@vleap/warps-adapter-evm 0.2.0-beta.54 → 0.2.0-beta.56

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.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  WarpCache as WarpCache2,
9
9
  WarpCacheKey
10
10
  } from "@vleap/warps";
11
- import { ethers } from "ethers";
11
+ import { ethers as ethers3 } from "ethers";
12
12
 
13
13
  // src/providers/UniswapService.ts
14
14
  import { CacheTtl } from "@vleap/warps";
@@ -96,6 +96,126 @@ var _UniswapService = class _UniswapService {
96
96
  _UniswapService.UNISWAP_TOKEN_LIST_URL = "https://tokens.uniswap.org";
97
97
  var UniswapService = _UniswapService;
98
98
 
99
+ // src/providers/PrivateKeyWalletProvider.ts
100
+ import { ethers } from "ethers";
101
+ import { getWarpWalletPrivateKeyFromConfig } from "@vleap/warps";
102
+ var PrivateKeyWalletProvider = class {
103
+ constructor(config, chain, rpcProvider) {
104
+ this.config = config;
105
+ this.chain = chain;
106
+ this.rpcProvider = rpcProvider;
107
+ this.wallet = null;
108
+ }
109
+ async getAddress() {
110
+ try {
111
+ const wallet = this.getWallet();
112
+ return wallet.address;
113
+ } catch {
114
+ return null;
115
+ }
116
+ }
117
+ async getPublicKey() {
118
+ try {
119
+ const wallet = this.getWallet();
120
+ const publicKey = wallet.signingKey.publicKey;
121
+ return publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
122
+ } catch {
123
+ return null;
124
+ }
125
+ }
126
+ async signTransaction(tx) {
127
+ const wallet = this.getWallet();
128
+ const txRequest = {
129
+ to: tx.to,
130
+ data: tx.data,
131
+ value: tx.value || 0,
132
+ gasLimit: tx.gasLimit,
133
+ maxFeePerGas: tx.maxFeePerGas,
134
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
135
+ nonce: tx.nonce,
136
+ chainId: tx.chainId
137
+ };
138
+ const signedTx = await wallet.signTransaction(txRequest);
139
+ return { ...tx, signature: signedTx };
140
+ }
141
+ async signMessage(message) {
142
+ const wallet = this.getWallet();
143
+ return await wallet.signMessage(message);
144
+ }
145
+ getWalletInstance() {
146
+ return this.getWallet();
147
+ }
148
+ getWallet() {
149
+ if (this.wallet) return this.wallet;
150
+ const privateKey = getWarpWalletPrivateKeyFromConfig(this.config, this.chain.name);
151
+ if (!privateKey) {
152
+ throw new Error("No private key provided");
153
+ }
154
+ this.wallet = new ethers.Wallet(privateKey);
155
+ return this.wallet;
156
+ }
157
+ };
158
+
159
+ // src/providers/MnemonicWalletProvider.ts
160
+ import { ethers as ethers2 } from "ethers";
161
+ import { getWarpWalletMnemonicFromConfig } from "@vleap/warps";
162
+ var MnemonicWalletProvider = class {
163
+ constructor(config, chain, rpcProvider) {
164
+ this.config = config;
165
+ this.chain = chain;
166
+ this.rpcProvider = rpcProvider;
167
+ this.wallet = null;
168
+ }
169
+ async getAddress() {
170
+ try {
171
+ const wallet = this.getWallet();
172
+ return wallet.address;
173
+ } catch {
174
+ return null;
175
+ }
176
+ }
177
+ async getPublicKey() {
178
+ try {
179
+ const wallet = this.getWallet();
180
+ const publicKey = wallet.signingKey.publicKey;
181
+ return publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
182
+ } catch {
183
+ return null;
184
+ }
185
+ }
186
+ async signTransaction(tx) {
187
+ const wallet = this.getWallet();
188
+ const txRequest = {
189
+ to: tx.to,
190
+ data: tx.data,
191
+ value: tx.value || 0,
192
+ gasLimit: tx.gasLimit,
193
+ maxFeePerGas: tx.maxFeePerGas,
194
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
195
+ nonce: tx.nonce,
196
+ chainId: tx.chainId
197
+ };
198
+ const signedTx = await wallet.signTransaction(txRequest);
199
+ return { ...tx, signature: signedTx };
200
+ }
201
+ async signMessage(message) {
202
+ const wallet = this.getWallet();
203
+ return await wallet.signMessage(message);
204
+ }
205
+ getWalletInstance() {
206
+ return this.getWallet();
207
+ }
208
+ getWallet() {
209
+ if (this.wallet) return this.wallet;
210
+ const mnemonic = getWarpWalletMnemonicFromConfig(this.config, this.chain.name);
211
+ if (!mnemonic) {
212
+ throw new Error("No mnemonic provided");
213
+ }
214
+ this.wallet = ethers2.Wallet.fromPhrase(mnemonic);
215
+ return this.wallet;
216
+ }
217
+ };
218
+
99
219
  // src/tokens/arbitrum.ts
100
220
  import { WarpChainName } from "@vleap/warps";
101
221
  var ArbitrumChain = WarpChainName.Arbitrum;
@@ -160,7 +280,7 @@ var ArbitrumSepoliaTokens = [
160
280
  name: "Wrapped SET",
161
281
  symbol: "WSET",
162
282
  decimals: 18,
163
- logoUrl: "https://vleap.ai/images/tokens/set.svg"
283
+ logoUrl: "https://joai.ai/images/tokens/set-black.svg"
164
284
  }
165
285
  ];
