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
2 Answers
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.
-
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– DasappanCommented Oct 11, 2022 at 13:28
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.
- Install
$ npm i 0xweb -g
- If the contract is validated at https://bscscan.com/ install the contract locally by address
$ 0xweb install 0x... --name MyClaimContract --chain bsc
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
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.
- Install dequanto libraries
$ 0xweb init
- 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();
- Execute the script
$ npx atma run claims.ts