API说明
这里列出 window.$ukey.stellar 的常用方法和基础类型。业务代码应根据当前网络和地址选择对应的签名方法。
方法集
| 方法 | 说明 |
|---|---|
getAddress(params?) | 请求授权并返回当前 Stellar 地址 |
getNetwork() | 读取当前网络和 network passphrase |
signTransaction(xdr, opts?) | 签名 Stellar 交易 XDR |
signAuthEntry(authEntry, opts?) | 签名 Stellar Auth Entry XDR |
signMessage(message, opts?) | 签名链下消息 |
属性
| 属性 | 类别 | 说明 |
|---|---|---|
isUKey | boolean | UKey Wallet Provider 标识 |
类型集
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;
};
基础类型(仅供参考)
export type UKeyStellarProvider = {
isUKey: boolean;
// 与 Stellar Wallets Kit(KitActions)的定义保持一致
getAddress: (
requestParams?: 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>;
};