@0xtorch/evm 0.0.133 → 0.0.135

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 (67) hide show
  1. package/_cjs/chain/definitions/berachain.js +69 -0
  2. package/_cjs/chain/definitions/berachain.js.map +1 -0
  3. package/_cjs/chain/definitions/fantom.js +5 -6
  4. package/_cjs/chain/definitions/fantom.js.map +1 -1
  5. package/_cjs/chain/definitions/unichain.js +80 -0
  6. package/_cjs/chain/definitions/unichain.js.map +1 -0
  7. package/_cjs/chain/index.js +14 -4
  8. package/_cjs/chain/index.js.map +1 -1
  9. package/_cjs/index.js +13 -4
  10. package/_cjs/index.js.map +1 -1
  11. package/_cjs/logic/analyzeTransaction/createActions/index.js +1 -1
  12. package/_cjs/logic/analyzeTransaction/createActions/index.js.map +1 -1
  13. package/_esm/chain/definitions/berachain.js +70 -0
  14. package/_esm/chain/definitions/berachain.js.map +1 -0
  15. package/_esm/chain/definitions/fantom.js +6 -7
  16. package/_esm/chain/definitions/fantom.js.map +1 -1
  17. package/_esm/chain/definitions/unichain.js +75 -0
  18. package/_esm/chain/definitions/unichain.js.map +1 -0
  19. package/_esm/chain/index.js +2 -0
  20. package/_esm/chain/index.js.map +1 -1
  21. package/_esm/index.js +1 -1
  22. package/_esm/index.js.map +1 -1
  23. package/_esm/logic/analyzeTransaction/createActions/index.js +1 -1
  24. package/_esm/logic/analyzeTransaction/createActions/index.js.map +1 -1
  25. package/_types/chain/definitions/berachain.d.ts +18 -0
  26. package/_types/chain/definitions/berachain.d.ts.map +1 -0
  27. package/_types/chain/definitions/fantom.d.ts +1 -1
  28. package/_types/chain/definitions/fantom.d.ts.map +1 -1
  29. package/_types/chain/definitions/unichain.d.ts +18 -0
  30. package/_types/chain/definitions/unichain.d.ts.map +1 -0
  31. package/_types/chain/index.d.ts +2 -0
  32. package/_types/chain/index.d.ts.map +1 -1
  33. package/_types/chain/viemChains/chainVerse.d.ts +1 -0
  34. package/_types/chain/viemChains/chainVerse.d.ts.map +1 -1
  35. package/_types/chain/viemChains/defiVerse.d.ts +1 -0
  36. package/_types/chain/viemChains/defiVerse.d.ts.map +1 -1
  37. package/_types/chain/viemChains/geekVerse.d.ts +1 -0
  38. package/_types/chain/viemChains/geekVerse.d.ts.map +1 -1
  39. package/_types/chain/viemChains/gesoVerse.d.ts +1 -0
  40. package/_types/chain/viemChains/gesoVerse.d.ts.map +1 -1
  41. package/_types/chain/viemChains/homeVerse.d.ts +1 -0
  42. package/_types/chain/viemChains/homeVerse.d.ts.map +1 -1
  43. package/_types/chain/viemChains/mchVerse.d.ts +1 -0
  44. package/_types/chain/viemChains/mchVerse.d.ts.map +1 -1
  45. package/_types/chain/viemChains/saakuru.d.ts +1 -0
  46. package/_types/chain/viemChains/saakuru.d.ts.map +1 -1
  47. package/_types/chain/viemChains/soneium.d.ts +1 -0
  48. package/_types/chain/viemChains/soneium.d.ts.map +1 -1
  49. package/_types/chain/viemChains/sonic.d.ts +1 -0
  50. package/_types/chain/viemChains/sonic.d.ts.map +1 -1
  51. package/_types/chain/viemChains/tcgVerse.d.ts +1 -0
  52. package/_types/chain/viemChains/tcgVerse.d.ts.map +1 -1
  53. package/_types/index.d.ts +1 -1
  54. package/_types/index.d.ts.map +1 -1
  55. package/_types/logic/analyzeTransaction/createActions/index.d.ts +2 -7
  56. package/_types/logic/analyzeTransaction/createActions/index.d.ts.map +1 -1
  57. package/_types/types/converter.d.ts +1 -1
  58. package/_types/types/converter.d.ts.map +1 -1
  59. package/chain/definitions/berachain.ts +93 -0
  60. package/chain/definitions/fantom.ts +5 -7
  61. package/chain/definitions/unichain.ts +98 -0
  62. package/chain/index.ts +12 -0
  63. package/index.ts +8 -0
  64. package/logic/analyzeTransaction/createActions/index.ts +3 -8
  65. package/package.json +3 -3
  66. package/types/converter.ts +1 -1
  67. package/.DS_Store +0 -0
