@0xtorch/evm 0.0.64 → 0.0.66

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 (55) hide show
  1. package/_cjs/client/create.js +9 -28
  2. package/_cjs/client/create.js.map +1 -1
  3. package/_cjs/client/rpcManager.js +2 -7
  4. package/_cjs/client/rpcManager.js.map +1 -1
  5. package/_cjs/explorer/blockscout/client.js +2 -7
  6. package/_cjs/explorer/blockscout/client.js.map +1 -1
  7. package/_cjs/explorer/etherscan/client.js +2 -7
  8. package/_cjs/explorer/etherscan/client.js.map +1 -1
  9. package/_cjs/logic/analyzeTransaction/decodeTransaction/decodeInput.js +4 -13
  10. package/_cjs/logic/analyzeTransaction/decodeTransaction/decodeInput.js.map +1 -1
  11. package/_cjs/logic/analyzeTransaction/decodeTransaction/decodeLog.js +4 -13
  12. package/_cjs/logic/analyzeTransaction/decodeTransaction/decodeLog.js.map +1 -1
  13. package/_cjs/logic/getTransactionDetail/decodeTokenTransferLogs.js +1 -4
  14. package/_cjs/logic/getTransactionDetail/decodeTokenTransferLogs.js.map +1 -1
  15. package/_cjs/tests.js +6 -7
  16. package/_cjs/tests.js.map +1 -1
  17. package/_esm/client/create.js +9 -28
  18. package/_esm/client/create.js.map +1 -1
  19. package/_esm/client/rpcManager.js +2 -7
  20. package/_esm/client/rpcManager.js.map +1 -1
  21. package/_esm/explorer/blockscout/client.js +2 -7
  22. package/_esm/explorer/blockscout/client.js.map +1 -1
  23. package/_esm/explorer/etherscan/client.js +2 -7
  24. package/_esm/explorer/etherscan/client.js.map +1 -1
  25. package/_esm/logic/analyzeTransaction/decodeTransaction/decodeInput.js +4 -13
  26. package/_esm/logic/analyzeTransaction/decodeTransaction/decodeInput.js.map +1 -1
  27. package/_esm/logic/analyzeTransaction/decodeTransaction/decodeLog.js +4 -13
  28. package/_esm/logic/analyzeTransaction/decodeTransaction/decodeLog.js.map +1 -1
  29. package/_esm/logic/getTransactionDetail/decodeTokenTransferLogs.js +1 -4
  30. package/_esm/logic/getTransactionDetail/decodeTokenTransferLogs.js.map +1 -1
  31. package/_esm/tests.js +5 -6
  32. package/_esm/tests.js.map +1 -1
  33. package/_types/client/create.d.ts.map +1 -1
  34. package/_types/client/rpcManager.d.ts.map +1 -1
  35. package/_types/explorer/blockscout/client.d.ts.map +1 -1
  36. package/_types/explorer/etherscan/client.d.ts.map +1 -1
  37. package/_types/logic/analyzeTransaction/decodeTransaction/decodeInput.d.ts.map +1 -1
  38. package/_types/logic/analyzeTransaction/decodeTransaction/decodeLog.d.ts.map +1 -1
  39. package/_types/logic/getTransactionDetail/decodeTokenTransferLogs.d.ts.map +1 -1
  40. package/_types/tests.d.ts +0 -1
  41. package/_types/tests.d.ts.map +1 -1
  42. package/client/create.ts +9 -28
  43. package/client/rpcManager.ts +2 -7
  44. package/explorer/blockscout/client.ts +2 -7
  45. package/explorer/etherscan/client.ts +2 -7
  46. package/logic/analyzeTransaction/decodeTransaction/decodeInput.ts +4 -13
  47. package/logic/analyzeTransaction/decodeTransaction/decodeLog.ts +4 -13
  48. package/logic/getTransactionDetail/decodeTokenTransferLogs.ts +1 -4
  49. package/package.json +2 -2
  50. package/tests.ts +10 -7
  51. package/.DS_Store +0 -0
  52. package/analyzer/.DS_Store +0 -0
  53. package/chain/.DS_Store +0 -0
  54. package/client/.DS_Store +0 -0
  55. package/explorer/.DS_Store +0 -0
@@ -1,6 +1,5 @@
1
1
  import { rest } from '@0xtorch/core'
2
2
  import { type ZodType, type ZodTypeDef, z } from 'zod'
3
- import { IS_DEBUG } from '../../tests'
4
3
 
