@vleap/warps-adapter-evm 0.2.0-alpha.3 → 0.2.0-alpha.30

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.js CHANGED
@@ -20,324 +20,573 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- EVM_CHAIN_CONFIGS: () => EVM_CHAIN_CONFIGS,
24
- WarpEvmBuilder: () => WarpEvmBuilder,
23
+ ArbitrumExplorers: () => ArbitrumExplorers,
24
+ BaseExplorers: () => BaseExplorers,
25
+ EthereumExplorers: () => EthereumExplorers,
26
+ EvmExplorers: () => EvmExplorers,
27
+ ExplorerUrls: () => ExplorerUrls,
28
+ KnownTokens: () => KnownTokens,
29
+ NativeTokenArb: () => NativeTokenArb,
30
+ NativeTokenBase: () => NativeTokenBase,
31
+ NativeTokenEth: () => NativeTokenEth,
32
+ UniswapService: () => UniswapService,
25
33
  WarpEvmConstants: () => WarpEvmConstants,
34
+ WarpEvmDataLoader: () => WarpEvmDataLoader,
26
35
  WarpEvmExecutor: () => WarpEvmExecutor,
27
36
  WarpEvmExplorer: () => WarpEvmExplorer,
28
37
  WarpEvmResults: () => WarpEvmResults,
29
38
  WarpEvmSerializer: () => WarpEvmSerializer,
39
+ WarpEvmWallet: () => WarpEvmWallet,
40
+ createEvmAdapter: () => createEvmAdapter,
41
+ findKnownTokenById: () => findKnownTokenById,
30
42
  getAllEvmAdapters: () => getAllEvmAdapters,
43
+ getAllEvmChainNames: () => getAllEvmChainNames,
31
44
  getArbitrumAdapter: () => getArbitrumAdapter,
32
45
  getBaseAdapter: () => getBaseAdapter,
33
46
  getEthereumAdapter: () => getEthereumAdapter,
34
- getEvmApiUrl: () => getEvmApiUrl,
35
- getEvmBlockTime: () => getEvmBlockTime,
36
- getEvmChainConfig: () => getEvmChainConfig,
37
- getEvmChainId: () => getEvmChainId,
38
- getEvmExplorerUrl: () => getEvmExplorerUrl,
39
- getEvmNativeToken: () => getEvmNativeToken,
40
- getEvmRegistryAddress: () => getEvmRegistryAddress,
41
- getSupportedEnvironments: () => getSupportedEnvironments,
42
- getSupportedEvmChains: () => getSupportedEvmChains
47
+ getKnownTokensForChain: () => getKnownTokensForChain
43
48
  });
44
49
  module.exports = __toCommonJS(index_exports);
45
50
 
