@0xtorch/evm 0.0.51 → 0.0.53

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 (79) hide show
  1. package/_cjs/clients/externals/viem/createViemInstance.js +2 -1
  2. package/_cjs/clients/externals/viem/createViemInstance.js.map +1 -1
  3. package/_cjs/decoder/tests.js +3 -0
  4. package/_cjs/decoder/tests.js.map +1 -1
  5. package/_cjs/explorers/definitions/blockscout.js +22 -0
  6. package/_cjs/explorers/definitions/blockscout.js.map +1 -1
  7. package/_cjs/explorers/definitions/etherscan.js +28 -1
  8. package/_cjs/explorers/definitions/etherscan.js.map +1 -1
  9. package/_cjs/explorers/definitions/roninExplorer.js +6 -0
  10. package/_cjs/explorers/definitions/roninExplorer.js.map +1 -1
  11. package/_cjs/explorers/definitions/routescan.js +4 -0
  12. package/_cjs/explorers/definitions/routescan.js.map +1 -1
  13. package/_cjs/explorers/externals/blockscout/getEventLogsByAddressAndTopics.js +76 -0
  14. package/_cjs/explorers/externals/blockscout/getEventLogsByAddressAndTopics.js.map +1 -0
  15. package/_cjs/explorers/externals/blockscout/index.js +3 -1
  16. package/_cjs/explorers/externals/blockscout/index.js.map +1 -1
  17. package/_cjs/explorers/externals/etherscan/getContractCreations.js +14 -8
  18. package/_cjs/explorers/externals/etherscan/getContractCreations.js.map +1 -1
  19. package/_cjs/explorers/externals/etherscan/getEventLogsByAddressAndTopics.js +77 -0
  20. package/_cjs/explorers/externals/etherscan/getEventLogsByAddressAndTopics.js.map +1 -0
  21. package/_cjs/explorers/externals/etherscan/index.js +3 -1
  22. package/_cjs/explorers/externals/etherscan/index.js.map +1 -1
  23. package/_esm/clients/externals/viem/createViemInstance.js +4 -2
  24. package/_esm/clients/externals/viem/createViemInstance.js.map +1 -1
  25. package/_esm/decoder/tests.js +3 -0
  26. package/_esm/decoder/tests.js.map +1 -1
  27. package/_esm/explorers/definitions/blockscout.js +23 -1
  28. package/_esm/explorers/definitions/blockscout.js.map +1 -1
  29. package/_esm/explorers/definitions/etherscan.js +29 -2
  30. package/_esm/explorers/definitions/etherscan.js.map +1 -1
  31. package/_esm/explorers/definitions/roninExplorer.js +6 -0
  32. package/_esm/explorers/definitions/roninExplorer.js.map +1 -1
  33. package/_esm/explorers/definitions/routescan.js +5 -0
  34. package/_esm/explorers/definitions/routescan.js.map +1 -1
  35. package/_esm/explorers/externals/blockscout/getEventLogsByAddressAndTopics.js +73 -0
  36. package/_esm/explorers/externals/blockscout/getEventLogsByAddressAndTopics.js.map +1 -0
  37. package/_esm/explorers/externals/blockscout/index.js +1 -0
  38. package/_esm/explorers/externals/blockscout/index.js.map +1 -1
  39. package/_esm/explorers/externals/etherscan/getContractCreations.js +14 -8
  40. package/_esm/explorers/externals/etherscan/getContractCreations.js.map +1 -1
  41. package/_esm/explorers/externals/etherscan/getEventLogsByAddressAndTopics.js +74 -0
  42. package/_esm/explorers/externals/etherscan/getEventLogsByAddressAndTopics.js.map +1 -0
  43. package/_esm/explorers/externals/etherscan/index.js +1 -0
  44. package/_esm/explorers/externals/etherscan/index.js.map +1 -1
  45. package/_types/clients/externals/viem/createViemInstance.d.ts.map +1 -1
  46. package/_types/decoder/tests.d.ts.map +1 -1
  47. package/_types/explorers/definitions/blockscout.d.ts +13 -1
  48. package/_types/explorers/definitions/blockscout.d.ts.map +1 -1
  49. package/_types/explorers/definitions/etherscan.d.ts +17 -5
  50. package/_types/explorers/definitions/etherscan.d.ts.map +1 -1
  51. package/_types/explorers/definitions/roninExplorer.d.ts +7 -0
  52. package/_types/explorers/definitions/roninExplorer.d.ts.map +1 -1
  53. package/_types/explorers/definitions/routescan.d.ts +1 -0
  54. package/_types/explorers/definitions/routescan.d.ts.map +1 -1
  55. package/_types/explorers/externals/blockscout/getEventLogsByAddressAndTopics.d.ts +39 -0
  56. package/_types/explorers/externals/blockscout/getEventLogsByAddressAndTopics.d.ts.map +1 -0
  57. package/_types/explorers/externals/blockscout/index.d.ts +1 -0
  58. package/_types/explorers/externals/blockscout/index.d.ts.map +1 -1
  59. package/_types/explorers/externals/etherscan/getContractCreations.d.ts +4 -4
  60. package/_types/explorers/externals/etherscan/getContractCreations.d.ts.map +1 -1
  61. package/_types/explorers/externals/etherscan/getEventLogsByAddressAndTopics.d.ts +41 -0
  62. package/_types/explorers/externals/etherscan/getEventLogsByAddressAndTopics.d.ts.map +1 -0
  63. package/_types/explorers/externals/etherscan/index.d.ts +1 -0
  64. package/_types/explorers/externals/etherscan/index.d.ts.map +1 -1
  65. package/_types/explorers/types.d.ts +17 -4
  66. package/_types/explorers/types.d.ts.map +1 -1
  67. package/clients/externals/viem/createViemInstance.ts +4 -2
  68. package/decoder/tests.ts +3 -0
  69. package/explorers/definitions/blockscout.ts +32 -1
  70. package/explorers/definitions/etherscan.ts +35 -2
  71. package/explorers/definitions/roninExplorer.ts +6 -0
  72. package/explorers/definitions/routescan.ts +5 -0
  73. package/explorers/externals/blockscout/getEventLogsByAddressAndTopics.ts +105 -0
  74. package/explorers/externals/blockscout/index.ts +1 -0
  75. package/explorers/externals/etherscan/getContractCreations.ts +14 -8
  76. package/explorers/externals/etherscan/getEventLogsByAddressAndTopics.ts +111 -0
  77. package/explorers/externals/etherscan/index.ts +1 -0
  78. package/explorers/types.ts +20 -4
  79. package/package.json +1 -1
