Skip to Content
硬件接入
本页目录

xrpSignTransaction

Ripple:签名交易

请求交易签名。用户在设备上核对并确认请求。

const response = await HardwareSDK.xrpSignTransaction(connectId, deviceId, params)

参数

可选通用参数

  • path - 必需 string | Array<number> SDK 校验的最小长度为 5。 路径格式
  • transaction - 必需 XrpTransaction 类型

XrpTransaction 类型

type XrpTransaction = { fee: string; flags?: number; sequence: number; maxLedgerVersion?: number; // Proto: "last_ledger_sequence" payment: XrpPayment; } type XrpPayment = { amount: number; destination: string; destinationTag?: number; }

当前 SDK 运行时接收 { path, transaction },并将 transaction.payment.amount 校验为数字。导出的 TypeScript 声明与该运行时结构不一致。以下示例遵循运行时接口;编译接入代码前,请检查所安装 SDK 版本的声明。金额单位为 drops。不要为了满足错误的声明而将 transaction 字段移到顶层。

示例

HardwareSDK.xrpSignTransaction(connectId, deviceId, { path: "m/44'/144'/0'/0/0", transaction: { fee: '12', flags: 0, sequence: 32841006, maxLedgerVersion: 32841630, payment: { amount: 1000000, destination: 'rwgumKP89VhMrJ4dRkGVS4tafRfAmZmKf8', } } });

返回结果

{ success: true, payload: { signature: string; serializedTx: string; } }

错误

{ success: false, payload: { error: string, // error message code?: string | number // error code } }
最后更新于