集成Bitget钱包
const provider = window.bitkeep.ethereum
连接钱包
window.bitkeep.ethereum.enable()
构造交易信息
const transactionParameters = {
nonce: '0x00', // Bitkeep 会忽略此字段
gasPrice: '0x09184e72a000', // 用户在 Bitkeep 确认时可自定义
gas: '0x2710', // 用户在 Bitkeep 确认时可自定义
to: '0x0000000000000000000000000000000000000000', // 除了在合约发布时,必须填写
from: Provider.selectedAddress, // 必须与用户当前激活的地址一致
value: '0x00', // 仅在需要从发起账户向接收方发送 ETH 时必填
data:
'0x7f7465737432000000000000000000000000000000000000000000000000000000600057', // 可选,用于定义合约创建或交互
chainId: '0x3', // 用于防止跨链重放交易,由 Bitkeep 自动填充
};
签名和广播
const txHash = await Provider.request({
method: 'eth_sendTransaction',
params: [transactionParameters],
});
Last updated on