@@ -0,0 +1,98 @@
1
+ import { ethereum } from '@0xtorch/core'
2
+ import { unichain } from 'viem/chains'
3
+ import { type Client, createClient } from '../../client'
4
+ import type { Explorer } from '../../explorer'
5
+ import { createEtherscan } from '../../explorer'
6
+ import type { Chain } from '../types/chain'
7
+ import type { HttpRpc } from '../types/rpc'
8
+
9
+ export const createUnichain = ({
10
+ explorerApiKey: apiKey,
11
+ explorerProxyUrl: proxyUrl,
12
+ explorerPageSize: pageSize,
13
+ }: {
14
+ explorerApiKey?: string
15
+ explorerProxyUrl?: string
16
+ explorerPageSize?: number
17
+ }) =>
18
+ createUnichainCustom({
19
+ client: createClient({
20
+ chain: unichain,
21
+ httpRpcs: unichainHttpRpcs,
22
+ }),
23
+ explorer: createEtherscan({
24
+ name: 'Uniscan',
25
+ baseUrl: 'https://uniscan.xyz',
26
+ apiBaseUrl: 'https://api.uniscan.xyz/api',
27
+ apiKey,
28
+ proxyUrl,
29
+ pageSize,
30
+ }),
31
+ })
32
+
33
+ type CreateUnichainParameters = {
34
+ client: Client
35
+ explorer: Explorer
36
+ }
37
+
38
+ export const createUnichainCustom = ({
39
+ client,
40
+ explorer,
41
+ }: CreateUnichainParameters): Chain => ({
42
+ id: 130,
43
+ network: 'unichain',
44
+ name: 'Unichain',
45
+ nativeToken: {
46
+ name: 'Ethereum',
47
+ symbol: 'ETH',
48
+ decimals: 18,
49
+ currency: ethereum,
50
+ },
51
+ wrappedTokenAddresses: new Set([
52
+ '0x4200000000000000000000000000000000000006',
53
+ ]),
54
+ explorer,
55
+ client,
56
+ blockTime: 1000,
57
+ coingeckoId: 'unichain',
58
+ defillamaId: undefined,
59
+ })
60
+
61
+ export const unichainHttpRpcs: HttpRpc[] = [
62
+ {
63
+ url: 'https://mainnet.unichain.org',
64
+ getLogsIsUsable: true,
65
+ getLogsMaxBlockRange: 10_000n,
66
+ },
67
+ {
68
+ url: 'https://unichain.api.onfinality.io/public',
69
+ getLogsIsUsable: false,
70
+ getLogsMaxBlockRange: 0n,
71
+ },
72
+ {
73
+ url: 'https://unichain-rpc.publicnode.com',
74
+ getLogsIsUsable: true,
75
+ getLogsMaxBlockRange: 10_000n,
76
+ },
77
+ {
78
+ url: 'https://unichain.drpc.org',
79
+ getLogsIsUsable: true,
80
+ getLogsMaxBlockRange: 10_000n,
81
+ },
82
+ {
83
+ url: 'https://0xrpc.io/uni',
84
+ getLogsIsUsable: true,
85
+ getLogsMaxBlockRange: 10_000n,
86
+ },
87
+ {
88
+ url: 'https://rpc.therpc.io/unichain',
89
+ getLogsIsUsable: true,
90
+ getLogsMaxBlockRange: 10_000n,
91
+ },
92
+ ]
93
+
94
+ export const unichainWebsocketRpcUrls: readonly string[] = [
95
+ 'wss://unichain-rpc.publicnode.com',
96
+ 'wss://unichain.drpc.org',
97
+ 'wss://0xrpc.io/uni',
98
+ ]
package/chain/index.ts CHANGED
@@ -28,6 +28,12 @@ export {
28
28
  baseHttpRpcs,
29
29
  baseWebsocketRpcUrls,
30
30
  } from './definitions/base'
