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

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
+ identifier: "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,13 @@ 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
+ const apiUrl = (0, import_warps9.getProviderUrl)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
742
+ const network = new import_ethers3.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
743
+ this.provider = new import_ethers3.ethers.JsonRpcProvider(apiUrl, network);
491
744
  }
492
745
  async getTransactionExecutionResults(warp, tx) {
493
746
  const success = tx.status === 1;
@@ -507,10 +760,12 @@ var WarpEvmResults = class {
507
760
  success,
508
761
  warp,
509
762
  action: 0,
510
- user: this.config.user?.wallets?.evm || null,
763
+ user: (0, import_warps9.getWarpWalletAddressFromConfig)(this.config, "evm"),
511
764
  txHash: transactionHash,
765
+ tx,
512
766
  next: null,
513
767
  values: [transactionHash, blockNumber, gasUsed, gasPrice, ...logs.length > 0 ? logs : []],
768
+ valuesRaw: [transactionHash, blockNumber, gasUsed, gasPrice, ...logs.length > 0 ? logs : []],
514
769
  results: {},
515
770
  messages: {}
516
771
  };
@@ -519,7 +774,7 @@ var WarpEvmResults = class {
519
774
  const values = typedValues.map((t) => this.serializer.typedToString(t));
520
775
  const valuesRaw = typedValues.map((t) => this.serializer.typedToNative(t)[1]);
521
776
  let results = {};
522
- if (!warp.results) return { values, results };
777
+ if (!warp.results) return { values, valuesRaw, results };
523
778
  const getNestedValue = (path) => {
524
779
  const indices = path.split(".").slice(1).map((i) => parseInt(i) - 1);
525
780
  if (indices.length === 0) return void 0;
@@ -531,8 +786,8 @@ var WarpEvmResults = class {
531
786
  return value;
532
787
  };
533
788
  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);
789
+ if (path.startsWith(import_warps9.WarpConstants.Transform.Prefix)) continue;
790
+ const currentActionIndex = (0, import_warps9.parseResultsOutIndex)(path);
536
791
  if (currentActionIndex !== null && currentActionIndex !== actionIndex) {
537
792
  results[key] = null;
538
793
  continue;
@@ -543,20 +798,45 @@ var WarpEvmResults = class {
543
798
  results[key] = path;
544
799
  }
545
800
  }
546
- return { values, results: await (0, import_warps2.evaluateResultsCommon)(warp, results, actionIndex, inputs) };
801
+ return { values, valuesRaw, results: await (0, import_warps9.evaluateResultsCommon)(warp, results, actionIndex, inputs) };
802
+ }
803
+ async getTransactionStatus(txHash) {
804
+ try {
805
+ const receipt = await this.provider.getTransactionReceipt(txHash);
806
+ if (!receipt) {
807
+ return { status: "pending" };
808
+ }
809
+ return {
810
+ status: receipt.status === 1 ? "confirmed" : "failed",
811
+ blockNumber: receipt.blockNumber,
812
+ gasUsed: receipt.gasUsed
813
+ };
814
+ } catch (error) {
815
+ throw new Error(`Failed to get transaction status: ${error}`);
816
+ }
817
+ }
818
+ async getTransactionReceipt(txHash) {
819
+ try {
820
+ return await this.provider.getTransactionReceipt(txHash);
821
+ } catch (error) {
822
+ return null;
823
+ }
547
824
  }
548
825
  };
549
826
 
550
827
  // src/WarpEvmExecutor.ts
