mirror of
https://github.com/status-im/keycard-redeem.git
synced 2025-02-17 06:27:29 +00:00
avoid parallel tx execution
This commit is contained in:
parent
5d9e3bcb6c
commit
827965e8eb
@ -76,11 +76,11 @@ async function createGift(sender, bucket, keycard) {
|
|||||||
let methodCall = GiftBucket.methods.createGift(keycard.keycard, keycard.amount, keycard.code);
|
let methodCall = GiftBucket.methods.createGift(keycard.keycard, keycard.amount, keycard.code);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await sendMethod(methodCall, sender, GiftBucket.options.address);
|
let receipt = await sendMethod(methodCall, sender, GiftBucket.options.address);
|
||||||
return true;
|
return receipt;
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,9 @@ async function run() {
|
|||||||
if (argv["file"]) {
|
if (argv["file"]) {
|
||||||
let file = fs.readFileSync(argv["file"], 'utf8');
|
let file = fs.readFileSync(argv["file"], 'utf8');
|
||||||
keycards = file.split("\n").map(processLine);
|
keycards = file.split("\n").map(processLine);
|
||||||
await Promise.all(keycards.map((keycard) => createGift(sender, bucket, keycard)));
|
for (let keycard of keycards) {
|
||||||
|
await createGift(sender, bucket, keycard)
|
||||||
|
}
|
||||||
} else if (!hasDoneSomething) {
|
} else if (!hasDoneSomething) {
|
||||||
console.error("the --file option must be specified");
|
console.error("the --file option must be specified");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user