166
286
 
@@ -344,7 +464,7 @@ var EthereumSepoliaTokens = [
344
464
  name: "Wrapped SET",
345
465
  symbol: "WSET",
346
466
  decimals: 18,
347
- logoUrl: "https://vleap.ai/images/tokens/set.svg"
467
+ logoUrl: "https://joai.ai/images/tokens/set-black.svg"
348
468
  }
349
469
  ];
350
470
 
@@ -387,8 +507,8 @@ var WarpEvmDataLoader = class {
387
507
  this.config = config;
388
508
  this.chain = chain;
389
509
  const providerConfig = getProviderConfig(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
390
- const network = new ethers.Network(this.chain.name, parseInt(this.chain.chainId));
391
- this.provider = new ethers.JsonRpcProvider(providerConfig.url, network);
510
+ const network = new ethers3.Network(this.chain.name, parseInt(this.chain.chainId));
511
+ this.provider = new ethers3.JsonRpcProvider(providerConfig.url, network);
392
512
  this.cache = new WarpCache2(config.cache?.type);
393
513
  this.uniswapService = new UniswapService(this.cache, parseInt(this.chain.chainId));
394
514
  }
@@ -513,7 +633,7 @@ var WarpEvmDataLoader = class {
513
633
  }));
514
634
  }
515
635
  async getTokenBalance(address, tokenAddress) {
516
- const contract = new ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
636
+ const contract = new ethers3.Contract(tokenAddress, ERC20_ABI, this.provider);
517
637
  const balance = await contract.balanceOf(address);
518
638
  return balance;
519
639
  }
