@0xtorch/evm 0.0.110 → 0.0.111

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 (82) hide show
  1. package/_cjs/explorer/blockscout/create.js +10 -5
  2. package/_cjs/explorer/blockscout/create.js.map +1 -1
  3. package/_cjs/explorer/blockscout/getTokenTransferEventsByAddress.js +44 -6
  4. package/_cjs/explorer/blockscout/getTokenTransferEventsByAddress.js.map +1 -1
  5. package/_cjs/explorer/blockscout/getTransactionsByAddress.js +4 -0
  6. package/_cjs/explorer/blockscout/getTransactionsByAddress.js.map +1 -1
  7. package/_cjs/explorer/etherscan/client.js +2 -1
  8. package/_cjs/explorer/etherscan/client.js.map +1 -1
  9. package/_cjs/explorer/etherscan/create.js +10 -5
  10. package/_cjs/explorer/etherscan/create.js.map +1 -1
  11. package/_cjs/explorer/etherscan/getListOfErc20TokenTransferEventsByAddress.js +28 -6
  12. package/_cjs/explorer/etherscan/getListOfErc20TokenTransferEventsByAddress.js.map +1 -1
  13. package/_cjs/explorer/etherscan/getListOfNormalTransactionsByAddress.js +4 -0
  14. package/_cjs/explorer/etherscan/getListOfNormalTransactionsByAddress.js.map +1 -1
  15. package/_cjs/explorer/moralis/create.js +16 -1
  16. package/_cjs/explorer/moralis/create.js.map +1 -1
  17. package/_cjs/explorer/moralis/getWalletTransactionHistory.js +2 -0
  18. package/_cjs/explorer/moralis/getWalletTransactionHistory.js.map +1 -1
  19. package/_cjs/logic/getAddressIndexData.js +2 -1
  20. package/_cjs/logic/getAddressIndexData.js.map +1 -1
  21. package/_cjs/logic/getTransactionDetail/index.js +10 -5
  22. package/_cjs/logic/getTransactionDetail/index.js.map +1 -1
  23. package/_cjs/types/transactionIndex.js +7 -1
  24. package/_cjs/types/transactionIndex.js.map +1 -1
  25. package/_esm/explorer/blockscout/create.js +10 -5
  26. package/_esm/explorer/blockscout/create.js.map +1 -1
  27. package/_esm/explorer/blockscout/getTokenTransferEventsByAddress.js +45 -7
  28. package/_esm/explorer/blockscout/getTokenTransferEventsByAddress.js.map +1 -1
  29. package/_esm/explorer/blockscout/getTransactionsByAddress.js +5 -1
  30. package/_esm/explorer/blockscout/getTransactionsByAddress.js.map +1 -1
  31. package/_esm/explorer/etherscan/client.js +2 -1
  32. package/_esm/explorer/etherscan/client.js.map +1 -1
  33. package/_esm/explorer/etherscan/create.js +10 -5
  34. package/_esm/explorer/etherscan/create.js.map +1 -1
  35. package/_esm/explorer/etherscan/getListOfErc20TokenTransferEventsByAddress.js +29 -7
  36. package/_esm/explorer/etherscan/getListOfErc20TokenTransferEventsByAddress.js.map +1 -1
  37. package/_esm/explorer/etherscan/getListOfNormalTransactionsByAddress.js +5 -1
  38. package/_esm/explorer/etherscan/getListOfNormalTransactionsByAddress.js.map +1 -1
  39. package/_esm/explorer/moralis/create.js +16 -1
  40. package/_esm/explorer/moralis/create.js.map +1 -1
  41. package/_esm/explorer/moralis/getWalletTransactionHistory.js +2 -0
  42. package/_esm/explorer/moralis/getWalletTransactionHistory.js.map +1 -1
  43. package/_esm/logic/getAddressIndexData.js +2 -1
  44. package/_esm/logic/getAddressIndexData.js.map +1 -1
  45. package/_esm/logic/getTransactionDetail/index.js +10 -5
  46. package/_esm/logic/getTransactionDetail/index.js.map +1 -1
  47. package/_esm/types/transactionIndex.js +7 -1
  48. package/_esm/types/transactionIndex.js.map +1 -1
  49. package/_types/explorer/blockscout/create.d.ts.map +1 -1
  50. package/_types/explorer/blockscout/getTokenTransferEventsByAddress.d.ts +5 -1
  51. package/_types/explorer/blockscout/getTokenTransferEventsByAddress.d.ts.map +1 -1
  52. package/_types/explorer/blockscout/getTransactionsByAddress.d.ts.map +1 -1
  53. package/_types/explorer/etherscan/client.d.ts.map +1 -1
  54. package/_types/explorer/etherscan/create.d.ts.map +1 -1
  55. package/_types/explorer/etherscan/getListOfErc20TokenTransferEventsByAddress.d.ts +5 -1
  56. package/_types/explorer/etherscan/getListOfErc20TokenTransferEventsByAddress.d.ts.map +1 -1
  57. package/_types/explorer/etherscan/getListOfNormalTransactionsByAddress.d.ts.map +1 -1
  58. package/_types/explorer/moralis/create.d.ts.map +1 -1
  59. package/_types/explorer/moralis/getWalletTransactionHistory.d.ts +2 -0
  60. package/_types/explorer/moralis/getWalletTransactionHistory.d.ts.map +1 -1
  61. package/_types/explorer/types.d.ts +5 -2
  62. package/_types/explorer/types.d.ts.map +1 -1
  63. package/_types/logic/getAddressIndexData.d.ts +4 -2
  64. package/_types/logic/getAddressIndexData.d.ts.map +1 -1
  65. package/_types/logic/getTransactionDetail/index.d.ts +3 -1
  66. package/_types/logic/getTransactionDetail/index.d.ts.map +1 -1
  67. package/_types/types/transactionIndex.d.ts +9 -2
  68. package/_types/types/transactionIndex.d.ts.map +1 -1
  69. package/explorer/blockscout/create.ts +20 -12
  70. package/explorer/blockscout/getTokenTransferEventsByAddress.ts +52 -10
  71. package/explorer/blockscout/getTransactionsByAddress.ts +5 -1
  72. package/explorer/etherscan/client.ts +6 -1
  73. package/explorer/etherscan/create.ts +21 -13
  74. package/explorer/etherscan/getListOfErc20TokenTransferEventsByAddress.ts +34 -10
  75. package/explorer/etherscan/getListOfNormalTransactionsByAddress.ts +5 -1
  76. package/explorer/moralis/create.ts +19 -2
  77. package/explorer/moralis/getWalletTransactionHistory.ts +2 -0
  78. package/explorer/types.ts +5 -2
  79. package/logic/getAddressIndexData.ts +26 -20
  80. package/logic/getTransactionDetail/index.ts +13 -4
  81. package/package.json +1 -1
  82. package/types/transactionIndex.ts +11 -5
