@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.
Files changed (57) hide show
  1. package/.DS_Store +0 -0
  2. package/_cjs/clients/externals/viem/middleware.js +5 -0
  3. package/_cjs/clients/externals/viem/middleware.js.map +1 -1
  4. package/_cjs/decoder/tests.js +9 -0
  5. package/_cjs/decoder/tests.js.map +1 -1
  6. package/_cjs/explorers/definitions/blockscout.js +97 -0
  7. package/_cjs/explorers/definitions/blockscout.js.map +1 -1
  8. package/_cjs/explorers/definitions/etherscan.js +152 -0
  9. package/_cjs/explorers/definitions/etherscan.js.map +1 -1
  10. package/_cjs/explorers/definitions/roninExplorer.js +70 -0
  11. package/_cjs/explorers/definitions/roninExplorer.js.map +1 -1
  12. package/_cjs/explorers/definitions/routescan.js +12 -0
  13. package/_cjs/explorers/definitions/routescan.js.map +1 -1
  14. package/_esm/clients/externals/viem/middleware.js +5 -0
  15. package/_esm/clients/externals/viem/middleware.js.map +1 -1
  16. package/_esm/decoder/tests.js +9 -0
  17. package/_esm/decoder/tests.js.map +1 -1
  18. package/_esm/explorers/definitions/blockscout.js +99 -1
  19. package/_esm/explorers/definitions/blockscout.js.map +1 -1
  20. package/_esm/explorers/definitions/etherscan.js +155 -0
  21. package/_esm/explorers/definitions/etherscan.js.map +1 -1
  22. package/_esm/explorers/definitions/roninExplorer.js +70 -0
  23. package/_esm/explorers/definitions/roninExplorer.js.map +1 -1
  24. package/_esm/explorers/definitions/routescan.js +15 -0
  25. package/_esm/explorers/definitions/routescan.js.map +1 -1
  26. package/_types/clients/externals/viem/middleware.d.ts.map +1 -1
  27. package/_types/decoder/tests.d.ts.map +1 -1
  28. package/_types/explorers/definitions/blockscout.d.ts +28 -1
  29. package/_types/explorers/definitions/blockscout.d.ts.map +1 -1
  30. package/_types/explorers/definitions/etherscan.d.ts +28 -1
  31. package/_types/explorers/definitions/etherscan.d.ts.map +1 -1
  32. package/_types/explorers/definitions/roninExplorer.d.ts +26 -0
  33. package/_types/explorers/definitions/roninExplorer.d.ts.map +1 -1
  34. package/_types/explorers/definitions/routescan.d.ts +3 -0
  35. package/_types/explorers/definitions/routescan.d.ts.map +1 -1
  36. package/_types/explorers/types.d.ts +30 -0
  37. package/_types/explorers/types.d.ts.map +1 -1
  38. package/clients/externals/viem/middleware.ts +6 -0
  39. package/decoder/tests.ts +9 -0
  40. package/explorers/definitions/blockscout.ts +141 -1
  41. package/explorers/definitions/etherscan.ts +211 -0
  42. package/explorers/definitions/roninExplorer.ts +99 -0
  43. package/explorers/definitions/routescan.ts +15 -0
  44. package/explorers/types.ts +37 -0
  45. package/package.json +2 -2
  46. package/_cjs/.DS_Store +0 -0
  47. package/_cjs/analyzer/.DS_Store +0 -0
  48. package/_cjs/chains/.DS_Store +0 -0
  49. package/_cjs/clients/.DS_Store +0 -0
  50. package/_cjs/explorers/.DS_Store +0 -0
  51. package/_esm/.DS_Store +0 -0
  52. package/_esm/clients/.DS_Store +0 -0
  53. package/_types/.DS_Store +0 -0
  54. package/_types/analyzer/.DS_Store +0 -0
  55. package/_types/chains/.DS_Store +0 -0
  56. package/_types/clients/.DS_Store +0 -0
  57. package/_types/explorers/.DS_Store +0 -0
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from '@0xtorch/core';
2
- import type { InternalTransaction } from '../../types';
2
+ import type { InternalTransaction, LowerHex } from '../../types';
3
3
  type CreateBlockscoutParameters<TName extends string, TUrl extends string, TApiUrl extends string> = {
4
4
  readonly name: TName;
5
5
  readonly url: TUrl;
@@ -55,6 +55,33 @@ export declare const createBlockscout: <TName extends string, TUrl extends strin
55
55
  isError: boolean;
56
56
  errCode: string;
57
57
  }[]>;
