@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,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'
@@ -11,8 +12,9 @@ type GetAddressIndexDataParameters = {
11
12
  }
12
13
 
13
14
  type GetAddressIndexDataReturnTypes = {
14
- readonly transactionIndexes: readonly TransactionIndex[]
15
- readonly internalTransactions: readonly InternalTransaction[]
15
+ transactionIndexes: readonly TransactionIndex[]
16
+ internalTransactions: readonly InternalTransaction[]
17
+ erc20Transfers: readonly Erc20Transfer[]
16
18
  }
17
19
 
18
20
  export const getAddressIndexData = async ({
@@ -21,24 +23,27 @@ export const getAddressIndexData = async ({
21
23
  fromBlock,
22
24
  toBlock,
23
25
  }: GetAddressIndexDataParameters): Promise<GetAddressIndexDataReturnTypes> => {
24
- const [transactionIndexes, transferIndexes, internalTransactions] =
25
- await Promise.all([
26
- chain.explorer.getAddressTransactionIndexes({
27
- address,
28
- fromBlock,
29
- toBlock,
30
- }),
31
- chain.explorer.getAddressTokenTransferIndexes({
32
- address,
33
- fromBlock,
34
- toBlock,
35
- }),
36
- chain.explorer.getAddressInternalTransactions({
37
- address,
38
- fromBlock,
39
- toBlock,
40
- }),
41
- ])
26
+ const [
27
+ transactionIndexes,
28
+ { indexes: transferIndexes, erc20Transfers },
29
+ internalTransactions,
30
+ ] = await Promise.all([
31
+ chain.explorer.getAddressTransactionIndexes({
32
+ address,
33
+ fromBlock,
34
+ toBlock,
35
+ }),
36
+ chain.explorer.getAddressTokenTransferIndexes({
37
+ address,
38
+ fromBlock,
39
+ toBlock,
40
+ }),
41
+ chain.explorer.getAddressInternalTransactions({
42
+ address,
43
+ fromBlock,
44
+ toBlock,
45
+ }),
46
+ ])
42
47
 
43
48
  const indexes = new Map<LowerHex, TransactionIndex>()
44
49
  for (const index of transactionIndexes) {
@@ -64,5 +69,6 @@ export const getAddressIndexData = async ({
64
69
  return {
65
70
  transactionIndexes: [...indexes.values()],
66
71
  internalTransactions,
72
+ erc20Transfers,
67
73
  }
68
74
  }
@@ -13,6 +13,8 @@ type GetTransactionDetailParameters = {
13
13
  timestamp?: number
14
14
  internalTransactions?: readonly InternalTransaction[]
15
15
  timeout?: number
16
+ input?: LowerHex
17
+ value?: bigint
16
18
  }
17
19
 
18
20
  export const getTransactionDetail = async ({
@@ -21,12 +23,19 @@ export const getTransactionDetail = async ({
21
23
  timestamp: optionalTimestamp,
22
24
  internalTransactions = [],
23
25
  timeout,
26
+ input,
27
+ value,
24
28
  }: GetTransactionDetailParameters): Promise<TransactionDetail> => {
25
29
  const [transaction, receipt] = await Promise.all([
26
- chain.client.call({
27
- clientCall: (client) => client.getTransaction({ hash }),
28
- timeout,
29
- }),
30
+ input === undefined || value === undefined
31
+ ? chain.client.call({
32
+ clientCall: (client) => client.getTransaction({ hash }),
33
+ timeout,
34
+ })
35
+ : {
36
+ input,
37
+ value,
38
+ },
30
39
  chain.client.call({
31
40
  clientCall: (client) => client.getTransactionReceipt({ hash }),
32
41
  timeout,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xtorch/evm",
3
- "version": "0.0.110",
3
+ "version": "0.0.111",
4
4
  "description": "Cryptorch EVM extension",
5
5
  "keywords": [
6
6
  "cryptorch",
@@ -1,10 +1,16 @@
1
1
  import type { z } from 'zod'
2
+ import { bigintTextSchema, lowerHexSchema } from './primitive'
2
3
  import { transactionDetailSchema } from './transactionDetail'
3
4
 
4
- const transactionIndexSchema = transactionDetailSchema.pick({
5
- hash: true,
6
- blockNumber: true,
7
- timestamp: true,
8
- })
5
+ const transactionIndexSchema = transactionDetailSchema
6
+ .pick({
7
+ hash: true,
8
+ blockNumber: true,
9
+ timestamp: true,
10
+ })
11
+ .extend({
12
+ input: lowerHexSchema.optional(),
13
+ value: bigintTextSchema.optional(),
14
+ })
9
15
 
10
16
  export type TransactionIndex = z.infer<typeof transactionIndexSchema>