@@ -1 +1 @@
1
- {"version":3,"file":"getListOfErc20TokenTransferEventsByAddress.d.ts","sourceRoot":"","sources":["../../../explorer/etherscan/getListOfErc20TokenTransferEventsByAddress.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,oDAAoD,GAAG;IAC1D,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAAA;AASD,oHAAoH;AACpH,eAAO,MAAM,0CAA0C,4EASpD,oDAAoD,KAAG,OAAO,CAC/D,gBAAgB,EAAE,CAiCnB,CAAA"}
1
+ {"version":3,"file":"getListOfErc20TokenTransferEventsByAddress.d.ts","sourceRoot":"","sources":["../../../explorer/etherscan/getListOfErc20TokenTransferEventsByAddress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,oDAAoD,GAAG;IAC1D,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAAA;AAaD,oHAAoH;AACpH,eAAO,MAAM,0CAA0C,4EASpD,oDAAoD,KAAG,OAAO,CAAC;IAChE,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACpC,cAAc,EAAE,SAAS,aAAa,EAAE,CAAA;CACzC,CAkDA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getListOfNormalTransactionsByAddress.d.ts","sourceRoot":"","sources":["../../../explorer/etherscan/getListOfNormalTransactionsByAddress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,8CAA8C,GAAG;IACpD,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,GAAG,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAAA;AASD,4GAA4G;AAC5G,eAAO,MAAM,oCAAoC,4EAS9C,8CAA8C,KAAG,OAAO,CACzD,gBAAgB,EAAE,CAiCnB,CAAA"}
1
+ {"version":3,"file":"getListOfNormalTransactionsByAddress.d.ts","sourceRoot":"","sources":["../../../explorer/etherscan/getListOfNormalTransactionsByAddress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,8CAA8C,GAAG;IACpD,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,GAAG,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAAA;AAWD,4GAA4G;AAC5G,eAAO,MAAM,oCAAoC,4EAS9C,8CAA8C,KAAG,OAAO,CACzD,gBAAgB,EAAE,CAmCnB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/moralis/create.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC,KAAK,+BAA+B,GAAG;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAID,eAAO,MAAM,qBAAqB,gDAM/B,+BAA+B,KAAG,QAwKpC,CAAA"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/moralis/create.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC,KAAK,+BAA+B,GAAG;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAID,eAAO,MAAM,qBAAqB,gDAM/B,+BAA+B,KAAG,QAwLpC,CAAA"}
@@ -22,9 +22,11 @@ export declare const getWalletTransactionHistory: ({ client, address, chain, fro
22
22
  to_address: `0x${Lowercase<string>}`;
23
23
  }[];
24
24
  erc20_transfers: {
25
+ address: `0x${Lowercase<string>}`;
25
26
  value: bigint;
26
27
  from_address: `0x${Lowercase<string>}`;
27
28
  to_address: `0x${Lowercase<string>}`;
29
+ log_index: number;
28
30
  }[];
29
31
  internal_transactions: {
30
32
  from: `0x${Lowercase<string>}`;
@@ -1 +1 @@
1
- {"version":3,"file":"getWalletTransactionHistory.d.ts","sourceRoot":"","sources":["../../../explorer/moralis/getWalletTransactionHistory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA0H7C,KAAK,qCAAqC,GAAG;IAC3C,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,2BAA2B,qEAQrC,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCvC,CAAA"}
1
+ {"version":3,"file":"getWalletTransactionHistory.d.ts","sourceRoot":"","sources":["../../../explorer/moralis/getWalletTransactionHistory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA4H7C,KAAK,qCAAqC,GAAG;IAC3C,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,2BAA2B,qEAQrC,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCvC,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { Hex, LowerHex } from '../types';
1
+ import type { Erc20Transfer, Hex, LowerHex } from '../types';
2
2
  import type { InternalTransactionWithIndex } from '../types/internalTransaction';
3
3
  import type { Log } from '../types/log';
4
4
  import type { TransactionIndex } from '../types/transactionIndex';
@@ -43,7 +43,10 @@ type FunctionGetAddressTokenTransferIndexes = (parameters: {
43
43
  fromBlock?: number;
44
44
  toBlock?: number;
45
45
  headers?: Record<string, string>;
46
- }) => Promise<TransactionIndex[]>;
46
+ }) => Promise<{
47
+ indexes: TransactionIndex[];
48
+ erc20Transfers: Erc20Transfer[];
49
+ }>;
47
50
  type FunctionGetBlockNumberOfTimestamp = (parameters: {
48
51
  /** Unix timestamp in milliseconds */
49
52
  timestamp: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../explorer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAEjE,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,EAAE,QAAQ,CAAA;IACzB,eAAe,EAAE,QAAQ,CAAA;IACzB,MAAM,EAAE,QAAQ,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,GAAG,GAAG;IACrC,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO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AAoB,GAAG,CAAC,UAAU,EAAE;IACvC,OAAO,EAAE,GAAG,CAAA;IACZ,MAAM,EAAE,QAAQ,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,KAAK,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAA;AAEnC,KAAK,2CAA2C,GAAG,CAAC,UAAU,EAAE;IAC9D,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,KAAK,OAAO,CAAC,4BAA4B,EAAE,CAAC,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import type { Chain } from '../chain';
2
+ import type { Erc20Transfer } from '../types';
2
3
  import type { LowerHex } from '../types/hex';
3
4
  import type { InternalTransaction } from '../types/internalTransaction';
4
5
  import type { TransactionIndex } from '../types/transactionIndex';
@@ -9,8 +10,9 @@ type GetAddressIndexDataParameters = {
9
10
  toBlock?: number;
10
11
  };
11
12
  type GetAddressIndexDataReturnTypes = {
12
- readonly transactionIndexes: readonly TransactionIndex[];
13
- readonly internalTransactions: readonly InternalTransaction[];
13
+ transactionIndexes: readonly TransactionIndex[];
14
+ internalTransactions: readonly InternalTransaction[];
15
+ erc20Transfers: readonly Erc20Transfer[];
14
16
  };
15
17
  export declare const getAddressIndexData: ({ chain, address, fromBlock, toBlock, }: GetAddressIndexDataParameters) => Promise<GetAddressIndexDataReturnTypes>;
16
18
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"getAddressIndexData.d.ts","sourceRoot":"","sources":["../../logic/getAddressIndexData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EA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AED,eAAO,MAAM,mBAAmB,4CAK7B,6BAA6B,KAAG,OAAO,CAAC,8BAA8B,CAiDxE,CAAA"}
@@ -7,7 +7,9 @@ type GetTransactionDetailParameters = {
7
7
  timestamp?: number;
8
8
  internalTransactions?: readonly InternalTransaction[];
9
9
  timeout?: number;
10
+ input?: LowerHex;
11
+ value?: bigint;
10
12
  };
11
- export declare const getTransactionDetail: ({ chain, hash, timestamp: optionalTimestamp, internalTransactions, timeout, }: GetTransactionDetailParameters) => Promise<TransactionDetail>;
13
+ export declare const getTransactionDetail: ({ chain, hash, timestamp: optionalTimestamp, internalTransactions, timeout, input, value, }: GetTransactionDetailParameters) => Promise<TransactionDetail>;
12
14
  export {};
13
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../logic/getTransactionDetail/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EAEd,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAGtE,KAAK,8BAA8B,GAAG;IACpC,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oBAAoB,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACrD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,oBAAoB,kFAM9B,8BAA8B,KAAG,OAAO,CAAC,iBAAiB,CAiD5D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../logic/getTransactionDetail/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EAEd,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAGtE,KAAK,8BAA8B,GAAG;IACpC,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oBAAoB,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACrD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,oBAAoB,gGAQ9B,8BAA8B,KAAG,OAAO,CAAC,iBAAiB,CAsD5D,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { z } from 'zod';
2
- declare const transactionIndexSchema: z.ZodObject<Pick<{
2
+ declare const transactionIndexSchema: z.ZodObject<z.objectUtil.extendShape<Pick<{
3
3
  blockNumber: z.ZodNumber;
4
4
  chainId: z.ZodNumber;
5
5
  contractAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>>;
@@ -147,14 +147,21 @@ declare const transactionIndexSchema: z.ZodObject<Pick<{
147
147
  timestamp: z.ZodNumber;
148
148
  to: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>>;
149
149
  value: z.ZodEffects<z.ZodString, bigint, string>;
150
- }, "hash" | "blockNumber" | "timestamp">, "strip", z.ZodTypeAny, {
150
+ }, "hash" | "blockNumber" | "timestamp">, {
151
+ input: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>>;
152
+ value: z.ZodOptional<z.ZodEffects<z.ZodString, bigint, string>>;
153
+ }>, "strip", z.ZodTypeAny, {
151
154
  hash: `0x${Lowercase<string>}`;
152
155
  blockNumber: number;
153
156
  timestamp: number;
157
+ value?: bigint | undefined;
158
+ input?: `0x${Lowercase<string>}` | undefined;
154
159
  }, {
155
160
  hash: string;
156
161
  blockNumber: number;
157
162
  timestamp: number;
163
+ value?: string | undefined;
164
+ input?: string | undefined;
158
165
  }>;
159
166
  export type TransactionIndex = z.infer<typeof transactionIndexSchema>;
160
167
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"transactionIndex.d.ts","sourceRoot":"","sources":["../../types/transactionIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAG5B,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI1B,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
1
+ {"version":3,"file":"transactionIndex.d.ts","sourceRoot":"","sources":["../../types/transactionIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAI5B,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxB,CAAA;AAEJ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { LowerHex } from '../../types'
1
+ import type { Erc20Transfer, LowerHex } from '../../types'
2
2
  import type { InternalTransactionWithIndex } from '../../types/internalTransaction'
3
3
  import type { TransactionIndex } from '../../types/transactionIndex'
4
4
  import { createInternalTransactionId } from '../../utils/createInternalTransactionId'
@@ -104,29 +104,37 @@ export const createBlockscout = ({
104
104
  headers,
105
105
  }) => {
106
106
  const indexes = new Map<LowerHex, TransactionIndex>()
107
+ const erc20Transfers: Erc20Transfer[] = []
107
108
  let startblock = fromBlock
108
109
  const endblock = toBlock
109
110
  const maxPageSize = 10_000
110
111
  while (true) {
111
- const result = await getTokenTransferEventsByAddress({
112
- client,
113
- address,
114
- startblock,
115
- endblock,
116
- headers,
117
- })
118
- for (const index of result) {
112
+ const { indexes: resultIndexes, erc20Transfers: resultErc20Transfers } =
113
+ await getTokenTransferEventsByAddress({
114
+ client,
115
+ address,
116
+ startblock,
117
+ endblock,
118
+ headers,
119
+ })
120
+ for (const index of resultIndexes) {
119
121
  if (!indexes.has(index.hash)) {
120
122
  indexes.set(index.hash, index)
121
123
  }
122
124
  }
123
- if (result.length < maxPageSize) {
125
+ erc20Transfers.push(...resultErc20Transfers)
126
+ if (resultIndexes.length < maxPageSize) {
124
127
  break
125
128
  }
126
- const maxBlockNumber = Math.max(...result.map((x) => x.blockNumber))
129
+ const maxBlockNumber = Math.max(
130
+ ...resultIndexes.map((x) => x.blockNumber),
131
+ )
127
132
  startblock = maxBlockNumber
128
133
  }
129
- return [...indexes.values()]
134
+ return {
135
+ indexes: [...indexes.values()],
136
+ erc20Transfers,
137
+ }
130
138
  },
131
139
  getBlockNumberOfTimestamp: ({ timestamp, headers }) =>
132
140
  getBlockNumberByTimestamp({
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod'
2
- import { lowerHexSchema } from '../../types/primitive'
2
+ import type { Erc20Transfer } from '../../types'
3
+ import { bigintTextSchema, lowerHexSchema } from '../../types/primitive'
3
4
  import type { TransactionIndex } from '../../types/transactionIndex'
4
5
  import type { BlockscoutClient } from './client'
5
6
 
@@ -18,6 +19,21 @@ const transferSchema = z.object({
18
19
  blockNumber: z.string().regex(/^\d+$/).transform(Number),
19
20
  hash: lowerHexSchema,
20
21
  timeStamp: z.string().regex(/^\d+$/).transform(Number),
22
+ contractAddress: lowerHexSchema,
23
+ from: lowerHexSchema,
24
+ to: lowerHexSchema,
25
+ logIndex: z.string().regex(/^\d+$/).transform(Number),
26
+ tokenDecimal: z
27
+ .union([
28
+ z.literal('').transform(() => undefined),
29
+ z.string().regex(/^\d+$/).transform(Number),
30
+ ])
31
+ .nullable()
32
+ .optional(),
33
+ value: z
34
+ .union([z.literal('').transform(() => undefined), bigintTextSchema])
35
+ .nullable()
36
+ .optional(),
21
37
  })
22
38
  const resultSchema = z.array(transferSchema)
23
39
 
@@ -31,9 +47,10 @@ export const getTokenTransferEventsByAddress = async ({
31
47
  offset = 10_000,
32
48
  sort = 'asc',
33
49
  headers,
34
- }: GetTokenTransferEventsByAddressParameters): Promise<
35
- readonly TransactionIndex[]
36
- > => {
50
+ }: GetTokenTransferEventsByAddressParameters): Promise<{
51
+ indexes: readonly TransactionIndex[]
52
+ erc20Transfers: readonly Erc20Transfer[]
53
+ }> => {
37
54
  try {
38
55
  const result = await client.get({
39
56
  path: '',
@@ -54,17 +71,42 @@ export const getTokenTransferEventsByAddress = async ({
54
71
  resultSchema,
55
72
  headers,
56
73
  })
57
- return result.map((v) => ({
58
- blockNumber: v.blockNumber,
59
- hash: v.hash,
60
- timestamp: v.timeStamp * 1000,
61
- }))
74
+ const indexes: TransactionIndex[] = []
75
+ const transfers: Erc20Transfer[] = []
76
+ for (const data of result) {
77
+ indexes.push({
78
+ blockNumber: data.blockNumber,
79
+ hash: data.hash,
80
+ timestamp: data.timeStamp * 1000,
81
+ })
82
+ if (
83
+ data.tokenDecimal !== null &&
84
+ data.tokenDecimal !== undefined &&
85
+ data.value !== null &&
86
+ data.value !== undefined
87
+ ) {
88
+ transfers.push({
89
+ address: data.contractAddress,
90
+ from: data.from,
91
+ logIndex: data.logIndex,
92
+ to: data.to,
93
+ value: data.value,
94
+ })
95
+ }
96
+ }
97
+ return {
98
+ indexes,
99
+ erc20Transfers: transfers,
100
+ }
62
101
  } catch (error) {
63
102
  if (
64
103
  error instanceof Error &&
65
104
  error.message === 'No token transfers found'
66
105
  ) {
67
- return []
106
+ return {
107
+ indexes: [],
108
+ erc20Transfers: [],
109
+ }
68
110
  }
69
111
  throw error
70
112
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod'
2
2
  import type { Hex } from '../../types'
3
- import { lowerHexSchema } from '../../types/primitive'
3
+ import { bigintTextSchema, lowerHexSchema } from '../../types/primitive'
4
4
  import type { TransactionIndex } from '../../types/transactionIndex'
5
5
  import type { BlockscoutClient } from './client'
6
6
 
@@ -19,6 +19,8 @@ const transactionSchema = z.object({
19
19
  blockNumber: z.string().regex(/^\d+$/).transform(Number),
20
20
  hash: lowerHexSchema,
21
21
  timeStamp: z.string().regex(/^\d+$/).transform(Number),
22
+ input: lowerHexSchema,
23
+ value: bigintTextSchema,
22
24
  })
23
25
  const resultSchema = z.array(transactionSchema)
24
26
 
@@ -57,6 +59,8 @@ export const getTransactionsByAddress = async ({
57
59
  blockNumber: v.blockNumber,
58
60
  hash: v.hash,
59
61
  timestamp: v.timeStamp * 1000,
62
+ input: v.input,
63
+ value: v.value,
60
64
  }))
61
65
  } catch (error) {
62
66
  if (error instanceof Error && error.message === 'No transactions found') {
@@ -130,7 +130,12 @@ export const createEtherscanClient = ({
130
130
  await new Promise((resolve) => setTimeout(resolve, 5000))
131
131
  return get({ path, query, resultSchema }, repeat + 1)
132
132
  }
133
- if (error.message.includes('429')) {
133
+ if (
134
+ error.message.includes('429') ||
135
+ error.message.includes(
136
+ 'Unexpected error, timeout or server too busy. Please try again later',
137
+ )
138
+ ) {
134
139
  console.debug(error)
135
140
  await new Promise((resolve) => setTimeout(resolve, 10_000))
136
141
  return await get({ path, query, resultSchema }, repeat + 1)
@@ -1,4 +1,4 @@
1
- import type { LowerHex } from '../../types'
1
+ import type { Erc20Transfer, LowerHex } from '../../types'
2
2
  import type { InternalTransactionWithIndex } from '../../types/internalTransaction'
3
3
  import type { TransactionIndex } from '../../types/transactionIndex'
4
4
  import { createInternalTransactionId } from '../../utils/createInternalTransactionId'
@@ -114,28 +114,33 @@ export const createEtherscan = ({
114
114
  headers,
115
115
  }) => {
116
116
  const indexes = new Map<LowerHex, TransactionIndex>()
117
+ const erc20Transfers: Erc20Transfer[] = []
117
118
  const endblock = toBlock
118
119
 
119
120
  // ERC20
120
121
  let startblock = fromBlock
121
122
  while (true) {
122
- const result = await getListOfErc20TokenTransferEventsByAddress({
123
- client,
124
- address,
125
- startblock,
126
- endblock,
127
- offset: pageSize,
128
- headers,
129
- })
130
- for (const index of result) {
123
+ const { indexes: resultIndexes, erc20Transfers: resultErc20Transfers } =
124
+ await getListOfErc20TokenTransferEventsByAddress({
125
+ client,
126
+ address,
127
+ startblock,
128
+ endblock,
129
+ offset: pageSize,
130
+ headers,
131
+ })
132
+ for (const index of resultIndexes) {
131
133
  if (!indexes.has(index.hash)) {
132
134
  indexes.set(index.hash, index)
133
135
  }
134
136
  }
135
- if (result.length < pageSize) {
137
+ erc20Transfers.push(...resultErc20Transfers)
138
+ if (resultIndexes.length < pageSize) {
136
139
  break
137
140
  }
138
- const maxBlockNumber = Math.max(...result.map((x) => x.blockNumber))
141
+ const maxBlockNumber = Math.max(
142
+ ...resultIndexes.map((x) => x.blockNumber),
143
+ )
139
144
  startblock = maxBlockNumber
140
145
  }
141
146
 
@@ -185,7 +190,10 @@ export const createEtherscan = ({
185
190
  startblock = maxBlockNumber
186
191
  }
187
192
 
188
- return [...indexes.values()]
193
+ return {
194
+ indexes: [...indexes.values()],
195
+ erc20Transfers,
196
+ }
189
197
  },
190
198
  getBlockNumberOfTimestamp: ({ timestamp, headers }): Promise<number> =>
191
199
  getBlockNumberByTimestamp({
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod'
2
- import { lowerHexSchema } from '../../types/primitive'
2
+ import type { Erc20Transfer } from '../../types'
3
+ import { bigintTextSchema, lowerHexSchema } from '../../types/primitive'
3
4
  import type { TransactionIndex } from '../../types/transactionIndex'
4
5
  import type { EtherscanClient } from './client'
5
6
 
@@ -18,6 +19,10 @@ const transferSchema = z.object({
18
19
  blockNumber: z.string().regex(/^\d+$/).transform(Number),
19
20
  hash: lowerHexSchema,
20
21
  timeStamp: z.string().regex(/^\d+$/).transform(Number),
22
+ contractAddress: lowerHexSchema,
23
+ from: lowerHexSchema,
24
+ to: lowerHexSchema,
25
+ value: bigintTextSchema,
21
26
  })
22
27
  const resultSchema = z.array(transferSchema)
23
28
 
@@ -31,9 +36,10 @@ export const getListOfErc20TokenTransferEventsByAddress = async ({
31
36
  offset = 10_000,
32
37
  sort = 'asc',
33
38
  headers,
34
- }: GetListOfErc20TokenTransferEventsByAddressParameters): Promise<
35
- TransactionIndex[]
36
- > => {
39
+ }: GetListOfErc20TokenTransferEventsByAddressParameters): Promise<{
40
+ indexes: readonly TransactionIndex[]
41
+ erc20Transfers: readonly Erc20Transfer[]
42
+ }> => {
37
43
  try {
38
44
  const result = await client.get({
39
45
  path: '',
@@ -54,14 +60,32 @@ export const getListOfErc20TokenTransferEventsByAddress = async ({
54
60
  resultSchema,
55
61
  headers,
56
62
  })
57
- return result.map((v) => ({
58
- blockNumber: v.blockNumber,
59
- hash: v.hash,
60
- timestamp: v.timeStamp * 1000,
61
- }))
63
+ const indexes: TransactionIndex[] = []
64
+ const transfers: Erc20Transfer[] = []
65
+ for (const data of result) {
66
+ indexes.push({
67
+ blockNumber: data.blockNumber,
68
+ hash: data.hash,
69
+ timestamp: data.timeStamp * 1000,
70
+ })
71
+ transfers.push({
72
+ address: data.contractAddress,
73
+ from: data.from,
74
+ logIndex: 0,
75
+ to: data.to,
76
+ value: data.value,
77
+ })
78
+ }
79
+ return {
80
+ indexes,
81
+ erc20Transfers: transfers,
82
+ }
62
83
  } catch (error) {
63
84
  if (error instanceof Error && error.message === 'No transactions found') {
64
- return []
85
+ return {
86
+ indexes: [],
87
+ erc20Transfers: [],
88
+ }
65
89
  }
66
90
  throw error
67
91
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod'
2
2
  import type { Hex } from '../../types'
3
- import { lowerHexSchema } from '../../types/primitive'
3
+ import { bigintTextSchema, lowerHexSchema } from '../../types/primitive'
4
4
  import type { TransactionIndex } from '../../types/transactionIndex'
5
5
  import type { EtherscanClient } from './client'
6
6
 
@@ -19,6 +19,8 @@ const transactionSchema = z.object({
19
19
  blockNumber: z.string().regex(/^\d+$/).transform(Number),
20
20
  hash: lowerHexSchema,
21
21
  timeStamp: z.string().regex(/^\d+$/).transform(Number),
22
+ input: lowerHexSchema,
23
+ value: bigintTextSchema,
22
24
  })
23
25
  const resultSchema = z.array(transactionSchema)
24
26
 
@@ -59,6 +61,8 @@ export const getListOfNormalTransactionsByAddress = async ({
59
61
  blockNumber: v.blockNumber,
60
62
  hash: v.hash,
61
63
  timestamp: v.timeStamp * 1000,
64
+ input: v.input,
65
+ value: v.value,
62
66
  }))
63
67
  } catch (error) {
64
68
  if (error instanceof Error && error.message === 'No transactions found') {
@@ -1,4 +1,5 @@
1
1
  import {
2
+ type Erc20Transfer,
2
3
  type InternalTransactionWithIndex,
3
4
  type LowerHex,
4
5
  type TransactionIndex,
@@ -123,6 +124,7 @@ export const createMoralisExplorer = ({
123
124
  hash: transaction.hash,
124
125
  blockNumber: transaction.block_number,
125
126
  timestamp: transaction.block_timestamp,
127
+ value: transaction.value,
126
128
  }
127
129
  indexes.set(data.hash, data)
128
130
  }
@@ -140,9 +142,10 @@ export const createMoralisExplorer = ({
140
142
  fromBlock,
141
143
  toBlock,
142
144
  headers,
143
- }): Promise<TransactionIndex[]> => {
145
+ }) => {
144
146
  const lowerAddress = toLowerHex(address)
145
147
  const indexes = new Map<LowerHex, TransactionIndex>()
148
+ const erc20Transfers: Erc20Transfer[] = []
146
149
 
147
150
  let count = 0
148
151
  let cursor: string | undefined = undefined
@@ -165,9 +168,20 @@ export const createMoralisExplorer = ({
165
168
  hash: transaction.hash,
166
169
  blockNumber: transaction.block_number,
167
170
  timestamp: transaction.block_timestamp,
171
+ value: transaction.value,
168
172
  }
169
173
  indexes.set(data.hash, data)
170
174
  }
175
+
176
+ for (const transfer of transaction.erc20_transfers) {
177
+ erc20Transfers.push({
178
+ address: transfer.address,
179
+ from: transfer.from_address,
180
+ logIndex: transfer.log_index,
181
+ to: transfer.to_address,
182
+ value: transfer.value,
183
+ })
184
+ }
171
185
  }
172
186
 
173
187
  if (result.result.length < limit) {
@@ -175,7 +189,10 @@ export const createMoralisExplorer = ({
175
189
  }
176
190
  }
177
191
 
178
- return [...indexes.values()]
192
+ return {
193
+ indexes: [...indexes.values()],
194
+ erc20Transfers,
195
+ }
179
196
  },
180
197
  getBlockNumberOfTimestamp: (): Promise<number> => {
181
198
  throw new Error('Function not implemented.')
@@ -80,7 +80,9 @@ const transactionSchema = z.object({
80
80
  to_address: lowerHexSchema,
81
81
  // "to_address_label": null,
82
82
  // "address": "0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5",
83
+ address: lowerHexSchema,
83
84
  // "log_index": 37,
85
+ log_index: z.number().int(),
84
86
  // "value": "6851147569444444",
85
87
  value: bigintTextSchema,
86
88
  // "possible_spam": false,
package/explorer/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Hex, LowerHex } from '../types'
1
+ import type { Erc20Transfer, Hex, LowerHex } from '../types'
2
2
  import type { InternalTransactionWithIndex } from '../types/internalTransaction'
3
3
  import type { Log } from '../types/log'
4
4
  import type { TransactionIndex } from '../types/transactionIndex'
@@ -50,7 +50,10 @@ type FunctionGetAddressTokenTransferIndexes = (parameters: {
50
50
  fromBlock?: number
51
51
  toBlock?: number
52
52
  headers?: Record<string, string>
53
- }) => Promise<TransactionIndex[]>
53
+ }) => Promise<{
54
+ indexes: TransactionIndex[]
55
+ erc20Transfers: Erc20Transfer[]
56
+ }>
54
57
 
55
58
  type FunctionGetBlockNumberOfTimestamp = (parameters: {
56
59
  /** Unix timestamp in milliseconds */