Skip to content
Discussion options

You must be logged in to vote

After some research I found solution

    const abi= new ethers.utils.Interface([
        'function transfer(address recipient, uint256 amount)',
        'function balanceOf(address owner) view returns (uint)'
    ]);
 

    const contractAddress = 'CONTRACT_ADDRESS';
    const provider = new BscscanProvider("bsc-mainnet")
    const myWallet = new ethers.Wallet(
        'PRIVATE_KEY',
        provider
    )
    const contract = new ethers.Contract(contractAddress , abi, provider);
    const balance = await contract.balanceOf(myWallet.address) 

    const tx = await contract.populateTransaction.transfer(
        RECIPIENTS_ADDRESS,
        balance
    )

    tx.gasPrice = ethers.utils.parse…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Unintendedz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant