suiSignTransaction
Sui:签名交易
使用指定 BIP32 路径派生的私钥对交易进行签名。用户需要在 Ukey Wallet 上核对交易目标、金额、费用等关键信息后确认。
const result = await HardwareSDK.suiSignTransaction(
connectId,
deviceId,
params,
);
参数
path- 必需string | Array<number>,字符串数组最小长度限制为3。更多信息rawTx- 必需string,序列化后的交易字符串。
rawTx 大小限制
- UKey Lite 24、UKey Lite 25、UKey Core 26 的固件版本低于 1.1.0 时,数据大小上限为 4KB。
- UKey Lite 24、UKey Lite 25、UKey Core 26 的固件版本大于或等于 1.1.0 时,数据大小上限为 6KB。
示例
const rawTx =
"5472616e73616374696f6e446174613a3a0007013eb4b557544a31b5b3a501945821686ce054742e1300000000000000318b8c6a54db5c0b3381440b8d7eec563d80808b29a8402169c5bd18b25e33f1b6029dc25b8b42932aa3b1009f42fa98819da7f483b71251531f10000000000d79422d819a29c37fb96c5efe97a88cb092197983eb4b557544a31b5b3a501945821686ce054742e1300000000000000318b8c6a54db5c0b3381440b8d7eec563d80808b29a8402169c5bd18b25e33f1b602000000000000008b00000000000000";
const response = await HardwareSDK.suiSignTransaction(connectId, deviceId, {
path: "m/44'/784'/1'/0'/0'",
rawTx: rawTx,
});
返回结果
{
success: true,
payload: {
path: "m/44'/784'/1'/0'/0'", // 派生路径
public_key: string, // 返回的公钥
signature: string // 签名结果
}
}
错误
{
success: false,
payload: {
error: string, // 错误消息
code: number // 错误码
}
}