Skip to content

Commit 6797b01

Browse files
committed
Support multiple txids in update script
1 parent 9621241 commit 6797b01

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

scripts/updateForTxId.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
import { updateDbFromEthTransaction } from "../utils";
22

3-
// This is a command line script that accepts a txid as an argument and updates the database with the
4-
// attestations/schemas from the transaction
3+
// This is a command line script that accepts either a single txid or a comma-separated list of txids
4+
// as an argument and updates the database with the attestations/schemas from the transaction(s)
55

6-
const txid = process.argv[2];
6+
const input = process.argv[2];
77

8-
if (!txid) {
9-
console.error("Please provide a transaction id");
8+
if (!input) {
9+
console.error("Please provide a transaction id or a comma-separated list of transaction ids");
1010
process.exit(1);
1111
}
1212

13-
updateDbFromEthTransaction(txid)
13+
const txids = input.split(',').map(txid => txid.trim());
14+
15+
Promise.all(txids.map(updateDbFromEthTransaction))
1416
.then(() => {
1517
console.log("Success");
1618
process.exit(0);
1719
})
1820
.catch((e) => {
1921
console.error("Error", e);
2022
process.exit(1);
21-
});
23+
});

0 commit comments

Comments
 (0)