File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 11import { 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+ } ) ;
You can’t perform that action at this time.
0 commit comments