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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ __export(index_exports, {
49
49
  module.exports = __toCommonJS(index_exports);
50
50
 
51
51
  // src/chains/arbitrum.ts
52
- var import_warps11 = require("@vleap/warps");
52
+ var import_warps12 = require("@vleap/warps");
53
53
 
54
54
  // src/WarpEvmDataLoader.ts
55
55
  var import_warps7 = require("@vleap/warps");
@@ -1189,6 +1189,7 @@ var WarpEvmExplorer = class {
1189
1189
  };
1190
1190
 
1191
1191
  // src/WarpEvmWallet.ts
1192
+ var import_warps11 = require("@vleap/warps");
1192
1193
  var import_ethers5 = require("ethers");
1193
1194
  var WarpEvmWallet = class {
1194
1195
  constructor(config, chain) {
@@ -1198,12 +1199,12 @@ var WarpEvmWallet = class {
1198
1199
  this.provider = new import_ethers5.ethers.JsonRpcProvider(chain.defaultApiUrl || "https://rpc.sepolia.org");
1199
1200
  }
1200
1201
  async signTransaction(tx) {
1201
- if (!this.wallet) {
1202
- throw new Error("Wallet not initialized - no private key provided");
1203
- }
1204
1202
  if (!tx || typeof tx !== "object") {
1205
1203
  throw new Error("Invalid transaction object");
1206
1204
  }
1205
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1206
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
1207
+ const wallet = new import_ethers5.ethers.Wallet(privateKey);
1207
1208
  const txRequest = {
1208
1209
  to: tx.to,
1209
1210
  data: tx.data,
@@ -1214,14 +1215,14 @@ var WarpEvmWallet = class {
1214
1215
  nonce: tx.nonce,
1215
1216
  chainId: tx.chainId
1216
1217
  };
1217
- const signedTx = await this.wallet.signTransaction(txRequest);
1218
+ const signedTx = await wallet.signTransaction(txRequest);
1218
1219
  return { ...tx, signature: signedTx };
1219
1220
  }
1220
1221
  async signMessage(message) {
1221
- if (!this.wallet) {
1222
- throw new Error("Wallet not initialized - no private key provided");
1223
- }
1224
- return await this.wallet.signMessage(message);
1222
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1223
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
1224
+ const wallet = new import_ethers5.ethers.Wallet(privateKey);
1225
+ return await wallet.signMessage(message);
1225
1226
  }
1226
1227
  async sendTransaction(tx) {
1227
1228
  if (!tx || typeof tx !== "object") {
@@ -1230,11 +1231,10 @@ var WarpEvmWallet = class {
1230
1231
  if (!tx.signature) {
1231
1232
  throw new Error("Transaction must be signed before sending");
1232
1233
  }
1233
- if (!this.wallet) {
1234
- throw new Error("Wallet not initialized - no private key provided");
1235
- }
1236
- const connectedWallet = this.wallet.connect(this.provider);
1237
- const txResponse = await connectedWallet.sendTransaction(tx);
1234
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1235
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
1236
+ const wallet = new import_ethers5.ethers.Wallet(privateKey).connect(this.provider);
1237
+ const txResponse = await wallet.sendTransaction(tx);
1238
1238
  return txResponse.hash;
1239
1239
  }
1240
1240
  create(mnemonic) {
@@ -1246,7 +1246,10 @@ var WarpEvmWallet = class {
1246
1246
  return { address: wallet.address, privateKey: wallet.privateKey, mnemonic: wallet.mnemonic?.phrase || "" };
1247
1247
  }
1248
1248
  getAddress() {
1249
- return this.wallet?.address || null;
1249
+ const privateKey = (0, import_warps11.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
1250
+ if (!privateKey) return null;
1251
+ const wallet = new import_ethers5.ethers.Wallet(privateKey);
1252
+ return wallet.address;
1250
1253
  }
1251
1254
  };
1252
1255
 
@@ -1274,16 +1277,16 @@ var createEvmAdapter = (chainName, chainPrefix, chainInfos) => {
1274
1277
 
1275
1278
  // src/chains/arbitrum.ts
1276
1279
  var NativeTokenArb = {
1277
- chain: import_warps11.WarpChainName.Arbitrum,
1280
+ chain: import_warps12.WarpChainName.Arbitrum,
1278
1281
  identifier: "ARB",
1279
1282
  symbol: "ARB",
1280
1283
  name: "Arbitrum",
1281
1284
  decimals: 18,
1282
1285
  logoUrl: "https://vleap.ai/images/tokens/arb.svg"
1283
1286
  };
1284
- var getArbitrumAdapter = createEvmAdapter(import_warps11.WarpChainName.Arbitrum, "arb", {
1287
+ var getArbitrumAdapter = createEvmAdapter(import_warps12.WarpChainName.Arbitrum, "arb", {
1285
1288
  mainnet: {
1286
- name: import_warps11.WarpChainName.Arbitrum,
1289
+ name: import_warps12.WarpChainName.Arbitrum,
1287
1290
  displayName: "Arbitrum",
1288
1291
  chainId: "42161",
1289
1292
  blockTime: 1e3,
@@ -1293,7 +1296,7 @@ var getArbitrumAdapter = createEvmAdapter(import_warps11.WarpChainName.Arbitrum,
1293
1296
  nativeToken: NativeTokenArb
1294
1297
  },
1295
1298
  testnet: {
1296
- name: import_warps11.WarpChainName.Arbitrum,
1299
+ name: import_warps12.WarpChainName.Arbitrum,
1297
1300
  displayName: "Arbitrum Sepolia",
1298
1301
  chainId: "421614",
1299
1302
  blockTime: 1e3,
@@ -1303,7 +1306,7 @@ var getArbitrumAdapter = createEvmAdapter(import_warps11.WarpChainName.Arbitrum,
1303
1306
  nativeToken: NativeTokenArb
1304
1307
  },
1305
1308
  devnet: {
1306
- name: import_warps11.WarpChainName.Arbitrum,
1309
+ name: import_warps12.WarpChainName.Arbitrum,
1307
1310
  displayName: "Arbitrum Sepolia",
1308
1311
  chainId: "421614",
1309
1312
  blockTime: 1e3,
@@ -1315,18 +1318,18 @@ var getArbitrumAdapter = createEvmAdapter(import_warps11.WarpChainName.Arbitrum,
1315
1318
  });
1316
1319
 
1317
1320
  // src/chains/base.ts
1318
- var import_warps12 = require("@vleap/warps");
1321
+ var import_warps13 = require("@vleap/warps");
1319
1322
  var NativeTokenBase = {
1320
- chain: import_warps12.WarpChainName.Base,
1323
+ chain: import_warps13.WarpChainName.Base,
1321
1324
  identifier: "ETH",
1322
1325
  name: "Ether",
1323
1326
  symbol: "ETH",
1324
1327
  decimals: 18,
1325
1328
  logoUrl: "https://vleap.ai/images/tokens/eth.svg"
1326
1329
  };
1327
- var getBaseAdapter = createEvmAdapter(import_warps12.WarpChainName.Base, "base", {
1330
+ var getBaseAdapter = createEvmAdapter(import_warps13.WarpChainName.Base, "base", {
1328
1331
  mainnet: {
1329
- name: import_warps12.WarpChainName.Base,
1332
+ name: import_warps13.WarpChainName.Base,
1330
1333
  displayName: "Base",
1331
1334
  chainId: "8453",
1332
1335
  blockTime: 2e3,
@@ -1336,7 +1339,7 @@ var getBaseAdapter = createEvmAdapter(import_warps12.WarpChainName.Base, "base",
1336
1339
  nativeToken: NativeTokenBase
1337
1340
  },
1338
1341
  testnet: {
1339
- name: import_warps12.WarpChainName.Base,
1342
+ name: import_warps13.WarpChainName.Base,
1340
1343
  displayName: "Base Sepolia",
1341
1344
  chainId: "84532",
1342
1345
  blockTime: 2e3,
@@ -1346,7 +1349,7 @@ var getBaseAdapter = createEvmAdapter(import_warps12.WarpChainName.Base, "base",
1346
1349
  nativeToken: NativeTokenBase
1347
1350
  },
1348
1351
  devnet: {
1349
- name: import_warps12.WarpChainName.Base,
1352
+ name: import_warps13.WarpChainName.Base,
1350
1353
  displayName: "Base Sepolia",
1351
1354
  chainId: "84532",
1352
1355
  blockTime: 2e3,
@@ -1358,21 +1361,21 @@ var getBaseAdapter = createEvmAdapter(import_warps12.WarpChainName.Base, "base",
1358
1361
  });
1359
1362
 
1360
1363
  // src/chains/combined.ts
1361
- var import_warps15 = require("@vleap/warps");
1364
+ var import_warps16 = require("@vleap/warps");
1362
1365
 
1363
1366
  // src/chains/ethereum.ts
1364
- var import_warps13 = require("@vleap/warps");
1367
+ var import_warps14 = require("@vleap/warps");
1365
1368
  var NativeTokenEth = {
1366
- chain: import_warps13.WarpChainName.Ethereum,
1369
+ chain: import_warps14.WarpChainName.Ethereum,
1367
1370
  identifier: "ETH",
1368
1371
  symbol: "ETH",
1369
1372
  name: "Ether",
1370
1373
  decimals: 18,
1371
1374
  logoUrl: "https://vleap.ai/images/tokens/eth.svg"
1372
1375
  };
1373
- var getEthereumAdapter = createEvmAdapter(import_warps13.WarpChainName.Ethereum, "eth", {
1376
+ var getEthereumAdapter = createEvmAdapter(import_warps14.WarpChainName.Ethereum, "eth", {
1374
1377
  mainnet: {
1375
- name: import_warps13.WarpChainName.Ethereum,
1378
+ name: import_warps14.WarpChainName.Ethereum,
1376
1379
  displayName: "Ethereum Mainnet",
1377
1380
  chainId: "1",
1378
1381
  blockTime: 12e3,
@@ -1382,7 +1385,7 @@ var getEthereumAdapter = createEvmAdapter(import_warps13.WarpChainName.Ethereum,
1382
1385
  nativeToken: NativeTokenEth
1383
1386
  },
1384
1387
  testnet: {
1385
- name: import_warps13.WarpChainName.Ethereum,
1388
+ name: import_warps14.WarpChainName.Ethereum,
1386
1389
  displayName: "Ethereum Sepolia",
1387
1390
  chainId: "11155111",
1388
1391
  blockTime: 12e3,
@@ -1392,7 +1395,7 @@ var getEthereumAdapter = createEvmAdapter(import_warps13.WarpChainName.Ethereum,
1392
1395
  nativeToken: NativeTokenEth
1393
1396
  },
1394
1397
  devnet: {
1395
- name: import_warps13.WarpChainName.Ethereum,
1398
+ name: import_warps14.WarpChainName.Ethereum,
1396
1399
  displayName: "Ethereum Sepolia",
1397
1400
  chainId: "11155111",
1398
1401
  blockTime: 12e3,
@@ -1404,9 +1407,9 @@ var getEthereumAdapter = createEvmAdapter(import_warps13.WarpChainName.Ethereum,
1404
1407
  });
1405
1408
 
1406
1409
  // src/chains/somnia.ts
1407
- var import_warps14 = require("@vleap/warps");
1410
+ var import_warps15 = require("@vleap/warps");
1408
1411
  var NativeTokenSomi = {
1409
- chain: import_warps14.WarpChainName.Somnia,
1412
+ chain: import_warps15.WarpChainName.Somnia,
1410
1413
  identifier: "SOMI",
1411
1414
  symbol: "SOMI",
1412
1415
  name: "Somnia",
@@ -1414,16 +1417,16 @@ var NativeTokenSomi = {
1414
1417
  logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
1415
1418
  };
1416
1419
  var NativeTokenStt = {
1417
- chain: import_warps14.WarpChainName.Somnia,
1420
+ chain: import_warps15.WarpChainName.Somnia,
1418
1421
  identifier: "STT",
1419
1422
  symbol: "STT",
1420
1423
  name: "Somnia Testnet Token",
1421
1424
  decimals: 18,
1422
1425
  logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
1423
1426
  };
1424
- var getSomniaAdapter = createEvmAdapter(import_warps14.WarpChainName.Somnia, "eth", {
1427
+ var getSomniaAdapter = createEvmAdapter(import_warps15.WarpChainName.Somnia, "eth", {
1425
1428
  mainnet: {
1426
- name: import_warps14.WarpChainName.Somnia,
1429
+ name: import_warps15.WarpChainName.Somnia,
1427
1430
  displayName: "Somnia Mainnet",
1428
1431
  chainId: "5031",
1429
1432
  blockTime: 100,
@@ -1433,7 +1436,7 @@ var getSomniaAdapter = createEvmAdapter(import_warps14.WarpChainName.Somnia, "et
1433
1436
  nativeToken: NativeTokenSomi
1434
1437
  },
1435
1438
  testnet: {
1436
- name: import_warps14.WarpChainName.Somnia,
1439
+ name: import_warps15.WarpChainName.Somnia,
1437
1440
  displayName: "Somnia Testnet",
1438
1441
  chainId: "50312",
1439
1442
  blockTime: 100,
@@ -1443,7 +1446,7 @@ var getSomniaAdapter = createEvmAdapter(import_warps14.WarpChainName.Somnia, "et
1443
1446
  nativeToken: NativeTokenStt
1444
1447
  },
1445
1448
  devnet: {
1446
- name: import_warps14.WarpChainName.Somnia,
1449
+ name: import_warps15.WarpChainName.Somnia,
1447
1450
  displayName: "Somnia Testnet",
1448
1451
  chainId: "50312",
1449
1452
  blockTime: 100,
@@ -1462,10 +1465,10 @@ var getAllEvmAdapters = (config, fallback) => [
1462
1465
  getSomniaAdapter(config, fallback)
1463
1466
  ];
1464
1467
  var getAllEvmChainNames = () => [
1465
- import_warps15.WarpChainName.Ethereum,
1466
- import_warps15.WarpChainName.Base,
1467
- import_warps15.WarpChainName.Arbitrum,
1468
- import_warps15.WarpChainName.Somnia
1468
+ import_warps16.WarpChainName.Ethereum,
1469
+ import_warps16.WarpChainName.Base,
1470
+ import_warps16.WarpChainName.Arbitrum,
1471
+ import_warps16.WarpChainName.Somnia
1469
1472
  ];
1470
1473
  // Annotate the CommonJS export names for ESM import in node:
1471
1474
  0 && (module.exports = {