跳到主要内容

cosmosSignTransaction

使用要求

  • 固件版本要求
    • UKey Lite 24 / UKey Lite 25: 1.1.0
    • UKey Core 26: 1.1.0

Cosmos:签名交易

使用指定 BIP32 路径派生的私钥对交易进行签名。用户需要在 Ukey Wallet 上核对交易目标、金额、费用等关键信息后确认。

const result = await HardwareSDK.cosmosSignTransaction(
connectId,
deviceId,
params,
);

参数

可选通用参数

  • path - 必需 string | Array<number>,字符串数组最小长度限制为 3更多信息
  • rawTx - 必需 string,序列化后的交易字符串。

示例

const rawTx =
"4f1a9c72b5d3448ea6712fd8c9830ab54d3f8e291c74bb6a85f12c7e904ad632b74ec1a930d64be8f2510c6d3e9ab48216cd7f34be2198ad50c17be420f8d6a53970c2b84f16de738aa5c4019bd257ce03f18a64bd7f2091ce58fb34ad7825e1";

const response = await HardwareSDK.cosmosSignTransaction(connectId, deviceId, {
path: "m/44'/118'/1'/0/0",
rawTx: rawTx,
});

返回结果

{
success: true,
payload: {
path: "m/44'/118'/1'/0/0", // 派生路径
signature: string // 签名结果
}
}

错误

{
success: false,
payload: {
error: string, // 错误消息
code: number // 错误码
}
}