Skip to content

SHARD-2024: Add typing to extracted methods #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
import crypto from 'crypto'
import { completeReadableReceipt } from '../external/Collector'
import axios, { AxiosError } from 'axios'
import NestedCounters from '../utils/nestedCounters'

interface BuildGetTransactionByBlockHashAndIndex {
nestedCountersInstance: any
ensureArrayArgs: any
countFailedResponse: any
nestedCountersInstance: NestedCounters
ensureArrayArgs: (args: RequestParamsLike, callback: JSONRPCCallbackTypePlain) => boolean
countFailedResponse: (api: string, reason: string) => void
logEventEmitter: any

Check warning on line 11 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
firstLineLogs: any
firstLineLogs: boolean
collectorAPI: any

Check warning on line 13 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
extractTransactionObject: any

Check warning on line 14 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
countSuccessResponse: any

Check warning on line 15 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
config: any

Check warning on line 16 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
verbose: any
errorBusy: any
verbose: boolean
errorBusy: { code: number; message: string }
}

export const buildGetTransactionByBlockHashAndIndex = ({
Expand Down Expand Up @@ -54,11 +55,11 @@
let result: string | completeReadableReceipt | null | undefined = null

try {
const blockResp = await collectorAPI.getBlock((args as any)[0], 'hash', true)

Check warning on line 58 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
result = blockResp?.transactions[Number((args as any)[1])]

Check warning on line 59 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
if (result) {
if (typeof result === 'object' && result.transactionIndex && (args as any)[1] !== undefined) {

Check warning on line 61 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
const transactionIndex = parseInt((args as any)[1], 16)

Check warning on line 62 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
if (!isNaN(transactionIndex)) {
result.transactionIndex = '0x' + transactionIndex.toString(16)
}
Expand All @@ -73,7 +74,7 @@
countFailedResponse(api_name, 'exception in collectorAPI.getBlock')
logEventEmitter.emit('fn_end', ticket, { success: false }, performance.now())
}
const blockHash = (args as any)[0]

Check warning on line 77 in src/eth-handlers/eth_getTransactionByBlockHashAndIndex.ts

View workflow job for this annotation

GitHub Actions / ci / QA merge checks

Unexpected any. Specify a different type
const index = parseInt((args as any)[1], 16)
//if (blockHash !== 'latest') blockHash = parseInt(blockHash, 16)
if (config.queryFromValidator && config.queryFromExplorer) {
Expand Down
13 changes: 7 additions & 6 deletions src/eth-handlers/eth_getTransactionByBlockNumberAndIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ import crypto from 'crypto'
import { completeReadableReceipt } from '../external/Collector'
import { JSONRPCCallbackTypePlain } from 'jayson'
import axios from 'axios'
import NestedCounters from '../utils/nestedCounters'

interface BuildGetTransactionByBlockNumberAndIndex {
nestedCountersInstance: any
ensureArrayArgs: any
countFailedResponse: any
nestedCountersInstance: NestedCounters
ensureArrayArgs: (args: RequestParamsLike, callback: JSONRPCCallbackTypePlain) => boolean
countFailedResponse: (api: string, reason: string) => void
logEventEmitter: any
firstLineLogs: any
firstLineLogs: boolean
collectorAPI: any
extractTransactionObject: any
countSuccessResponse: any
config: any
verbose: any
errorBusy: any
verbose: boolean
errorBusy: { code: number; message: string }
}

export const buildGetTransactionByBlockNumberAndIndex = ({
Expand Down
Loading