@joai/warps-adapter-fastset 1.0.0-beta.58 → 1.0.0

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
@@ -40,7 +40,7 @@ __export(index_exports, {
40
40
  module.exports = __toCommonJS(index_exports);
41
41
 
42
42
  // src/main.ts
43
- var import_warps9 = require("@joai/warps");
43
+ var import_warps10 = require("@joai/warps");
44
44
 
45
45
  // src/helpers/encode.ts
46
46
  var encoder = new TextEncoder();
@@ -1512,9 +1512,10 @@ var getConfiguredFastsetClient = (config, chain2) => {
1512
1512
  };
1513
1513
 
1514
1514
  // src/tokens/fastset.ts
1515
+ var import_warps2 = require("@joai/warps");
1515
1516
  var FastsetTokens = [
1516
1517
  {
1517
- chain: "fastset",
1518
+ chain: import_warps2.WarpChainName.Fastset,
1518
1519
  identifier: "0x37bb8861c49c6f59d869634557245b8640c2de6a2d3dffd6ad4065f6f67989f1",
1519
1520
  name: "Ethereum",
1520
1521
  symbol: "ETH",
@@ -1526,7 +1527,7 @@ var FastsetTokens = [
1526
1527
  amount: 0n
1527
1528
  },
1528
1529
  {
1529
- chain: "fastset",
1530
+ chain: import_warps2.WarpChainName.Fastset,
1530
1531
  identifier: "0ee63eaa3ff9bf6e1c84a70133c5461e6e06d3787ed93200b924a6b82f0f35ff",
1531
1532
  name: "Bitcoin",
1532
1533
  symbol: "BTC",
@@ -1535,7 +1536,7 @@ var FastsetTokens = [
1535
1536
  amount: 0n
1536
1537
  },
1537
1538
  {
1538
- chain: "fastset",
1539
+ chain: import_warps2.WarpChainName.Fastset,
1539
1540
  identifier: "b69f0d3a4d7609367bd893ee3191e48b3047f2c4ccd21728c2441bcc2154f70c",
1540
1541
  name: "Solana",
1541
1542
  symbol: "SOL",
@@ -1544,7 +1545,7 @@ var FastsetTokens = [
1544
1545
  amount: 0n
1545
1546
  },
1546
1547
  {
1547
- chain: "fastset",
1548
+ chain: import_warps2.WarpChainName.Fastset,
1548
1549
  identifier: "c83166ed4e5e3ca88f7b2cf0ce2d310fa8c4d2ee2fc90d741f7b2040279b2687",
1549
1550
  name: "USD Coin",
1550
1551
  symbol: "USDC",
@@ -1553,7 +1554,7 @@ var FastsetTokens = [
1553
1554
  amount: 0n
1554
1555
  },
1555
1556
  {
1556
- chain: "fastset",
1557
+ chain: import_warps2.WarpChainName.Fastset,
1557
1558
  identifier: "0xfa575e7000000000000000000000000000000000000000000000000000000000",
1558
1559
  name: "Wrapped SET",
1559
1560
  symbol: "WSET",
@@ -1665,7 +1666,7 @@ var WarpFastsetDataLoader = class {
1665
1666
  };
1666
1667
 
1667
1668
  // src/WarpFastsetExecutor.ts
1668
- var import_warps2 = require("@joai/warps");
1669
+ var import_warps3 = require("@joai/warps");
1669
1670
  var WarpFastsetExecutor = class {
1670
1671
  constructor(config, chain2) {
1671
1672
  this.config = config;
@@ -1673,7 +1674,7 @@ var WarpFastsetExecutor = class {
1673
1674
  this.client = getConfiguredFastsetClient(this.config, this.chain);
1674
1675
  }
1675
1676
  async createTransaction(executable) {
1676
- const action = (0, import_warps2.getWarpActionByIndex)(executable.warp, executable.action);
1677
+ const action = (0, import_warps3.getWarpActionByIndex)(executable.warp, executable.action);
1677
1678
  if (action.type === "transfer") return this.createTransferTransaction(executable);
1678
1679
  if (action.type === "contract") return this.createContractCallTransaction(executable);
1679
1680
  if (action.type === "query") throw new Error("WarpFastsetExecutor: Invalid action type for createTransaction; Use executeQuery instead");
@@ -1683,7 +1684,7 @@ var WarpFastsetExecutor = class {
1683
1684
  }
1684
1685
  async createTransferTransaction(executable) {
1685
1686
  if (!executable.destination) throw new Error("WarpFastsetExecutor: createTransfer - destination not set");
1686
- const userWallet = (0, import_warps2.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
1687
+ const userWallet = (0, import_warps3.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
1687
1688
  if (!userWallet) throw new Error("WarpFastsetExecutor: createTransfer - user address not set");
1688
1689
  const senderPubKey = FastsetClient.decodeBech32Address(userWallet);
1689
1690
  const recipientPubKey = FastsetClient.decodeBech32Address(executable.destination);
@@ -1748,13 +1749,13 @@ var WarpFastsetExplorer = class {
1748
1749
  };
1749
1750
 
1750
1751
  // src/WarpFastsetOutput.ts
1751
- var import_warps4 = require("@joai/warps");
1752
+ var import_warps5 = require("@joai/warps");
1752
1753
 
1753
1754
  // src/WarpFastsetSerializer.ts
1754
- var import_warps3 = require("@joai/warps");
1755
+ var import_warps4 = require("@joai/warps");
1755
1756
  var WarpFastsetSerializer = class {
1756
1757
  constructor() {
1757
- this.coreSerializer = new import_warps3.WarpSerializer();
1758
+ this.coreSerializer = new import_warps4.WarpSerializer();
1758
1759
  }
1759
1760
  typedToString(value) {
1760
1761
  if (typeof value === "string") {
@@ -1878,7 +1879,7 @@ var WarpFastsetOutput = class {
1878
1879
  status: success ? "success" : "error",
1879
1880
  warp,
1880
1881
  action: 0,
1881
- user: (0, import_warps4.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
1882
+ user: (0, import_warps5.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
1882
1883
  txHash: transactionHash,
1883
1884
  tx,
1884
1885
  next: null,
@@ -1911,8 +1912,8 @@ var WarpFastsetOutput = class {
1911
1912
  return value;
1912
1913
  };
1913
1914
  for (const [key, path] of Object.entries(warp.output)) {
1914
- if (path.startsWith(import_warps4.WarpConstants.Transform.Prefix)) continue;
1915
- const currentActionIndex = (0, import_warps4.parseOutputOutIndex)(path);
1915
+ if (path.startsWith(import_warps5.WarpConstants.Transform.Prefix)) continue;
1916
+ const currentActionIndex = (0, import_warps5.parseOutputOutIndex)(path);
1916
1917
  if (currentActionIndex !== null && currentActionIndex !== actionIndex) {
1917
1918
  output[key] = null;
1918
1919
  continue;
@@ -1926,7 +1927,7 @@ var WarpFastsetOutput = class {
1926
1927
  }
1927
1928
  return {
1928
1929
  values,
1929
- output: await (0, import_warps4.evaluateOutputCommon)(
1930
+ output: await (0, import_warps5.evaluateOutputCommon)(
1930
1931
  warp,
1931
1932
  output,
1932
1933
  actionIndex,
@@ -1960,12 +1961,12 @@ var WarpFastsetOutput = class {
1960
1961
  };
1961
1962
 
1962
1963
  // src/WarpFastsetWallet.ts
1963
- var import_warps8 = require("@joai/warps");
1964
+ var import_warps9 = require("@joai/warps");
1964
1965
 
1965
1966
  // src/providers/MnemonicWalletProvider.ts
1966
1967
  var bip39 = __toESM(require("@scure/bip39"), 1);
1967
1968
  var import_english = require("@scure/bip39/wordlists/english.js");
1968
- var import_warps5 = require("@joai/warps");
1969
+ var import_warps6 = require("@joai/warps");
1969
1970
 
1970
1971
  // src/sdk/ed25519-setup.ts
1971
1972
  var ed25519 = __toESM(require("@noble/ed25519"), 1);
@@ -2425,7 +2426,7 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
2425
2426
  return uint8ArrayToHex(signature);
2426
2427
  }
2427
2428
  async importFromMnemonic(mnemonic) {
2428
- const trimmedMnemonic = (0, import_warps5.normalizeAndValidateMnemonic)(mnemonic);
2429
+ const trimmedMnemonic = (0, import_warps6.normalizeAndValidateMnemonic)(mnemonic);
2429
2430
  const seed = bip39.mnemonicToSeedSync(trimmedMnemonic);
2430
2431
  const privateKey = seed.slice(0, 32);
2431
2432
  const publicKey = ed.getPublicKey(privateKey);
@@ -2436,7 +2437,7 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
2436
2437
  privateKey: uint8ArrayToHex(privateKey),
2437
2438
  mnemonic: trimmedMnemonic
2438
2439
  };
2439
- (0, import_warps5.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
2440
+ (0, import_warps6.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
2440
2441
  return walletDetails;
2441
2442
  }
2442
2443
  async importFromPrivateKey(privateKey) {
@@ -2449,13 +2450,13 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
2449
2450
  privateKey,
2450
2451
  mnemonic: null
2451
2452
  };
2452
- (0, import_warps5.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
2453
+ (0, import_warps6.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
2453
2454
  return walletDetails;
2454
2455
  }
2455
2456
  async export() {
2456
2457
  const privateKey = this.getPrivateKey();
2457
- const mnemonic = (0, import_warps5.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
2458
- const privateKeyHex = (0, import_warps5.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
2458
+ const mnemonic = (0, import_warps6.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
2459
+ const privateKeyHex = (0, import_warps6.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
2459
2460
  const publicKey = ed.getPublicKey(privateKey);
2460
2461
  const address = FastsetClient.encodeBech32Address(publicKey);
2461
2462
  return {
@@ -2467,8 +2468,8 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
2467
2468
  }
2468
2469
  async generate() {
2469
2470
  const mnemonicRaw = bip39.generateMnemonic(import_english.wordlist, 256);
2470
- const mnemonic = (0, import_warps5.normalizeMnemonic)(mnemonicRaw);
2471
- (0, import_warps5.validateMnemonicLength)(mnemonic);
2471
+ const mnemonic = (0, import_warps6.normalizeMnemonic)(mnemonicRaw);
2472
+ (0, import_warps6.validateMnemonicLength)(mnemonic);
2472
2473
  const seed = bip39.mnemonicToSeedSync(mnemonic);
2473
2474
  const privateKey = seed.slice(0, 32);
2474
2475
  const publicKey = ed.getPublicKey(privateKey);
@@ -2482,7 +2483,7 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
2482
2483
  }
2483
2484
  getPrivateKey() {
2484
2485
  if (this.privateKey) return this.privateKey;
2485
- const mnemonic = (0, import_warps5.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
2486
+ const mnemonic = (0, import_warps6.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
2486
2487
  if (!mnemonic) throw new Error("No mnemonic provided");
2487
2488
  const seed = bip39.mnemonicToSeedSync(mnemonic);
2488
2489
  this.privateKey = seed.slice(0, 32);
@@ -2493,7 +2494,7 @@ _MnemonicWalletProvider.PROVIDER_NAME = "mnemonic";
2493
2494
  var MnemonicWalletProvider = _MnemonicWalletProvider;
2494
2495
 
2495
2496
  // src/providers/PrivateKeyWalletProvider.ts
2496
- var import_warps6 = require("@joai/warps");
2497
+ var import_warps7 = require("@joai/warps");
2497
2498
  var bip392 = __toESM(require("@scure/bip39"), 1);
2498
2499
  var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
2499
2500
  constructor(config, chain2) {
@@ -2547,7 +2548,7 @@ var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
2547
2548
  privateKey: uint8ArrayToHex(privateKey),
2548
2549
  mnemonic
2549
2550
  };
2550
- (0, import_warps6.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
2551
+ (0, import_warps7.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
2551
2552
  return walletDetails;
2552
2553
  }
2553
2554
  async importFromPrivateKey(privateKey) {
@@ -2560,13 +2561,13 @@ var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
2560
2561
  privateKey,
2561
2562
  mnemonic: null
2562
2563
  };
2563
- (0, import_warps6.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
2564
+ (0, import_warps7.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
2564
2565
  return walletDetails;
2565
2566
  }
2566
2567
  async export() {
2567
2568
  const privateKey = this.getPrivateKey();
2568
- const privateKeyHex = (0, import_warps6.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
2569
- const mnemonic = (0, import_warps6.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
2569
+ const privateKeyHex = (0, import_warps7.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
2570
+ const mnemonic = (0, import_warps7.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
2570
2571
  const publicKey = ed.getPublicKey(privateKey);
2571
2572
  const address = FastsetClient.encodeBech32Address(publicKey);
2572
2573
  return {
@@ -2589,7 +2590,7 @@ var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
2589
2590
  }
2590
2591
  getPrivateKey() {
2591
2592
  if (this.privateKey) return this.privateKey;
2592
- const privateKeyHex = (0, import_warps6.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
2593
+ const privateKeyHex = (0, import_warps7.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
2593
2594
  if (!privateKeyHex) throw new Error("No private key provided");
2594
2595
  this.privateKey = hexToUint8Array(privateKeyHex);
2595
2596
  return this.privateKey;
@@ -2599,14 +2600,14 @@ _PrivateKeyWalletProvider.PROVIDER_NAME = "privateKey";
2599
2600
  var PrivateKeyWalletProvider = _PrivateKeyWalletProvider;
2600
2601
 
2601
2602
  // src/providers/ReadOnlyWalletProvider.ts
2602
- var import_warps7 = require("@joai/warps");
2603
+ var import_warps8 = require("@joai/warps");
2603
2604
  var ReadOnlyWalletProvider = class {
2604
2605
  constructor(config, chain2) {
2605
2606
  this.config = config;
2606
2607
  this.chain = chain2;
2607
2608
  }
2608
2609
  async getAddress() {
2609
- return (0, import_warps7.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2610
+ return (0, import_warps8.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2610
2611
  }
2611
2612
  async getPublicKey() {
2612
2613
  return null;
@@ -2620,19 +2621,19 @@ var ReadOnlyWalletProvider = class {
2620
2621
  throw new Error(`Wallet can not be used for signing: ${address}`);
2621
2622
  }
2622
2623
  async importFromMnemonic(mnemonic) {
2623
- const address = (0, import_warps7.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2624
+ const address = (0, import_warps8.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2624
2625
  throw new Error(`Wallet can not be used for signing: ${address}`);
2625
2626
  }
2626
2627
  async importFromPrivateKey(privateKey) {
2627
- const address = (0, import_warps7.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2628
+ const address = (0, import_warps8.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2628
2629
  throw new Error(`Wallet can not be used for signing: ${address}`);
2629
2630
  }
2630
2631
  async export() {
2631
- const address = (0, import_warps7.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2632
+ const address = (0, import_warps8.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2632
2633
  throw new Error(`Wallet can not be used for signing: ${address}`);
2633
2634
  }
2634
2635
  async generate() {
2635
- const address = (0, import_warps7.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2636
+ const address = (0, import_warps8.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
2636
2637
  throw new Error(`Wallet can not be used for signing: ${address}`);
2637
2638
  }
2638
2639
  };
@@ -2701,10 +2702,11 @@ var WarpFastsetWallet = class {
2701
2702
  const wallet = this.config.user?.wallets?.[this.chain.name];
2702
2703
  if (!wallet) return null;
2703
2704
  if (typeof wallet === "string") return new ReadOnlyWalletProvider(this.config, this.chain);
2705
+ if (!wallet.provider) return new ReadOnlyWalletProvider(this.config, this.chain);
2704
2706
  return this.createProviderForOperation(wallet.provider);
2705
2707
  }
2706
2708
  initializeCache() {
2707
- (0, import_warps8.initializeWalletCache)(this.walletProvider).then((cache) => {
2709
+ (0, import_warps9.initializeWalletCache)(this.walletProvider).then((cache) => {
2708
2710
  this.cachedAddress = cache.address;
2709
2711
  this.cachedPublicKey = cache.publicKey;
2710
2712
  });
@@ -2725,7 +2727,7 @@ var WarpFastsetWallet = class {
2725
2727
 
2726
2728
  // src/main.ts
2727
2729
  var NativeTokenSet = {
2728
- chain: import_warps9.WarpChainName.Fastset,
2730
+ chain: import_warps10.WarpChainName.Fastset,
2729
2731
  identifier: "SET",
2730
2732
  name: "SET",
2731
2733
  symbol: "SET",
@@ -2752,9 +2754,9 @@ function createFastsetAdapter(chainName, chainInfos) {
2752
2754
  };
2753
2755
  };
2754
2756
  }
2755
- var FastsetAdapter = createFastsetAdapter(import_warps9.WarpChainName.Fastset, {
2757
+ var FastsetAdapter = createFastsetAdapter(import_warps10.WarpChainName.Fastset, {
2756
2758
  mainnet: {
2757
- name: import_warps9.WarpChainName.Fastset,
2759
+ name: import_warps10.WarpChainName.Fastset,
2758
2760
  displayName: "FastSet",
2759
2761
  chainId: "1",
2760
2762
  blockTime: 1e3,
@@ -2764,7 +2766,7 @@ var FastsetAdapter = createFastsetAdapter(import_warps9.WarpChainName.Fastset, {
2764
2766
  nativeToken: NativeTokenSet
2765
2767
  },
2766
2768
  testnet: {
2767
- name: import_warps9.WarpChainName.Fastset,
2769
+ name: import_warps10.WarpChainName.Fastset,
2768
2770
  displayName: "FastSet Testnet",
2769
2771
  chainId: "testnet",
2770
2772
  blockTime: 1e3,
@@ -2774,7 +2776,7 @@ var FastsetAdapter = createFastsetAdapter(import_warps9.WarpChainName.Fastset, {
2774
2776
  nativeToken: NativeTokenSet
2775
2777
  },
2776
2778
  devnet: {
2777
- name: import_warps9.WarpChainName.Fastset,
2779
+ name: import_warps10.WarpChainName.Fastset,
2778
2780
  displayName: "FastSet Devnet",
2779
2781
  chainId: "devnet",
2780
2782
  blockTime: 1e3,