@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.js
CHANGED
|
@@ -26,7 +26,6 @@ __export(index_exports, {
|
|
|
26
26
|
EthereumExplorers: () => EthereumExplorers,
|
|
27
27
|
EvmExplorers: () => EvmExplorers,
|
|
28
28
|
ExplorerUrls: () => ExplorerUrls,
|
|
29
|
-
LocalExplorers: () => LocalExplorers,
|
|
30
29
|
WarpEvmBuilder: () => WarpEvmBuilder,
|
|
31
30
|
WarpEvmConstants: () => WarpEvmConstants,
|
|
32
31
|
WarpEvmExecutor: () => WarpEvmExecutor,
|
|
@@ -39,91 +38,12 @@ __export(index_exports, {
|
|
|
39
38
|
getEthereumAdapter: () => getEthereumAdapter,
|
|
40
39
|
getEvmApiUrl: () => getEvmApiUrl,
|
|
41
40
|
getEvmChainConfig: () => getEvmChainConfig,
|
|
42
|
-
|
|
43
|
-
getEvmExplorerUrl: () => getEvmExplorerUrl,
|
|
44
|
-
getEvmExplorerUrlByName: () => getEvmExplorerUrlByName,
|
|
45
|
-
getEvmExplorers: () => getEvmExplorers,
|
|
46
|
-
getPrimaryEvmExplorer: () => getPrimaryEvmExplorer
|
|
41
|
+
getEvmExplorerUrl: () => getEvmExplorerUrl
|
|
47
42
|
});
|
|
48
43
|
module.exports = __toCommonJS(index_exports);
|
|
49
44
|
|
|
50
|
-
// src/
|
|
51
|
-
var
|
|
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
|
-
};
|
|
45
|
+
// src/WarpEvmBuilder.ts
|
|
46
|
+
var import_ethers = require("ethers");
|
|
127
47
|
|
|
128
48
|
// src/config.ts
|
|
129
49
|
var EVM_CHAIN_CONFIGS = {
|
|
@@ -134,7 +54,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
134
54
|
chainId: "1",
|
|
135
55
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
136
56
|
nativeToken: "ETH",
|
|
137
|
-
blockTime:
|
|
57
|
+
blockTime: 12e3
|
|
138
58
|
},
|
|
139
59
|
testnet: {
|
|
140
60
|
apiUrl: "https://eth-sepolia.g.alchemy.com/v2/demo",
|
|
@@ -142,7 +62,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
142
62
|
chainId: "11155111",
|
|
143
63
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
144
64
|
nativeToken: "ETH",
|
|
145
|
-
blockTime:
|
|
65
|
+
blockTime: 12e3
|
|
146
66
|
},
|
|
147
67
|
devnet: {
|
|
148
68
|
apiUrl: "http://localhost:8545",
|
|
@@ -150,7 +70,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
150
70
|
chainId: "1337",
|
|
151
71
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
152
72
|
nativeToken: "ETH",
|
|
153
|
-
blockTime:
|
|
73
|
+
blockTime: 12e3
|
|
154
74
|
}
|
|
155
75
|
},
|
|
156
76
|
arbitrum: {
|
|
@@ -160,7 +80,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
160
80
|
chainId: "42161",
|
|
161
81
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
162
82
|
nativeToken: "ETH",
|
|
163
|
-
blockTime:
|
|
83
|
+
blockTime: 1e3
|
|
164
84
|
},
|
|
165
85
|
testnet: {
|
|
166
86
|
apiUrl: "https://arb-sepolia.g.alchemy.com/v2/demo",
|
|
@@ -168,7 +88,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
168
88
|
chainId: "421614",
|
|
169
89
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
170
90
|
nativeToken: "ETH",
|
|
171
|
-
blockTime:
|
|
91
|
+
blockTime: 1e3
|
|
172
92
|
},
|
|
173
93
|
devnet: {
|
|
174
94
|
apiUrl: "http://localhost:8545",
|
|
@@ -176,7 +96,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
176
96
|
chainId: "1337",
|
|
177
97
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
178
98
|
nativeToken: "ETH",
|
|
179
|
-
blockTime:
|
|
99
|
+
blockTime: 1e3
|
|
180
100
|
}
|
|
181
101
|
},
|
|
182
102
|
base: {
|
|
@@ -186,7 +106,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
186
106
|
chainId: "8453",
|
|
187
107
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
188
108
|
nativeToken: "ETH",
|
|
189
|
-
blockTime:
|
|
109
|
+
blockTime: 2e3
|
|
190
110
|
},
|
|
191
111
|
testnet: {
|
|
192
112
|
apiUrl: "https://sepolia.base.org",
|
|
@@ -194,7 +114,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
194
114
|
chainId: "84532",
|
|
195
115
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
196
116
|
nativeToken: "ETH",
|
|
197
|
-
blockTime:
|
|
117
|
+
blockTime: 2e3
|
|
198
118
|
},
|
|
199
119
|
devnet: {
|
|
200
120
|
apiUrl: "http://localhost:8545",
|
|
@@ -202,7 +122,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
202
122
|
chainId: "1337",
|
|
203
123
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
204
124
|
nativeToken: "ETH",
|
|
205
|
-
blockTime:
|
|
125
|
+
blockTime: 2e3
|
|
206
126
|
}
|
|
207
127
|
}
|
|
208
128
|
};
|
|
@@ -224,35 +144,8 @@ var getEvmApiUrl = (env, chain = DEFAULT_CHAIN) => {
|
|
|
224
144
|
var getEvmExplorerUrl = (env, chain = DEFAULT_CHAIN) => {
|
|
225
145
|
return getEvmChainConfig(chain, env).explorerUrl;
|
|
226
146
|
};
|
|
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;
|
|
237
|
-
};
|
|
238
|
-
var getPrimaryEvmExplorer = (chain = DEFAULT_CHAIN, env) => {
|
|
239
|
-
const explorers = getEvmExplorers(chain, env);
|
|
240
|
-
return explorers[0];
|
|
241
|
-
};
|
|
242
|
-
var getEvmExplorerUrlByName = (explorerName) => {
|
|
243
|
-
const url = ExplorerUrls[explorerName];
|
|
244
|
-
if (!url) {
|
|
245
|
-
throw new Error(`Unsupported explorer: ${explorerName}`);
|
|
246
|
-
}
|
|
247
|
-
return url;
|
|
248
|
-
};
|
|
249
|
-
var getEvmExplorerByName = (chain = DEFAULT_CHAIN, env, name) => {
|
|
250
|
-
const explorers = getEvmExplorers(chain, env);
|
|
251
|
-
return explorers.find((explorer) => explorer.toLowerCase() === name.toLowerCase());
|
|
252
|
-
};
|
|
253
147
|
|
|
254
148
|
// src/WarpEvmBuilder.ts
|
|
255
|
-
var import_ethers = require("ethers");
|
|
256
149
|
var WarpEvmBuilder = class {
|
|
257
150
|
constructor(config) {
|
|
258
151
|
this.config = config;
|
|
@@ -351,6 +244,79 @@ var WarpEvmBuilder = class {
|
|
|
351
244
|
var import_warps3 = require("@vleap/warps");
|
|
352
245
|
var import_ethers3 = require("ethers");
|
|
353
246
|
|
|
247
|
+
// src/constants.ts
|
|
248
|
+
var WarpEvmConstants = {
|
|
249
|
+
GasLimit: {
|
|
250
|
+
Default: 21e3,
|
|
251
|
+
ContractCall: 1e5,
|
|
252
|
+
ContractDeploy: 5e5,
|
|
253
|
+
Transfer: 21e3,
|
|
254
|
+
Approve: 46e3,
|
|
255
|
+
Swap: 2e5
|
|
256
|
+
},
|
|
257
|
+
GasPrice: {
|
|
258
|
+
Default: "20000000000"
|
|
259
|
+
},
|
|
260
|
+
Validation: {
|
|
261
|
+
MinGasLimit: 21e3,
|
|
262
|
+
MaxGasLimit: 3e7
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
var EthereumExplorers = /* @__PURE__ */ ((EthereumExplorers2) => {
|
|
266
|
+
EthereumExplorers2["Etherscan"] = "etherscan";
|
|
267
|
+
EthereumExplorers2["EtherscanSepolia"] = "etherscan_sepolia";
|
|
268
|
+
EthereumExplorers2["Ethplorer"] = "ethplorer";
|
|
269
|
+
EthereumExplorers2["Blockscout"] = "blockscout";
|
|
270
|
+
EthereumExplorers2["BlockscoutSepolia"] = "blockscout_sepolia";
|
|
271
|
+
return EthereumExplorers2;
|
|
272
|
+
})(EthereumExplorers || {});
|
|
273
|
+
var ArbitrumExplorers = /* @__PURE__ */ ((ArbitrumExplorers2) => {
|
|
274
|
+
ArbitrumExplorers2["Arbiscan"] = "arbiscan";
|
|
275
|
+
ArbitrumExplorers2["ArbiscanSepolia"] = "arbiscan_sepolia";
|
|
276
|
+
ArbitrumExplorers2["BlockscoutArbitrum"] = "blockscout_arbitrum";
|
|
277
|
+
ArbitrumExplorers2["BlockscoutArbitrumSepolia"] = "blockscout_arbitrum_sepolia";
|
|
278
|
+
return ArbitrumExplorers2;
|
|
279
|
+
})(ArbitrumExplorers || {});
|
|
280
|
+
var BaseExplorers = /* @__PURE__ */ ((BaseExplorers2) => {
|
|
281
|
+
BaseExplorers2["Basescan"] = "basescan";
|
|
282
|
+
BaseExplorers2["BasescanSepolia"] = "basescan_sepolia";
|
|
283
|
+
BaseExplorers2["BlockscoutBase"] = "blockscout_base";
|
|
284
|
+
BaseExplorers2["BlockscoutBaseSepolia"] = "blockscout_base_sepolia";
|
|
285
|
+
return BaseExplorers2;
|
|
286
|
+
})(BaseExplorers || {});
|
|
287
|
+
var EvmExplorers = {
|
|
288
|
+
ethereum: {
|
|
289
|
+
mainnet: ["etherscan" /* Etherscan */, "ethplorer" /* Ethplorer */, "blockscout" /* Blockscout */],
|
|
290
|
+
testnet: ["etherscan_sepolia" /* EtherscanSepolia */, "blockscout_sepolia" /* BlockscoutSepolia */],
|
|
291
|
+
devnet: ["etherscan_sepolia" /* EtherscanSepolia */, "blockscout_sepolia" /* BlockscoutSepolia */]
|
|
292
|
+
},
|
|
293
|
+
arbitrum: {
|
|
294
|
+
mainnet: ["arbiscan" /* Arbiscan */, "blockscout_arbitrum" /* BlockscoutArbitrum */],
|
|
295
|
+
testnet: ["arbiscan_sepolia" /* ArbiscanSepolia */, "blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */],
|
|
296
|
+
devnet: ["arbiscan_sepolia" /* ArbiscanSepolia */, "blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */]
|
|
297
|
+
},
|
|
298
|
+
base: {
|
|
299
|
+
mainnet: ["basescan" /* Basescan */, "blockscout_base" /* BlockscoutBase */],
|
|
300
|
+
testnet: ["basescan_sepolia" /* BasescanSepolia */, "blockscout_base_sepolia" /* BlockscoutBaseSepolia */],
|
|
301
|
+
devnet: ["basescan_sepolia" /* BasescanSepolia */, "blockscout_base_sepolia" /* BlockscoutBaseSepolia */]
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
var ExplorerUrls = {
|
|
305
|
+
["etherscan" /* Etherscan */]: "https://etherscan.io",
|
|
306
|
+
["etherscan_sepolia" /* EtherscanSepolia */]: "https://sepolia.etherscan.io",
|
|
307
|
+
["ethplorer" /* Ethplorer */]: "https://ethplorer.io",
|
|
308
|
+
["blockscout" /* Blockscout */]: "https://eth.blockscout.com",
|
|
309
|
+
["blockscout_sepolia" /* BlockscoutSepolia */]: "https://sepolia.blockscout.com",
|
|
310
|
+
["arbiscan" /* Arbiscan */]: "https://arbiscan.io",
|
|
311
|
+
["arbiscan_sepolia" /* ArbiscanSepolia */]: "https://sepolia.arbiscan.io",
|
|
312
|
+
["blockscout_arbitrum" /* BlockscoutArbitrum */]: "https://arbitrum.blockscout.com",
|
|
313
|
+
["blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */]: "https://sepolia.blockscout.com",
|
|
314
|
+
["basescan" /* Basescan */]: "https://basescan.org",
|
|
315
|
+
["basescan_sepolia" /* BasescanSepolia */]: "https://sepolia.basescan.org",
|
|
316
|
+
["blockscout_base" /* BlockscoutBase */]: "https://base.blockscout.com",
|
|
317
|
+
["blockscout_base_sepolia" /* BlockscoutBaseSepolia */]: "https://sepolia.blockscout.com"
|
|
318
|
+
};
|
|
319
|
+
|
|
354
320
|
// src/WarpEvmResults.ts
|
|
355
321
|
var import_warps2 = require("@vleap/warps");
|
|
356
322
|
|
|
@@ -594,7 +560,7 @@ var WarpEvmExecutor = class {
|
|
|
594
560
|
return tx;
|
|
595
561
|
}
|
|
596
562
|
async createTransferTransaction(executable) {
|
|
597
|
-
const userWallet = this.config.user?.wallets?.[executable.chain
|
|
563
|
+
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
598
564
|
if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
|
|
599
565
|
if (!import_ethers3.ethers.isAddress(executable.destination)) {
|
|
600
566
|
throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
|
|
@@ -610,7 +576,7 @@ var WarpEvmExecutor = class {
|
|
|
610
576
|
return this.estimateGasAndSetDefaults(tx, userWallet);
|
|
611
577
|
}
|
|
612
578
|
async createContractCallTransaction(executable) {
|
|
613
|
-
const userWallet = this.config.user?.wallets?.[executable.chain
|
|
579
|
+
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
614
580
|
if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
|
|
615
581
|
const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
|
|
616
582
|
if (!action || !("func" in action) || !action.func) {
|
|
@@ -661,24 +627,12 @@ var WarpEvmExecutor = class {
|
|
|
661
627
|
executable.action,
|
|
662
628
|
executable.resolvedInputs
|
|
663
629
|
);
|
|
664
|
-
const
|
|
665
|
-
chain: "ethereum",
|
|
666
|
-
prefix: "eth",
|
|
667
|
-
builder: () => ({}),
|
|
668
|
-
executor: {},
|
|
669
|
-
results: {},
|
|
670
|
-
serializer: {},
|
|
671
|
-
registry: {},
|
|
672
|
-
explorer: () => ({}),
|
|
673
|
-
abiBuilder: () => ({}),
|
|
674
|
-
brandBuilder: () => ({})
|
|
675
|
-
};
|
|
676
|
-
const next = (0, import_warps3.getNextInfo)(this.config, mockAdapter, executable.warp, executable.action, results);
|
|
630
|
+
const next = (0, import_warps3.getNextInfo)(this.config, [], executable.warp, executable.action, results);
|
|
677
631
|
return {
|
|
678
632
|
success: isSuccess,
|
|
679
633
|
warp: executable.warp,
|
|
680
634
|
action: executable.action,
|
|
681
|
-
user: this.config.user?.wallets?.[executable.chain
|
|
635
|
+
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
682
636
|
txHash: null,
|
|
683
637
|
next,
|
|
684
638
|
values,
|
|
@@ -690,7 +644,7 @@ var WarpEvmExecutor = class {
|
|
|
690
644
|
success: false,
|
|
691
645
|
warp: executable.warp,
|
|
692
646
|
action: executable.action,
|
|
693
|
-
user: this.config.user?.wallets?.[executable.chain
|
|
647
|
+
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
694
648
|
txHash: null,
|
|
695
649
|
next: null,
|
|
696
650
|
values: [],
|
|
@@ -784,8 +738,23 @@ var WarpEvmExplorer = class {
|
|
|
784
738
|
this.chain = chain;
|
|
785
739
|
this.config = config;
|
|
786
740
|
}
|
|
741
|
+
getExplorers() {
|
|
742
|
+
const chainExplorers = EvmExplorers[this.chain];
|
|
743
|
+
if (!chainExplorers) {
|
|
744
|
+
return ["Default"];
|
|
745
|
+
}
|
|
746
|
+
const explorers = chainExplorers[this.config.env];
|
|
747
|
+
if (!explorers) {
|
|
748
|
+
return ["Default"];
|
|
749
|
+
}
|
|
750
|
+
return explorers;
|
|
751
|
+
}
|
|
752
|
+
getPrimaryExplorer() {
|
|
753
|
+
const explorers = this.getExplorers();
|
|
754
|
+
return explorers[0];
|
|
755
|
+
}
|
|
787
756
|
getExplorerUrlByName(explorer) {
|
|
788
|
-
const userPreference = this.
|
|
757
|
+
const userPreference = this.config.preferences?.explorers?.[this.chain];
|
|
789
758
|
if (userPreference && !explorer) {
|
|
790
759
|
const url2 = ExplorerUrls[userPreference];
|
|
791
760
|
if (url2) return url2;
|
|
@@ -794,9 +763,9 @@ var WarpEvmExplorer = class {
|
|
|
794
763
|
const url2 = ExplorerUrls[explorer];
|
|
795
764
|
if (url2) return url2;
|
|
796
765
|
}
|
|
797
|
-
const primaryExplorer =
|
|
766
|
+
const primaryExplorer = this.getPrimaryExplorer();
|
|
798
767
|
const url = ExplorerUrls[primaryExplorer];
|
|
799
|
-
return url ||
|
|
768
|
+
return url || ExplorerUrls[primaryExplorer];
|
|
800
769
|
}
|
|
801
770
|
getAccountUrl(address, explorer) {
|
|
802
771
|
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
@@ -819,18 +788,11 @@ var WarpEvmExplorer = class {
|
|
|
819
788
|
return `${baseUrl}/address/${contractAddress}`;
|
|
820
789
|
}
|
|
821
790
|
getAllExplorers() {
|
|
822
|
-
|
|
823
|
-
return getEvmExplorers(this.chain.name, this.config.env);
|
|
824
|
-
} catch {
|
|
825
|
-
return ["Default"];
|
|
826
|
-
}
|
|
791
|
+
return this.getExplorers();
|
|
827
792
|
}
|
|
828
793
|
getExplorerByName(name) {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
} catch {
|
|
832
|
-
return void 0;
|
|
833
|
-
}
|
|
794
|
+
const explorers = this.getExplorers();
|
|
795
|
+
return explorers.find((explorer) => explorer.toLowerCase() === name.toLowerCase());
|
|
834
796
|
}
|
|
835
797
|
getAccountUrls(address) {
|
|
836
798
|
const explorers = this.getAllExplorers();
|
|
@@ -856,32 +818,116 @@ var WarpEvmExplorer = class {
|
|
|
856
818
|
}
|
|
857
819
|
};
|
|
858
820
|
|
|
859
|
-
// src/
|
|
860
|
-
var
|
|
861
|
-
var getArbitrumAdapter = createEvmAdapter("arbitrum", "arb");
|
|
862
|
-
var getBaseAdapter = createEvmAdapter("base", "base");
|
|
863
|
-
var getAllEvmAdapters = (config, fallback) => [
|
|
864
|
-
getEthereumAdapter(config, fallback),
|
|
865
|
-
getArbitrumAdapter(config, fallback),
|
|
866
|
-
getBaseAdapter(config, fallback)
|
|
867
|
-
];
|
|
868
|
-
function createEvmAdapter(chainName, chainPrefix) {
|
|
821
|
+
// src/chains/common.ts
|
|
822
|
+
var createEvmAdapter = (chainName, chainPrefix, chainInfos) => {
|
|
869
823
|
return (config, fallback) => {
|
|
870
824
|
if (!fallback) throw new Error(`${chainName} adapter requires a fallback adapter`);
|
|
871
825
|
return {
|
|
872
826
|
chain: chainName,
|
|
827
|
+
chainInfo: chainInfos[config.env],
|
|
873
828
|
prefix: chainPrefix,
|
|
874
829
|
builder: () => new WarpEvmBuilder(config),
|
|
875
830
|
executor: new WarpEvmExecutor(config),
|
|
876
831
|
results: new WarpEvmResults(config),
|
|
877
832
|
serializer: new WarpEvmSerializer(),
|
|
878
833
|
registry: fallback.registry,
|
|
879
|
-
explorer:
|
|
834
|
+
explorer: new WarpEvmExplorer(chainInfos[config.env], config),
|
|
880
835
|
abiBuilder: () => fallback.abiBuilder(),
|
|
881
836
|
brandBuilder: () => fallback.brandBuilder()
|
|
882
837
|
};
|
|
883
838
|
};
|
|
884
|
-
}
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
// src/chains/arbitrum.ts
|
|
842
|
+
var getArbitrumAdapter = createEvmAdapter("arbitrum", "arb", {
|
|
843
|
+
devnet: {
|
|
844
|
+
displayName: "Arbitrum Devnet",
|
|
845
|
+
chainId: "421614",
|
|
846
|
+
blockTime: 1e3,
|
|
847
|
+
addressHrp: "0x",
|
|
848
|
+
apiUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
849
|
+
nativeToken: "ETH"
|
|
850
|
+
},
|
|
851
|
+
testnet: {
|
|
852
|
+
displayName: "Arbitrum Testnet",
|
|
853
|
+
chainId: "421613",
|
|
854
|
+
blockTime: 1e3,
|
|
855
|
+
addressHrp: "0x",
|
|
856
|
+
apiUrl: "https://goerli-rollup.arbitrum.io/rpc",
|
|
857
|
+
nativeToken: "ETH"
|
|
858
|
+
},
|
|
859
|
+
mainnet: {
|
|
860
|
+
displayName: "Arbitrum",
|
|
861
|
+
chainId: "42161",
|
|
862
|
+
blockTime: 1e3,
|
|
863
|
+
addressHrp: "0x",
|
|
864
|
+
apiUrl: "https://arb1.arbitrum.io/rpc",
|
|
865
|
+
nativeToken: "ETH"
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
// src/chains/base.ts
|
|
870
|
+
var getBaseAdapter = createEvmAdapter("base", "base", {
|
|
871
|
+
mainnet: {
|
|
872
|
+
displayName: "Base",
|
|
873
|
+
chainId: "8453",
|
|
874
|
+
blockTime: 2e3,
|
|
875
|
+
addressHrp: "0x",
|
|
876
|
+
apiUrl: "https://mainnet.base.org",
|
|
877
|
+
nativeToken: "ETH"
|
|
878
|
+
},
|
|
879
|
+
testnet: {
|
|
880
|
+
displayName: "Base",
|
|
881
|
+
chainId: "84531",
|
|
882
|
+
blockTime: 2e3,
|
|
883
|
+
addressHrp: "0x",
|
|
884
|
+
apiUrl: "https://goerli.base.org",
|
|
885
|
+
nativeToken: "ETH"
|
|
886
|
+
},
|
|
887
|
+
devnet: {
|
|
888
|
+
displayName: "Base",
|
|
889
|
+
chainId: "84532",
|
|
890
|
+
blockTime: 2e3,
|
|
891
|
+
addressHrp: "0x",
|
|
892
|
+
apiUrl: "https://sepolia.base.org",
|
|
893
|
+
nativeToken: "ETH"
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
// src/chains/ethereum.ts
|
|
898
|
+
var getEthereumAdapter = createEvmAdapter("ethereum", "eth", {
|
|
899
|
+
devnet: {
|
|
900
|
+
displayName: "Ethereum Devnet",
|
|
901
|
+
chainId: "11155111",
|
|
902
|
+
blockTime: 12e3,
|
|
903
|
+
addressHrp: "0x",
|
|
904
|
+
apiUrl: "https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY",
|
|
905
|
+
nativeToken: "ETH"
|
|
906
|
+
},
|
|
907
|
+
testnet: {
|
|
908
|
+
displayName: "Ethereum Testnet",
|
|
909
|
+
chainId: "5",
|
|
910
|
+
blockTime: 12e3,
|
|
911
|
+
addressHrp: "0x",
|
|
912
|
+
apiUrl: "https://eth-goerli.g.alchemy.com/v2/YOUR_API_KEY",
|
|
913
|
+
nativeToken: "ETH"
|
|
914
|
+
},
|
|
915
|
+
mainnet: {
|
|
916
|
+
displayName: "Ethereum Mainnet",
|
|
917
|
+
chainId: "1",
|
|
918
|
+
blockTime: 12e3,
|
|
919
|
+
addressHrp: "0x",
|
|
920
|
+
apiUrl: "https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY",
|
|
921
|
+
nativeToken: "ETH"
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
// src/chains/combined.ts
|
|
926
|
+
var getAllEvmAdapters = (config, fallback) => [
|
|
927
|
+
getEthereumAdapter(config, fallback),
|
|
928
|
+
getArbitrumAdapter(config, fallback),
|
|
929
|
+
getBaseAdapter(config, fallback)
|
|
930
|
+
];
|
|
885
931
|
// Annotate the CommonJS export names for ESM import in node:
|
|
886
932
|
0 && (module.exports = {
|
|
887
933
|
ArbitrumExplorers,
|
|
@@ -890,7 +936,6 @@ function createEvmAdapter(chainName, chainPrefix) {
|
|
|
890
936
|
EthereumExplorers,
|
|
891
937
|
EvmExplorers,
|
|
892
938
|
ExplorerUrls,
|
|
893
|
-
LocalExplorers,
|
|
894
939
|
WarpEvmBuilder,
|
|
895
940
|
WarpEvmConstants,
|
|
896
941
|
WarpEvmExecutor,
|
|
@@ -903,10 +948,6 @@ function createEvmAdapter(chainName, chainPrefix) {
|
|
|
903
948
|
getEthereumAdapter,
|
|
904
949
|
getEvmApiUrl,
|
|
905
950
|
getEvmChainConfig,
|
|
906
|
-
|
|
907
|
-
getEvmExplorerUrl,
|
|
908
|
-
getEvmExplorerUrlByName,
|
|
909
|
-
getEvmExplorers,
|
|
910
|
-
getPrimaryEvmExplorer
|
|
951
|
+
getEvmExplorerUrl
|
|
911
952
|
});
|
|
912
953
|
//# sourceMappingURL=index.js.map
|