i am trying to integrate Metamask for payments in my websites. I have done it so far, unfortunately, I don't know how to change the cryptocurrency to be USDT on Binance chain. In the code I have defined the chainId for Binance chain, but don't know how to create the contractData.
I will appreciate any help!
payNow: async (ethereum, from) => {
var amount = $('#inp_amount').val();
try {
await ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0x38' }],
});
// contractData = 'USDT + AMOUNT';
ethereum
.request({
method: 'eth_sendTransaction',
params: [{
from: from,
to: "{{ $user->eth_address }}",
gas: '0x76c0', // 30400
gasPrice: '0x9184e72a000', // 10000000000000
data: contractData,
chainId: '0x38',
}],
})
.then((txHash) => {
if (txHash) {
console.log(txHash);
storeTransaction();
} else {
console.log("Something went wrong. Please try again");
}
})
.catch((error) => {
// for testing
// storeTransaction();
console.log(error);
});
}
catch (switchError) {
console.log(error);
}
},