5
4
  export type BlockscoutClient = {
6
5
  get: <
@@ -73,9 +72,7 @@ export const createBlockscoutClient = (
73
72
  for (const [key, value] of Object.entries(query)) {
74
73
  url.searchParams.append(key, value)
75
74
  }
76
- if (IS_DEBUG) {
77
- console.debug(`[GET] ${url.toString()}`)
78
- }
75
+ console.debug(`[GET] ${url.toString()}`)
79
76
  const { status, message, result } = await rest(url.toString(), {
80
77
  schema: responseSchema,
81
78
  })
@@ -97,9 +94,7 @@ export const createBlockscoutClient = (
97
94
  error instanceof Error &&
98
95
  error.message === 'Max rate limit reached'
99
96
  ) {
100
- if (IS_DEBUG) {
101
- console.debug(error)
102
- }
97
+ console.debug(error)
103
98
  await new Promise((resolve) => setTimeout(resolve, 5000))
104
99
  return await get({ path, query, resultSchema }, repeat + 1)
105
100
  }
@@ -1,6 +1,5 @@
1
1
  import { rest } from '@0xtorch/core'
2
2
  import { type ZodType, type ZodTypeDef, z } from 'zod'
3
- import { IS_DEBUG } from '../../tests'
4
3
 
5
4
  export type EtherscanClient = {
6
5
  get: <
@@ -91,9 +90,7 @@ export const createEtherscanClient = ({
91
90
  if (apiKey !== undefined) {
92
91
  url.searchParams.set('apikey', apiKey)
93
92
  }
94
- if (IS_DEBUG) {
95
- console.debug(`[GET] ${url.toString()}`)
96
- }
93
+ console.debug(`[GET] ${url.toString()}`)
97
94
  const { status, message, result } = await rest(
98
95
  proxyUrl === undefined
99
96
  ? url.toString()
@@ -128,9 +125,7 @@ export const createEtherscanClient = ({
128
125
  error.message ===
129
126
  'Max rate limit reached, please use API Key for higher rate limit')
130
127
  ) {
131
- if (IS_DEBUG) {
132
- console.debug(error)
133
- }
128
+ console.debug(error)
134
129
  await new Promise((resolve) => setTimeout(resolve, 5000))
135
130
  return get({ path, query, resultSchema }, repeat + 1)
136
131
  }
@@ -4,7 +4,6 @@ import {
4
4
  decodeFunctionData,
5
5
  getAbiItem,
6
6
  } from 'viem'
7
- import { IS_DEBUG } from '../../../tests'
8
7
  import type { LowerHex } from '../../../types'
9
8
  import type { TransactionFunction } from '../../../types/transactionDecoded'
10
9
 
@@ -46,9 +45,7 @@ const decodeInputByAddressAbi = (
46
45
  try {
47
46
  const parsedAbi = Abi.safeParse(JSON.parse(abiText))
48
47
  if (!parsedAbi.success) {
49
- if (IS_DEBUG) {
50
- console.debug(parsedAbi.error)
51
- }
48
+ console.debug(parsedAbi.error)
52
49
  return undefined
53
50
  }
54
51
  const abi = parsedAbi.data
@@ -67,9 +64,7 @@ const decodeInputByAddressAbi = (
67
64
  interface: createInterface({ name: functionName, args: functionArgs }),
68
65
  }
69
66
  } catch (error) {
70
- if (IS_DEBUG) {
71
- console.debug(error)
72
- }
67
+ console.debug(error)
73
68
  return undefined
74
69
  }
75
70
  }
@@ -81,9 +76,7 @@ const decodeInputByFunctionAbi = (
81
76
  try {
82
77
  const parsedAbi = AbiFunction.safeParse(JSON.parse(abiText))
83
78
  if (!parsedAbi.success) {
84
- if (IS_DEBUG) {
85
- console.debug(parsedAbi.error)
86
- }
79
+ console.debug(parsedAbi.error)
87
80
  return undefined
88
81
  }
89
82
  const abiItem = parsedAbi.data
@@ -101,9 +94,7 @@ const decodeInputByFunctionAbi = (
101
94
  interface: createInterface({ name: functionName, args: functionArgs }),
102
95
  }
103
96
  } catch (error) {
104
- if (IS_DEBUG) {
105
- console.debug(error)
106
- }
97
+ console.debug(error)
107
98
  return undefined
108
99
  }
109
100
  }
@@ -1,6 +1,5 @@
1
1
  import { Abi, AbiEvent } from 'abitype/zod'
2
2
  import { type AbiEvent as AbiEventType, decodeEventLog, getAbiItem } from 'viem'
3
- import { IS_DEBUG } from '../../../tests'
4
3
  import type { Hex } from '../../../types'
5
4
  import type { Log } from '../../../types/log'
6
5
 
@@ -42,9 +41,7 @@ export const decodeLogByAddressAbi = (
42
41
  try {
43
42
  const parsedAbi = Abi.safeParse(JSON.parse(abiText))
44
43
  if (!parsedAbi.success) {
45
- if (IS_DEBUG) {
46
- console.debug(parsedAbi.error)
47
- }
44
+ console.debug(parsedAbi.error)
48
45
  return undefined
49
46
  }
50
47
  const abi = parsedAbi.data
@@ -66,9 +63,7 @@ export const decodeLogByAddressAbi = (
66
63
  args: createLogArgs(decodedLog.args, abiItem),
67
64
  }
68
65
  } catch (error) {
69
- if (IS_DEBUG) {
70
- console.debug(error)
71
- }
66
+ console.debug(error)
72
67
  return undefined
73
68
  }
74
69
  }
@@ -77,9 +72,7 @@ const decodeInputByEventAbi = (log: Log, abiText: string): Log | undefined => {
77
72
  try {
78
73
  const parsedAbi = AbiEvent.safeParse(JSON.parse(abiText))
79
74
  if (!parsedAbi.success) {
80
- if (IS_DEBUG) {
81
- console.debug(parsedAbi.error)
82
- }
75
+ console.debug(parsedAbi.error)
83
76
  return undefined
84
77
  }
85
78
  const abiItem = parsedAbi.data
@@ -94,9 +87,7 @@ const decodeInputByEventAbi = (log: Log, abiText: string): Log | undefined => {
94
87
  args: createLogArgs(decodedLog.args, abiItem),
95
88
  }
96
89
  } catch (error) {
97
- if (IS_DEBUG) {
98
- console.debug(error)
99
- }
90
+ console.debug(error)
100
91
  return undefined
101
92
  }
102
93
  }
@@ -1,5 +1,4 @@
1
1
  import { decodeEventLog, zeroAddress } from 'viem'
2
- import { IS_DEBUG } from '../../tests'
3
2
  import {
4
3
  type Erc20Transfer,
5
4
  type Erc721Transfer,
@@ -479,9 +478,7 @@ const decodeErc1155TransferBatchLog = (
479
478
  })),
480
479
  }
481
480
  } catch (error) {
482
- if (IS_DEBUG) {
483
- console.debug(error)
484
- }
481
+ console.debug(error)
485
482
  return undefined
486
483
  }
487
484
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xtorch/evm",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "description": "Cryptorch EVM extension",
5
5
  "keywords": [
6
6
  "cryptorch",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@0xtorch/big-decimal": "^0.0.10",
41
- "@0xtorch/core": "^0.0.40",
41
+ "@0xtorch/core": "^0.0.44",
42
42
  "abitype": "^1.0.6",
43
43
  "viem": "^2.21.7",
44
44
  "zod": "^3.23.8"
package/tests.ts CHANGED
@@ -1,11 +1,14 @@
1
- export const IS_SMALL_TEST = (process.env.TEST_SIZE ?? '').includes('S')
1
+ export const IS_SMALL_TEST =
2
+ process !== undefined && (process.env.TEST_SIZE ?? '').includes('S')
2
3
 
3
- export const IS_MEDIUM_TEST = (process.env.TEST_SIZE ?? '').includes('M')
4
+ export const IS_MEDIUM_TEST =
5
+ process !== undefined && (process.env.TEST_SIZE ?? '').includes('M')
4
6
 
5
- export const IS_LARGE_TEST = (process.env.TEST_SIZE ?? '').includes('L')
7
+ export const IS_LARGE_TEST =
8
+ process !== undefined && (process.env.TEST_SIZE ?? '').includes('L')
6
9
 
7
- export const IS_END_TO_END_TEST = (process.env.TEST_SIZE ?? '').includes('E')
10
+ export const IS_END_TO_END_TEST =
11
+ process !== undefined && (process.env.TEST_SIZE ?? '').includes('E')
8
12
 
9
- export const IS_RPC_TEST = process.env.TEST_TARGET === 'RPC'
10
-
11
- export const IS_DEBUG = (process.env.DEBUG ?? '').length > 0
13
+ export const IS_RPC_TEST =
14
+ process !== undefined && process.env.TEST_TARGET === 'RPC'
package/.DS_Store DELETED
Binary file
Binary file
package/chain/.DS_Store DELETED
Binary file
package/client/.DS_Store DELETED
Binary file
Binary file