0

I want to connect my different eth wallets to a contract and I want to claim the token from that contract from different wallets at the same time. do anyone knows how can I do this one? Please help me in this

1
  • Use something like Metamask, it allows importing several private keys, and switching between the accounts. If you really want to do it at the same time you have to write a script.
    – Ismael
    Commented Oct 12, 2022 at 5:38

2 Answers 2

0

You can’t control when your transaction is being mined. In addition, Etherium is deterministic so no two actions will happen at the same time.

1
  • actually i want to do this on bnb chain, the thing is that I have multiple wallets in the bnb chain and so I want to use a claim option and claim the token from multiple wallets, so I want to know is there any way I can claim from multiple wallets automatically using any script or something like that instead of doing it manually
    – Dasappan
    Commented Oct 11, 2022 at 13:28
0

You can use 0xweb CLI tool to send transactions via the Command Line, as such you could send multiple claim transactions at once. How to execute multiple cli commands at once, you could search online regarding your system, setup, or tools.

  1. Install
$ npm i 0xweb -g
  1. If the contract is validated at https://bscscan.com/ install the contract locally by address
$ 0xweb install 0x... --name MyClaimContract --chain bsc
  1. Find out the method you have to execute in the contract. You can see that either from bscscan or by running $ 0xweb contract abi MyClaimContract --chain bsc

  2. Assume the method is called claim with no parameters, then the send transaction would be:

$ 0xweb contract write MyClaimContract claim --chain bsc --account 0xYOUR_KEY

You can also write a script to do this.

  1. Install dequanto libraries
$ 0xweb init
  1. Create the script in file claims.ts
import { MyClaimContract } from '@0xweb/bsc/MyClaimContract/MyClaimContract';
import { Config } from '@dequanto/Config';


async function executeClaims () {
    await Config.fetch();

    // get your wallet keys
    let keys: string[] = [];
    let claimContract = new MyClaimContract();


    let promises = keys.map(async key => {
        let account = { key };
        let writer = await claimContract.claim(account);
        return writer.wait();
    });

    let receipts = await Promise.all(promises);
    console.log(`Transactions completed`, receipts.map(receipt => receipt.transactionHash))
}

executeClaims();
  1. Execute the script
$ npx atma run claims.ts

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.