@sudobility/types 1.8.22 → 1.8.23
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.
- package/dist/index.cjs +9 -11
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -11
- package/dist/index.js.map +1 -1
- package/dist/utils/blockchain/index.cjs +1 -3
- package/dist/utils/blockchain/index.d.ts +0 -2
- package/dist/utils/blockchain/index.d.ts.map +1 -1
- package/dist/utils/blockchain/index.js +1 -3
- package/dist/utils/blockchain/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/utils/blockchain/rpc-helpers.cjs +0 -881
- package/dist/utils/blockchain/rpc-helpers.d.ts +0 -304
- package/dist/utils/blockchain/rpc-helpers.d.ts.map +0 -1
- package/dist/utils/blockchain/rpc-helpers.js +0 -881
- package/dist/utils/blockchain/rpc-helpers.js.map +0 -1
|
@@ -1,881 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* RPC and API endpoint helper utilities
|
|
4
|
-
*
|
|
5
|
-
* Provides helper functions to build RPC endpoints and block explorer API URLs
|
|
6
|
-
* from API keys and chain identifiers.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.RpcHelpers = void 0;
|
|
10
|
-
const enums_1 = require("../../types/business/enums");
|
|
11
|
-
/**
|
|
12
|
-
* Consolidated chain information map
|
|
13
|
-
* Contains all static metadata for each supported blockchain network
|
|
14
|
-
*/
|
|
15
|
-
const CHAIN_INFO_MAP = {
|
|
16
|
-
// Ethereum
|
|
17
|
-
[enums_1.Chain.ETH_MAINNET]: {
|
|
18
|
-
chainType: enums_1.ChainType.EVM,
|
|
19
|
-
chainId: 1,
|
|
20
|
-
name: 'Ethereum',
|
|
21
|
-
alchemyNetwork: 'eth-mainnet',
|
|
22
|
-
explorerDomain: 'api.etherscan.io',
|
|
23
|
-
explorerBrowserDomain: 'etherscan.io',
|
|
24
|
-
usdcAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
25
|
-
isDev: false,
|
|
26
|
-
},
|
|
27
|
-
[enums_1.Chain.ETH_SEPOLIA]: {
|
|
28
|
-
chainType: enums_1.ChainType.EVM,
|
|
29
|
-
chainId: 11155111,
|
|
30
|
-
name: 'Ethereum Sepolia',
|
|
31
|
-
alchemyNetwork: 'eth-sepolia',
|
|
32
|
-
explorerDomain: 'api-sepolia.etherscan.io',
|
|
33
|
-
explorerBrowserDomain: 'sepolia.etherscan.io',
|
|
34
|
-
usdcAddress: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',
|
|
35
|
-
isDev: true,
|
|
36
|
-
mailerAddress: '0x13fC7Fe676E4FaaE8F4D910d8Ed7fbD3FebDbe88',
|
|
37
|
-
},
|
|
38
|
-
[enums_1.Chain.ETH_GOERLI]: {
|
|
39
|
-
chainType: enums_1.ChainType.EVM,
|
|
40
|
-
chainId: 5,
|
|
41
|
-
name: 'Ethereum Goerli',
|
|
42
|
-
alchemyNetwork: 'eth-goerli',
|
|
43
|
-
explorerDomain: 'api-goerli.etherscan.io',
|
|
44
|
-
explorerBrowserDomain: 'goerli.etherscan.io',
|
|
45
|
-
usdcAddress: '0x07865c6E87B9F70255377e024ace6630C1Eaa37F',
|
|
46
|
-
isDev: true,
|
|
47
|
-
},
|
|
48
|
-
// Polygon
|
|
49
|
-
[enums_1.Chain.POLYGON_MAINNET]: {
|
|
50
|
-
chainType: enums_1.ChainType.EVM,
|
|
51
|
-
chainId: 137,
|
|
52
|
-
name: 'Polygon',
|
|
53
|
-
alchemyNetwork: 'polygon-mainnet',
|
|
54
|
-
explorerDomain: 'api.polygonscan.com',
|
|
55
|
-
explorerBrowserDomain: 'polygonscan.com',
|
|
56
|
-
usdcAddress: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359',
|
|
57
|
-
isDev: false,
|
|
58
|
-
},
|
|
59
|
-
[enums_1.Chain.POLYGON_MUMBAI]: {
|
|
60
|
-
chainType: enums_1.ChainType.EVM,
|
|
61
|
-
chainId: 80001,
|
|
62
|
-
name: 'Polygon Mumbai',
|
|
63
|
-
alchemyNetwork: 'polygon-mumbai',
|
|
64
|
-
explorerDomain: 'api-testnet.polygonscan.com',
|
|
65
|
-
explorerBrowserDomain: 'mumbai.polygonscan.com',
|
|
66
|
-
usdcAddress: '0x9999f7Fea5938fD3b1E26A12c3f2fb024e194f97',
|
|
67
|
-
isDev: true,
|
|
68
|
-
},
|
|
69
|
-
[enums_1.Chain.POLYGON_AMOY]: {
|
|
70
|
-
chainType: enums_1.ChainType.EVM,
|
|
71
|
-
chainId: 80002,
|
|
72
|
-
name: 'Polygon Amoy',
|
|
73
|
-
alchemyNetwork: 'polygon-amoy',
|
|
74
|
-
explorerDomain: 'api-amoy.polygonscan.com',
|
|
75
|
-
explorerBrowserDomain: 'amoy.polygonscan.com',
|
|
76
|
-
usdcAddress: '0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582',
|
|
77
|
-
isDev: true,
|
|
78
|
-
},
|
|
79
|
-
// Optimism
|
|
80
|
-
[enums_1.Chain.OPTIMISM_MAINNET]: {
|
|
81
|
-
chainType: enums_1.ChainType.EVM,
|
|
82
|
-
chainId: 10,
|
|
83
|
-
name: 'Optimism',
|
|
84
|
-
alchemyNetwork: 'opt-mainnet',
|
|
85
|
-
explorerDomain: 'api-optimistic.etherscan.io',
|
|
86
|
-
explorerBrowserDomain: 'optimistic.etherscan.io',
|
|
87
|
-
usdcAddress: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
|
|
88
|
-
isDev: false,
|
|
89
|
-
},
|
|
90
|
-
[enums_1.Chain.OPTIMISM_SEPOLIA]: {
|
|
91
|
-
chainType: enums_1.ChainType.EVM,
|
|
92
|
-
chainId: 11155420,
|
|
93
|
-
name: 'Optimism Sepolia',
|
|
94
|
-
alchemyNetwork: 'opt-sepolia',
|
|
95
|
-
explorerDomain: 'api-sepolia-optimistic.etherscan.io',
|
|
96
|
-
explorerBrowserDomain: 'sepolia-optimistic.etherscan.io',
|
|
97
|
-
usdcAddress: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7',
|
|
98
|
-
isDev: true,
|
|
99
|
-
},
|
|
100
|
-
[enums_1.Chain.OPTIMISM_GOERLI]: {
|
|
101
|
-
chainType: enums_1.ChainType.EVM,
|
|
102
|
-
chainId: 420,
|
|
103
|
-
name: 'Optimism Goerli',
|
|
104
|
-
alchemyNetwork: 'opt-goerli',
|
|
105
|
-
explorerDomain: 'api-goerli-optimistic.etherscan.io',
|
|
106
|
-
explorerBrowserDomain: 'goerli-optimistic.etherscan.io',
|
|
107
|
-
usdcAddress: '0xe05606174bac4A6364B31bd0eCA4bf4dD368f8C6',
|
|
108
|
-
isDev: true,
|
|
109
|
-
},
|
|
110
|
-
// Arbitrum
|
|
111
|
-
[enums_1.Chain.ARBITRUM_MAINNET]: {
|
|
112
|
-
chainType: enums_1.ChainType.EVM,
|
|
113
|
-
chainId: 42161,
|
|
114
|
-
name: 'Arbitrum',
|
|
115
|
-
alchemyNetwork: 'arb-mainnet',
|
|
116
|
-
explorerDomain: 'api.arbiscan.io',
|
|
117
|
-
explorerBrowserDomain: 'arbiscan.io',
|
|
118
|
-
usdcAddress: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
|
|
119
|
-
isDev: false,
|
|
120
|
-
},
|
|
121
|
-
[enums_1.Chain.ARBITRUM_SEPOLIA]: {
|
|
122
|
-
chainType: enums_1.ChainType.EVM,
|
|
123
|
-
chainId: 421614,
|
|
124
|
-
name: 'Arbitrum Sepolia',
|
|
125
|
-
alchemyNetwork: 'arb-sepolia',
|
|
126
|
-
explorerDomain: 'api-sepolia.arbiscan.io',
|
|
127
|
-
explorerBrowserDomain: 'sepolia.arbiscan.io',
|
|
128
|
-
usdcAddress: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d',
|
|
129
|
-
isDev: true,
|
|
130
|
-
},
|
|
131
|
-
[enums_1.Chain.ARBITRUM_GOERLI]: {
|
|
132
|
-
chainType: enums_1.ChainType.EVM,
|
|
133
|
-
chainId: 421613,
|
|
134
|
-
name: 'Arbitrum Goerli',
|
|
135
|
-
alchemyNetwork: 'arb-goerli',
|
|
136
|
-
explorerDomain: 'api-goerli.arbiscan.io',
|
|
137
|
-
explorerBrowserDomain: 'goerli.arbiscan.io',
|
|
138
|
-
usdcAddress: '0xfd064A18f3BF249cf1f87FC203E90D8f650f2d63',
|
|
139
|
-
isDev: true,
|
|
140
|
-
},
|
|
141
|
-
// Base
|
|
142
|
-
[enums_1.Chain.BASE_MAINNET]: {
|
|
143
|
-
chainType: enums_1.ChainType.EVM,
|
|
144
|
-
chainId: 8453,
|
|
145
|
-
name: 'Base',
|
|
146
|
-
alchemyNetwork: 'base-mainnet',
|
|
147
|
-
explorerDomain: 'api.basescan.org',
|
|
148
|
-
explorerBrowserDomain: 'basescan.org',
|
|
149
|
-
usdcAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
150
|
-
isDev: false,
|
|
151
|
-
},
|
|
152
|
-
[enums_1.Chain.BASE_SEPOLIA]: {
|
|
153
|
-
chainType: enums_1.ChainType.EVM,
|
|
154
|
-
chainId: 84532,
|
|
155
|
-
name: 'Base Sepolia',
|
|
156
|
-
alchemyNetwork: 'base-sepolia',
|
|
157
|
-
explorerDomain: 'api-sepolia.basescan.org',
|
|
158
|
-
explorerBrowserDomain: 'sepolia.basescan.org',
|
|
159
|
-
usdcAddress: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
|
|
160
|
-
isDev: true,
|
|
161
|
-
},
|
|
162
|
-
[enums_1.Chain.BASE_GOERLI]: {
|
|
163
|
-
chainType: enums_1.ChainType.EVM,
|
|
164
|
-
chainId: 84531,
|
|
165
|
-
name: 'Base Goerli',
|
|
166
|
-
alchemyNetwork: 'base-goerli',
|
|
167
|
-
explorerDomain: 'api-goerli.basescan.org',
|
|
168
|
-
explorerBrowserDomain: 'goerli.basescan.org',
|
|
169
|
-
usdcAddress: '0xF175520C52418dfE19C8098071a252da48Cd1C19',
|
|
170
|
-
isDev: true,
|
|
171
|
-
},
|
|
172
|
-
// Avalanche
|
|
173
|
-
[enums_1.Chain.AVALANCHE_MAINNET]: {
|
|
174
|
-
chainType: enums_1.ChainType.EVM,
|
|
175
|
-
chainId: 43114,
|
|
176
|
-
name: 'Avalanche',
|
|
177
|
-
alchemyNetwork: 'avax-mainnet',
|
|
178
|
-
explorerDomain: 'api.snowtrace.io',
|
|
179
|
-
explorerBrowserDomain: 'snowtrace.io',
|
|
180
|
-
usdcAddress: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
|
|
181
|
-
isDev: false,
|
|
182
|
-
},
|
|
183
|
-
[enums_1.Chain.AVALANCHE_FUJI]: {
|
|
184
|
-
chainType: enums_1.ChainType.EVM,
|
|
185
|
-
chainId: 43113,
|
|
186
|
-
name: 'Avalanche Fuji',
|
|
187
|
-
alchemyNetwork: 'avax-fuji',
|
|
188
|
-
explorerDomain: 'api-testnet.snowtrace.io',
|
|
189
|
-
explorerBrowserDomain: 'testnet.snowtrace.io',
|
|
190
|
-
usdcAddress: '0x5425890298aed601595a70AB815c96711a31Bc65',
|
|
191
|
-
isDev: true,
|
|
192
|
-
},
|
|
193
|
-
// BNB Chain
|
|
194
|
-
[enums_1.Chain.BNB_MAINNET]: {
|
|
195
|
-
chainType: enums_1.ChainType.EVM,
|
|
196
|
-
chainId: 56,
|
|
197
|
-
name: 'BNB Chain',
|
|
198
|
-
alchemyNetwork: 'bnb-mainnet',
|
|
199
|
-
explorerDomain: 'api.bscscan.com',
|
|
200
|
-
explorerBrowserDomain: 'bscscan.com',
|
|
201
|
-
usdcAddress: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d',
|
|
202
|
-
isDev: false,
|
|
203
|
-
},
|
|
204
|
-
[enums_1.Chain.BNB_TESTNET]: {
|
|
205
|
-
chainType: enums_1.ChainType.EVM,
|
|
206
|
-
chainId: 97,
|
|
207
|
-
name: 'BNB Chain Testnet',
|
|
208
|
-
alchemyNetwork: 'bnb-testnet',
|
|
209
|
-
explorerDomain: 'api-testnet.bscscan.com',
|
|
210
|
-
explorerBrowserDomain: 'testnet.bscscan.com',
|
|
211
|
-
usdcAddress: '0x64544969ed7EBf5f083679233325356EbE738930',
|
|
212
|
-
isDev: true,
|
|
213
|
-
},
|
|
214
|
-
// Gnosis Chain
|
|
215
|
-
[enums_1.Chain.GNOSIS_MAINNET]: {
|
|
216
|
-
chainType: enums_1.ChainType.EVM,
|
|
217
|
-
chainId: 100,
|
|
218
|
-
name: 'Gnosis',
|
|
219
|
-
alchemyNetwork: 'gnosis-mainnet',
|
|
220
|
-
explorerDomain: 'api.gnosisscan.io',
|
|
221
|
-
explorerBrowserDomain: 'gnosisscan.io',
|
|
222
|
-
usdcAddress: '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83',
|
|
223
|
-
isDev: false,
|
|
224
|
-
},
|
|
225
|
-
[enums_1.Chain.GNOSIS_CHIADO]: {
|
|
226
|
-
chainType: enums_1.ChainType.EVM,
|
|
227
|
-
chainId: 10200,
|
|
228
|
-
name: 'Gnosis Chiado',
|
|
229
|
-
alchemyNetwork: 'gnosis-chiado',
|
|
230
|
-
explorerDomain: 'api-chiado.gnosisscan.io',
|
|
231
|
-
explorerBrowserDomain: 'gnosis-chiado.blockscout.com',
|
|
232
|
-
usdcAddress: '0x',
|
|
233
|
-
isDev: true,
|
|
234
|
-
},
|
|
235
|
-
// Celo
|
|
236
|
-
[enums_1.Chain.CELO_MAINNET]: {
|
|
237
|
-
chainType: enums_1.ChainType.EVM,
|
|
238
|
-
chainId: 42220,
|
|
239
|
-
name: 'Celo',
|
|
240
|
-
alchemyNetwork: 'celo-mainnet',
|
|
241
|
-
explorerDomain: 'api.celoscan.io',
|
|
242
|
-
explorerBrowserDomain: 'celoscan.io',
|
|
243
|
-
usdcAddress: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C',
|
|
244
|
-
isDev: false,
|
|
245
|
-
},
|
|
246
|
-
[enums_1.Chain.CELO_ALFAJORES]: {
|
|
247
|
-
chainType: enums_1.ChainType.EVM,
|
|
248
|
-
chainId: 44787,
|
|
249
|
-
name: 'Celo Alfajores',
|
|
250
|
-
alchemyNetwork: 'celo-alfajores',
|
|
251
|
-
explorerDomain: 'api-alfajores.celoscan.io',
|
|
252
|
-
explorerBrowserDomain: 'alfajores.celoscan.io',
|
|
253
|
-
usdcAddress: '0x2F25deB3848C207fc8E0c34035B3Ba7fC157602B',
|
|
254
|
-
isDev: true,
|
|
255
|
-
},
|
|
256
|
-
// zkSync
|
|
257
|
-
[enums_1.Chain.ZKSYNC_MAINNET]: {
|
|
258
|
-
chainType: enums_1.ChainType.EVM,
|
|
259
|
-
chainId: 324,
|
|
260
|
-
name: 'zkSync',
|
|
261
|
-
alchemyNetwork: 'zksync-mainnet',
|
|
262
|
-
explorerDomain: 'api-era.zksync.network',
|
|
263
|
-
explorerBrowserDomain: 'explorer.zksync.io',
|
|
264
|
-
usdcAddress: '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4',
|
|
265
|
-
isDev: false,
|
|
266
|
-
},
|
|
267
|
-
[enums_1.Chain.ZKSYNC_SEPOLIA]: {
|
|
268
|
-
chainType: enums_1.ChainType.EVM,
|
|
269
|
-
chainId: 300,
|
|
270
|
-
name: 'zkSync Sepolia',
|
|
271
|
-
alchemyNetwork: 'zksync-sepolia',
|
|
272
|
-
explorerDomain: 'api-sepolia-era.zksync.network',
|
|
273
|
-
explorerBrowserDomain: 'sepolia.explorer.zksync.io',
|
|
274
|
-
usdcAddress: '0x',
|
|
275
|
-
isDev: true,
|
|
276
|
-
},
|
|
277
|
-
// Linea
|
|
278
|
-
[enums_1.Chain.LINEA_MAINNET]: {
|
|
279
|
-
chainType: enums_1.ChainType.EVM,
|
|
280
|
-
chainId: 59144,
|
|
281
|
-
name: 'Linea',
|
|
282
|
-
alchemyNetwork: 'linea-mainnet',
|
|
283
|
-
explorerDomain: 'api.lineascan.build',
|
|
284
|
-
explorerBrowserDomain: 'lineascan.build',
|
|
285
|
-
usdcAddress: '0x176211869cA2b568f2A7D4EE941E073a821EE1ff',
|
|
286
|
-
isDev: false,
|
|
287
|
-
},
|
|
288
|
-
[enums_1.Chain.LINEA_SEPOLIA]: {
|
|
289
|
-
chainType: enums_1.ChainType.EVM,
|
|
290
|
-
chainId: 59141,
|
|
291
|
-
name: 'Linea Sepolia',
|
|
292
|
-
alchemyNetwork: 'linea-sepolia',
|
|
293
|
-
explorerDomain: 'api-sepolia.lineascan.build',
|
|
294
|
-
explorerBrowserDomain: 'sepolia.lineascan.build',
|
|
295
|
-
usdcAddress: '0x',
|
|
296
|
-
isDev: true,
|
|
297
|
-
},
|
|
298
|
-
// Scroll
|
|
299
|
-
[enums_1.Chain.SCROLL_MAINNET]: {
|
|
300
|
-
chainType: enums_1.ChainType.EVM,
|
|
301
|
-
chainId: 534352,
|
|
302
|
-
name: 'Scroll',
|
|
303
|
-
alchemyNetwork: 'scroll-mainnet',
|
|
304
|
-
explorerDomain: 'api.scrollscan.com',
|
|
305
|
-
explorerBrowserDomain: 'scrollscan.com',
|
|
306
|
-
usdcAddress: '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4',
|
|
307
|
-
isDev: false,
|
|
308
|
-
},
|
|
309
|
-
[enums_1.Chain.SCROLL_SEPOLIA]: {
|
|
310
|
-
chainType: enums_1.ChainType.EVM,
|
|
311
|
-
chainId: 534351,
|
|
312
|
-
name: 'Scroll Sepolia',
|
|
313
|
-
alchemyNetwork: 'scroll-sepolia',
|
|
314
|
-
explorerDomain: 'api-sepolia.scrollscan.com',
|
|
315
|
-
explorerBrowserDomain: 'sepolia.scrollscan.com',
|
|
316
|
-
usdcAddress: '0x',
|
|
317
|
-
isDev: true,
|
|
318
|
-
},
|
|
319
|
-
// Monad
|
|
320
|
-
[enums_1.Chain.MONAD_MAINNET]: {
|
|
321
|
-
chainType: enums_1.ChainType.EVM,
|
|
322
|
-
chainId: 10000,
|
|
323
|
-
name: 'Monad',
|
|
324
|
-
alchemyNetwork: '',
|
|
325
|
-
explorerDomain: '',
|
|
326
|
-
explorerBrowserDomain: 'explorer.monad.xyz',
|
|
327
|
-
usdcAddress: '0x',
|
|
328
|
-
isDev: false,
|
|
329
|
-
},
|
|
330
|
-
[enums_1.Chain.MONAD_TESTNET]: {
|
|
331
|
-
chainType: enums_1.ChainType.EVM,
|
|
332
|
-
chainId: 10001,
|
|
333
|
-
name: 'Monad Testnet',
|
|
334
|
-
alchemyNetwork: '',
|
|
335
|
-
explorerDomain: '',
|
|
336
|
-
explorerBrowserDomain: 'testnet.explorer.monad.xyz',
|
|
337
|
-
usdcAddress: '0x',
|
|
338
|
-
isDev: true,
|
|
339
|
-
},
|
|
340
|
-
// Story Protocol
|
|
341
|
-
[enums_1.Chain.STORY_MAINNET]: {
|
|
342
|
-
chainType: enums_1.ChainType.EVM,
|
|
343
|
-
chainId: 1516,
|
|
344
|
-
name: 'Story',
|
|
345
|
-
alchemyNetwork: '',
|
|
346
|
-
explorerDomain: '',
|
|
347
|
-
explorerBrowserDomain: 'explorer.story.foundation',
|
|
348
|
-
usdcAddress: '0x',
|
|
349
|
-
isDev: false,
|
|
350
|
-
},
|
|
351
|
-
[enums_1.Chain.STORY_TESTNET]: {
|
|
352
|
-
chainType: enums_1.ChainType.EVM,
|
|
353
|
-
chainId: 1513,
|
|
354
|
-
name: 'Story Testnet',
|
|
355
|
-
alchemyNetwork: '',
|
|
356
|
-
explorerDomain: '',
|
|
357
|
-
explorerBrowserDomain: 'testnet.explorer.story.foundation',
|
|
358
|
-
usdcAddress: '0x',
|
|
359
|
-
isDev: true,
|
|
360
|
-
},
|
|
361
|
-
// Plume Network
|
|
362
|
-
[enums_1.Chain.PLUME_MAINNET]: {
|
|
363
|
-
chainType: enums_1.ChainType.EVM,
|
|
364
|
-
chainId: 98865,
|
|
365
|
-
name: 'Plume',
|
|
366
|
-
alchemyNetwork: '',
|
|
367
|
-
explorerDomain: '',
|
|
368
|
-
explorerBrowserDomain: 'explorer.plumenetwork.xyz',
|
|
369
|
-
usdcAddress: '0x222365EF19F7947e5484218551B56bb3965Aa7aF',
|
|
370
|
-
isDev: false,
|
|
371
|
-
},
|
|
372
|
-
[enums_1.Chain.PLUME_TESTNET]: {
|
|
373
|
-
chainType: enums_1.ChainType.EVM,
|
|
374
|
-
chainId: 98864,
|
|
375
|
-
name: 'Plume Testnet',
|
|
376
|
-
alchemyNetwork: '',
|
|
377
|
-
explorerDomain: '',
|
|
378
|
-
explorerBrowserDomain: 'testnet.explorer.plumenetwork.xyz',
|
|
379
|
-
usdcAddress: '0xcB5f30e335672893c7eb944B374c196392C19D18',
|
|
380
|
-
isDev: true,
|
|
381
|
-
},
|
|
382
|
-
// Nexus
|
|
383
|
-
[enums_1.Chain.NEXUS_MAINNET]: {
|
|
384
|
-
chainType: enums_1.ChainType.EVM,
|
|
385
|
-
chainId: 9999,
|
|
386
|
-
name: 'Nexus',
|
|
387
|
-
alchemyNetwork: '',
|
|
388
|
-
explorerDomain: '',
|
|
389
|
-
explorerBrowserDomain: 'explorer.nexus.xyz',
|
|
390
|
-
usdcAddress: '0x',
|
|
391
|
-
isDev: false,
|
|
392
|
-
},
|
|
393
|
-
[enums_1.Chain.NEXUS_TESTNET]: {
|
|
394
|
-
chainType: enums_1.ChainType.EVM,
|
|
395
|
-
chainId: 9998,
|
|
396
|
-
name: 'Nexus Testnet',
|
|
397
|
-
alchemyNetwork: '',
|
|
398
|
-
explorerDomain: '',
|
|
399
|
-
explorerBrowserDomain: 'testnet.explorer.nexus.xyz',
|
|
400
|
-
usdcAddress: '0x',
|
|
401
|
-
isDev: true,
|
|
402
|
-
},
|
|
403
|
-
// HyperEVM
|
|
404
|
-
[enums_1.Chain.HYPEREVM_MAINNET]: {
|
|
405
|
-
chainType: enums_1.ChainType.EVM,
|
|
406
|
-
chainId: 998,
|
|
407
|
-
name: 'HyperEVM',
|
|
408
|
-
alchemyNetwork: '',
|
|
409
|
-
explorerDomain: '',
|
|
410
|
-
explorerBrowserDomain: 'app.hyperliquid.xyz/explorer',
|
|
411
|
-
usdcAddress: '0xb88339CB7199b77E23DB6E890353E22632Ba630f',
|
|
412
|
-
isDev: false,
|
|
413
|
-
},
|
|
414
|
-
[enums_1.Chain.HYPEREVM_TESTNET]: {
|
|
415
|
-
chainType: enums_1.ChainType.EVM,
|
|
416
|
-
chainId: 997,
|
|
417
|
-
name: 'HyperEVM Testnet',
|
|
418
|
-
alchemyNetwork: '',
|
|
419
|
-
explorerDomain: '',
|
|
420
|
-
explorerBrowserDomain: 'app.hyperliquid-testnet.xyz/explorer',
|
|
421
|
-
usdcAddress: '0x2B3370eE501B4a559b57D449569354196457D8Ab',
|
|
422
|
-
isDev: true,
|
|
423
|
-
},
|
|
424
|
-
// Sonic
|
|
425
|
-
[enums_1.Chain.SONIC_MAINNET]: {
|
|
426
|
-
chainType: enums_1.ChainType.EVM,
|
|
427
|
-
chainId: 146,
|
|
428
|
-
name: 'Sonic',
|
|
429
|
-
alchemyNetwork: '',
|
|
430
|
-
explorerDomain: '',
|
|
431
|
-
explorerBrowserDomain: 'sonicscan.org',
|
|
432
|
-
usdcAddress: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894',
|
|
433
|
-
isDev: false,
|
|
434
|
-
},
|
|
435
|
-
[enums_1.Chain.SONIC_TESTNET]: {
|
|
436
|
-
chainType: enums_1.ChainType.EVM,
|
|
437
|
-
chainId: 64165,
|
|
438
|
-
name: 'Sonic Testnet',
|
|
439
|
-
alchemyNetwork: '',
|
|
440
|
-
explorerDomain: '',
|
|
441
|
-
explorerBrowserDomain: 'testnet.sonicscan.org',
|
|
442
|
-
usdcAddress: '0x0BA304580ee7c9a980CF72e55f5Ed2E9fd30Bc51',
|
|
443
|
-
isDev: true,
|
|
444
|
-
},
|
|
445
|
-
[enums_1.Chain.SONIC_BLAZE]: {
|
|
446
|
-
chainType: enums_1.ChainType.EVM,
|
|
447
|
-
chainId: 57054,
|
|
448
|
-
name: 'Sonic Blaze',
|
|
449
|
-
alchemyNetwork: '',
|
|
450
|
-
explorerDomain: '',
|
|
451
|
-
explorerBrowserDomain: 'blaze.sonicscan.org',
|
|
452
|
-
usdcAddress: '0xA4879Fed32Ecbef99399e5cbC247E533421C4eC6',
|
|
453
|
-
isDev: true,
|
|
454
|
-
},
|
|
455
|
-
// Unichain
|
|
456
|
-
[enums_1.Chain.UNICHAIN_MAINNET]: {
|
|
457
|
-
chainType: enums_1.ChainType.EVM,
|
|
458
|
-
chainId: 1,
|
|
459
|
-
name: 'Unichain',
|
|
460
|
-
alchemyNetwork: '',
|
|
461
|
-
explorerDomain: '',
|
|
462
|
-
explorerBrowserDomain: 'uniscan.xyz',
|
|
463
|
-
usdcAddress: '0x078D782b760474a361dDA0AF3839290b0EF57AD6',
|
|
464
|
-
isDev: false,
|
|
465
|
-
},
|
|
466
|
-
[enums_1.Chain.UNICHAIN_SEPOLIA]: {
|
|
467
|
-
chainType: enums_1.ChainType.EVM,
|
|
468
|
-
chainId: 1301,
|
|
469
|
-
name: 'Unichain Sepolia',
|
|
470
|
-
alchemyNetwork: '',
|
|
471
|
-
explorerDomain: '',
|
|
472
|
-
explorerBrowserDomain: 'sepolia.uniscan.xyz',
|
|
473
|
-
usdcAddress: '0x31d0220469e10c4E71834a79b1f276E153D00a2D',
|
|
474
|
-
isDev: true,
|
|
475
|
-
},
|
|
476
|
-
// World Chain
|
|
477
|
-
[enums_1.Chain.WORLD_MAINNET]: {
|
|
478
|
-
chainType: enums_1.ChainType.EVM,
|
|
479
|
-
chainId: 480,
|
|
480
|
-
name: 'World Chain',
|
|
481
|
-
alchemyNetwork: '',
|
|
482
|
-
explorerDomain: '',
|
|
483
|
-
explorerBrowserDomain: 'worldscan.org',
|
|
484
|
-
usdcAddress: '0x79A02482A880bCe3F13E09da970dC34dB4cD24D1',
|
|
485
|
-
isDev: false,
|
|
486
|
-
},
|
|
487
|
-
// XDC Network
|
|
488
|
-
[enums_1.Chain.XDC_MAINNET]: {
|
|
489
|
-
chainType: enums_1.ChainType.EVM,
|
|
490
|
-
chainId: 50,
|
|
491
|
-
name: 'XDC Network',
|
|
492
|
-
alchemyNetwork: '',
|
|
493
|
-
explorerDomain: '',
|
|
494
|
-
explorerBrowserDomain: 'xdcscan.io',
|
|
495
|
-
usdcAddress: '0x',
|
|
496
|
-
isDev: false,
|
|
497
|
-
},
|
|
498
|
-
// Ink
|
|
499
|
-
[enums_1.Chain.INK_TESTNET]: {
|
|
500
|
-
chainType: enums_1.ChainType.EVM,
|
|
501
|
-
chainId: 763373,
|
|
502
|
-
name: 'Ink Testnet',
|
|
503
|
-
alchemyNetwork: '',
|
|
504
|
-
explorerDomain: '',
|
|
505
|
-
explorerBrowserDomain: 'explorer.inkonchain.com',
|
|
506
|
-
usdcAddress: '0xFabab97dCE620294D2B0b0e46C68964e326300Ac',
|
|
507
|
-
isDev: true,
|
|
508
|
-
},
|
|
509
|
-
// Fetch.ai
|
|
510
|
-
[enums_1.Chain.FETCH_MAINNET]: {
|
|
511
|
-
chainType: enums_1.ChainType.EVM,
|
|
512
|
-
chainId: 2154,
|
|
513
|
-
name: 'Fetch.ai',
|
|
514
|
-
alchemyNetwork: '',
|
|
515
|
-
explorerDomain: '',
|
|
516
|
-
explorerBrowserDomain: 'explore.fetch.ai',
|
|
517
|
-
usdcAddress: '0x',
|
|
518
|
-
isDev: false,
|
|
519
|
-
},
|
|
520
|
-
[enums_1.Chain.FETCH_TESTNET]: {
|
|
521
|
-
chainType: enums_1.ChainType.EVM,
|
|
522
|
-
chainId: 2153,
|
|
523
|
-
name: 'Fetch.ai Testnet',
|
|
524
|
-
alchemyNetwork: '',
|
|
525
|
-
explorerDomain: '',
|
|
526
|
-
explorerBrowserDomain: 'explore-testnet.fetch.ai',
|
|
527
|
-
usdcAddress: '0x',
|
|
528
|
-
isDev: true,
|
|
529
|
-
},
|
|
530
|
-
// Gensyn
|
|
531
|
-
[enums_1.Chain.GENSYN_MAINNET]: {
|
|
532
|
-
chainType: enums_1.ChainType.EVM,
|
|
533
|
-
chainId: 8888,
|
|
534
|
-
name: 'Gensyn',
|
|
535
|
-
alchemyNetwork: '',
|
|
536
|
-
explorerDomain: '',
|
|
537
|
-
explorerBrowserDomain: 'explorer.gensyn.ai',
|
|
538
|
-
usdcAddress: '0x',
|
|
539
|
-
isDev: false,
|
|
540
|
-
},
|
|
541
|
-
[enums_1.Chain.GENSYN_TESTNET]: {
|
|
542
|
-
chainType: enums_1.ChainType.EVM,
|
|
543
|
-
chainId: 8887,
|
|
544
|
-
name: 'Gensyn Testnet',
|
|
545
|
-
alchemyNetwork: '',
|
|
546
|
-
explorerDomain: '',
|
|
547
|
-
explorerBrowserDomain: 'testnet.explorer.gensyn.ai',
|
|
548
|
-
usdcAddress: '0x',
|
|
549
|
-
isDev: true,
|
|
550
|
-
},
|
|
551
|
-
// Ritual
|
|
552
|
-
[enums_1.Chain.RITUAL_MAINNET]: {
|
|
553
|
-
chainType: enums_1.ChainType.EVM,
|
|
554
|
-
chainId: 7777,
|
|
555
|
-
name: 'Ritual',
|
|
556
|
-
alchemyNetwork: '',
|
|
557
|
-
explorerDomain: '',
|
|
558
|
-
explorerBrowserDomain: 'explorer.ritual.net',
|
|
559
|
-
usdcAddress: '0x',
|
|
560
|
-
isDev: false,
|
|
561
|
-
},
|
|
562
|
-
[enums_1.Chain.RITUAL_TESTNET]: {
|
|
563
|
-
chainType: enums_1.ChainType.EVM,
|
|
564
|
-
chainId: 7776,
|
|
565
|
-
name: 'Ritual Testnet',
|
|
566
|
-
alchemyNetwork: '',
|
|
567
|
-
explorerDomain: '',
|
|
568
|
-
explorerBrowserDomain: 'testnet.explorer.ritual.net',
|
|
569
|
-
usdcAddress: '0x',
|
|
570
|
-
isDev: true,
|
|
571
|
-
},
|
|
572
|
-
// Solana
|
|
573
|
-
[enums_1.Chain.SOLANA_MAINNET]: {
|
|
574
|
-
chainType: enums_1.ChainType.SOLANA,
|
|
575
|
-
chainId: -101,
|
|
576
|
-
name: 'Solana',
|
|
577
|
-
alchemyNetwork: 'solana-mainnet',
|
|
578
|
-
explorerDomain: '',
|
|
579
|
-
explorerBrowserDomain: 'explorer.solana.com',
|
|
580
|
-
usdcAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
581
|
-
isDev: false,
|
|
582
|
-
},
|
|
583
|
-
[enums_1.Chain.SOLANA_DEVNET]: {
|
|
584
|
-
chainType: enums_1.ChainType.SOLANA,
|
|
585
|
-
chainId: -102,
|
|
586
|
-
name: 'Solana Devnet',
|
|
587
|
-
alchemyNetwork: 'solana-devnet',
|
|
588
|
-
explorerDomain: '',
|
|
589
|
-
explorerBrowserDomain: 'explorer.solana.com/?cluster=devnet',
|
|
590
|
-
usdcAddress: '4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU',
|
|
591
|
-
isDev: true,
|
|
592
|
-
},
|
|
593
|
-
[enums_1.Chain.SOLANA_TESTNET]: {
|
|
594
|
-
chainType: enums_1.ChainType.SOLANA,
|
|
595
|
-
chainId: -103,
|
|
596
|
-
name: 'Solana Testnet',
|
|
597
|
-
alchemyNetwork: 'solana-testnet',
|
|
598
|
-
explorerDomain: '',
|
|
599
|
-
explorerBrowserDomain: 'explorer.solana.com/?cluster=testnet',
|
|
600
|
-
usdcAddress: '4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU',
|
|
601
|
-
isDev: true,
|
|
602
|
-
},
|
|
603
|
-
// Local development
|
|
604
|
-
[enums_1.Chain.EVM_LOCAL]: {
|
|
605
|
-
chainType: enums_1.ChainType.EVM,
|
|
606
|
-
chainId: 31337,
|
|
607
|
-
name: 'Local EVM',
|
|
608
|
-
alchemyNetwork: '',
|
|
609
|
-
explorerDomain: '',
|
|
610
|
-
explorerBrowserDomain: '',
|
|
611
|
-
usdcAddress: '0x0000000000000000000000000000000000000000',
|
|
612
|
-
isDev: true,
|
|
613
|
-
},
|
|
614
|
-
[enums_1.Chain.SOLANA_LOCAL]: {
|
|
615
|
-
chainType: enums_1.ChainType.SOLANA,
|
|
616
|
-
chainId: -104,
|
|
617
|
-
name: 'Local Solana',
|
|
618
|
-
alchemyNetwork: '',
|
|
619
|
-
explorerDomain: '',
|
|
620
|
-
explorerBrowserDomain: '',
|
|
621
|
-
usdcAddress: '11111111111111111111111111111111',
|
|
622
|
-
isDev: true,
|
|
623
|
-
},
|
|
624
|
-
};
|
|
625
|
-
/**
|
|
626
|
-
* Helper class for building RPC endpoints and block explorer API URLs
|
|
627
|
-
*/
|
|
628
|
-
class RpcHelpers {
|
|
629
|
-
/**
|
|
630
|
-
* Check if a chain is an EVM chain
|
|
631
|
-
* @param chain - Chain identifier to check
|
|
632
|
-
* @returns True if the chain is an EVM chain
|
|
633
|
-
*/
|
|
634
|
-
static isEvmChain(chain) {
|
|
635
|
-
const info = CHAIN_INFO_MAP[chain];
|
|
636
|
-
return info ? info.chainType === enums_1.ChainType.EVM : false;
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
* Check if a chain is a Solana chain
|
|
640
|
-
* @param chain - Chain identifier to check
|
|
641
|
-
* @returns True if the chain is a Solana chain
|
|
642
|
-
*/
|
|
643
|
-
static isSolanaChain(chain) {
|
|
644
|
-
const info = CHAIN_INFO_MAP[chain];
|
|
645
|
-
return info ? info.chainType === enums_1.ChainType.SOLANA : false;
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Get the chain type (EVM or Solana) for a given chain
|
|
649
|
-
* @param chain - Chain identifier
|
|
650
|
-
* @returns ChainType.EVM or ChainType.SOLANA
|
|
651
|
-
* @throws Error if the chain is not recognized
|
|
652
|
-
* @example
|
|
653
|
-
* ```typescript
|
|
654
|
-
* const type = RpcHelpers.getChainType(Chain.ETH_MAINNET);
|
|
655
|
-
* // Returns: ChainType.EVM
|
|
656
|
-
*
|
|
657
|
-
* const solanaType = RpcHelpers.getChainType(Chain.SOLANA_MAINNET);
|
|
658
|
-
* // Returns: ChainType.SOLANA
|
|
659
|
-
* ```
|
|
660
|
-
*/
|
|
661
|
-
static getChainType(chain) {
|
|
662
|
-
const info = CHAIN_INFO_MAP[chain];
|
|
663
|
-
if (!info) {
|
|
664
|
-
throw new Error(`Unknown chain: ${chain}`);
|
|
665
|
-
}
|
|
666
|
-
return info.chainType;
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
* Get complete static chain information
|
|
670
|
-
* @param chain - Chain identifier
|
|
671
|
-
* @returns ChainInfo object containing all static chain metadata
|
|
672
|
-
* @throws Error if the chain is not recognized
|
|
673
|
-
* @example
|
|
674
|
-
* ```typescript
|
|
675
|
-
* const info = RpcHelpers.getChainInfo(Chain.ETH_MAINNET);
|
|
676
|
-
* // Returns: {
|
|
677
|
-
* // chainType: ChainType.EVM,
|
|
678
|
-
* // chainId: 1,
|
|
679
|
-
* // name: 'Ethereum',
|
|
680
|
-
* // alchemyNetwork: 'eth-mainnet',
|
|
681
|
-
* // explorerDomain: 'api.etherscan.io',
|
|
682
|
-
* // explorerBrowserDomain: 'etherscan.io',
|
|
683
|
-
* // usdcAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
|
|
684
|
-
* // }
|
|
685
|
-
* ```
|
|
686
|
-
*/
|
|
687
|
-
static getChainInfo(chain) {
|
|
688
|
-
const info = CHAIN_INFO_MAP[chain];
|
|
689
|
-
if (!info) {
|
|
690
|
-
throw new Error(`Unknown chain: ${chain}`);
|
|
691
|
-
}
|
|
692
|
-
return info;
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Get the chain ID for a given chain
|
|
696
|
-
* @param chain - Chain identifier
|
|
697
|
-
* @returns Numeric chain ID for EVM chains, or negative ID for Solana chains
|
|
698
|
-
* @throws Error if the chain is not recognized or has no chain ID
|
|
699
|
-
* @example
|
|
700
|
-
* ```typescript
|
|
701
|
-
* const ethChainId = RpcHelpers.getChainId(Chain.ETH_MAINNET);
|
|
702
|
-
* // Returns: 1
|
|
703
|
-
*
|
|
704
|
-
* const polygonChainId = RpcHelpers.getChainId(Chain.POLYGON_MAINNET);
|
|
705
|
-
* // Returns: 137
|
|
706
|
-
*
|
|
707
|
-
* const solanaChainId = RpcHelpers.getChainId(Chain.SOLANA_MAINNET);
|
|
708
|
-
* // Returns: -101
|
|
709
|
-
*
|
|
710
|
-
* const localChainId = RpcHelpers.getChainId(Chain.EVM_LOCAL);
|
|
711
|
-
* // Returns: 31337
|
|
712
|
-
* ```
|
|
713
|
-
*/
|
|
714
|
-
static getChainId(chain) {
|
|
715
|
-
return this.getChainInfo(chain).chainId;
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Get the USDC address/mint for a given chain
|
|
719
|
-
* @param chain - Chain identifier
|
|
720
|
-
* @returns USDC contract address for EVM chains, or mint address for Solana chains
|
|
721
|
-
* @throws Error if the chain is not recognized
|
|
722
|
-
* @example
|
|
723
|
-
* ```typescript
|
|
724
|
-
* const ethUSDC = RpcHelpers.getUSDCAddress(Chain.ETH_MAINNET);
|
|
725
|
-
* // Returns: '0xA0b86a33E6441146a8A8e27c01f0D9B1F5E42E92'
|
|
726
|
-
*
|
|
727
|
-
* const polygonUSDC = RpcHelpers.getUSDCAddress(Chain.POLYGON_MAINNET);
|
|
728
|
-
* // Returns: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'
|
|
729
|
-
*
|
|
730
|
-
* const solanaUSDC = RpcHelpers.getUSDCAddress(Chain.SOLANA_MAINNET);
|
|
731
|
-
* // Returns: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
|
|
732
|
-
* ```
|
|
733
|
-
*/
|
|
734
|
-
static getUSDCAddress(chain) {
|
|
735
|
-
return this.getChainInfo(chain).usdcAddress;
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Get the user-friendly display name for a chain
|
|
739
|
-
* @param chain - Chain identifier
|
|
740
|
-
* @returns Human-readable chain name
|
|
741
|
-
* @throws Error if the chain is not recognized
|
|
742
|
-
* @example
|
|
743
|
-
* ```typescript
|
|
744
|
-
* const ethName = RpcHelpers.getUserFriendlyName(Chain.ETH_MAINNET);
|
|
745
|
-
* // Returns: 'Ethereum'
|
|
746
|
-
*
|
|
747
|
-
* const polygonName = RpcHelpers.getUserFriendlyName(Chain.POLYGON_MAINNET);
|
|
748
|
-
* // Returns: 'Polygon'
|
|
749
|
-
*
|
|
750
|
-
* const sepoliaName = RpcHelpers.getUserFriendlyName(Chain.ETH_SEPOLIA);
|
|
751
|
-
* // Returns: 'Ethereum Sepolia'
|
|
752
|
-
*
|
|
753
|
-
* const localName = RpcHelpers.getUserFriendlyName(Chain.EVM_LOCAL);
|
|
754
|
-
* // Returns: 'Local EVM'
|
|
755
|
-
* ```
|
|
756
|
-
*/
|
|
757
|
-
static getUserFriendlyName(chain) {
|
|
758
|
-
return this.getChainInfo(chain).name;
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* Get the list of visible chains for the application
|
|
762
|
-
* @param chainType - Filter by chain type (EVM or Solana)
|
|
763
|
-
* @param isDev - Whether to include development/testnet chains (true) or production chains (false)
|
|
764
|
-
* @returns Array of ChainInfo objects for chains that match the filters and have a mailer contract deployed
|
|
765
|
-
* @example
|
|
766
|
-
* ```typescript
|
|
767
|
-
* // Get production EVM chains with mailer contracts
|
|
768
|
-
* const prodEvmChains = RpcHelpers.getVisibleChains(ChainType.EVM, false);
|
|
769
|
-
* // Returns: ChainInfo[] with only mainnet EVM chains that have mailerAddress set
|
|
770
|
-
*
|
|
771
|
-
* // Get development EVM chains with mailer contracts
|
|
772
|
-
* const devEvmChains = RpcHelpers.getVisibleChains(ChainType.EVM, true);
|
|
773
|
-
* // Returns: ChainInfo[] with only testnet EVM chains that have mailerAddress set
|
|
774
|
-
*
|
|
775
|
-
* // Get production Solana chains with mailer contracts
|
|
776
|
-
* const prodSolanaChains = RpcHelpers.getVisibleChains(ChainType.SOLANA, false);
|
|
777
|
-
* // Returns: ChainInfo[] with only mainnet Solana chains that have mailerAddress set
|
|
778
|
-
* ```
|
|
779
|
-
*/
|
|
780
|
-
static getVisibleChains(chainType, isDev) {
|
|
781
|
-
return Object.values(CHAIN_INFO_MAP).filter((info) => info.chainType === chainType &&
|
|
782
|
-
info.isDev === isDev &&
|
|
783
|
-
info.mailerAddress !== undefined);
|
|
784
|
-
}
|
|
785
|
-
/**
|
|
786
|
-
* Derive all chain information from a ChainConfig including API URLs
|
|
787
|
-
* @param config - Chain configuration with API keys
|
|
788
|
-
* @returns Object with all derived chain information including RPC and explorer URLs
|
|
789
|
-
* @example
|
|
790
|
-
* ```typescript
|
|
791
|
-
* const config: ChainConfig = {
|
|
792
|
-
* chain: Chain.ETH_MAINNET,
|
|
793
|
-
* alchemyApiKey: 'your-alchemy-key',
|
|
794
|
-
* etherscanApiKey: 'your-etherscan-key'
|
|
795
|
-
* };
|
|
796
|
-
*
|
|
797
|
-
* const info = RpcHelpers.deriveChainInfo(config);
|
|
798
|
-
* // Returns: {
|
|
799
|
-
* // chain: Chain.ETH_MAINNET,
|
|
800
|
-
* // chainId: 1,
|
|
801
|
-
* // chainType: ChainType.EVM,
|
|
802
|
-
* // name: 'Ethereum',
|
|
803
|
-
* // rpcUrl: 'https://eth-mainnet.g.alchemy.com/v2/your-alchemy-key',
|
|
804
|
-
* // explorerApiUrl: 'https://api.etherscan.io/api?apikey=your-etherscan-key',
|
|
805
|
-
* // explorerUrl: 'https://etherscan.io',
|
|
806
|
-
* // usdcAddress: '0xA0b86a33E6441146a8A8e27c01f0D9B1F5E42E92'
|
|
807
|
-
* // }
|
|
808
|
-
* ```
|
|
809
|
-
*/
|
|
810
|
-
static deriveChainInfo(config) {
|
|
811
|
-
return {
|
|
812
|
-
chain: config.chain,
|
|
813
|
-
chainId: this.getChainId(config.chain),
|
|
814
|
-
chainType: this.getChainType(config.chain),
|
|
815
|
-
name: this.getUserFriendlyName(config.chain),
|
|
816
|
-
rpcUrl: this.getRpcUrl(config.alchemyApiKey, config.chain),
|
|
817
|
-
explorerApiUrl: this.getExplorerApiUrl(config.etherscanApiKey, config.chain),
|
|
818
|
-
explorerUrl: this.getBlockExplorerUrl(config.chain),
|
|
819
|
-
usdcAddress: this.getUSDCAddress(config.chain),
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
static getRpcUrl(apiKeyOrApis, chain) {
|
|
823
|
-
const alchemyApiKey = typeof apiKeyOrApis === 'string'
|
|
824
|
-
? apiKeyOrApis
|
|
825
|
-
: apiKeyOrApis.alchemyApiKey;
|
|
826
|
-
if (!alchemyApiKey) {
|
|
827
|
-
return undefined;
|
|
828
|
-
}
|
|
829
|
-
const chainInfo = this.getChainInfo(chain);
|
|
830
|
-
const network = chainInfo.alchemyNetwork;
|
|
831
|
-
if (!network) {
|
|
832
|
-
return undefined;
|
|
833
|
-
}
|
|
834
|
-
return `https://${network}.g.alchemy.com/v2/${alchemyApiKey}`;
|
|
835
|
-
}
|
|
836
|
-
static getExplorerApiUrl(apiKeyOrApis, chain) {
|
|
837
|
-
const etherscanApiKey = typeof apiKeyOrApis === 'string'
|
|
838
|
-
? apiKeyOrApis
|
|
839
|
-
: apiKeyOrApis.etherscanApiKey;
|
|
840
|
-
if (!etherscanApiKey) {
|
|
841
|
-
return undefined;
|
|
842
|
-
}
|
|
843
|
-
const chainInfo = this.getChainInfo(chain);
|
|
844
|
-
if (chainInfo.chainType === enums_1.ChainType.SOLANA) {
|
|
845
|
-
return undefined;
|
|
846
|
-
}
|
|
847
|
-
const domain = chainInfo.explorerDomain;
|
|
848
|
-
if (!domain) {
|
|
849
|
-
return undefined;
|
|
850
|
-
}
|
|
851
|
-
return `https://${domain}/api?apikey=${etherscanApiKey}`;
|
|
852
|
-
}
|
|
853
|
-
/**
|
|
854
|
-
* Get block explorer browser URL
|
|
855
|
-
*
|
|
856
|
-
* @param chain - Chain identifier from Chain enum
|
|
857
|
-
* @returns Browser URL for the explorer, or undefined if no explorer available
|
|
858
|
-
*
|
|
859
|
-
* @example
|
|
860
|
-
* ```typescript
|
|
861
|
-
* const etherscanUrl = RpcHelpers.getBlockExplorerUrl(Chain.ETH_MAINNET);
|
|
862
|
-
* // Returns: https://etherscan.io
|
|
863
|
-
*
|
|
864
|
-
* const basescanUrl = RpcHelpers.getBlockExplorerUrl(Chain.BASE_MAINNET);
|
|
865
|
-
* // Returns: https://basescan.org
|
|
866
|
-
*
|
|
867
|
-
* const solanaUrl = RpcHelpers.getBlockExplorerUrl(Chain.SOLANA_MAINNET);
|
|
868
|
-
* // Returns: https://explorer.solana.com
|
|
869
|
-
* ```
|
|
870
|
-
*/
|
|
871
|
-
static getBlockExplorerUrl(chain) {
|
|
872
|
-
const chainInfo = this.getChainInfo(chain);
|
|
873
|
-
const domain = chainInfo.explorerBrowserDomain;
|
|
874
|
-
if (!domain) {
|
|
875
|
-
return undefined;
|
|
876
|
-
}
|
|
877
|
-
return `https://${domain}`;
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
exports.RpcHelpers = RpcHelpers;
|
|
881
|
-
//# sourceMappingURL=rpc-helpers.js.map
|