tonGetAddress
使用要求
- 固件版本要求
- UKey Lite 24 / UKey Lite 25 / UKey Core 26: 1.1.0
TON:获取地址
根据传入的 BIP32 路径派生地址,并把结果返回给调用方。开启设备展示时,用户需要在 Ukey Wallet 上核对并确认导出该地址。
const response = await HardwareSDK.tonGetAddress(connectId, deviceId, params);
参数
导出单个地址
path- 必需string | Array<number>,字符串数组最小长度限制为3。更多信息showOnUKey- 可选boolean,决定是否在设备上进行地址显示;默认值为true。walletVersion- 可选TonWalletVersion,TON 钱包版本;默认值为3。isBounceable- 可选boolean,决定地址是否可弹回;默认值为false。isTestnetOnly- 可选boolean,决定是否使用测试网;默认值为false。
导出批量地址
bundle-Array数组对象,包含path和showOnUKey字段。
示例
// 获取单个地址
const response = await HardwareSDK.tonGetAddress(connectId, deviceId, {
path: "m/44'/607'/1'",
showOnUKey: false,
walletVersion: 3,
isBounceable: false,
isTestnetOnly: false,
});
// 获取多个地址
const batchResponse = await HardwareSDK.tonGetAddress(connectId, deviceId, {
bundle: [
{
path: "m/44'/607'/3'",
showOnUKey: false,
}, // 第4个派生账户路径
{
path: "m/44'/607'/4'",
showOnUKey: false,
}, // 第5个派生账户路径
{
path: "m/44'/607'/5'",
showOnUKey: false,
}, // 第6个派生账户路径
],
});
返回结果
单个地址返回示例
{
success: true,
payload: {
address: string, // 返回的地址
publicKey: string, // 返回的公钥
path: Array<number>, // 派生路径
}
}
批量地址返回示例(顺序与请求一致)
{
success: true,
payload: [
{ address: string, publicKey: string, path: Array<number> }, // 第4个派生账户路径
{ address: string, publicKey: string, path: Array<number> }, // 第5个派生账户路径
{ address: string, publicKey: string, path: Array<number> } // 第6个派生账户路径
]
}
错误
{
success: false,
payload: {
error: string, // 错误消息
code: number // 错误码
}
}