3

There is an online shopping app written in Flutter, right now, this app can connects to the Metamask wallet using walletConnect_dart package. It gets user's account address. The goal is to pay with USDT. I want customers pay as less transaction fees as possible and for now I've selected BSC network.

User after hitting checkout button, should be redirected to Metamask and sign the transaction fot transfering USDT, so the USDT will transfer to the shop owner's wallet address.

I don't have any contract or ABI Or wallet private key to put inside code. I want user to accept the transaction through non-cutodial Metamask wallet.

I've used this source code to connect to Metamask with WalletConnect. https://github.com/BhaskarDutta2209/FlutterAppWithMetamask

1 Answer 1

1

you can get contract Abi from https://bscscan.com/token/0x2b90e061a517db2bbd7e39ef7f733fd234b494ca#code

use web3dart package to get data param

final contract = DeployedContract(
      ContractAbi.fromJson(contractAbi, cryptoSymbol),
      EthereumAddress.fromHex(contractAddress),
    );

    final encoded =
      contract.function("transfer").encodeCall([EthereumAddress.fromHex(to), value]);

contractAbi is map cryptoSymbol USDT in your case to is receipt address (where you want to send USDT/BUSD)

once you get data from abi you should send trx to contract address of USDT on binance chain

to should be contractAddress and do not send value param when sending a token

return {
          'from': from,
          'to': contractAddress,
          'data': '0x${contractData.asciiToHex()}',
        };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.