跳到主要内容

alephiumSignTransaction

使用要求

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

Alephium:签名交易

使用指定 BIP32 路径派生的私钥签名 Alephium 交易,用户需要在 Ukey Wallet 设备上确认操作。

const result = await HardwareSDK.alephiumSignTransaction(connectId, deviceId, {
path: "m/44'/1234'/1'/0/0",
rawTx:
"00010080004e20c1174876e80001f3bf9d774d87e65e79a72d5482da5ef35aac8d0b930b394bdd67586930f6ae7b4fd8362b0003f6bd3137b3cadbad59a73527c3b8e26429bba093722a59639f22af9d2adb477302c40de0b6b3a7640000001e98167f559360e002c3f3ceb3cc95c1dad848403f0296c76439093d2b9879ac00000000000000000000c43c7a13049ed60800001e98167f559360e002c3f3ceb3cc95c1dad848403f0296c76439093d2b9879ac00000000000000000000",
});

参数

可选通用参数

  • path - 必需 string | Array<number>,字符串数组最小长度限制为 3
  • rawTx - 必需 string,十六进制格式的原始交易。
  • scriptOpt - 可选 string,脚本类型选项。

示例

const response = await HardwareSDK.alephiumSignTransaction(
connectId,
deviceId,
{
path: "m/44'/1234'/2'/0/0",
rawTx: "0x0456abcd7890ef12",
scriptOpt: "p2mpkh",
},
);

返回结果

{
success: true,
payload: {
signature: string, // 签名结果
address: string, // 返回的地址
}
}

错误

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