Как отправить в метасак транзакцию со своим токеном?
При отправке транзакции в metamask для подписи, туда не приходит asset(монета). Я думаю что дело в data, наверное я ее неправильно создаю. Как мне отправить транзакцию со своей монетой в метамаск
const web3 = new Web3("https://data-seed-prebsc-1-s1.binance.org:8545")
connectMetaMask = async () => {
if (typeof window.ethereum != "undefined") {
console.log('MetaMask is installed!');
account = await ethereum.request({method: 'eth_requestAccounts'}, (data) => {
return data;
});
} else {
document.getElementById("main_metamask").style.display = ''
}
}
async function Test_tr() {
web3.eth.defaultAccount = account;
const tx_to_data = contract_POSI.methods.transfer(main_adress, "19");
const data = tx_to_data.encodeABI();
const nonce = await web3.eth.getTransactionCount(account);
const gas = await tx_to_data.estimateGas({from: account});
const gasPrice = await web3.eth.getGasPrice();
const txHash = await ethereum.send({
method: 'eth_sendTransaction',
params: [
{
from: account,
to: main_adress,
data: data,
gas: gas.toString(),
gasPrice: gasPrice.toString(),
nonce: nonce.toString(),
}
],
id: "1"
},(response)=>{
console.log(response)
})
}