Skip to Content
硬件接入
本页目录

alephiumGetAddress

使用要求

  • 最低固件版本
    • Touch: 4.10.0

Alephium:获取地址

派生并返回指定路径的地址。showOnOneKey 为 true 时,用户必须在设备上确认地址。

const result = await HardwareSDK.alephiumGetAddress(connectId, deviceId, { path: "m/44'/1234'/0'/0/0", showOnOneKey: false, group: 0, includePublicKey: true });

参数

可选通用参数

导出单个地址

  • path - 必需 string | Array<number> SDK 校验的最小长度为 3。
  • group - 必需 number | undefined | null。传 undefined 使用组 0,传 null 不指定目标组。
  • includePublicKey - 可选 boolean 返回 pub 及其 publicKey 别名,默认 false。
  • showOnOneKey - 可选 boolean。是否在设备上显示地址,默认为 true。

导出批量地址

  • bundle - 包含 path、showOnOneKey 和 group 字段的对象 Array

示例

// Get single address const response = await HardwareSDK.alephiumGetAddress(connectId, deviceId, { path: "m/44'/1234'/0'/0/0", showOnOneKey: true, group: undefined }); // Get multiple addresses const batchResponse = await HardwareSDK.alephiumGetAddress(connectId, deviceId, { bundle: [ { path: "m/44'/1234'/0'/0/0", showOnOneKey: false, group: undefined }, { path: "m/44'/1234'/1'/0/0", showOnOneKey: false, group: undefined } ] });

返回结果

单个地址响应

{ success: true, payload: { address: string, // displayed address derivedPath: string, pub?: string, publicKey?: string, path: string // serialized BIP32 path } }

批量响应,顺序与请求一致

{ success: true, payload: [ { address: string, derivedPath: string, pub?: string, publicKey?: string, path: string }, // account 1 { address: string, derivedPath: string, pub?: string, publicKey?: string, path: string }, // account 2 { address: string, derivedPath: string, pub?: string, publicKey?: string, path: string } // account 3 ] }

错误

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