跳到主要内容

polkadotSignTransaction

使用要求

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

Polkadot:签名交易

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

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

参数

可选通用参数

  • path - 必需 string | Array<number>,字符串数组最小长度限制为 3更多信息
  • network - 必需 string,网络名称;默认值为 polkadot
  • rawTx - 必需 string,序列化后的交易字符串。

示例

const rawTx =
"0501004a72c83ef5d1a69b3407f2d8ce1604b8a1f905bc37dc2e5a19480ab31d6c4f290800d12f6b1046013200bc2d000014000000b261f34904bd61f9e7d9f73706c4efaf5d2a74bc18d2de3fbe27461324e4531fd462b915ef68374ccbd31e8f5914adce20f86cd7de11a4b6d7c1f9e472a3c58a";

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

返回结果

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

错误

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