@@ -522,7 +642,7 @@ var WarpEvmDataLoader = class {
522
642
  if (uniswapMetadata) {
523
643
  return uniswapMetadata;
524
644
  }
525
- const contract = new ethers.Contract(tokenAddress, ERC20_ABI, this.provider);
645
+ const contract = new ethers3.Contract(tokenAddress, ERC20_ABI, this.provider);
526
646
  const [name, symbol, decimals] = await Promise.all([
527
647
  contract.name().catch(() => "Unknown Token"),
528
648
  contract.symbol().catch(() => "UNKNOWN"),
@@ -546,7 +666,7 @@ import {
546
666
  getWarpActionByIndex,
547
667
  getWarpWalletAddressFromConfig as getWarpWalletAddressFromConfig2
548
668
  } from "@vleap/warps";
549
- import { ethers as ethers4 } from "ethers";
669
+ import { ethers as ethers6 } from "ethers";
550
670
 
551
671
  // src/constants.ts
552
672
  var WarpEvmConstants = {
@@ -634,14 +754,14 @@ import {
634
754
  WarpCache as WarpCache3,
635
755
  WarpCacheKey as WarpCacheKey2
636
756
  } from "@vleap/warps";
637
- import { ethers as ethers3 } from "ethers";
757
+ import { ethers as ethers5 } from "ethers";
638
758
 
639
759
  // src/WarpEvmSerializer.ts
640
760
  import {
641
761
  WarpConstants,
642
762
  WarpSerializer
643
763
  } from "@vleap/warps";
644
- import { ethers as ethers2 } from "ethers";
764
+ import { ethers as ethers4 } from "ethers";
645
765
  var SplitParamsRegex = new RegExp(`${WarpConstants.ArgParamsSeparator}(.*)`);
646
766
  var WarpEvmSerializer = class {
647
767
  constructor() {
@@ -649,10 +769,10 @@ var WarpEvmSerializer = class {
649
769
  }
650
770
  typedToString(value) {
651
771
  if (typeof value === "string") {
652
- if (ethers2.isAddress(value)) {
772
+ if (ethers4.isAddress(value)) {
653
773
  return `address:${value}`;
654
774
  }
655
- if (ethers2.isHexString(value) && !ethers2.isAddress(value)) {
775
+ if (ethers4.isHexString(value) && !ethers4.isAddress(value)) {
656
776
  return `hex:${value}`;
657
777
  }
658
778
  return `string:${value}`;
@@ -799,8 +919,8 @@ var WarpEvmOutput = class {
799
919
  this.chain = chain;
800
920
  this.serializer = new WarpEvmSerializer();
801
921
  const providerConfig = getProviderConfig2(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
802
- const network = new ethers3.Network(this.chain.name, parseInt(this.chain.chainId));
803
- this.provider = new ethers3.JsonRpcProvider(providerConfig.url, network);
922
+ const network = new ethers5.Network(this.chain.name, parseInt(this.chain.chainId));
923
+ this.provider = new ethers5.JsonRpcProvider(providerConfig.url, network);
804
924
  this.cache = new WarpCache3(config.cache?.type);
805
925
  }
806
926
  async getActionExecution(warp, actionIndex, tx) {
@@ -946,8 +1066,8 @@ var WarpEvmExecutor = class {
946
1066
  this.chain = chain;
947
1067
  this.serializer = new WarpEvmSerializer();
948
1068
  const providerConfig = getProviderConfig3(this.config, chain.name, this.config.env, this.chain.defaultApiUrl);
949
- const network = new ethers4.Network(this.chain.name, parseInt(this.chain.chainId));
950
- this.provider = new ethers4.JsonRpcProvider(providerConfig.url, network);
1069
+ const network = new ethers6.Network(this.chain.name, parseInt(this.chain.chainId));
1070
+ this.provider = new ethers6.JsonRpcProvider(providerConfig.url, network);
951
1071
  this.output = new WarpEvmOutput(config, this.chain);
952
1072
  }
953
1073
  async createTransaction(executable) {
@@ -968,7 +1088,7 @@ var WarpEvmExecutor = class {
968
1088
  async createTransferTransaction(executable) {
969
1089
  const userWallet = getWarpWalletAddressFromConfig2(this.config, executable.chain.name);
970
1090
  if (!userWallet) throw new Error("WarpEvmExecutor: createTransfer - user address not set");
971
- if (!ethers4.isAddress(executable.destination)) {
1091
+ if (!ethers6.isAddress(executable.destination)) {
972
1092
  throw new Error(`WarpEvmExecutor: Invalid destination address: ${executable.destination}`);
973
1093
  }
974
1094
  if (executable.transfers && executable.transfers.length > 0) {
@@ -986,13 +1106,13 @@ var WarpEvmExecutor = class {
986
1106
  if (!userWallet) throw new Error("WarpEvmExecutor: createContractCall - user address not set");
987
1107
  const action = getWarpActionByIndex(executable.warp, executable.action);
988
1108
  if (!action || !("func" in action) || !action.func) throw new Error("WarpEvmExecutor: Contract action must have a function name");
989
- if (!ethers4.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
1109
+ if (!ethers6.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid contract address: ${executable.destination}`);
990
1110
  try {
991
1111
  let iface;
992
1112
  try {
993
- iface = new ethers4.Interface(JSON.parse(action.abi));
1113
+ iface = new ethers6.Interface(JSON.parse(action.abi));
994
1114
  } catch {
995
- iface = new ethers4.Interface([action.abi]);
1115
+ iface = new ethers6.Interface([action.abi]);
996
1116
  }
997
1117
  const funcFragment = iface.getFunction(action.func);
998
1118
  if (!funcFragment) throw new Error(`WarpEvmExecutor: Function ${action.func} not found in ABI`);
@@ -1034,10 +1154,10 @@ var WarpEvmExecutor = class {
1034
1154
  throw new Error("WarpEvmExecutor: Invalid transfer configuration");
1035
1155
  }
1036
1156
  async createSingleTokenTransfer(executable, transfer, userWallet) {
1037
- if (!ethers4.isAddress(transfer.identifier)) {
1157
+ if (!ethers6.isAddress(transfer.identifier)) {
1038
1158
  throw new Error(`WarpEvmExecutor: Invalid token address: ${transfer.identifier}`);
1039
1159
  }
1040
- const transferInterface = new ethers4.Interface(["function transfer(address to, uint256 amount) returns (bool)"]);
1160
+ const transferInterface = new ethers6.Interface(["function transfer(address to, uint256 amount) returns (bool)"]);
1041
1161
  const encodedData = transferInterface.encodeFunctionData("transfer", [executable.destination, transfer.amount]);
1042
1162
  const tx = {
1043
1163
  to: transfer.identifier,
@@ -1050,13 +1170,13 @@ var WarpEvmExecutor = class {
1050
1170
  const action = getWarpActionByIndex(executable.warp, executable.action);
1051
1171
  if (action.type !== "query") throw new Error(`WarpEvmExecutor: Invalid action type for executeQuery: ${action.type}`);
1052
1172
  if (!action.func) throw new Error("WarpEvmExecutor: Query action must have a function name");
1053
- if (!ethers4.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid address for query: ${executable.destination}`);
1173
+ if (!ethers6.isAddress(executable.destination)) throw new Error(`WarpEvmExecutor: Invalid address for query: ${executable.destination}`);
1054
1174
  try {
1055
1175
  let iface;
1056
1176
  try {
1057
- iface = new ethers4.Interface(JSON.parse(action.abi));
1177
+ iface = new ethers6.Interface(JSON.parse(action.abi));
1058
1178
  } catch {
1059
- iface = new ethers4.Interface([action.abi]);
1179
+ iface = new ethers6.Interface([action.abi]);
1060
1180
  }
1061
1181
  const funcFragment = iface.getFunction(action.func);
1062
1182
  if (!funcFragment) throw new Error(`WarpEvmExecutor: Function ${action.func} not found in ABI`);
@@ -1141,7 +1261,7 @@ var WarpEvmExecutor = class {
1141
1261
  ...tx,
1142
1262
  chainId: parseInt(this.chain.chainId),
1143
1263
  gasLimit: gasEstimate,
1144
- gasPrice: ethers4.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1264
+ gasPrice: ethers6.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1145
1265
  };
1146
1266
  }
1147
1267
  } catch (error) {
@@ -1159,13 +1279,13 @@ var WarpEvmExecutor = class {
1159
1279
  ...tx,
1160
1280
  chainId: parseInt(this.chain.chainId),
1161
1281
  gasLimit: defaultGasLimit,
1162
- gasPrice: ethers4.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1282
+ gasPrice: ethers6.parseUnits(WarpEvmConstants.GasPrice.Default, "wei")
1163
1283
  };
1164
1284
  }
1165
1285
  }
1166
1286
  async verifyMessage(message, signature) {
1167
1287
  try {
1168
- const recoveredAddress = ethers4.verifyMessage(message, signature);
1288
+ const recoveredAddress = ethers6.verifyMessage(message, signature);
1169
1289
  return recoveredAddress;
1170
1290
  } catch (error) {
1171
1291
  throw new Error(`Failed to verify message: ${error}`);
@@ -1211,7 +1331,7 @@ var WarpEvmExecutor = class {
1211
1331
  hexValue = "0x" + hexValue;
1212
1332
  }
1213
1333
  if (hexValue.length !== 66) {
1214
- hexValue = ethers4.zeroPadValue(hexValue, 32);
1334
+ hexValue = ethers6.zeroPadValue(hexValue, 32);
1215
1335
  }
1216
1336
  return hexValue;
1217
1337
  }
@@ -1342,107 +1462,108 @@ var WarpEvmExplorer = class {
1342
1462
  // src/WarpEvmWallet.ts
1343
1463
  import {
1344
1464
  getProviderConfig as getProviderConfig4,
1345
- getWarpWalletMnemonicFromConfig,
1346
- getWarpWalletPrivateKeyFromConfig
1465
+ getWarpWalletMnemonicFromConfig as getWarpWalletMnemonicFromConfig2,
1466
+ getWarpWalletPrivateKeyFromConfig as getWarpWalletPrivateKeyFromConfig2,
1467
+ initializeWalletCache
1347
1468
  } from "@vleap/warps";
1348
- import { ethers as ethers5 } from "ethers";
1469
+ import { ethers as ethers7 } from "ethers";
1349
1470
  var WarpEvmWallet = class {
1350
- constructor(config, chain) {
1471
+ constructor(config, chain, walletProvider) {
1351
1472
  this.config = config;
1352
1473
  this.chain = chain;
1474
+ this.cachedAddress = null;
1475
+ this.cachedPublicKey = null;
1353
1476
  const providerConfig = getProviderConfig4(config, chain.name, config.env, chain.defaultApiUrl);
1354
- this.provider = new ethers5.JsonRpcProvider(providerConfig.url);
1477
+ this.provider = new ethers7.JsonRpcProvider(providerConfig.url);
1478
+ this.walletProvider = walletProvider || this.createDefaultProvider();
1479
+ this.initializeCache();
1480
+ }
1481
+ createDefaultProvider() {
1482
+ const privateKey = getWarpWalletPrivateKeyFromConfig2(this.config, this.chain.name);
1483
+ if (privateKey) {
1484
+ return new PrivateKeyWalletProvider(this.config, this.chain, this.provider);
1485
+ }
1486
+ const mnemonic = getWarpWalletMnemonicFromConfig2(this.config, this.chain.name);
1487
+ if (mnemonic) {
1488
+ return new MnemonicWalletProvider(this.config, this.chain, this.provider);
1489
+ }
1490
+ return null;
1491
+ }
1492
+ initializeCache() {
1493
+ initializeWalletCache(this.walletProvider).then((cache) => {
1494
+ this.cachedAddress = cache.address;
1495
+ this.cachedPublicKey = cache.publicKey;
1496
+ });
1355
1497
  }
1356
1498
  async signTransaction(tx) {
1357
1499
  if (!tx || typeof tx !== "object") throw new Error("Invalid transaction object");
1358
- const wallet = this.getWallet();
1359
- const txRequest = {
1360
- to: tx.to,
1361
- data: tx.data,
1362
- value: tx.value || 0,
1363
- gasLimit: tx.gasLimit,
1364
- maxFeePerGas: tx.maxFeePerGas,
1365
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
1366
- nonce: tx.nonce,
1367
- chainId: tx.chainId
1368
- };
1369
- const signedTx = await wallet.signTransaction(txRequest);
1370
- return { ...tx, signature: signedTx };
1500
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1501
+ return await this.walletProvider.signTransaction(tx);
1371
1502
  }
1372
1503
  async signTransactions(txs) {
1373
1504
  if (txs.length === 0) return [];
1374
- if (txs.length > 1) {
1375
- const wallet = this.getWallet();
1505
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1506
+ if (this.walletProvider instanceof PrivateKeyWalletProvider || this.walletProvider instanceof MnemonicWalletProvider) {
1507
+ const wallet = this.walletProvider.getWalletInstance();
1376
1508
  const address = wallet.address;
1377
- const currentNonce = await this.provider.getTransactionCount(address, "pending");
1378
- const signedTxs = [];
1379
- for (let i = 0; i < txs.length; i++) {
1380
- const tx = { ...txs[i] };
1381
- tx.nonce = currentNonce + i;
1382
- if (i > 0) {
1383
- const priorityReduction = BigInt(i * 1e9);
1384
- const minGasPrice = BigInt(1e9);
1385
- if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) {
1386
- tx.maxFeePerGas = tx.maxFeePerGas > priorityReduction ? tx.maxFeePerGas - priorityReduction : minGasPrice;
1387
- tx.maxPriorityFeePerGas = tx.maxPriorityFeePerGas > priorityReduction ? tx.maxPriorityFeePerGas - priorityReduction : minGasPrice;
1388
- delete tx.gasPrice;
1389
- } else if (tx.gasPrice) {
1390
- tx.gasPrice = tx.gasPrice > priorityReduction ? tx.gasPrice - priorityReduction : minGasPrice;
1391
- delete tx.maxFeePerGas;
1392
- delete tx.maxPriorityFeePerGas;
1509
+ if (txs.length > 1) {
1510
+ const currentNonce = await this.provider.getTransactionCount(address, "pending");
1511
+ const signedTxs = [];
1512
+ for (let i = 0; i < txs.length; i++) {
1513
+ const tx = { ...txs[i] };
1514
+ tx.nonce = currentNonce + i;
1515
+ if (i > 0) {
1516
+ const priorityReduction = BigInt(i * 1e9);
1517
+ const minGasPrice = BigInt(1e9);
1518
+ if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) {
1519
+ tx.maxFeePerGas = tx.maxFeePerGas > priorityReduction ? tx.maxFeePerGas - priorityReduction : minGasPrice;
1520
+ tx.maxPriorityFeePerGas = tx.maxPriorityFeePerGas > priorityReduction ? tx.maxPriorityFeePerGas - priorityReduction : minGasPrice;
1521
+ delete tx.gasPrice;
1522
+ } else if (tx.gasPrice) {
1523
+ tx.gasPrice = tx.gasPrice > priorityReduction ? tx.gasPrice - priorityReduction : minGasPrice;
1524
+ delete tx.maxFeePerGas;
1525
+ delete tx.maxPriorityFeePerGas;
1526
+ }
1393
1527
  }
1528
+ signedTxs.push(await this.signTransaction(tx));
1394
1529
  }
1395
- const signedTx = await this.signTransaction(tx);
1396
- signedTxs.push(signedTx);
1530
+ return signedTxs;
1397
1531
  }
1398
- return signedTxs;
1399
1532
  }
1400
1533
  return Promise.all(txs.map(async (tx) => this.signTransaction(tx)));
1401
1534
  }
1402
1535
  async signMessage(message) {
1403
- const wallet = this.getWallet();
1404
- const signature = await wallet.signMessage(message);
1405
- return signature;
1536
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1537
+ return await this.walletProvider.signMessage(message);
1406
1538
  }
1407
1539
  async sendTransaction(tx) {
1408
1540
  if (!tx || typeof tx !== "object") throw new Error("Invalid transaction object");
1409
1541
  if (!tx.signature) throw new Error("Transaction must be signed before sending");
1410
- const wallet = this.getWallet();
1411
- if (!wallet) throw new Error("Wallet not initialized - no private key provided");
1412
- const connectedWallet = wallet.connect(this.provider);
1413
- const txResponse = await connectedWallet.sendTransaction(tx);
1414
- return txResponse.hash;
1542
+ if (!this.walletProvider) throw new Error("No wallet provider available");
1543
+ if (this.walletProvider instanceof PrivateKeyWalletProvider || this.walletProvider instanceof MnemonicWalletProvider) {
1544
+ const wallet = this.walletProvider.getWalletInstance();
1545
+ const connectedWallet = wallet.connect(this.provider);
1546
+ const txResponse = await connectedWallet.sendTransaction(tx);
1547
+ return txResponse.hash;
1548
+ }
1549
+ throw new Error("Wallet provider does not support sending transactions");
1415
1550
  }
1416
1551
  async sendTransactions(txs) {
1417
1552
  return Promise.all(txs.map(async (tx) => this.sendTransaction(tx)));
1418
1553
  }
1419
1554
  create(mnemonic) {
1420
- const wallet = ethers5.Wallet.fromPhrase(mnemonic);
1555
+ const wallet = ethers7.Wallet.fromPhrase(mnemonic);
1421
1556
  return { address: wallet.address, privateKey: wallet.privateKey, mnemonic };
1422
1557
  }
1423
1558
  generate() {
1424
- const wallet = ethers5.Wallet.createRandom();
1559
+ const wallet = ethers7.Wallet.createRandom();
1425
1560
  return { address: wallet.address, privateKey: wallet.privateKey, mnemonic: wallet.mnemonic?.phrase || "" };
1426
1561
  }
1427
1562
  getAddress() {
1428
- const wallet = this.getWallet();
1429
- return wallet.address;
1563
+ return this.cachedAddress;
1430
1564
  }
1431
1565
  getPublicKey() {
1432
- try {
1433
- const wallet = this.getWallet();
1434
- const publicKey = wallet.signingKey.publicKey;
1435
- return publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
1436
- } catch {
1437
- return null;
1438
- }
1439
- }
1440
- getWallet() {
1441
- const privateKey = getWarpWalletPrivateKeyFromConfig(this.config, this.chain.name);
1442
- if (privateKey) return new ethers5.Wallet(privateKey);
1443
- const mnemonic = getWarpWalletMnemonicFromConfig(this.config, this.chain.name);
1444
- if (mnemonic) return ethers5.Wallet.fromPhrase(mnemonic);
1445
- throw new Error("No private key or mnemonic provided");
1566
+ return this.cachedPublicKey;
1446
1567
  }
1447
1568
  };
1448
1569
 
@@ -1473,7 +1594,7 @@ var NativeTokenArb = {
1473
1594
  symbol: "ARB",
1474
1595
  name: "Arbitrum",
1475
1596
  decimals: 18,
1476
- logoUrl: "https://vleap.ai/images/tokens/arb.svg"
1597
+ logoUrl: "https://joai.ai/images/tokens/arb.svg"
1477
1598
  };
1478
1599
  var getArbitrumAdapter = createEvmAdapter(WarpChainName7.Arbitrum, {
1479
1600
  mainnet: {
@@ -1483,7 +1604,7 @@ var getArbitrumAdapter = createEvmAdapter(WarpChainName7.Arbitrum, {
1483
1604
  blockTime: 1e3,
1484
1605
  addressHrp: "0x",
1485
1606
  defaultApiUrl: "https://arb1.arbitrum.io/rpc",
1486
- logoUrl: "https://vleap.ai/images/chains/arbitrum.svg",
1607
+ logoUrl: "https://joai.ai/images/chains/arbitrum.svg",
1487
1608
  nativeToken: NativeTokenArb
1488
1609
  },
1489
1610
  testnet: {
@@ -1493,7 +1614,7 @@ var getArbitrumAdapter = createEvmAdapter(WarpChainName7.Arbitrum, {
1493
1614
  blockTime: 1e3,
1494
1615
  addressHrp: "0x",
1495
1616
  defaultApiUrl: "https://sepolia-rollup.arbitrum.io/rpc",
1496
- logoUrl: "https://vleap.ai/images/chains/arbitrum.svg",
1617
+ logoUrl: "https://joai.ai/images/chains/arbitrum.svg",
1497
1618
  nativeToken: NativeTokenArb
1498
1619
  },
1499
1620
  devnet: {
@@ -1503,7 +1624,7 @@ var getArbitrumAdapter = createEvmAdapter(WarpChainName7.Arbitrum, {
1503
1624
  blockTime: 1e3,
1504
1625
  addressHrp: "0x",
1505
1626
  defaultApiUrl: "https://sepolia-rollup.arbitrum.io/rpc",
1506
- logoUrl: "https://vleap.ai/images/chains/arbitrum.svg",
1627
+ logoUrl: "https://joai.ai/images/chains/arbitrum.svg",
1507
1628
  nativeToken: NativeTokenArb
1508
1629
  }
1509
1630
  });
@@ -1516,7 +1637,7 @@ var NativeTokenBase = {
1516
1637
  name: "Ether",
1517
1638
  symbol: "ETH",
1518
1639
  decimals: 18,
1519
- logoUrl: "https://vleap.ai/images/tokens/eth.svg"
1640
+ logoUrl: "https://joai.ai/images/tokens/eth.svg"
1520
1641
  };
1521
1642
  var getBaseAdapter = createEvmAdapter(WarpChainName8.Base, {
1522
1643
  mainnet: {
@@ -1526,7 +1647,7 @@ var getBaseAdapter = createEvmAdapter(WarpChainName8.Base, {
1526
1647
  blockTime: 2e3,
1527
1648
  addressHrp: "0x",
1528
1649
  defaultApiUrl: "https://mainnet.base.org",
1529
- logoUrl: "https://vleap.ai/images/chains/base.svg",
1650
+ logoUrl: "https://joai.ai/images/chains/base.svg",
1530
1651
  nativeToken: NativeTokenBase
1531
1652
  },
1532
1653
  testnet: {
@@ -1536,7 +1657,7 @@ var getBaseAdapter = createEvmAdapter(WarpChainName8.Base, {
1536
1657
  blockTime: 2e3,
1537
1658
  addressHrp: "0x",
1538
1659
  defaultApiUrl: "https://sepolia.base.org",
1539
- logoUrl: "https://vleap.ai/images/chains/base.svg",
1660
+ logoUrl: "https://joai.ai/images/chains/base.svg",
1540
1661
  nativeToken: NativeTokenBase
1541
1662
  },
1542
1663
  devnet: {
@@ -1546,7 +1667,7 @@ var getBaseAdapter = createEvmAdapter(WarpChainName8.Base, {
1546
1667
  blockTime: 2e3,
1547
1668
  addressHrp: "0x",
1548
1669
  defaultApiUrl: "https://sepolia.base.org",
1549
- logoUrl: "https://vleap.ai/images/chains/base.svg",
1670
+ logoUrl: "https://joai.ai/images/chains/base.svg",
1550
1671
  nativeToken: NativeTokenBase
1551
1672
  }
1552
1673
  });
@@ -1562,7 +1683,7 @@ var NativeTokenEth = {
1562
1683
  symbol: "ETH",
1563
1684
  name: "Ether",
1564
1685
  decimals: 18,
1565
- logoUrl: "https://vleap.ai/images/tokens/eth.svg"
1686
+ logoUrl: "https://joai.ai/images/tokens/eth.svg"
1566
1687
  };
1567
1688
  var getEthereumAdapter = createEvmAdapter(WarpChainName9.Ethereum, {
1568
1689
  mainnet: {
@@ -1572,7 +1693,7 @@ var getEthereumAdapter = createEvmAdapter(WarpChainName9.Ethereum, {
1572
1693
  blockTime: 12e3,
1573
1694
  addressHrp: "0x",
1574
1695
  defaultApiUrl: "https://ethereum-rpc.publicnode.com",
1575
- logoUrl: "https://vleap.ai/images/chains/ethereum.svg",
1696
+ logoUrl: "https://joai.ai/images/chains/ethereum.svg",
1576
1697
  nativeToken: NativeTokenEth
1577
1698
  },
1578
1699
  testnet: {
@@ -1582,7 +1703,7 @@ var getEthereumAdapter = createEvmAdapter(WarpChainName9.Ethereum, {
1582
1703
  blockTime: 12e3,
1583
1704
  addressHrp: "0x",
1584
1705
  defaultApiUrl: "https://ethereum-sepolia-rpc.publicnode.com",
1585
- logoUrl: "https://vleap.ai/images/chains/ethereum.svg",
1706
+ logoUrl: "https://joai.ai/images/chains/ethereum.svg",
1586
1707
  nativeToken: NativeTokenEth
1587
1708
  },
1588
1709
  devnet: {
@@ -1592,7 +1713,7 @@ var getEthereumAdapter = createEvmAdapter(WarpChainName9.Ethereum, {
1592
1713
  blockTime: 12e3,
1593
1714
  addressHrp: "0x",
1594
1715
  defaultApiUrl: "https://ethereum-sepolia-rpc.publicnode.com",
1595
- logoUrl: "https://vleap.ai/images/chains/ethereum.svg",
1716
+ logoUrl: "https://joai.ai/images/chains/ethereum.svg",
1596
1717
  nativeToken: NativeTokenEth
1597
1718
  }
1598
1719
  });
@@ -1623,7 +1744,7 @@ var getSomniaAdapter = createEvmAdapter(WarpChainName10.Somnia, {
1623
1744
  blockTime: 100,
1624
1745
  addressHrp: "0x",
1625
1746
  defaultApiUrl: "https://api.infra.mainnet.somnia.network/",
1626
- logoUrl: "https://vleap.ai/images/chains/somnia.png",
1747
+ logoUrl: "https://joai.ai/images/chains/somnia.png",
1627
1748
  nativeToken: NativeTokenSomi
1628
1749
  },
1629
1750
  testnet: {
@@ -1633,7 +1754,7 @@ var getSomniaAdapter = createEvmAdapter(WarpChainName10.Somnia, {
1633
1754
  blockTime: 100,
1634
1755
  addressHrp: "0x",
1635
1756
  defaultApiUrl: "https://dream-rpc.somnia.network/",
1636
- logoUrl: "https://vleap.ai/images/chains/somnia.png",
1757
+ logoUrl: "https://joai.ai/images/chains/somnia.png",
1637
1758
  nativeToken: NativeTokenStt
1638
1759
  },
1639
1760
  devnet: {
@@ -1643,7 +1764,7 @@ var getSomniaAdapter = createEvmAdapter(WarpChainName10.Somnia, {
1643
1764
  blockTime: 100,
1644
1765
  addressHrp: "0x",
1645
1766
  defaultApiUrl: "https://dream-rpc.somnia.network",
1646
- logoUrl: "https://vleap.ai/images/chains/somnia.png",
1767
+ logoUrl: "https://joai.ai/images/chains/somnia.png",
1647
1768
  nativeToken: NativeTokenStt
1648
1769
  }
1649
1770
  });
@@ -1668,9 +1789,11 @@ export {
1668
1789
  EvmExplorers,
1669
1790
  ExplorerUrls,
1670
1791
  KnownTokens,
1792
+ MnemonicWalletProvider,
1671
1793
  NativeTokenArb,
1672
1794
  NativeTokenBase,
1673
1795
  NativeTokenEth,
1796
+ PrivateKeyWalletProvider,
1674
1797
  UniswapService,
1675
1798
  WarpEvmConstants,
1676
1799
  WarpEvmDataLoader,