@vleap/warps-adapter-evm 0.2.0-alpha.8 → 0.2.0-beta.43

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