@vleap/warps-adapter-evm 0.2.0-alpha.6 → 0.2.0-alpha.8

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 CHANGED
@@ -1,12 +1,16 @@
1
- import { AdapterFactory, WarpClientConfig, Adapter, WarpChainEnv, CombinedWarpBuilder, Warp, BaseWarpBuilder, WarpCacheConfig, AdapterWarpExecutor, WarpExecutable, WarpExecution, WarpChainInfo, WarpActionInputType, AdapterWarpExplorer, WarpChain, AdapterWarpResults, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
1
+ import { WarpChain, AdapterFactory, WarpClientConfig, Adapter, WarpChainEnv, CombinedWarpBuilder, Warp, BaseWarpBuilder, WarpCacheConfig, AdapterWarpExecutor, WarpExecutable, WarpExecution, WarpChainInfo, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
2
2
  import { ethers } from 'ethers';
3
3
 
4
+ declare const ChainNameArbitrum: WarpChain;
4
5
  declare const getArbitrumAdapter: AdapterFactory;
5
6
 
7
+ declare const ChainNameBase: WarpChain;
6
8
  declare const getBaseAdapter: AdapterFactory;
7
9
 
8
10
  declare const getAllEvmAdapters: (config: WarpClientConfig, fallback?: Adapter) => Adapter[];
11
+ declare const getAllEvmChainNames: () => WarpChain[];
9
12
 
13
+ declare const ChainNameEthereum: WarpChain;
10
14
  declare const getEthereumAdapter: AdapterFactory;
11
15
 
12
16
  interface EvmChainConfig {
@@ -113,15 +117,15 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
113
117
  declare class WarpEvmExplorer implements AdapterWarpExplorer {
114
118
  private readonly chain;
115
119
  private readonly config;
116
- constructor(chain: WarpChain, config: WarpClientConfig);
120
+ constructor(chain: WarpChainInfo, config: WarpClientConfig);
117
121
  private getExplorers;
118
122
  private getPrimaryExplorer;
119
123
  private getExplorerUrlByName;
120
124
  getAccountUrl(address: string, explorer?: ExplorerName): string;
121
125
  getTransactionUrl(hash: string, explorer?: ExplorerName): string;
122
126
  getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
123
- getTokenUrl(tokenAddress: string, explorer?: ExplorerName): string;
124
- getContractUrl(contractAddress: string, explorer?: ExplorerName): string;
127
+ getAssetUrl(identifier: string, explorer?: ExplorerName): string;
128
+ getContractUrl(address: string, explorer?: ExplorerName): string;
125
129
  getAllExplorers(): readonly ExplorerName[];
126
130
  getExplorerByName(name: string): ExplorerName | undefined;
127
131
  getAccountUrls(address: string): Record<ExplorerName, string>;
@@ -150,4 +154,4 @@ declare class WarpEvmSerializer implements AdapterWarpSerializer {
150
154
  private parseNativeValue;
151
155
  }
152
156
 
153
- export { ArbitrumExplorers, BaseExplorers, EVM_CHAIN_CONFIGS, EthereumExplorers, type EvmChainConfig, EvmExplorers, type ExplorerName, ExplorerUrls, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer, getAllEvmAdapters, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getEvmApiUrl, getEvmChainConfig, getEvmExplorerUrl };
157
+ export { ArbitrumExplorers, BaseExplorers, ChainNameArbitrum, ChainNameBase, ChainNameEthereum, EVM_CHAIN_CONFIGS, EthereumExplorers, type EvmChainConfig, EvmExplorers, type ExplorerName, ExplorerUrls, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer, getAllEvmAdapters, getAllEvmChainNames, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getEvmApiUrl, getEvmChainConfig, getEvmExplorerUrl };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,16 @@
1
- import { AdapterFactory, WarpClientConfig, Adapter, WarpChainEnv, CombinedWarpBuilder, Warp, BaseWarpBuilder, WarpCacheConfig, AdapterWarpExecutor, WarpExecutable, WarpExecution, WarpChainInfo, WarpActionInputType, AdapterWarpExplorer, WarpChain, AdapterWarpResults, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
1
+ import { WarpChain, AdapterFactory, WarpClientConfig, Adapter, WarpChainEnv, CombinedWarpBuilder, Warp, BaseWarpBuilder, WarpCacheConfig, AdapterWarpExecutor, WarpExecutable, WarpExecution, WarpChainInfo, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
2
2
  import { ethers } from 'ethers';
3
3
 
4
+ declare const ChainNameArbitrum: WarpChain;
4
5
  declare const getArbitrumAdapter: AdapterFactory;
5
6
 
7
+ declare const ChainNameBase: WarpChain;
6
8
  declare const getBaseAdapter: AdapterFactory;
7
9
 
8
10
  declare const getAllEvmAdapters: (config: WarpClientConfig, fallback?: Adapter) => Adapter[];
11
+ declare const getAllEvmChainNames: () => WarpChain[];
9
12
 
13
+ declare const ChainNameEthereum: WarpChain;
10
14
  declare const getEthereumAdapter: AdapterFactory;
11
15
 
12
16
  interface EvmChainConfig {
@@ -113,15 +117,15 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
113
117
  declare class WarpEvmExplorer implements AdapterWarpExplorer {
114
118
  private readonly chain;
115
119
  private readonly config;
116
- constructor(chain: WarpChain, config: WarpClientConfig);
120
+ constructor(chain: WarpChainInfo, config: WarpClientConfig);
117
121
  private getExplorers;
118
122
  private getPrimaryExplorer;
119
123
  private getExplorerUrlByName;
120
124
  getAccountUrl(address: string, explorer?: ExplorerName): string;
121
125
  getTransactionUrl(hash: string, explorer?: ExplorerName): string;
122
126
  getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
123
- getTokenUrl(tokenAddress: string, explorer?: ExplorerName): string;
124
- getContractUrl(contractAddress: string, explorer?: ExplorerName): string;
127
+ getAssetUrl(identifier: string, explorer?: ExplorerName): string;
128
+ getContractUrl(address: string, explorer?: ExplorerName): string;
125
129
  getAllExplorers(): readonly ExplorerName[];
126
130
  getExplorerByName(name: string): ExplorerName | undefined;
127
131
  getAccountUrls(address: string): Record<ExplorerName, string>;
@@ -150,4 +154,4 @@ declare class WarpEvmSerializer implements AdapterWarpSerializer {
150
154
  private parseNativeValue;
151
155
  }
152
156
 
153
- export { ArbitrumExplorers, BaseExplorers, EVM_CHAIN_CONFIGS, EthereumExplorers, type EvmChainConfig, EvmExplorers, type ExplorerName, ExplorerUrls, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer, getAllEvmAdapters, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getEvmApiUrl, getEvmChainConfig, getEvmExplorerUrl };
157
+ export { ArbitrumExplorers, BaseExplorers, ChainNameArbitrum, ChainNameBase, ChainNameEthereum, EVM_CHAIN_CONFIGS, EthereumExplorers, type EvmChainConfig, EvmExplorers, type ExplorerName, ExplorerUrls, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer, getAllEvmAdapters, getAllEvmChainNames, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getEvmApiUrl, getEvmChainConfig, getEvmExplorerUrl };
package/dist/index.js CHANGED
@@ -22,6 +22,9 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  ArbitrumExplorers: () => ArbitrumExplorers,
24
24
  BaseExplorers: () => BaseExplorers,
25
+ ChainNameArbitrum: () => ChainNameArbitrum,
26
+ ChainNameBase: () => ChainNameBase,
27
+ ChainNameEthereum: () => ChainNameEthereum,
25
28
  EVM_CHAIN_CONFIGS: () => EVM_CHAIN_CONFIGS,
26
29
  EthereumExplorers: () => EthereumExplorers,
27
30
  EvmExplorers: () => EvmExplorers,
@@ -33,6 +36,7 @@ __export(index_exports, {
33
36
  WarpEvmResults: () => WarpEvmResults,
34
37
  WarpEvmSerializer: () => WarpEvmSerializer,
35
38
  getAllEvmAdapters: () => getAllEvmAdapters,
39
+ getAllEvmChainNames: () => getAllEvmChainNames,
36
40
  getArbitrumAdapter: () => getArbitrumAdapter,
37
41
  getBaseAdapter: () => getBaseAdapter,
38
42
  getEthereumAdapter: () => getEthereumAdapter,
@@ -240,9 +244,242 @@ var WarpEvmBuilder = class {
240
244
  }
241
245
  };
242
246
 
247
+ // src/WarpEvmDataLoader.ts
248
+ var import_ethers2 = require("ethers");
249
+ var ERC20_ABI = [
250
+ "function balanceOf(address owner) view returns (uint256)",
251
+ "function decimals() view returns (uint8)",
252
+ "function name() view returns (string)",
253
+ "function symbol() view returns (string)",
254
+ "function totalSupply() view returns (uint256)"
255
+ ];
256
+ var KNOWN_TOKENS = {
257
+ ethereum: {
258
+ "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": {
259
+ name: "USD Coin",
260
+ symbol: "USDC",
261
+ decimals: 6,
262
+ logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
263
+ },
264
+ "0xdAC17F958D2ee523a2206206994597C13D831ec7": {
265
+ name: "Tether USD",
266
+ symbol: "USDT",
267
+ decimals: 6,
268
+ logoUrl: "https://assets.coingecko.com/coins/images/325/small/Tether.png"
269
+ },
270
+ "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599": {
271
+ name: "Wrapped Bitcoin",
272
+ symbol: "WBTC",
273
+ decimals: 8,
274
+ logoUrl: "https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png"
275
+ },
276
+ "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": {
277
+ name: "Wrapped Ether",
278
+ symbol: "WETH",
279
+ decimals: 18,
280
+ logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
281
+ },
282
+ "0x6B175474E89094C44Da98b954EedeAC495271d0F": {
283
+ name: "Dai Stablecoin",
284
+ symbol: "DAI",
285
+ decimals: 18,
286
+ logoUrl: "https://assets.coingecko.com/coins/images/9956/small/4943.png"
287
+ }
288
+ },
289
+ arbitrum: {
290
+ "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8": {
291
+ name: "USD Coin",
292
+ symbol: "USDC",
293
+ decimals: 6,
294
+ logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
295
+ },
296
+ "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9": {
297
+ name: "Tether USD",
298
+ symbol: "USDT",
299
+ decimals: 6,
300
+ logoUrl: "https://assets.coingecko.com/coins/images/325/small/Tether.png"
301
+ },
302
+ "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1": {
303
+ name: "Wrapped Ether",
304
+ symbol: "WETH",
305
+ decimals: 18,
306
+ logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
307
+ }
308
+ },
309
+ base: {
310
+ "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913": {
311
+ name: "USD Coin",
312
+ symbol: "USDC",
313
+ decimals: 6,
314
+ logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
315
+ },
316
+ "0x4200000000000000000000000000000000000006": {
317
+ name: "Wrapped Ether",
318
+ symbol: "WETH",
319
+ decimals: 18,
320
+ logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
321
+ }
322
+ }
323
+ };
324
+ var WarpEvmDataLoader = class {
325
+ constructor(config, chain) {
326
+ this.config = config;
327
+ this.chain = chain;
328
+ this.provider = new import_ethers2.ethers.JsonRpcProvider(getEvmApiUrl(this.config.env, this.chain.name));
329
+ this.chainConfig = getEvmChainConfig(this.chain.name, this.config.env);
330
+ }
331
+ async getAccount(address) {
332
+ try {
333
+ const balance = await this.provider.getBalance(address);
334
+ return {
335
+ address,
336
+ balance
337
+ };
338
+ } catch (error) {
339
+ throw new Error(`Failed to get account balance for ${address}: ${error}`);
340
+ }
341
+ }
342
+ async getAccountAssets(address) {
343
+ try {
344
+ const assets = [];
345
+ const tokenBalances = await this.getERC20TokenBalances(address);
346
+ for (const tokenBalance of tokenBalances) {
347
+ if (tokenBalance.balance > 0n) {
348
+ assets.push({
349
+ identifier: tokenBalance.tokenAddress,
350
+ name: tokenBalance.metadata.name,
351
+ amount: tokenBalance.balance,
352
+ decimals: tokenBalance.metadata.decimals,
353
+ logoUrl: tokenBalance.metadata.logoUrl || ""
354
+ });
355
+ }
356
+ }
357
+ return assets;
358
+ } catch (error) {
359
+ throw new Error(`Failed to get account assets for ${address}: ${error}`);
360
+ }
361
+ }
362
+ async getERC20TokenBalances(address) {
363
+ const tokenBalances = [];
364
+ const knownTokens = KNOWN_TOKENS[this.chain.name] || {};
365
+ for (const [tokenAddress, metadata] of Object.entries(knownTokens)) {
366
+ try {
367
+ const balance = await this.getTokenBalance(address, tokenAddress);
368
+ if (balance > 0n) {
369
+ tokenBalances.push({
370
+ tokenAddress,
371
+ balance,
372
+ metadata
373
+ });
374
+ }
375
+ } catch (error) {
376
+ console.warn(`Failed to get balance for token ${tokenAddress}: ${error}`);
377
+ }
378
+ }
379
+ const additionalTokens = await this.detectTokensFromEvents(address);
380
+ for (const tokenAddress of additionalTokens) {
381
+ if (!knownTokens[tokenAddress]) {
382
+ try {
383
+ const metadata = await this.getTokenMetadata(tokenAddress);
384
+ const balance = await this.getTokenBalance(address, tokenAddress);
385
+ if (balance > 0n) {
386
+ tokenBalances.push({
387
+ tokenAddress,
388
+ balance,
389
+ metadata
390
+ });
391
+ }
392
+ } catch (error) {
393
+ console.warn(`Failed to get metadata/balance for detected token ${tokenAddress}: ${error}`);
394
+ }
395
+ }
396
+ }
397
+ return tokenBalances;
398
+ }
399
+ async getTokenBalance(address, tokenAddress) {
400
+ try {
401
+ const contract = new import_ethers2.ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
402
+ const balance = await contract.balanceOf(address);
403
+ return balance;
404
+ } catch (error) {
405
+ throw new Error(`Failed to get token balance: ${error}`);
406
+ }
407
+ }
408
+ async getTokenMetadata(tokenAddress) {
409
+ try {
410
+ const contract = new import_ethers2.ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
411
+ const [name, symbol, decimals] = await Promise.all([contract.name(), contract.symbol(), contract.decimals()]);
412
+ return {
413
+ name: name || "Unknown Token",
414
+ symbol: symbol || "UNKNOWN",
415
+ decimals: decimals || 18
416
+ };
417
+ } catch (error) {
418
+ throw new Error(`Failed to get token metadata: ${error}`);
419
+ }
420
+ }
421
+ async detectTokensFromEvents(address) {
422
+ try {
423
+ const currentBlock = await this.provider.getBlockNumber();
424
+ const fromBlock = Math.max(0, currentBlock - 1e4);
425
+ const filter = {
426
+ fromBlock,
427
+ toBlock: currentBlock,
428
+ topics: [
429
+ import_ethers2.ethers.id("Transfer(address,address,uint256)"),
430
+ null,
431
+ // from address (any)
432
+ import_ethers2.ethers.zeroPadValue(address, 32)
433
+ // to address (our target)
434
+ ]
435
+ };
436
+ const logs = await this.provider.getLogs(filter);
437
+ const tokenAddresses = /* @__PURE__ */ new Set();
438
+ for (const log of logs) {
439
+ tokenAddresses.add(log.address);
440
+ }
441
+ return Array.from(tokenAddresses);
442
+ } catch (error) {
443
+ console.warn(`Failed to detect tokens from events: ${error}`);
444
+ return [];
445
+ }
446
+ }
447
+ // Additional utility methods for enhanced token support
448
+ async getTokenInfo(tokenAddress) {
449
+ try {
450
+ return await this.getTokenMetadata(tokenAddress);
451
+ } catch (error) {
452
+ console.warn(`Failed to get token info for ${tokenAddress}: ${error}`);
453
+ return null;
454
+ }
455
+ }
456
+ async getTokenBalanceForAddress(address, tokenAddress) {
457
+ try {
458
+ return await this.getTokenBalance(address, tokenAddress);
459
+ } catch (error) {
460
+ throw new Error(`Failed to get token balance for ${tokenAddress}: ${error}`);
461
+ }
462
+ }
463
+ async getMultipleTokenBalances(address, tokenAddresses) {
464
+ const balances = /* @__PURE__ */ new Map();
465
+ await Promise.all(
466
+ tokenAddresses.map(async (tokenAddress) => {
467
+ try {
468
+ const balance = await this.getTokenBalance(address, tokenAddress);
469
+ balances.set(tokenAddress, balance);
470
+ } catch (error) {
471
+ console.warn(`Failed to get balance for token ${tokenAddress}: ${error}`);
472
+ balances.set(tokenAddress, 0n);
473
+ }
474
+ })
475
+ );
476
+ return balances;
477
+ }
478
+ };
479
+
243
480
  // src/WarpEvmExecutor.ts
244
481
  var import_warps3 = require("@vleap/warps");
245
- var import_ethers3 = require("ethers");
482
+ var import_ethers4 = require("ethers");
246
483
 
247
484
  // src/constants.ts
248
485
  var WarpEvmConstants = {
@@ -322,7 +559,7 @@ var import_warps2 = require("@vleap/warps");
322
559
 
323
560
  // src/WarpEvmSerializer.ts
324
561
  var import_warps = require("@vleap/warps");
325
- var import_ethers2 = require("ethers");
562
+ var import_ethers3 = require("ethers");
326
563
  var SplitParamsRegex = new RegExp(`${import_warps.WarpConstants.ArgParamsSeparator}(.*)`);
327
564
  var WarpEvmSerializer = class {
328
565
  constructor() {
@@ -330,10 +567,10 @@ var WarpEvmSerializer = class {
330
567
  }
331
568
  typedToString(value) {
332
569
  if (typeof value === "string") {
333
- if (import_ethers2.ethers.isAddress(value)) {
570
+ if (import_ethers3.ethers.isAddress(value)) {
334
571
  return `address:${value}`;
335
572
  }
336
- if (import_ethers2.ethers.isHexString(value) && !import_ethers2.ethers.isAddress(value)) {
573
+ if (import_ethers3.ethers.isHexString(value) && !import_ethers3.ethers.isAddress(value)) {
337
574
  return `hex:${value}`;
338
575
  }
339
576
  return `string:${value}`;
@@ -541,7 +778,7 @@ var WarpEvmExecutor = class {
541
778
  constructor(config) {
542
779
  this.config = config;
543
780
  this.serializer = new WarpEvmSerializer();
544
- this.provider = new import_ethers3.ethers.JsonRpcProvider(getEvmApiUrl(config.env));
781
+ this.provider = new import_ethers4.ethers.JsonRpcProvider(getEvmApiUrl(config.env));
545
782
  this.results = new WarpEvmResults(config);
546
783
  }
547
784
  async createTransaction(executable) {
@@ -560,9 +797,9 @@ var WarpEvmExecutor = class {
560
797
  return tx;
561
798
  }
562
799
  async createTransferTransaction(executable) {
563
- const userWallet = this.config.user?.wallets?.[executable.chain];
800
+ const userWallet = this.config.user?.wallets?.[executable.chain.name];
564
801
  if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
565
- if (!import_ethers3.ethers.isAddress(executable.destination)) {
802
+ if (!import_ethers4.ethers.isAddress(executable.destination)) {
566
803
  throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
567
804
  }
568
805
  if (executable.value < 0) {
@@ -576,20 +813,20 @@ var WarpEvmExecutor = class {
576
813
  return this.estimateGasAndSetDefaults(tx, userWallet);
577
814
  }
578
815
  async createContractCallTransaction(executable) {
579
- const userWallet = this.config.user?.wallets?.[executable.chain];
816
+ const userWallet = this.config.user?.wallets?.[executable.chain.name];
580
817
  if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
581
818
  const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
582
819
  if (!action || !("func" in action) || !action.func) {
583
820
  throw new Error("WarpEvmExecutor: Contract action must have a function name");
584
821
  }
585
- if (!import_ethers3.ethers.isAddress(executable.destination)) {
822
+ if (!import_ethers4.ethers.isAddress(executable.destination)) {
586
823
  throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
587
824
  }
588
825
  if (executable.value < 0) {
589
826
  throw new Error(`WarpEvmExecutor: Contract call value cannot be negative: ${executable.value}`);
590
827
  }
591
828
  try {
592
- const iface = new import_ethers3.ethers.Interface([`function ${action.func}`]);
829
+ const iface = new import_ethers4.ethers.Interface([`function ${action.func}`]);
593
830
  const encodedData = iface.encodeFunctionData(action.func, executable.args);
594
831
  const tx = {
595
832
  to: executable.destination,
@@ -609,11 +846,11 @@ var WarpEvmExecutor = class {
609
846
  if (!action.func) {
610
847
  throw new Error("WarpEvmExecutor: Query action must have a function name");
611
848
  }
612
- if (!import_ethers3.ethers.isAddress(executable.destination)) {
849
+ if (!import_ethers4.ethers.isAddress(executable.destination)) {
613
850
  throw new Error(`WarpEvmExecutor: Invalid contract address for query: ${executable.destination}`);
614
851
  }
615
852
  try {
616
- const iface = new import_ethers3.ethers.Interface([`function ${action.func}`]);
853
+ const iface = new import_ethers4.ethers.Interface([`function ${action.func}`]);
617
854
  const encodedData = iface.encodeFunctionData(action.func, executable.args);
618
855
  const result = await this.provider.call({
619
856
  to: executable.destination,
@@ -632,7 +869,7 @@ var WarpEvmExecutor = class {
632
869
  success: isSuccess,
633
870
  warp: executable.warp,
634
871
  action: executable.action,
635
- user: this.config.user?.wallets?.[executable.chain] || null,
872
+ user: this.config.user?.wallets?.[executable.chain.name] || null,
636
873
  txHash: null,
637
874
  next,
638
875
  values,
@@ -644,7 +881,7 @@ var WarpEvmExecutor = class {
644
881
  success: false,
645
882
  warp: executable.warp,
646
883
  action: executable.action,
647
- user: this.config.user?.wallets?.[executable.chain] || null,
884
+ user: this.config.user?.wallets?.[executable.chain.name] || null,
648
885
  txHash: null,
649
886
  next: null,
650
887
  values: [],
@@ -657,12 +894,12 @@ var WarpEvmExecutor = class {
657
894
  const typedValue = this.serializer.stringToTyped(value);
658
895
  switch (type) {
659
896
  case "address":
660
- if (!import_ethers3.ethers.isAddress(typedValue)) {
897
+ if (!import_ethers4.ethers.isAddress(typedValue)) {
661
898
  throw new Error(`Invalid address format: ${typedValue}`);
662
899
  }
663
- return import_ethers3.ethers.getAddress(typedValue);
900
+ return import_ethers4.ethers.getAddress(typedValue);
664
901
  case "hex":
665
- if (!import_ethers3.ethers.isHexString(typedValue)) {
902
+ if (!import_ethers4.ethers.isHexString(typedValue)) {
666
903
  throw new Error(`Invalid hex format: ${typedValue}`);
667
904
  }
668
905
  return typedValue;
@@ -710,7 +947,7 @@ var WarpEvmExecutor = class {
710
947
  return {
711
948
  ...tx,
712
949
  gasLimit: gasEstimate,
713
- gasPrice: import_ethers3.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
950
+ gasPrice: import_ethers4.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
714
951
  };
715
952
  }
716
953
  } catch (error) {
@@ -723,7 +960,7 @@ var WarpEvmExecutor = class {
723
960
  return {
724
961
  ...tx,
725
962
  gasLimit: defaultGasLimit,
726
- gasPrice: import_ethers3.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
963
+ gasPrice: import_ethers4.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
727
964
  };
728
965
  }
729
966
  }
@@ -739,7 +976,7 @@ var WarpEvmExplorer = class {
739
976
  this.config = config;
740
977
  }
741
978
  getExplorers() {
742
- const chainExplorers = EvmExplorers[this.chain];
979
+ const chainExplorers = EvmExplorers[this.chain.name];
743
980
  if (!chainExplorers) {
744
981
  return ["Default"];
745
982
  }
@@ -754,7 +991,7 @@ var WarpEvmExplorer = class {
754
991
  return explorers[0];
755
992
  }
756
993
  getExplorerUrlByName(explorer) {
757
- const userPreference = this.config.preferences?.explorers?.[this.chain];
994
+ const userPreference = this.config.preferences?.explorers?.[this.chain.name];
758
995
  if (userPreference && !explorer) {
759
996
  const url2 = ExplorerUrls[userPreference];
760
997
  if (url2) return url2;
@@ -779,13 +1016,13 @@ var WarpEvmExplorer = class {
779
1016
  const baseUrl = this.getExplorerUrlByName(explorer);
780
1017
  return `${baseUrl}/block/${blockNumber}`;
781
1018
  }
782
- getTokenUrl(tokenAddress, explorer) {
1019
+ getAssetUrl(identifier, explorer) {
783
1020
  const baseUrl = this.getExplorerUrlByName(explorer);
784
- return `${baseUrl}/token/${tokenAddress}`;
1021
+ return `${baseUrl}/token/${identifier}`;
785
1022
  }
786
- getContractUrl(contractAddress, explorer) {
1023
+ getContractUrl(address, explorer) {
787
1024
  const baseUrl = this.getExplorerUrlByName(explorer);
788
- return `${baseUrl}/address/${contractAddress}`;
1025
+ return `${baseUrl}/address/${address}`;
789
1026
  }
790
1027
  getAllExplorers() {
791
1028
  return this.getExplorers();
@@ -833,16 +1070,17 @@ var createEvmAdapter = (chainName, chainPrefix, chainInfos) => {
833
1070
  registry: fallback.registry,
834
1071
  explorer: new WarpEvmExplorer(chainInfos[config.env], config),
835
1072
  abiBuilder: () => fallback.abiBuilder(),
836
- brandBuilder: () => fallback.brandBuilder()
1073
+ brandBuilder: () => fallback.brandBuilder(),
1074
+ dataLoader: new WarpEvmDataLoader(config, chainInfos[config.env])
837
1075
  };
838
1076
  };
839
1077
  };
840
1078
 
841
1079
  // src/chains/arbitrum.ts
842
- var ChainName = "arbitrum";
843
- var getArbitrumAdapter = createEvmAdapter(ChainName, "arb", {
1080
+ var ChainNameArbitrum = "arbitrum";
1081
+ var getArbitrumAdapter = createEvmAdapter(ChainNameArbitrum, "arb", {
844
1082
  devnet: {
845
- name: ChainName,
1083
+ name: ChainNameArbitrum,
846
1084
  displayName: "Arbitrum Devnet",
847
1085
  chainId: "421614",
848
1086
  blockTime: 1e3,
@@ -851,7 +1089,7 @@ var getArbitrumAdapter = createEvmAdapter(ChainName, "arb", {
851
1089
  nativeToken: "ETH"
852
1090
  },
853
1091
  testnet: {
854
- name: ChainName,
1092
+ name: ChainNameArbitrum,
855
1093
  displayName: "Arbitrum Testnet",
856
1094
  chainId: "421613",
857
1095
  blockTime: 1e3,
@@ -860,7 +1098,7 @@ var getArbitrumAdapter = createEvmAdapter(ChainName, "arb", {
860
1098
  nativeToken: "ETH"
861
1099
  },
862
1100
  mainnet: {
863
- name: ChainName,
1101
+ name: ChainNameArbitrum,
864
1102
  displayName: "Arbitrum",
865
1103
  chainId: "42161",
866
1104
  blockTime: 1e3,
@@ -871,10 +1109,10 @@ var getArbitrumAdapter = createEvmAdapter(ChainName, "arb", {
871
1109
  });
872
1110
 
873
1111
  // src/chains/base.ts
874
- var ChainName2 = "base";
875
- var getBaseAdapter = createEvmAdapter(ChainName2, "base", {
1112
+ var ChainNameBase = "base";
1113
+ var getBaseAdapter = createEvmAdapter(ChainNameBase, "base", {
876
1114
  mainnet: {
877
- name: ChainName2,
1115
+ name: ChainNameBase,
878
1116
  displayName: "Base",
879
1117
  chainId: "8453",
880
1118
  blockTime: 2e3,
@@ -883,8 +1121,8 @@ var getBaseAdapter = createEvmAdapter(ChainName2, "base", {
883
1121
  nativeToken: "ETH"
884
1122
  },
885
1123
  testnet: {
886
- name: ChainName2,
887
- displayName: "Base",
1124
+ name: ChainNameBase,
1125
+ displayName: "Base Testnet",
888
1126
  chainId: "84531",
889
1127
  blockTime: 2e3,
890
1128
  addressHrp: "0x",
@@ -892,8 +1130,8 @@ var getBaseAdapter = createEvmAdapter(ChainName2, "base", {
892
1130
  nativeToken: "ETH"
893
1131
  },
894
1132
  devnet: {
895
- name: ChainName2,
896
- displayName: "Base",
1133
+ name: ChainNameBase,
1134
+ displayName: "Base Devnet",
897
1135
  chainId: "84532",
898
1136
  blockTime: 2e3,
899
1137
  addressHrp: "0x",
@@ -903,10 +1141,10 @@ var getBaseAdapter = createEvmAdapter(ChainName2, "base", {
903
1141
  });
904
1142
 
905
1143
  // src/chains/ethereum.ts
906
- var ChainName3 = "ethereum";
907
- var getEthereumAdapter = createEvmAdapter(ChainName3, "eth", {
1144
+ var ChainNameEthereum = "ethereum";
1145
+ var getEthereumAdapter = createEvmAdapter(ChainNameEthereum, "eth", {
908
1146
  devnet: {
909
- name: ChainName3,
1147
+ name: ChainNameEthereum,
910
1148
  displayName: "Ethereum Devnet",
911
1149
  chainId: "11155111",
912
1150
  blockTime: 12e3,
@@ -915,7 +1153,7 @@ var getEthereumAdapter = createEvmAdapter(ChainName3, "eth", {
915
1153
  nativeToken: "ETH"
916
1154
  },
917
1155
  testnet: {
918
- name: ChainName3,
1156
+ name: ChainNameEthereum,
919
1157
  displayName: "Ethereum Testnet",
920
1158
  chainId: "5",
921
1159
  blockTime: 12e3,
@@ -924,7 +1162,7 @@ var getEthereumAdapter = createEvmAdapter(ChainName3, "eth", {
924
1162
  nativeToken: "ETH"
925
1163
  },
926
1164
  mainnet: {
927
- name: ChainName3,
1165
+ name: ChainNameEthereum,
928
1166
  displayName: "Ethereum Mainnet",
929
1167
  chainId: "1",
930
1168
  blockTime: 12e3,
@@ -940,10 +1178,14 @@ var getAllEvmAdapters = (config, fallback) => [
940
1178
  getArbitrumAdapter(config, fallback),
941
1179
  getBaseAdapter(config, fallback)
942
1180
  ];
1181
+ var getAllEvmChainNames = () => [ChainNameArbitrum, ChainNameBase, ChainNameEthereum];
943
1182
  // Annotate the CommonJS export names for ESM import in node:
944
1183
  0 && (module.exports = {
945
1184
  ArbitrumExplorers,
946
1185
  BaseExplorers,
1186
+ ChainNameArbitrum,
1187
+ ChainNameBase,
1188
+ ChainNameEthereum,
947
1189
  EVM_CHAIN_CONFIGS,
948
1190
  EthereumExplorers,
949
1191
  EvmExplorers,
@@ -955,6 +1197,7 @@ var getAllEvmAdapters = (config, fallback) => [
955
1197
  WarpEvmResults,
956
1198
  WarpEvmSerializer,
957
1199
  getAllEvmAdapters,
1200
+ getAllEvmChainNames,
958
1201
  getArbitrumAdapter,
959
1202
  getBaseAdapter,
960
1203
  getEthereumAdapter,