File tree 1 file changed +9
-11
lines changed
1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -157,29 +157,27 @@ export class NearArchiveWatcher extends Watcher {
157
157
endingTimestamp : string
158
158
) : Promise < NearTxn [ ] > {
159
159
console . log ( `Fetching transactions in range [${ beginningTimestamp } , ${ endingTimestamp } ]...` ) ;
160
- let txs : NearTxn [ ] = [ ] ;
160
+ const txs : NearTxn [ ] = [ ] ;
161
161
let done : boolean = false ;
162
162
163
163
let page = 1 ;
164
164
while ( ! done ) {
165
- console . log ( `Fetching transactions for page ${ page } ...` ) ;
165
+ this . logger . debug ( `Fetching transactions for page ${ page } ...` ) ;
166
166
// https://api3.nearblocks.io/v1/account/contract.wormhole_crypto.near/txns?method=publish_message&order=desc&page=1&per_page=25
167
- const res = (
168
- await axios . get (
169
- `https://api3.nearblocks.io/v1/account/${ accountId } /txns?method=publish_message&order=desc&page=${ page } &per_page=25` ,
170
- AXIOS_CONFIG_JSON
171
- )
172
- ) . data as GetTransactionsByAccountIdResponse ;
167
+ const res = await axios . get < GetTransactionsByAccountIdResponse > (
168
+ `https://api3.nearblocks.io/v1/account/${ accountId } /txns?method=publish_message&order=desc&page=${ page } &per_page=25` ,
169
+ AXIOS_CONFIG_JSON
170
+ ) ;
173
171
// console.log(`Fetched ${JSON.stringify(res)}`);
174
172
page ++ ;
175
- for ( const tx of res . txns ) {
173
+ for ( const tx of res . data . txns ) {
176
174
// Need to pad the timestamp to 19 digits to match the timestamp format in the NearTxn object.
177
175
const paddedTimestamp : number = Number ( tx . block_timestamp . padEnd ( 19 , '0' ) ) ;
178
- console . log (
176
+ this . logger . debug (
179
177
`Checking transaction ${ tx . transaction_hash } at block timestamp ${ tx . block_timestamp } ...`
180
178
) ;
181
179
if ( paddedTimestamp >= beginningTimestamp && paddedTimestamp <= Number ( endingTimestamp ) ) {
182
- console . log (
180
+ this . logger . debug (
183
181
`Transaction ${ tx . transaction_hash } at block ${ paddedTimestamp } is in range of [${ beginningTimestamp } , ${ endingTimestamp } ].`
184
182
) ;
185
183
txs . push ( tx ) ;
You can’t perform that action at this time.
0 commit comments