58
+ readonly getAddressTransactionHashesWithTimestamp: ({ address, startBlock, endBlock, logger, }: {
59
+ readonly address: `0x${string}`;
60
+ readonly startBlock?: bigint | undefined;
61
+ readonly endBlock?: bigint | undefined;
62
+ readonly logger?: Logger | undefined;
63
+ }) => Promise<{
64
+ readonly hash: LowerHex;
65
+ readonly timestamp: number;
66
+ }[]>;
67
+ readonly getAddressInternalTransactionsWithTimestamp: ({ address, startBlock, endBlock, nativeCurrency, logger, }: {
68
+ readonly address: `0x${string}`;
69
+ readonly startBlock?: bigint | undefined;
70
+ readonly endBlock?: bigint | undefined;
71
+ readonly nativeCurrency: import("@0xtorch/core").CryptoCurrency;
72
+ readonly logger?: Logger | undefined;
73
+ }) => Promise<(InternalTransaction<undefined> & {
74
+ readonly timestamp: number;
75
+ })[]>;
76
+ readonly getAddressTokenTransferHashesWithTimestamp: ({ address, startBlock, endBlock, logger, }: {
77
+ readonly address: `0x${string}`;
78
+ readonly startBlock?: bigint | undefined;
79
+ readonly endBlock?: bigint | undefined;
80
+ readonly logger?: Logger | undefined;
81
+ }) => Promise<{
82
+ readonly hash: LowerHex;
83
+ readonly timestamp: number;
84
+ }[]>;
58
85
  };
59
86
  export {};
60
87
  //# sourceMappingURL=blockscout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blockscout.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/blockscout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,aAAa,CAAA;AAWhE,KAAK,0BAA0B,CAC7B,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,EACnB,OAAO,SAAS,MAAM,IACpB;IACF,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;qEA6I6B,MAAM;4DAMtB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC5C,CAAA"}
1
+ {"version":3,"file":"blockscout.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/blockscout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAWhE,KAAK,0BAA0B,CAC7B,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,EACnB,OAAO,SAAS,MAAM,IACpB;IACF,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;qEA6I6B,MAAM;4DAMtB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA2CzB,QAAQ;4BACH,MAAM;;;;;;;;;4BAwCN,MAAM;;;;;;;;uBAyDX,QAAQ;4BACH,MAAM;;CAiC9B,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from '@0xtorch/core';
2
- import type { InternalTransaction } from '../../types';
2
+ import type { InternalTransaction, LowerHex } from '../../types';
3
3
  type CreateEtherscanExplorerParameters<TName extends string, TUrl extends string, TApiUrl extends string> = {
4
4
  readonly name: TName;
5
5
  readonly url: TUrl;
@@ -56,6 +56,33 @@ export declare const createEtherscan: <TName extends string, TUrl extends string
56
56
  isError: boolean;
57
57
  errCode: string;
58
58
  }[]>;
59
+ readonly getAddressTransactionHashesWithTimestamp: ({ address, startBlock, endBlock, logger, }: {
60
+ readonly address: `0x${string}`;
61
+ readonly startBlock?: bigint | undefined;
62
+ readonly endBlock?: bigint | undefined;
63
+ readonly logger?: Logger | undefined;
64
+ }) => Promise<{
65
+ readonly hash: LowerHex;
66
+ readonly timestamp: number;
67
+ }[]>;
68
+ readonly getAddressInternalTransactionsWithTimestamp: ({ address, startBlock, endBlock, nativeCurrency, logger, }: {
69
+ readonly address: `0x${string}`;
70
+ readonly startBlock?: bigint | undefined;
71
+ readonly endBlock?: bigint | undefined;
72
+ readonly nativeCurrency: import("@0xtorch/core").CryptoCurrency;
73
+ readonly logger?: Logger | undefined;
74
+ }) => Promise<(InternalTransaction<undefined> & {
75
+ readonly timestamp: number;
76
+ })[]>;
77
+ readonly getAddressTokenTransferHashesWithTimestamp: ({ address, startBlock, endBlock, logger, }: {
78
+ readonly address: `0x${string}`;
79
+ readonly startBlock?: bigint | undefined;
80
+ readonly endBlock?: bigint | undefined;
81
+ readonly logger?: Logger | undefined;
82
+ }) => Promise<{
83
+ readonly hash: LowerHex;
84
+ readonly timestamp: number;
85
+ }[]>;
59
86
  };
