@vleap/warps-adapter-evm 0.2.0-beta.55 → 0.2.0-beta.57

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,16 +20,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ ArbitrumAdapter: () => ArbitrumAdapter,
23
24
  ArbitrumExplorers: () => ArbitrumExplorers,
25
+ BaseAdapter: () => BaseAdapter,
24
26
  BaseExplorers: () => BaseExplorers,
27
+ EthereumAdapter: () => EthereumAdapter,
25
28
  EthereumExplorers: () => EthereumExplorers,
29
+ EvmChainIdMap: () => EvmChainIdMap,
30
+ EvmChainIds: () => EvmChainIds,
26
31
  EvmExplorers: () => EvmExplorers,
27
32
  ExplorerUrls: () => ExplorerUrls,
28
33
  KnownTokens: () => KnownTokens,
29
34
  NativeTokenArb: () => NativeTokenArb,
30
35
  NativeTokenBase: () => NativeTokenBase,
31
36
  NativeTokenEth: () => NativeTokenEth,
32
- UniswapService: () => UniswapService,
37
+ SupportedEvmChainIds: () => SupportedEvmChainIds,
33
38
  WarpEvmConstants: () => WarpEvmConstants,
34
39
  WarpEvmDataLoader: () => WarpEvmDataLoader,
35
40
  WarpEvmExecutor: () => WarpEvmExecutor,
@@ -41,19 +46,16 @@ __export(index_exports, {
41
46
  findKnownTokenById: () => findKnownTokenById,
42
47
  getAllEvmAdapters: () => getAllEvmAdapters,
43
48
  getAllEvmChainNames: () => getAllEvmChainNames,
44
- getArbitrumAdapter: () => getArbitrumAdapter,
45
- getBaseAdapter: () => getBaseAdapter,
46
- getEthereumAdapter: () => getEthereumAdapter,
47
49
  getKnownTokensForChain: () => getKnownTokensForChain
48
50
  });
49
51
  module.exports = __toCommonJS(index_exports);
50
52
 
51
53
  // src/chains/arbitrum.ts
52
- var import_warps13 = require("@vleap/warps");
54
+ var import_warps15 = require("@vleap/warps");
53
55
 
54
56
  // src/WarpEvmDataLoader.ts
55
- var import_warps8 = require("@vleap/warps");
56
- var import_ethers = require("ethers");
57
+ var import_warps10 = require("@vleap/warps");
58
+ var import_ethers3 = require("ethers");
57
59
 
58
60
  // src/providers/UniswapService.ts
59
61
  var import_warps = require("@vleap/warps");