551
828
  var WarpEvmExecutor = class {
552
- constructor(config) {
829
+ constructor(config, chain) {
553
830
  this.config = config;
831
+ this.chain = chain;
554
832
  this.serializer = new WarpEvmSerializer();
555
- this.provider = new import_ethers3.ethers.JsonRpcProvider(getEvmApiUrl(config.env));
556
- this.results = new WarpEvmResults(config);
833
+ const apiUrl = (0, import_warps10.getProviderUrl)(this.config, chain.name, this.config.env, this.chain.defaultApiUrl);
834
+ const network = new import_ethers4.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
835
+ this.provider = new import_ethers4.ethers.JsonRpcProvider(apiUrl, network);
836
+ this.results = new WarpEvmResults(config, this.chain);
557
837
  }
558
838
  async createTransaction(executable) {
559
- const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
839
+ const action = (0, import_warps10.getWarpActionByIndex)(executable.warp, executable.action);
560
840
  let tx = null;
561
841
  if (action.type === "transfer") {
562
842
  tx = await this.createTransferTransaction(executable);
@@ -571,13 +851,13 @@ var WarpEvmExecutor = class {
571
851
  return tx;
572
852
  }
573
853
  async createTransferTransaction(executable) {
574
- const userWallet = this.config.user?.wallets?.[executable.chain.name];
854
+ const userWallet = (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
575
855
  if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
576
- if (!import_ethers3.ethers.isAddress(executable.destination)) {
856
+ if (!import_ethers4.ethers.isAddress(executable.destination)) {
577
857
  throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
578
858
  }
579
- if (executable.value < 0) {
580
- throw new Error(`WarpEvmExecutor: Transfer value cannot be negative: ${executable.value}`);
859
+ if (executable.transfers && executable.transfers.length > 0) {
860
+ return this.createTokenTransferTransaction(executable, userWallet);
581
861
  }
582
862
  const tx = {
583
863
  to: executable.destination,
@@ -587,20 +867,17 @@ var WarpEvmExecutor = class {
587
867
  return this.estimateGasAndSetDefaults(tx, userWallet);
588
868
  }
589
869
  async createContractCallTransaction(executable) {
590
- const userWallet = this.config.user?.wallets?.[executable.chain.name];
870
+ const userWallet = (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
591
871
  if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
592
- const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
872
+ const action = (0, import_warps10.getWarpActionByIndex)(executable.warp, executable.action);
593
873
  if (!action || !("func" in action) || !action.func) {
594
874
  throw new Error("WarpEvmExecutor: Contract action must have a function name");
595
875
  }
596
- if (!import_ethers3.ethers.isAddress(executable.destination)) {
876
+ if (!import_ethers4.ethers.isAddress(executable.destination)) {
597
877
  throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
598
878
  }
599
- if (executable.value < 0) {
600
- throw new Error(`WarpEvmExecutor: Contract call value cannot be negative: ${executable.value}`);
601
- }
602
879
  try {
603
- const iface = new import_ethers3.ethers.Interface([`function ${action.func}`]);
880
+ const iface = new import_ethers4.ethers.Interface([`function ${action.func}`]);
604
881
  const encodedData = iface.encodeFunctionData(action.func, executable.args);
605
882
  const tx = {
606
883
  to: executable.destination,
@@ -612,19 +889,63 @@ var WarpEvmExecutor = class {
612
889
  throw new Error(`WarpEvmExecutor: Failed to encode function data for ${action.func}: ${error}`);
613
890
  }
614
891
  }
892
+ async createTokenTransferTransaction(executable, userWallet) {
893
+ if (executable.transfers.length === 0) {
894
+ throw new Error("WarpEvmExecutor: No transfers provided");
895
+ }
896
+ if (!this.chain.nativeToken?.identifier) {
897
+ throw new Error("WarpEvmExecutor: No native token defined for this chain");
898
+ }
899
+ const nativeTokenTransfers = executable.transfers.filter((transfer) => transfer.identifier === this.chain.nativeToken.identifier);
900
+ const erc20Transfers = executable.transfers.filter((transfer) => transfer.identifier !== this.chain.nativeToken.identifier);
901
+ if (nativeTokenTransfers.length === 1 && erc20Transfers.length === 0) {
902
+ const transfer = nativeTokenTransfers[0];
903
+ if (transfer.amount <= 0n) {
904
+ throw new Error("WarpEvmExecutor: Native token transfer amount must be positive");
905
+ }
906
+ const tx = {
907
+ to: executable.destination,
908
+ value: transfer.amount,
909
+ data: "0x"
910
+ };
911
+ return this.estimateGasAndSetDefaults(tx, userWallet);
912
+ }
913
+ if (nativeTokenTransfers.length === 0 && erc20Transfers.length === 1) {
914
+ return this.createSingleTokenTransfer(executable, erc20Transfers[0], userWallet);
915
+ }
916
+ if (executable.transfers.length > 1) {
917
+ throw new Error("WarpEvmExecutor: Multiple token transfers not yet supported");
918
+ }
919
+ throw new Error("WarpEvmExecutor: Invalid transfer configuration");
920
+ }
921
+ async createSingleTokenTransfer(executable, transfer, userWallet) {
922
+ if (!import_ethers4.ethers.isAddress(transfer.identifier)) {
923
+ throw new Error(`WarpEvmExecutor: Invalid token address: ${transfer.identifier}`);
924
+ }
925
+ const transferInterface = new import_ethers4.ethers.Interface(["function transfer(address to, uint256 amount) returns (bool)"]);
926
+ const encodedData = transferInterface.encodeFunctionData("transfer", [executable.destination, transfer.amount]);
927
+ const tx = {
928
+ to: transfer.identifier,
929
+ // Token contract address
930
+ value: 0n,
931
+ // No native token value for ERC-20 transfers
932
+ data: encodedData
933
+ };
934
+ return this.estimateGasAndSetDefaults(tx, userWallet);
935
+ }
615
936
  async executeQuery(executable) {
616
- const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
937
+ const action = (0, import_warps10.getWarpActionByIndex)(executable.warp, executable.action);
617
938
  if (action.type !== "query") {
618
939
  throw new Error(`WarpEvmExecutor: Invalid action type for executeQuery: ${action.type}`);
619
940
  }
620
941
  if (!action.func) {
621
942
  throw new Error("WarpEvmExecutor: Query action must have a function name");
622
943
  }
623
- if (!import_ethers3.ethers.isAddress(executable.destination)) {
944
+ if (!import_ethers4.ethers.isAddress(executable.destination)) {
624
945
  throw new Error(`WarpEvmExecutor: Invalid contract address for query: ${executable.destination}`);
625
946
  }
626
947
  try {
627
- const iface = new import_ethers3.ethers.Interface([`function ${action.func}`]);
948
+ const iface = new import_ethers4.ethers.Interface([`function ${action.func}`]);
628
949
  const encodedData = iface.encodeFunctionData(action.func, executable.args);
629
950
  const result = await this.provider.call({
630
951
  to: executable.destination,
@@ -632,77 +953,42 @@ var WarpEvmExecutor = class {
632
953
  });
633
954
  const decodedResult = iface.decodeFunctionResult(action.func, result);
634
955
  const isSuccess = true;
635
- const { values, results } = await this.results.extractQueryResults(
956
+ const { values, valuesRaw, results } = await this.results.extractQueryResults(
636
957
  executable.warp,
637
958
  decodedResult,
638
959
  executable.action,
639
960
  executable.resolvedInputs
640
961
  );
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);
962
+ const next = (0, import_warps10.getNextInfo)(this.config, [], executable.warp, executable.action, results);
654
963
  return {
655
964
  success: isSuccess,
656
965
  warp: executable.warp,
657
966
  action: executable.action,
658
- user: this.config.user?.wallets?.[executable.chain.name] || null,
967
+ user: (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
659
968
  txHash: null,
969
+ tx: null,
660
970
  next,
661
971
  values,
972
+ valuesRaw,
662
973
  results,
663
- messages: (0, import_warps3.applyResultsToMessages)(executable.warp, results)
974
+ messages: (0, import_warps10.applyResultsToMessages)(executable.warp, results)
664
975
  };
665
976
  } catch (error) {
666
977
  return {
667
978
  success: false,
668
979
  warp: executable.warp,
669
980
  action: executable.action,
670
- user: this.config.user?.wallets?.[executable.chain.name] || null,
981
+ user: (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
671
982
  txHash: null,
983
+ tx: null,
672
984
  next: null,
673
985
  values: [],
986
+ valuesRaw: [],
674
987
  results: {},
675
988
  messages: {}
676
989
  };
677
990
  }
678
991
  }
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
992
  async estimateGasAndSetDefaults(tx, from) {
707
993
  try {
708
994
  const gasEstimate = await this.provider.estimateGas({
@@ -719,6 +1005,7 @@ var WarpEvmExecutor = class {
719
1005
  if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) {
720
1006
  return {
721
1007
  ...tx,
1008
+ chainId: BigInt(this.chain.chainId),
722
1009
  gasLimit: gasEstimate,
723
1010
  maxFeePerGas: feeData.maxFeePerGas,
724
1011
  maxPriorityFeePerGas: feeData.maxPriorityFeePerGas
@@ -726,98 +1013,483 @@ var WarpEvmExecutor = class {
726
1013
  } else if (feeData.gasPrice) {
727
1014
  return {
728
1015
  ...tx,
1016
+ chainId: BigInt(this.chain.chainId),
729
1017
  gasLimit: gasEstimate,
730
1018
  gasPrice: feeData.gasPrice
731
1019
  };
732
1020
  } else {
733
1021
  return {
734
1022
  ...tx,
1023
+ chainId: BigInt(this.chain.chainId),
735
1024
  gasLimit: gasEstimate,
736
- gasPrice: import_ethers3.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1025
+ gasPrice: import_ethers4.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
737
1026
  };
738
1027
  }
739
1028
  } catch (error) {
740
1029
  let defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.Default);
741
1030
  if (tx.data && tx.data !== "0x") {
742
- defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.ContractCall);
1031
+ if (tx.data.startsWith("0xa9059cbb")) {
1032
+ defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.TokenTransfer);
1033
+ } else {
1034
+ defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.ContractCall);
1035
+ }
743
1036
  } else {
744
1037
  defaultGasLimit = BigInt(WarpEvmConstants.GasLimit.Transfer);
745
1038
  }
746
1039
  return {
747
1040
  ...tx,
1041
+ chainId: BigInt(this.chain.chainId),
748
1042
  gasLimit: defaultGasLimit,
749
- gasPrice: import_ethers3.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1043
+ gasPrice: import_ethers4.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
750
1044
  };
751
1045
  }
752
1046
  }
753
1047
  async signMessage(message, privateKey) {
754
- throw new Error("Not implemented");
1048
+ try {
1049
+ const wallet = new import_ethers4.ethers.Wallet(privateKey);
1050
+ const signature = await wallet.signMessage(message);
1051
+ return signature;
1052
+ } catch (error) {
1053
+ throw new Error(`Failed to sign message: ${error}`);
1054
+ }
1055
+ }
1056
+ async verifyMessage(message, signature) {
1057
+ try {
1058
+ const recoveredAddress = import_ethers4.ethers.verifyMessage(message, signature);
1059
+ return recoveredAddress;
1060
+ } catch (error) {
1061
+ throw new Error(`Failed to verify message: ${error}`);
1062
+ }
755
1063
  }
756
1064
  };
757
1065
 
758
1066
  // src/WarpEvmExplorer.ts
759
1067
  var WarpEvmExplorer = class {
760
- constructor(chainInfo, chainName = "ethereum") {
761
- this.chainInfo = chainInfo;
762
- this.chainName = chainName;
1068
+ constructor(chain, config) {
1069
+ this.chain = chain;
1070
+ this.config = config;
1071
+ }
1072
+ getExplorers() {
1073
+ const chainExplorers = EvmExplorers[this.chain.name];
1074
+ if (!chainExplorers) {
1075
+ return ["Default"];
1076
+ }
1077
+ const explorers = chainExplorers[this.config.env];
1078
+ if (!explorers) {
1079
+ return ["Default"];
1080
+ }
1081
+ return explorers;
1082
+ }
1083
+ getPrimaryExplorer() {
1084
+ const explorers = this.getExplorers();
1085
+ return explorers[0];
763
1086
  }
764
- getAccountUrl(address) {
765
- const baseUrl = this.chainInfo.explorerUrl || getEvmExplorerUrl("mainnet", this.chainName);
1087
+ getExplorerUrlByName(explorer) {
1088
+ const userPreference = this.config.preferences?.explorers?.[this.chain.name];
1089
+ if (userPreference && !explorer) {
1090
+ const url2 = ExplorerUrls[userPreference];
1091
+ if (url2) return url2;
1092
+ }
1093
+ if (explorer) {
1094
+ const url2 = ExplorerUrls[explorer];
1095
+ if (url2) return url2;
1096
+ }
1097
+ const primaryExplorer = this.getPrimaryExplorer();
1098
+ const url = ExplorerUrls[primaryExplorer];
1099
+ return url || ExplorerUrls[primaryExplorer];
1100
+ }
1101
+ getAccountUrl(address, explorer) {
1102
+ const baseUrl = this.getExplorerUrlByName(explorer);
766
1103
  return `${baseUrl}/address/${address}`;
767
1104
  }
768
- getTransactionUrl(hash) {
769
- const baseUrl = this.chainInfo.explorerUrl || getEvmExplorerUrl("mainnet", this.chainName);
1105
+ getTransactionUrl(hash, explorer) {
1106
+ const baseUrl = this.getExplorerUrlByName(explorer);
770
1107
  return `${baseUrl}/tx/${hash}`;
771
1108
  }
1109
+ getBlockUrl(blockNumber, explorer) {
1110
+ const baseUrl = this.getExplorerUrlByName(explorer);
1111
+ return `${baseUrl}/block/${blockNumber}`;
1112
+ }
1113
+ getAssetUrl(identifier, explorer) {
1114
+ const baseUrl = this.getExplorerUrlByName(explorer);
1115
+ return `${baseUrl}/token/${identifier}`;
1116
+ }
1117
+ getContractUrl(address, explorer) {
1118
+ const baseUrl = this.getExplorerUrlByName(explorer);
1119
+ return `${baseUrl}/address/${address}`;
1120
+ }
1121
+ getAllExplorers() {
1122
+ return this.getExplorers();
1123
+ }
1124
+ getExplorerByName(name) {
1125
+ const explorers = this.getExplorers();
1126
+ return explorers.find((explorer) => explorer.toLowerCase() === name.toLowerCase());
1127
+ }
1128
+ getAccountUrls(address) {
1129
+ const explorers = this.getAllExplorers();
1130
+ const urls = {};
1131
+ explorers.forEach((explorer) => {
1132
+ const url = ExplorerUrls[explorer];
1133
+ if (url) {
1134
+ urls[explorer] = `${url}/address/${address}`;
1135
+ }
1136
+ });
1137
+ return urls;
1138
+ }
1139
+ getTransactionUrls(hash) {
1140
+ const explorers = this.getAllExplorers();
1141
+ const urls = {};
1142
+ explorers.forEach((explorer) => {
1143
+ const url = ExplorerUrls[explorer];
1144
+ if (url) {
1145
+ urls[explorer] = `${url}/tx/${hash}`;
1146
+ }
1147
+ });
1148
+ return urls;
1149
+ }
1150
+ getAssetUrls(identifier) {
1151
+ const explorers = this.getAllExplorers();
1152
+ const urls = {};
1153
+ explorers.forEach((explorer) => {
1154
+ const url = ExplorerUrls[explorer];
1155
+ if (url) {
1156
+ urls[explorer] = `${url}/token/${identifier}`;
1157
+ }
1158
+ });
1159
+ return urls;
1160
+ }
1161
+ getContractUrls(address) {
1162
+ const explorers = this.getAllExplorers();
1163
+ const urls = {};
1164
+ explorers.forEach((explorer) => {
1165
+ const url = ExplorerUrls[explorer];
1166
+ if (url) {
1167
+ urls[explorer] = `${url}/address/${address}`;
1168
+ }
1169
+ });
1170
+ return urls;
1171
+ }
1172
+ getBlockUrls(blockNumber) {
1173
+ const explorers = this.getAllExplorers();
1174
+ const urls = {};
1175
+ explorers.forEach((explorer) => {
1176
+ const url = ExplorerUrls[explorer];
1177
+ if (url) {
1178
+ urls[explorer] = `${url}/block/${blockNumber}`;
1179
+ }
1180
+ });
1181
+ return urls;
1182
+ }
772
1183
  };
773
1184
 
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) {
1185
+ // src/WarpEvmWallet.ts
1186
+ var import_warps11 = require("@vleap/warps");
1187
+ var import_ethers5 = require("ethers");
1188
+ var WarpEvmWallet = class {
1189
+ constructor(config, chain) {
1190
+ this.config = config;
1191
+ this.chain = chain;
1192
+ this.wallet = null;
1193
+ this.provider = new import_ethers5.ethers.JsonRpcProvider(chain.defaultApiUrl || "https://rpc.sepolia.org");
1194
+ }
1195
+ async signTransaction(tx) {
1196
+ if (!tx || typeof tx !== "object") {
1197
+ throw new Error("Invalid transaction object");
1198
+ }
1199
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1200
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
1201
+ const wallet = new import_ethers5.ethers.Wallet(privateKey);
1202
+ const txRequest = {
1203
+ to: tx.to,
1204
+ data: tx.data,
1205
+ value: tx.value || 0,
1206
+ gasLimit: tx.gasLimit,
1207
+ maxFeePerGas: tx.maxFeePerGas,
1208
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
1209
+ nonce: tx.nonce,
1210
+ chainId: tx.chainId
1211
+ };
1212
+ const signedTx = await wallet.signTransaction(txRequest);
1213
+ return { ...tx, signature: signedTx };
1214
+ }
1215
+ async signMessage(message) {
1216
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1217
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
1218
+ const wallet = new import_ethers5.ethers.Wallet(privateKey);
1219
+ return await wallet.signMessage(message);
1220
+ }
1221
+ async sendTransaction(tx) {
1222
+ if (!tx || typeof tx !== "object") {
1223
+ throw new Error("Invalid transaction object");
1224
+ }
1225
+ if (!tx.signature) {
1226
+ throw new Error("Transaction must be signed before sending");
1227
+ }
1228
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1229
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
1230
+ const wallet = new import_ethers5.ethers.Wallet(privateKey).connect(this.provider);
1231
+ const txResponse = await wallet.sendTransaction(tx);
1232
+ return txResponse.hash;
1233
+ }
1234
+ create(mnemonic) {
1235
+ const wallet = import_ethers5.ethers.Wallet.fromPhrase(mnemonic);
1236
+ return { address: wallet.address, privateKey: wallet.privateKey, mnemonic };
1237
+ }
1238
+ generate() {
1239
+ const wallet = import_ethers5.ethers.Wallet.createRandom();
1240
+ return { address: wallet.address, privateKey: wallet.privateKey, mnemonic: wallet.mnemonic?.phrase || "" };
1241
+ }
1242
+ getAddress() {
1243
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1244
+ if (!privateKey) return null;
1245
+ const wallet = new import_ethers5.ethers.Wallet(privateKey);
1246
+ return wallet.address;
1247
+ }
1248
+ };
1249
+
1250
+ // src/chains/common.ts
1251
+ var createEvmAdapter = (chainName, chainPrefix, chainInfos) => {
784
1252
  return (config, fallback) => {
785
1253
  if (!fallback) throw new Error(`${chainName} adapter requires a fallback adapter`);
786
1254
  return {
787
1255
  chain: chainName,
1256
+ chainInfo: chainInfos[config.env],
788
1257
  prefix: chainPrefix,
789
- builder: () => new WarpEvmBuilder(config),
790
- executor: new WarpEvmExecutor(config),
791
- results: new WarpEvmResults(config),
1258
+ builder: () => fallback.builder(),
1259
+ executor: new WarpEvmExecutor(config, chainInfos[config.env]),
1260
+ results: new WarpEvmResults(config, chainInfos[config.env]),
792
1261
  serializer: new WarpEvmSerializer(),
793
1262
  registry: fallback.registry,
794
- explorer: (chainInfo) => new WarpEvmExplorer(chainInfo),
1263
+ explorer: new WarpEvmExplorer(chainInfos[config.env], config),
795
1264
  abiBuilder: () => fallback.abiBuilder(),
796
- brandBuilder: () => fallback.brandBuilder()
1265
+ brandBuilder: () => fallback.brandBuilder(),
1266
+ dataLoader: new WarpEvmDataLoader(config, chainInfos[config.env]),
1267
+ wallet: new WarpEvmWallet(config, chainInfos[config.env])
797
1268
  };
798
1269
  };
799
- }
1270
+ };
1271
+
1272
+ // src/chains/arbitrum.ts
1273
+ var NativeTokenArb = {
1274
+ chain: import_warps12.WarpChainName.Arbitrum,
1275
+ identifier: "ARB",
1276
+ symbol: "ARB",
1277
+ name: "Arbitrum",
1278
+ decimals: 18,
1279
+ logoUrl: "https://vleap.ai/images/tokens/arb.svg"
1280
+ };
1281
+ var getArbitrumAdapter = createEvmAdapter(import_warps12.WarpChainName.Arbitrum, "arb", {
1282
+ mainnet: {
1283
+ name: import_warps12.WarpChainName.Arbitrum,
1284
+ displayName: "Arbitrum",
1285
+ chainId: "42161",
1286
+ blockTime: 1e3,
1287
+ addressHrp: "0x",
1288
+ defaultApiUrl: "https://arb1.arbitrum.io/rpc",
1289
+ logoUrl: "https://vleap.ai/images/chains/arbitrum.svg",
1290
+ nativeToken: NativeTokenArb
1291
+ },
1292
+ testnet: {
1293
+ name: import_warps12.WarpChainName.Arbitrum,
1294
+ displayName: "Arbitrum Sepolia",
1295
+ chainId: "421614",
1296
+ blockTime: 1e3,
1297
+ addressHrp: "0x",
1298
+ defaultApiUrl: "https://sepolia-rollup.arbitrum.io/rpc",
1299
+ logoUrl: "https://vleap.ai/images/chains/arbitrum.svg",
1300
+ nativeToken: NativeTokenArb
1301
+ },
1302
+ devnet: {
1303
+ name: import_warps12.WarpChainName.Arbitrum,
1304
+ displayName: "Arbitrum Sepolia",
1305
+ chainId: "421614",
1306
+ blockTime: 1e3,
1307
+ addressHrp: "0x",
1308
+ defaultApiUrl: "https://sepolia-rollup.arbitrum.io/rpc",
1309
+ logoUrl: "https://vleap.ai/images/chains/arbitrum.svg",
1310
+ nativeToken: NativeTokenArb
1311
+ }
1312
+ });
1313
+
1314
+ // src/chains/base.ts
1315
+ var import_warps13 = require("@vleap/warps");
1316
+ var NativeTokenBase = {
1317
+ chain: import_warps13.WarpChainName.Base,
1318
+ identifier: "ETH",
1319
+ name: "Ether",
1320
+ symbol: "ETH",
1321
+ decimals: 18,
1322
+ logoUrl: "https://vleap.ai/images/tokens/eth.svg"
1323
+ };
1324
+ var getBaseAdapter = createEvmAdapter(import_warps13.WarpChainName.Base, "base", {
1325
+ mainnet: {
1326
+ name: import_warps13.WarpChainName.Base,
1327
+ displayName: "Base",
1328
+ chainId: "8453",
1329
+ blockTime: 2e3,
1330
+ addressHrp: "0x",
1331
+ defaultApiUrl: "https://mainnet.base.org",
1332
+ logoUrl: "https://vleap.ai/images/chains/base.svg",
1333
+ nativeToken: NativeTokenBase
1334
+ },
1335
+ testnet: {
1336
+ name: import_warps13.WarpChainName.Base,
1337
+ displayName: "Base Sepolia",
1338
+ chainId: "84532",
1339
+ blockTime: 2e3,
1340
+ addressHrp: "0x",
1341
+ defaultApiUrl: "https://sepolia.base.org",
1342
+ logoUrl: "https://vleap.ai/images/chains/base.svg",
1343
+ nativeToken: NativeTokenBase
1344
+ },
1345
+ devnet: {
1346
+ name: import_warps13.WarpChainName.Base,
1347
+ displayName: "Base Sepolia",
1348
+ chainId: "84532",
1349
+ blockTime: 2e3,
1350
+ addressHrp: "0x",
1351
+ defaultApiUrl: "https://sepolia.base.org",
1352
+ logoUrl: "https://vleap.ai/images/chains/base.svg",
1353
+ nativeToken: NativeTokenBase
1354
+ }
1355
+ });
1356
+
1357
+ // src/chains/combined.ts
1358
+ var import_warps16 = require("@vleap/warps");
1359
+
1360
+ // src/chains/ethereum.ts
1361
+ var import_warps14 = require("@vleap/warps");
1362
+ var NativeTokenEth = {
1363
+ chain: import_warps14.WarpChainName.Ethereum,
1364
+ identifier: "ETH",
1365
+ symbol: "ETH",
1366
+ name: "Ether",
1367
+ decimals: 18,
1368
+ logoUrl: "https://vleap.ai/images/tokens/eth.svg"
1369
+ };
1370
+ var getEthereumAdapter = createEvmAdapter(import_warps14.WarpChainName.Ethereum, "eth", {
1371
+ mainnet: {
1372
+ name: import_warps14.WarpChainName.Ethereum,
1373
+ displayName: "Ethereum Mainnet",
1374
+ chainId: "1",
1375
+ blockTime: 12e3,
1376
+ addressHrp: "0x",
1377
+ defaultApiUrl: "https://ethereum-rpc.publicnode.com",
1378
+ logoUrl: "https://vleap.ai/images/chains/ethereum.svg",
1379
+ nativeToken: NativeTokenEth
1380
+ },
1381
+ testnet: {
1382
+ name: import_warps14.WarpChainName.Ethereum,
1383
+ displayName: "Ethereum Sepolia",
1384
+ chainId: "11155111",
1385
+ blockTime: 12e3,
1386
+ addressHrp: "0x",
1387
+ defaultApiUrl: "https://ethereum-sepolia-rpc.publicnode.com",
1388
+ logoUrl: "https://vleap.ai/images/chains/ethereum.svg",
1389
+ nativeToken: NativeTokenEth
1390
+ },
1391
+ devnet: {
1392
+ name: import_warps14.WarpChainName.Ethereum,
1393
+ displayName: "Ethereum Sepolia",
1394
+ chainId: "11155111",
1395
+ blockTime: 12e3,
1396
+ addressHrp: "0x",
1397
+ defaultApiUrl: "https://ethereum-sepolia-rpc.publicnode.com",
1398
+ logoUrl: "https://vleap.ai/images/chains/ethereum.svg",
1399
+ nativeToken: NativeTokenEth
1400
+ }
1401
+ });
1402
+
1403
+ // src/chains/somnia.ts
1404
+ var import_warps15 = require("@vleap/warps");
1405
+ var NativeTokenSomi = {
1406
+ chain: import_warps15.WarpChainName.Somnia,
1407
+ identifier: "SOMI",
1408
+ symbol: "SOMI",
1409
+ name: "Somnia",
1410
+ decimals: 18,
1411
+ logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
1412
+ };
1413
+ var NativeTokenStt = {
1414
+ chain: import_warps15.WarpChainName.Somnia,
1415
+ identifier: "STT",
1416
+ symbol: "STT",
1417
+ name: "Somnia Testnet Token",
1418
+ decimals: 18,
1419
+ logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
1420
+ };
1421
+ var getSomniaAdapter = createEvmAdapter(import_warps15.WarpChainName.Somnia, "eth", {
1422
+ mainnet: {
1423
+ name: import_warps15.WarpChainName.Somnia,
1424
+ displayName: "Somnia Mainnet",
1425
+ chainId: "5031",
1426
+ blockTime: 100,
1427
+ addressHrp: "0x",
1428
+ defaultApiUrl: "https://api.infra.mainnet.somnia.network/",
1429
+ logoUrl: "https://vleap.ai/images/chains/somnia.png",
1430
+ nativeToken: NativeTokenSomi
1431
+ },
1432
+ testnet: {
1433
+ name: import_warps15.WarpChainName.Somnia,
1434
+ displayName: "Somnia Testnet",
1435
+ chainId: "50312",
1436
+ blockTime: 100,
1437
+ addressHrp: "0x",
1438
+ defaultApiUrl: "https://dream-rpc.somnia.network/",
1439
+ logoUrl: "https://vleap.ai/images/chains/somnia.png",
1440
+ nativeToken: NativeTokenStt
1441
+ },
1442
+ devnet: {
1443
+ name: import_warps15.WarpChainName.Somnia,
1444
+ displayName: "Somnia Testnet",
1445
+ chainId: "50312",
1446
+ blockTime: 100,
1447
+ addressHrp: "0x",
1448
+ defaultApiUrl: "https://dream-rpc.somnia.network",
1449
+ logoUrl: "https://vleap.ai/images/chains/somnia.png",
1450
+ nativeToken: NativeTokenStt
1451
+ }
1452
+ });
1453
+
1454
+ // src/chains/combined.ts
1455
+ var getAllEvmAdapters = (config, fallback) => [
1456
+ getEthereumAdapter(config, fallback),
1457
+ getBaseAdapter(config, fallback),
1458
+ getArbitrumAdapter(config, fallback),
1459
+ getSomniaAdapter(config, fallback)
1460
+ ];
1461
+ var getAllEvmChainNames = () => [
1462
+ import_warps16.WarpChainName.Ethereum,
1463
+ import_warps16.WarpChainName.Base,
1464
+ import_warps16.WarpChainName.Arbitrum,
1465
+ import_warps16.WarpChainName.Somnia
1466
+ ];
800
1467
  // Annotate the CommonJS export names for ESM import in node:
801
1468
  0 && (module.exports = {
802
- EVM_CHAIN_CONFIGS,
803
- WarpEvmBuilder,
1469
+ ArbitrumExplorers,
1470
+ BaseExplorers,
1471
+ EthereumExplorers,
1472
+ EvmExplorers,
1473
+ ExplorerUrls,
1474
+ KnownTokens,
1475
+ NativeTokenArb,
1476
+ NativeTokenBase,
1477
+ NativeTokenEth,
1478
+ UniswapService,
804
1479
  WarpEvmConstants,
1480
+ WarpEvmDataLoader,
805
1481
  WarpEvmExecutor,
806
1482
  WarpEvmExplorer,
807
1483
  WarpEvmResults,
808
1484
  WarpEvmSerializer,
1485
+ WarpEvmWallet,
1486
+ createEvmAdapter,
1487
+ findKnownTokenById,
809
1488
  getAllEvmAdapters,
1489
+ getAllEvmChainNames,
810
1490
  getArbitrumAdapter,
811
1491
  getBaseAdapter,
812
1492
  getEthereumAdapter,
813
- getEvmApiUrl,
814
- getEvmBlockTime,
815
- getEvmChainConfig,
816
- getEvmChainId,
817
- getEvmExplorerUrl,
818
- getEvmNativeToken,
819
- getEvmRegistryAddress,
820
- getSupportedEnvironments,
821
- getSupportedEvmChains
1493
+ getKnownTokensForChain
822
1494
  });
823
1495
  //# sourceMappingURL=index.js.map