tronSignTransaction

TRON: Sign transaction

Asks device to sign given transaction. User is asked to confirm all transaction details on OneKey.

const response = await HardwareSDK.tronSignTransaction(connectId, deviceId, params)

Params

Optional common params

  • path — required string | Array<number> minimum length is 3. read more

  • transaction - required TronTransaction type

TronTransaction Type

type TronTransaction = {
  refBlockBytes: string;
  refBlockHash: string;
  expiration: number;
  data?: string;
  contract: TronTransactionContract;
  timestamp: number;
  feeLimit?: number;
};

type TronTransactionContract = {
  transferContract?: TronTransferContract;
  triggerSmartContract?: TronTriggerSmartContract;
};

type TronTransferContract = {
  toAddress?: string;
  amount?: UintType;
};

type TronTriggerSmartContract = {
  contractAddress?: string;
  callValue?: number;
  data?: string;
  callTokenValue?: number;
  assetId?: number;
};

Example

HardwareSDK.tronSignTransaction(connectId, deviceId, {
    path: "m/44'/195'/0'/0'/0",
    transaction: {
        refBlockBytes: 'ddf1',
        refBlockHash: 'd04764f22469a0b8',
        timestamp: 1655692083406,
        expiration: 1655692140000,
        contract: {
            transferContract: {
                toAddress: 'TXrs7yxQLNzig7J9EbKhoEiUp6kWpdWKnD',
                amount: 100,
            },
        }
    }
});

Result

{
    success: true,
    payload: {
        signature: string;
        serialized_tx: string;
    }
}

Error

{
    success: false,
    payload: {
        error: string, // error message
        code: number // error code
    }
}

Last updated