En esta página
Referencia de la API
Referencia de métodos y tipos básicos de window.$onekey.stellar.
Métodos
| Método | Descripción |
|---|---|
getAddress(params?) | Solicitar permiso (conectar) y devolver la dirección de Stellar actual |
getNetwork() | Obtener información de la red actual |
signTransaction(xdr, opts?) | Firmar el XDR de una transacción de Stellar |
signAuthEntry(authEntry, opts?) | Firmar una entrada de autorización de Stellar (XDR de la entrada de autorización) |
signMessage(message, opts?) | Firmar un mensaje arbitrario |
Propiedades
| Propiedad | Tipo | Descripción |
|---|---|---|
isOneKey | boolean | Identificador de OneKey |
Tipos
export type StellarGetAddressParams = { path?: string }
export type StellarGetAddressResponse = { address: string }
export type StellarNetworkInfo = {
network: string
networkPassphrase: string
}
export type StellarSignTransactionOpts = {
networkPassphrase?: string
address?: string
path?: string
submit?: boolean
submitUrl?: string
}
export type StellarSignTransactionResponse = {
signedTxXdr: string
signerAddress?: string
}
export type StellarSignAuthEntryOpts = {
networkPassphrase?: string
address?: string
path?: string
}
export type StellarSignAuthEntryResponse = {
signedAuthEntry: string
signerAddress?: string
}
export type StellarSignMessageOpts = {
networkPassphrase?: string
address?: string
path?: string
}
export type StellarSignMessageResponse = {
signedMessage: string
signerAddress?: string
}Tipo básico (como referencia)
export type OneKeyStellarProvider = {
isOneKey: boolean
// Align with Stellar Wallets Kit (KitActions)
getAddress: (params?: StellarGetAddressParams) => Promise<StellarGetAddressResponse>
getNetwork: () => Promise<StellarNetworkInfo>
signTransaction: (
xdr: string,
opts?: StellarSignTransactionOpts
) => Promise<StellarSignTransactionResponse>
signAuthEntry: (
authEntry: string,
opts?: StellarSignAuthEntryOpts
) => Promise<StellarSignAuthEntryResponse>
signMessage: (
message: string,
opts?: StellarSignMessageOpts
) => Promise<StellarSignMessageResponse>
}Todos los métodos devuelven promesas. Gestiona las solicitudes rechazadas y trata el campo opcional signerAddress como tal, sin asumir que esté presente. El proveedor también ofrece disconnect() y emite accountsChanged con una cadena de dirección o null; borra el estado específico de la cuenta cuando cambie.
Última actualización el