@@ -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,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAYhE,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;;;;kFAcK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAqCpC,QAAQ;4BACH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;4BAwCN,MAAM;;;;;;;;uBAyDX,QAAQ;4BACH,MAAM;;CAiC9B,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,GAAG,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAarE,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;;;;kFAcK,MAAM;;;;;;;;;;;;qBAYtC,MAAM;yBACF,GAAG;cACd,GAAG;gBACD,SAAS,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAoDP,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, LowerHex } from '../../types';
2
+ import type { Hex, 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;
@@ -49,11 +49,23 @@ export declare const createEtherscan: <TName extends string, TUrl extends string
49
49
  name: string;
50
50
  abi: string;
51
51
  } | undefined>;
52
- readonly getContractCreations: (addresses: readonly `0x${string}`[], logger?: Logger) => Promise<readonly Readonly<{
52
+ readonly getContractCreations: (addresses: readonly `0x${string}`[], logger?: Logger) => Promise<{
53
53
  contractAddress: `0x${Lowercase<string>}`;
54
- contractCreator: `0x${Lowercase<string>}`;
55
- txHash: `0x${Lowercase<string>}`;
56
- }>[]>;
54
+ contractCreator: `0x${Lowercase<string>}` | undefined;
55
+ txHash: `0x${string}` | undefined;
56
+ }[]>;
57
+ readonly getEventLogs: ({ address, topic0, fromBlock, toBlock, logger }: {
58
+ readonly address: `0x${string}`;
59
+ readonly topic0: `0x${string}`;
60
+ readonly fromBlock?: bigint | undefined;
61
+ readonly toBlock?: bigint | undefined;
62
+ readonly logger?: Logger | undefined;
63
+ }) => Promise<{
64
+ blockNumber: bigint;
65
+ transactionHash: Hex;
66
+ data: Hex;
67
+ topics: readonly Hex[];
68
+ }[]>;
57
69
  readonly getInternalTransactionOfTransaction: ({ hash, nativeCurrency, logger, }: {
58
70
  readonly hash: `0x${string}`;
59
71
  readonly nativeCurrency: {
@@ -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,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAchE,KAAK,iCAAiC,CACpC,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,EACnB,OAAO,SAAS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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAmDP,QAAQ;4BACH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;4BAyCN,MAAM;;;;;;;;uBA2DX,QAAQ;4BACH,MAAM;;CAqG9B,CAAA"}
@@ -48,6 +48,13 @@ export declare const createRoninExplorer: <TName extends string, TUrl extends st
48
48
  readonly getBlockNumberOfTimestamp: () => never;
49
49
  readonly getContract: (_: `0x${string}`, logger: Logger | undefined) => Promise<undefined>;
50
50
  readonly getContractCreations: (_: readonly `0x${string}`[], logger?: Logger) => never;
51
+ readonly getEventLogs: ({ logger }: {
52
+ readonly address: `0x${string}`;
53
+ readonly topic0: `0x${string}`;
54
+ readonly fromBlock?: bigint | undefined;
55
+ readonly toBlock?: bigint | undefined;
56
+ readonly logger?: Logger | undefined;
57
+ }) => never;
51
58
  readonly getInternalTransactionOfTransaction: ({ hash, nativeCurrency, logger, }: {
52
59
  readonly hash: `0x${string}`;
53
60
  readonly nativeCurrency: {
@@ -1 +1 @@
1
- {"version":3,"file":"roninExplorer.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/roninExplorer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0EAwGO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAsCtB,QAAQ;4BACH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAmDX,QAAQ;4BACH,MAAM;;CAsC9B,CAAA"}
1
+ {"version":3,"file":"roninExplorer.d.ts","sourceRoot":"","sources":["../../../explorers/definitions/roninExplorer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0EAwGO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA4CtB,QAAQ;4BACH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAmDX,QAAQ;4BACH,MAAM;;CAsC9B,CAAA"}
@@ -14,6 +14,7 @@ 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 getContractCreations: () => Promise<never>;
17
+ readonly getEventLogs: () => Promise<never>;
17
18
  readonly getInternalTransactionOfTransaction: () => Promise<never>;
18
19
  readonly getAddressTransactionHashesWithTimestamp: () => Promise<never>;
19
20
  readonly getAddressInternalTransactionsWithTimestamp: () => Promise<never>;
@@ -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;;;;;;;;;;;;;;CA+DxB,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;;;;;;;;;;;;;;;CAoExB,CAAA"}
@@ -0,0 +1,39 @@
1
+ import type { Logger } from '@0xtorch/core';
2
+ import { z } from 'zod';
3
+ import type { Hex } from '../../../types';
4
+ type GetEventLogsByAddressAndTopicsParameters = {
5
+ readonly apiEndpoint: string;
6
+ readonly address: Hex;
7
+ readonly topic0: Hex;
8
+ readonly fromBlock: bigint | 'latest';
9
+ readonly toBlock: bigint | 'latest';
10
+ readonly logger?: Logger;
11
+ };
12
+ declare const logSchema: z.ZodObject<{
13
+ address: z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>;
14
+ topics: z.ZodEffects<z.ZodArray<z.ZodNullable<z.ZodEffects<z.ZodString, `0x${string}`, string>>, "many">, `0x${string}`[], (string | null)[]>;
15
+ data: z.ZodEffects<z.ZodString, `0x${string}`, string>;
16
+ blockNumber: z.ZodEffects<z.ZodString, bigint, string>;
17
+ logIndex: z.ZodEffects<z.ZodString, bigint, string>;
18
+ transactionHash: z.ZodEffects<z.ZodString, `0x${string}`, string>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ address: `0x${Lowercase<string>}`;
21
+ transactionHash: `0x${string}`;
22
+ blockNumber: bigint;
23
+ data: `0x${string}`;
24
+ logIndex: bigint;
25
+ topics: `0x${string}`[];
26
+ }, {
27
+ address: string;
28
+ transactionHash: string;
29
+ blockNumber: string;
30
+ data: string;
31
+ logIndex: string;
32
+ topics: (string | null)[];
33
+ }>;
34
+ type Log = Readonly<z.infer<typeof logSchema>>;
35
+ type ReturnType = readonly Log[];
36
+ /** {@link https://docs.blockscout.com/developer-support/api/rpc-endpoints/logs#get-event-logs-by-address-and-or-topic-s} */
37
+ export declare const getEventLogsByAddressAndTopics: ({ apiEndpoint, address, topic0, fromBlock, toBlock, logger, }: GetEventLogsByAddressAndTopicsParameters) => Promise<ReturnType>;
38
+ export {};
39
+ //# sourceMappingURL=getEventLogsByAddressAndTopics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEventLogsByAddressAndTopics.d.ts","sourceRoot":"","sources":["../../../../explorers/externals/blockscout/getEventLogsByAddressAndTopics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAIzC,KAAK,wCAAwC,GAAG;IAC9C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAA;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAA;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;EA8Bb,CAAA;AAQF,KAAK,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC,CAAA;AAC9C,KAAK,UAAU,GAAG,SAAS,GAAG,EAAE,CAAA;AAEhC,4HAA4H;AAC5H,eAAO,MAAM,8BAA8B,kEAOxC,wCAAwC,KAAG,QAAQ,UAAU,CAwC/D,CAAA"}
@@ -1,6 +1,7 @@
1
1
  export { getBlockNumberOfTimestamp } from './getBlockNumberOfTimestamp';
2
2
  export { getContractByAddress } from './getContractByAddress';
3
3
  export { getContractCreations } from './getContractCreations';
4
+ export { getEventLogsByAddressAndTopics } from './getEventLogsByAddressAndTopics';
4
5
  export { getInternalTransactionsByAddress } from './getInternalTransactionsByAddress';
5
6
  export { getInternalTransactionsByTransactionHash } from './getInternalTransactionsByTransactionHash';
6
7
  export { getNormalTransactionsByAddress } from './getNormalTransactionsByAddress';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../explorers/externals/blockscout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAA;AACrF,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAA;AACrG,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../explorers/externals/blockscout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAA;AACrF,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAA;AACrG,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA"}
@@ -9,12 +9,12 @@ type GetContractCreationsParameters = {
9
9
  };
10
10
  declare const contractCreationSchema: z.ZodObject<{
11
11
  contractAddress: z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>;
12
- contractCreator: z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>;
13
- txHash: z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>;
12
+ contractCreator: z.ZodUnion<[z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>, z.ZodEffects<z.ZodString, undefined, string>]>;
13
+ txHash: z.ZodUnion<[z.ZodEffects<z.ZodString, `0x${string}`, string>, z.ZodEffects<z.ZodString, undefined, string>]>;
14
14
  }, "strip", z.ZodTypeAny, {
15
15
  contractAddress: `0x${Lowercase<string>}`;
16
- contractCreator: `0x${Lowercase<string>}`;
17
- txHash: `0x${Lowercase<string>}`;
16
+ contractCreator?: `0x${Lowercase<string>}` | undefined;
17
+ txHash?: `0x${string}` | undefined;
18
18
  }, {
19
19
  contractAddress: string;
20
20
  contractCreator: string;
@@ -1 +1 @@
1
- {"version":3,"file":"getContractCreations.d.ts","sourceRoot":"","sources":["../../../../explorers/externals/etherscan/getContractCreations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAIzC,KAAK,8BAA8B,GAAG;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,EAAE,CAAA;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,QAAA,MAAM,sBAAsB;;;;;;;;;;;;EAa1B,CAAA;AAQF,KAAK,gBAAgB,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAA;AACxE,KAAK,UAAU,GAAG,SAAS,gBAAgB,EAAE,CAAA;AAE7C,0GAA0G;AAC1G,eAAO,MAAM,oBAAoB,gDAK9B,8BAA8B,KAAG,QAAQ,UAAU,CAoCrD,CAAA"}
1
+ {"version":3,"file":"getContractCreations.d.ts","sourceRoot":"","sources":["../../../../explorers/externals/etherscan/getContractCreations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAIzC,KAAK,8BAA8B,GAAG;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,EAAE,CAAA;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,QAAA,MAAM,sBAAsB;;;;;;;;;;;;EAmB1B,CAAA;AAQF,KAAK,gBAAgB,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAA;AACxE,KAAK,UAAU,GAAG,SAAS,gBAAgB,EAAE,CAAA;AAE7C,0GAA0G;AAC1G,eAAO,MAAM,oBAAoB,gDAK9B,8BAA8B,KAAG,QAAQ,UAAU,CAoCrD,CAAA"}
@@ -0,0 +1,41 @@
1
+ import type { Logger } from '@0xtorch/core';
2
+ import { z } from 'zod';
3
+ import type { Hex } from '../../../types';
4
+ type GetEventLogsByAddressAndTopicsParameters = {
5
+ readonly apiEndpoint: string;
6
+ readonly apiKey: string;
7
+ readonly address: Hex;
8
+ readonly topic0: Hex;
9
+ readonly fromBlock?: bigint;
10
+ readonly toBlock?: bigint;
11
+ readonly page?: number;
12
+ readonly logger?: Logger;
13
+ };
14
+ declare const logSchema: z.ZodObject<{
15
+ address: z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>;
16
+ topics: z.ZodArray<z.ZodEffects<z.ZodString, `0x${string}`, string>, "many">;
17
+ data: z.ZodEffects<z.ZodString, `0x${string}`, string>;
18
+ blockNumber: z.ZodEffects<z.ZodString, bigint, string>;
19
+ logIndex: z.ZodEffects<z.ZodString, bigint, string>;
20
+ transactionHash: z.ZodEffects<z.ZodString, `0x${string}`, string>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ address: `0x${Lowercase<string>}`;
23
+ transactionHash: `0x${string}`;
24
+ blockNumber: bigint;
25
+ data: `0x${string}`;
26
+ logIndex: bigint;
27
+ topics: `0x${string}`[];
28
+ }, {
29
+ address: string;
30
+ transactionHash: string;
31
+ blockNumber: string;
32
+ data: string;
33
+ logIndex: string;
34
+ topics: string[];
35
+ }>;
36
+ type Log = Readonly<z.infer<typeof logSchema>>;
37
+ type ReturnType = readonly Log[];
38
+ /** {@link https://docs.etherscan.io/api-endpoints/logs#get-event-logs-by-address-filtered-by-topics} */
39
+ export declare const getEventLogsByAddressAndTopics: ({ apiEndpoint, apiKey, address, topic0, fromBlock, toBlock, page, logger, }: GetEventLogsByAddressAndTopicsParameters) => Promise<ReturnType>;
40
+ export {};
41
+ //# sourceMappingURL=getEventLogsByAddressAndTopics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEventLogsByAddressAndTopics.d.ts","sourceRoot":"","sources":["../../../../explorers/externals/etherscan/getEventLogsByAddressAndTopics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAIzC,KAAK,wCAAwC,GAAG;IAC9C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAA;IACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;EA2Bb,CAAA;AAQF,KAAK,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC,CAAA;AAC9C,KAAK,UAAU,GAAG,SAAS,GAAG,EAAE,CAAA;AAEhC,wGAAwG;AACxG,eAAO,MAAM,8BAA8B,gFASxC,wCAAwC,KAAG,QAAQ,UAAU,CA6C/D,CAAA"}
@@ -4,6 +4,7 @@ export { getContractCreations } from './getContractCreations';
4
4
  export { getErc1155TokenTransfersByAddress } from './getErc1155TokenTransfersByAddress';
5
5
  export { getErc20TokenTransfersByAddress } from './getErc20TokenTransfersByAddress';
6
6
  export { getErc721TokenTransfersByAddress } from './getErc721TokenTransfersByAddress';
7
+ export { getEventLogsByAddressAndTopics } from './getEventLogsByAddressAndTopics';
7
8
  export { getInternalTransactionsByAddress } from './getInternalTransactionsByAddress';
8
9
  export { getInternalTransactionsByTransactionHash } from './getInternalTransactionsByTransactionHash';
9
10
  export { getNormalTransactionsByAddress } from './getNormalTransactionsByAddress';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../explorers/externals/etherscan/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAA;AACvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAA;AACrF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAA;AACrF,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAA;AACrG,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../explorers/externals/etherscan/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAA;AACvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAA;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAA;AACrF,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAA;AACrG,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { CryptoCurrency, Logger } from '@0xtorch/core';
2
- import type { Hex, InternalTransaction } from '../types';
2
+ import type { Hex, InternalTransaction, LowerHex } from '../types';
3
3
  export type Explorer = {
4
4
  readonly name: string;
5
5
  readonly url: string;
@@ -13,6 +13,7 @@ export type Explorer = {
13
13
  readonly getBlockNumberOfTimestamp: (timestamp: number, logger?: Logger) => Promise<bigint>;
14
14
  readonly getContract: FunctionGetContract;
15
15
  readonly getContractCreations: FunctionGetContractCreations;
16
+ readonly getEventLogs: FunctionGetEventLogs;
16
17
  readonly getInternalTransactionOfTransaction: FunctionGetInternalTransactionOfTransaction;
17
18
  };
18
19
  type FunctionGetAddressTransactionHashes = (parameters: {
@@ -66,9 +67,21 @@ type FunctionGetContract = (address: Hex, logger?: Logger) => Promise<{
66
67
  readonly abi: string;
67
68
  } | undefined>;
68
69
  type FunctionGetContractCreations = (addresses: readonly Hex[], logger?: Logger) => Promise<readonly {
69
- readonly contractAddress: Hex;
70
- readonly contractCreator: Hex;
71
- readonly txHash: Hex;
70
+ readonly contractAddress: LowerHex;
71
+ readonly contractCreator: LowerHex | undefined;
72
+ readonly txHash: Hex | undefined;
73
+ }[]>;
74
+ type FunctionGetEventLogs = (parameters: {
75
+ readonly address: Hex;
76
+ readonly topic0: Hex;
77
+ readonly fromBlock?: bigint;
78
+ readonly toBlock?: bigint;
79
+ readonly logger?: Logger;
80
+ }) => Promise<readonly {
81
+ blockNumber: bigint;
82
+ transactionHash: Hex;
83
+ data: Hex;
84
+ topics: readonly Hex[];
72
85
  }[]>;
73
86
  type FunctionGetInternalTransactionOfTransaction = (parameters: {
74
87
  readonly hash: Hex;
@@ -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,wCAAwC,EAAE,gDAAgD,CAAA;IACnG,QAAQ,CAAC,8BAA8B,EAAE,sCAAsC,CAAA;IAC/E,QAAQ,CAAC,2CAA2C,EAAE,mDAAmD,CAAA;IACzG,QAAQ,CAAC,6BAA6B,EAAE,qCAAqC,CAAA;IAC7E,QAAQ,CAAC,0CAA0C,EAAE,kDAAkD,CAAA;IACvG,QAAQ,CAAC,yBAAyB,EAAE,CAClC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC,MAAM,CAAC,CAAA;IACpB,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAA;IACzC,QAAQ,CAAC,oBAAoB,EAAE,4BAA4B,CAAA;IAC3D,QAAQ,CAAC,mCAAmC,EAAE,2CAA2C,CAAA;CAC1F,CAAA;AAED,KAAK,mCAAmC,GAAG,CAAC,UAAU,EAAE;IACtD,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAA;IACrB,QA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AE,EACzB,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CACV,SAAS;IACP,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAA;IAClC,QAAQ,CAAC,eAAe,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC9C,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,SAAS,CAAA;CACjC,EAAE,CACJ,CAAA;AAED,KAAK,oBAAoB,GAAG,CAAC,UAAU,EAAE;IACvC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAA;IACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB,KAAK,OAAO,CACX,SAAS;IACP,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,GAAG,CAAA;IACpB,IAAI,EAAE,GAAG,CAAA;IACT,MAAM,EAAE,SAAS,GAAG,EAAE,CAAA;CACvB,EAAE,CACJ,CAAA;AAED,KAAK,2CAA2C,GAAG,CAAC,UAAU,EAAE;IAC9D,QAAQ,CAAC,IAAI,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"}
@@ -81,12 +81,14 @@ export const createViemInstance = (() => {
81
81
  })
82
82
  return await caller(client)
83
83
  } catch (error) {
84
- // TODO 後で消す
85
- console.debug(error)
86
84
  if (error instanceof HttpRequestError && error.status === 429) {
85
+ // TODO 後で消す
86
+ console.debug(error)
87
87
  cooldownEndpoint(endpoint)
88
88
  return await call(chain, caller, timeout - (Date.now() - start))
89
89
  } else if (error instanceof TransactionReceiptNotFoundError) {
90
+ // TODO 後で消す
91
+ console.debug(error)
90
92
  cooldownEndpoint(endpoint, 5000)
91
93
  return await call(chain, caller, timeout - (Date.now() - start))
92
94
  }
package/decoder/tests.ts CHANGED
@@ -76,6 +76,9 @@ const testExplorer: Explorer = {
76
76
  getContractCreations: () => {
77
77
  throw new Error('Not implemented')
78
78
  },
79
+ getEventLogs: () => {
80
+ throw new Error('Not implemented')
81
+ },
79
82
  getInternalTransactionOfTransaction: () => {
80
83
  throw new Error('Not implemented')
81
84
  },
@@ -1,9 +1,10 @@
1
1
  import type { Logger } from '@0xtorch/core'
2
- import type { InternalTransaction, LowerHex } from '../../types'
2
+ import type { Hex, InternalTransaction, LowerHex } from '../../types'
3
3
  import {
4
4
  getContractCreations as apiGetContractCreations,
5
5
  getBlockNumberOfTimestamp,
6
6
  getContractByAddress,
7
+ getEventLogsByAddressAndTopics,
7
8
  getInternalTransactionsByAddress,
8
9
  getInternalTransactionsByTransactionHash,
9
10
  getNormalTransactionsByAddress,
@@ -190,6 +191,36 @@ export const createBlockscout = <
190
191
  })
191
192
  return creations
192
193
  },
194
+ getEventLogs: async ({ address, topic0, fromBlock, toBlock, logger }) => {
195
+ const loop = true
196
+ let mut_fromBlock = fromBlock ?? 0n
197
+ const mut_logs: {
198
+ blockNumber: bigint
199
+ transactionHash: Hex
200
+ data: Hex
201
+ topics: readonly Hex[]
202
+ }[] = []
203
+ while (loop) {
204
+ const logs = await getEventLogsByAddressAndTopics({
205
+ apiEndpoint: apiUrl,
206
+ address,
207
+ topic0,
208
+ fromBlock: mut_fromBlock,
209
+ toBlock: toBlock ?? 'latest',
210
+ logger,
211
+ })
212
+ mut_logs.push(...logs)
213
+ if (logs.length < 1000) {
214
+ break
215
+ }
216
+ const maxBlockNumber = logs.reduce(
217
+ (max, { blockNumber }) => (max < blockNumber ? blockNumber : max),
218
+ logs[0].blockNumber,
219
+ )
220
+ mut_fromBlock = maxBlockNumber
221
+ }
222
+ return mut_logs
223
+ },
193
224
  getInternalTransactionOfTransaction: async ({
194
225
  hash,
195
226
  nativeCurrency,
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from '@0xtorch/core'
2
- import type { InternalTransaction, LowerHex } from '../../types'
2
+ import type { Hex, InternalTransaction, LowerHex } from '../../types'
3
3
  import {
4
4
  getContractCreations as apiGetContractCreations,
5
5
  getBlockNumberOfTimestamp,
@@ -7,6 +7,7 @@ import {
7
7
  getErc1155TokenTransfersByAddress,
8
8
  getErc20TokenTransfersByAddress,
9
9
  getErc721TokenTransfersByAddress,
10
+ getEventLogsByAddressAndTopics,
10
11
  getInternalTransactionsByAddress,
11
12
  getInternalTransactionsByTransactionHash,
12
13
  getNormalTransactionsByAddress,
@@ -262,7 +263,39 @@ export const createEtherscan = <
262
263
  addresses,
263
264
  logger,
264
265
  })
265
- return creations
266
+ return creations.map((creation) => ({
267
+ contractAddress: creation.contractAddress,
268
+ contractCreator: creation.contractCreator,
269
+ txHash: creation.txHash,
270
+ }))
271
+ },
272
+ getEventLogs: async ({ address, topic0, fromBlock, toBlock, logger }) => {
273
+ const loop = true
274
+ let mut_page: number | undefined
275
+ const mut_logs: {
276
+ blockNumber: bigint
277
+ transactionHash: Hex
278
+ data: Hex
279
+ topics: readonly Hex[]
280
+ }[] = []
281
+ while (loop) {
282
+ const logs = await getEventLogsByAddressAndTopics({
283
+ apiEndpoint: apiUrl,
284
+ apiKey,
285
+ address,
286
+ topic0,
287
+ fromBlock,
288
+ toBlock,
289
+ page: mut_page,
290
+ logger,
291
+ })
292
+ mut_logs.push(...logs)
293
+ if (logs.length < 1000) {
294
+ break
295
+ }
296
+ mut_page = (mut_page ?? 0) + 1
297
+ }
298
+ return mut_logs
266
299
  },
267
300
  getInternalTransactionOfTransaction: async ({
268
301
  hash,
@@ -130,6 +130,12 @@ export const createRoninExplorer = <
130
130
  }
131
131
  throw new Error('Not supported')
132
132
  },
133
+ getEventLogs: ({ logger }) => {
134
+ if (logger !== undefined) {
135
+ logger.info('getEventLogs is not supported on Ronin Explorer')
136
+ }
137
+ throw new Error('Not supported')
138
+ },
133
139
  getInternalTransactionOfTransaction: async ({
134
140
  hash,
135
141
  nativeCurrency,
@@ -54,6 +54,11 @@ export const createRoutescan = <
54
54
  await new Promise((resolve) => setTimeout(resolve))
55
55
  throw new Error('not implemented')
56
56
  },
57
+ getEventLogs: async () => {
58
+ // TODO implement
59
+ await new Promise((resolve) => setTimeout(resolve))
60
+ throw new Error('not implemented')
61
+ },
57
62
  getInternalTransactionOfTransaction: async () => {
58
63
  // TODO implement
59
64
  await new Promise((resolve) => setTimeout(resolve))
@@ -0,0 +1,105 @@
1
+ import type { Logger } from '@0xtorch/core'
2
+ import { z } from 'zod'
3
+ import type { Hex } from '../../../types'
4
+ import { isHex, toLowerHex } from '../../../types'
5
+ import { createBlockscoutClient } from './middleware'
6
+
7
+ type GetEventLogsByAddressAndTopicsParameters = {
8
+ readonly apiEndpoint: string
9
+ readonly address: Hex
10
+ readonly topic0: Hex
11
+ readonly fromBlock: bigint | 'latest'
12
+ readonly toBlock: bigint | 'latest'
13
+ readonly logger?: Logger
14
+ }
15
+
16
+ const logSchema = z.object({
17
+ address: z
18
+ .string()
19
+ .regex(/^0x[\da-f]{40}$/)
20
+ .transform((x) => (isHex(x) ? toLowerHex(x) : '0x')),
21
+ topics: z
22
+ .array(
23
+ z
24
+ .string()
25
+ .regex(/^0x[\da-f]{64}$/)
26
+ .transform((x) => (isHex(x) ? x : '0x'))
27
+ .nullable(),
28
+ )
29
+ .transform((x) => x.filter((y): y is Hex => y !== null)),
30
+ data: z
31
+ .string()
32
+ .regex(/^0x[\da-f]*$/)
33
+ .transform((x) => (isHex(x) ? x : '0x')),
34
+ blockNumber: z
35
+ .string()
36
+ .regex(/^0x[\da-f]*$/)
37
+ .transform(BigInt),
38
+ logIndex: z
39
+ .string()
40
+ .regex(/^0x[\da-f]*$/)
41
+ .transform(BigInt),
42
+ transactionHash: z
43
+ .string()
44
+ .regex(/^0x[\da-f]{64}$/)
45
+ .transform((x) => (isHex(x) ? x : '0x')),
46
+ })
47
+
48
+ const responseSchema = z.object({
49
+ status: z.string(),
50
+ message: z.string(),
51
+ result: z.union([z.array(logSchema), z.string()]).nullable(),
52
+ })
53
+
54
+ type Log = Readonly<z.infer<typeof logSchema>>
55
+ type ReturnType = readonly Log[]
56
+
57
+ /** {@link https://docs.blockscout.com/developer-support/api/rpc-endpoints/logs#get-event-logs-by-address-and-or-topic-s} */
58
+ export const getEventLogsByAddressAndTopics = async ({
59
+ apiEndpoint,
60
+ address,
61
+ topic0,
62
+ fromBlock,
63
+ toBlock,
64
+ logger,
65
+ }: GetEventLogsByAddressAndTopicsParameters): Promise<ReturnType> => {
66
+ try {
67
+ const { status, message, result } = await createBlockscoutClient(
68
+ apiEndpoint,
69
+ ).get(
70
+ '',
71
+ {
72
+ module: 'logs',
73
+ action: 'getLogs',
74
+ address,
75
+ topic0,
76
+ fromBlock: fromBlock.toString(),
77
+ toBlock: toBlock.toString(),
78
+ },
79
+ responseSchema,
80
+ logger,
81
+ )
82
+ if (status !== '1' || result === null) {
83
+ const error =
84
+ typeof result === 'string' ? new Error(result) : new Error(message)
85
+ throw error
86
+ }
87
+ if (typeof result === 'string') {
88
+ throw new TypeError(result)
89
+ }
90
+ return result
91
+ } catch (error) {
92
+ if (error instanceof Error && error.message === 'Max rate limit reached') {
93
+ await new Promise((resolve) => setTimeout(resolve, 1000))
94
+ return await getEventLogsByAddressAndTopics({
95
+ apiEndpoint,
96
+ address,
97
+ topic0,
98
+ fromBlock,
99
+ toBlock,
100
+ logger,
101
+ })
102
+ }
103
+ throw error
104
+ }
105
+ }
@@ -1,6 +1,7 @@
1
1
  export { getBlockNumberOfTimestamp } from './getBlockNumberOfTimestamp'
2
2
  export { getContractByAddress } from './getContractByAddress'
3
3
  export { getContractCreations } from './getContractCreations'
4
+ export { getEventLogsByAddressAndTopics } from './getEventLogsByAddressAndTopics'
4
5
  export { getInternalTransactionsByAddress } from './getInternalTransactionsByAddress'
5
6
  export { getInternalTransactionsByTransactionHash } from './getInternalTransactionsByTransactionHash'
6
7
  export { getNormalTransactionsByAddress } from './getNormalTransactionsByAddress'
@@ -16,14 +16,20 @@ const contractCreationSchema = z.object({
16
16
  .string()
17
17
  .regex(/^0x[\da-f]{40}$/)
18
18
  .transform((x) => (isHex(x) ? toLowerHex(x) : '0x')),
19
- contractCreator: z
20
- .string()
21
- .regex(/^0x[\da-f]{40}$/)
22
- .transform((x) => (isHex(x) ? toLowerHex(x) : '0x')),
23
- txHash: z
24
- .string()
25
- .regex(/^0x[\da-f]{64}$/)
26
- .transform((x) => (isHex(x) ? toLowerHex(x) : '0x')),
19
+ contractCreator: z.union([
20
+ z
21
+ .string()
22
+ .regex(/^0x[\da-f]{40}$/)
23
+ .transform((x) => (isHex(x) ? toLowerHex(x) : '0x')),
24
+ z.string().transform(() => undefined),
25
+ ]),
26
+ txHash: z.union([
27
+ z
28
+ .string()
29
+ .regex(/^0x[\da-f]{64}$/)
30
+ .transform((x) => (isHex(x) ? x : '0x')),
31
+ z.string().transform(() => undefined),
32
+ ]),
27
33
  })
28
34
 
29
35
  const responseSchema = z.object({