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

Optional common params

Required Parameters

  • pathrequired string | Array<number> minimum length is 3

  • destinationrequired string destination address

  • tonAmountrequired number amount of TON to transfer

  • seqnorequired number sequence number

  • expireAtrequired number message expiration timestamp

Optional Parameters

  • walletVersionoptional TonWalletVersion TON wallet version (default: 3)

  • isBounceableoptional boolean whether message is bounceable (default: false)

  • isTestnetOnlyoptional boolean whether to use testnet (default: false)

  • jettonMasterAddressoptional string Jetton master contract address

  • jettonAmountoptional number amount of jettons to transfer

  • fwdFeeoptional number forward fee for jetton transfer

  • commentoptional string message comment

  • modeoptional number message mode

  • workchainoptional TonWorkChain TON workchain

  • walletIdoptional number 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