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

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,6 +1,14 @@
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 { 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';
2
2
  import { ethers } from 'ethers';
3
3
 
4
+ declare const getArbitrumAdapter: AdapterFactory;
5
+
6
+ declare const getBaseAdapter: AdapterFactory;
7
+
8
+ declare const getAllEvmAdapters: (config: WarpClientConfig, fallback?: Adapter) => Adapter[];
9
+
10
+ declare const getEthereumAdapter: AdapterFactory;
11
+
4
12
  interface EvmChainConfig {
5
13
  apiUrl: string;
6
14
  explorerUrl: string;
@@ -13,19 +21,8 @@ declare const EVM_CHAIN_CONFIGS: Record<string, Record<WarpChainEnv, EvmChainCon
13
21
  declare const getEvmChainConfig: (chain: string | undefined, env: WarpChainEnv) => EvmChainConfig;
14
22
  declare const getEvmApiUrl: (env: WarpChainEnv, chain?: string) => string;
15
23
  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
24
 
23
25
  declare const WarpEvmConstants: {
24
- Ether: {
25
- Identifier: string;
26
- DisplayName: string;
27
- Decimals: number;
28
- };
29
26
  GasLimit: {
30
27
  Default: number;
31
28
  ContractCall: number;
@@ -36,44 +33,50 @@ declare const WarpEvmConstants: {
36
33
  };
37
34
  GasPrice: {
38
35
  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
36
  };
60
37
  Validation: {
61
- AddressLength: number;
62
- HexPrefix: string;
63
38
  MinGasLimit: number;
64
39
  MaxGasLimit: number;
65
40
  };
66
- Timeouts: {
67
- DefaultRpcTimeout: number;
68
- GasEstimationTimeout: number;
69
- QueryTimeout: number;
41
+ };
42
+ declare enum EthereumExplorers {
43
+ Etherscan = "etherscan",
44
+ EtherscanSepolia = "etherscan_sepolia",
45
+ Ethplorer = "ethplorer",
46
+ Blockscout = "blockscout",
47
+ BlockscoutSepolia = "blockscout_sepolia"
48
+ }
49
+ declare enum ArbitrumExplorers {
50
+ Arbiscan = "arbiscan",
51
+ ArbiscanSepolia = "arbiscan_sepolia",
52
+ BlockscoutArbitrum = "blockscout_arbitrum",
53
+ BlockscoutArbitrumSepolia = "blockscout_arbitrum_sepolia"
54
+ }
55
+ declare enum BaseExplorers {
56
+ Basescan = "basescan",
57
+ BasescanSepolia = "basescan_sepolia",
58
+ BlockscoutBase = "blockscout_base",
59
+ BlockscoutBaseSepolia = "blockscout_base_sepolia"
60
+ }
61
+ type ExplorerName = EthereumExplorers | ArbitrumExplorers | BaseExplorers;
62
+ declare const EvmExplorers: {
63
+ readonly ethereum: {
64
+ readonly mainnet: readonly [EthereumExplorers.Etherscan, EthereumExplorers.Ethplorer, EthereumExplorers.Blockscout];
65
+ readonly testnet: readonly [EthereumExplorers.EtherscanSepolia, EthereumExplorers.BlockscoutSepolia];
66
+ readonly devnet: readonly [EthereumExplorers.EtherscanSepolia, EthereumExplorers.BlockscoutSepolia];
67
+ };
68
+ readonly arbitrum: {
69
+ readonly mainnet: readonly [ArbitrumExplorers.Arbiscan, ArbitrumExplorers.BlockscoutArbitrum];
70
+ readonly testnet: readonly [ArbitrumExplorers.ArbiscanSepolia, ArbitrumExplorers.BlockscoutArbitrumSepolia];
71
+ readonly devnet: readonly [ArbitrumExplorers.ArbiscanSepolia, ArbitrumExplorers.BlockscoutArbitrumSepolia];
72
+ };
73
+ readonly base: {
74
+ readonly mainnet: readonly [BaseExplorers.Basescan, BaseExplorers.BlockscoutBase];
75
+ readonly testnet: readonly [BaseExplorers.BasescanSepolia, BaseExplorers.BlockscoutBaseSepolia];
76
+ readonly devnet: readonly [BaseExplorers.BasescanSepolia, BaseExplorers.BlockscoutBaseSepolia];
70
77
  };
71
78
  };
72
-
73
- declare const getEthereumAdapter: AdapterFactory;
74
- declare const getArbitrumAdapter: AdapterFactory;
75
- declare const getBaseAdapter: AdapterFactory;
76
- declare const getAllEvmAdapters: (config: WarpClientConfig, fallback?: Adapter) => Adapter[];
79
+ declare const ExplorerUrls: Record<ExplorerName, string>;
77
80
 
78
81
  declare class WarpEvmBuilder implements CombinedWarpBuilder {
79
82
  private readonly config;
@@ -108,11 +111,21 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
108
111
  }
109
112
 
110
113
  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;
114
+ private readonly chain;
115
+ private readonly config;
116
+ constructor(chain: WarpChain, config: WarpClientConfig);
117
+ private getExplorers;
118
+ private getPrimaryExplorer;
119
+ private getExplorerUrlByName;
120
+ getAccountUrl(address: string, explorer?: ExplorerName): string;
121
+ getTransactionUrl(hash: string, explorer?: ExplorerName): string;
122
+ getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
123
+ getTokenUrl(tokenAddress: string, explorer?: ExplorerName): string;
124
+ getContractUrl(contractAddress: string, explorer?: ExplorerName): string;
125
+ getAllExplorers(): readonly ExplorerName[];
126
+ getExplorerByName(name: string): ExplorerName | undefined;
127
+ getAccountUrls(address: string): Record<ExplorerName, string>;
128
+ getTransactionUrls(hash: string): Record<ExplorerName, string>;
116
129
  }
117
130
 
118
131
  declare class WarpEvmResults implements AdapterWarpResults {
@@ -137,4 +150,4 @@ declare class WarpEvmSerializer implements AdapterWarpSerializer {
137
150
  private parseNativeValue;
138
151
  }
139
152
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,14 @@
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 { 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';
2
2
  import { ethers } from 'ethers';
3
3
 
4
+ declare const getArbitrumAdapter: AdapterFactory;
5
+
6
+ declare const getBaseAdapter: AdapterFactory;
7
+
8
+ declare const getAllEvmAdapters: (config: WarpClientConfig, fallback?: Adapter) => Adapter[];
9
+
10
+ declare const getEthereumAdapter: AdapterFactory;
11
+
4
12
  interface EvmChainConfig {
5
13
  apiUrl: string;
6
14
  explorerUrl: string;
@@ -13,19 +21,8 @@ declare const EVM_CHAIN_CONFIGS: Record<string, Record<WarpChainEnv, EvmChainCon
13
21
  declare const getEvmChainConfig: (chain: string | undefined, env: WarpChainEnv) => EvmChainConfig;
14
22
  declare const getEvmApiUrl: (env: WarpChainEnv, chain?: string) => string;
15
23
  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
24
 
23
25
  declare const WarpEvmConstants: {
24
- Ether: {
25
- Identifier: string;
26
- DisplayName: string;
27
- Decimals: number;
28
- };
29
26
  GasLimit: {
30
27
  Default: number;
31
28
  ContractCall: number;
@@ -36,44 +33,50 @@ declare const WarpEvmConstants: {
36
33
  };
37
34
  GasPrice: {
38
35
  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
36
  };
60
37
  Validation: {
61
- AddressLength: number;
62
- HexPrefix: string;
63
38
  MinGasLimit: number;
64
39
  MaxGasLimit: number;
65
40
  };
66
- Timeouts: {
67
- DefaultRpcTimeout: number;
68
- GasEstimationTimeout: number;
69
- QueryTimeout: number;
41
+ };
42
+ declare enum EthereumExplorers {
43
+ Etherscan = "etherscan",
44
+ EtherscanSepolia = "etherscan_sepolia",
45
+ Ethplorer = "ethplorer",
46
+ Blockscout = "blockscout",
47
+ BlockscoutSepolia = "blockscout_sepolia"
48
+ }
49
+ declare enum ArbitrumExplorers {
50
+ Arbiscan = "arbiscan",
51
+ ArbiscanSepolia = "arbiscan_sepolia",
52
+ BlockscoutArbitrum = "blockscout_arbitrum",
53
+ BlockscoutArbitrumSepolia = "blockscout_arbitrum_sepolia"
54
+ }
55
+ declare enum BaseExplorers {
56
+ Basescan = "basescan",
57
+ BasescanSepolia = "basescan_sepolia",
58
+ BlockscoutBase = "blockscout_base",
59
+ BlockscoutBaseSepolia = "blockscout_base_sepolia"
60
+ }
61
+ type ExplorerName = EthereumExplorers | ArbitrumExplorers | BaseExplorers;
62
+ declare const EvmExplorers: {
63
+ readonly ethereum: {
64
+ readonly mainnet: readonly [EthereumExplorers.Etherscan, EthereumExplorers.Ethplorer, EthereumExplorers.Blockscout];
65
+ readonly testnet: readonly [EthereumExplorers.EtherscanSepolia, EthereumExplorers.BlockscoutSepolia];
66
+ readonly devnet: readonly [EthereumExplorers.EtherscanSepolia, EthereumExplorers.BlockscoutSepolia];
67
+ };
68
+ readonly arbitrum: {
69
+ readonly mainnet: readonly [ArbitrumExplorers.Arbiscan, ArbitrumExplorers.BlockscoutArbitrum];
70
+ readonly testnet: readonly [ArbitrumExplorers.ArbiscanSepolia, ArbitrumExplorers.BlockscoutArbitrumSepolia];
71
+ readonly devnet: readonly [ArbitrumExplorers.ArbiscanSepolia, ArbitrumExplorers.BlockscoutArbitrumSepolia];
72
+ };
73
+ readonly base: {
74
+ readonly mainnet: readonly [BaseExplorers.Basescan, BaseExplorers.BlockscoutBase];
75
+ readonly testnet: readonly [BaseExplorers.BasescanSepolia, BaseExplorers.BlockscoutBaseSepolia];
76
+ readonly devnet: readonly [BaseExplorers.BasescanSepolia, BaseExplorers.BlockscoutBaseSepolia];
70
77
  };
71
78
  };
72
-
73
- declare const getEthereumAdapter: AdapterFactory;
74
- declare const getArbitrumAdapter: AdapterFactory;
75
- declare const getBaseAdapter: AdapterFactory;
76
- declare const getAllEvmAdapters: (config: WarpClientConfig, fallback?: Adapter) => Adapter[];
79
+ declare const ExplorerUrls: Record<ExplorerName, string>;
77
80
 
78
81
  declare class WarpEvmBuilder implements CombinedWarpBuilder {
79
82
  private readonly config;
@@ -108,11 +111,21 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
108
111
  }
109
112
 
110
113
  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;
114
+ private readonly chain;
115
+ private readonly config;
116
+ constructor(chain: WarpChain, config: WarpClientConfig);
117
+ private getExplorers;
118
+ private getPrimaryExplorer;
119
+ private getExplorerUrlByName;
120
+ getAccountUrl(address: string, explorer?: ExplorerName): string;
121
+ getTransactionUrl(hash: string, explorer?: ExplorerName): string;
122
+ getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
123
+ getTokenUrl(tokenAddress: string, explorer?: ExplorerName): string;
124
+ getContractUrl(contractAddress: string, explorer?: ExplorerName): string;
125
+ getAllExplorers(): readonly ExplorerName[];
126
+ getExplorerByName(name: string): ExplorerName | undefined;
127
+ getAccountUrls(address: string): Record<ExplorerName, string>;
128
+ getTransactionUrls(hash: string): Record<ExplorerName, string>;
116
129
  }
117
130
 
118
131
  declare class WarpEvmResults implements AdapterWarpResults {
@@ -137,4 +150,4 @@ declare class WarpEvmSerializer implements AdapterWarpSerializer {
137
150
  private parseNativeValue;
138
151
  }
139
152
 
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 };
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 };