@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 +62 -49
- package/dist/index.d.ts +62 -49
- package/dist/index.js +275 -145
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +269 -138
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/WarpEvmBuilder.ts
|
|
2
|
+
import { ethers } from "ethers";
|
|
3
|
+
|
|
1
4
|
// src/config.ts
|
|
2
5
|
var EVM_CHAIN_CONFIGS = {
|
|
3
6
|
ethereum: {
|
|
@@ -7,7 +10,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
7
10
|
chainId: "1",
|
|
8
11
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
9
12
|
nativeToken: "ETH",
|
|
10
|
-
blockTime:
|
|
13
|
+
blockTime: 12e3
|
|
11
14
|
},
|
|
12
15
|
testnet: {
|
|
13
16
|
apiUrl: "https://eth-sepolia.g.alchemy.com/v2/demo",
|
|
@@ -15,7 +18,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
15
18
|
chainId: "11155111",
|
|
16
19
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
17
20
|
nativeToken: "ETH",
|
|
18
|
-
blockTime:
|
|
21
|
+
blockTime: 12e3
|
|
19
22
|
},
|
|
20
23
|
devnet: {
|
|
21
24
|
apiUrl: "http://localhost:8545",
|
|
@@ -23,7 +26,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
23
26
|
chainId: "1337",
|
|
24
27
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
25
28
|
nativeToken: "ETH",
|
|
26
|
-
blockTime:
|
|
29
|
+
blockTime: 12e3
|
|
27
30
|
}
|
|
28
31
|
},
|
|
29
32
|
arbitrum: {
|
|
@@ -33,7 +36,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
33
36
|
chainId: "42161",
|
|
34
37
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
35
38
|
nativeToken: "ETH",
|
|
36
|
-
blockTime:
|
|
39
|
+
blockTime: 1e3
|
|
37
40
|
},
|
|
38
41
|
testnet: {
|
|
39
42
|
apiUrl: "https://arb-sepolia.g.alchemy.com/v2/demo",
|
|
@@ -41,7 +44,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
41
44
|
chainId: "421614",
|
|
42
45
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
43
46
|
nativeToken: "ETH",
|
|
44
|
-
blockTime:
|
|
47
|
+
blockTime: 1e3
|
|
45
48
|
},
|
|
46
49
|
devnet: {
|
|
47
50
|
apiUrl: "http://localhost:8545",
|
|
@@ -49,7 +52,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
49
52
|
chainId: "1337",
|
|
50
53
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
51
54
|
nativeToken: "ETH",
|
|
52
|
-
blockTime:
|
|
55
|
+
blockTime: 1e3
|
|
53
56
|
}
|
|
54
57
|
},
|
|
55
58
|
base: {
|
|
@@ -59,7 +62,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
59
62
|
chainId: "8453",
|
|
60
63
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
61
64
|
nativeToken: "ETH",
|
|
62
|
-
blockTime:
|
|
65
|
+
blockTime: 2e3
|
|
63
66
|
},
|
|
64
67
|
testnet: {
|
|
65
68
|
apiUrl: "https://sepolia.base.org",
|
|
@@ -67,7 +70,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
67
70
|
chainId: "84532",
|
|
68
71
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
69
72
|
nativeToken: "ETH",
|
|
70
|
-
blockTime:
|
|
73
|
+
blockTime: 2e3
|
|
71
74
|
},
|
|
72
75
|
devnet: {
|
|
73
76
|
apiUrl: "http://localhost:8545",
|
|
@@ -75,7 +78,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
75
78
|
chainId: "1337",
|
|
76
79
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
77
80
|
nativeToken: "ETH",
|
|
78
|
-
blockTime:
|
|
81
|
+
blockTime: 2e3
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
};
|
|
@@ -97,94 +100,8 @@ var getEvmApiUrl = (env, chain = DEFAULT_CHAIN) => {
|
|
|
97
100
|
var getEvmExplorerUrl = (env, chain = DEFAULT_CHAIN) => {
|
|
98
101
|
return getEvmChainConfig(chain, env).explorerUrl;
|
|
99
102
|
};
|
|
100
|
-
var getEvmChainId = (env, chain = DEFAULT_CHAIN) => {
|
|
101
|
-
return getEvmChainConfig(chain, env).chainId;
|
|
102
|
-
};
|
|
103
|
-
var getEvmRegistryAddress = (env, chain = DEFAULT_CHAIN) => {
|
|
104
|
-
return getEvmChainConfig(chain, env).registryAddress;
|
|
105
|
-
};
|
|
106
|
-
var getEvmNativeToken = (env, chain = DEFAULT_CHAIN) => {
|
|
107
|
-
return getEvmChainConfig(chain, env).nativeToken;
|
|
108
|
-
};
|
|
109
|
-
var getEvmBlockTime = (env, chain = DEFAULT_CHAIN) => {
|
|
110
|
-
return getEvmChainConfig(chain, env).blockTime || 12;
|
|
111
|
-
};
|
|
112
|
-
var getSupportedEvmChains = () => {
|
|
113
|
-
return Object.keys(EVM_CHAIN_CONFIGS);
|
|
114
|
-
};
|
|
115
|
-
var getSupportedEnvironments = (chain) => {
|
|
116
|
-
const chainConfigs = EVM_CHAIN_CONFIGS[chain];
|
|
117
|
-
if (!chainConfigs) {
|
|
118
|
-
return [];
|
|
119
|
-
}
|
|
120
|
-
return Object.keys(chainConfigs);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// src/constants.ts
|
|
124
|
-
var WarpEvmConstants = {
|
|
125
|
-
// Native token configuration
|
|
126
|
-
Ether: {
|
|
127
|
-
Identifier: "ETH",
|
|
128
|
-
DisplayName: "Ether",
|
|
129
|
-
Decimals: 18
|
|
130
|
-
},
|
|
131
|
-
// Gas configuration
|
|
132
|
-
GasLimit: {
|
|
133
|
-
Default: 21e3,
|
|
134
|
-
ContractCall: 1e5,
|
|
135
|
-
ContractDeploy: 5e5,
|
|
136
|
-
Transfer: 21e3,
|
|
137
|
-
Approve: 46e3,
|
|
138
|
-
Swap: 2e5
|
|
139
|
-
},
|
|
140
|
-
GasPrice: {
|
|
141
|
-
Default: "20000000000",
|
|
142
|
-
// 20 gwei
|
|
143
|
-
Low: "10000000000",
|
|
144
|
-
// 10 gwei
|
|
145
|
-
Medium: "20000000000",
|
|
146
|
-
// 20 gwei
|
|
147
|
-
High: "50000000000"
|
|
148
|
-
// 50 gwei
|
|
149
|
-
},
|
|
150
|
-
// Supported networks
|
|
151
|
-
Networks: {
|
|
152
|
-
Ethereum: {
|
|
153
|
-
ChainId: "1",
|
|
154
|
-
Name: "Ethereum",
|
|
155
|
-
BlockTime: 12
|
|
156
|
-
},
|
|
157
|
-
Arbitrum: {
|
|
158
|
-
ChainId: "42161",
|
|
159
|
-
Name: "Arbitrum",
|
|
160
|
-
BlockTime: 1
|
|
161
|
-
},
|
|
162
|
-
Base: {
|
|
163
|
-
ChainId: "8453",
|
|
164
|
-
Name: "Base",
|
|
165
|
-
BlockTime: 2
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
// Validation rules
|
|
169
|
-
Validation: {
|
|
170
|
-
AddressLength: 42,
|
|
171
|
-
HexPrefix: "0x",
|
|
172
|
-
MinGasLimit: 21e3,
|
|
173
|
-
MaxGasLimit: 3e7
|
|
174
|
-
},
|
|
175
|
-
// Timeout configuration
|
|
176
|
-
Timeouts: {
|
|
177
|
-
DefaultRpcTimeout: 3e4,
|
|
178
|
-
// 30 seconds
|
|
179
|
-
GasEstimationTimeout: 1e4,
|
|
180
|
-
// 10 seconds
|
|
181
|
-
QueryTimeout: 15e3
|
|
182
|
-
// 15 seconds
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
103
|
|
|
186
104
|
// src/WarpEvmBuilder.ts
|
|
187
|
-
import { ethers } from "ethers";
|
|
188
105
|
var WarpEvmBuilder = class {
|
|
189
106
|
constructor(config) {
|
|
190
107
|
this.config = config;
|
|
@@ -287,6 +204,79 @@ import {
|
|
|
287
204
|
} from "@vleap/warps";
|
|
288
205
|
import { ethers as ethers3 } from "ethers";
|
|
289
206
|
|
|
207
|
+
// src/constants.ts
|
|
208
|
+
var WarpEvmConstants = {
|
|
209
|
+
GasLimit: {
|
|
210
|
+
Default: 21e3,
|
|
211
|
+
ContractCall: 1e5,
|
|
212
|
+
ContractDeploy: 5e5,
|
|
213
|
+
Transfer: 21e3,
|
|
214
|
+
Approve: 46e3,
|
|
215
|
+
Swap: 2e5
|
|
216
|
+
},
|
|
217
|
+
GasPrice: {
|
|
218
|
+
Default: "20000000000"
|
|
219
|
+
},
|
|
220
|
+
Validation: {
|
|
221
|
+
MinGasLimit: 21e3,
|
|
222
|
+
MaxGasLimit: 3e7
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
var EthereumExplorers = /* @__PURE__ */ ((EthereumExplorers2) => {
|
|
226
|
+
EthereumExplorers2["Etherscan"] = "etherscan";
|
|
227
|
+
EthereumExplorers2["EtherscanSepolia"] = "etherscan_sepolia";
|
|
228
|
+
EthereumExplorers2["Ethplorer"] = "ethplorer";
|
|
229
|
+
EthereumExplorers2["Blockscout"] = "blockscout";
|
|
230
|
+
EthereumExplorers2["BlockscoutSepolia"] = "blockscout_sepolia";
|
|
231
|
+
return EthereumExplorers2;
|
|
232
|
+
})(EthereumExplorers || {});
|
|
233
|
+
var ArbitrumExplorers = /* @__PURE__ */ ((ArbitrumExplorers2) => {
|
|
234
|
+
ArbitrumExplorers2["Arbiscan"] = "arbiscan";
|
|
235
|
+
ArbitrumExplorers2["ArbiscanSepolia"] = "arbiscan_sepolia";
|
|
236
|
+
ArbitrumExplorers2["BlockscoutArbitrum"] = "blockscout_arbitrum";
|
|
237
|
+
ArbitrumExplorers2["BlockscoutArbitrumSepolia"] = "blockscout_arbitrum_sepolia";
|
|
238
|
+
return ArbitrumExplorers2;
|
|
239
|
+
})(ArbitrumExplorers || {});
|
|
240
|
+
var BaseExplorers = /* @__PURE__ */ ((BaseExplorers2) => {
|
|
241
|
+
BaseExplorers2["Basescan"] = "basescan";
|
|
242
|
+
BaseExplorers2["BasescanSepolia"] = "basescan_sepolia";
|
|
243
|
+
BaseExplorers2["BlockscoutBase"] = "blockscout_base";
|
|
244
|
+
BaseExplorers2["BlockscoutBaseSepolia"] = "blockscout_base_sepolia";
|
|
245
|
+
return BaseExplorers2;
|
|
246
|
+
})(BaseExplorers || {});
|
|
247
|
+
var EvmExplorers = {
|
|
248
|
+
ethereum: {
|
|
249
|
+
mainnet: ["etherscan" /* Etherscan */, "ethplorer" /* Ethplorer */, "blockscout" /* Blockscout */],
|
|
250
|
+
testnet: ["etherscan_sepolia" /* EtherscanSepolia */, "blockscout_sepolia" /* BlockscoutSepolia */],
|
|
251
|
+
devnet: ["etherscan_sepolia" /* EtherscanSepolia */, "blockscout_sepolia" /* BlockscoutSepolia */]
|
|
252
|
+
},
|
|
253
|
+
arbitrum: {
|
|
254
|
+
mainnet: ["arbiscan" /* Arbiscan */, "blockscout_arbitrum" /* BlockscoutArbitrum */],
|
|
255
|
+
testnet: ["arbiscan_sepolia" /* ArbiscanSepolia */, "blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */],
|
|
256
|
+
devnet: ["arbiscan_sepolia" /* ArbiscanSepolia */, "blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */]
|
|
257
|
+
},
|
|
258
|
+
base: {
|
|
259
|
+
mainnet: ["basescan" /* Basescan */, "blockscout_base" /* BlockscoutBase */],
|
|
260
|
+
testnet: ["basescan_sepolia" /* BasescanSepolia */, "blockscout_base_sepolia" /* BlockscoutBaseSepolia */],
|
|
261
|
+
devnet: ["basescan_sepolia" /* BasescanSepolia */, "blockscout_base_sepolia" /* BlockscoutBaseSepolia */]
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
var ExplorerUrls = {
|
|
265
|
+
["etherscan" /* Etherscan */]: "https://etherscan.io",
|
|
266
|
+
["etherscan_sepolia" /* EtherscanSepolia */]: "https://sepolia.etherscan.io",
|
|
267
|
+
["ethplorer" /* Ethplorer */]: "https://ethplorer.io",
|
|
268
|
+
["blockscout" /* Blockscout */]: "https://eth.blockscout.com",
|
|
269
|
+
["blockscout_sepolia" /* BlockscoutSepolia */]: "https://sepolia.blockscout.com",
|
|
270
|
+
["arbiscan" /* Arbiscan */]: "https://arbiscan.io",
|
|
271
|
+
["arbiscan_sepolia" /* ArbiscanSepolia */]: "https://sepolia.arbiscan.io",
|
|
272
|
+
["blockscout_arbitrum" /* BlockscoutArbitrum */]: "https://arbitrum.blockscout.com",
|
|
273
|
+
["blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */]: "https://sepolia.blockscout.com",
|
|
274
|
+
["basescan" /* Basescan */]: "https://basescan.org",
|
|
275
|
+
["basescan_sepolia" /* BasescanSepolia */]: "https://sepolia.basescan.org",
|
|
276
|
+
["blockscout_base" /* BlockscoutBase */]: "https://base.blockscout.com",
|
|
277
|
+
["blockscout_base_sepolia" /* BlockscoutBaseSepolia */]: "https://sepolia.blockscout.com"
|
|
278
|
+
};
|
|
279
|
+
|
|
290
280
|
// src/WarpEvmResults.ts
|
|
291
281
|
import {
|
|
292
282
|
evaluateResultsCommon,
|
|
@@ -537,7 +527,7 @@ var WarpEvmExecutor = class {
|
|
|
537
527
|
return tx;
|
|
538
528
|
}
|
|
539
529
|
async createTransferTransaction(executable) {
|
|
540
|
-
const userWallet = this.config.user?.wallets?.[executable.chain
|
|
530
|
+
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
541
531
|
if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
|
|
542
532
|
if (!ethers3.isAddress(executable.destination)) {
|
|
543
533
|
throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
|
|
@@ -553,7 +543,7 @@ var WarpEvmExecutor = class {
|
|
|
553
543
|
return this.estimateGasAndSetDefaults(tx, userWallet);
|
|
554
544
|
}
|
|
555
545
|
async createContractCallTransaction(executable) {
|
|
556
|
-
const userWallet = this.config.user?.wallets?.[executable.chain
|
|
546
|
+
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
557
547
|
if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
|
|
558
548
|
const action = getWarpActionByIndex(executable.warp, executable.action);
|
|
559
549
|
if (!action || !("func" in action) || !action.func) {
|
|
@@ -604,24 +594,12 @@ var WarpEvmExecutor = class {
|
|
|
604
594
|
executable.action,
|
|
605
595
|
executable.resolvedInputs
|
|
606
596
|
);
|
|
607
|
-
const
|
|
608
|
-
chain: "ethereum",
|
|
609
|
-
prefix: "eth",
|
|
610
|
-
builder: () => ({}),
|
|
611
|
-
executor: {},
|
|
612
|
-
results: {},
|
|
613
|
-
serializer: {},
|
|
614
|
-
registry: {},
|
|
615
|
-
explorer: () => ({}),
|
|
616
|
-
abiBuilder: () => ({}),
|
|
617
|
-
brandBuilder: () => ({})
|
|
618
|
-
};
|
|
619
|
-
const next = getNextInfo(this.config, mockAdapter, executable.warp, executable.action, results);
|
|
597
|
+
const next = getNextInfo(this.config, [], executable.warp, executable.action, results);
|
|
620
598
|
return {
|
|
621
599
|
success: isSuccess,
|
|
622
600
|
warp: executable.warp,
|
|
623
601
|
action: executable.action,
|
|
624
|
-
user: this.config.user?.wallets?.[executable.chain
|
|
602
|
+
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
625
603
|
txHash: null,
|
|
626
604
|
next,
|
|
627
605
|
values,
|
|
@@ -633,7 +611,7 @@ var WarpEvmExecutor = class {
|
|
|
633
611
|
success: false,
|
|
634
612
|
warp: executable.warp,
|
|
635
613
|
action: executable.action,
|
|
636
|
-
user: this.config.user?.wallets?.[executable.chain
|
|
614
|
+
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
637
615
|
txHash: null,
|
|
638
616
|
next: null,
|
|
639
617
|
values: [],
|
|
@@ -723,48 +701,207 @@ var WarpEvmExecutor = class {
|
|
|
723
701
|
|
|
724
702
|
// src/WarpEvmExplorer.ts
|
|
725
703
|
var WarpEvmExplorer = class {
|
|
726
|
-
constructor(
|
|
727
|
-
this.
|
|
728
|
-
this.
|
|
704
|
+
constructor(chain, config) {
|
|
705
|
+
this.chain = chain;
|
|
706
|
+
this.config = config;
|
|
729
707
|
}
|
|
730
|
-
|
|
731
|
-
const
|
|
708
|
+
getExplorers() {
|
|
709
|
+
const chainExplorers = EvmExplorers[this.chain];
|
|
710
|
+
if (!chainExplorers) {
|
|
711
|
+
return ["Default"];
|
|
712
|
+
}
|
|
713
|
+
const explorers = chainExplorers[this.config.env];
|
|
714
|
+
if (!explorers) {
|
|
715
|
+
return ["Default"];
|
|
716
|
+
}
|
|
717
|
+
return explorers;
|
|
718
|
+
}
|
|
719
|
+
getPrimaryExplorer() {
|
|
720
|
+
const explorers = this.getExplorers();
|
|
721
|
+
return explorers[0];
|
|
722
|
+
}
|
|
723
|
+
getExplorerUrlByName(explorer) {
|
|
724
|
+
const userPreference = this.config.preferences?.explorers?.[this.chain];
|
|
725
|
+
if (userPreference && !explorer) {
|
|
726
|
+
const url2 = ExplorerUrls[userPreference];
|
|
727
|
+
if (url2) return url2;
|
|
728
|
+
}
|
|
729
|
+
if (explorer) {
|
|
730
|
+
const url2 = ExplorerUrls[explorer];
|
|
731
|
+
if (url2) return url2;
|
|
732
|
+
}
|
|
733
|
+
const primaryExplorer = this.getPrimaryExplorer();
|
|
734
|
+
const url = ExplorerUrls[primaryExplorer];
|
|
735
|
+
return url || ExplorerUrls[primaryExplorer];
|
|
736
|
+
}
|
|
737
|
+
getAccountUrl(address, explorer) {
|
|
738
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
732
739
|
return `${baseUrl}/address/${address}`;
|
|
733
740
|
}
|
|
734
|
-
getTransactionUrl(hash) {
|
|
735
|
-
const baseUrl = this.
|
|
741
|
+
getTransactionUrl(hash, explorer) {
|
|
742
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
736
743
|
return `${baseUrl}/tx/${hash}`;
|
|
737
744
|
}
|
|
745
|
+
getBlockUrl(blockNumber, explorer) {
|
|
746
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
747
|
+
return `${baseUrl}/block/${blockNumber}`;
|
|
748
|
+
}
|
|
749
|
+
getTokenUrl(tokenAddress, explorer) {
|
|
750
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
751
|
+
return `${baseUrl}/token/${tokenAddress}`;
|
|
752
|
+
}
|
|
753
|
+
getContractUrl(contractAddress, explorer) {
|
|
754
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
755
|
+
return `${baseUrl}/address/${contractAddress}`;
|
|
756
|
+
}
|
|
757
|
+
getAllExplorers() {
|
|
758
|
+
return this.getExplorers();
|
|
759
|
+
}
|
|
760
|
+
getExplorerByName(name) {
|
|
761
|
+
const explorers = this.getExplorers();
|
|
762
|
+
return explorers.find((explorer) => explorer.toLowerCase() === name.toLowerCase());
|
|
763
|
+
}
|
|
764
|
+
getAccountUrls(address) {
|
|
765
|
+
const explorers = this.getAllExplorers();
|
|
766
|
+
const urls = {};
|
|
767
|
+
explorers.forEach((explorer) => {
|
|
768
|
+
const url = ExplorerUrls[explorer];
|
|
769
|
+
if (url) {
|
|
770
|
+
urls[explorer] = `${url}/address/${address}`;
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
return urls;
|
|
774
|
+
}
|
|
775
|
+
getTransactionUrls(hash) {
|
|
776
|
+
const explorers = this.getAllExplorers();
|
|
777
|
+
const urls = {};
|
|
778
|
+
explorers.forEach((explorer) => {
|
|
779
|
+
const url = ExplorerUrls[explorer];
|
|
780
|
+
if (url) {
|
|
781
|
+
urls[explorer] = `${url}/tx/${hash}`;
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
return urls;
|
|
785
|
+
}
|
|
738
786
|
};
|
|
739
787
|
|
|
740
|
-
// src/
|
|
741
|
-
var
|
|
742
|
-
var getArbitrumAdapter = createEvmAdapter("arbitrum", "arb");
|
|
743
|
-
var getBaseAdapter = createEvmAdapter("base", "base");
|
|
744
|
-
var getAllEvmAdapters = (config, fallback) => [
|
|
745
|
-
getEthereumAdapter(config, fallback),
|
|
746
|
-
getArbitrumAdapter(config, fallback),
|
|
747
|
-
getBaseAdapter(config, fallback)
|
|
748
|
-
];
|
|
749
|
-
function createEvmAdapter(chainName, chainPrefix) {
|
|
788
|
+
// src/chains/common.ts
|
|
789
|
+
var createEvmAdapter = (chainName, chainPrefix, chainInfos) => {
|
|
750
790
|
return (config, fallback) => {
|
|
751
791
|
if (!fallback) throw new Error(`${chainName} adapter requires a fallback adapter`);
|
|
752
792
|
return {
|
|
753
793
|
chain: chainName,
|
|
794
|
+
chainInfo: chainInfos[config.env],
|
|
754
795
|
prefix: chainPrefix,
|
|
755
796
|
builder: () => new WarpEvmBuilder(config),
|
|
756
797
|
executor: new WarpEvmExecutor(config),
|
|
757
798
|
results: new WarpEvmResults(config),
|
|
758
799
|
serializer: new WarpEvmSerializer(),
|
|
759
800
|
registry: fallback.registry,
|
|
760
|
-
explorer:
|
|
801
|
+
explorer: new WarpEvmExplorer(chainInfos[config.env], config),
|
|
761
802
|
abiBuilder: () => fallback.abiBuilder(),
|
|
762
803
|
brandBuilder: () => fallback.brandBuilder()
|
|
763
804
|
};
|
|
764
805
|
};
|
|
765
|
-
}
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
// src/chains/arbitrum.ts
|
|
809
|
+
var getArbitrumAdapter = createEvmAdapter("arbitrum", "arb", {
|
|
810
|
+
devnet: {
|
|
811
|
+
displayName: "Arbitrum Devnet",
|
|
812
|
+
chainId: "421614",
|
|
813
|
+
blockTime: 1e3,
|
|
814
|
+
addressHrp: "0x",
|
|
815
|
+
apiUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
816
|
+
nativeToken: "ETH"
|
|
817
|
+
},
|
|
818
|
+
testnet: {
|
|
819
|
+
displayName: "Arbitrum Testnet",
|
|
820
|
+
chainId: "421613",
|
|
821
|
+
blockTime: 1e3,
|
|
822
|
+
addressHrp: "0x",
|
|
823
|
+
apiUrl: "https://goerli-rollup.arbitrum.io/rpc",
|
|
824
|
+
nativeToken: "ETH"
|
|
825
|
+
},
|
|
826
|
+
mainnet: {
|
|
827
|
+
displayName: "Arbitrum",
|
|
828
|
+
chainId: "42161",
|
|
829
|
+
blockTime: 1e3,
|
|
830
|
+
addressHrp: "0x",
|
|
831
|
+
apiUrl: "https://arb1.arbitrum.io/rpc",
|
|
832
|
+
nativeToken: "ETH"
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
// src/chains/base.ts
|
|
837
|
+
var getBaseAdapter = createEvmAdapter("base", "base", {
|
|
838
|
+
mainnet: {
|
|
839
|
+
displayName: "Base",
|
|
840
|
+
chainId: "8453",
|
|
841
|
+
blockTime: 2e3,
|
|
842
|
+
addressHrp: "0x",
|
|
843
|
+
apiUrl: "https://mainnet.base.org",
|
|
844
|
+
nativeToken: "ETH"
|
|
845
|
+
},
|
|
846
|
+
testnet: {
|
|
847
|
+
displayName: "Base",
|
|
848
|
+
chainId: "84531",
|
|
849
|
+
blockTime: 2e3,
|
|
850
|
+
addressHrp: "0x",
|
|
851
|
+
apiUrl: "https://goerli.base.org",
|
|
852
|
+
nativeToken: "ETH"
|
|
853
|
+
},
|
|
854
|
+
devnet: {
|
|
855
|
+
displayName: "Base",
|
|
856
|
+
chainId: "84532",
|
|
857
|
+
blockTime: 2e3,
|
|
858
|
+
addressHrp: "0x",
|
|
859
|
+
apiUrl: "https://sepolia.base.org",
|
|
860
|
+
nativeToken: "ETH"
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
// src/chains/ethereum.ts
|
|
865
|
+
var getEthereumAdapter = createEvmAdapter("ethereum", "eth", {
|
|
866
|
+
devnet: {
|
|
867
|
+
displayName: "Ethereum Devnet",
|
|
868
|
+
chainId: "11155111",
|
|
869
|
+
blockTime: 12e3,
|
|
870
|
+
addressHrp: "0x",
|
|
871
|
+
apiUrl: "https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY",
|
|
872
|
+
nativeToken: "ETH"
|
|
873
|
+
},
|
|
874
|
+
testnet: {
|
|
875
|
+
displayName: "Ethereum Testnet",
|
|
876
|
+
chainId: "5",
|
|
877
|
+
blockTime: 12e3,
|
|
878
|
+
addressHrp: "0x",
|
|
879
|
+
apiUrl: "https://eth-goerli.g.alchemy.com/v2/YOUR_API_KEY",
|
|
880
|
+
nativeToken: "ETH"
|
|
881
|
+
},
|
|
882
|
+
mainnet: {
|
|
883
|
+
displayName: "Ethereum Mainnet",
|
|
884
|
+
chainId: "1",
|
|
885
|
+
blockTime: 12e3,
|
|
886
|
+
addressHrp: "0x",
|
|
887
|
+
apiUrl: "https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY",
|
|
888
|
+
nativeToken: "ETH"
|
|
889
|
+
}
|
|
890
|
+
});
|
|
891
|
+
|
|
892
|
+
// src/chains/combined.ts
|
|
893
|
+
var getAllEvmAdapters = (config, fallback) => [
|
|
894
|
+
getEthereumAdapter(config, fallback),
|
|
895
|
+
getArbitrumAdapter(config, fallback),
|
|
896
|
+
getBaseAdapter(config, fallback)
|
|
897
|
+
];
|
|
766
898
|
export {
|
|
899
|
+
ArbitrumExplorers,
|
|
900
|
+
BaseExplorers,
|
|
767
901
|
EVM_CHAIN_CONFIGS,
|
|
902
|
+
EthereumExplorers,
|
|
903
|
+
EvmExplorers,
|
|
904
|
+
ExplorerUrls,
|
|
768
905
|
WarpEvmBuilder,
|
|
769
906
|
WarpEvmConstants,
|
|
770
907
|
WarpEvmExecutor,
|
|
@@ -776,13 +913,7 @@ export {
|
|
|
776
913
|
getBaseAdapter,
|
|
777
914
|
getEthereumAdapter,
|
|
778
915
|
getEvmApiUrl,
|
|
779
|
-
getEvmBlockTime,
|
|
780
916
|
getEvmChainConfig,
|
|
781
|
-
|
|
782
|
-
getEvmExplorerUrl,
|
|
783
|
-
getEvmNativeToken,
|
|
784
|
-
getEvmRegistryAddress,
|
|
785
|
-
getSupportedEnvironments,
|
|
786
|
-
getSupportedEvmChains
|
|
917
|
+
getEvmExplorerUrl
|
|
787
918
|
};
|
|
788
919
|
//# sourceMappingURL=index.mjs.map
|