@vleap/warps-adapter-evm 0.2.0-alpha.3 → 0.2.0-alpha.4

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,31 +1,7 @@
1
- import { WarpChainEnv, AdapterFactory, WarpClientConfig, Adapter, CombinedWarpBuilder, Warp, BaseWarpBuilder, WarpCacheConfig, AdapterWarpExecutor, WarpExecutable, WarpExecution, WarpChainInfo, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
1
+ import { WarpExplorerName, WarpChainEnv, AdapterFactory, WarpClientConfig, Adapter, 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
- interface EvmChainConfig {
5
- apiUrl: string;
6
- explorerUrl: string;
7
- chainId: string;
8
- registryAddress: string;
9
- nativeToken: string;
10
- blockTime?: number;
11
- }
12
- declare const EVM_CHAIN_CONFIGS: Record<string, Record<WarpChainEnv, EvmChainConfig>>;
13
- declare const getEvmChainConfig: (chain: string | undefined, env: WarpChainEnv) => EvmChainConfig;
14
- declare const getEvmApiUrl: (env: WarpChainEnv, chain?: string) => string;
15
- declare const getEvmExplorerUrl: (env: WarpChainEnv, chain?: string) => string;
16
- declare const getEvmChainId: (env: WarpChainEnv, chain?: string) => string;
17
- declare const getEvmRegistryAddress: (env: WarpChainEnv, chain?: string) => string;
18
- declare const getEvmNativeToken: (env: WarpChainEnv, chain?: string) => string;
19
- declare const getEvmBlockTime: (env: WarpChainEnv, chain?: string) => number;
20
- declare const getSupportedEvmChains: () => string[];
21
- declare const getSupportedEnvironments: (chain: string) => WarpChainEnv[];
22
-
23
4
  declare const WarpEvmConstants: {
24
- Ether: {
25
- Identifier: string;
26
- DisplayName: string;
27
- Decimals: number;
28
- };
29
5
  GasLimit: {
30
6
  Default: number;
31
7
  ContractCall: number;
@@ -36,39 +12,70 @@ declare const WarpEvmConstants: {
36
12
  };
37
13
  GasPrice: {
38
14
  Default: string;
39
- Low: string;
40
- Medium: string;
41
- High: string;
42
- };
43
- Networks: {
44
- Ethereum: {
45
- ChainId: string;
46
- Name: string;
47
- BlockTime: number;
48
- };
49
- Arbitrum: {
50
- ChainId: string;
51
- Name: string;
52
- BlockTime: number;
53
- };
54
- Base: {
55
- ChainId: string;
56
- Name: string;
57
- BlockTime: number;
58
- };
59
15
  };
60
16
  Validation: {
61
- AddressLength: number;
62
- HexPrefix: string;
63
17
  MinGasLimit: number;
64
18
  MaxGasLimit: number;
65
19
  };
66
- Timeouts: {
67
- DefaultRpcTimeout: number;
68
- GasEstimationTimeout: number;
69
- QueryTimeout: number;
20
+ };
21
+ declare enum EthereumExplorers {
22
+ Etherscan = "etherscan",
23
+ EtherscanSepolia = "etherscan_sepolia",
24
+ Ethplorer = "ethplorer",
25
+ Blockscout = "blockscout",
26
+ BlockscoutSepolia = "blockscout_sepolia"
27
+ }
28
+ declare enum ArbitrumExplorers {
29
+ Arbiscan = "arbiscan",
30
+ ArbiscanSepolia = "arbiscan_sepolia",
31
+ BlockscoutArbitrum = "blockscout_arbitrum",
32
+ BlockscoutArbitrumSepolia = "blockscout_arbitrum_sepolia"
33
+ }
34
+ declare enum BaseExplorers {
35
+ Basescan = "basescan",
36
+ BasescanSepolia = "basescan_sepolia",
37
+ BlockscoutBase = "blockscout_base",
38
+ BlockscoutBaseSepolia = "blockscout_base_sepolia"
39
+ }
40
+ declare enum LocalExplorers {
41
+ LocalBlockscout = "local_blockscout"
42
+ }
43
+ type ExplorerName = EthereumExplorers | ArbitrumExplorers | BaseExplorers | (LocalExplorers & WarpExplorerName);
44
+ declare const EvmExplorers: {
45
+ readonly ethereum: {
46
+ readonly mainnet: readonly [EthereumExplorers.Etherscan, EthereumExplorers.Ethplorer, EthereumExplorers.Blockscout];
47
+ readonly testnet: readonly [EthereumExplorers.EtherscanSepolia, EthereumExplorers.BlockscoutSepolia];
48
+ readonly devnet: readonly [LocalExplorers];
49
+ };
50
+ readonly arbitrum: {
51
+ readonly mainnet: readonly [ArbitrumExplorers.Arbiscan, ArbitrumExplorers.BlockscoutArbitrum];
52
+ readonly testnet: readonly [ArbitrumExplorers.ArbiscanSepolia, ArbitrumExplorers.BlockscoutArbitrumSepolia];
53
+ readonly devnet: readonly [LocalExplorers];
54
+ };
55
+ readonly base: {
56
+ readonly mainnet: readonly [BaseExplorers.Basescan, BaseExplorers.BlockscoutBase];
57
+ readonly testnet: readonly [BaseExplorers.BasescanSepolia, BaseExplorers.BlockscoutBaseSepolia];
58
+ readonly devnet: readonly [LocalExplorers];
70
59
  };
71
60
  };
61
+ declare const ExplorerUrls: Record<ExplorerName, string>;
62
+
63
+ interface EvmChainConfig {
64
+ apiUrl: string;
65
+ explorerUrl: string;
66
+ chainId: string;
67
+ registryAddress: string;
68
+ nativeToken: string;
69
+ blockTime?: number;
70
+ }
71
+ declare const EVM_CHAIN_CONFIGS: Record<string, Record<WarpChainEnv, EvmChainConfig>>;
72
+ declare const getEvmChainConfig: (chain: string | undefined, env: WarpChainEnv) => EvmChainConfig;
73
+ declare const getEvmApiUrl: (env: WarpChainEnv, chain?: string) => string;
74
+ declare const getEvmExplorerUrl: (env: WarpChainEnv, chain?: string) => string;
75
+ declare const getEvmExplorers: (chain: string | undefined, env: WarpChainEnv) => readonly ExplorerName[];
76
+ declare const getPrimaryEvmExplorer: (chain: string | undefined, env: WarpChainEnv) => ExplorerName;
77
+ declare const getEvmExplorerUrlByName: (explorerName: ExplorerName) => string;
78
+ declare const getEvmExplorerByName: (chain: string | undefined, env: WarpChainEnv, name: string) => ExplorerName | undefined;
72
79
 
73
80
  declare const getEthereumAdapter: AdapterFactory;
74
81
  declare const getArbitrumAdapter: AdapterFactory;
@@ -108,11 +115,19 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
108
115
  }
109
116
 
110
117
  declare class WarpEvmExplorer implements AdapterWarpExplorer {
111
- private readonly chainInfo;
112
- private readonly chainName;
113
- constructor(chainInfo: WarpChainInfo, chainName?: string);
114
- getAccountUrl(address: string): string;
115
- getTransactionUrl(hash: string): string;
118
+ private readonly chain;
119
+ private readonly config;
120
+ constructor(chain: WarpChainInfo, config: WarpClientConfig);
121
+ private getExplorerUrlByName;
122
+ getAccountUrl(address: string, explorer?: ExplorerName): string;
123
+ getTransactionUrl(hash: string, explorer?: ExplorerName): string;
124
+ getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
125
+ getTokenUrl(tokenAddress: string, explorer?: ExplorerName): string;
126
+ getContractUrl(contractAddress: string, explorer?: ExplorerName): string;
127
+ getAllExplorers(): readonly ExplorerName[];
128
+ getExplorerByName(name: string): ExplorerName | undefined;
129
+ getAccountUrls(address: string): Record<ExplorerName, string>;
130
+ getTransactionUrls(hash: string): Record<ExplorerName, string>;
116
131
  }
117
132
 
118
133
  declare class WarpEvmResults implements AdapterWarpResults {
@@ -137,4 +152,4 @@ declare class WarpEvmSerializer implements AdapterWarpSerializer {
137
152
  private parseNativeValue;
138
153
  }
139
154
 
140
- export { EVM_CHAIN_CONFIGS, type EvmChainConfig, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer, getAllEvmAdapters, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getEvmApiUrl, getEvmBlockTime, getEvmChainConfig, getEvmChainId, getEvmExplorerUrl, getEvmNativeToken, getEvmRegistryAddress, getSupportedEnvironments, getSupportedEvmChains };
155
+ export { ArbitrumExplorers, BaseExplorers, EVM_CHAIN_CONFIGS, EthereumExplorers, type EvmChainConfig, EvmExplorers, type ExplorerName, ExplorerUrls, LocalExplorers, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer, getAllEvmAdapters, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getEvmApiUrl, getEvmChainConfig, getEvmExplorerByName, getEvmExplorerUrl, getEvmExplorerUrlByName, getEvmExplorers, getPrimaryEvmExplorer };
package/dist/index.d.ts CHANGED
@@ -1,31 +1,7 @@
1
- import { WarpChainEnv, AdapterFactory, WarpClientConfig, Adapter, CombinedWarpBuilder, Warp, BaseWarpBuilder, WarpCacheConfig, AdapterWarpExecutor, WarpExecutable, WarpExecution, WarpChainInfo, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
1
+ import { WarpExplorerName, WarpChainEnv, AdapterFactory, WarpClientConfig, Adapter, 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
- interface EvmChainConfig {
5
- apiUrl: string;
6
- explorerUrl: string;
7
- chainId: string;
8
- registryAddress: string;
9
- nativeToken: string;
10
- blockTime?: number;
11
- }
12
- declare const EVM_CHAIN_CONFIGS: Record<string, Record<WarpChainEnv, EvmChainConfig>>;
13
- declare const getEvmChainConfig: (chain: string | undefined, env: WarpChainEnv) => EvmChainConfig;
14
- declare const getEvmApiUrl: (env: WarpChainEnv, chain?: string) => string;
15
- declare const getEvmExplorerUrl: (env: WarpChainEnv, chain?: string) => string;
16
- declare const getEvmChainId: (env: WarpChainEnv, chain?: string) => string;
17
- declare const getEvmRegistryAddress: (env: WarpChainEnv, chain?: string) => string;
18
- declare const getEvmNativeToken: (env: WarpChainEnv, chain?: string) => string;
19
- declare const getEvmBlockTime: (env: WarpChainEnv, chain?: string) => number;
20
- declare const getSupportedEvmChains: () => string[];
21
- declare const getSupportedEnvironments: (chain: string) => WarpChainEnv[];
22
-
23
4
  declare const WarpEvmConstants: {
24
- Ether: {
25
- Identifier: string;
26
- DisplayName: string;
27
- Decimals: number;
28
- };
29
5
  GasLimit: {
30
6
  Default: number;
31
7
  ContractCall: number;
@@ -36,39 +12,70 @@ declare const WarpEvmConstants: {
36
12
  };
37
13
  GasPrice: {
38
14
  Default: string;
39
- Low: string;
40
- Medium: string;
41
- High: string;
42
- };
43
- Networks: {
44
- Ethereum: {
45
- ChainId: string;
46
- Name: string;
47
- BlockTime: number;
48
- };
49
- Arbitrum: {
50
- ChainId: string;
51
- Name: string;
52
- BlockTime: number;
53
- };
54
- Base: {
55
- ChainId: string;
56
- Name: string;
57
- BlockTime: number;
58
- };
59
15
  };
60
16
  Validation: {
61
- AddressLength: number;
62
- HexPrefix: string;
63
17
  MinGasLimit: number;
64
18
  MaxGasLimit: number;
65
19
  };
66
- Timeouts: {
67
- DefaultRpcTimeout: number;
68
- GasEstimationTimeout: number;
69
- QueryTimeout: number;
20
+ };
21
+ declare enum EthereumExplorers {
22
+ Etherscan = "etherscan",
23
+ EtherscanSepolia = "etherscan_sepolia",
24
+ Ethplorer = "ethplorer",
25
+ Blockscout = "blockscout",
26
+ BlockscoutSepolia = "blockscout_sepolia"
27
+ }
28
+ declare enum ArbitrumExplorers {
29
+ Arbiscan = "arbiscan",
30
+ ArbiscanSepolia = "arbiscan_sepolia",
31
+ BlockscoutArbitrum = "blockscout_arbitrum",
32
+ BlockscoutArbitrumSepolia = "blockscout_arbitrum_sepolia"
33
+ }
34
+ declare enum BaseExplorers {
35
+ Basescan = "basescan",
36
+ BasescanSepolia = "basescan_sepolia",
37
+ BlockscoutBase = "blockscout_base",
38
+ BlockscoutBaseSepolia = "blockscout_base_sepolia"
39
+ }
40
+ declare enum LocalExplorers {
41
+ LocalBlockscout = "local_blockscout"
42
+ }
43
+ type ExplorerName = EthereumExplorers | ArbitrumExplorers | BaseExplorers | (LocalExplorers & WarpExplorerName);
44
+ declare const EvmExplorers: {
45
+ readonly ethereum: {
46
+ readonly mainnet: readonly [EthereumExplorers.Etherscan, EthereumExplorers.Ethplorer, EthereumExplorers.Blockscout];
47
+ readonly testnet: readonly [EthereumExplorers.EtherscanSepolia, EthereumExplorers.BlockscoutSepolia];
48
+ readonly devnet: readonly [LocalExplorers];
49
+ };
50
+ readonly arbitrum: {
51
+ readonly mainnet: readonly [ArbitrumExplorers.Arbiscan, ArbitrumExplorers.BlockscoutArbitrum];
52
+ readonly testnet: readonly [ArbitrumExplorers.ArbiscanSepolia, ArbitrumExplorers.BlockscoutArbitrumSepolia];
53
+ readonly devnet: readonly [LocalExplorers];
54
+ };
55
+ readonly base: {
56
+ readonly mainnet: readonly [BaseExplorers.Basescan, BaseExplorers.BlockscoutBase];
57
+ readonly testnet: readonly [BaseExplorers.BasescanSepolia, BaseExplorers.BlockscoutBaseSepolia];
58
+ readonly devnet: readonly [LocalExplorers];
70
59
  };
71
60
  };
61
+ declare const ExplorerUrls: Record<ExplorerName, string>;
62
+
63
+ interface EvmChainConfig {
64
+ apiUrl: string;
65
+ explorerUrl: string;
66
+ chainId: string;
67
+ registryAddress: string;
68
+ nativeToken: string;
69
+ blockTime?: number;
70
+ }
71
+ declare const EVM_CHAIN_CONFIGS: Record<string, Record<WarpChainEnv, EvmChainConfig>>;
72
+ declare const getEvmChainConfig: (chain: string | undefined, env: WarpChainEnv) => EvmChainConfig;
73
+ declare const getEvmApiUrl: (env: WarpChainEnv, chain?: string) => string;
74
+ declare const getEvmExplorerUrl: (env: WarpChainEnv, chain?: string) => string;
75
+ declare const getEvmExplorers: (chain: string | undefined, env: WarpChainEnv) => readonly ExplorerName[];
76
+ declare const getPrimaryEvmExplorer: (chain: string | undefined, env: WarpChainEnv) => ExplorerName;
77
+ declare const getEvmExplorerUrlByName: (explorerName: ExplorerName) => string;
78
+ declare const getEvmExplorerByName: (chain: string | undefined, env: WarpChainEnv, name: string) => ExplorerName | undefined;
72
79
 
73
80
  declare const getEthereumAdapter: AdapterFactory;
74
81
  declare const getArbitrumAdapter: AdapterFactory;
@@ -108,11 +115,19 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
108
115
  }
109
116
 
110
117
  declare class WarpEvmExplorer implements AdapterWarpExplorer {
111
- private readonly chainInfo;
112
- private readonly chainName;
113
- constructor(chainInfo: WarpChainInfo, chainName?: string);
114
- getAccountUrl(address: string): string;
115
- getTransactionUrl(hash: string): string;
118
+ private readonly chain;
119
+ private readonly config;
120
+ constructor(chain: WarpChainInfo, config: WarpClientConfig);
121
+ private getExplorerUrlByName;
122
+ getAccountUrl(address: string, explorer?: ExplorerName): string;
123
+ getTransactionUrl(hash: string, explorer?: ExplorerName): string;
124
+ getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
125
+ getTokenUrl(tokenAddress: string, explorer?: ExplorerName): string;
126
+ getContractUrl(contractAddress: string, explorer?: ExplorerName): string;
127
+ getAllExplorers(): readonly ExplorerName[];
128
+ getExplorerByName(name: string): ExplorerName | undefined;
129
+ getAccountUrls(address: string): Record<ExplorerName, string>;
130
+ getTransactionUrls(hash: string): Record<ExplorerName, string>;
116
131
  }
117
132
 
118
133
  declare class WarpEvmResults implements AdapterWarpResults {
@@ -137,4 +152,4 @@ declare class WarpEvmSerializer implements AdapterWarpSerializer {
137
152
  private parseNativeValue;
138
153
  }
139
154
 
140
- export { EVM_CHAIN_CONFIGS, type EvmChainConfig, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer, getAllEvmAdapters, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getEvmApiUrl, getEvmBlockTime, getEvmChainConfig, getEvmChainId, getEvmExplorerUrl, getEvmNativeToken, getEvmRegistryAddress, getSupportedEnvironments, getSupportedEvmChains };
155
+ export { ArbitrumExplorers, BaseExplorers, EVM_CHAIN_CONFIGS, EthereumExplorers, type EvmChainConfig, EvmExplorers, type ExplorerName, ExplorerUrls, LocalExplorers, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer, getAllEvmAdapters, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getEvmApiUrl, getEvmChainConfig, getEvmExplorerByName, getEvmExplorerUrl, getEvmExplorerUrlByName, getEvmExplorers, getPrimaryEvmExplorer };
package/dist/index.js CHANGED
@@ -20,7 +20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ ArbitrumExplorers: () => ArbitrumExplorers,
24
+ BaseExplorers: () => BaseExplorers,
23
25
  EVM_CHAIN_CONFIGS: () => EVM_CHAIN_CONFIGS,
26
+ EthereumExplorers: () => EthereumExplorers,
27
+ EvmExplorers: () => EvmExplorers,
28
+ ExplorerUrls: () => ExplorerUrls,
29
+ LocalExplorers: () => LocalExplorers,
24
30
  WarpEvmBuilder: () => WarpEvmBuilder,
25
31
  WarpEvmConstants: () => WarpEvmConstants,
26
32
  WarpEvmExecutor: () => WarpEvmExecutor,
@@ -32,17 +38,93 @@ __export(index_exports, {
32
38
  getBaseAdapter: () => getBaseAdapter,
33
39
  getEthereumAdapter: () => getEthereumAdapter,
34
40
  getEvmApiUrl: () => getEvmApiUrl,
35
- getEvmBlockTime: () => getEvmBlockTime,
36
41
  getEvmChainConfig: () => getEvmChainConfig,
37
- getEvmChainId: () => getEvmChainId,
42
+ getEvmExplorerByName: () => getEvmExplorerByName,
38
43
  getEvmExplorerUrl: () => getEvmExplorerUrl,
39
- getEvmNativeToken: () => getEvmNativeToken,
40
- getEvmRegistryAddress: () => getEvmRegistryAddress,
41
- getSupportedEnvironments: () => getSupportedEnvironments,
42
- getSupportedEvmChains: () => getSupportedEvmChains
44
+ getEvmExplorerUrlByName: () => getEvmExplorerUrlByName,
45
+ getEvmExplorers: () => getEvmExplorers,
46
+ getPrimaryEvmExplorer: () => getPrimaryEvmExplorer
43
47
  });
44
48
  module.exports = __toCommonJS(index_exports);
45
49
 
50
+ // src/constants.ts
51
+ var WarpEvmConstants = {
52
+ GasLimit: {
53
+ Default: 21e3,
54
+ ContractCall: 1e5,
55
+ ContractDeploy: 5e5,
56
+ Transfer: 21e3,
57
+ Approve: 46e3,
58
+ Swap: 2e5
59
+ },
60
+ GasPrice: {
61
+ Default: "20000000000"
62
+ },
63
+ Validation: {
64
+ MinGasLimit: 21e3,
65
+ MaxGasLimit: 3e7
66
+ }
67
+ };
68
+ var EthereumExplorers = /* @__PURE__ */ ((EthereumExplorers2) => {
69
+ EthereumExplorers2["Etherscan"] = "etherscan";
70
+ EthereumExplorers2["EtherscanSepolia"] = "etherscan_sepolia";
71
+ EthereumExplorers2["Ethplorer"] = "ethplorer";
72
+ EthereumExplorers2["Blockscout"] = "blockscout";
73
+ EthereumExplorers2["BlockscoutSepolia"] = "blockscout_sepolia";
74
+ return EthereumExplorers2;
75
+ })(EthereumExplorers || {});
76
+ var ArbitrumExplorers = /* @__PURE__ */ ((ArbitrumExplorers2) => {
77
+ ArbitrumExplorers2["Arbiscan"] = "arbiscan";
78
+ ArbitrumExplorers2["ArbiscanSepolia"] = "arbiscan_sepolia";
79
+ ArbitrumExplorers2["BlockscoutArbitrum"] = "blockscout_arbitrum";
80
+ ArbitrumExplorers2["BlockscoutArbitrumSepolia"] = "blockscout_arbitrum_sepolia";
81
+ return ArbitrumExplorers2;
82
+ })(ArbitrumExplorers || {});
83
+ var BaseExplorers = /* @__PURE__ */ ((BaseExplorers2) => {
84
+ BaseExplorers2["Basescan"] = "basescan";
85
+ BaseExplorers2["BasescanSepolia"] = "basescan_sepolia";
86
+ BaseExplorers2["BlockscoutBase"] = "blockscout_base";
87
+ BaseExplorers2["BlockscoutBaseSepolia"] = "blockscout_base_sepolia";
88
+ return BaseExplorers2;
89
+ })(BaseExplorers || {});
90
+ var LocalExplorers = /* @__PURE__ */ ((LocalExplorers2) => {
91
+ LocalExplorers2["LocalBlockscout"] = "local_blockscout";
92
+ return LocalExplorers2;
93
+ })(LocalExplorers || {});
94
+ var EvmExplorers = {
95
+ ethereum: {
96
+ mainnet: ["etherscan" /* Etherscan */, "ethplorer" /* Ethplorer */, "blockscout" /* Blockscout */],
97
+ testnet: ["etherscan_sepolia" /* EtherscanSepolia */, "blockscout_sepolia" /* BlockscoutSepolia */],
98
+ devnet: ["local_blockscout" /* LocalBlockscout */]
99
+ },
100
+ arbitrum: {
101
+ mainnet: ["arbiscan" /* Arbiscan */, "blockscout_arbitrum" /* BlockscoutArbitrum */],
102
+ testnet: ["arbiscan_sepolia" /* ArbiscanSepolia */, "blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */],
103
+ devnet: ["local_blockscout" /* LocalBlockscout */]
104
+ },
105
+ base: {
106
+ mainnet: ["basescan" /* Basescan */, "blockscout_base" /* BlockscoutBase */],
107
+ testnet: ["basescan_sepolia" /* BasescanSepolia */, "blockscout_base_sepolia" /* BlockscoutBaseSepolia */],
108
+ devnet: ["local_blockscout" /* LocalBlockscout */]
109
+ }
110
+ };
111
+ var ExplorerUrls = {
112
+ ["etherscan" /* Etherscan */]: "https://etherscan.io",
113
+ ["etherscan_sepolia" /* EtherscanSepolia */]: "https://sepolia.etherscan.io",
114
+ ["ethplorer" /* Ethplorer */]: "https://ethplorer.io",
115
+ ["blockscout" /* Blockscout */]: "https://eth.blockscout.com",
116
+ ["blockscout_sepolia" /* BlockscoutSepolia */]: "https://sepolia.blockscout.com",
117
+ ["arbiscan" /* Arbiscan */]: "https://arbiscan.io",
118
+ ["arbiscan_sepolia" /* ArbiscanSepolia */]: "https://sepolia.arbiscan.io",
119
+ ["blockscout_arbitrum" /* BlockscoutArbitrum */]: "https://arbitrum.blockscout.com",
120
+ ["blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */]: "https://sepolia.blockscout.com",
121
+ ["basescan" /* Basescan */]: "https://basescan.org",
122
+ ["basescan_sepolia" /* BasescanSepolia */]: "https://sepolia.basescan.org",
123
+ ["blockscout_base" /* BlockscoutBase */]: "https://base.blockscout.com",
124
+ ["blockscout_base_sepolia" /* BlockscoutBaseSepolia */]: "https://sepolia.blockscout.com",
125
+ ["local_blockscout" /* LocalBlockscout */]: "http://localhost:4000"
126
+ };
127
+
46
128
  // src/config.ts
47
129
  var EVM_CHAIN_CONFIGS = {
48
130
  ethereum: {
@@ -142,90 +224,31 @@ var getEvmApiUrl = (env, chain = DEFAULT_CHAIN) => {
142
224
  var getEvmExplorerUrl = (env, chain = DEFAULT_CHAIN) => {
143
225
  return getEvmChainConfig(chain, env).explorerUrl;
144
226
  };
145
- var getEvmChainId = (env, chain = DEFAULT_CHAIN) => {
146
- return getEvmChainConfig(chain, env).chainId;
147
- };
148
- var getEvmRegistryAddress = (env, chain = DEFAULT_CHAIN) => {
149
- return getEvmChainConfig(chain, env).registryAddress;
150
- };
151
- var getEvmNativeToken = (env, chain = DEFAULT_CHAIN) => {
152
- return getEvmChainConfig(chain, env).nativeToken;
153
- };
154
- var getEvmBlockTime = (env, chain = DEFAULT_CHAIN) => {
155
- return getEvmChainConfig(chain, env).blockTime || 12;
227
+ var getEvmExplorers = (chain = DEFAULT_CHAIN, env) => {
228
+ const chainExplorers = EvmExplorers[chain];
229
+ if (!chainExplorers) {
230
+ throw new Error(`Unsupported EVM chain: ${chain}`);
231
+ }
232
+ const explorers = chainExplorers[env];
233
+ if (!explorers) {
234
+ throw new Error(`Unsupported environment ${env} for chain ${chain}`);
235
+ }
236
+ return explorers;
156
237
  };
157
- var getSupportedEvmChains = () => {
158
- return Object.keys(EVM_CHAIN_CONFIGS);
238
+ var getPrimaryEvmExplorer = (chain = DEFAULT_CHAIN, env) => {
239
+ const explorers = getEvmExplorers(chain, env);
240
+ return explorers[0];
159
241
  };
160
- var getSupportedEnvironments = (chain) => {
161
- const chainConfigs = EVM_CHAIN_CONFIGS[chain];
162
- if (!chainConfigs) {
163
- return [];
242
+ var getEvmExplorerUrlByName = (explorerName) => {
243
+ const url = ExplorerUrls[explorerName];
244
+ if (!url) {
245
+ throw new Error(`Unsupported explorer: ${explorerName}`);
164
246
  }
165
- return Object.keys(chainConfigs);
247
+ return url;
166
248
  };
167
-
168
- // src/constants.ts
169
- var WarpEvmConstants = {
170
- // Native token configuration
171
- Ether: {
172
- Identifier: "ETH",
173
- DisplayName: "Ether",
174
- Decimals: 18
175
- },
176
- // Gas configuration
177
- GasLimit: {
178
- Default: 21e3,
179
- ContractCall: 1e5,
180
- ContractDeploy: 5e5,
181
- Transfer: 21e3,
182
- Approve: 46e3,
183
- Swap: 2e5
184
- },
185
- GasPrice: {
186
- Default: "20000000000",
187
- // 20 gwei
188
- Low: "10000000000",
189
- // 10 gwei
190
- Medium: "20000000000",
191
- // 20 gwei
192
- High: "50000000000"
193
- // 50 gwei
194
- },
195
- // Supported networks
196
- Networks: {
197
- Ethereum: {
198
- ChainId: "1",
199
- Name: "Ethereum",
200
- BlockTime: 12
201
- },
202
- Arbitrum: {
203
- ChainId: "42161",
204
- Name: "Arbitrum",
205
- BlockTime: 1
206
- },
207
- Base: {
208
- ChainId: "8453",
209
- Name: "Base",
210
- BlockTime: 2
211
- }
212
- },
213
- // Validation rules
214
- Validation: {
215
- AddressLength: 42,
216
- HexPrefix: "0x",
217
- MinGasLimit: 21e3,
218
- MaxGasLimit: 3e7
219
- },
220
- // Timeout configuration
221
- Timeouts: {
222
- DefaultRpcTimeout: 3e4,
223
- // 30 seconds
224
- GasEstimationTimeout: 1e4,
225
- // 10 seconds
226
- QueryTimeout: 15e3
227
- // 15 seconds
228
- }
249
+ var getEvmExplorerByName = (chain = DEFAULT_CHAIN, env, name) => {
250
+ const explorers = getEvmExplorers(chain, env);
251
+ return explorers.find((explorer) => explorer.toLowerCase() === name.toLowerCase());
229
252
  };
230
253
 
231
254
  // src/WarpEvmBuilder.ts
@@ -757,18 +780,80 @@ var WarpEvmExecutor = class {
757
780
 
758
781
  // src/WarpEvmExplorer.ts
759
782
  var WarpEvmExplorer = class {
760
- constructor(chainInfo, chainName = "ethereum") {
761
- this.chainInfo = chainInfo;
762
- this.chainName = chainName;
783
+ constructor(chain, config) {
784
+ this.chain = chain;
785
+ this.config = config;
763
786
  }
764
- getAccountUrl(address) {
765
- const baseUrl = this.chainInfo.explorerUrl || getEvmExplorerUrl("mainnet", this.chainName);
787
+ getExplorerUrlByName(explorer) {
788
+ const userPreference = this.chain.preferences?.explorers?.[this.chain.name];
789
+ if (userPreference && !explorer) {
790
+ const url2 = ExplorerUrls[userPreference];
791
+ if (url2) return url2;
792
+ }
793
+ if (explorer) {
794
+ const url2 = ExplorerUrls[explorer];
795
+ if (url2) return url2;
796
+ }
797
+ const primaryExplorer = getPrimaryEvmExplorer(this.chain.name, this.config.env);
798
+ const url = ExplorerUrls[primaryExplorer];
799
+ return url || getEvmExplorerUrl(this.config.env, this.chain.name);
800
+ }
801
+ getAccountUrl(address, explorer) {
802
+ const baseUrl = this.getExplorerUrlByName(explorer);
766
803
  return `${baseUrl}/address/${address}`;
767
804
  }
768
- getTransactionUrl(hash) {
769
- const baseUrl = this.chainInfo.explorerUrl || getEvmExplorerUrl("mainnet", this.chainName);
805
+ getTransactionUrl(hash, explorer) {
806
+ const baseUrl = this.getExplorerUrlByName(explorer);
770
807
  return `${baseUrl}/tx/${hash}`;
771
808
  }
809
+ getBlockUrl(blockNumber, explorer) {
810
+ const baseUrl = this.getExplorerUrlByName(explorer);
811
+ return `${baseUrl}/block/${blockNumber}`;
812
+ }
813
+ getTokenUrl(tokenAddress, explorer) {
814
+ const baseUrl = this.getExplorerUrlByName(explorer);
815
+ return `${baseUrl}/token/${tokenAddress}`;
816
+ }
817
+ getContractUrl(contractAddress, explorer) {
818
+ const baseUrl = this.getExplorerUrlByName(explorer);
819
+ return `${baseUrl}/address/${contractAddress}`;
820
+ }
821
+ getAllExplorers() {
822
+ try {
823
+ return getEvmExplorers(this.chain.name, this.config.env);
824
+ } catch {
825
+ return ["Default"];
826
+ }
827
+ }
828
+ getExplorerByName(name) {
829
+ try {
830
+ return getEvmExplorerByName(this.chain.name, this.config.env, name);
831
+ } catch {
832
+ return void 0;
833
+ }
834
+ }
835
+ getAccountUrls(address) {
836
+ const explorers = this.getAllExplorers();
837
+ const urls = {};
838
+ explorers.forEach((explorer) => {
839
+ const url = ExplorerUrls[explorer];
840
+ if (url) {
841
+ urls[explorer] = `${url}/address/${address}`;
842
+ }
843
+ });
844
+ return urls;
845
+ }
846
+ getTransactionUrls(hash) {
847
+ const explorers = this.getAllExplorers();
848
+ const urls = {};
849
+ explorers.forEach((explorer) => {
850
+ const url = ExplorerUrls[explorer];
851
+ if (url) {
852
+ urls[explorer] = `${url}/tx/${hash}`;
853
+ }
854
+ });
855
+ return urls;
856
+ }
772
857
  };
773
858
 
774
859
  // src/main.ts
@@ -791,7 +876,7 @@ function createEvmAdapter(chainName, chainPrefix) {
791
876
  results: new WarpEvmResults(config),
792
877
  serializer: new WarpEvmSerializer(),
793
878
  registry: fallback.registry,
794
- explorer: (chainInfo) => new WarpEvmExplorer(chainInfo),
879
+ explorer: (chainInfo) => new WarpEvmExplorer(chainInfo, config),
795
880
  abiBuilder: () => fallback.abiBuilder(),
796
881
  brandBuilder: () => fallback.brandBuilder()
797
882
  };
@@ -799,7 +884,13 @@ function createEvmAdapter(chainName, chainPrefix) {
799
884
  }
800
885
  // Annotate the CommonJS export names for ESM import in node:
801
886
  0 && (module.exports = {
887
+ ArbitrumExplorers,
888
+ BaseExplorers,
802
889
  EVM_CHAIN_CONFIGS,
890
+ EthereumExplorers,
891
+ EvmExplorers,
892
+ ExplorerUrls,
893
+ LocalExplorers,
803
894
  WarpEvmBuilder,
804
895
  WarpEvmConstants,
805
896
  WarpEvmExecutor,
@@ -811,13 +902,11 @@ function createEvmAdapter(chainName, chainPrefix) {
811
902
  getBaseAdapter,
812
903
  getEthereumAdapter,
813
904
  getEvmApiUrl,
814
- getEvmBlockTime,
815
905
  getEvmChainConfig,
816
- getEvmChainId,
906
+ getEvmExplorerByName,
817
907
  getEvmExplorerUrl,
818
- getEvmNativeToken,
819
- getEvmRegistryAddress,
820
- getSupportedEnvironments,
821
- getSupportedEvmChains
908
+ getEvmExplorerUrlByName,
909
+ getEvmExplorers,
910
+ getPrimaryEvmExplorer
822
911
  });
823
912
  //# sourceMappingURL=index.js.map