tonSignMessage
Use requirement
Firmware version required
Touch: 4.10.0
TON: sign message
Sign a message or transaction using the private key derived by given BIP32 path. User needs to confirm the action on OneKey device.
const response = await HardwareSDK.tonSignMessage(connectId, deviceId, {
path: "m/44'/607'/0'",
destination: "UQBYkuShkZzRYAWX_HrK3kFpeAixiRKd-K7QBXYxl9OBXM0_",
tonAmount: 100,
seqno: 0,
expireAt: Date.now() + 1000 * 60 * 60 * 24,
walletVersion: 3,
isBounceable: false,
isTestnetOnly: false
});
Params
Required Parameters
path
โ requiredstring | Array<number>
minimum length is 3destination
โ requiredstring
destination addresstonAmount
โ requirednumber
amount of TON to transferseqno
โ requirednumber
sequence numberexpireAt
โ requirednumber
message expiration timestamp
Optional Parameters
walletVersion
โ optionalTonWalletVersion
TON wallet version (default: 3)isBounceable
โ optionalboolean
whether message is bounceable (default: false)isTestnetOnly
โ optionalboolean
whether to use testnet (default: false)jettonMasterAddress
โ optionalstring
Jetton master contract addressjettonAmount
โ optionalnumber
amount of jettons to transferfwdFee
โ optionalnumber
forward fee for jetton transfercomment
โ optionalstring
message commentmode
โ optionalnumber
message modeworkchain
โ optionalTonWorkChain
TON workchainwalletId
โ optionalnumber
wallet ID
Example
// Simple TON transfer
const response = await HardwareSDK.tonSignMessage(connectId, deviceId, {
path: "m/44'/607'/0'",
destination: "UQBYkuShkZzRYAWX_HrK3kFpeAixiRKd-K7QBXYxl9OBXM0_",
tonAmount: 100,
seqno: 0,
expireAt: Date.now() + 1000 * 60 * 60 * 24,
walletVersion: 3,
isBounceable: false,
isTestnetOnly: false
});
// Multiple Native
const jettonResponse = await HardwareSDK.tonSignMessage(connectId, deviceId, {
path: "m/44'/607'/0'",
destination: 'UQBYkuShkZzRYAWX_HrK3kFpeAixiRKd-K7QBXYxl9OBXM0_',
tonAmount: 100,
seqno: 0,
expireAt: Date.now() + 1000 * 60 * 60 * 24,
walletVersion: 3,
isBounceable: false,
isTestnetOnly: false,
extDestination: ['UQBYkuShkZzRYAWX_HrK3kFpeAixiRKd-K7QBXYxl9OBXM0_'],
extTonAmount: [100],
extPayload: ['48656c6c6f204f6e654b6579'],
});
Result
{
success: true,
payload: {
skip_validate: boolean; // Used to skip validation in classic 1s.
signature: string;
signning_message: string;
}
}
Error
{
success: false,
payload: {
error: string, // error message
code: number // error code
}
}
Last updated
Was this helpful?