Skip to content

Commit c6578a5

Browse files
committed
watcher: ci fixes
1 parent 092dc12 commit c6578a5

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

watcher/src/watchers/NearArchiveWatcher.ts

+9-11
Original file line numberDiff line numberDiff line change
@@ -157,29 +157,27 @@ export class NearArchiveWatcher extends Watcher {
157157
endingTimestamp: string
158158
): Promise<NearTxn[]> {
159159
console.log(`Fetching transactions in range [${beginningTimestamp}, ${endingTimestamp}]...`);
160-
let txs: NearTxn[] = [];
160+
const txs: NearTxn[] = [];
161161
let done: boolean = false;
162162

163163
let page = 1;
164164
while (!done) {
165-
console.log(`Fetching transactions for page ${page}...`);
165+
this.logger.debug(`Fetching transactions for page ${page}...`);
166166
// 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+
);
173171
// console.log(`Fetched ${JSON.stringify(res)}`);
174172
page++;
175-
for (const tx of res.txns) {
173+
for (const tx of res.data.txns) {
176174
// Need to pad the timestamp to 19 digits to match the timestamp format in the NearTxn object.
177175
const paddedTimestamp: number = Number(tx.block_timestamp.padEnd(19, '0'));
178-
console.log(
176+
this.logger.debug(
179177
`Checking transaction ${tx.transaction_hash} at block timestamp ${tx.block_timestamp}...`
180178
);
181179
if (paddedTimestamp >= beginningTimestamp && paddedTimestamp <= Number(endingTimestamp)) {
182-
console.log(
180+
this.logger.debug(
183181
`Transaction ${tx.transaction_hash} at block ${paddedTimestamp} is in range of [${beginningTimestamp}, ${endingTimestamp}].`
184182
);
185183
txs.push(tx);

0 commit comments

Comments
 (0)