@vleap/warps-adapter-evm 0.2.0-alpha.4 → 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 +30 -32
- package/dist/index.d.ts +30 -32
- package/dist/index.js +208 -167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +207 -161
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,80 +1,5 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
3
|
-
GasLimit: {
|
|
4
|
-
Default: 21e3,
|
|
5
|
-
ContractCall: 1e5,
|
|
6
|
-
ContractDeploy: 5e5,
|
|
7
|
-
Transfer: 21e3,
|
|
8
|
-
Approve: 46e3,
|
|
9
|
-
Swap: 2e5
|
|
10
|
-
},
|
|
11
|
-
GasPrice: {
|
|
12
|
-
Default: "20000000000"
|
|
13
|
-
},
|
|
14
|
-
Validation: {
|
|
15
|
-
MinGasLimit: 21e3,
|
|
16
|
-
MaxGasLimit: 3e7
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
var EthereumExplorers = /* @__PURE__ */ ((EthereumExplorers2) => {
|
|
20
|
-
EthereumExplorers2["Etherscan"] = "etherscan";
|
|
21
|
-
EthereumExplorers2["EtherscanSepolia"] = "etherscan_sepolia";
|
|
22
|
-
EthereumExplorers2["Ethplorer"] = "ethplorer";
|
|
23
|
-
EthereumExplorers2["Blockscout"] = "blockscout";
|
|
24
|
-
EthereumExplorers2["BlockscoutSepolia"] = "blockscout_sepolia";
|
|
25
|
-
return EthereumExplorers2;
|
|
26
|
-
})(EthereumExplorers || {});
|
|
27
|
-
var ArbitrumExplorers = /* @__PURE__ */ ((ArbitrumExplorers2) => {
|
|
28
|
-
ArbitrumExplorers2["Arbiscan"] = "arbiscan";
|
|
29
|
-
ArbitrumExplorers2["ArbiscanSepolia"] = "arbiscan_sepolia";
|
|
30
|
-
ArbitrumExplorers2["BlockscoutArbitrum"] = "blockscout_arbitrum";
|
|
31
|
-
ArbitrumExplorers2["BlockscoutArbitrumSepolia"] = "blockscout_arbitrum_sepolia";
|
|
32
|
-
return ArbitrumExplorers2;
|
|
33
|
-
})(ArbitrumExplorers || {});
|
|
34
|
-
var BaseExplorers = /* @__PURE__ */ ((BaseExplorers2) => {
|
|
35
|
-
BaseExplorers2["Basescan"] = "basescan";
|
|
36
|
-
BaseExplorers2["BasescanSepolia"] = "basescan_sepolia";
|
|
37
|
-
BaseExplorers2["BlockscoutBase"] = "blockscout_base";
|
|
38
|
-
BaseExplorers2["BlockscoutBaseSepolia"] = "blockscout_base_sepolia";
|
|
39
|
-
return BaseExplorers2;
|
|
40
|
-
})(BaseExplorers || {});
|
|
41
|
-
var LocalExplorers = /* @__PURE__ */ ((LocalExplorers2) => {
|
|
42
|
-
LocalExplorers2["LocalBlockscout"] = "local_blockscout";
|
|
43
|
-
return LocalExplorers2;
|
|
44
|
-
})(LocalExplorers || {});
|
|
45
|
-
var EvmExplorers = {
|
|
46
|
-
ethereum: {
|
|
47
|
-
mainnet: ["etherscan" /* Etherscan */, "ethplorer" /* Ethplorer */, "blockscout" /* Blockscout */],
|
|
48
|
-
testnet: ["etherscan_sepolia" /* EtherscanSepolia */, "blockscout_sepolia" /* BlockscoutSepolia */],
|
|
49
|
-
devnet: ["local_blockscout" /* LocalBlockscout */]
|
|
50
|
-
},
|
|
51
|
-
arbitrum: {
|
|
52
|
-
mainnet: ["arbiscan" /* Arbiscan */, "blockscout_arbitrum" /* BlockscoutArbitrum */],
|
|
53
|
-
testnet: ["arbiscan_sepolia" /* ArbiscanSepolia */, "blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */],
|
|
54
|
-
devnet: ["local_blockscout" /* LocalBlockscout */]
|
|
55
|
-
},
|
|
56
|
-
base: {
|
|
57
|
-
mainnet: ["basescan" /* Basescan */, "blockscout_base" /* BlockscoutBase */],
|
|
58
|
-
testnet: ["basescan_sepolia" /* BasescanSepolia */, "blockscout_base_sepolia" /* BlockscoutBaseSepolia */],
|
|
59
|
-
devnet: ["local_blockscout" /* LocalBlockscout */]
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
var ExplorerUrls = {
|
|
63
|
-
["etherscan" /* Etherscan */]: "https://etherscan.io",
|
|
64
|
-
["etherscan_sepolia" /* EtherscanSepolia */]: "https://sepolia.etherscan.io",
|
|
65
|
-
["ethplorer" /* Ethplorer */]: "https://ethplorer.io",
|
|
66
|
-
["blockscout" /* Blockscout */]: "https://eth.blockscout.com",
|
|
67
|
-
["blockscout_sepolia" /* BlockscoutSepolia */]: "https://sepolia.blockscout.com",
|
|
68
|
-
["arbiscan" /* Arbiscan */]: "https://arbiscan.io",
|
|
69
|
-
["arbiscan_sepolia" /* ArbiscanSepolia */]: "https://sepolia.arbiscan.io",
|
|
70
|
-
["blockscout_arbitrum" /* BlockscoutArbitrum */]: "https://arbitrum.blockscout.com",
|
|
71
|
-
["blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */]: "https://sepolia.blockscout.com",
|
|
72
|
-
["basescan" /* Basescan */]: "https://basescan.org",
|
|
73
|
-
["basescan_sepolia" /* BasescanSepolia */]: "https://sepolia.basescan.org",
|
|
74
|
-
["blockscout_base" /* BlockscoutBase */]: "https://base.blockscout.com",
|
|
75
|
-
["blockscout_base_sepolia" /* BlockscoutBaseSepolia */]: "https://sepolia.blockscout.com",
|
|
76
|
-
["local_blockscout" /* LocalBlockscout */]: "http://localhost:4000"
|
|
77
|
-
};
|
|
1
|
+
// src/WarpEvmBuilder.ts
|
|
2
|
+
import { ethers } from "ethers";
|
|
78
3
|
|
|
79
4
|
// src/config.ts
|
|
80
5
|
var EVM_CHAIN_CONFIGS = {
|
|
@@ -85,7 +10,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
85
10
|
chainId: "1",
|
|
86
11
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
87
12
|
nativeToken: "ETH",
|
|
88
|
-
blockTime:
|
|
13
|
+
blockTime: 12e3
|
|
89
14
|
},
|
|
90
15
|
testnet: {
|
|
91
16
|
apiUrl: "https://eth-sepolia.g.alchemy.com/v2/demo",
|
|
@@ -93,7 +18,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
93
18
|
chainId: "11155111",
|
|
94
19
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
95
20
|
nativeToken: "ETH",
|
|
96
|
-
blockTime:
|
|
21
|
+
blockTime: 12e3
|
|
97
22
|
},
|
|
98
23
|
devnet: {
|
|
99
24
|
apiUrl: "http://localhost:8545",
|
|
@@ -101,7 +26,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
101
26
|
chainId: "1337",
|
|
102
27
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
103
28
|
nativeToken: "ETH",
|
|
104
|
-
blockTime:
|
|
29
|
+
blockTime: 12e3
|
|
105
30
|
}
|
|
106
31
|
},
|
|
107
32
|
arbitrum: {
|
|
@@ -111,7 +36,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
111
36
|
chainId: "42161",
|
|
112
37
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
113
38
|
nativeToken: "ETH",
|
|
114
|
-
blockTime:
|
|
39
|
+
blockTime: 1e3
|
|
115
40
|
},
|
|
116
41
|
testnet: {
|
|
117
42
|
apiUrl: "https://arb-sepolia.g.alchemy.com/v2/demo",
|
|
@@ -119,7 +44,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
119
44
|
chainId: "421614",
|
|
120
45
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
121
46
|
nativeToken: "ETH",
|
|
122
|
-
blockTime:
|
|
47
|
+
blockTime: 1e3
|
|
123
48
|
},
|
|
124
49
|
devnet: {
|
|
125
50
|
apiUrl: "http://localhost:8545",
|
|
@@ -127,7 +52,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
127
52
|
chainId: "1337",
|
|
128
53
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
129
54
|
nativeToken: "ETH",
|
|
130
|
-
blockTime:
|
|
55
|
+
blockTime: 1e3
|
|
131
56
|
}
|
|
132
57
|
},
|
|
133
58
|
base: {
|
|
@@ -137,7 +62,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
137
62
|
chainId: "8453",
|
|
138
63
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
139
64
|
nativeToken: "ETH",
|
|
140
|
-
blockTime:
|
|
65
|
+
blockTime: 2e3
|
|
141
66
|
},
|
|
142
67
|
testnet: {
|
|
143
68
|
apiUrl: "https://sepolia.base.org",
|
|
@@ -145,7 +70,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
145
70
|
chainId: "84532",
|
|
146
71
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
147
72
|
nativeToken: "ETH",
|
|
148
|
-
blockTime:
|
|
73
|
+
blockTime: 2e3
|
|
149
74
|
},
|
|
150
75
|
devnet: {
|
|
151
76
|
apiUrl: "http://localhost:8545",
|
|
@@ -153,7 +78,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
153
78
|
chainId: "1337",
|
|
154
79
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
155
80
|
nativeToken: "ETH",
|
|
156
|
-
blockTime:
|
|
81
|
+
blockTime: 2e3
|
|
157
82
|
}
|
|
158
83
|
}
|
|
159
84
|
};
|
|
@@ -175,35 +100,8 @@ var getEvmApiUrl = (env, chain = DEFAULT_CHAIN) => {
|
|
|
175
100
|
var getEvmExplorerUrl = (env, chain = DEFAULT_CHAIN) => {
|
|
176
101
|
return getEvmChainConfig(chain, env).explorerUrl;
|
|
177
102
|
};
|
|
178
|
-
var getEvmExplorers = (chain = DEFAULT_CHAIN, env) => {
|
|
179
|
-
const chainExplorers = EvmExplorers[chain];
|
|
180
|
-
if (!chainExplorers) {
|
|
181
|
-
throw new Error(`Unsupported EVM chain: ${chain}`);
|
|
182
|
-
}
|
|
183
|
-
const explorers = chainExplorers[env];
|
|
184
|
-
if (!explorers) {
|
|
185
|
-
throw new Error(`Unsupported environment ${env} for chain ${chain}`);
|
|
186
|
-
}
|
|
187
|
-
return explorers;
|
|
188
|
-
};
|
|
189
|
-
var getPrimaryEvmExplorer = (chain = DEFAULT_CHAIN, env) => {
|
|
190
|
-
const explorers = getEvmExplorers(chain, env);
|
|
191
|
-
return explorers[0];
|
|
192
|
-
};
|
|
193
|
-
var getEvmExplorerUrlByName = (explorerName) => {
|
|
194
|
-
const url = ExplorerUrls[explorerName];
|
|
195
|
-
if (!url) {
|
|
196
|
-
throw new Error(`Unsupported explorer: ${explorerName}`);
|
|
197
|
-
}
|
|
198
|
-
return url;
|
|
199
|
-
};
|
|
200
|
-
var getEvmExplorerByName = (chain = DEFAULT_CHAIN, env, name) => {
|
|
201
|
-
const explorers = getEvmExplorers(chain, env);
|
|
202
|
-
return explorers.find((explorer) => explorer.toLowerCase() === name.toLowerCase());
|
|
203
|
-
};
|
|
204
103
|
|
|
205
104
|
// src/WarpEvmBuilder.ts
|
|
206
|
-
import { ethers } from "ethers";
|
|
207
105
|
var WarpEvmBuilder = class {
|
|
208
106
|
constructor(config) {
|
|
209
107
|
this.config = config;
|
|
@@ -306,6 +204,79 @@ import {
|
|
|
306
204
|
} from "@vleap/warps";
|
|
307
205
|
import { ethers as ethers3 } from "ethers";
|
|
308
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
|
+
|
|
309
280
|
// src/WarpEvmResults.ts
|
|
310
281
|
import {
|
|
311
282
|
evaluateResultsCommon,
|
|
@@ -556,7 +527,7 @@ var WarpEvmExecutor = class {
|
|
|
556
527
|
return tx;
|
|
557
528
|
}
|
|
558
529
|
async createTransferTransaction(executable) {
|
|
559
|
-
const userWallet = this.config.user?.wallets?.[executable.chain
|
|
530
|
+
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
560
531
|
if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
|
|
561
532
|
if (!ethers3.isAddress(executable.destination)) {
|
|
562
533
|
throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
|
|
@@ -572,7 +543,7 @@ var WarpEvmExecutor = class {
|
|
|
572
543
|
return this.estimateGasAndSetDefaults(tx, userWallet);
|
|
573
544
|
}
|
|
574
545
|
async createContractCallTransaction(executable) {
|
|
575
|
-
const userWallet = this.config.user?.wallets?.[executable.chain
|
|
546
|
+
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
576
547
|
if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
|
|
577
548
|
const action = getWarpActionByIndex(executable.warp, executable.action);
|
|
578
549
|
if (!action || !("func" in action) || !action.func) {
|
|
@@ -623,24 +594,12 @@ var WarpEvmExecutor = class {
|
|
|
623
594
|
executable.action,
|
|
624
595
|
executable.resolvedInputs
|
|
625
596
|
);
|
|
626
|
-
const
|
|
627
|
-
chain: "ethereum",
|
|
628
|
-
prefix: "eth",
|
|
629
|
-
builder: () => ({}),
|
|
630
|
-
executor: {},
|
|
631
|
-
results: {},
|
|
632
|
-
serializer: {},
|
|
633
|
-
registry: {},
|
|
634
|
-
explorer: () => ({}),
|
|
635
|
-
abiBuilder: () => ({}),
|
|
636
|
-
brandBuilder: () => ({})
|
|
637
|
-
};
|
|
638
|
-
const next = getNextInfo(this.config, mockAdapter, executable.warp, executable.action, results);
|
|
597
|
+
const next = getNextInfo(this.config, [], executable.warp, executable.action, results);
|
|
639
598
|
return {
|
|
640
599
|
success: isSuccess,
|
|
641
600
|
warp: executable.warp,
|
|
642
601
|
action: executable.action,
|
|
643
|
-
user: this.config.user?.wallets?.[executable.chain
|
|
602
|
+
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
644
603
|
txHash: null,
|
|
645
604
|
next,
|
|
646
605
|
values,
|
|
@@ -652,7 +611,7 @@ var WarpEvmExecutor = class {
|
|
|
652
611
|
success: false,
|
|
653
612
|
warp: executable.warp,
|
|
654
613
|
action: executable.action,
|
|
655
|
-
user: this.config.user?.wallets?.[executable.chain
|
|
614
|
+
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
656
615
|
txHash: null,
|
|
657
616
|
next: null,
|
|
658
617
|
values: [],
|
|
@@ -746,8 +705,23 @@ var WarpEvmExplorer = class {
|
|
|
746
705
|
this.chain = chain;
|
|
747
706
|
this.config = config;
|
|
748
707
|
}
|
|
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
|
+
}
|
|
749
723
|
getExplorerUrlByName(explorer) {
|
|
750
|
-
const userPreference = this.
|
|
724
|
+
const userPreference = this.config.preferences?.explorers?.[this.chain];
|
|
751
725
|
if (userPreference && !explorer) {
|
|
752
726
|
const url2 = ExplorerUrls[userPreference];
|
|
753
727
|
if (url2) return url2;
|
|
@@ -756,9 +730,9 @@ var WarpEvmExplorer = class {
|
|
|
756
730
|
const url2 = ExplorerUrls[explorer];
|
|
757
731
|
if (url2) return url2;
|
|
758
732
|
}
|
|
759
|
-
const primaryExplorer =
|
|
733
|
+
const primaryExplorer = this.getPrimaryExplorer();
|
|
760
734
|
const url = ExplorerUrls[primaryExplorer];
|
|
761
|
-
return url ||
|
|
735
|
+
return url || ExplorerUrls[primaryExplorer];
|
|
762
736
|
}
|
|
763
737
|
getAccountUrl(address, explorer) {
|
|
764
738
|
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
@@ -781,18 +755,11 @@ var WarpEvmExplorer = class {
|
|
|
781
755
|
return `${baseUrl}/address/${contractAddress}`;
|
|
782
756
|
}
|
|
783
757
|
getAllExplorers() {
|
|
784
|
-
|
|
785
|
-
return getEvmExplorers(this.chain.name, this.config.env);
|
|
786
|
-
} catch {
|
|
787
|
-
return ["Default"];
|
|
788
|
-
}
|
|
758
|
+
return this.getExplorers();
|
|
789
759
|
}
|
|
790
760
|
getExplorerByName(name) {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
} catch {
|
|
794
|
-
return void 0;
|
|
795
|
-
}
|
|
761
|
+
const explorers = this.getExplorers();
|
|
762
|
+
return explorers.find((explorer) => explorer.toLowerCase() === name.toLowerCase());
|
|
796
763
|
}
|
|
797
764
|
getAccountUrls(address) {
|
|
798
765
|
const explorers = this.getAllExplorers();
|
|
@@ -818,32 +785,116 @@ var WarpEvmExplorer = class {
|
|
|
818
785
|
}
|
|
819
786
|
};
|
|
820
787
|
|
|
821
|
-
// src/
|
|
822
|
-
var
|
|
823
|
-
var getArbitrumAdapter = createEvmAdapter("arbitrum", "arb");
|
|
824
|
-
var getBaseAdapter = createEvmAdapter("base", "base");
|
|
825
|
-
var getAllEvmAdapters = (config, fallback) => [
|
|
826
|
-
getEthereumAdapter(config, fallback),
|
|
827
|
-
getArbitrumAdapter(config, fallback),
|
|
828
|
-
getBaseAdapter(config, fallback)
|
|
829
|
-
];
|
|
830
|
-
function createEvmAdapter(chainName, chainPrefix) {
|
|
788
|
+
// src/chains/common.ts
|
|
789
|
+
var createEvmAdapter = (chainName, chainPrefix, chainInfos) => {
|
|
831
790
|
return (config, fallback) => {
|
|
832
791
|
if (!fallback) throw new Error(`${chainName} adapter requires a fallback adapter`);
|
|
833
792
|
return {
|
|
834
793
|
chain: chainName,
|
|
794
|
+
chainInfo: chainInfos[config.env],
|
|
835
795
|
prefix: chainPrefix,
|
|
836
796
|
builder: () => new WarpEvmBuilder(config),
|
|
837
797
|
executor: new WarpEvmExecutor(config),
|
|
838
798
|
results: new WarpEvmResults(config),
|
|
839
799
|
serializer: new WarpEvmSerializer(),
|
|
840
800
|
registry: fallback.registry,
|
|
841
|
-
explorer:
|
|
801
|
+
explorer: new WarpEvmExplorer(chainInfos[config.env], config),
|
|
842
802
|
abiBuilder: () => fallback.abiBuilder(),
|
|
843
803
|
brandBuilder: () => fallback.brandBuilder()
|
|
844
804
|
};
|
|
845
805
|
};
|
|
846
|
-
}
|
|
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
|
+
];
|
|
847
898
|
export {
|
|
848
899
|
ArbitrumExplorers,
|
|
849
900
|
BaseExplorers,
|
|
@@ -851,7 +902,6 @@ export {
|
|
|
851
902
|
EthereumExplorers,
|
|
852
903
|
EvmExplorers,
|
|
853
904
|
ExplorerUrls,
|
|
854
|
-
LocalExplorers,
|
|
855
905
|
WarpEvmBuilder,
|
|
856
906
|
WarpEvmConstants,
|
|
857
907
|
WarpEvmExecutor,
|
|
@@ -864,10 +914,6 @@ export {
|
|
|
864
914
|
getEthereumAdapter,
|
|
865
915
|
getEvmApiUrl,
|
|
866
916
|
getEvmChainConfig,
|
|
867
|
-
|
|
868
|
-
getEvmExplorerUrl,
|
|
869
|
-
getEvmExplorerUrlByName,
|
|
870
|
-
getEvmExplorers,
|
|
871
|
-
getPrimaryEvmExplorer
|
|
917
|
+
getEvmExplorerUrl
|
|
872
918
|
};
|
|
873
919
|
//# sourceMappingURL=index.mjs.map
|