@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.js
CHANGED
|
@@ -20,7 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
ArbitrumExplorers: () => ArbitrumExplorers,
|
|
24
|
+
BaseExplorers: () => BaseExplorers,
|
|
23
25
|
EVM_CHAIN_CONFIGS: () => EVM_CHAIN_CONFIGS,
|
|
26
|
+
EthereumExplorers: () => EthereumExplorers,
|
|
27
|
+
EvmExplorers: () => EvmExplorers,
|
|
28
|
+
ExplorerUrls: () => ExplorerUrls,
|
|
24
29
|
WarpEvmBuilder: () => WarpEvmBuilder,
|
|
25
30
|
WarpEvmConstants: () => WarpEvmConstants,
|
|
26
31
|
WarpEvmExecutor: () => WarpEvmExecutor,
|
|
@@ -32,17 +37,14 @@ __export(index_exports, {
|
|
|
32
37
|
getBaseAdapter: () => getBaseAdapter,
|
|
33
38
|
getEthereumAdapter: () => getEthereumAdapter,
|
|
34
39
|
getEvmApiUrl: () => getEvmApiUrl,
|
|
35
|
-
getEvmBlockTime: () => getEvmBlockTime,
|
|
36
40
|
getEvmChainConfig: () => getEvmChainConfig,
|
|
37
|
-
|
|
38
|
-
getEvmExplorerUrl: () => getEvmExplorerUrl,
|
|
39
|
-
getEvmNativeToken: () => getEvmNativeToken,
|
|
40
|
-
getEvmRegistryAddress: () => getEvmRegistryAddress,
|
|
41
|
-
getSupportedEnvironments: () => getSupportedEnvironments,
|
|
42
|
-
getSupportedEvmChains: () => getSupportedEvmChains
|
|
41
|
+
getEvmExplorerUrl: () => getEvmExplorerUrl
|
|
43
42
|
});
|
|
44
43
|
module.exports = __toCommonJS(index_exports);
|
|
45
44
|
|
|
45
|
+
// src/WarpEvmBuilder.ts
|
|
46
|
+
var import_ethers = require("ethers");
|
|
47
|
+
|
|
46
48
|
// src/config.ts
|
|
47
49
|
var EVM_CHAIN_CONFIGS = {
|
|
48
50
|
ethereum: {
|
|
@@ -52,7 +54,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
52
54
|
chainId: "1",
|
|
53
55
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
54
56
|
nativeToken: "ETH",
|
|
55
|
-
blockTime:
|
|
57
|
+
blockTime: 12e3
|
|
56
58
|
},
|
|
57
59
|
testnet: {
|
|
58
60
|
apiUrl: "https://eth-sepolia.g.alchemy.com/v2/demo",
|
|
@@ -60,7 +62,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
60
62
|
chainId: "11155111",
|
|
61
63
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
62
64
|
nativeToken: "ETH",
|
|
63
|
-
blockTime:
|
|
65
|
+
blockTime: 12e3
|
|
64
66
|
},
|
|
65
67
|
devnet: {
|
|
66
68
|
apiUrl: "http://localhost:8545",
|
|
@@ -68,7 +70,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
68
70
|
chainId: "1337",
|
|
69
71
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
70
72
|
nativeToken: "ETH",
|
|
71
|
-
blockTime:
|
|
73
|
+
blockTime: 12e3
|
|
72
74
|
}
|
|
73
75
|
},
|
|
74
76
|
arbitrum: {
|
|
@@ -78,7 +80,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
78
80
|
chainId: "42161",
|
|
79
81
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
80
82
|
nativeToken: "ETH",
|
|
81
|
-
blockTime:
|
|
83
|
+
blockTime: 1e3
|
|
82
84
|
},
|
|
83
85
|
testnet: {
|
|
84
86
|
apiUrl: "https://arb-sepolia.g.alchemy.com/v2/demo",
|
|
@@ -86,7 +88,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
86
88
|
chainId: "421614",
|
|
87
89
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
88
90
|
nativeToken: "ETH",
|
|
89
|
-
blockTime:
|
|
91
|
+
blockTime: 1e3
|
|
90
92
|
},
|
|
91
93
|
devnet: {
|
|
92
94
|
apiUrl: "http://localhost:8545",
|
|
@@ -94,7 +96,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
94
96
|
chainId: "1337",
|
|
95
97
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
96
98
|
nativeToken: "ETH",
|
|
97
|
-
blockTime:
|
|
99
|
+
blockTime: 1e3
|
|
98
100
|
}
|
|
99
101
|
},
|
|
100
102
|
base: {
|
|
@@ -104,7 +106,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
104
106
|
chainId: "8453",
|
|
105
107
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
106
108
|
nativeToken: "ETH",
|
|
107
|
-
blockTime:
|
|
109
|
+
blockTime: 2e3
|
|
108
110
|
},
|
|
109
111
|
testnet: {
|
|
110
112
|
apiUrl: "https://sepolia.base.org",
|
|
@@ -112,7 +114,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
112
114
|
chainId: "84532",
|
|
113
115
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
114
116
|
nativeToken: "ETH",
|
|
115
|
-
blockTime:
|
|
117
|
+
blockTime: 2e3
|
|
116
118
|
},
|
|
117
119
|
devnet: {
|
|
118
120
|
apiUrl: "http://localhost:8545",
|
|
@@ -120,7 +122,7 @@ var EVM_CHAIN_CONFIGS = {
|
|
|
120
122
|
chainId: "1337",
|
|
121
123
|
registryAddress: "0x0000000000000000000000000000000000000000",
|
|
122
124
|
nativeToken: "ETH",
|
|
123
|
-
blockTime:
|
|
125
|
+
blockTime: 2e3
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
};
|
|
@@ -142,94 +144,8 @@ var getEvmApiUrl = (env, chain = DEFAULT_CHAIN) => {
|
|
|
142
144
|
var getEvmExplorerUrl = (env, chain = DEFAULT_CHAIN) => {
|
|
143
145
|
return getEvmChainConfig(chain, env).explorerUrl;
|
|
144
146
|
};
|
|
145
|
-
var getEvmChainId = (env, chain = DEFAULT_CHAIN) => {
|
|
146
|
-
return getEvmChainConfig(chain, env).chainId;
|
|
147
|
-
};
|
|
148
|
-
var getEvmRegistryAddress = (env, chain = DEFAULT_CHAIN) => {
|
|
149
|
-
return getEvmChainConfig(chain, env).registryAddress;
|
|
150
|
-
};
|
|
151
|
-
var getEvmNativeToken = (env, chain = DEFAULT_CHAIN) => {
|
|
152
|
-
return getEvmChainConfig(chain, env).nativeToken;
|
|
153
|
-
};
|
|
154
|
-
var getEvmBlockTime = (env, chain = DEFAULT_CHAIN) => {
|
|
155
|
-
return getEvmChainConfig(chain, env).blockTime || 12;
|
|
156
|
-
};
|
|
157
|
-
var getSupportedEvmChains = () => {
|
|
158
|
-
return Object.keys(EVM_CHAIN_CONFIGS);
|
|
159
|
-
};
|
|
160
|
-
var getSupportedEnvironments = (chain) => {
|
|
161
|
-
const chainConfigs = EVM_CHAIN_CONFIGS[chain];
|
|
162
|
-
if (!chainConfigs) {
|
|
163
|
-
return [];
|
|
164
|
-
}
|
|
165
|
-
return Object.keys(chainConfigs);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// src/constants.ts
|
|
169
|
-
var WarpEvmConstants = {
|
|
170
|
-
// Native token configuration
|
|
171
|
-
Ether: {
|
|
172
|
-
Identifier: "ETH",
|
|
173
|
-
DisplayName: "Ether",
|
|
174
|
-
Decimals: 18
|
|
175
|
-
},
|
|
176
|
-
// Gas configuration
|
|
177
|
-
GasLimit: {
|
|
178
|
-
Default: 21e3,
|
|
179
|
-
ContractCall: 1e5,
|
|
180
|
-
ContractDeploy: 5e5,
|
|
181
|
-
Transfer: 21e3,
|
|
182
|
-
Approve: 46e3,
|
|
183
|
-
Swap: 2e5
|
|
184
|
-
},
|
|
185
|
-
GasPrice: {
|
|
186
|
-
Default: "20000000000",
|
|
187
|
-
// 20 gwei
|
|
188
|
-
Low: "10000000000",
|
|
189
|
-
// 10 gwei
|
|
190
|
-
Medium: "20000000000",
|
|
191
|
-
// 20 gwei
|
|
192
|
-
High: "50000000000"
|
|
193
|
-
// 50 gwei
|
|
194
|
-
},
|
|
195
|
-
// Supported networks
|
|
196
|
-
Networks: {
|
|
197
|
-
Ethereum: {
|
|
198
|
-
ChainId: "1",
|
|
199
|
-
Name: "Ethereum",
|
|
200
|
-
BlockTime: 12
|
|
201
|
-
},
|
|
202
|
-
Arbitrum: {
|
|
203
|
-
ChainId: "42161",
|
|
204
|
-
Name: "Arbitrum",
|
|
205
|
-
BlockTime: 1
|
|
206
|
-
},
|
|
207
|
-
Base: {
|
|
208
|
-
ChainId: "8453",
|
|
209
|
-
Name: "Base",
|
|
210
|
-
BlockTime: 2
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
// Validation rules
|
|
214
|
-
Validation: {
|
|
215
|
-
AddressLength: 42,
|
|
216
|
-
HexPrefix: "0x",
|
|
217
|
-
MinGasLimit: 21e3,
|
|
218
|
-
MaxGasLimit: 3e7
|
|
219
|
-
},
|
|
220
|
-
// Timeout configuration
|
|
221
|
-
Timeouts: {
|
|
222
|
-
DefaultRpcTimeout: 3e4,
|
|
223
|
-
// 30 seconds
|
|
224
|
-
GasEstimationTimeout: 1e4,
|
|
225
|
-
// 10 seconds
|
|
226
|
-
QueryTimeout: 15e3
|
|
227
|
-
// 15 seconds
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
147
|
|
|
231
148
|
// src/WarpEvmBuilder.ts
|
|
232
|
-
var import_ethers = require("ethers");
|
|
233
149
|
var WarpEvmBuilder = class {
|
|
234
150
|
constructor(config) {
|
|
235
151
|
this.config = config;
|
|
@@ -328,6 +244,79 @@ var WarpEvmBuilder = class {
|
|
|
328
244
|
var import_warps3 = require("@vleap/warps");
|
|
329
245
|
var import_ethers3 = require("ethers");
|
|
330
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
|
+
|
|
331
320
|
// src/WarpEvmResults.ts
|
|
332
321
|
var import_warps2 = require("@vleap/warps");
|
|
333
322
|
|
|
@@ -571,7 +560,7 @@ var WarpEvmExecutor = class {
|
|
|
571
560
|
return tx;
|
|
572
561
|
}
|
|
573
562
|
async createTransferTransaction(executable) {
|
|
574
|
-
const userWallet = this.config.user?.wallets?.[executable.chain
|
|
563
|
+
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
575
564
|
if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
|
|
576
565
|
if (!import_ethers3.ethers.isAddress(executable.destination)) {
|
|
577
566
|
throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
|
|
@@ -587,7 +576,7 @@ var WarpEvmExecutor = class {
|
|
|
587
576
|
return this.estimateGasAndSetDefaults(tx, userWallet);
|
|
588
577
|
}
|
|
589
578
|
async createContractCallTransaction(executable) {
|
|
590
|
-
const userWallet = this.config.user?.wallets?.[executable.chain
|
|
579
|
+
const userWallet = this.config.user?.wallets?.[executable.chain];
|
|
591
580
|
if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
|
|
592
581
|
const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
|
|
593
582
|
if (!action || !("func" in action) || !action.func) {
|
|
@@ -638,24 +627,12 @@ var WarpEvmExecutor = class {
|
|
|
638
627
|
executable.action,
|
|
639
628
|
executable.resolvedInputs
|
|
640
629
|
);
|
|
641
|
-
const
|
|
642
|
-
chain: "ethereum",
|
|
643
|
-
prefix: "eth",
|
|
644
|
-
builder: () => ({}),
|
|
645
|
-
executor: {},
|
|
646
|
-
results: {},
|
|
647
|
-
serializer: {},
|
|
648
|
-
registry: {},
|
|
649
|
-
explorer: () => ({}),
|
|
650
|
-
abiBuilder: () => ({}),
|
|
651
|
-
brandBuilder: () => ({})
|
|
652
|
-
};
|
|
653
|
-
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);
|
|
654
631
|
return {
|
|
655
632
|
success: isSuccess,
|
|
656
633
|
warp: executable.warp,
|
|
657
634
|
action: executable.action,
|
|
658
|
-
user: this.config.user?.wallets?.[executable.chain
|
|
635
|
+
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
659
636
|
txHash: null,
|
|
660
637
|
next,
|
|
661
638
|
values,
|
|
@@ -667,7 +644,7 @@ var WarpEvmExecutor = class {
|
|
|
667
644
|
success: false,
|
|
668
645
|
warp: executable.warp,
|
|
669
646
|
action: executable.action,
|
|
670
|
-
user: this.config.user?.wallets?.[executable.chain
|
|
647
|
+
user: this.config.user?.wallets?.[executable.chain] || null,
|
|
671
648
|
txHash: null,
|
|
672
649
|
next: null,
|
|
673
650
|
values: [],
|
|
@@ -757,49 +734,208 @@ var WarpEvmExecutor = class {
|
|
|
757
734
|
|
|
758
735
|
// src/WarpEvmExplorer.ts
|
|
759
736
|
var WarpEvmExplorer = class {
|
|
760
|
-
constructor(
|
|
761
|
-
this.
|
|
762
|
-
this.
|
|
737
|
+
constructor(chain, config) {
|
|
738
|
+
this.chain = chain;
|
|
739
|
+
this.config = config;
|
|
763
740
|
}
|
|
764
|
-
|
|
765
|
-
const
|
|
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
|
+
}
|
|
756
|
+
getExplorerUrlByName(explorer) {
|
|
757
|
+
const userPreference = this.config.preferences?.explorers?.[this.chain];
|
|
758
|
+
if (userPreference && !explorer) {
|
|
759
|
+
const url2 = ExplorerUrls[userPreference];
|
|
760
|
+
if (url2) return url2;
|
|
761
|
+
}
|
|
762
|
+
if (explorer) {
|
|
763
|
+
const url2 = ExplorerUrls[explorer];
|
|
764
|
+
if (url2) return url2;
|
|
765
|
+
}
|
|
766
|
+
const primaryExplorer = this.getPrimaryExplorer();
|
|
767
|
+
const url = ExplorerUrls[primaryExplorer];
|
|
768
|
+
return url || ExplorerUrls[primaryExplorer];
|
|
769
|
+
}
|
|
770
|
+
getAccountUrl(address, explorer) {
|
|
771
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
766
772
|
return `${baseUrl}/address/${address}`;
|
|
767
773
|
}
|
|
768
|
-
getTransactionUrl(hash) {
|
|
769
|
-
const baseUrl = this.
|
|
774
|
+
getTransactionUrl(hash, explorer) {
|
|
775
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
770
776
|
return `${baseUrl}/tx/${hash}`;
|
|
771
777
|
}
|
|
778
|
+
getBlockUrl(blockNumber, explorer) {
|
|
779
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
780
|
+
return `${baseUrl}/block/${blockNumber}`;
|
|
781
|
+
}
|
|
782
|
+
getTokenUrl(tokenAddress, explorer) {
|
|
783
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
784
|
+
return `${baseUrl}/token/${tokenAddress}`;
|
|
785
|
+
}
|
|
786
|
+
getContractUrl(contractAddress, explorer) {
|
|
787
|
+
const baseUrl = this.getExplorerUrlByName(explorer);
|
|
788
|
+
return `${baseUrl}/address/${contractAddress}`;
|
|
789
|
+
}
|
|
790
|
+
getAllExplorers() {
|
|
791
|
+
return this.getExplorers();
|
|
792
|
+
}
|
|
793
|
+
getExplorerByName(name) {
|
|
794
|
+
const explorers = this.getExplorers();
|
|
795
|
+
return explorers.find((explorer) => explorer.toLowerCase() === name.toLowerCase());
|
|
796
|
+
}
|
|
797
|
+
getAccountUrls(address) {
|
|
798
|
+
const explorers = this.getAllExplorers();
|
|
799
|
+
const urls = {};
|
|
800
|
+
explorers.forEach((explorer) => {
|
|
801
|
+
const url = ExplorerUrls[explorer];
|
|
802
|
+
if (url) {
|
|
803
|
+
urls[explorer] = `${url}/address/${address}`;
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
return urls;
|
|
807
|
+
}
|
|
808
|
+
getTransactionUrls(hash) {
|
|
809
|
+
const explorers = this.getAllExplorers();
|
|
810
|
+
const urls = {};
|
|
811
|
+
explorers.forEach((explorer) => {
|
|
812
|
+
const url = ExplorerUrls[explorer];
|
|
813
|
+
if (url) {
|
|
814
|
+
urls[explorer] = `${url}/tx/${hash}`;
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
return urls;
|
|
818
|
+
}
|
|
772
819
|
};
|
|
773
820
|
|
|
774
|
-
// src/
|
|
775
|
-
var
|
|
776
|
-
var getArbitrumAdapter = createEvmAdapter("arbitrum", "arb");
|
|
777
|
-
var getBaseAdapter = createEvmAdapter("base", "base");
|
|
778
|
-
var getAllEvmAdapters = (config, fallback) => [
|
|
779
|
-
getEthereumAdapter(config, fallback),
|
|
780
|
-
getArbitrumAdapter(config, fallback),
|
|
781
|
-
getBaseAdapter(config, fallback)
|
|
782
|
-
];
|
|
783
|
-
function createEvmAdapter(chainName, chainPrefix) {
|
|
821
|
+
// src/chains/common.ts
|
|
822
|
+
var createEvmAdapter = (chainName, chainPrefix, chainInfos) => {
|
|
784
823
|
return (config, fallback) => {
|
|
785
824
|
if (!fallback) throw new Error(`${chainName} adapter requires a fallback adapter`);
|
|
786
825
|
return {
|
|
787
826
|
chain: chainName,
|
|
827
|
+
chainInfo: chainInfos[config.env],
|
|
788
828
|
prefix: chainPrefix,
|
|
789
829
|
builder: () => new WarpEvmBuilder(config),
|
|
790
830
|
executor: new WarpEvmExecutor(config),
|
|
791
831
|
results: new WarpEvmResults(config),
|
|
792
832
|
serializer: new WarpEvmSerializer(),
|
|
793
833
|
registry: fallback.registry,
|
|
794
|
-
explorer:
|
|
834
|
+
explorer: new WarpEvmExplorer(chainInfos[config.env], config),
|
|
795
835
|
abiBuilder: () => fallback.abiBuilder(),
|
|
796
836
|
brandBuilder: () => fallback.brandBuilder()
|
|
797
837
|
};
|
|
798
838
|
};
|
|
799
|
-
}
|
|
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
|
+
];
|
|
800
931
|
// Annotate the CommonJS export names for ESM import in node:
|
|
801
932
|
0 && (module.exports = {
|
|
933
|
+
ArbitrumExplorers,
|
|
934
|
+
BaseExplorers,
|
|
802
935
|
EVM_CHAIN_CONFIGS,
|
|
936
|
+
EthereumExplorers,
|
|
937
|
+
EvmExplorers,
|
|
938
|
+
ExplorerUrls,
|
|
803
939
|
WarpEvmBuilder,
|
|
804
940
|
WarpEvmConstants,
|
|
805
941
|
WarpEvmExecutor,
|
|
@@ -811,13 +947,7 @@ function createEvmAdapter(chainName, chainPrefix) {
|
|
|
811
947
|
getBaseAdapter,
|
|
812
948
|
getEthereumAdapter,
|
|
813
949
|
getEvmApiUrl,
|
|
814
|
-
getEvmBlockTime,
|
|
815
950
|
getEvmChainConfig,
|
|
816
|
-
|
|
817
|
-
getEvmExplorerUrl,
|
|
818
|
-
getEvmNativeToken,
|
|
819
|
-
getEvmRegistryAddress,
|
|
820
|
-
getSupportedEnvironments,
|
|
821
|
-
getSupportedEvmChains
|
|
951
|
+
getEvmExplorerUrl
|
|
822
952
|
});
|
|
823
953
|
//# sourceMappingURL=index.js.map
|