发送交易
const transactionParameters = {
nonce: '0x00', // ignored by TokenPocket Extension
gasPrice: '0x09184e72a000', // customizable by user during TokenPocket Extension confirmation.
gas: '0x2710', // customizable by user during TokenPocket Extension confirmation.
to: '0x0000000000000000000000000000000000000000', // Required except during contract publications.
from: ethereum.selectedAddress, // must match user's active address.
value: '0x00', // Only required to send ether to the recipient from the initiating external account.
data:
'0x7f7465737432000000000000000000000000000000000000000000000000000000600057', // Optional, but used for defining smart contract creation and interaction.
chainId: '0x3', // Used to prevent transaction reuse across blockchains. Auto-filled by TokenPocket Extension.
};
// txHash is a hex string
// As with any RPC call, it may throw an error
const txHash = await ethereum.request({
method: 'eth_sendTransaction',
params: [transactionParameters],
});交易参数
Nonce [忽略]
Gas Price [可选]
Gas Limit [可选]
To [半可选]
Value [可选]
Data [半可选]
Chain ID [当前忽略]
Last updated