60
87
  export {};
61
88
  //# sourceMappingURL=etherscan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"etherscan.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/etherscan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,aAAa,CAAA;AAahE,KAAK,iCAAiC,CACpC,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,EACnB,OAAO,SAAS,MAAM,IACpB;IACF,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;qEAiN8B,MAAM;4DAOtB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC5C,CAAA"}
1
+ {"version":3,"file":"etherscan.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/etherscan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAahE,KAAK,iCAAiC,CACpC,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,EACnB,OAAO,SAAS,MAAM,IACpB;IACF,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;qEAiN8B,MAAM;4DAOtB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA6CzB,QAAQ;4BACH,MAAM;;;;;;;;;4BAyCN,MAAM;;;;;;;;uBA2DX,QAAQ;4BACH,MAAM;;CAqG9B,CAAA"}
@@ -1,3 +1,4 @@
1
+ import type { LowerHex } from '../../types';
1
2
  type CreateRoninExplorerParameters<TName extends string, TUrl extends string, TApiUrl extends string> = {
2
3
  readonly name: TName;
3
4
  readonly url: TUrl;
@@ -57,6 +58,31 @@ export declare const createRoninExplorer: <TName extends string, TUrl extends st
57
58
  block_hash: string;
58
59
  tx_type: string;
59
60
  }[]>;
61
+ readonly getAddressTransactionHashesWithTimestamp: ({ address, startBlock, endBlock, logger, }: {
62
+ readonly address: `0x${string}`;
63
+ readonly startBlock?: bigint | undefined;
64
+ readonly endBlock?: bigint | undefined;
65
+ readonly logger?: import("@0xtorch/core").Logger | undefined;
66
+ }) => Promise<{
67
+ readonly hash: LowerHex;
68
+ readonly timestamp: number;
69
+ }[]>;
70
+ readonly getAddressInternalTransactionsWithTimestamp: ({ logger }: {
71
+ readonly address: `0x${string}`;
72
+ readonly startBlock?: bigint | undefined;
73
+ readonly endBlock?: bigint | undefined;
74
+ readonly nativeCurrency: import("@0xtorch/core").CryptoCurrency;
75
+ readonly logger?: import("@0xtorch/core").Logger | undefined;
76
+ }) => Promise<never[]>;
77
+ readonly getAddressTokenTransferHashesWithTimestamp: ({ address, startBlock, endBlock, logger, }: {
78
+ readonly address: `0x${string}`;
79
+ readonly startBlock?: bigint | undefined;
80
+ readonly endBlock?: bigint | undefined;
81
+ readonly logger?: import("@0xtorch/core").Logger | undefined;
82
+ }) => Promise<{
83
+ readonly hash: LowerHex;
84
+ readonly timestamp: number;
85
+ }[]>;
60
86
  };
61
87
  export {};
62
88
  //# sourceMappingURL=roninExplorer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"roninExplorer.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/roninExplorer.ts"],"names":[],"mappings":"AAQA,KAAK,6BAA6B,CAChC,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,EACnB,OAAO,SAAS,MAAM,IACpB;IACF,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiI5B,CAAA"}
1
+ {"version":3,"file":"roninExplorer.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/roninExplorer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAQ3C,KAAK,6BAA6B,CAChC,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,EACnB,OAAO,SAAS,MAAM,IACpB;IACF,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAwIT,QAAQ;4BACH,MAAM;;;;;;;;;;;;;;;uBAmDX,QAAQ;4BACH,MAAM;;CAsC9B,CAAA"}
@@ -14,6 +14,9 @@ export declare const createRoutescan: <TName extends string, TUrl extends string
14
14
  readonly getBlockNumberOfTimestamp: () => Promise<never>;
