@vleap/warps-adapter-evm 0.2.0-alpha.2 → 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 +76 -60
- package/dist/index.d.ts +76 -60
- package/dist/index.js +233 -114
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +219 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,33 +1,7 @@
|
|
|
1
|
-
import { WarpChainEnv, AdapterFactory,
|
|
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
|
-
ChainName: string;
|
|
25
|
-
ChainPrefix: string;
|
|
26
|
-
Ether: {
|
|
27
|
-
Identifier: string;
|
|
28
|
-
DisplayName: string;
|
|
29
|
-
Decimals: number;
|
|
30
|
-
};
|
|
31
5
|
GasLimit: {
|
|
32
6
|
Default: number;
|
|
33
7
|
ContractCall: number;
|
|
@@ -38,41 +12,75 @@ declare const WarpEvmConstants: {
|
|
|
38
12
|
};
|
|
39
13
|
GasPrice: {
|
|
40
14
|
Default: string;
|
|
41
|
-
Low: string;
|
|
42
|
-
Medium: string;
|
|
43
|
-
High: string;
|
|
44
|
-
};
|
|
45
|
-
Network: {
|
|
46
|
-
Ethereum: {
|
|
47
|
-
ChainId: string;
|
|
48
|
-
Name: string;
|
|
49
|
-
BlockTime: number;
|
|
50
|
-
};
|
|
51
|
-
Arbitrum: {
|
|
52
|
-
ChainId: string;
|
|
53
|
-
Name: string;
|
|
54
|
-
BlockTime: number;
|
|
55
|
-
};
|
|
56
|
-
Base: {
|
|
57
|
-
ChainId: string;
|
|
58
|
-
Name: string;
|
|
59
|
-
BlockTime: number;
|
|
60
|
-
};
|
|
61
15
|
};
|
|
62
16
|
Validation: {
|
|
63
|
-
AddressLength: number;
|
|
64
|
-
HexPrefix: string;
|
|
65
17
|
MinGasLimit: number;
|
|
66
18
|
MaxGasLimit: number;
|
|
67
19
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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];
|
|
72
59
|
};
|
|
73
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;
|
|
74
79
|
|
|
75
|
-
declare const
|
|
80
|
+
declare const getEthereumAdapter: AdapterFactory;
|
|
81
|
+
declare const getArbitrumAdapter: AdapterFactory;
|
|
82
|
+
declare const getBaseAdapter: AdapterFactory;
|
|
83
|
+
declare const getAllEvmAdapters: (config: WarpClientConfig, fallback?: Adapter) => Adapter[];
|
|
76
84
|
|
|
77
85
|
declare class WarpEvmBuilder implements CombinedWarpBuilder {
|
|
78
86
|
private readonly config;
|
|
@@ -107,11 +115,19 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
|
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
declare class WarpEvmExplorer implements AdapterWarpExplorer {
|
|
110
|
-
private readonly
|
|
111
|
-
private readonly
|
|
112
|
-
constructor(
|
|
113
|
-
|
|
114
|
-
|
|
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>;
|
|
115
131
|
}
|
|
116
132
|
|
|
117
133
|
declare class WarpEvmResults implements AdapterWarpResults {
|
|
@@ -136,4 +152,4 @@ declare class WarpEvmSerializer implements AdapterWarpSerializer {
|
|
|
136
152
|
private parseNativeValue;
|
|
137
153
|
}
|
|
138
154
|
|
|
139
|
-
export { EVM_CHAIN_CONFIGS, type EvmChainConfig, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer,
|
|
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,33 +1,7 @@
|
|
|
1
|
-
import { WarpChainEnv, AdapterFactory,
|
|
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
|
-
ChainName: string;
|
|
25
|
-
ChainPrefix: string;
|
|
26
|
-
Ether: {
|
|
27
|
-
Identifier: string;
|
|
28
|
-
DisplayName: string;
|
|
29
|
-
Decimals: number;
|
|
30
|
-
};
|
|
31
5
|
GasLimit: {
|
|
32
6
|
Default: number;
|
|
33
7
|
ContractCall: number;
|
|
@@ -38,41 +12,75 @@ declare const WarpEvmConstants: {
|
|
|
38
12
|
};
|
|
39
13
|
GasPrice: {
|
|
40
14
|
Default: string;
|
|
41
|
-
Low: string;
|
|
42
|
-
Medium: string;
|
|
43
|
-
High: string;
|
|
44
|
-
};
|
|
45
|
-
Network: {
|
|
46
|
-
Ethereum: {
|
|
47
|
-
ChainId: string;
|
|
48
|
-
Name: string;
|
|
49
|
-
BlockTime: number;
|
|
50
|
-
};
|
|
51
|
-
Arbitrum: {
|
|
52
|
-
ChainId: string;
|
|
53
|
-
Name: string;
|
|
54
|
-
BlockTime: number;
|
|
55
|
-
};
|
|
56
|
-
Base: {
|
|
57
|
-
ChainId: string;
|
|
58
|
-
Name: string;
|
|
59
|
-
BlockTime: number;
|
|
60
|
-
};
|
|
61
15
|
};
|
|
62
16
|
Validation: {
|
|
63
|
-
AddressLength: number;
|
|
64
|
-
HexPrefix: string;
|
|
65
17
|
MinGasLimit: number;
|
|
66
18
|
MaxGasLimit: number;
|
|
67
19
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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];
|
|
72
59
|
};
|
|
73
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;
|
|
74
79
|
|
|
75
|
-
declare const
|
|
80
|
+
declare const getEthereumAdapter: AdapterFactory;
|
|
81
|
+
declare const getArbitrumAdapter: AdapterFactory;
|
|
82
|
+
declare const getBaseAdapter: AdapterFactory;
|
|
83
|
+
declare const getAllEvmAdapters: (config: WarpClientConfig, fallback?: Adapter) => Adapter[];
|
|
76
84
|
|
|
77
85
|
declare class WarpEvmBuilder implements CombinedWarpBuilder {
|
|
78
86
|
private readonly config;
|
|
@@ -107,11 +115,19 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
|
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
declare class WarpEvmExplorer implements AdapterWarpExplorer {
|
|
110
|
-
private readonly
|
|
111
|
-
private readonly
|
|
112
|
-
constructor(
|
|
113
|
-
|
|
114
|
-
|
|
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>;
|
|
115
131
|
}
|
|
116
132
|
|
|
117
133
|
declare class WarpEvmResults implements AdapterWarpResults {
|
|
@@ -136,4 +152,4 @@ declare class WarpEvmSerializer implements AdapterWarpSerializer {
|
|
|
136
152
|
private parseNativeValue;
|
|
137
153
|
}
|
|
138
154
|
|
|
139
|
-
export { EVM_CHAIN_CONFIGS, type EvmChainConfig, WarpEvmBuilder, WarpEvmConstants, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer,
|
|
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 };
|