31
+ export {
32
+ createBerachain,
33
+ createBerachainCustom,
34
+ berachainHttpRpcs,
35
+ berachainWebsocketRpcUrls,
36
+ } from './definitions/berachain'
31
37
  export {
32
38
  createBlastChain,
33
39
  createBlastChainCustom,
@@ -202,6 +208,12 @@ export {
202
208
  tcgVerseHttpRpcs,
203
209
  tcgVerseWebsocketRpcUrls,
204
210
  } from './definitions/tcgVerse'
211
+ export {
212
+ createUnichain,
213
+ createUnichainCustom,
214
+ unichainHttpRpcs,
215
+ unichainWebsocketRpcUrls,
216
+ } from './definitions/unichain'
205
217
  export {
206
218
  createYooldoVerseChain,
207
219
  createYooldoVerseChainCustom,
package/index.ts CHANGED
@@ -10,6 +10,8 @@ export {
10
10
  avalancheCWebsocketRpcUrls,
11
11
  baseHttpRpcs,
12
12
  baseWebsocketRpcUrls,
13
+ berachainHttpRpcs,
14
+ berachainWebsocketRpcUrls,
13
15
  blastHttpRpcs,
14
16
  blastWebsocketRpcUrls,
15
17
  bscHttpRpcs,
@@ -26,6 +28,8 @@ export {
26
28
  createAvalancheCChainCustom,
27
29
  createBaseChain,
28
30
  createBaseChainCustom,
31
+ createBerachain,
32
+ createBerachainCustom,
29
33
  createBlastChain,
30
34
  createBlastChainCustom,
31
35
  createBscChain,
@@ -84,6 +88,8 @@ export {
84
88
  createTaikoChainCustom,
85
89
  createTcgVerseChain,
86
90
  createTcgVerseChainCustom,
91
+ createUnichain,
92
+ createUnichainCustom,
87
93
  createYooldoVerseChain,
88
94
  createYooldoVerseChainCustom,
89
95
  createZkFairChain,
@@ -144,6 +150,8 @@ export {
144
150
  taikoWebsocketRpcUrls,
145
151
  tcgVerseHttpRpcs,
146
152
  tcgVerseWebsocketRpcUrls,
153
+ unichainHttpRpcs,
154
+ unichainWebsocketRpcUrls,
147
155
  yooldoVerseHttpRpcs,
148
156
  yooldoVerseWebsocketRpcUrls,
149
157
  zkFairHttpRpcs,
@@ -1,6 +1,6 @@
1
1
  import { type Action, checkIfActionsIsValid } from '@0xtorch/core'
2
2
  import type { Chain } from '../../../chain'
3
- import type { LowerHex } from '../../../types'
3
+ import type { Converter, LowerHex } from '../../../types'
4
4
  import type { TransactionDecoded } from '../../../types/transactionDecoded'
5
5
  import { createEvmActionSource, createEvmAddressId } from '../../../utils'
6
6
  import { createActionsByFailAnalyzer } from './fail'
@@ -15,12 +15,7 @@ type CreateActionsParameters = {
15
15
  chain: Chain
16
16
  transaction: TransactionDecoded
17
17
  relatedAddresses: Set<LowerHex>
18
- converter?: (args: {
19
- chain: Chain
20
- relatedAddresses: Set<LowerHex>
21
- source: string
22
- transaction: TransactionDecoded
23
- }) => Promise<readonly Action[] | undefined>
18
+ converter?: Converter
24
19
  jsonAnalyzers: readonly JsonAnalyzer[]
25
20
  }
26
21
 
@@ -76,7 +71,7 @@ export const createActions = async ({
76
71
  // [some] converter
77
72
  if (converter !== undefined) {
78
73
  const actionsByConverter = await converter({
79
- chain,
74
+ nativeToken: chain.nativeToken,
80
75
  relatedAddresses,
81
76
  source,
82
77
  transaction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xtorch/evm",
3
- "version": "0.0.133",
3
+ "version": "0.0.135",
4
4
  "description": "Cryptorch EVM extension",
5
5
  "keywords": [
6
6
  "cryptorch",
@@ -38,9 +38,9 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@0xtorch/big-decimal": "^0.0.14",
41
- "@0xtorch/core": "^0.0.64",
41
+ "@0xtorch/core": "^0.0.65",
42
42
  "abitype": "^1.0.8",
43
- "viem": "^2.29.2",
43
+ "viem": "^2.31.4",
44
44
  "zod": "^3.24.4"
45
45
  }
46
46
  }
@@ -4,7 +4,7 @@ import type { LowerHex } from './hex'
4
4
  import type { TransactionDecoded } from './transactionDecoded'
5
5
 
6
6
  export type Converter = (args: {
7
- chain: Chain
7
+ nativeToken: Chain['nativeToken']
8
8
  relatedAddresses: Set<LowerHex>
9
9
  source: string
10
10
  transaction: TransactionDecoded
package/.DS_Store DELETED
Binary file