15
15
  readonly getContract: () => Promise<never>;
16
16
  readonly getInternalTransactionOfTransaction: () => Promise<never>;
17
+ readonly getAddressTransactionHashesWithTimestamp: () => Promise<never>;
18
+ readonly getAddressInternalTransactionsWithTimestamp: () => Promise<never>;
19
+ readonly getAddressTokenTransferHashesWithTimestamp: () => Promise<never>;
17
20
  };
18
21
  export {};
19
22
  //# sourceMappingURL=routescan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routescan.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/routescan.ts"],"names":[],"mappings":"AAEA,KAAK,iCAAiC,CACpC,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,EACnB,OAAO,SAAS,MAAM,IACpB;IACF,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;CA2CxB,CAAA"}
1
+ {"version":3,"file":"routescan.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/routescan.ts"],"names":[],"mappings":"AAEA,KAAK,iCAAiC,CACpC,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,EACnB,OAAO,SAAS,MAAM,IACpB;IACF,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;CA0DxB,CAAA"}
@@ -5,8 +5,11 @@ export type Explorer = {
5
5
  readonly url: string;
6
6
  readonly apiUrl: string;
7
7
  readonly getAddressTransactionHashes: FunctionGetAddressTransactionHashes;
8
+ readonly getAddressTransactionHashesWithTimestamp: FunctionGetAddressTransactionHashesWithTimestamp;
8
9
  readonly getAddressInternalTransactions: FunctionGetAddressInternalTransactions;
10
+ readonly getAddressInternalTransactionsWithTimestamp: FunctionGetAddressInternalTransactionsWithTimestamp;
9
11
  readonly getAddressTokenTransferHashes: FunctionGetAddressTokenTransferHashes;
12
+ readonly getAddressTokenTransferHashesWithTimestamp: FunctionGetAddressTokenTransferHashesWithTimestamp;
10
13
  readonly getBlockNumberOfTimestamp: (timestamp: number, logger?: Logger) => Promise<bigint>;
11
14
  readonly getContract: FunctionGetContract;
12
15
  readonly getInternalTransactionOfTransaction: FunctionGetInternalTransactionOfTransaction;
@@ -17,6 +20,15 @@ type FunctionGetAddressTransactionHashes = (parameters: {
17
20
  readonly endBlock?: bigint;
18
21
  readonly logger?: Logger;
19
22
  }) => Promise<readonly Hex[]>;
23
+ type FunctionGetAddressTransactionHashesWithTimestamp = (parameters: {
24
+ readonly address: Hex;
25
+ readonly startBlock?: bigint;
26
+ readonly endBlock?: bigint;
27
+ readonly logger?: Logger;
28
+ }) => Promise<readonly {
29
+ readonly hash: Hex;
30
+ readonly timestamp: number;
31
+ }[]>;
20
32
  type FunctionGetAddressInternalTransactions = (parameters: {
21
33
  readonly address: Hex;
22
34
  readonly startBlock?: bigint;
@@ -24,12 +36,30 @@ type FunctionGetAddressInternalTransactions = (parameters: {
24
36
  readonly nativeCurrency: CryptoCurrency;
25
37
  readonly logger?: Logger;
26
38
  }) => Promise<readonly InternalTransaction<undefined>[]>;
39
+ type FunctionGetAddressInternalTransactionsWithTimestamp = (parameters: {
40
+ readonly address: Hex;
41
+ readonly startBlock?: bigint;
42
+ readonly endBlock?: bigint;
43
+ readonly nativeCurrency: CryptoCurrency;
44
+ readonly logger?: Logger;
45
+ }) => Promise<readonly (InternalTransaction<undefined> & {
46
+ readonly timestamp: number;
47
+ })[]>;
27
48
  type FunctionGetAddressTokenTransferHashes = (parameters: {
28
49
  readonly address: Hex;
29
50
  readonly startBlock?: bigint;
30
51
  readonly endBlock?: bigint;
31
52
  readonly logger?: Logger;
32
53
  }) => Promise<readonly Hex[]>;
54
+ type FunctionGetAddressTokenTransferHashesWithTimestamp = (parameters: {
55
+ readonly address: Hex;
56
+ readonly startBlock?: bigint;
57
+ readonly endBlock?: bigint;
58
+ readonly logger?: Logger;
59
+ }) => Promise<readonly {
60
+ readonly hash: Hex;
61
+ readonly timestamp: number;
62
+ }[]>;
33
63
  type FunctionGetContract = (address: Hex, logger?: Logger) => Promise<{
34
64
  readonly name: string;
35
65
  readonly abi: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../explorers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAExD,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,2BAA2B,EAAE,mCAAmC,CAAA;IACzE,QAAQ,CAAC,8BAA8B,EAAE,sCAAsC,CAAA;IAC/E,QAAQ,CAAC,6BAA6B,EAAE,qCAAqC,CAAA;IAC7E,QAAQ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EAAE,GAAG,CAAA;IAClB,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAA;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB,KAAK,OAAO,CAAC,SAAS,mBAAmB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA"}
@@ -14,6 +14,7 @@ import { bigIntMin } from '../../../utils'
14
14
  type RpcStatus = {
15
15
  readonly rpc: HttpRpc
16
16
  readonly isAvailable: boolean
17
+ readonly isUsing: boolean
17
18
  error:
18
19
  | {
19
20
  timestamp: number
@@ -44,6 +45,7 @@ const updateRpcs = (
44
45
  ? {
45
46
  rpc,
46
47
  isAvailable: true,
48
+ isUsing: false,
47
49
  error: undefined,
48
50
  }
49
51
  : currentRpcs[url]
@@ -103,6 +105,7 @@ const lockRpc = (rpcs: ChainRpcs, url: string): ChainRpcs => ({
103
105
  [url]: {
104
106
  ...rpcs[url],
105
107
  isAvailable: false,
108
+ isUsing: true,
106
109
  },
107
110
  })
108
111
 
@@ -111,6 +114,7 @@ const unlockRpc = (rpcs: ChainRpcs, url: string): ChainRpcs => ({
111
114
  [url]: {
112
115
  ...rpcs[url],
113
116
  isAvailable: true,
117
+ isUsing: false,
114
118
  error: undefined,
115
119
  },
116
120
  })
@@ -121,6 +125,7 @@ const unlockErrorRpcs = (rpcs: ChainRpcs): ChainRpcs => {
121
125
  for (const [url, rpc] of Object.entries(rpcs)) {
122
126
  mut_rpcs[url] =
123
127
  !rpc.isAvailable &&
128
+ !rpc.isUsing &&
124
129
  rpc.error !== undefined &&
125
130
  rpc.error.unlockTimestamp < now
126
131
  ? {
@@ -144,6 +149,7 @@ const saveRpcError = (
144
149
  [url]: {
145
150
  ...rpcs[url],
146
151
  isAvailable: false,
152
+ isUsing: false,
147
153
  error: {
148
154
  timestamp: now,
149
155
  unlockTimestamp:
package/decoder/tests.ts CHANGED
@@ -73,6 +73,15 @@ const testExplorer: Explorer = {
73
73
  getInternalTransactionOfTransaction: () => {
74
74
  throw new Error('Not implemented')
75
75
  },
76
+ getAddressTransactionHashesWithTimestamp: () => {
77
+ throw new Error('not implemented')
78
+ },
79
+ getAddressInternalTransactionsWithTimestamp: () => {
80
+ throw new Error('not implemented')
81
+ },
82
+ getAddressTokenTransferHashesWithTimestamp: () => {
83
+ throw new Error('not implemented')
84
+ },
76
85
  }
77
86
 
78
87
  export const testChain = createEthereumChainCustom({
@@ -133,7 +133,7 @@ export const createBlockscout = <
133
133
  const loop = true
134
134
  const hashSet = new Set<LowerHex>()
135
135
 
136
- // erc20 transfer
136
+ // token transfer
137
137
  let mut_startBlock = startBlock
138
138
  while (loop) {
139
139
  const transfers = await getTokenTransfersByAddress({
@@ -202,4 +202,144 @@ export const createBlockscout = <
202
202
  price: undefined,
203
203
  }))
204
204
  },
205
+ getAddressTransactionHashesWithTimestamp: async ({
206
+ address,
207
+ startBlock,
208
+ endBlock,
209
+ logger,
210
+ }) => {
211
+ const loop = true
212
+ const mut_hashesWithTimestamp: {
213
+ readonly hash: LowerHex
214
+ readonly timestamp: number
215
+ }[] = []
216
+ let mut_startBlock = startBlock
217
+ while (loop) {
218
+ const transactions = await getNormalTransactionsByAddress({
219
+ apiEndpoint: apiUrl,
220
+ address,
221
+ startBlock: mut_startBlock,
222
+ endBlock,
223
+ logger,
224
+ })
225
+ for (const { hash, timeStamp } of transactions) {
226
+ if (mut_hashesWithTimestamp.every(({ hash: h }) => h !== hash)) {
227
+ mut_hashesWithTimestamp.push({ hash, timestamp: timeStamp })
228
+ }
229
+ }
230
+ if (transactions.length < 10_000) {
231
+ break
232
+ }
233
+ const maxTxBlockNumber = transactions.reduce(
234
+ (max, { blockNumber }) =>
235
+ max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
236
+ 0n,
237
+ )
238
+ if (maxTxBlockNumber === 0n || maxTxBlockNumber === mut_startBlock) {
239
+ break
240
+ }
241
+ mut_startBlock = maxTxBlockNumber
242
+ }
243
+ return mut_hashesWithTimestamp
244
+ },
245
+ getAddressInternalTransactionsWithTimestamp: async ({
246
+ address,
247
+ startBlock,
248
+ endBlock,
249
+ nativeCurrency,
250
+ logger,
251
+ }) => {
252
+ const loop = true
253
+ const mut_internalTransactionsWithTimestamp: (InternalTransaction<undefined> & {
254
+ readonly timestamp: number
255
+ })[] = []
256
+ let mut_startBlock = startBlock
257
+ while (loop) {
258
+ const transactions = await getInternalTransactionsByAddress({
259
+ apiEndpoint: apiUrl,
260
+ address,
261
+ startBlock: mut_startBlock,
262
+ endBlock,
263
+ logger,
264
+ })
265
+ for (const transaction of transactions) {
266
+ if (
267
+ mut_internalTransactionsWithTimestamp.some(
268
+ ({ transactionHash, from, to, value }) =>
269
+ transaction.transactionHash === transactionHash &&
270
+ transaction.from === from &&
271
+ transaction.to === to &&
272
+ transaction.value === value,
273
+ )
274
+ ) {
275
+ continue
276
+ }
277
+ mut_internalTransactionsWithTimestamp.push({
278
+ ...transaction,
279
+ type: 'InternalTransaction',
280
+ to: transaction.to,
281
+ contractAddress: transaction.contractAddress,
282
+ txType: transaction.type,
283
+ currency: nativeCurrency,
284
+ price: undefined,
285
+ timestamp: transaction.timeStamp,
286
+ })
287
+ }
288
+ if (transactions.length < 10_000) {
289
+ break
290
+ }
291
+ const maxTxBlockNumber = transactions.reduce(
292
+ (max, { blockNumber }) =>
293
+ max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
294
+ 0n,
295
+ )
296
+ if (maxTxBlockNumber === 0n || maxTxBlockNumber === mut_startBlock) {
297
+ break
298
+ }
299
+ mut_startBlock = maxTxBlockNumber
300
+ }
301
+ return mut_internalTransactionsWithTimestamp
302
+ },
303
+ getAddressTokenTransferHashesWithTimestamp: async ({
304
+ address,
305
+ startBlock,
306
+ endBlock,
307
+ logger,
308
+ }) => {
309
+ const loop = true
310
+ const mut_hashesWithTimestamp: {
311
+ readonly hash: LowerHex
312
+ readonly timestamp: number
313
+ }[] = []
314
+
315
+ // token transfer
316
+ let mut_startBlock = startBlock
317
+ while (loop) {
318
+ const transfers = await getTokenTransfersByAddress({
319
+ apiEndpoint: apiUrl,
320
+ address,
321
+ startBlock: mut_startBlock,
322
+ endBlock,
323
+ logger,
324
+ })
325
+ for (const { hash, timeStamp } of transfers) {
326
+ if (mut_hashesWithTimestamp.every(({ hash: h }) => h !== hash)) {
327
+ mut_hashesWithTimestamp.push({ hash, timestamp: timeStamp })
328
+ }
329
+ }
330
+ if (transfers.length < 10_000) {
331
+ break
332
+ }
333
+ const maxTxBlockNumber = transfers.reduce(
334
+ (max, { blockNumber }) =>
335
+ max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
336
+ 0n,
337
+ )
338
+ if (maxTxBlockNumber === 0n || maxTxBlockNumber === mut_startBlock) {
339
+ break
340
+ }
341
+ mut_startBlock = maxTxBlockNumber
342
+ }
343
+ return mut_hashesWithTimestamp
344
+ },
205
345
  })
@@ -276,4 +276,215 @@ export const createEtherscan = <
276
276
  price: undefined,
277
277
  }))
278
278
  },
279
+ getAddressTransactionHashesWithTimestamp: async ({
280
+ address,
281
+ startBlock,
282
+ endBlock,
283
+ logger,
284
+ }) => {
285
+ const loop = true
286
+ const mut_hashesWithTimestamp: {
287
+ readonly hash: LowerHex
288
+ readonly timestamp: number
289
+ }[] = []
290
+ let mut_startBlock = startBlock
291
+ while (loop) {
292
+ const transactions = await getNormalTransactionsByAddress({
293
+ apiEndpoint: apiUrl,
294
+ apiKey,
295
+ address,
296
+ startBlock: mut_startBlock,
297
+ endBlock,
298
+ logger,
299
+ })
300
+ for (const { hash, timeStamp } of transactions) {
301
+ if (mut_hashesWithTimestamp.every(({ hash: h }) => h !== hash)) {
302
+ mut_hashesWithTimestamp.push({ hash, timestamp: timeStamp })
303
+ }
304
+ }
305
+ if (transactions.length < 10_000) {
306
+ break
307
+ }
308
+ const maxTxBlockNumber = transactions.reduce(
309
+ (max, { blockNumber }) =>
310
+ max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
311
+ 0n,
312
+ )
313
+ if (maxTxBlockNumber === 0n || maxTxBlockNumber === mut_startBlock) {
314
+ break
315
+ }
316
+ mut_startBlock = maxTxBlockNumber
317
+ }
318
+ return mut_hashesWithTimestamp
319
+ },
320
+ getAddressInternalTransactionsWithTimestamp: async ({
321
+ address,
322
+ startBlock,
323
+ endBlock,
324
+ nativeCurrency,
325
+ logger,
326
+ }) => {
327
+ const loop = true
328
+ const mut_internalTransactionsWithTimestamp: (InternalTransaction<undefined> & {
329
+ readonly timestamp: number
330
+ })[] = []
331
+ let mut_startBlock = startBlock
332
+ while (loop) {
333
+ const transactions = await getInternalTransactionsByAddress({
334
+ apiEndpoint: apiUrl,
335
+ apiKey,
336
+ address,
337
+ startBlock: mut_startBlock,
338
+ endBlock,
339
+ logger,
340
+ })
341
+ for (const transaction of transactions) {
342
+ if (
343
+ mut_internalTransactionsWithTimestamp.some(
344
+ ({ transactionHash, from, to, value }) =>
345
+ transaction.hash === transactionHash &&
346
+ transaction.from === from &&
347
+ transaction.to === to &&
348
+ transaction.value === value,
349
+ )
350
+ ) {
351
+ continue
352
+ }
353
+ mut_internalTransactionsWithTimestamp.push({
354
+ ...transaction,
355
+ type: 'InternalTransaction',
356
+ transactionHash: transaction.hash,
357
+ to: transaction.to,
358
+ contractAddress: transaction.contractAddress,
359
+ txType: transaction.type,
360
+ currency: nativeCurrency,
361
+ price: undefined,
362
+ timestamp: transaction.timeStamp,
363
+ })
364
+ }
365
+ if (transactions.length < 10_000) {
366
+ break
367
+ }
368
+ const maxTxBlockNumber = transactions.reduce(
369
+ (max, { blockNumber }) =>
370
+ max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
371
+ 0n,
372
+ )
373
+ if (maxTxBlockNumber === 0n || maxTxBlockNumber === mut_startBlock) {
374
+ break
375
+ }
376
+ mut_startBlock = maxTxBlockNumber
377
+ }
378
+ return mut_internalTransactionsWithTimestamp
379
+ },
380
+ getAddressTokenTransferHashesWithTimestamp: async ({
381
+ address,
382
+ startBlock,
383
+ endBlock,
384
+ logger,
385
+ }) => {
386
+ const loop = true
387
+ const mut_hashesWithTimestamp: {
388
+ readonly hash: LowerHex
389
+ readonly timestamp: number
390
+ }[] = []
391
+
392
+ // erc20 transfer
393
+ let mut_erc20StartBlock = startBlock
394
+ while (loop) {
395
+ const transfers = await getErc20TokenTransfersByAddress({
396
+ apiEndpoint: apiUrl,
397
+ apiKey,
398
+ address,
399
+ startBlock: mut_erc20StartBlock,
400
+ endBlock,
401
+ logger,
402
+ })
403
+ for (const { hash, timeStamp } of transfers) {
404
+ if (mut_hashesWithTimestamp.every(({ hash: h }) => h !== hash)) {
405
+ mut_hashesWithTimestamp.push({ hash, timestamp: timeStamp })
406
+ }
407
+ }
408
+ if (transfers.length < 10_000) {
409
+ break
410
+ }
411
+ const maxTxBlockNumber = transfers.reduce(
412
+ (max, { blockNumber }) =>
413
+ max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
414
+ 0n,
415
+ )
416
+ if (
417
+ maxTxBlockNumber === 0n ||
418
+ maxTxBlockNumber === mut_erc20StartBlock
419
+ ) {
420
+ break
421
+ }
422
+ mut_erc20StartBlock = maxTxBlockNumber
423
+ }
424
+ // erc721 transfer
425
+ let mut_erc721StartBlock = startBlock
426
+ while (loop) {
427
+ const transfers = await getErc721TokenTransfersByAddress({
428
+ apiEndpoint: apiUrl,
429
+ apiKey,
430
+ address,
431
+ startBlock: mut_erc721StartBlock,
432
+ endBlock,
433
+ logger,
434
+ })
435
+ for (const { hash, timeStamp } of transfers) {
436
+ if (mut_hashesWithTimestamp.every(({ hash: h }) => h !== hash)) {
437
+ mut_hashesWithTimestamp.push({ hash, timestamp: timeStamp })
438
+ }
439
+ }
440
+ if (transfers.length < 10_000) {
441
+ break
442
+ }
443
+ const maxTxBlockNumber = transfers.reduce(
444
+ (max, { blockNumber }) =>
445
+ max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
446
+ 0n,
447
+ )
448
+ if (
449
+ maxTxBlockNumber === 0n ||
450
+ maxTxBlockNumber === mut_erc721StartBlock
451
+ ) {
452
+ break
453
+ }
454
+ mut_erc721StartBlock = maxTxBlockNumber
455
+ }
456
+ // erc1155 transfer
457
+ let mut_erc1155StartBlock = startBlock
458
+ while (loop) {
459
+ const transfers = await getErc1155TokenTransfersByAddress({
460
+ apiEndpoint: apiUrl,
461
+ apiKey,
462
+ address,
463
+ startBlock: mut_erc1155StartBlock,
464
+ endBlock,
465
+ logger,
466
+ })
467
+ for (const { hash, timeStamp } of transfers) {
468
+ if (mut_hashesWithTimestamp.every(({ hash: h }) => h !== hash)) {
469
+ mut_hashesWithTimestamp.push({ hash, timestamp: timeStamp })
470
+ }
471
+ }
472
+ if (transfers.length < 10_000) {
473
+ break
474
+ }
475
+ const maxTxBlockNumber = transfers.reduce(
476
+ (max, { blockNumber }) =>
477
+ max < BigInt(blockNumber) ? BigInt(blockNumber) : max,
478
+ 0n,
479
+ )
480
+ if (
481
+ maxTxBlockNumber === 0n ||
482
+ maxTxBlockNumber === mut_erc1155StartBlock
483
+ ) {
484
+ break
485
+ }
486
+ mut_erc1155StartBlock = maxTxBlockNumber
487
+ }
488
+ return mut_hashesWithTimestamp
489
+ },
279
490
  })