@0xtorch/evm 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.DS_Store +0 -0
- package/_cjs/clients/externals/viem/middleware.js +5 -0
- package/_cjs/clients/externals/viem/middleware.js.map +1 -1
- package/_cjs/decoder/tests.js +9 -0
- package/_cjs/decoder/tests.js.map +1 -1
- package/_cjs/explorers/definitions/blockscout.js +97 -0
- package/_cjs/explorers/definitions/blockscout.js.map +1 -1
- package/_cjs/explorers/definitions/etherscan.js +152 -0
- package/_cjs/explorers/definitions/etherscan.js.map +1 -1
- package/_cjs/explorers/definitions/roninExplorer.js +70 -0
- package/_cjs/explorers/definitions/roninExplorer.js.map +1 -1
- package/_cjs/explorers/definitions/routescan.js +12 -0
- package/_cjs/explorers/definitions/routescan.js.map +1 -1
- package/_esm/clients/externals/viem/middleware.js +5 -0
- package/_esm/clients/externals/viem/middleware.js.map +1 -1
- package/_esm/decoder/tests.js +9 -0
- package/_esm/decoder/tests.js.map +1 -1
- package/_esm/explorers/definitions/blockscout.js +99 -1
- package/_esm/explorers/definitions/blockscout.js.map +1 -1
- package/_esm/explorers/definitions/etherscan.js +155 -0
- package/_esm/explorers/definitions/etherscan.js.map +1 -1
- package/_esm/explorers/definitions/roninExplorer.js +70 -0
- package/_esm/explorers/definitions/roninExplorer.js.map +1 -1
- package/_esm/explorers/definitions/routescan.js +15 -0
- package/_esm/explorers/definitions/routescan.js.map +1 -1
- package/_types/clients/externals/viem/middleware.d.ts.map +1 -1
- package/_types/decoder/tests.d.ts.map +1 -1
- package/_types/explorers/definitions/blockscout.d.ts +28 -1
- package/_types/explorers/definitions/blockscout.d.ts.map +1 -1
- package/_types/explorers/definitions/etherscan.d.ts +28 -1
- package/_types/explorers/definitions/etherscan.d.ts.map +1 -1
- package/_types/explorers/definitions/roninExplorer.d.ts +26 -0
- package/_types/explorers/definitions/roninExplorer.d.ts.map +1 -1
- package/_types/explorers/definitions/routescan.d.ts +3 -0
- package/_types/explorers/definitions/routescan.d.ts.map +1 -1
- package/_types/explorers/types.d.ts +30 -0
- package/_types/explorers/types.d.ts.map +1 -1
- package/clients/externals/viem/middleware.ts +6 -0
- package/decoder/tests.ts +9 -0
- package/explorers/definitions/blockscout.ts +141 -1
- package/explorers/definitions/etherscan.ts +211 -0
- package/explorers/definitions/roninExplorer.ts +99 -0
- package/explorers/definitions/routescan.ts +15 -0
- package/explorers/types.ts +37 -0
- package/package.json +2 -2
- package/_cjs/.DS_Store +0 -0
- package/_cjs/analyzer/.DS_Store +0 -0
- package/_cjs/chains/.DS_Store +0 -0
- package/_cjs/clients/.DS_Store +0 -0
- package/_cjs/explorers/.DS_Store +0 -0
- package/_esm/.DS_Store +0 -0
- package/_esm/clients/.DS_Store +0 -0
- package/_types/.DS_Store +0 -0
- package/_types/analyzer/.DS_Store +0 -0
- package/_types/chains/.DS_Store +0 -0
- package/_types/clients/.DS_Store +0 -0
- package/_types/explorers/.DS_Store +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Hex } from 'viem'
|
|
2
|
+
import type { LowerHex } from '../../types'
|
|
2
3
|
import {
|
|
3
4
|
getInternalTransactionByHash,
|
|
4
5
|
getNormalTransactionsByAddress,
|
|
@@ -147,4 +148,102 @@ export const createRoninExplorer = <
|
|
|
147
148
|
price: undefined,
|
|
148
149
|
}))
|
|
149
150
|
},
|
|
151
|
+
getAddressTransactionHashesWithTimestamp: async ({
|
|
152
|
+
address,
|
|
153
|
+
startBlock,
|
|
154
|
+
endBlock,
|
|
155
|
+
logger,
|
|
156
|
+
}) => {
|
|
157
|
+
const mut_hashesWithTimestamp: {
|
|
158
|
+
readonly hash: LowerHex
|
|
159
|
+
readonly timestamp: number
|
|
160
|
+
}[] = []
|
|
161
|
+
let mut_from = 0
|
|
162
|
+
while (mut_from >= 0) {
|
|
163
|
+
const { total, transactions } = await getNormalTransactionsByAddress({
|
|
164
|
+
apiEndpoint: explorerApiUrl,
|
|
165
|
+
address,
|
|
166
|
+
size: 100,
|
|
167
|
+
from: mut_from,
|
|
168
|
+
logger,
|
|
169
|
+
})
|
|
170
|
+
for (const transaction of transactions) {
|
|
171
|
+
if (
|
|
172
|
+
startBlock !== undefined &&
|
|
173
|
+
BigInt(transaction.block_number) < startBlock
|
|
174
|
+
) {
|
|
175
|
+
return mut_hashesWithTimestamp
|
|
176
|
+
}
|
|
177
|
+
if (
|
|
178
|
+
(endBlock === undefined ||
|
|
179
|
+
BigInt(transaction.block_number) <= endBlock) &&
|
|
180
|
+
mut_hashesWithTimestamp.every(
|
|
181
|
+
({ hash }) => hash !== transaction.hash,
|
|
182
|
+
)
|
|
183
|
+
) {
|
|
184
|
+
mut_hashesWithTimestamp.push({
|
|
185
|
+
hash: transaction.hash,
|
|
186
|
+
timestamp: transaction.timestamp,
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
mut_from += transactions.length
|
|
191
|
+
if (mut_from + transactions.length >= total) {
|
|
192
|
+
break
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return mut_hashesWithTimestamp
|
|
196
|
+
},
|
|
197
|
+
getAddressInternalTransactionsWithTimestamp: ({ logger }) => {
|
|
198
|
+
if (logger !== undefined) {
|
|
199
|
+
logger.info('getAddressInternalTransactions is not implemented')
|
|
200
|
+
}
|
|
201
|
+
return Promise.resolve([])
|
|
202
|
+
},
|
|
203
|
+
getAddressTokenTransferHashesWithTimestamp: async ({
|
|
204
|
+
address,
|
|
205
|
+
startBlock,
|
|
206
|
+
endBlock,
|
|
207
|
+
logger,
|
|
208
|
+
}) => {
|
|
209
|
+
const mut_hashesWithTimestamp: {
|
|
210
|
+
readonly hash: LowerHex
|
|
211
|
+
readonly timestamp: number
|
|
212
|
+
}[] = []
|
|
213
|
+
let mut_from = 0
|
|
214
|
+
while (mut_from >= 0) {
|
|
215
|
+
const { total, transfers } = await getTokenTransfersByAddress({
|
|
216
|
+
apiEndpoint: explorerApiUrl,
|
|
217
|
+
address,
|
|
218
|
+
size: 100,
|
|
219
|
+
from: mut_from,
|
|
220
|
+
logger,
|
|
221
|
+
})
|
|
222
|
+
for (const transfer of transfers) {
|
|
223
|
+
if (
|
|
224
|
+
startBlock !== undefined &&
|
|
225
|
+
BigInt(transfer.block_number) < startBlock
|
|
226
|
+
) {
|
|
227
|
+
return mut_hashesWithTimestamp
|
|
228
|
+
}
|
|
229
|
+
if (
|
|
230
|
+
(endBlock === undefined ||
|
|
231
|
+
BigInt(transfer.block_number) <= endBlock) &&
|
|
232
|
+
mut_hashesWithTimestamp.every(
|
|
233
|
+
({ hash }) => hash !== transfer.tx_hash,
|
|
234
|
+
)
|
|
235
|
+
) {
|
|
236
|
+
mut_hashesWithTimestamp.push({
|
|
237
|
+
hash: transfer.tx_hash,
|
|
238
|
+
timestamp: transfer.timestamp,
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
mut_from += transfers.length
|
|
243
|
+
if (mut_from + transfers.length >= total) {
|
|
244
|
+
break
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return mut_hashesWithTimestamp
|
|
248
|
+
},
|
|
150
249
|
})
|
|
@@ -54,4 +54,19 @@ export const createRoutescan = <
|
|
|
54
54
|
await new Promise((resolve) => setTimeout(resolve))
|
|
55
55
|
throw new Error('not implemented')
|
|
56
56
|
},
|
|
57
|
+
getAddressTransactionHashesWithTimestamp: async () => {
|
|
58
|
+
// TODO implement
|
|
59
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
60
|
+
throw new Error('not implemented')
|
|
61
|
+
},
|
|
62
|
+
getAddressInternalTransactionsWithTimestamp: async () => {
|
|
63
|
+
// TODO implement
|
|
64
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
65
|
+
throw new Error('not implemented')
|
|
66
|
+
},
|
|
67
|
+
getAddressTokenTransferHashesWithTimestamp: async () => {
|
|
68
|
+
// TODO implement
|
|
69
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
70
|
+
throw new Error('not implemented')
|
|
71
|
+
},
|
|
57
72
|
})
|
package/explorers/types.ts
CHANGED
|
@@ -6,8 +6,11 @@ export type Explorer = {
|
|
|
6
6
|
readonly url: string
|
|
7
7
|
readonly apiUrl: string
|
|
8
8
|
readonly getAddressTransactionHashes: FunctionGetAddressTransactionHashes
|
|
9
|
+
readonly getAddressTransactionHashesWithTimestamp: FunctionGetAddressTransactionHashesWithTimestamp
|
|
9
10
|
readonly getAddressInternalTransactions: FunctionGetAddressInternalTransactions
|
|
11
|
+
readonly getAddressInternalTransactionsWithTimestamp: FunctionGetAddressInternalTransactionsWithTimestamp
|
|
10
12
|
readonly getAddressTokenTransferHashes: FunctionGetAddressTokenTransferHashes
|
|
13
|
+
readonly getAddressTokenTransferHashesWithTimestamp: FunctionGetAddressTokenTransferHashesWithTimestamp
|
|
11
14
|
readonly getBlockNumberOfTimestamp: (
|
|
12
15
|
timestamp: number,
|
|
13
16
|
logger?: Logger,
|
|
@@ -23,6 +26,18 @@ type FunctionGetAddressTransactionHashes = (parameters: {
|
|
|
23
26
|
readonly logger?: Logger
|
|
24
27
|
}) => Promise<readonly Hex[]>
|
|
25
28
|
|
|
29
|
+
type FunctionGetAddressTransactionHashesWithTimestamp = (parameters: {
|
|
30
|
+
readonly address: Hex
|
|
31
|
+
readonly startBlock?: bigint
|
|
32
|
+
readonly endBlock?: bigint
|
|
33
|
+
readonly logger?: Logger
|
|
34
|
+
}) => Promise<
|
|
35
|
+
readonly {
|
|
36
|
+
readonly hash: Hex
|
|
37
|
+
readonly timestamp: number
|
|
38
|
+
}[]
|
|
39
|
+
>
|
|
40
|
+
|
|
26
41
|
type FunctionGetAddressInternalTransactions = (parameters: {
|
|
27
42
|
readonly address: Hex
|
|
28
43
|
readonly startBlock?: bigint
|
|
@@ -31,6 +46,16 @@ type FunctionGetAddressInternalTransactions = (parameters: {
|
|
|
31
46
|
readonly logger?: Logger
|
|
32
47
|
}) => Promise<readonly InternalTransaction<undefined>[]>
|
|
33
48
|
|
|
49
|
+
type FunctionGetAddressInternalTransactionsWithTimestamp = (parameters: {
|
|
50
|
+
readonly address: Hex
|
|
51
|
+
readonly startBlock?: bigint
|
|
52
|
+
readonly endBlock?: bigint
|
|
53
|
+
readonly nativeCurrency: CryptoCurrency
|
|
54
|
+
readonly logger?: Logger
|
|
55
|
+
}) => Promise<
|
|
56
|
+
readonly (InternalTransaction<undefined> & { readonly timestamp: number })[]
|
|
57
|
+
>
|
|
58
|
+
|
|
34
59
|
type FunctionGetAddressTokenTransferHashes = (parameters: {
|
|
35
60
|
readonly address: Hex
|
|
36
61
|
readonly startBlock?: bigint
|
|
@@ -38,6 +63,18 @@ type FunctionGetAddressTokenTransferHashes = (parameters: {
|
|
|
38
63
|
readonly logger?: Logger
|
|
39
64
|
}) => Promise<readonly Hex[]>
|
|
40
65
|
|
|
66
|
+
type FunctionGetAddressTokenTransferHashesWithTimestamp = (parameters: {
|
|
67
|
+
readonly address: Hex
|
|
68
|
+
readonly startBlock?: bigint
|
|
69
|
+
readonly endBlock?: bigint
|
|
70
|
+
readonly logger?: Logger
|
|
71
|
+
}) => Promise<
|
|
72
|
+
readonly {
|
|
73
|
+
readonly hash: Hex
|
|
74
|
+
readonly timestamp: number
|
|
75
|
+
}[]
|
|
76
|
+
>
|
|
77
|
+
|
|
41
78
|
type FunctionGetContract = (
|
|
42
79
|
address: Hex,
|
|
43
80
|
logger?: Logger,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xtorch/evm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Cryptorch EVM extension",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cryptorch",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"!tsconfig.build.json"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@0xtorch/big-decimal": "^0.0.
|
|
40
|
+
"@0xtorch/big-decimal": "^0.0.9",
|
|
41
41
|
"@0xtorch/core": "^0.0.2",
|
|
42
42
|
"@supercharge/promise-pool": "^3.1.1",
|
|
43
43
|
"viem": "^2.8.9",
|
package/_cjs/.DS_Store
DELETED
|
Binary file
|
package/_cjs/analyzer/.DS_Store
DELETED
|
Binary file
|
package/_cjs/chains/.DS_Store
DELETED
|
Binary file
|
package/_cjs/clients/.DS_Store
DELETED
|
Binary file
|
package/_cjs/explorers/.DS_Store
DELETED
|
Binary file
|
package/_esm/.DS_Store
DELETED
|
Binary file
|
package/_esm/clients/.DS_Store
DELETED
|
Binary file
|
package/_types/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|
package/_types/chains/.DS_Store
DELETED
|
Binary file
|
package/_types/clients/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|