46
- // src/config.ts
47
- var EVM_CHAIN_CONFIGS = {
48
- ethereum: {
49
- mainnet: {
50
- apiUrl: "https://eth-mainnet.g.alchemy.com/v2/demo",
51
- explorerUrl: "https://etherscan.io",
52
- chainId: "1",
53
- registryAddress: "0x0000000000000000000000000000000000000000",
54
- nativeToken: "ETH",
55
- blockTime: 12
56
- },
57
- testnet: {
58
- apiUrl: "https://eth-sepolia.g.alchemy.com/v2/demo",
59
- explorerUrl: "https://sepolia.etherscan.io",
60
- chainId: "11155111",
61
- registryAddress: "0x0000000000000000000000000000000000000000",
62
- nativeToken: "ETH",
63
- blockTime: 12
64
- },
65
- devnet: {
66
- apiUrl: "http://localhost:8545",
67
- explorerUrl: "http://localhost:4000",
68
- chainId: "1337",
69
- registryAddress: "0x0000000000000000000000000000000000000000",
70
- nativeToken: "ETH",
71
- blockTime: 12
51
+ // src/chains/arbitrum.ts
52
+ var import_warps12 = require("@vleap/warps");
53
+
54
+ // src/WarpEvmDataLoader.ts
55
+ var import_warps7 = require("@vleap/warps");
56
+ var import_ethers = require("ethers");
57
+
58
+ // src/providers/UniswapService.ts
59
+ var import_warps = require("@vleap/warps");
60
+ var _UniswapService = class _UniswapService {
61
+ constructor(cache, chainId) {
62
+ this.cache = cache;
63
+ this.chainId = chainId;
64
+ }
65
+ async getTokenList() {
66
+ try {
67
+ const response = await fetch(_UniswapService.UNISWAP_TOKEN_LIST_URL);
68
+ if (!response.ok) {
69
+ throw new Error(`Failed to fetch Uniswap token list: ${response.status}`);
70
+ }
71
+ const tokenList = await response.json();
72
+ return tokenList;
73
+ } catch (error) {
74
+ throw new Error(`Failed to fetch Uniswap token list: ${error}`);
72
75
  }
73
- },
74
- arbitrum: {
75
- mainnet: {
76
- apiUrl: "https://arb-mainnet.g.alchemy.com/v2/demo",
77
- explorerUrl: "https://arbiscan.io",
78
- chainId: "42161",
79
- registryAddress: "0x0000000000000000000000000000000000000000",
80
- nativeToken: "ETH",
81
- blockTime: 1
82
- },
83
- testnet: {
84
- apiUrl: "https://arb-sepolia.g.alchemy.com/v2/demo",
85
- explorerUrl: "https://sepolia.arbiscan.io",
86
- chainId: "421614",
87
- registryAddress: "0x0000000000000000000000000000000000000000",
88
- nativeToken: "ETH",
89
- blockTime: 1
90
- },
91
- devnet: {
92
- apiUrl: "http://localhost:8545",
93
- explorerUrl: "http://localhost:4000",
94
- chainId: "1337",
95
- registryAddress: "0x0000000000000000000000000000000000000000",
96
- nativeToken: "ETH",
97
- blockTime: 1
76
+ }
77
+ async findToken(address) {
78
+ const normalizedAddress = address.toLowerCase();
79
+ const cacheKey = `uniswap:token:${this.chainId}:${normalizedAddress}`;
80
+ const cachedToken = this.cache.get(cacheKey);
81
+ if (cachedToken) {
82
+ return cachedToken;
98
83
  }
99
- },
100
- base: {
101
- mainnet: {
102
- apiUrl: "https://mainnet.base.org",
103
- explorerUrl: "https://basescan.org",
104
- chainId: "8453",
105
- registryAddress: "0x0000000000000000000000000000000000000000",
106
- nativeToken: "ETH",
107
- blockTime: 2
108
- },
109
- testnet: {
110
- apiUrl: "https://sepolia.base.org",
111
- explorerUrl: "https://sepolia.basescan.org",
112
- chainId: "84532",
113
- registryAddress: "0x0000000000000000000000000000000000000000",
114
- nativeToken: "ETH",
115
- blockTime: 2
116
- },
117
- devnet: {
118
- apiUrl: "http://localhost:8545",
119
- explorerUrl: "http://localhost:4000",
120
- chainId: "1337",
121
- registryAddress: "0x0000000000000000000000000000000000000000",
122
- nativeToken: "ETH",
123
- blockTime: 2
84
+ try {
85
+ const tokenList = await this.getTokenList();
86
+ const token = tokenList.tokens.find((token2) => token2.address.toLowerCase() === normalizedAddress) || null;
87
+ if (token && token.chainId !== this.chainId) {
88
+ return null;
89
+ }
90
+ if (token) {
91
+ this.cache.set(cacheKey, token, import_warps.CacheTtl.OneHour);
92
+ } else {
93
+ this.cache.set(cacheKey, null, import_warps.CacheTtl.OneMinute * 5);
94
+ }
95
+ return token;
96
+ } catch (error) {
97
+ return null;
124
98
  }
125
99
  }
126
- };
127
- var DEFAULT_CHAIN = "ethereum";
128
- var getEvmChainConfig = (chain = DEFAULT_CHAIN, env) => {
129
- const chainConfigs = EVM_CHAIN_CONFIGS[chain];
130
- if (!chainConfigs) {
131
- throw new Error(`Unsupported EVM chain: ${chain}`);
132
- }
133
- const config = chainConfigs[env];
134
- if (!config) {
135
- throw new Error(`Unsupported environment ${env} for chain ${chain}`);
100
+ async getTokenMetadata(address) {
101
+ const normalizedAddress = address.toLowerCase();
102
+ const cacheKey = `uniswap:metadata:${this.chainId}:${normalizedAddress}`;
103
+ const cachedMetadata = this.cache.get(cacheKey);
104
+ if (cachedMetadata !== null) {
105
+ return cachedMetadata;
106
+ }
107
+ const token = await this.findToken(address);
108
+ if (!token) {
109
+ this.cache.set(cacheKey, null, import_warps.CacheTtl.OneMinute * 5);
110
+ return null;
111
+ }
112
+ const metadata = {
113
+ name: token.name,
114
+ symbol: token.symbol,
115
+ decimals: token.decimals,
116
+ logoUrl: token.logoURI
117
+ };
118
+ this.cache.set(cacheKey, metadata, import_warps.CacheTtl.OneHour);
119
+ return metadata;
136
120
  }
137
- return config;
138
- };
139
- var getEvmApiUrl = (env, chain = DEFAULT_CHAIN) => {
140
- return getEvmChainConfig(chain, env).apiUrl;
141
- };
142
- var getEvmExplorerUrl = (env, chain = DEFAULT_CHAIN) => {
143
- return getEvmChainConfig(chain, env).explorerUrl;
144
- };
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 [];
121
+ async getBridgeInfo(address) {
122
+ const normalizedAddress = address.toLowerCase();
123
+ const cacheKey = `uniswap:bridge:${this.chainId}:${normalizedAddress}`;
124
+ const cachedBridgeInfo = this.cache.get(cacheKey);
125
+ if (cachedBridgeInfo !== null) {
126
+ return cachedBridgeInfo;
127
+ }
128
+ const token = await this.findToken(address);
129
+ if (!token?.extensions?.bridgeInfo) {
130
+ this.cache.set(cacheKey, null, import_warps.CacheTtl.OneMinute * 5);
131
+ return null;
132
+ }
133
+ const bridgeInfo = {};
134
+ for (const [chainId, info] of Object.entries(token.extensions.bridgeInfo)) {
135
+ bridgeInfo[chainId] = info.tokenAddress;
136
+ }
137
+ this.cache.set(cacheKey, bridgeInfo, import_warps.CacheTtl.OneHour);
138
+ return bridgeInfo;
164
139
  }
165
- return Object.keys(chainConfigs);
166
140
  };
141
+ _UniswapService.UNISWAP_TOKEN_LIST_URL = "https://tokens.uniswap.org";
142
+ var UniswapService = _UniswapService;
167
143
 
168
- // src/constants.ts
169
- var WarpEvmConstants = {
170
- // Native token configuration
171
- Ether: {
172
- Identifier: "ETH",
173
- DisplayName: "Ether",
174
- Decimals: 18
144
+ // src/tokens/arbitrum.ts
145
+ var import_warps2 = require("@vleap/warps");
146
+ var ArbitrumChain = import_warps2.WarpChainName.Arbitrum;
147
+ var ArbitrumTokens = [
148
+ {
149
+ chain: ArbitrumChain,
150
+ identifier: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
151
+ name: "USD Coin",
152
+ symbol: "USDC",
153
+ decimals: 6,
154
+ logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
175
155
  },
176
- // Gas configuration
177
- GasLimit: {
178
- Default: 21e3,
179
- ContractCall: 1e5,
180
- ContractDeploy: 5e5,
181
- Transfer: 21e3,
182
- Approve: 46e3,
183
- Swap: 2e5
156
+ {
157
+ chain: ArbitrumChain,
158
+ identifier: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
159
+ name: "Tether USD",
160
+ symbol: "USDT",
161
+ decimals: 6,
162
+ logoUrl: "https://assets.coingecko.com/coins/images/325/small/Tether.png"
184
163
  },
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
164
+ {
165
+ chain: ArbitrumChain,
166
+ identifier: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
167
+ name: "Wrapped Ether",
168
+ symbol: "WETH",
169
+ decimals: 18,
170
+ logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
171
+ }
172
+ ];
173
+
174
+ // src/tokens/base.ts
175
+ var import_warps3 = require("@vleap/warps");
176
+ var BaseChain = import_warps3.WarpChainName.Base;
177
+ var BaseTokens = [
178
+ {
179
+ chain: BaseChain,
180
+ identifier: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
181
+ name: "USD Coin",
182
+ symbol: "USDC",
183
+ decimals: 6,
184
+ logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
194
185
  },
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
- }
186
+ {
187
+ chain: BaseChain,
188
+ identifier: "0x4200000000000000000000000000000000000006",
189
+ name: "Wrapped Ether",
190
+ symbol: "WETH",
191
+ decimals: 18,
192
+ logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
212
193
  },
213
- // Validation rules
214
- Validation: {
215
- AddressLength: 42,
216
- HexPrefix: "0x",
217
- MinGasLimit: 21e3,
218
- MaxGasLimit: 3e7
194
+ {
195
+ chain: BaseChain,
196
+ identifier: "0x808456652fdb597867f38412077A9182bf77359F",
197
+ name: "Euro",
198
+ symbol: "EURC",
199
+ decimals: 6,
200
+ logoUrl: "https://assets.coingecko.com/coins/images/26045/standard/euro.png"
219
201
  },
220
- // Timeout configuration
221
- Timeouts: {
222
- DefaultRpcTimeout: 3e4,
223
- // 30 seconds
224
- GasEstimationTimeout: 1e4,
225
- // 10 seconds
226
- QueryTimeout: 15e3
227
- // 15 seconds
202
+ {
203
+ chain: BaseChain,
204
+ fidentifier: "0xcbB7C0006F23900c38EB856149F799620fcb8A4a",
205
+ name: "Coinbase Wrapped BTC",
206
+ symbol: "CBETH",
207
+ decimals: 8,
208
+ logoUrl: "https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png"
228
209
  }
229
- };
210
+ ];
230
211
 
231
- // src/WarpEvmBuilder.ts
232
- var import_ethers = require("ethers");
233
- var WarpEvmBuilder = class {
234
- constructor(config) {
235
- this.config = config;
236
- this.warp = {};
237
- this.actions = [];
238
- }
239
- async createFromRaw(encoded) {
240
- try {
241
- const decoded = JSON.parse(encoded);
242
- return decoded;
243
- } catch (error) {
244
- throw new Error(`Failed to decode warp from raw data: ${error}`);
245
- }
246
- }
247
- setTitle(title) {
248
- this.warp.title = title;
249
- return this;
250
- }
251
- setDescription(description) {
252
- this.warp.description = description;
253
- return this;
212
+ // src/tokens/base-sepolia.ts
213
+ var import_warps4 = require("@vleap/warps");
214
+ var BaseChain2 = import_warps4.WarpChainName.Base;
215
+ var BaseSepoliaTokens = [
216
+ {
217
+ chain: BaseChain2,
218
+ identifier: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
219
+ name: "USD",
220
+ symbol: "USDC",
221
+ decimals: 6,
222
+ logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
223
+ },
224
+ {
225
+ chain: BaseChain2,
226
+ identifier: "0x808456652fdb597867f38412077A9182bf77359F",
227
+ name: "Euro",
228
+ symbol: "EURC",
229
+ decimals: 6,
230
+ logoUrl: "https://assets.coingecko.com/coins/images/26045/thumb/euro-coin.png?1655394420"
231
+ },
232
+ {
233
+ chain: BaseChain2,
234
+ identifier: "0xcbB7C0006F23900c38EB856149F799620fcb8A4a",
235
+ name: "Wrapped Bitcoin",
236
+ symbol: "WBTC",
237
+ decimals: 8,
238
+ logoUrl: "https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png"
254
239
  }
255
- setPreview(preview) {
256
- this.warp.preview = preview;
257
- return this;
240
+ ];
241
+
242
+ // src/tokens/ethereum.ts
243
+ var import_warps5 = require("@vleap/warps");
244
+ var EthereumChain = import_warps5.WarpChainName.Ethereum;
245
+ var EthereumTokens = [
246
+ {
247
+ chain: EthereumChain,
248
+ identifier: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
249
+ name: "USD Coin",
250
+ symbol: "USDC",
251
+ decimals: 6,
252
+ logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
253
+ },
254
+ {
255
+ chain: EthereumChain,
256
+ identifier: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
257
+ name: "Tether USD",
258
+ symbol: "USDT",
259
+ decimals: 6,
260
+ logoUrl: "https://assets.coingecko.com/coins/images/325/small/Tether.png"
261
+ },
262
+ {
263
+ chain: EthereumChain,
264
+ identifier: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
265
+ name: "Wrapped Bitcoin",
266
+ symbol: "WBTC",
267
+ decimals: 8,
268
+ logoUrl: "https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png"
269
+ },
270
+ {
271
+ chain: EthereumChain,
272
+ identifier: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
273
+ name: "Wrapped Ether",
274
+ symbol: "WETH",
275
+ decimals: 18,
276
+ logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
277
+ },
278
+ {
279
+ chain: EthereumChain,
280
+ identifier: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
281
+ name: "Dai Stablecoin",
282
+ symbol: "DAI",
283
+ decimals: 18,
284
+ logoUrl: "https://assets.coingecko.com/coins/images/9956/small/4943.png"
258
285
  }
259
- setActions(actions) {
260
- this.actions = actions;
261
- return this;
286
+ ];
287
+
288
+ // src/tokens/ethereum-sepolia.ts
289
+ var import_warps6 = require("@vleap/warps");
290
+ var EthereumChain2 = import_warps6.WarpChainName.Ethereum;
291
+ var EthereumSepoliaTokens = [
292
+ {
293
+ chain: EthereumChain2,
294
+ identifier: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
295
+ name: "USD Coin",
296
+ symbol: "USDC",
297
+ decimals: 6,
298
+ logoUrl: "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png"
299
+ },
300
+ {
301
+ chain: EthereumChain2,
302
+ identifier: "0x7169D38820dfd117C3FA1f22a697dBA58d90BA06",
303
+ name: "Tether USD",
304
+ symbol: "USDT",
305
+ decimals: 6,
306
+ logoUrl: "https://assets.coingecko.com/coins/images/325/small/Tether.png"
307
+ },
308
+ {
309
+ chain: EthereumChain2,
310
+ identifier: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
311
+ name: "Wrapped Ether",
312
+ symbol: "WETH",
313
+ decimals: 18,
314
+ logoUrl: "https://assets.coingecko.com/coins/images/2518/small/weth.png"
262
315
  }
263
- addAction(action) {
264
- this.actions.push(action);
265
- return this;
316
+ ];
317
+
318
+ // src/tokens.ts
319
+ var KnownTokens = {
320
+ ethereum: {
321
+ mainnet: EthereumTokens,
322
+ testnet: EthereumSepoliaTokens,
323
+ devnet: EthereumSepoliaTokens
324
+ },
325
+ base: {
326
+ mainnet: BaseTokens,
327
+ testnet: BaseSepoliaTokens,
328
+ devnet: BaseSepoliaTokens
329
+ },
330
+ arbitrum: {
331
+ mainnet: ArbitrumTokens
266
332
  }
267
- async build() {
268
- if (!this.warp.title) {
269
- throw new Error("Warp title is required");
270
- }
271
- return {
272
- protocol: "warp",
273
- name: this.warp.name || "evm-warp",
274
- title: this.warp.title,
275
- description: this.warp.description || null,
276
- preview: this.warp.preview || null,
277
- actions: this.actions,
278
- meta: {
279
- chain: "evm",
280
- hash: import_ethers.ethers.keccak256(import_ethers.ethers.toUtf8Bytes(this.warp.title)),
281
- creator: this.config.user?.wallets?.evm || "",
282
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
283
- }
284
- };
333
+ };
334
+ var findKnownTokenById = (chain, env, id) => {
335
+ const chainTokens = KnownTokens[chain]?.[env] || [];
336
+ return chainTokens.find((token) => token.identifier === id) || null;
337
+ };
338
+ var getKnownTokensForChain = (chainName, env = "mainnet") => {
339
+ return KnownTokens[chainName]?.[env] || [];
340
+ };
341
+
342
+ // src/WarpEvmDataLoader.ts
343
+ var ERC20_ABI = [
344
+ "function balanceOf(address owner) view returns (uint256)",
345
+ "function decimals() view returns (uint8)",
346
+ "function name() view returns (string)",
347
+ "function symbol() view returns (string)",
348
+ "function totalSupply() view returns (uint256)"
349
+ ];
350
+ var WarpEvmDataLoader = class {
351
+ constructor(config, chain) {
352
+ this.config = config;
353
+ this.chain = chain;
354
+ const apiUrl = (0, import_warps7.getProviderUrl)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
355
+ const network = new import_ethers.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
356
+ this.provider = new import_ethers.ethers.JsonRpcProvider(apiUrl, network);
357
+ this.cache = new import_warps7.WarpCache(config.cache?.type);
358
+ this.uniswapService = new UniswapService(this.cache, parseInt(this.chain.chainId));
285
359
  }
286
- createInscriptionTransaction(warp) {
287
- const warpData = JSON.stringify(warp);
288
- const data = import_ethers.ethers.toUtf8Bytes(warpData);
360
+ async getAccount(address) {
361
+ const balance = await this.provider.getBalance(address);
289
362
  return {
290
- data: import_ethers.ethers.hexlify(data)
363
+ chain: this.chain.name,
364
+ address,
365
+ balance
291
366
  };
292
367
  }
293
- async createFromTransaction(tx, validate) {
294
- if (!tx.data || tx.data === "0x") {
295
- throw new Error("Transaction has no data");
368
+ async getAccountAssets(address) {
369
+ const account = await this.getAccount(address);
370
+ const tokenBalances = await this.getERC20TokenBalances(address);
371
+ let assets = account.balance > 0 ? [{ ...this.chain.nativeToken, amount: account.balance }] : [];
372
+ for (const tokenBalance of tokenBalances) {
373
+ if (tokenBalance.balance > 0n) {
374
+ assets.push({
375
+ chain: this.chain.name,
376
+ identifier: tokenBalance.tokenAddress,
377
+ name: tokenBalance.name,
378
+ symbol: tokenBalance.symbol,
379
+ amount: tokenBalance.balance,
380
+ decimals: tokenBalance.decimals,
381
+ logoUrl: tokenBalance.logoUrl || ""
382
+ });
383
+ }
296
384
  }
385
+ return assets;
386
+ }
387
+ async getAsset(identifier) {
297
388
  try {
298
- const data = import_ethers.ethers.toUtf8String(tx.data);
299
- const warp = JSON.parse(data);
300
- if (validate) {
301
- if (!warp.protocol || warp.protocol !== "warp") {
302
- throw new Error("Invalid warp protocol");
303
- }
304
- if (!warp.title) {
305
- throw new Error("Warp title is required");
306
- }
389
+ if (identifier === this.chain.nativeToken.identifier) {
390
+ return this.chain.nativeToken;
391
+ }
392
+ const cacheKey = import_warps7.WarpCacheKey.Asset(this.config.env, this.chain.name, identifier);
393
+ const cachedAsset = this.cache.get(cacheKey);
394
+ if (cachedAsset) {
395
+ return cachedAsset;
396
+ }
397
+ const knownToken = findKnownTokenById(this.chain.name, this.config.env, identifier);
398
+ if (knownToken) {
399
+ return {
400
+ chain: this.chain.name,
401
+ identifier,
402
+ name: knownToken.name,
403
+ symbol: knownToken.symbol,
404
+ amount: 0n,
405
+ decimals: knownToken.decimals,
406
+ logoUrl: knownToken.logoUrl
407
+ };
307
408
  }
308
- return warp;
409
+ const metadata = await this.getTokenMetadata(identifier);
410
+ const asset = {
411
+ chain: this.chain.name,
412
+ identifier,
413
+ name: metadata.name,
414
+ symbol: metadata.symbol,
415
+ amount: 0n,
416
+ decimals: metadata.decimals,
417
+ logoUrl: metadata.logoUrl || ""
418
+ };
419
+ this.cache.set(cacheKey, asset, import_warps7.CacheTtl.OneHour);
420
+ return asset;
309
421
  } catch (error) {
310
- throw new Error(`Failed to create warp from transaction: ${error}`);
422
+ return null;
311
423
  }
312
424
  }
313
- async createFromTransactionHash(hash, cache) {
425
+ async getAction(identifier, awaitCompleted = false) {
314
426
  try {
315
- const provider = new import_ethers.ethers.JsonRpcProvider(getEvmApiUrl(this.config.env));
316
- const tx = await provider.getTransaction(hash);
317
- if (!tx) {
318
- return null;
319
- }
320
- return await this.createFromTransaction(tx);
427
+ const tx = await this.provider.getTransaction(identifier);
428
+ if (!tx) return null;
429
+ const receipt = await this.provider.getTransactionReceipt(identifier);
430
+ const block = await this.provider.getBlock(tx.blockNumber || "latest");
431
+ return {
432
+ chain: this.chain.name,
433
+ id: tx.hash || identifier,
434
+ receiver: tx.to || "",
435
+ sender: tx.from,
436
+ value: tx.value,
437
+ function: tx.data && tx.data !== "0x" ? "contract_call" : "",
438
+ status: receipt?.status === 1 ? "success" : receipt?.status === 0 ? "failed" : "pending",
439
+ createdAt: block?.timestamp ? new Date(Number(block.timestamp) * 1e3).toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
440
+ error: receipt?.status === 0 ? "Transaction failed" : null,
441
+ tx: {
442
+ hash: tx.hash || "",
443
+ from: tx.from,
444
+ to: tx.to || "",
445
+ value: tx.value.toString(),
446
+ data: tx.data || "0x",
447
+ gasLimit: tx.gasLimit?.toString() || "0",
448
+ gasPrice: tx.gasPrice?.toString() || "0",
449
+ blockNumber: tx.blockNumber || 0,
450
+ blockHash: tx.blockHash || "",
451
+ transactionIndex: tx.index || 0
452
+ }
453
+ };
321
454
  } catch (error) {
322
455
  return null;
323
456
  }
324
457
  }
458
+ async getAccountActions(address, options) {
459
+ return [];
460
+ }
461
+ async getERC20TokenBalances(address) {
462
+ const env = this.config.env === "mainnet" ? "mainnet" : "testnet";
463
+ const tokens = getKnownTokensForChain(this.chain.name, env);
464
+ const balanceReqs = tokens.map((token) => this.getTokenBalance(address, token.identifier).catch(() => 0n));
465
+ const balances = await Promise.all(balanceReqs);
466
+ return balances.map((balance, index) => ({ balance, token: tokens[index] })).filter(({ balance }) => balance > 0n).map(({ balance, token }) => ({
467
+ tokenAddress: token.identifier,
468
+ balance,
469
+ name: token.name,
470
+ symbol: token.symbol,
471
+ decimals: token.decimals || 18,
472
+ logoUrl: token.logoUrl || ""
473
+ }));
474
+ }
475
+ async getTokenBalance(address, tokenAddress) {
476
+ const contract = new import_ethers.ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
477
+ const balance = await contract.balanceOf(address);
478
+ return balance;
479
+ }
480
+ async getTokenMetadata(tokenAddress) {
481
+ const uniswapMetadata = await this.uniswapService.getTokenMetadata(tokenAddress);
482
+ if (uniswapMetadata) {
483
+ return uniswapMetadata;
484
+ }
485
+ const contract = new import_ethers.ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
486
+ const [name, symbol, decimals] = await Promise.all([
487
+ contract.name().catch(() => "Unknown Token"),
488
+ contract.symbol().catch(() => "UNKNOWN"),
489
+ contract.decimals().catch(() => 18)
490
+ ]);
491
+ return {
492
+ name: name || "Unknown Token",
493
+ symbol: symbol || "UNKNOWN",
494
+ decimals: decimals || 18,
495
+ logoUrl: ""
496
+ };
497
+ }
325
498
  };
326
499
 
327
500
  // src/WarpEvmExecutor.ts
328
- var import_warps3 = require("@vleap/warps");
329
- var import_ethers3 = require("ethers");
501
+ var import_warps10 = require("@vleap/warps");
502
+ var import_ethers4 = require("ethers");
503
+
504
+ // src/constants.ts
505
+ var WarpEvmConstants = {
506
+ GasLimit: {
507
+ Default: 21e3,
508
+ ContractCall: 1e5,
509
+ ContractDeploy: 5e5,
510
+ Transfer: 21e3,
511
+ TokenTransfer: 65e3,
512
+ // ERC-20 transfer gas limit
513
+ Approve: 46e3,
514
+ Swap: 2e5
515
+ },
516
+ GasPrice: {
517
+ Default: "20000000000"
518
+ },
519
+ Validation: {
520
+ MinGasLimit: 21e3,
521
+ MaxGasLimit: 3e7
522
+ }
523
+ };
524
+ var EthereumExplorers = /* @__PURE__ */ ((EthereumExplorers2) => {
525
+ EthereumExplorers2["Etherscan"] = "etherscan";
526
+ EthereumExplorers2["EtherscanSepolia"] = "etherscan_sepolia";
527
+ EthereumExplorers2["Ethplorer"] = "ethplorer";
528
+ EthereumExplorers2["Blockscout"] = "blockscout";
529
+ EthereumExplorers2["BlockscoutSepolia"] = "blockscout_sepolia";
530
+ return EthereumExplorers2;
531
+ })(EthereumExplorers || {});
532
+ var ArbitrumExplorers = /* @__PURE__ */ ((ArbitrumExplorers2) => {
533
+ ArbitrumExplorers2["Arbiscan"] = "arbiscan";
534
+ ArbitrumExplorers2["ArbiscanSepolia"] = "arbiscan_sepolia";
535
+ ArbitrumExplorers2["BlockscoutArbitrum"] = "blockscout_arbitrum";
536
+ ArbitrumExplorers2["BlockscoutArbitrumSepolia"] = "blockscout_arbitrum_sepolia";
537
+ return ArbitrumExplorers2;
538
+ })(ArbitrumExplorers || {});
539
+ var BaseExplorers = /* @__PURE__ */ ((BaseExplorers2) => {
540
+ BaseExplorers2["Basescan"] = "basescan";
541
+ BaseExplorers2["BasescanSepolia"] = "basescan_sepolia";
542
+ BaseExplorers2["BlockscoutBase"] = "blockscout_base";
543
+ BaseExplorers2["BlockscoutBaseSepolia"] = "blockscout_base_sepolia";
544
+ return BaseExplorers2;
545
+ })(BaseExplorers || {});
546
+ var EvmExplorers = {
547
+ ethereum: {
548
+ mainnet: ["etherscan" /* Etherscan */, "ethplorer" /* Ethplorer */, "blockscout" /* Blockscout */],
549
+ testnet: ["etherscan_sepolia" /* EtherscanSepolia */, "blockscout_sepolia" /* BlockscoutSepolia */],
550
+ devnet: ["etherscan_sepolia" /* EtherscanSepolia */, "blockscout_sepolia" /* BlockscoutSepolia */]
551
+ },
552
+ arbitrum: {
553
+ mainnet: ["arbiscan" /* Arbiscan */, "blockscout_arbitrum" /* BlockscoutArbitrum */],
554
+ testnet: ["arbiscan_sepolia" /* ArbiscanSepolia */, "blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */],
555
+ devnet: ["arbiscan_sepolia" /* ArbiscanSepolia */, "blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */]
556
+ },
557
+ base: {
558
+ mainnet: ["basescan" /* Basescan */, "blockscout_base" /* BlockscoutBase */],
559
+ testnet: ["basescan_sepolia" /* BasescanSepolia */, "blockscout_base_sepolia" /* BlockscoutBaseSepolia */],
560
+ devnet: ["basescan_sepolia" /* BasescanSepolia */, "blockscout_base_sepolia" /* BlockscoutBaseSepolia */]
561
+ }
562
+ };
563
+ var ExplorerUrls = {
564
+ ["etherscan" /* Etherscan */]: "https://etherscan.io",
565
+ ["etherscan_sepolia" /* EtherscanSepolia */]: "https://sepolia.etherscan.io",
566
+ ["ethplorer" /* Ethplorer */]: "https://ethplorer.io",
567
+ ["blockscout" /* Blockscout */]: "https://eth.blockscout.com",
568
+ ["blockscout_sepolia" /* BlockscoutSepolia */]: "https://sepolia.blockscout.com",
569
+ ["arbiscan" /* Arbiscan */]: "https://arbiscan.io",
570
+ ["arbiscan_sepolia" /* ArbiscanSepolia */]: "https://sepolia.arbiscan.io",
571
+ ["blockscout_arbitrum" /* BlockscoutArbitrum */]: "https://arbitrum.blockscout.com",
572
+ ["blockscout_arbitrum_sepolia" /* BlockscoutArbitrumSepolia */]: "https://sepolia.blockscout.com",
573
+ ["basescan" /* Basescan */]: "https://basescan.org",
574
+ ["basescan_sepolia" /* BasescanSepolia */]: "https://sepolia.basescan.org",
575
+ ["blockscout_base" /* BlockscoutBase */]: "https://base.blockscout.com",
576
+ ["blockscout_base_sepolia" /* BlockscoutBaseSepolia */]: "https://sepolia.blockscout.com"
577
+ };
330
578
 
331
579
  // src/WarpEvmResults.ts
332
- var import_warps2 = require("@vleap/warps");
580
+ var import_warps9 = require("@vleap/warps");
581
+ var import_ethers3 = require("ethers");
333
582
 
334
583
  // src/WarpEvmSerializer.ts
335
- var import_warps = require("@vleap/warps");
584
+ var import_warps8 = require("@vleap/warps");
336
585
  var import_ethers2 = require("ethers");
337
- var SplitParamsRegex = new RegExp(`${import_warps.WarpConstants.ArgParamsSeparator}(.*)`);
586
+ var SplitParamsRegex = new RegExp(`${import_warps8.WarpConstants.ArgParamsSeparator}(.*)`);
338
587
  var WarpEvmSerializer = class {
339
588
  constructor() {
340
- this.coreSerializer = new import_warps.WarpSerializer();
589
+ this.coreSerializer = new import_warps8.WarpSerializer();
341
590
  }
342
591
  typedToString(value) {
343
592
  if (typeof value === "string") {
@@ -366,9 +615,9 @@ var WarpEvmSerializer = class {
366
615
  }
367
616
  if (Array.isArray(value)) {
368
617
  if (value.length === 0) return `list:string:`;
369
- const types = value.map((item) => this.typedToString(item).split(import_warps.WarpConstants.ArgParamsSeparator)[0]);
618
+ const types = value.map((item) => this.typedToString(item).split(import_warps8.WarpConstants.ArgParamsSeparator)[0]);
370
619
  const type = types[0];
371
- const values = value.map((item) => this.typedToString(item).split(import_warps.WarpConstants.ArgParamsSeparator)[1]);
620
+ const values = value.map((item) => this.typedToString(item).split(import_warps8.WarpConstants.ArgParamsSeparator)[1]);
372
621
  return `list:${type}:${values.join(",")}`;
373
622
  }
374
623
  if (value === null || value === void 0) {
@@ -378,8 +627,8 @@ var WarpEvmSerializer = class {
378
627
  }
379
628
  typedToNative(value) {
380
629
  const stringValue = this.typedToString(value);
381
- const [type, ...valueParts] = stringValue.split(import_warps.WarpConstants.ArgParamsSeparator);
382
- const nativeValue = valueParts.join(import_warps.WarpConstants.ArgParamsSeparator);
630
+ const [type, ...valueParts] = stringValue.split(import_warps8.WarpConstants.ArgParamsSeparator);
631
+ const nativeValue = valueParts.join(import_warps8.WarpConstants.ArgParamsSeparator);
383
632
  return [type, this.parseNativeValue(type, nativeValue)];
384
633
  }
385
634
  nativeToTyped(type, value) {
@@ -430,7 +679,7 @@ var WarpEvmSerializer = class {
430
679
  }
431
680
  }
432
681
  stringToTyped(value) {
433
- const parts = value.split(import_warps.WarpConstants.ArgParamsSeparator, 2);
682
+ const parts = value.split(import_warps8.WarpConstants.ArgParamsSeparator, 2);
434
683
  if (parts.length < 2) {
435
684
  return value;
436
685
  }
@@ -485,9 +734,19 @@ var WarpEvmSerializer = class {
485
734
 
486
735
  // src/WarpEvmResults.ts
487
736
  var WarpEvmResults = class {
488
- constructor(config) {
737
+ constructor(config, chain) {
489
738
  this.config = config;
739
+ this.chain = chain;
490
740
  this.serializer = new WarpEvmSerializer();
741
+ if (this.chain) {
742
+ const apiUrl = (0, import_warps9.getProviderUrl)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
743
+ const network = new import_ethers3.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
744
+ this.provider = new import_ethers3.ethers.JsonRpcProvider(apiUrl, network);
745
+ } else {
746
+ const apiUrl = (0, import_warps9.getProviderUrl)(this.config, "ethereum", this.config.env, "https://ethereum-rpc.publicnode.com");
747
+ const network = new import_ethers3.ethers.Network("ethereum", 1);
748
+ this.provider = new import_ethers3.ethers.JsonRpcProvider(apiUrl, network);
749
+ }
491
750
  }
492
751
  async getTransactionExecutionResults(warp, tx) {
493
752
  const success = tx.status === 1;
@@ -507,10 +766,12 @@ var WarpEvmResults = class {
507
766
  success,
508
767
  warp,
509
768
  action: 0,
510
- user: this.config.user?.wallets?.evm || null,
769
+ user: (0, import_warps9.getWarpWalletAddressFromConfig)(this.config, "evm"),
511
770
  txHash: transactionHash,
771
+ tx,
512
772
  next: null,
513
773
  values: [transactionHash, blockNumber, gasUsed, gasPrice, ...logs.length > 0 ? logs : []],
774
+ valuesRaw: [transactionHash, blockNumber, gasUsed, gasPrice, ...logs.length > 0 ? logs : []],
514
775
  results: {},
515
776
  messages: {}
516
777
  };
@@ -519,7 +780,7 @@ var WarpEvmResults = class {
519
780
  const values = typedValues.map((t) => this.serializer.typedToString(t));
520
781
  const valuesRaw = typedValues.map((t) => this.serializer.typedToNative(t)[1]);
521
782
  let results = {};
522
- if (!warp.results) return { values, results };
783
+ if (!warp.results) return { values, valuesRaw, results };
523
784
  const getNestedValue = (path) => {
524
785
  const indices = path.split(".").slice(1).map((i) => parseInt(i) - 1);
525
786
  if (indices.length === 0) return void 0;
@@ -531,8 +792,8 @@ var WarpEvmResults = class {
531
792
  return value;
532
793
  };
533
794
  for (const [key, path] of Object.entries(warp.results)) {
534
- if (path.startsWith(import_warps2.WarpConstants.Transform.Prefix)) continue;
535
- const currentActionIndex = (0, import_warps2.parseResultsOutIndex)(path);
795
+ if (path.startsWith(import_warps9.WarpConstants.Transform.Prefix)) continue;
796
+ const currentActionIndex = (0, import_warps9.parseResultsOutIndex)(path);
536
797
  if (currentActionIndex !== null && currentActionIndex !== actionIndex) {
537
798
  results[key] = null;
538
799
  continue;
@@ -543,20 +804,45 @@ var WarpEvmResults = class {
543
804
  results[key] = path;
544
805
  }
545
806
  }
546
- return { values, results: await (0, import_warps2.evaluateResultsCommon)(warp, results, actionIndex, inputs) };
807
+ return { values, valuesRaw, results: await (0, import_warps9.evaluateResultsCommon)(warp, results, actionIndex, inputs) };
808
+ }
809
+ async getTransactionStatus(txHash) {
810
+ try {
811
+ const receipt = await this.provider.getTransactionReceipt(txHash);
812
+ if (!receipt) {
813
+ return { status: "pending" };
814
+ }
815
+ return {
816
+ status: receipt.status === 1 ? "confirmed" : "failed",
817
+ blockNumber: receipt.blockNumber,
818
+ gasUsed: receipt.gasUsed
819
+ };
820
+ } catch (error) {
821
+ throw new Error(`Failed to get transaction status: ${error}`);
822
+ }
823
+ }
824
+ async getTransactionReceipt(txHash) {
825
+ try {
826
+ return await this.provider.getTransactionReceipt(txHash);
827
+ } catch (error) {
828
+ return null;
829
+ }
547
830
  }
548
831
  };
549
832
 
550
833
  // src/WarpEvmExecutor.ts
551
834
  var WarpEvmExecutor = class {
552
- constructor(config) {
835
+ constructor(config, chain) {
553
836
  this.config = config;
837
+ this.chain = chain;
554
838
  this.serializer = new WarpEvmSerializer();
555
- this.provider = new import_ethers3.ethers.JsonRpcProvider(getEvmApiUrl(config.env));
556
- this.results = new WarpEvmResults(config);
839
+ const apiUrl = (0, import_warps10.getProviderUrl)(this.config, chain.name, this.config.env, this.chain.defaultApiUrl);
840
+ const network = new import_ethers4.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
841
+ this.provider = new import_ethers4.ethers.JsonRpcProvider(apiUrl, network);
842
+ this.results = new WarpEvmResults(config, this.chain);
557
843
  }
558
844
  async createTransaction(executable) {
559
- const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
845
+ const action = (0, import_warps10.getWarpActionByIndex)(executable.warp, executable.action);
560
846
  let tx = null;
561
847
  if (action.type === "transfer") {
562
848
  tx = await this.createTransferTransaction(executable);
@@ -571,13 +857,13 @@ var WarpEvmExecutor = class {
571
857
  return tx;
572
858
  }
573
859
  async createTransferTransaction(executable) {
574
- const userWallet = this.config.user?.wallets?.[executable.chain.name];
860
+ const userWallet = (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
575
861
  if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
576
- if (!import_ethers3.ethers.isAddress(executable.destination)) {
862
+ if (!import_ethers4.ethers.isAddress(executable.destination)) {
577
863
  throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
578
864
  }
579
- if (executable.value < 0) {
580
- throw new Error(`WarpEvmExecutor: Transfer value cannot be negative: ${executable.value}`);
865
+ if (executable.transfers && executable.transfers.length > 0) {
866
+ return this.createTokenTransferTransaction(executable, userWallet);
581
867
  }
582
868
  const tx = {
583
869
  to: executable.destination,
@@ -587,20 +873,17 @@ var WarpEvmExecutor = class {
587
873
  return this.estimateGasAndSetDefaults(tx, userWallet);
588
874
  }
589
875
  async createContractCallTransaction(executable) {
590
- const userWallet = this.config.user?.wallets?.[executable.chain.name];
876
+ const userWallet = (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
591
877
  if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
592
- const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
878
+ const action = (0, import_warps10.getWarpActionByIndex)(executable.warp, executable.action);
593
879
  if (!action || !("func" in action) || !action.func) {
594
880
  throw new Error("WarpEvmExecutor: Contract action must have a function name");
595
881
  }
596
- if (!import_ethers3.ethers.isAddress(executable.destination)) {
882
+ if (!import_ethers4.ethers.isAddress(executable.destination)) {
597
883
  throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
598
884
  }
599
- if (executable.value < 0) {
600
- throw new Error(`WarpEvmExecutor: Contract call value cannot be negative: ${executable.value}`);
601
- }
602
885
  try {
603
- const iface = new import_ethers3.ethers.Interface([`function ${action.func}`]);
886
+ const iface = new import_ethers4.ethers.Interface([`function ${action.func}`]);
604
887
  const encodedData = iface.encodeFunctionData(action.func, executable.args);
605
888
  const tx = {
606
889
  to: executable.destination,
@@ -612,19 +895,63 @@ var WarpEvmExecutor = class {
612
895
  throw new Error(`WarpEvmExecutor: Failed to encode function data for ${action.func}: ${error}`);
613
896
  }
614
897
  }
898
+ async createTokenTransferTransaction(executable, userWallet) {
899
+ if (executable.transfers.length === 0) {
900
+ throw new Error("WarpEvmExecutor: No transfers provided");
901
+ }
902
+ if (!this.chain.nativeToken?.identifier) {
903
+ throw new Error("WarpEvmExecutor: No native token defined for this chain");
904
+ }
905
+ const nativeTokenTransfers = executable.transfers.filter((transfer) => transfer.identifier === this.chain.nativeToken.identifier);
906
+ const erc20Transfers = executable.transfers.filter((transfer) => transfer.identifier !== this.chain.nativeToken.identifier);
907
+ if (nativeTokenTransfers.length === 1 && erc20Transfers.length === 0) {
908
+ const transfer = nativeTokenTransfers[0];
909
+ if (transfer.amount <= 0n) {
910
+ throw new Error("WarpEvmExecutor: Native token transfer amount must be positive");
911
+ }
912
+ const tx = {
913
+ to: executable.destination,
914
+ value: transfer.amount,
915
+ data: "0x"
916
+ };
917
+ return this.estimateGasAndSetDefaults(tx, userWallet);
918
+ }
919
+ if (nativeTokenTransfers.length === 0 && erc20Transfers.length === 1) {
920
+ return this.createSingleTokenTransfer(executable, erc20Transfers[0], userWallet);
921
+ }
922
+ if (executable.transfers.length > 1) {
923
+ throw new Error("WarpEvmExecutor: Multiple token transfers not yet supported");
924
+ }
925
+ throw new Error("WarpEvmExecutor: Invalid transfer configuration");
926
+ }
927
+ async createSingleTokenTransfer(executable, transfer, userWallet) {
928
+ if (!import_ethers4.ethers.isAddress(transfer.identifier)) {
929
+ throw new Error(`WarpEvmExecutor: Invalid token address: ${transfer.identifier}`);
930
+ }
931
+ const transferInterface = new import_ethers4.ethers.Interface(["function transfer(address to, uint256 amount) returns (bool)"]);
932
+ const encodedData = transferInterface.encodeFunctionData("transfer", [executable.destination, transfer.amount]);
933
+ const tx = {
934
+ to: transfer.identifier,
935
+ // Token contract address
936
+ value: 0n,
937
+ // No native token value for ERC-20 transfers
938
+ data: encodedData
939
+ };
940
+ return this.estimateGasAndSetDefaults(tx, userWallet);
941
+ }
615
942
  async executeQuery(executable) {
616
- const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
943
+ const action = (0, import_warps10.getWarpActionByIndex)(executable.warp, executable.action);
617
944
  if (action.type !== "query") {
618
945
  throw new Error(`WarpEvmExecutor: Invalid action type for executeQuery: ${action.type}`);
619
946
  }
620
947
  if (!action.func) {
621
948
  throw new Error("WarpEvmExecutor: Query action must have a function name");
622
949
  }
623
- if (!import_ethers3.ethers.isAddress(executable.destination)) {
950
+ if (!import_ethers4.ethers.isAddress(executable.destination)) {
624
951
  throw new Error(`WarpEvmExecutor: Invalid contract address for query: ${executable.destination}`);
625
952
  }
626
953
  try {
627
- const iface = new import_ethers3.ethers.Interface([`function ${action.func}`]);
954
+ const iface = new import_ethers4.ethers.Interface([`function ${action.func}`]);
628
955
  const encodedData = iface.encodeFunctionData(action.func, executable.args);
629
956
  const result = await this.provider.call({
630
957
  to: executable.destination,
@@ -632,77 +959,42 @@ var WarpEvmExecutor = class {
632
959
  });
633
960
  const decodedResult = iface.decodeFunctionResult(action.func, result);
634
961
  const isSuccess = true;
635
- const { values, results } = await this.results.extractQueryResults(
962
+ const { values, valuesRaw, results } = await this.results.extractQueryResults(
636
963
  executable.warp,
637
964
  decodedResult,
638
965
  executable.action,
639
966
  executable.resolvedInputs
640
967
  );
641
- const mockAdapter = {
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);
968
+ const next = (0, import_warps10.getNextInfo)(this.config, [], executable.warp, executable.action, results);
654
969
  return {
655
970
  success: isSuccess,
656
971
  warp: executable.warp,
657
972
  action: executable.action,
658
- user: this.config.user?.wallets?.[executable.chain.name] || null,
973
+ user: (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
659
974
  txHash: null,
975
+ tx: null,
660
976
  next,
661
977
  values,
978
+ valuesRaw,
662
979
  results,
663
- messages: (0, import_warps3.applyResultsToMessages)(executable.warp, results)
980
+ messages: (0, import_warps10.applyResultsToMessages)(executable.warp, results)
664
981
  };
665
982
  } catch (error) {
666
983
  return {
667
984
  success: false,
668
985
  warp: executable.warp,
669
986
  action: executable.action,
670
- user: this.config.user?.wallets?.[executable.chain.name] || null,
987
+ user: (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
671
988
  txHash: null,
989
+ tx: null,
672
990
  next: null,
673
991
  values: [],
992
+ valuesRaw: [],
674
993
  results: {},
675
994
  messages: {}
676
995
  };
677
996
  }
678
997
  }
679
- async preprocessInput(chain, input, type, value) {
680
- const typedValue = this.serializer.stringToTyped(value);
681
- switch (type) {
682
- case "address":
683
- if (!import_ethers3.ethers.isAddress(typedValue)) {
684
- throw new Error(`Invalid address format: ${typedValue}`);
685
- }
686
- return import_ethers3.ethers.getAddress(typedValue);
687
- case "hex":
688
- if (!import_ethers3.ethers.isHexString(typedValue)) {
689
- throw new Error(`Invalid hex format: ${typedValue}`);
690
- }
691
- return typedValue;
692
- case "uint8":
693
- case "uint16":
694
- case "uint32":
695
- case "uint64":
696
- case "biguint":
697
- const bigIntValue = BigInt(typedValue);
698
- if (bigIntValue < 0) {
699
- throw new Error(`Negative value not allowed for type ${type}: ${typedValue}`);
700
- }
701
- return bigIntValue.toString();
702
- default:
703
- return String(typedValue);
704
- }
705
- }
706
998
  async estimateGasAndSetDefaults(tx, from) {
707
999
  try {
708
1000
  const gasEstimate = await this.provider.estimateGas({
@@ -719,6 +1011,7 @@ var WarpEvmExecutor = class {
719
1011
  if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) {
720
1012
  return {
721
1013
  ...tx,
1014
+ chainId: BigInt(this.chain.chainId),
722
1015
  gasLimit: gasEstimate,
723
1016
  maxFeePerGas: feeData.maxFeePerGas,
724
1017
  maxPriorityFeePerGas: feeData.maxPriorityFeePerGas
@@ -726,98 +1019,483 @@ var WarpEvmExecutor = class {
726
1019
  } else if (feeData.gasPrice) {
727
1020
  return {
728
1021
  ...tx,
1022
+ chainId: BigInt(this.chain.chainId),
729
1023
  gasLimit: gasEstimate,
730
1024
  gasPrice: feeData.gasPrice
731
1025
  };
732
1026
  } else {
733
1027
  return {
734
1028
  ...tx,
1029
+ chainId: BigInt(this.chain.chainId),
735
1030
  gasLimit: gasEstimate,
736
- gasPrice: import_ethers3.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1031
+ gasPrice: import_ethers4.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
737
1032
  };
738
1033
  }
739
1034
  } catch (error) {
740
1035
  let defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.Default);
741
1036
  if (tx.data && tx.data !== "0x") {
742
- defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.ContractCall);
1037
+ if (tx.data.startsWith("0xa9059cbb")) {
1038
+ defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.TokenTransfer);
1039
+ } else {
1040
+ defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.ContractCall);
1041
+ }
743
1042
  } else {
744
1043
  defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.Transfer);
745
1044
  }
746
1045
  return {
747
1046
  ...tx,
1047
+ chainId: BigInt(this.chain.chainId),
748
1048
  gasLimit: defaultGasLimit,
749
- gasPrice: import_ethers3.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1049
+ gasPrice: import_ethers4.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
750
1050
  };
751
1051
  }
752
1052
  }
753
1053
  async signMessage(message, privateKey) {
754
- throw new Error("Not implemented");
1054
+ try {
1055
+ const wallet = new import_ethers4.ethers.Wallet(privateKey);
1056
+ const signature = await wallet.signMessage(message);
1057
+ return signature;
1058
+ } catch (error) {
1059
+ throw new Error(`Failed to sign message: ${error}`);
1060
+ }
1061
+ }
1062
+ async verifyMessage(message, signature) {
1063
+ try {
1064
+ const recoveredAddress = import_ethers4.ethers.verifyMessage(message, signature);
1065
+ return recoveredAddress;
1066
+ } catch (error) {
1067
+ throw new Error(`Failed to verify message: ${error}`);
1068
+ }
755
1069
  }
756
1070
  };
757
1071
 
758
1072
  // src/WarpEvmExplorer.ts
759
1073
  var WarpEvmExplorer = class {
760
- constructor(chainInfo, chainName = "ethereum") {
761
- this.chainInfo = chainInfo;
762
- this.chainName = chainName;
1074
+ constructor(chain, config) {
1075
+ this.chain = chain;
1076
+ this.config = config;
1077
+ }
1078
+ getExplorers() {
1079
+ const chainExplorers = EvmExplorers[this.chain.name];
1080
+ if (!chainExplorers) {
1081
+ return ["Default"];
1082
+ }
1083
+ const explorers = chainExplorers[this.config.env];
1084
+ if (!explorers) {
1085
+ return ["Default"];
1086
+ }
1087
+ return explorers;
1088
+ }
1089
+ getPrimaryExplorer() {
1090
+ const explorers = this.getExplorers();
1091
+ return explorers[0];
763
1092
  }
764
- getAccountUrl(address) {
765
- const baseUrl = this.chainInfo.explorerUrl || getEvmExplorerUrl("mainnet", this.chainName);
1093
+ getExplorerUrlByName(explorer) {
1094
+ const userPreference = this.config.preferences?.explorers?.[this.chain.name];
1095
+ if (userPreference && !explorer) {
1096
+ const url2 = ExplorerUrls[userPreference];
1097
+ if (url2) return url2;
1098
+ }
1099
+ if (explorer) {
1100
+ const url2 = ExplorerUrls[explorer];
1101
+ if (url2) return url2;
1102
+ }
1103
+ const primaryExplorer = this.getPrimaryExplorer();
1104
+ const url = ExplorerUrls[primaryExplorer];
1105
+ return url || ExplorerUrls[primaryExplorer];
1106
+ }
1107
+ getAccountUrl(address, explorer) {
1108
+ const baseUrl = this.getExplorerUrlByName(explorer);
766
1109
  return `${baseUrl}/address/${address}`;
767
1110
  }
768
- getTransactionUrl(hash) {
769
- const baseUrl = this.chainInfo.explorerUrl || getEvmExplorerUrl("mainnet", this.chainName);
1111
+ getTransactionUrl(hash, explorer) {
1112
+ const baseUrl = this.getExplorerUrlByName(explorer);
770
1113
  return `${baseUrl}/tx/${hash}`;
771
1114
  }
1115
+ getBlockUrl(blockNumber, explorer) {
1116
+ const baseUrl = this.getExplorerUrlByName(explorer);
1117
+ return `${baseUrl}/block/${blockNumber}`;
1118
+ }
1119
+ getAssetUrl(identifier, explorer) {
1120
+ const baseUrl = this.getExplorerUrlByName(explorer);
1121
+ return `${baseUrl}/token/${identifier}`;
1122
+ }
1123
+ getContractUrl(address, explorer) {
1124
+ const baseUrl = this.getExplorerUrlByName(explorer);
1125
+ return `${baseUrl}/address/${address}`;
1126
+ }
1127
+ getAllExplorers() {
1128
+ return this.getExplorers();
1129
+ }
1130
+ getExplorerByName(name) {
1131
+ const explorers = this.getExplorers();
1132
+ return explorers.find((explorer) => explorer.toLowerCase() === name.toLowerCase());
1133
+ }
1134
+ getAccountUrls(address) {
1135
+ const explorers = this.getAllExplorers();
1136
+ const urls = {};
1137
+ explorers.forEach((explorer) => {
1138
+ const url = ExplorerUrls[explorer];
1139
+ if (url) {
1140
+ urls[explorer] = `${url}/address/${address}`;
1141
+ }
1142
+ });
1143
+ return urls;
1144
+ }
1145
+ getTransactionUrls(hash) {
1146
+ const explorers = this.getAllExplorers();
1147
+ const urls = {};
1148
+ explorers.forEach((explorer) => {
1149
+ const url = ExplorerUrls[explorer];
1150
+ if (url) {
1151
+ urls[explorer] = `${url}/tx/${hash}`;
1152
+ }
1153
+ });
1154
+ return urls;
1155
+ }
1156
+ getAssetUrls(identifier) {
1157
+ const explorers = this.getAllExplorers();
1158
+ const urls = {};
1159
+ explorers.forEach((explorer) => {
1160
+ const url = ExplorerUrls[explorer];
1161
+ if (url) {
1162
+ urls[explorer] = `${url}/token/${identifier}`;
1163
+ }
1164
+ });
1165
+ return urls;
1166
+ }
1167
+ getContractUrls(address) {
1168
+ const explorers = this.getAllExplorers();
1169
+ const urls = {};
1170
+ explorers.forEach((explorer) => {
1171
+ const url = ExplorerUrls[explorer];
1172
+ if (url) {
1173
+ urls[explorer] = `${url}/address/${address}`;
1174
+ }
1175
+ });
1176
+ return urls;
1177
+ }
1178
+ getBlockUrls(blockNumber) {
1179
+ const explorers = this.getAllExplorers();
1180
+ const urls = {};
1181
+ explorers.forEach((explorer) => {
1182
+ const url = ExplorerUrls[explorer];
1183
+ if (url) {
1184
+ urls[explorer] = `${url}/block/${blockNumber}`;
1185
+ }
1186
+ });
1187
+ return urls;
1188
+ }
772
1189
  };
773
1190
 
774
- // src/main.ts
775
- var getEthereumAdapter = createEvmAdapter("ethereum", "eth");
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) {
1191
+ // src/WarpEvmWallet.ts
1192
+ var import_warps11 = require("@vleap/warps");
1193
+ var import_ethers5 = require("ethers");
1194
+ var WarpEvmWallet = class {
1195
+ constructor(config, chain) {
1196
+ this.config = config;
1197
+ this.chain = chain;
1198
+ this.wallet = null;
1199
+ this.provider = new import_ethers5.ethers.JsonRpcProvider(chain.defaultApiUrl || "https://rpc.sepolia.org");
1200
+ }
1201
+ async signTransaction(tx) {
1202
+ if (!tx || typeof tx !== "object") {
1203
+ throw new Error("Invalid transaction object");
1204
+ }
1205
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1206
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
1207
+ const wallet = new import_ethers5.ethers.Wallet(privateKey);
1208
+ const txRequest = {
1209
+ to: tx.to,
1210
+ data: tx.data,
1211
+ value: tx.value || 0,
1212
+ gasLimit: tx.gasLimit,
1213
+ maxFeePerGas: tx.maxFeePerGas,
1214
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
1215
+ nonce: tx.nonce,
1216
+ chainId: tx.chainId
1217
+ };
1218
+ const signedTx = await wallet.signTransaction(txRequest);
1219
+ return { ...tx, signature: signedTx };
1220
+ }
1221
+ async signMessage(message) {
1222
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1223
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
1224
+ const wallet = new import_ethers5.ethers.Wallet(privateKey);
1225
+ return await wallet.signMessage(message);
1226
+ }
1227
+ async sendTransaction(tx) {
1228
+ if (!tx || typeof tx !== "object") {
1229
+ throw new Error("Invalid transaction object");
1230
+ }
1231
+ if (!tx.signature) {
1232
+ throw new Error("Transaction must be signed before sending");
1233
+ }
1234
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1235
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
1236
+ const wallet = new import_ethers5.ethers.Wallet(privateKey).connect(this.provider);
1237
+ const txResponse = await wallet.sendTransaction(tx);
1238
+ return txResponse.hash;
1239
+ }
1240
+ create(mnemonic) {
1241
+ const wallet = import_ethers5.ethers.Wallet.fromPhrase(mnemonic);
1242
+ return { address: wallet.address, privateKey: wallet.privateKey, mnemonic };
1243
+ }
1244
+ generate() {
1245
+ const wallet = import_ethers5.ethers.Wallet.createRandom();
1246
+ return { address: wallet.address, privateKey: wallet.privateKey, mnemonic: wallet.mnemonic?.phrase || "" };
1247
+ }
1248
+ getAddress() {
1249
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1250
+ if (!privateKey) return null;
1251
+ const wallet = new import_ethers5.ethers.Wallet(privateKey);
1252
+ return wallet.address;
1253
+ }
1254
+ };
1255
+
1256
+ // src/chains/common.ts
1257
+ var createEvmAdapter = (chainName, chainPrefix, chainInfos) => {
784
1258
  return (config, fallback) => {
785
1259
  if (!fallback) throw new Error(`${chainName} adapter requires a fallback adapter`);
786
1260
  return {
787
1261
  chain: chainName,
1262
+ chainInfo: chainInfos[config.env],
788
1263
  prefix: chainPrefix,
789
- builder: () => new WarpEvmBuilder(config),
790
- executor: new WarpEvmExecutor(config),
791
- results: new WarpEvmResults(config),
1264
+ builder: () => fallback.builder(),
1265
+ executor: new WarpEvmExecutor(config, chainInfos[config.env]),
1266
+ results: new WarpEvmResults(config, chainInfos[config.env]),
792
1267
  serializer: new WarpEvmSerializer(),
793
1268
  registry: fallback.registry,
794
- explorer: (chainInfo) => new WarpEvmExplorer(chainInfo),
1269
+ explorer: new WarpEvmExplorer(chainInfos[config.env], config),
795
1270
  abiBuilder: () => fallback.abiBuilder(),
796
- brandBuilder: () => fallback.brandBuilder()
1271
+ brandBuilder: () => fallback.brandBuilder(),
1272
+ dataLoader: new WarpEvmDataLoader(config, chainInfos[config.env]),
1273
+ wallet: new WarpEvmWallet(config, chainInfos[config.env])
797
1274
  };
798
1275
  };
799
- }
1276
+ };
1277
+
1278
+ // src/chains/arbitrum.ts
1279
+ var NativeTokenArb = {
1280
+ chain: import_warps12.WarpChainName.Arbitrum,
1281
+ identifier: "ARB",
1282
+ symbol: "ARB",
1283
+ name: "Arbitrum",
1284
+ decimals: 18,
1285
+ logoUrl: "https://vleap.ai/images/tokens/arb.svg"
1286
+ };
1287
+ var getArbitrumAdapter = createEvmAdapter(import_warps12.WarpChainName.Arbitrum, "arb", {
1288
+ mainnet: {
1289
+ name: import_warps12.WarpChainName.Arbitrum,
1290
+ displayName: "Arbitrum",
1291
+ chainId: "42161",
1292
+ blockTime: 1e3,
1293
+ addressHrp: "0x",
1294
+ defaultApiUrl: "https://arb1.arbitrum.io/rpc",
1295
+ logoUrl: "https://vleap.ai/images/chains/arbitrum.svg",
1296
+ nativeToken: NativeTokenArb
1297
+ },
1298
+ testnet: {
1299
+ name: import_warps12.WarpChainName.Arbitrum,
1300
+ displayName: "Arbitrum Sepolia",
1301
+ chainId: "421614",
1302
+ blockTime: 1e3,
1303
+ addressHrp: "0x",
1304
+ defaultApiUrl: "https://sepolia-rollup.arbitrum.io/rpc",
1305
+ logoUrl: "https://vleap.ai/images/chains/arbitrum.svg",
1306
+ nativeToken: NativeTokenArb
1307
+ },
1308
+ devnet: {
1309
+ name: import_warps12.WarpChainName.Arbitrum,
1310
+ displayName: "Arbitrum Sepolia",
1311
+ chainId: "421614",
1312
+ blockTime: 1e3,
1313
+ addressHrp: "0x",
1314
+ defaultApiUrl: "https://sepolia-rollup.arbitrum.io/rpc",
1315
+ logoUrl: "https://vleap.ai/images/chains/arbitrum.svg",
1316
+ nativeToken: NativeTokenArb
1317
+ }
1318
+ });
1319
+
1320
+ // src/chains/base.ts
1321
+ var import_warps13 = require("@vleap/warps");
1322
+ var NativeTokenBase = {
1323
+ chain: import_warps13.WarpChainName.Base,
1324
+ identifier: "ETH",
1325
+ name: "Ether",
1326
+ symbol: "ETH",
1327
+ decimals: 18,
1328
+ logoUrl: "https://vleap.ai/images/tokens/eth.svg"
1329
+ };
1330
+ var getBaseAdapter = createEvmAdapter(import_warps13.WarpChainName.Base, "base", {
1331
+ mainnet: {
1332
+ name: import_warps13.WarpChainName.Base,
1333
+ displayName: "Base",
1334
+ chainId: "8453",
1335
+ blockTime: 2e3,
1336
+ addressHrp: "0x",
1337
+ defaultApiUrl: "https://mainnet.base.org",
1338
+ logoUrl: "https://vleap.ai/images/chains/base.svg",
1339
+ nativeToken: NativeTokenBase
1340
+ },
1341
+ testnet: {
1342
+ name: import_warps13.WarpChainName.Base,
1343
+ displayName: "Base Sepolia",
1344
+ chainId: "84532",
1345
+ blockTime: 2e3,
1346
+ addressHrp: "0x",
1347
+ defaultApiUrl: "https://sepolia.base.org",
1348
+ logoUrl: "https://vleap.ai/images/chains/base.svg",
1349
+ nativeToken: NativeTokenBase
1350
+ },
1351
+ devnet: {
1352
+ name: import_warps13.WarpChainName.Base,
1353
+ displayName: "Base Sepolia",
1354
+ chainId: "84532",
1355
+ blockTime: 2e3,
1356
+ addressHrp: "0x",
1357
+ defaultApiUrl: "https://sepolia.base.org",
1358
+ logoUrl: "https://vleap.ai/images/chains/base.svg",
1359
+ nativeToken: NativeTokenBase
1360
+ }
1361
+ });
1362
+
1363
+ // src/chains/combined.ts
1364
+ var import_warps16 = require("@vleap/warps");
1365
+
1366
+ // src/chains/ethereum.ts
1367
+ var import_warps14 = require("@vleap/warps");
1368
+ var NativeTokenEth = {
1369
+ chain: import_warps14.WarpChainName.Ethereum,
1370
+ identifier: "ETH",
1371
+ symbol: "ETH",
1372
+ name: "Ether",
1373
+ decimals: 18,
1374
+ logoUrl: "https://vleap.ai/images/tokens/eth.svg"
1375
+ };
1376
+ var getEthereumAdapter = createEvmAdapter(import_warps14.WarpChainName.Ethereum, "eth", {
1377
+ mainnet: {
1378
+ name: import_warps14.WarpChainName.Ethereum,
1379
+ displayName: "Ethereum Mainnet",
1380
+ chainId: "1",
1381
+ blockTime: 12e3,
1382
+ addressHrp: "0x",
1383
+ defaultApiUrl: "https://ethereum-rpc.publicnode.com",
1384
+ logoUrl: "https://vleap.ai/images/chains/ethereum.svg",
1385
+ nativeToken: NativeTokenEth
1386
+ },
1387
+ testnet: {
1388
+ name: import_warps14.WarpChainName.Ethereum,
1389
+ displayName: "Ethereum Sepolia",
1390
+ chainId: "11155111",
1391
+ blockTime: 12e3,
1392
+ addressHrp: "0x",
1393
+ defaultApiUrl: "https://ethereum-sepolia-rpc.publicnode.com",
1394
+ logoUrl: "https://vleap.ai/images/chains/ethereum.svg",
1395
+ nativeToken: NativeTokenEth
1396
+ },
1397
+ devnet: {
1398
+ name: import_warps14.WarpChainName.Ethereum,
1399
+ displayName: "Ethereum Sepolia",
1400
+ chainId: "11155111",
1401
+ blockTime: 12e3,
1402
+ addressHrp: "0x",
1403
+ defaultApiUrl: "https://ethereum-sepolia-rpc.publicnode.com",
1404
+ logoUrl: "https://vleap.ai/images/chains/ethereum.svg",
1405
+ nativeToken: NativeTokenEth
1406
+ }
1407
+ });
1408
+
1409
+ // src/chains/somnia.ts
1410
+ var import_warps15 = require("@vleap/warps");
1411
+ var NativeTokenSomi = {
1412
+ chain: import_warps15.WarpChainName.Somnia,
1413
+ identifier: "SOMI",
1414
+ symbol: "SOMI",
1415
+ name: "Somnia",
1416
+ decimals: 18,
1417
+ logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
1418
+ };
1419
+ var NativeTokenStt = {
1420
+ chain: import_warps15.WarpChainName.Somnia,
1421
+ identifier: "STT",
1422
+ symbol: "STT",
1423
+ name: "Somnia Testnet Token",
1424
+ decimals: 18,
1425
+ logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
1426
+ };
1427
+ var getSomniaAdapter = createEvmAdapter(import_warps15.WarpChainName.Somnia, "eth", {
1428
+ mainnet: {
1429
+ name: import_warps15.WarpChainName.Somnia,
1430
+ displayName: "Somnia Mainnet",
1431
+ chainId: "5031",
1432
+ blockTime: 100,
1433
+ addressHrp: "0x",
1434
+ defaultApiUrl: "https://api.infra.mainnet.somnia.network/",
1435
+ logoUrl: "https://vleap.ai/images/chains/somnia.png",
1436
+ nativeToken: NativeTokenSomi
1437
+ },
1438
+ testnet: {
1439
+ name: import_warps15.WarpChainName.Somnia,
1440
+ displayName: "Somnia Testnet",
1441
+ chainId: "50312",
1442
+ blockTime: 100,
1443
+ addressHrp: "0x",
1444
+ defaultApiUrl: "https://dream-rpc.somnia.network/",
1445
+ logoUrl: "https://vleap.ai/images/chains/somnia.png",
1446
+ nativeToken: NativeTokenStt
1447
+ },
1448
+ devnet: {
1449
+ name: import_warps15.WarpChainName.Somnia,
1450
+ displayName: "Somnia Testnet",
1451
+ chainId: "50312",
1452
+ blockTime: 100,
1453
+ addressHrp: "0x",
1454
+ defaultApiUrl: "https://dream-rpc.somnia.network",
1455
+ logoUrl: "https://vleap.ai/images/chains/somnia.png",
1456
+ nativeToken: NativeTokenStt
1457
+ }
1458
+ });
1459
+
1460
+ // src/chains/combined.ts
1461
+ var getAllEvmAdapters = (config, fallback) => [
1462
+ getEthereumAdapter(config, fallback),
1463
+ getBaseAdapter(config, fallback),
1464
+ getArbitrumAdapter(config, fallback),
1465
+ getSomniaAdapter(config, fallback)
1466
+ ];
1467
+ var getAllEvmChainNames = () => [
1468
+ import_warps16.WarpChainName.Ethereum,
1469
+ import_warps16.WarpChainName.Base,
1470
+ import_warps16.WarpChainName.Arbitrum,
1471
+ import_warps16.WarpChainName.Somnia
1472
+ ];
800
1473
  // Annotate the CommonJS export names for ESM import in node:
801
1474
  0 && (module.exports = {
802
- EVM_CHAIN_CONFIGS,
803
- WarpEvmBuilder,
1475
+ ArbitrumExplorers,
1476
+ BaseExplorers,
1477
+ EthereumExplorers,
1478
+ EvmExplorers,
1479
+ ExplorerUrls,
1480
+ KnownTokens,
1481
+ NativeTokenArb,
1482
+ NativeTokenBase,
1483
+ NativeTokenEth,
1484
+ UniswapService,
804
1485
  WarpEvmConstants,
1486
+ WarpEvmDataLoader,
805
1487
  WarpEvmExecutor,
806
1488
  WarpEvmExplorer,
807
1489
  WarpEvmResults,
808
1490
  WarpEvmSerializer,
1491
+ WarpEvmWallet,
1492
+ createEvmAdapter,
1493
+ findKnownTokenById,
809
1494
  getAllEvmAdapters,
1495
+ getAllEvmChainNames,
810
1496
  getArbitrumAdapter,
811
1497
  getBaseAdapter,
812
1498
  getEthereumAdapter,
813
- getEvmApiUrl,
814
- getEvmBlockTime,
815
- getEvmChainConfig,
816
- getEvmChainId,
817
- getEvmExplorerUrl,
818
- getEvmNativeToken,
819
- getEvmRegistryAddress,
820
- getSupportedEnvironments,
821
- getSupportedEvmChains
1499
+ getKnownTokensForChain
822
1500
  });
823
1501
  //# sourceMappingURL=index.js.map