Transactions
Send transactions on Conflux using OneKey
Learn how to send transactions on Conflux.
Send Transaction
const txHash = await provider.request({
method: 'cfx_sendTransaction',
params: [{
from: senderAddress,
to: recipientAddress,
value: '0xDE0B6B3A7640000', // 1 CFX in Drip (hex)
gas: '0x5208', // 21000
}]
})
console.log('Transaction hash:', txHash)Send with Gas Estimation
// Estimate gas first
const gasEstimate = await provider.request({
method: 'cfx_estimateGasAndCollateral',
params: [{
from: senderAddress,
to: recipientAddress,
value: '0xDE0B6B3A7640000',
}]
})
// Send with estimated values
const txHash = await provider.request({
method: 'cfx_sendTransaction',
params: [{
from: senderAddress,
to: recipientAddress,
value: '0xDE0B6B3A7640000',
gas: gasEstimate.gasLimit,
storageLimit: gasEstimate.storageCollateralized,
}]
})Call Contract
Using with js-conflux-sdk
Setup
Connect Provider
Send Transaction with SDK
Contract Interaction
Error Handling
Last updated
Was this helpful?