@vleap/warps-adapter-evm 0.2.0-alpha.5 → 0.2.0-alpha.7
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.d.mts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +282 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +278 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/README.md +0 -400
package/dist/index.mjs
CHANGED
|
@@ -196,13 +196,246 @@ var WarpEvmBuilder = class {
|
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
198
|
|
|
199
|
+
// src/WarpEvmDataLoader.ts
|
|
200
|
+
import { ethers as ethers2 } from "ethers";
|
|
201
|
+
var ERC20_ABI = [
|
|
202
|
+
"function balanceOf(address owner) view returns (uint256)",
|
|
203
|
+
"function decimals() view returns (uint8)",
|
|
204
|
+
"function name() view returns (string)",
|
|
205
|
+
"function symbol() view returns (string)",
|
|
206
|
+
"function totalSupply() view returns (uint256)"
|
|
207
|
+
];
|
|
208
|
+
var KNOWN_TOKENS = {
|
|
209
|
+
ethereum: {
|
|
210
|
+
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": {
|
|
211
|
+
name: "USD Coin",
|
|
212
|
+
symbol: "USDC",
|
|
213
|
+
decimals: 6,
|
|
214
|
+
logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
|
|
215
|
+
},
|
|
216
|
+
"0xdAC17F958D2ee523a2206206994597C13D831ec7": {
|
|
217
|
+
name: "Tether USD",
|
|
218
|
+
symbol: "USDT",
|
|
219
|
+
decimals: 6,
|
|
220
|
+
logoUrl: "https://assets.coingecko.com/coins/images/325/small/Tether.png"
|
|
221
|
+
},
|
|
222
|
+
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599": {
|
|
223
|
+
name: "Wrapped Bitcoin",
|
|
224
|
+
symbol: "WBTC",
|
|
225
|
+
decimals: 8,
|
|
226
|
+
logoUrl: "https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png"
|
|
227
|
+
},
|
|
228
|
+
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": {
|
|
229
|
+
name: "Wrapped Ether",
|
|
230
|
+
symbol: "WETH",
|
|
231
|
+
decimals: 18,
|
|
232
|
+
logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
|
|
233
|
+
},
|
|
234
|
+
"0x6B175474E89094C44Da98b954EedeAC495271d0F": {
|
|
235
|
+
name: "Dai Stablecoin",
|
|
236
|
+
symbol: "DAI",
|
|
237
|
+
decimals: 18,
|
|
238
|
+
logoUrl: "https://assets.coingecko.com/coins/images/9956/small/4943.png"
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
arbitrum: {
|
|
242
|
+
"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8": {
|
|
243
|
+
name: "USD Coin",
|
|
244
|
+
symbol: "USDC",
|
|
245
|
+
decimals: 6,
|
|
246
|
+
logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
|
|
247
|
+
},
|
|
248
|
+
"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9": {
|
|
249
|
+
name: "Tether USD",
|
|
250
|
+
symbol: "USDT",
|
|
251
|
+
decimals: 6,
|
|
252
|
+
logoUrl: "https://assets.coingecko.com/coins/images/325/small/Tether.png"
|
|
253
|
+
},
|
|
254
|
+
"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1": {
|
|
255
|
+
name: "Wrapped Ether",
|
|
256
|
+
symbol: "WETH",
|
|
257
|
+
decimals: 18,
|
|
258
|
+
logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
base: {
|
|
262
|
+
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913": {
|
|
263
|
+
name: "USD Coin",
|
|
264
|
+
symbol: "USDC",
|
|
265
|
+
decimals: 6,
|
|
266
|
+
logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
|
|
267
|
+
},
|
|
268
|
+
"0x4200000000000000000000000000000000000006": {
|
|
269
|
+
name: "Wrapped Ether",
|
|
270
|
+
symbol: "WETH",
|
|
271
|
+
decimals: 18,
|
|
272
|
+
logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
var WarpEvmDataLoader = class {
|
|
277
|
+
constructor(config, chain) {
|
|
278
|
+
this.config = config;
|
|
279
|
+
this.chain = chain;
|
|
280
|
+
this.provider = new ethers2.JsonRpcProvider(getEvmApiUrl(this.config.env, this.chain.name));
|
|
281
|
+
this.chainConfig = getEvmChainConfig(this.chain.name, this.config.env);
|
|
282
|
+
}
|
|
283
|
+
async getAccount(address) {
|
|
284
|
+
try {
|
|
285
|
+
const balance = await this.provider.getBalance(address);
|
|
286
|
+
return {
|
|
287
|
+
address,
|
|
288
|
+
balance
|
|
289
|
+
};
|
|
290
|
+
} catch (error) {
|
|
291
|
+
throw new Error(`Failed to get account balance for ${address}: ${error}`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async getAccountAssets(address) {
|
|
295
|
+
try {
|
|
296
|
+
const assets = [];
|
|
297
|
+
const tokenBalances = await this.getERC20TokenBalances(address);
|
|
298
|
+
for (const tokenBalance of tokenBalances) {
|
|
299
|
+
if (tokenBalance.balance > 0n) {
|
|
300
|
+
assets.push({
|
|
301
|
+
identifier: tokenBalance.tokenAddress,
|
|
302
|
+
name: tokenBalance.metadata.name,
|
|
303
|
+
amount: tokenBalance.balance,
|
|
304
|
+
decimals: tokenBalance.metadata.decimals,
|
|
305
|
+
logoUrl: tokenBalance.metadata.logoUrl || ""
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return assets;
|
|
310
|
+
} catch (error) {
|
|
311
|
+
throw new Error(`Failed to get account assets for ${address}: ${error}`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
async getERC20TokenBalances(address) {
|
|
315
|
+
const tokenBalances = [];
|
|
316
|
+
const knownTokens = KNOWN_TOKENS[this.chain.name] || {};
|
|
317
|
+
for (const [tokenAddress, metadata] of Object.entries(knownTokens)) {
|
|
318
|
+
try {
|
|
319
|
+
const balance = await this.getTokenBalance(address, tokenAddress);
|
|
320
|
+
if (balance > 0n) {
|
|
321
|
+
tokenBalances.push({
|
|
322
|
+
tokenAddress,
|
|
323
|
+
balance,
|
|
324
|
+
metadata
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
} catch (error) {
|
|
328
|
+
console.warn(`Failed to get balance for token ${tokenAddress}: ${error}`);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const additionalTokens = await this.detectTokensFromEvents(address);
|
|
332
|
+
for (const tokenAddress of additionalTokens) {
|
|
333
|
+
if (!knownTokens[tokenAddress]) {
|
|
334
|
+
try {
|
|
335
|
+
const metadata = await this.getTokenMetadata(tokenAddress);
|
|
336
|
+
const balance = await this.getTokenBalance(address, tokenAddress);
|
|
337
|
+
if (balance > 0n) {
|
|
338
|
+
tokenBalances.push({
|
|
339
|
+
tokenAddress,
|
|
340
|
+
balance,
|
|
341
|
+
metadata
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
} catch (error) {
|
|
345
|
+
console.warn(`Failed to get metadata/balance for detected token ${tokenAddress}: ${error}`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return tokenBalances;
|
|
350
|
+
}
|
|
351
|
+
async getTokenBalance(address, tokenAddress) {
|
|
352
|
+
try {
|
|
353
|
+
const contract = new ethers2.Contract(tokenAddress, ERC20_ABI, this.provider);
|
|
354
|
+
const balance = await contract.balanceOf(address);
|
|
355
|
+
return balance;
|
|
356
|
+
} catch (error) {
|
|
357
|
+
throw new Error(`Failed to get token balance: ${error}`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
async getTokenMetadata(tokenAddress) {
|
|
361
|
+
try {
|
|
362
|
+
const contract = new ethers2.Contract(tokenAddress, ERC20_ABI, this.provider);
|
|
363
|
+
const [name, symbol, decimals] = await Promise.all([contract.name(), contract.symbol(), contract.decimals()]);
|
|
364
|
+
return {
|
|
365
|
+
name: name || "Unknown Token",
|
|
366
|
+
symbol: symbol || "UNKNOWN",
|
|
367
|
+
decimals: decimals || 18
|
|
368
|
+
};
|
|
369
|
+
} catch (error) {
|
|
370
|
+
throw new Error(`Failed to get token metadata: ${error}`);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
async detectTokensFromEvents(address) {
|
|
374
|
+
try {
|
|
375
|
+
const currentBlock = await this.provider.getBlockNumber();
|
|
376
|
+
const fromBlock = Math.max(0, currentBlock - 1e4);
|
|
377
|
+
const filter = {
|
|
378
|
+
fromBlock,
|
|
379
|
+
toBlock: currentBlock,
|
|
380
|
+
topics: [
|
|
381
|
+
ethers2.id("Transfer(address,address,uint256)"),
|
|
382
|
+
null,
|
|
383
|
+
// from address (any)
|
|
384
|
+
ethers2.zeroPadValue(address, 32)
|
|
385
|
+
// to address (our target)
|
|
386
|
+
]
|
|
387
|
+
};
|
|
388
|
+
const logs = await this.provider.getLogs(filter);
|
|
389
|
+
const tokenAddresses = /* @__PURE__ */ new Set();
|
|
390
|
+
for (const log of logs) {
|
|
391
|
+
tokenAddresses.add(log.address);
|
|
392
|
+
}
|
|
393
|
+
return Array.from(tokenAddresses);
|
|
394
|
+
} catch (error) {
|
|
395
|
+
console.warn(`Failed to detect tokens from events: ${error}`);
|
|
396
|
+
return [];
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
// Additional utility methods for enhanced token support
|
|
400
|
+
async getTokenInfo(tokenAddress) {
|
|
401
|
+
try {
|
|
402
|
+
return await this.getTokenMetadata(tokenAddress);
|
|
403
|
+
} catch (error) {
|
|
404
|
+
console.warn(`Failed to get token info for ${tokenAddress}: ${error}`);
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
async getTokenBalanceForAddress(address, tokenAddress) {
|
|
409
|
+
try {
|
|
410
|
+
return await this.getTokenBalance(address, tokenAddress);
|
|
411
|
+
} catch (error) {
|
|
412
|
+
throw new Error(`Failed to get token balance for ${tokenAddress}: ${error}`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
async getMultipleTokenBalances(address, tokenAddresses) {
|
|
416
|
+
const balances = /* @__PURE__ */ new Map();
|
|
417
|
+
await Promise.all(
|
|
418
|
+
tokenAddresses.map(async (tokenAddress) => {
|
|
419
|
+
try {
|
|
420
|
+
const balance = await this.getTokenBalance(address, tokenAddress);
|
|
421
|
+
balances.set(tokenAddress, balance);
|
|
422
|
+
} catch (error) {
|
|
423
|
+
console.warn(`Failed to get balance for token ${tokenAddress}: ${error}`);
|
|
424
|
+
balances.set(tokenAddress, 0n);
|
|
425
|
+
}
|
|
426
|
+
})
|
|
427
|
+
);
|
|
428
|
+
return balances;
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
|
|
199
432
|
// src/WarpEvmExecutor.ts
|
|
200
433
|
import {
|
|
201
434
|
applyResultsToMessages,
|
|
202
435
|
getNextInfo,
|
|
203
436
|
getWarpActionByIndex
|
|
204
437
|
} from "@vleap/warps";
|
|
205
|
-
import { ethers as
|
|
438
|
+
import { ethers as ethers4 } from "ethers";
|
|
206
439
|
|
|
207
440
|
// src/constants.ts
|
|
208
441
|
var WarpEvmConstants = {
|
|
@@ -289,7 +522,7 @@ import {
|
|
|
289
522
|
WarpConstants,
|
|
290
523
|
WarpSerializer
|
|
291
524
|
} from "@vleap/warps";
|
|
292
|
-
import { ethers as
|
|
525
|
+
import { ethers as ethers3 } from "ethers";
|
|
293
526
|
var SplitParamsRegex = new RegExp(`${WarpConstants.ArgParamsSeparator}(.*)`);
|
|
294
527
|
var WarpEvmSerializer = class {
|
|
295
528
|
constructor() {
|
|
@@ -297,10 +530,10 @@ var WarpEvmSerializer = class {
|
|
|
297
530
|
}
|
|
298
531
|
typedToString(value) {
|
|
299
532
|
if (typeof value === "string") {
|
|
300
|
-
if (
|
|
533
|
+
if (ethers3.isAddress(value)) {
|
|
301
534
|
return `address:${value}`;
|
|
302
535
|
}
|
|
303
|
-
if (
|
|
536
|
+
if (ethers3.isHexString(value) && !ethers3.isAddress(value)) {
|
|
304
537
|
return `hex:${value}`;
|
|
305
538
|
}
|
|
306
539
|
return `string:${value}`;
|
|
@@ -508,7 +741,7 @@ var WarpEvmExecutor = class {
|
|
|
508
741
|
constructor(config) {
|
|
509
742
|
this.config = config;
|
|
510
743
|
this.serializer = new WarpEvmSerializer();
|
|
511
|
-
this.provider = new
|
|
744
|
+
this.provider = new ethers4.JsonRpcProvider(getEvmApiUrl(config.env));
|
|
512
745
|
this.results = new WarpEvmResults(config);
|
|
513
746
|
}
|
|
514
747
|
async createTransaction(executable) {
|
|
@@ -527,9 +760,9 @@ var WarpEvmExecutor = class {
|
|
|
527
760
|
return tx;
|
|
528
761
|
}
|
|
529
762
|
async createTransferTransaction(executable) {
|
|
530
|
-
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
763
|
+
const userWallet = this.config.user?.wallets?.[executable.chain.name];
|
|
531
764
|
if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
|
|
532
|
-
if (!
|
|
765
|
+
if (!ethers4.isAddress(executable.destination)) {
|
|
533
766
|
throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
|
|
534
767
|
}
|
|
535
768
|
if (executable.value < 0) {
|
|
@@ -543,20 +776,20 @@ var WarpEvmExecutor = class {
|
|
|
543
776
|
return this.estimateGasAndSetDefaults(tx, userWallet);
|
|
544
777
|
}
|
|
545
778
|
async createContractCallTransaction(executable) {
|
|
546
|
-
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
779
|
+
const userWallet = this.config.user?.wallets?.[executable.chain.name];
|
|
547
780
|
if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
|
|
548
781
|
const action = getWarpActionByIndex(executable.warp, executable.action);
|
|
549
782
|
if (!action || !("func" in action) || !action.func) {
|
|
550
783
|
throw new Error("WarpEvmExecutor: Contract action must have a function name");
|
|
551
784
|
}
|
|
552
|
-
if (!
|
|
785
|
+
if (!ethers4.isAddress(executable.destination)) {
|
|
553
786
|
throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
|
|
554
787
|
}
|
|
555
788
|
if (executable.value < 0) {
|
|
556
789
|
throw new Error(`WarpEvmExecutor: Contract call value cannot be negative: ${executable.value}`);
|
|
557
790
|
}
|
|
558
791
|
try {
|
|
559
|
-
const iface = new
|
|
792
|
+
const iface = new ethers4.Interface([`function ${action.func}`]);
|
|
560
793
|
const encodedData = iface.encodeFunctionData(action.func, executable.args);
|
|
561
794
|
const tx = {
|
|
562
795
|
to: executable.destination,
|
|
@@ -576,11 +809,11 @@ var WarpEvmExecutor = class {
|
|
|
576
809
|
if (!action.func) {
|
|
577
810
|
throw new Error("WarpEvmExecutor: Query action must have a function name");
|
|
578
811
|
}
|
|
579
|
-
if (!
|
|
812
|
+
if (!ethers4.isAddress(executable.destination)) {
|
|
580
813
|
throw new Error(`WarpEvmExecutor: Invalid contract address for query: ${executable.destination}`);
|
|
581
814
|
}
|
|
582
815
|
try {
|
|
583
|
-
const iface = new
|
|
816
|
+
const iface = new ethers4.Interface([`function ${action.func}`]);
|
|
584
817
|
const encodedData = iface.encodeFunctionData(action.func, executable.args);
|
|
585
818
|
const result = await this.provider.call({
|
|
586
819
|
to: executable.destination,
|
|
@@ -599,7 +832,7 @@ var WarpEvmExecutor = class {
|
|
|
599
832
|
success: isSuccess,
|
|
600
833
|
warp: executable.warp,
|
|
601
834
|
action: executable.action,
|
|
602
|
-
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
835
|
+
user: this.config.user?.wallets?.[executable.chain.name] || null,
|
|
603
836
|
txHash: null,
|
|
604
837
|
next,
|
|
605
838
|
values,
|
|
@@ -611,7 +844,7 @@ var WarpEvmExecutor = class {
|
|
|
611
844
|
success: false,
|
|
612
845
|
warp: executable.warp,
|
|
613
846
|
action: executable.action,
|
|
614
|
-
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
847
|
+
user: this.config.user?.wallets?.[executable.chain.name] || null,
|
|
615
848
|
txHash: null,
|
|
616
849
|
next: null,
|
|
617
850
|
values: [],
|
|
@@ -624,12 +857,12 @@ var WarpEvmExecutor = class {
|
|
|
624
857
|
const typedValue = this.serializer.stringToTyped(value);
|
|
625
858
|
switch (type) {
|
|
626
859
|
case "address":
|
|
627
|
-
if (!
|
|
860
|
+
if (!ethers4.isAddress(typedValue)) {
|
|
628
861
|
throw new Error(`Invalid address format: ${typedValue}`);
|
|
629
862
|
}
|
|
630
|
-
return
|
|
863
|
+
return ethers4.getAddress(typedValue);
|
|
631
864
|
case "hex":
|
|
632
|
-
if (!
|
|
865
|
+
if (!ethers4.isHexString(typedValue)) {
|
|
633
866
|
throw new Error(`Invalid hex format: ${typedValue}`);
|
|
634
867
|
}
|
|
635
868
|
return typedValue;
|
|
@@ -677,7 +910,7 @@ var WarpEvmExecutor = class {
|
|
|
677
910
|
return {
|
|
678
911
|
...tx,
|
|
679
912
|
gasLimit: gasEstimate,
|
|
680
|
-
gasPrice:
|
|
913
|
+
gasPrice: ethers4.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
|
|
681
914
|
};
|
|
682
915
|
}
|
|
683
916
|
} catch (error) {
|
|
@@ -690,7 +923,7 @@ var WarpEvmExecutor = class {
|
|
|
690
923
|
return {
|
|
691
924
|
...tx,
|
|
692
925
|
gasLimit: defaultGasLimit,
|
|
693
|
-
gasPrice:
|
|
926
|
+
gasPrice: ethers4.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
|
|
694
927
|
};
|
|
695
928
|
}
|
|
696
929
|
}
|
|
@@ -706,7 +939,7 @@ var WarpEvmExplorer = class {
|
|
|
706
939
|
this.config = config;
|
|
707
940
|
}
|
|
708
941
|
getExplorers() {
|
|
709
|
-
const chainExplorers = EvmExplorers[this.chain];
|
|
942
|
+
const chainExplorers = EvmExplorers[this.chain.name];
|
|
710
943
|
if (!chainExplorers) {
|
|
711
944
|
return ["Default"];
|
|
712
945
|
}
|
|
@@ -721,7 +954,7 @@ var WarpEvmExplorer = class {
|
|
|
721
954
|
return explorers[0];
|
|
722
955
|
}
|
|
723
956
|
getExplorerUrlByName(explorer) {
|
|
724
|
-
const userPreference = this.config.preferences?.explorers?.[this.chain];
|
|
957
|
+
const userPreference = this.config.preferences?.explorers?.[this.chain.name];
|
|
725
958
|
if (userPreference && !explorer) {
|
|
726
959
|
const url2 = ExplorerUrls[userPreference];
|
|
727
960
|
if (url2) return url2;
|
|
@@ -800,14 +1033,17 @@ var createEvmAdapter = (chainName, chainPrefix, chainInfos) => {
|
|
|
800
1033
|
registry: fallback.registry,
|
|
801
1034
|
explorer: new WarpEvmExplorer(chainInfos[config.env], config),
|
|
802
1035
|
abiBuilder: () => fallback.abiBuilder(),
|
|
803
|
-
brandBuilder: () => fallback.brandBuilder()
|
|
1036
|
+
brandBuilder: () => fallback.brandBuilder(),
|
|
1037
|
+
dataLoader: new WarpEvmDataLoader(config, chainInfos[config.env])
|
|
804
1038
|
};
|
|
805
1039
|
};
|
|
806
1040
|
};
|
|
807
1041
|
|
|
808
1042
|
// src/chains/arbitrum.ts
|
|
809
|
-
var
|
|
1043
|
+
var ChainNameArbitrum = "arbitrum";
|
|
1044
|
+
var getArbitrumAdapter = createEvmAdapter(ChainNameArbitrum, "arb", {
|
|
810
1045
|
devnet: {
|
|
1046
|
+
name: ChainNameArbitrum,
|
|
811
1047
|
displayName: "Arbitrum Devnet",
|
|
812
1048
|
chainId: "421614",
|
|
813
1049
|
blockTime: 1e3,
|
|
@@ -816,6 +1052,7 @@ var getArbitrumAdapter = createEvmAdapter("arbitrum", "arb", {
|
|
|
816
1052
|
nativeToken: "ETH"
|
|
817
1053
|
},
|
|
818
1054
|
testnet: {
|
|
1055
|
+
name: ChainNameArbitrum,
|
|
819
1056
|
displayName: "Arbitrum Testnet",
|
|
820
1057
|
chainId: "421613",
|
|
821
1058
|
blockTime: 1e3,
|
|
@@ -824,6 +1061,7 @@ var getArbitrumAdapter = createEvmAdapter("arbitrum", "arb", {
|
|
|
824
1061
|
nativeToken: "ETH"
|
|
825
1062
|
},
|
|
826
1063
|
mainnet: {
|
|
1064
|
+
name: ChainNameArbitrum,
|
|
827
1065
|
displayName: "Arbitrum",
|
|
828
1066
|
chainId: "42161",
|
|
829
1067
|
blockTime: 1e3,
|
|
@@ -834,8 +1072,10 @@ var getArbitrumAdapter = createEvmAdapter("arbitrum", "arb", {
|
|
|
834
1072
|
});
|
|
835
1073
|
|
|
836
1074
|
// src/chains/base.ts
|
|
837
|
-
var
|
|
1075
|
+
var ChainNameBase = "base";
|
|
1076
|
+
var getBaseAdapter = createEvmAdapter(ChainNameBase, "base", {
|
|
838
1077
|
mainnet: {
|
|
1078
|
+
name: ChainNameBase,
|
|
839
1079
|
displayName: "Base",
|
|
840
1080
|
chainId: "8453",
|
|
841
1081
|
blockTime: 2e3,
|
|
@@ -844,7 +1084,8 @@ var getBaseAdapter = createEvmAdapter("base", "base", {
|
|
|
844
1084
|
nativeToken: "ETH"
|
|
845
1085
|
},
|
|
846
1086
|
testnet: {
|
|
847
|
-
|
|
1087
|
+
name: ChainNameBase,
|
|
1088
|
+
displayName: "Base Testnet",
|
|
848
1089
|
chainId: "84531",
|
|
849
1090
|
blockTime: 2e3,
|
|
850
1091
|
addressHrp: "0x",
|
|
@@ -852,7 +1093,8 @@ var getBaseAdapter = createEvmAdapter("base", "base", {
|
|
|
852
1093
|
nativeToken: "ETH"
|
|
853
1094
|
},
|
|
854
1095
|
devnet: {
|
|
855
|
-
|
|
1096
|
+
name: ChainNameBase,
|
|
1097
|
+
displayName: "Base Devnet",
|
|
856
1098
|
chainId: "84532",
|
|
857
1099
|
blockTime: 2e3,
|
|
858
1100
|
addressHrp: "0x",
|
|
@@ -862,8 +1104,10 @@ var getBaseAdapter = createEvmAdapter("base", "base", {
|
|
|
862
1104
|
});
|
|
863
1105
|
|
|
864
1106
|
// src/chains/ethereum.ts
|
|
865
|
-
var
|
|
1107
|
+
var ChainNameEthereum = "ethereum";
|
|
1108
|
+
var getEthereumAdapter = createEvmAdapter(ChainNameEthereum, "eth", {
|
|
866
1109
|
devnet: {
|
|
1110
|
+
name: ChainNameEthereum,
|
|
867
1111
|
displayName: "Ethereum Devnet",
|
|
868
1112
|
chainId: "11155111",
|
|
869
1113
|
blockTime: 12e3,
|
|
@@ -872,6 +1116,7 @@ var getEthereumAdapter = createEvmAdapter("ethereum", "eth", {
|
|
|
872
1116
|
nativeToken: "ETH"
|
|
873
1117
|
},
|
|
874
1118
|
testnet: {
|
|
1119
|
+
name: ChainNameEthereum,
|
|
875
1120
|
displayName: "Ethereum Testnet",
|
|
876
1121
|
chainId: "5",
|
|
877
1122
|
blockTime: 12e3,
|
|
@@ -880,6 +1125,7 @@ var getEthereumAdapter = createEvmAdapter("ethereum", "eth", {
|
|
|
880
1125
|
nativeToken: "ETH"
|
|
881
1126
|
},
|
|
882
1127
|
mainnet: {
|
|
1128
|
+
name: ChainNameEthereum,
|
|
883
1129
|
displayName: "Ethereum Mainnet",
|
|
884
1130
|
chainId: "1",
|
|
885
1131
|
blockTime: 12e3,
|
|
@@ -895,9 +1141,13 @@ var getAllEvmAdapters = (config, fallback) => [
|
|
|
895
1141
|
getArbitrumAdapter(config, fallback),
|
|
896
1142
|
getBaseAdapter(config, fallback)
|
|
897
1143
|
];
|
|
1144
|
+
var getAllEvmChainNames = () => [ChainNameArbitrum, ChainNameBase, ChainNameEthereum];
|
|
898
1145
|
export {
|
|
899
1146
|
ArbitrumExplorers,
|
|
900
1147
|
BaseExplorers,
|
|
1148
|
+
ChainNameArbitrum,
|
|
1149
|
+
ChainNameBase,
|
|
1150
|
+
ChainNameEthereum,
|
|
901
1151
|
EVM_CHAIN_CONFIGS,
|
|
902
1152
|
EthereumExplorers,
|
|
903
1153
|
EvmExplorers,
|
|
@@ -909,6 +1159,7 @@ export {
|
|
|
909
1159
|
WarpEvmResults,
|
|
910
1160
|
WarpEvmSerializer,
|
|
911
1161
|
getAllEvmAdapters,
|
|
1162
|
+
getAllEvmChainNames,
|
|
912
1163
|
getArbitrumAdapter,
|
|
913
1164
|
getBaseAdapter,
|
|
914
1165
|
getEthereumAdapter,
|