@@ -141,9 +143,161 @@ var _UniswapService = class _UniswapService {
141
143
  _UniswapService.UNISWAP_TOKEN_LIST_URL = "https://tokens.uniswap.org";
142
144
  var UniswapService = _UniswapService;
143
145
 
144
- // src/tokens/arbitrum.ts
146
+ // src/providers/PrivateKeyWalletProvider.ts
147
+ var import_ethers = require("ethers");
145
148
  var import_warps2 = require("@vleap/warps");
146
- var ArbitrumChain = import_warps2.WarpChainName.Arbitrum;
149
+ var PrivateKeyWalletProvider = class {
150
+ constructor(config, chain, rpcProvider) {
151
+ this.config = config;
152
+ this.chain = chain;
153
+ this.rpcProvider = rpcProvider;
154
+ this.wallet = null;
155
+ }
156
+ async getAddress() {
157
+ try {
158
+ const wallet = this.getWallet();
159
+ return wallet.address;
160
+ } catch {
161
+ return null;
162
+ }
163
+ }
164
+ async getPublicKey() {
165
+ try {
166
+ const wallet = this.getWallet();
167
+ const publicKey = wallet.signingKey.publicKey;
168
+ return publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
169
+ } catch {
170
+ return null;
171
+ }
172
+ }
173
+ async signTransaction(tx) {
174
+ const wallet = this.getWallet();
175
+ const txRequest = {
176
+ to: tx.to,
177
+ data: tx.data,
178
+ value: tx.value || 0,
179
+ gasLimit: tx.gasLimit,
180
+ maxFeePerGas: tx.maxFeePerGas,
181
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
182
+ nonce: tx.nonce,
183
+ chainId: tx.chainId
184
+ };
185
+ const signedTx = await wallet.signTransaction(txRequest);
186
+ return { ...tx, signature: signedTx };
187
+ }
188
+ async signMessage(message) {
189
+ const wallet = this.getWallet();
190
+ return await wallet.signMessage(message);
191
+ }
192
+ getWalletInstance() {
193
+ return this.getWallet();
194
+ }
195
+ create(mnemonic) {
196
+ const wallet = import_ethers.ethers.Wallet.fromPhrase(mnemonic);
197
+ return {
198
+ provider: "privateKey",
199
+ address: wallet.address,
200
+ privateKey: wallet.privateKey,
201
+ mnemonic
202
+ };
203
+ }
204
+ generate() {
205
+ const wallet = import_ethers.ethers.Wallet.createRandom();
206
+ return {
207
+ provider: "privateKey",
208
+ address: wallet.address,
209
+ privateKey: wallet.privateKey,
210
+ mnemonic: wallet.mnemonic?.phrase || null
211
+ };
212
+ }
213
+ getWallet() {
214
+ if (this.wallet) return this.wallet;
215
+ const privateKey = (0, import_warps2.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
216
+ if (!privateKey) throw new Error("No private key provided");
217
+ this.wallet = new import_ethers.ethers.Wallet(privateKey);
218
+ return this.wallet;
219
+ }
220
+ };
221
+
222
+ // src/providers/MnemonicWalletProvider.ts
223
+ var import_ethers2 = require("ethers");
224
+ var import_warps3 = require("@vleap/warps");
225
+ var MnemonicWalletProvider = class {
226
+ constructor(config, chain, rpcProvider) {
227
+ this.config = config;
228
+ this.chain = chain;
229
+ this.rpcProvider = rpcProvider;
230
+ this.wallet = null;
231
+ }
232
+ async getAddress() {
233
+ try {
234
+ const wallet = this.getWallet();
235
+ return wallet.address;
236
+ } catch {
237
+ return null;
238
+ }
239
+ }
240
+ async getPublicKey() {
241
+ try {
242
+ const wallet = this.getWallet();
243
+ const publicKey = wallet.signingKey.publicKey;
244
+ return publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
245
+ } catch {
246
+ return null;
247
+ }
248
+ }
249
+ async signTransaction(tx) {
250
+ const wallet = this.getWallet();
251
+ const txRequest = {
252
+ to: tx.to,
253
+ data: tx.data,
254
+ value: tx.value || 0,
255
+ gasLimit: tx.gasLimit,
256
+ maxFeePerGas: tx.maxFeePerGas,
257
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
258
+ nonce: tx.nonce,
259
+ chainId: tx.chainId
260
+ };
261
+ const signedTx = await wallet.signTransaction(txRequest);
262
+ return { ...tx, signature: signedTx };
263
+ }
264
+ async signMessage(message) {
265
+ const wallet = this.getWallet();
266
+ return await wallet.signMessage(message);
267
+ }
268
+ getWalletInstance() {
269
+ return this.getWallet();
270
+ }
271
+ create(mnemonic) {
272
+ const wallet = import_ethers2.ethers.Wallet.fromPhrase(mnemonic);
273
+ return {
274
+ provider: "mnemonic",
275
+ address: wallet.address,
276
+ privateKey: wallet.privateKey,
277
+ mnemonic
278
+ };
279
+ }
280
+ generate() {
281
+ const wallet = import_ethers2.ethers.Wallet.createRandom();
282
+ return {
283
+ provider: "mnemonic",
284
+ address: wallet.address,
285
+ privateKey: wallet.privateKey,
286
+ mnemonic: wallet.mnemonic?.phrase || null
287
+ };
288
+ }
289
+ getWallet() {
290
+ if (this.wallet) return this.wallet;
291
+ const mnemonic = (0, import_warps3.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
292
+ if (!mnemonic) throw new Error("No mnemonic provided");
293
+ this.wallet = import_ethers2.ethers.Wallet.fromPhrase(mnemonic);
294
+ return this.wallet;
295
+ }
296
+ };
297
+
298
+ // src/tokens/arbitrum.ts
299
+ var import_warps4 = require("@vleap/warps");
300
+ var ArbitrumChain = import_warps4.WarpChainName.Arbitrum;
147
301
  var ArbitrumTokens = [
148
302
  {
149
303
  chain: ArbitrumChain,
@@ -180,8 +334,8 @@ var ArbitrumTokens = [
180
334
  ];
181
335
 
182
336
  // src/tokens/arbitrum-sepolia.ts
183
- var import_warps3 = require("@vleap/warps");
184
- var ArbitrumChain2 = import_warps3.WarpChainName.Arbitrum;
337
+ var import_warps5 = require("@vleap/warps");
338
+ var ArbitrumChain2 = import_warps5.WarpChainName.Arbitrum;
185
339
  var ArbitrumSepoliaTokens = [
186
340
  {
187
341
  chain: ArbitrumChain2,
@@ -210,8 +364,8 @@ var ArbitrumSepoliaTokens = [
210
364
  ];
211
365
 
212
366
  // src/tokens/base.ts
213
- var import_warps4 = require("@vleap/warps");
214
- var BaseChain = import_warps4.WarpChainName.Base;
367
+ var import_warps6 = require("@vleap/warps");
368
+ var BaseChain = import_warps6.WarpChainName.Base;
215
369
  var BaseTokens = [
216
370
  {
217
371
  chain: BaseChain,
@@ -256,8 +410,8 @@ var BaseTokens = [
256
410
  ];
257
411
 
258
412
  // src/tokens/base-sepolia.ts
259
- var import_warps5 = require("@vleap/warps");
260
- var BaseChain2 = import_warps5.WarpChainName.Base;
413
+ var import_warps7 = require("@vleap/warps");
414
+ var BaseChain2 = import_warps7.WarpChainName.Base;
261
415
  var BaseSepoliaTokens = [
262
416
  {
263
417
  chain: BaseChain2,
@@ -294,8 +448,8 @@ var BaseSepoliaTokens = [
294
448
  ];
295
449
 
296
450
  // src/tokens/ethereum.ts
297
- var import_warps6 = require("@vleap/warps");
298
- var EthereumChain = import_warps6.WarpChainName.Ethereum;
451
+ var import_warps8 = require("@vleap/warps");
452
+ var EthereumChain = import_warps8.WarpChainName.Ethereum;
299
453
  var EthereumTokens = [
300
454
  {
301
455
  chain: EthereumChain,
@@ -348,8 +502,8 @@ var EthereumTokens = [
348
502
  ];
349
503
 
350
504
  // src/tokens/ethereum-sepolia.ts
351
- var import_warps7 = require("@vleap/warps");
352
- var EthereumChain2 = import_warps7.WarpChainName.Ethereum;
505
+ var import_warps9 = require("@vleap/warps");
506
+ var EthereumChain2 = import_warps9.WarpChainName.Ethereum;
353
507
  var EthereumSepoliaTokens = [
354
508
  {
355
509
  chain: EthereumChain2,
@@ -431,10 +585,10 @@ var WarpEvmDataLoader = class {
431
585
  constructor(config, chain) {
432
586
  this.config = config;
433
587
  this.chain = chain;
434
- const providerConfig = (0, import_warps8.getProviderConfig)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
435
- const network = new import_ethers.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
436
- this.provider = new import_ethers.ethers.JsonRpcProvider(providerConfig.url, network);
437
- this.cache = new import_warps8.WarpCache(config.cache?.type);
588
+ const providerConfig = (0, import_warps10.getProviderConfig)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
589
+ const network = new import_ethers3.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
590
+ this.provider = new import_ethers3.ethers.JsonRpcProvider(providerConfig.url, network);
591
+ this.cache = new import_warps10.WarpCache(config.cache?.type);
438
592
  this.uniswapService = new UniswapService(this.cache, parseInt(this.chain.chainId));
439
593
  }
440
594
  async getAccount(address) {
@@ -470,7 +624,7 @@ var WarpEvmDataLoader = class {
470
624
  if (identifier === this.chain.nativeToken.identifier) {
471
625
  return this.chain.nativeToken;
472
626
  }
473
- const cacheKey = import_warps8.WarpCacheKey.Asset(this.config.env, this.chain.name, identifier);
627
+ const cacheKey = import_warps10.WarpCacheKey.Asset(this.config.env, this.chain.name, identifier);
474
628
  const cachedAsset = this.cache.get(cacheKey);
475
629
  if (cachedAsset) {
476
630
  return cachedAsset;
@@ -498,7 +652,7 @@ var WarpEvmDataLoader = class {
498
652
  decimals: metadata.decimals,
499
653
  logoUrl: metadata.logoUrl
500
654
  };
501
- this.cache.set(cacheKey, asset, import_warps8.CacheTtl.OneHour);
655
+ this.cache.set(cacheKey, asset, import_warps10.CacheTtl.OneHour);
502
656
  return asset;
503
657
  } catch (error) {
504
658
  return null;
@@ -558,7 +712,7 @@ var WarpEvmDataLoader = class {
558
712
  }));
559
713
  }
560
714
  async getTokenBalance(address, tokenAddress) {
561
- const contract = new import_ethers.ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
715
+ const contract = new import_ethers3.ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
562
716
  const balance = await contract.balanceOf(address);
563
717
  return balance;
564
718
  }
@@ -567,7 +721,7 @@ var WarpEvmDataLoader = class {
567
721
  if (uniswapMetadata) {
568
722
  return uniswapMetadata;
569
723
  }
570
- const contract = new import_ethers.ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
724
+ const contract = new import_ethers3.ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
571
725
  const [name, symbol, decimals] = await Promise.all([
572
726
  contract.name().catch(() => "Unknown Token"),
573
727
  contract.symbol().catch(() => "UNKNOWN"),
@@ -583,8 +737,8 @@ var WarpEvmDataLoader = class {
583
737
  };
584
738
 
585
739
  // src/WarpEvmExecutor.ts
586
- var import_warps11 = require("@vleap/warps");
587
- var import_ethers4 = require("ethers");
740
+ var import_warps13 = require("@vleap/warps");
741
+ var import_ethers6 = require("ethers");
588
742
 
589
743
  // src/constants.ts
590
744
  var WarpEvmConstants = {
@@ -660,25 +814,74 @@ var ExplorerUrls = {
660
814
  ["blockscout_base" /* BlockscoutBase */]: "https://base.blockscout.com",
661
815
  ["blockscout_base_sepolia" /* BlockscoutBaseSepolia */]: "https://sepolia.blockscout.com"
662
816
  };
817
+ var EvmChainIds = {
818
+ Ethereum: {
819
+ Mainnet: 1,
820
+ Goerli: 5,
821
+ Sepolia: 11155111
822
+ },
823
+ Polygon: {
824
+ Mainnet: 137,
825
+ Mumbai: 80001
826
+ },
827
+ Arbitrum: {
828
+ Mainnet: 42161,
829
+ Sepolia: 421614
830
+ },
831
+ Base: {
832
+ Mainnet: 8453,
833
+ Sepolia: 84532
834
+ },
835
+ Optimism: {
836
+ Mainnet: 10,
837
+ Sepolia: 11155420
838
+ }
839
+ };
840
+ var EvmChainIdMap = {
841
+ "ethereum:mainnet": EvmChainIds.Ethereum.Mainnet,
842
+ "ethereum:goerli": EvmChainIds.Ethereum.Goerli,
843
+ "ethereum:sepolia": EvmChainIds.Ethereum.Sepolia,
844
+ "polygon:mainnet": EvmChainIds.Polygon.Mainnet,
845
+ "polygon:mumbai": EvmChainIds.Polygon.Mumbai,
846
+ "arbitrum:mainnet": EvmChainIds.Arbitrum.Mainnet,
847
+ "arbitrum:sepolia": EvmChainIds.Arbitrum.Sepolia,
848
+ "base:mainnet": EvmChainIds.Base.Mainnet,
849
+ "base:sepolia": EvmChainIds.Base.Sepolia,
850
+ "optimism:mainnet": EvmChainIds.Optimism.Mainnet,
851
+ "optimism:sepolia": EvmChainIds.Optimism.Sepolia
852
+ };
853
+ var SupportedEvmChainIds = [
854
+ EvmChainIds.Ethereum.Mainnet,
855
+ EvmChainIds.Ethereum.Goerli,
856
+ EvmChainIds.Ethereum.Sepolia,
857
+ EvmChainIds.Polygon.Mainnet,
858
+ EvmChainIds.Polygon.Mumbai,
859
+ EvmChainIds.Arbitrum.Mainnet,
860
+ EvmChainIds.Arbitrum.Sepolia,
861
+ EvmChainIds.Base.Mainnet,
862
+ EvmChainIds.Base.Sepolia,
863
+ EvmChainIds.Optimism.Mainnet,
864
+ EvmChainIds.Optimism.Sepolia
865
+ ];
663
866
 
664
867
  // src/WarpEvmOutput.ts
665
- var import_warps10 = require("@vleap/warps");
666
- var import_ethers3 = require("ethers");
868
+ var import_warps12 = require("@vleap/warps");
869
+ var import_ethers5 = require("ethers");
667
870
 
668
871
  // src/WarpEvmSerializer.ts
669
- var import_warps9 = require("@vleap/warps");
670
- var import_ethers2 = require("ethers");
671
- var SplitParamsRegex = new RegExp(`${import_warps9.WarpConstants.ArgParamsSeparator}(.*)`);
872
+ var import_warps11 = require("@vleap/warps");
873
+ var import_ethers4 = require("ethers");
874
+ var SplitParamsRegex = new RegExp(`${import_warps11.WarpConstants.ArgParamsSeparator}(.*)`);
672
875
  var WarpEvmSerializer = class {
673
876
  constructor() {
674
- this.coreSerializer = new import_warps9.WarpSerializer();
877
+ this.coreSerializer = new import_warps11.WarpSerializer();
675
878
  }
676
879
  typedToString(value) {
677
880
  if (typeof value === "string") {
678
- if (import_ethers2.ethers.isAddress(value)) {
881
+ if (import_ethers4.ethers.isAddress(value)) {
679
882
  return `address:${value}`;
680
883
  }
681
- if (import_ethers2.ethers.isHexString(value) && !import_ethers2.ethers.isAddress(value)) {
884
+ if (import_ethers4.ethers.isHexString(value) && !import_ethers4.ethers.isAddress(value)) {
682
885
  return `hex:${value}`;
683
886
  }
684
887
  return `string:${value}`;
@@ -700,9 +903,9 @@ var WarpEvmSerializer = class {
700
903
  }
701
904
  if (Array.isArray(value)) {
702
905
  if (value.length === 0) return `list:string:`;
703
- const types = value.map((item) => this.typedToString(item).split(import_warps9.WarpConstants.ArgParamsSeparator)[0]);
906
+ const types = value.map((item) => this.typedToString(item).split(import_warps11.WarpConstants.ArgParamsSeparator)[0]);
704
907
  const type = types[0];
705
- const values = value.map((item) => this.typedToString(item).split(import_warps9.WarpConstants.ArgParamsSeparator)[1]);
908
+ const values = value.map((item) => this.typedToString(item).split(import_warps11.WarpConstants.ArgParamsSeparator)[1]);
706
909
  return `list:${type}:${values.join(",")}`;
707
910
  }
708
911
  if (value === null || value === void 0) {
@@ -712,8 +915,8 @@ var WarpEvmSerializer = class {
712
915
  }
713
916
  typedToNative(value) {
714
917
  const stringValue = this.typedToString(value);
715
- const [type, ...valueParts] = stringValue.split(import_warps9.WarpConstants.ArgParamsSeparator);
716
- const nativeValue = valueParts.join(import_warps9.WarpConstants.ArgParamsSeparator);
918
+ const [type, ...valueParts] = stringValue.split(import_warps11.WarpConstants.ArgParamsSeparator);
919
+ const nativeValue = valueParts.join(import_warps11.WarpConstants.ArgParamsSeparator);
717
920
  return [type, this.parseNativeValue(type, nativeValue)];
718
921
  }
719
922
  nativeToTyped(type, value) {
@@ -765,7 +968,7 @@ var WarpEvmSerializer = class {
765
968
  }
766
969
  }
767
970
  stringToTyped(value) {
768
- const parts = value.split(import_warps9.WarpConstants.ArgParamsSeparator, 2);
971
+ const parts = value.split(import_warps11.WarpConstants.ArgParamsSeparator, 2);
769
972
  if (parts.length < 2) {
770
973
  return value;
771
974
  }
@@ -824,14 +1027,14 @@ var WarpEvmOutput = class {
824
1027
  this.config = config;
825
1028
  this.chain = chain;
826
1029
  this.serializer = new WarpEvmSerializer();
827
- const providerConfig = (0, import_warps10.getProviderConfig)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
828
- const network = new import_ethers3.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
829
- this.provider = new import_ethers3.ethers.JsonRpcProvider(providerConfig.url, network);
830
- this.cache = new import_warps10.WarpCache(config.cache?.type);
1030
+ const providerConfig = (0, import_warps12.getProviderConfig)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
1031
+ const network = new import_ethers5.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
1032
+ this.provider = new import_ethers5.ethers.JsonRpcProvider(providerConfig.url, network);
1033
+ this.cache = new import_warps12.WarpCache(config.cache?.type);
831
1034
  }
832
1035
  async getActionExecution(warp, actionIndex, tx) {
833
- const inputs = this.cache.get(import_warps10.WarpCacheKey.WarpExecutable(this.config.env, warp.meta?.hash || "", actionIndex)) ?? [];
834
- const resolvedInputs = (0, import_warps10.extractResolvedInputValues)(inputs);
1036
+ const inputs = this.cache.get(import_warps12.WarpCacheKey.WarpExecutable(this.config.env, warp.meta?.hash || "", actionIndex)) ?? [];
1037
+ const resolvedInputs = (0, import_warps12.extractResolvedInputValues)(inputs);
835
1038
  if (!tx) {
836
1039
  return this.createFailedExecution(warp, actionIndex, resolvedInputs);
837
1040
  }
@@ -845,7 +1048,7 @@ var WarpEvmOutput = class {
845
1048
  status: "error",
846
1049
  warp,
847
1050
  action: actionIndex,
848
- user: (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
1051
+ user: (0, import_warps12.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
849
1052
  txHash: "",
850
1053
  tx: null,
851
1054
  next: null,
@@ -868,7 +1071,7 @@ var WarpEvmOutput = class {
868
1071
  status: success ? "success" : "error",
869
1072
  warp,
870
1073
  action: actionIndex,
871
- user: (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
1074
+ user: (0, import_warps12.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
872
1075
  txHash: transactionHash,
873
1076
  tx,
874
1077
  next: null,
@@ -899,7 +1102,7 @@ var WarpEvmOutput = class {
899
1102
  status: success ? "success" : "error",
900
1103
  warp,
901
1104
  action: actionIndex,
902
- user: (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
1105
+ user: (0, import_warps12.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
903
1106
  txHash: transactionHash,
904
1107
  tx,
905
1108
  next: null,
@@ -927,8 +1130,8 @@ var WarpEvmOutput = class {
927
1130
  return value;
928
1131
  };
929
1132
  for (const [key, path] of Object.entries(warp.output)) {
930
- if (path.startsWith(import_warps10.WarpConstants.Transform.Prefix)) continue;
931
- const currentActionIndex = (0, import_warps10.parseOutputOutIndex)(path);
1133
+ if (path.startsWith(import_warps12.WarpConstants.Transform.Prefix)) continue;
1134
+ const currentActionIndex = (0, import_warps12.parseOutputOutIndex)(path);
932
1135
  if (currentActionIndex !== null && currentActionIndex !== actionIndex) {
933
1136
  output[key] = null;
934
1137
  continue;
@@ -939,7 +1142,7 @@ var WarpEvmOutput = class {
939
1142
  output[key] = path;
940
1143
  }
941
1144
  }
942
- return { values, output: await (0, import_warps10.evaluateOutputCommon)(warp, output, actionIndex, inputs, this.serializer.coreSerializer, this.config) };
1145
+ return { values, output: await (0, import_warps12.evaluateOutputCommon)(warp, output, actionIndex, inputs, this.serializer.coreSerializer, this.config) };
943
1146
  }
944
1147
  async getTransactionStatus(txHash) {
945
1148
  try {
@@ -971,13 +1174,13 @@ var WarpEvmExecutor = class {
971
1174
  this.config = config;
972
1175
  this.chain = chain;
973
1176
  this.serializer = new WarpEvmSerializer();
974
- const providerConfig = (0, import_warps11.getProviderConfig)(this.config, chain.name, this.config.env, this.chain.defaultApiUrl);
975
- const network = new import_ethers4.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
976
- this.provider = new import_ethers4.ethers.JsonRpcProvider(providerConfig.url, network);
1177
+ const providerConfig = (0, import_warps13.getProviderConfig)(this.config, chain.name, this.config.env, this.chain.defaultApiUrl);
1178
+ const network = new import_ethers6.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
1179
+ this.provider = new import_ethers6.ethers.JsonRpcProvider(providerConfig.url, network);
977
1180
  this.output = new WarpEvmOutput(config, this.chain);
978
1181
  }
979
1182
  async createTransaction(executable) {
980
- const action = (0, import_warps11.getWarpActionByIndex)(executable.warp, executable.action);
1183
+ const action = (0, import_warps13.getWarpActionByIndex)(executable.warp, executable.action);
981
1184
  let tx = null;
982
1185
  if (action.type === "transfer") {
983
1186
  tx = await this.createTransferTransaction(executable);
@@ -992,9 +1195,9 @@ var WarpEvmExecutor = class {
992
1195
  return tx;
993
1196
  }
994
1197
  async createTransferTransaction(executable) {
995
- const userWallet = (0, import_warps11.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
1198
+ const userWallet = (0, import_warps13.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
996
1199
  if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
997
- if (!import_ethers4.ethers.isAddress(executable.destination)) {
1200
+ if (!import_ethers6.ethers.isAddress(executable.destination)) {
998
1201
  throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
999
1202
  }
1000
1203
  if (executable.transfers && executable.transfers.length > 0) {
@@ -1008,17 +1211,17 @@ var WarpEvmExecutor = class {
1008
1211
  return this.estimateGasAndSetDefaults(tx, userWallet);
1009
1212
  }
1010
1213
  async createContractCallTransaction(executable) {
1011
- const userWallet = (0, import_warps11.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
1214
+ const userWallet = (0, import_warps13.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
1012
1215
  if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
1013
- const action = (0, import_warps11.getWarpActionByIndex)(executable.warp, executable.action);
1216
+ const action = (0, import_warps13.getWarpActionByIndex)(executable.warp, executable.action);
1014
1217
  if (!action || !("func" in action) || !action.func) throw new Error("WarpEvmExecutor: Contract action must have a function name");
1015
- if (!import_ethers4.ethers.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
1218
+ if (!import_ethers6.ethers.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
1016
1219
  try {
1017
1220
  let iface;
1018
1221
  try {
1019
- iface = new import_ethers4.ethers.Interface(JSON.parse(action.abi));
1222
+ iface = new import_ethers6.ethers.Interface(JSON.parse(action.abi));
1020
1223
  } catch {
1021
- iface = new import_ethers4.ethers.Interface([action.abi]);
1224
+ iface = new import_ethers6.ethers.Interface([action.abi]);
1022
1225
  }
1023
1226
  const funcFragment = iface.getFunction(action.func);
1024
1227
  if (!funcFragment) throw new Error(`WarpEvmExecutor: Function ${action.func} not found in ABI`);
@@ -1060,10 +1263,10 @@ var WarpEvmExecutor = class {
1060
1263
  throw new Error("WarpEvmExecutor: Invalid transfer configuration");
1061
1264
  }
1062
1265
  async createSingleTokenTransfer(executable, transfer, userWallet) {
1063
- if (!import_ethers4.ethers.isAddress(transfer.identifier)) {
1266
+ if (!import_ethers6.ethers.isAddress(transfer.identifier)) {
1064
1267
  throw new Error(`WarpEvmExecutor: Invalid token address: ${transfer.identifier}`);
1065
1268
  }
1066
- const transferInterface = new import_ethers4.ethers.Interface(["function transfer(address to, uint256 amount) returns (bool)"]);
1269
+ const transferInterface = new import_ethers6.ethers.Interface(["function transfer(address to, uint256 amount) returns (bool)"]);
1067
1270
  const encodedData = transferInterface.encodeFunctionData("transfer", [executable.destination, transfer.amount]);
1068
1271
  const tx = {
1069
1272
  to: transfer.identifier,
@@ -1073,16 +1276,16 @@ var WarpEvmExecutor = class {
1073
1276
  return this.estimateGasAndSetDefaults(tx, userWallet);
1074
1277
  }
1075
1278
  async executeQuery(executable) {
1076
- const action = (0, import_warps11.getWarpActionByIndex)(executable.warp, executable.action);
1279
+ const action = (0, import_warps13.getWarpActionByIndex)(executable.warp, executable.action);
1077
1280
  if (action.type !== "query") throw new Error(`WarpEvmExecutor: Invalid action type for executeQuery: ${action.type}`);
1078
1281
  if (!action.func) throw new Error("WarpEvmExecutor: Query action must have a function name");
1079
- if (!import_ethers4.ethers.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid address for query: ${executable.destination}`);
1282
+ if (!import_ethers6.ethers.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid address for query: ${executable.destination}`);
1080
1283
  try {
1081
1284
  let iface;
1082
1285
  try {
1083
- iface = new import_ethers4.ethers.Interface(JSON.parse(action.abi));
1286
+ iface = new import_ethers6.ethers.Interface(JSON.parse(action.abi));
1084
1287
  } catch {
1085
- iface = new import_ethers4.ethers.Interface([action.abi]);
1288
+ iface = new import_ethers6.ethers.Interface([action.abi]);
1086
1289
  }
1087
1290
  const funcFragment = iface.getFunction(action.func);
1088
1291
  if (!funcFragment) throw new Error(`WarpEvmExecutor: Function ${action.func} not found in ABI`);
@@ -1100,33 +1303,33 @@ var WarpEvmExecutor = class {
1100
1303
  executable.action,
1101
1304
  executable.resolvedInputs
1102
1305
  );
1103
- const next = (0, import_warps11.getNextInfo)(this.config, [], executable.warp, executable.action, output);
1306
+ const next = (0, import_warps13.getNextInfo)(this.config, [], executable.warp, executable.action, output);
1104
1307
  const destinationInput = executable.resolvedInputs.find((i) => i.input.position === "receiver" || i.input.position === "destination");
1105
1308
  const destination = destinationInput?.value || executable.destination;
1106
- const resolvedInputs = (0, import_warps11.extractResolvedInputValues)(executable.resolvedInputs);
1309
+ const resolvedInputs = (0, import_warps13.extractResolvedInputValues)(executable.resolvedInputs);
1107
1310
  return {
1108
1311
  status: isSuccess ? "success" : "error",
1109
1312
  warp: executable.warp,
1110
1313
  action: executable.action,
1111
- user: (0, import_warps11.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
1314
+ user: (0, import_warps13.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
1112
1315
  txHash: null,
1113
1316
  tx: null,
1114
1317
  next,
1115
1318
  values,
1116
1319
  output: { ...output, _DATA: decodedResult },
1117
- messages: (0, import_warps11.applyOutputToMessages)(executable.warp, output, this.config),
1320
+ messages: (0, import_warps13.applyOutputToMessages)(executable.warp, output, this.config),
1118
1321
  destination,
1119
1322
  resolvedInputs
1120
1323
  };
1121
1324
  } catch (error) {
1122
1325
  const destinationInput = executable.resolvedInputs.find((i) => i.input.position === "receiver" || i.input.position === "destination");
1123
1326
  const destination = destinationInput?.value || executable.destination;
1124
- const resolvedInputs = (0, import_warps11.extractResolvedInputValues)(executable.resolvedInputs);
1327
+ const resolvedInputs = (0, import_warps13.extractResolvedInputValues)(executable.resolvedInputs);
1125
1328
  return {
1126
1329
  status: "error",
1127
1330
  warp: executable.warp,
1128
1331
  action: executable.action,
1129
- user: (0, import_warps11.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
1332
+ user: (0, import_warps13.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
1130
1333
  txHash: null,
1131
1334
  tx: null,
1132
1335
  next: null,
@@ -1167,7 +1370,7 @@ var WarpEvmExecutor = class {
1167
1370
  ...tx,
1168
1371
  chainId: parseInt(this.chain.chainId),
1169
1372
  gasLimit: gasEstimate,
1170
- gasPrice: import_ethers4.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1373
+ gasPrice: import_ethers6.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1171
1374
  };
1172
1375
  }
1173
1376
  } catch (error) {
@@ -1185,13 +1388,13 @@ var WarpEvmExecutor = class {
1185
1388
  ...tx,
1186
1389
  chainId: parseInt(this.chain.chainId),
1187
1390
  gasLimit: defaultGasLimit,
1188
- gasPrice: import_ethers4.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1391
+ gasPrice: import_ethers6.ethers.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1189
1392
  };
1190
1393
  }
1191
1394
  }
1192
1395
  async verifyMessage(message, signature) {
1193
1396
  try {
1194
- const recoveredAddress = import_ethers4.ethers.verifyMessage(message, signature);
1397
+ const recoveredAddress = import_ethers6.ethers.verifyMessage(message, signature);
1195
1398
  return recoveredAddress;
1196
1399
  } catch (error) {
1197
1400
  throw new Error(`Failed to verify message: ${error}`);
@@ -1237,7 +1440,7 @@ var WarpEvmExecutor = class {
1237
1440
  hexValue = "0x" + hexValue;
1238
1441
  }
1239
1442
  if (hexValue.length !== 66) {
1240
- hexValue = import_ethers4.ethers.zeroPadValue(hexValue, 32);
1443
+ hexValue = import_ethers6.ethers.zeroPadValue(hexValue, 32);
1241
1444
  }
1242
1445
  return hexValue;
1243
1446
  }
@@ -1366,105 +1569,123 @@ var WarpEvmExplorer = class {
1366
1569
  };
1367
1570
 
1368
1571
  // src/WarpEvmWallet.ts
1369
- var import_warps12 = require("@vleap/warps");
1370
- var import_ethers5 = require("ethers");
1572
+ var import_warps14 = require("@vleap/warps");
1573
+ var import_client = require("@x402/evm/exact/client");
1574
+ var import_ethers7 = require("ethers");
1575
+ var import_accounts = require("viem/accounts");
1371
1576
  var WarpEvmWallet = class {
1372
1577
  constructor(config, chain) {
1373
1578
  this.config = config;
1374
1579
  this.chain = chain;
1375
- const providerConfig = (0, import_warps12.getProviderConfig)(config, chain.name, config.env, chain.defaultApiUrl);
1376
- this.provider = new import_ethers5.ethers.JsonRpcProvider(providerConfig.url);
1580
+ this.cachedAddress = null;
1581
+ this.cachedPublicKey = null;
1582
+ const providerConfig = (0, import_warps14.getProviderConfig)(config, chain.name, config.env, chain.defaultApiUrl);
1583
+ this.provider = new import_ethers7.ethers.JsonRpcProvider(providerConfig.url);
1584
+ this.walletProvider = this.createProvider();
1585
+ this.initializeCache();
1586
+ }
1587
+ createProvider() {
1588
+ const wallet = this.config.user?.wallets?.[this.chain.name];
1589
+ if (!wallet) return null;
1590
+ if (typeof wallet === "string") throw new Error(`Wallet can not be used for signing: ${wallet}`);
1591
+ const customWalletProviders = this.config.walletProviders?.[this.chain.name];
1592
+ const providerFactory = customWalletProviders?.[wallet.provider];
1593
+ if (providerFactory) return providerFactory(this.config, this.chain);
1594
+ if (wallet.provider === "privateKey") return new PrivateKeyWalletProvider(this.config, this.chain, this.provider);
1595
+ if (wallet.provider === "mnemonic") return new MnemonicWalletProvider(this.config, this.chain, this.provider);
1596
+ throw new Error(`Unsupported wallet provider for ${this.chain.name}: ${wallet.provider}`);
1597
+ }
1598
+ initializeCache() {
1599
+ (0, import_warps14.initializeWalletCache)(this.walletProvider).then((cache) => {
1600
+ this.cachedAddress = cache.address;
1601
+ this.cachedPublicKey = cache.publicKey;
1602
+ });
1377
1603
  }
1378
1604
  async signTransaction(tx) {
1379
1605
  if (!tx || typeof tx !== "object") throw new Error("Invalid transaction object");
1380
- const wallet = this.getWallet();
1381
- const txRequest = {
1382
- to: tx.to,
1383
- data: tx.data,
1384
- value: tx.value || 0,
1385
- gasLimit: tx.gasLimit,
1386
- maxFeePerGas: tx.maxFeePerGas,
1387
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
1388
- nonce: tx.nonce,
1389
- chainId: tx.chainId
1390
- };
1391
- const signedTx = await wallet.signTransaction(txRequest);
1392
- return { ...tx, signature: signedTx };
1606
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1607
+ return await this.walletProvider.signTransaction(tx);
1393
1608
  }
1394
1609
  async signTransactions(txs) {
1395
1610
  if (txs.length === 0) return [];
1396
- if (txs.length > 1) {
1397
- const wallet = this.getWallet();
1611
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1612
+ if (this.walletProvider instanceof PrivateKeyWalletProvider || this.walletProvider instanceof MnemonicWalletProvider) {
1613
+ const wallet = this.walletProvider.getWalletInstance();
1398
1614
  const address = wallet.address;
1399
- const currentNonce = await this.provider.getTransactionCount(address, "pending");
1400
- const signedTxs = [];
1401
- for (let i = 0; i < txs.length; i++) {
1402
- const tx = { ...txs[i] };
1403
- tx.nonce = currentNonce + i;
1404
- if (i > 0) {
1405
- const priorityReduction = BigInt(i * 1e9);
1406
- const minGasPrice = BigInt(1e9);
1407
- if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) {
1408
- tx.maxFeePerGas = tx.maxFeePerGas > priorityReduction ? tx.maxFeePerGas - priorityReduction : minGasPrice;
1409
- tx.maxPriorityFeePerGas = tx.maxPriorityFeePerGas > priorityReduction ? tx.maxPriorityFeePerGas - priorityReduction : minGasPrice;
1410
- delete tx.gasPrice;
1411
- } else if (tx.gasPrice) {
1412
- tx.gasPrice = tx.gasPrice > priorityReduction ? tx.gasPrice - priorityReduction : minGasPrice;
1413
- delete tx.maxFeePerGas;
1414
- delete tx.maxPriorityFeePerGas;
1615
+ if (txs.length > 1) {
1616
+ const currentNonce = await this.provider.getTransactionCount(address, "pending");
1617
+ const signedTxs = [];
1618
+ for (let i = 0; i < txs.length; i++) {
1619
+ const tx = { ...txs[i] };
1620
+ tx.nonce = currentNonce + i;
1621
+ if (i > 0) {
1622
+ const priorityReduction = BigInt(i * 1e9);
1623
+ const minGasPrice = BigInt(1e9);
1624
+ if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) {
1625
+ tx.maxFeePerGas = tx.maxFeePerGas > priorityReduction ? tx.maxFeePerGas - priorityReduction : minGasPrice;
1626
+ tx.maxPriorityFeePerGas = tx.maxPriorityFeePerGas > priorityReduction ? tx.maxPriorityFeePerGas - priorityReduction : minGasPrice;
1627
+ delete tx.gasPrice;
1628
+ } else if (tx.gasPrice) {
1629
+ tx.gasPrice = tx.gasPrice > priorityReduction ? tx.gasPrice - priorityReduction : minGasPrice;
1630
+ delete tx.maxFeePerGas;
1631
+ delete tx.maxPriorityFeePerGas;
1632
+ }
1415
1633
  }
1634
+ signedTxs.push(await this.signTransaction(tx));
1416
1635
  }
1417
- const signedTx = await this.signTransaction(tx);
1418
- signedTxs.push(signedTx);
1636
+ return signedTxs;
1419
1637
  }
1420
- return signedTxs;
1421
1638
  }
1422
1639
  return Promise.all(txs.map(async (tx) => this.signTransaction(tx)));
1423
1640
  }
1424
1641
  async signMessage(message) {
1425
- const wallet = this.getWallet();
1426
- const signature = await wallet.signMessage(message);
1427
- return signature;
1642
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1643
+ return await this.walletProvider.signMessage(message);
1428
1644
  }
1429
1645
  async sendTransaction(tx) {
1430
1646
  if (!tx || typeof tx !== "object") throw new Error("Invalid transaction object");
1431
1647
  if (!tx.signature) throw new Error("Transaction must be signed before sending");
1432
- const wallet = this.getWallet();
1433
- if (!wallet) throw new Error("Wallet not initialized - no private key provided");
1434
- const connectedWallet = wallet.connect(this.provider);
1435
- const txResponse = await connectedWallet.sendTransaction(tx);
1436
- return txResponse.hash;
1648
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1649
+ if (this.walletProvider instanceof PrivateKeyWalletProvider || this.walletProvider instanceof MnemonicWalletProvider) {
1650
+ const wallet = this.walletProvider.getWalletInstance();
1651
+ const connectedWallet = wallet.connect(this.provider);
1652
+ const txResponse = await connectedWallet.sendTransaction(tx);
1653
+ return txResponse.hash;
1654
+ }
1655
+ throw new Error("Wallet provider does not support sending transactions");
1437
1656
  }
1438
1657
  async sendTransactions(txs) {
1439
1658
  return Promise.all(txs.map(async (tx) => this.sendTransaction(tx)));
1440
1659
  }
1441
1660
  create(mnemonic) {
1442
- const wallet = import_ethers5.ethers.Wallet.fromPhrase(mnemonic);
1443
- return { address: wallet.address, privateKey: wallet.privateKey, mnemonic };
1661
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1662
+ return this.walletProvider.create(mnemonic);
1444
1663
  }
1445
1664
  generate() {
1446
- const wallet = import_ethers5.ethers.Wallet.createRandom();
1447
- return { address: wallet.address, privateKey: wallet.privateKey, mnemonic: wallet.mnemonic?.phrase || "" };
1665
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1666
+ return this.walletProvider.generate();
1448
1667
  }
1449
1668
  getAddress() {
1450
- const wallet = this.getWallet();
1451
- return wallet.address;
1669
+ return this.cachedAddress;
1452
1670
  }
1453
1671
  getPublicKey() {
1454
- try {
1455
- const wallet = this.getWallet();
1456
- const publicKey = wallet.signingKey.publicKey;
1457
- return publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
1458
- } catch {
1459
- return null;
1672
+ return this.cachedPublicKey;
1673
+ }
1674
+ async registerX402Handlers(client) {
1675
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1676
+ const provider = this.walletProvider;
1677
+ const getInstance = provider.getWalletInstance;
1678
+ if (typeof getInstance !== "function") throw new Error("Wallet provider does not have getWalletInstance method");
1679
+ const wallet = getInstance();
1680
+ if (!wallet || !wallet.privateKey) throw new Error("Wallet instance does not have private key");
1681
+ const signer = (0, import_accounts.privateKeyToAccount)(wallet.privateKey);
1682
+ const handlers = {};
1683
+ for (const chainId of SupportedEvmChainIds) {
1684
+ handlers[`eip155:${chainId}`] = () => {
1685
+ (0, import_client.registerExactEvmScheme)(client, { signer });
1686
+ };
1460
1687
  }
1461
- }
1462
- getWallet() {
1463
- const privateKey = (0, import_warps12.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1464
- if (privateKey) return new import_ethers5.ethers.Wallet(privateKey);
1465
- const mnemonic = (0, import_warps12.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
1466
- if (mnemonic) return import_ethers5.ethers.Wallet.fromPhrase(mnemonic);
1467
- throw new Error("No private key or mnemonic provided");
1688
+ return handlers;
1468
1689
  }
1469
1690
  };
1470
1691
 
@@ -1490,16 +1711,16 @@ var createEvmAdapter = (chainName, chainInfos) => {
1490
1711
 
1491
1712
  // src/chains/arbitrum.ts
1492
1713
  var NativeTokenArb = {
1493
- chain: import_warps13.WarpChainName.Arbitrum,
1714
+ chain: import_warps15.WarpChainName.Arbitrum,
1494
1715
  identifier: "ARB",
1495
1716
  symbol: "ARB",
1496
1717
  name: "Arbitrum",
1497
1718
  decimals: 18,
1498
1719
  logoUrl: "https://joai.ai/images/tokens/arb.svg"
1499
1720
  };
1500
- var getArbitrumAdapter = createEvmAdapter(import_warps13.WarpChainName.Arbitrum, {
1721
+ var ArbitrumAdapter = createEvmAdapter(import_warps15.WarpChainName.Arbitrum, {
1501
1722
  mainnet: {
1502
- name: import_warps13.WarpChainName.Arbitrum,
1723
+ name: import_warps15.WarpChainName.Arbitrum,
1503
1724
  displayName: "Arbitrum",
1504
1725
  chainId: "42161",
1505
1726
  blockTime: 1e3,
@@ -1509,7 +1730,7 @@ var getArbitrumAdapter = createEvmAdapter(import_warps13.WarpChainName.Arbitrum,
1509
1730
  nativeToken: NativeTokenArb
1510
1731
  },
1511
1732
  testnet: {
1512
- name: import_warps13.WarpChainName.Arbitrum,
1733
+ name: import_warps15.WarpChainName.Arbitrum,
1513
1734
  displayName: "Arbitrum Sepolia",
1514
1735
  chainId: "421614",
1515
1736
  blockTime: 1e3,
@@ -1519,7 +1740,7 @@ var getArbitrumAdapter = createEvmAdapter(import_warps13.WarpChainName.Arbitrum,
1519
1740
  nativeToken: NativeTokenArb
1520
1741
  },
1521
1742
  devnet: {
1522
- name: import_warps13.WarpChainName.Arbitrum,
1743
+ name: import_warps15.WarpChainName.Arbitrum,
1523
1744
  displayName: "Arbitrum Sepolia",
1524
1745
  chainId: "421614",
1525
1746
  blockTime: 1e3,
@@ -1531,18 +1752,18 @@ var getArbitrumAdapter = createEvmAdapter(import_warps13.WarpChainName.Arbitrum,
1531
1752
  });
1532
1753
 
1533
1754
  // src/chains/base.ts
1534
- var import_warps14 = require("@vleap/warps");
1755
+ var import_warps16 = require("@vleap/warps");
1535
1756
  var NativeTokenBase = {
1536
- chain: import_warps14.WarpChainName.Base,
1757
+ chain: import_warps16.WarpChainName.Base,
1537
1758
  identifier: "ETH",
1538
1759
  name: "Ether",
1539
1760
  symbol: "ETH",
1540
1761
  decimals: 18,
1541
1762
  logoUrl: "https://joai.ai/images/tokens/eth.svg"
1542
1763
  };
1543
- var getBaseAdapter = createEvmAdapter(import_warps14.WarpChainName.Base, {
1764
+ var BaseAdapter = createEvmAdapter(import_warps16.WarpChainName.Base, {
1544
1765
  mainnet: {
1545
- name: import_warps14.WarpChainName.Base,
1766
+ name: import_warps16.WarpChainName.Base,
1546
1767
  displayName: "Base",
1547
1768
  chainId: "8453",
1548
1769
  blockTime: 2e3,
@@ -1552,7 +1773,7 @@ var getBaseAdapter = createEvmAdapter(import_warps14.WarpChainName.Base, {
1552
1773
  nativeToken: NativeTokenBase
1553
1774
  },
1554
1775
  testnet: {
1555
- name: import_warps14.WarpChainName.Base,
1776
+ name: import_warps16.WarpChainName.Base,
1556
1777
  displayName: "Base Sepolia",
1557
1778
  chainId: "84532",
1558
1779
  blockTime: 2e3,
@@ -1562,7 +1783,7 @@ var getBaseAdapter = createEvmAdapter(import_warps14.WarpChainName.Base, {
1562
1783
  nativeToken: NativeTokenBase
1563
1784
  },
1564
1785
  devnet: {
1565
- name: import_warps14.WarpChainName.Base,
1786
+ name: import_warps16.WarpChainName.Base,
1566
1787
  displayName: "Base Sepolia",
1567
1788
  chainId: "84532",
1568
1789
  blockTime: 2e3,
@@ -1575,20 +1796,26 @@ var getBaseAdapter = createEvmAdapter(import_warps14.WarpChainName.Base, {
1575
1796
 
1576
1797
  // src/chains/combined.ts
1577
1798
  var import_warps17 = require("@vleap/warps");
1799
+ var getAllEvmChainNames = () => [
1800
+ import_warps17.WarpChainName.Ethereum,
1801
+ import_warps17.WarpChainName.Base,
1802
+ import_warps17.WarpChainName.Arbitrum,
1803
+ import_warps17.WarpChainName.Somnia
1804
+ ];
1578
1805
 
1579
1806
  // src/chains/ethereum.ts
1580
- var import_warps15 = require("@vleap/warps");
1807
+ var import_warps18 = require("@vleap/warps");
1581
1808
  var NativeTokenEth = {
1582
- chain: import_warps15.WarpChainName.Ethereum,
1809
+ chain: import_warps18.WarpChainName.Ethereum,
1583
1810
  identifier: "ETH",
1584
1811
  symbol: "ETH",
1585
1812
  name: "Ether",
1586
1813
  decimals: 18,
1587
1814
  logoUrl: "https://joai.ai/images/tokens/eth.svg"
1588
1815
  };
1589
- var getEthereumAdapter = createEvmAdapter(import_warps15.WarpChainName.Ethereum, {
1816
+ var EthereumAdapter = createEvmAdapter(import_warps18.WarpChainName.Ethereum, {
1590
1817
  mainnet: {
1591
- name: import_warps15.WarpChainName.Ethereum,
1818
+ name: import_warps18.WarpChainName.Ethereum,
1592
1819
  displayName: "Ethereum Mainnet",
1593
1820
  chainId: "1",
1594
1821
  blockTime: 12e3,
@@ -1598,7 +1825,7 @@ var getEthereumAdapter = createEvmAdapter(import_warps15.WarpChainName.Ethereum,
1598
1825
  nativeToken: NativeTokenEth
1599
1826
  },
1600
1827
  testnet: {
1601
- name: import_warps15.WarpChainName.Ethereum,
1828
+ name: import_warps18.WarpChainName.Ethereum,
1602
1829
  displayName: "Ethereum Sepolia",
1603
1830
  chainId: "11155111",
1604
1831
  blockTime: 12e3,
@@ -1608,7 +1835,7 @@ var getEthereumAdapter = createEvmAdapter(import_warps15.WarpChainName.Ethereum,
1608
1835
  nativeToken: NativeTokenEth
1609
1836
  },
1610
1837
  devnet: {
1611
- name: import_warps15.WarpChainName.Ethereum,
1838
+ name: import_warps18.WarpChainName.Ethereum,
1612
1839
  displayName: "Ethereum Sepolia",
1613
1840
  chainId: "11155111",
1614
1841
  blockTime: 12e3,
@@ -1619,10 +1846,13 @@ var getEthereumAdapter = createEvmAdapter(import_warps15.WarpChainName.Ethereum,
1619
1846
  }
1620
1847
  });
1621
1848
 
1849
+ // src/adapters.ts
1850
+ var import_warps20 = require("@vleap/warps");
1851
+
1622
1852
  // src/chains/somnia.ts
1623
- var import_warps16 = require("@vleap/warps");
1853
+ var import_warps19 = require("@vleap/warps");
1624
1854
  var NativeTokenSomi = {
1625
- chain: import_warps16.WarpChainName.Somnia,
1855
+ chain: import_warps19.WarpChainName.Somnia,
1626
1856
  identifier: "SOMI",
1627
1857
  symbol: "SOMI",
1628
1858
  name: "Somnia",
@@ -1630,16 +1860,16 @@ var NativeTokenSomi = {
1630
1860
  logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
1631
1861
  };
1632
1862
  var NativeTokenStt = {
1633
- chain: import_warps16.WarpChainName.Somnia,
1863
+ chain: import_warps19.WarpChainName.Somnia,
1634
1864
  identifier: "STT",
1635
1865
  symbol: "STT",
1636
1866
  name: "Somnia Testnet Token",
1637
1867
  decimals: 18,
1638
1868
  logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
1639
1869
  };
1640
- var getSomniaAdapter = createEvmAdapter(import_warps16.WarpChainName.Somnia, {
1870
+ var SomniaAdapter = createEvmAdapter(import_warps19.WarpChainName.Somnia, {
1641
1871
  mainnet: {
1642
- name: import_warps16.WarpChainName.Somnia,
1872
+ name: import_warps19.WarpChainName.Somnia,
1643
1873
  displayName: "Somnia Mainnet",
1644
1874
  chainId: "5031",
1645
1875
  blockTime: 100,
@@ -1649,7 +1879,7 @@ var getSomniaAdapter = createEvmAdapter(import_warps16.WarpChainName.Somnia, {
1649
1879
  nativeToken: NativeTokenSomi
1650
1880
  },
1651
1881
  testnet: {
1652
- name: import_warps16.WarpChainName.Somnia,
1882
+ name: import_warps19.WarpChainName.Somnia,
1653
1883
  displayName: "Somnia Testnet",
1654
1884
  chainId: "50312",
1655
1885
  blockTime: 100,
@@ -1659,7 +1889,7 @@ var getSomniaAdapter = createEvmAdapter(import_warps16.WarpChainName.Somnia, {
1659
1889
  nativeToken: NativeTokenStt
1660
1890
  },
1661
1891
  devnet: {
1662
- name: import_warps16.WarpChainName.Somnia,
1892
+ name: import_warps19.WarpChainName.Somnia,
1663
1893
  displayName: "Somnia Testnet",
1664
1894
  chainId: "50312",
1665
1895
  blockTime: 100,
@@ -1670,31 +1900,30 @@ var getSomniaAdapter = createEvmAdapter(import_warps16.WarpChainName.Somnia, {
1670
1900
  }
1671
1901
  });
1672
1902
 
1673
- // src/chains/combined.ts
1674
- var getAllEvmAdapters = (config, fallback) => [
1675
- getEthereumAdapter(config, fallback),
1676
- getBaseAdapter(config, fallback),
1677
- getArbitrumAdapter(config, fallback),
1678
- getSomniaAdapter(config, fallback)
1679
- ];
1680
- var getAllEvmChainNames = () => [
1681
- import_warps17.WarpChainName.Ethereum,
1682
- import_warps17.WarpChainName.Base,
1683
- import_warps17.WarpChainName.Arbitrum,
1684
- import_warps17.WarpChainName.Somnia
1903
+ // src/adapters.ts
1904
+ var getAllEvmAdapters = (fallbackFactory) => [
1905
+ (0, import_warps20.withAdapter)(EthereumAdapter, fallbackFactory),
1906
+ (0, import_warps20.withAdapter)(BaseAdapter, fallbackFactory),
1907
+ (0, import_warps20.withAdapter)(ArbitrumAdapter, fallbackFactory),
1908
+ (0, import_warps20.withAdapter)(SomniaAdapter, fallbackFactory)
1685
1909
  ];
1686
1910
  // Annotate the CommonJS export names for ESM import in node:
1687
1911
  0 && (module.exports = {
1912
+ ArbitrumAdapter,
1688
1913
  ArbitrumExplorers,
1914
+ BaseAdapter,
1689
1915
  BaseExplorers,
1916
+ EthereumAdapter,
1690
1917
  EthereumExplorers,
1918
+ EvmChainIdMap,
1919
+ EvmChainIds,
1691
1920
  EvmExplorers,
1692
1921
  ExplorerUrls,
1693
1922
  KnownTokens,
1694
1923
  NativeTokenArb,
1695
1924
  NativeTokenBase,
1696
1925
  NativeTokenEth,
1697
- UniswapService,
1926
+ SupportedEvmChainIds,
1698
1927
  WarpEvmConstants,
1699
1928
  WarpEvmDataLoader,
1700
1929
  WarpEvmExecutor,
@@ -1706,9 +1935,6 @@ var getAllEvmChainNames = () => [
1706
1935
  findKnownTokenById,
1707
1936
  getAllEvmAdapters,
1708
1937
  getAllEvmChainNames,
1709
- getArbitrumAdapter,
1710
- getBaseAdapter,
1711
- getEthereumAdapter,
1712
1938
  getKnownTokensForChain
1713
1939
  });
1714
1940
  //# sourceMappingURL=index.js.map