Auf dieser Seite
API-Referenz
Referenz der Methoden und grundlegenden Typen auf window.$onekey.stellar.
Methoden
| Methode | Beschreibung |
|---|---|
getAddress(params?) | Berechtigung anfordern (verbinden) und die aktuelle Stellar-Adresse zurückgeben |
getNetwork() | Aktuelle Netzwerkinformationen abrufen |
signTransaction(xdr, opts?) | Eine Stellar-Transaktion als XDR signieren |
signAuthEntry(authEntry, opts?) | Einen Stellar-Autorisierungseintrag signieren (XDR des Autorisierungseintrags) |
signMessage(message, opts?) | Eine beliebige Nachricht signieren |
Eigenschaften
| Eigenschaft | Typ | Beschreibung |
|---|---|---|
isOneKey | boolean | OneKey-Kennung |
Typen
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
}Grundlegender Typ (als Referenz)
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>
}Alle Methoden geben Promises zurück. Behandeln Sie abgelehnte Anfragen und behandeln Sie das optionale signerAddress als optional, statt sein Vorhandensein anzunehmen. Der Provider stellt außerdem disconnect() bereit und löst accountsChanged mit einer Adresszeichenfolge oder null aus; löschen Sie kontospezifische Zustände bei Änderungen.
Zuletzt aktualisiert am