I want to create a donate link that will allow the user to click and send .01 in BNB or .01 in a BEP20 contract.

I've gotten this far with BNB:

document.querySelector('.bnb-tip').addEventListener('click', function() {

  var transactionHash = window.ethereum.request({
    method: 'eth_sendTransaction',
    params: [
        to: '0xRECIPIETADDRESS',
        from: window.ethereum.selectedAddress,
        value: Web3.utils.toHex(Web3.utils.toWei("0.01")),

It works although in the MetaMask confirmation it says I am sending ether, which it should ideally say BNB.

On the other hand, I can't figure out how to send BEP20 tokens.

I would have rather not used Web3.js, but I had to for the hex function. Maybe Web3 will help send the BEP20 token as well?

Thanks for any attention

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.