0

I am developing a DAPP(Decentralized Application) using html, vanilla javascript(module system) for the frontend with these packages-

PACKAGES

@wagmi/core
@walletconnect/ethereum-provider
@walletconnect/modal
@web3modal/html
ethers
viem

PACKAGE BUNDLER

webpack
babel

I want the user to transfer USDT BEP-20 tokens to another account the Smart Contract is on Mainnet binance smart chain(BSC)

this is the code, that is being used to transfer tokens from front end

const transaction = wagmi.prepareSendTransaction({
    to: transferToAccount,
    value: viem.parseEther(transferAmount, "wei")
});

const {hash} = wagmi.sendTransaction(transaction);

this is the code to add into the block chain

const { request } = wagmi.prepareWriteContract({
    address: contractAddress,
    abi: abi,
    functionName: "addToBlockchain",
    args: [
    transferToAccount,
    viem.parseEther(transferAmount, "wei"),
    transferMessage,
    transferKeyword,
    ],
    });
const { hash }=wagmi.writeContract(request);

when user transfers some amount into another account it only transfers BNB token not USDT(BEP-20) I need help on how to achieve USDT(BEP-20) transfer to another account not BNB token`

TylerH
  • 20,799
  • 66
  • 75
  • 101
Roy_In
  • 11
  • 4

0 Answers0