evmSignTransaction
Ethereum: Sign transaction
Use
evmSignTransactionfor signing transactionsSupports both EIP-1559 and Legacy transactions. (But make sure that the RPC node you are using supports the type you are using)
Asks device to sign given transaction using the private key derived by given BIP32 path. User is asked to confirm all transaction details on OneKey.
const result = await HardwareSDK.evmSignTransaction(connectId, deviceId, params);Params
path- requiredstring | Array<number>minimum length is3. read moretransaction- requiredObjecttype ofEthereumTransactionEIP1559|EthereumSignTransaction"0x" prefix for each field is optionalchainId- optionalnumberThe ChainId in ETH is a unique identifier for a specific Ethereum network, used to distinguish different versions of the blockchain. Reference.
Examples
EIP1559 (after The London Upgrade)
If both parameters maxFeePerGas and maxPriorityFeePerGas are defined, transaction will be signed as the new type introduced in EIP1559.
HardwareSDK.evmSignTransaction(connectId, deviceId, {
path: "m/44'/60'/0'",
transaction: {
to: '0xd0d6d6c5fe4a677d343cc433536bb717bae167dd',
value: '0xf4240',
data: '0xa',
chainId: 1,
nonce: '0x0',
maxFeePerGas: '0x14',
maxPriorityFeePerGas: '0x0',
gasLimit: '0x14',
},
chainId: 1
});Legacy
Result
Error
Transaction Signing and Broadcasting example
Last updated
Was this helpful?