CRYPTO NEWS

How to send custom token with MetaMask API?

I want to select a custom token from the metamasks when init eth_sendTransaction, and offer to transfer the custom token, not the ether, the custom token has already been added via

method: ‘wallet_watchAsset’

How to do it? Thx!

sendEthButton.addEventListener('click', () => {     ethereum       .request({         method: 'eth_sendTransaction',         params: [{           from: ethereum.selectedAddress,           to: receiverAddress,           value: '0x29a2241af62c0000',           gasPrice: '0x09184e72a000',           gas: '0x2710',           data: '', // I understand that something needs to be added here, but what?         }],       })       .then((txHash) => console.log(txHash))       .catch((error) => console.error);   }); 

How to send custom token with MetaMask API?

Shopping cart
There are no products in the cart!
Continue shopping
0