@moonbeam-network/xcm-builder 1.0.0-dev.200 → 1.0.0-dev.201

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/build/index.d.ts CHANGED
@@ -370,6 +370,8 @@ declare function polkadotXcm$1(): {
370
370
  };
371
371
  transferAssets: () => {
372
372
  here: (parents?: number) => ExtrinsicConfigBuilder;
373
+ X2: () => ExtrinsicConfigBuilder;
374
+ X3: () => ExtrinsicConfigBuilder;
373
375
  X2AndFeeHere: () => ExtrinsicConfigBuilder;
374
376
  };
375
377
  transferAssetsUsingTypeAndThen: () => {
package/build/index.mjs CHANGED
@@ -1722,6 +1722,104 @@ function polkadotXcm() {
1722
1722
  }
1723
1723
  })
1724
1724
  }),
1725
+ X2: () => ({
1726
+ build: (params) => new ExtrinsicConfig({
1727
+ module: pallet2,
1728
+ func,
1729
+ getArgs: (extrinsicFunction) => {
1730
+ const version = getExtrinsicArgumentVersion(extrinsicFunction);
1731
+ const assetInDestination = params.destination.getChainAsset(
1732
+ params.asset
1733
+ );
1734
+ return getPolkadotXcmExtrinsicArgs({
1735
+ ...params,
1736
+ func: extrinsicFunction,
1737
+ asset: [
1738
+ {
1739
+ id: normalizeConcrete(version, {
1740
+ parents: 1,
1741
+ interior: {
1742
+ X2: [
1743
+ {
1744
+ Parachain: params.destination.parachainId
1745
+ },
1746
+ {
1747
+ PalletInstance: assetInDestination.getAssetPalletInstance()
1748
+ }
1749
+ ]
1750
+ }
1751
+ }),
1752
+ fun: {
1753
+ Fungible: params.asset.amount
1754
+ }
1755
+ }
1756
+ ]
1757
+ });
1758
+ }
1759
+ })
1760
+ }),
1761
+ X3: () => ({
1762
+ build: (params) => new ExtrinsicConfig({
1763
+ module: pallet2,
1764
+ func,
1765
+ getArgs: (extrinsicFunction) => {
1766
+ const version = getExtrinsicArgumentVersion(extrinsicFunction);
1767
+ const assetInDestination = params.destination.getChainAsset(
1768
+ params.asset
1769
+ );
1770
+ const feeAssetInDestination = params.destination.getChainAsset(
1771
+ params.fee
1772
+ );
1773
+ return getPolkadotXcmExtrinsicArgs({
1774
+ ...params,
1775
+ func: extrinsicFunction,
1776
+ asset: [
1777
+ {
1778
+ id: normalizeConcrete(version, {
1779
+ parents: 1,
1780
+ interior: {
1781
+ X2: [
1782
+ {
1783
+ Parachain: params.destination.parachainId
1784
+ },
1785
+ {
1786
+ PalletInstance: feeAssetInDestination.getAssetPalletInstance()
1787
+ }
1788
+ ]
1789
+ }
1790
+ }),
1791
+ fun: {
1792
+ Fungible: params.fee.amount
1793
+ }
1794
+ },
1795
+ {
1796
+ id: normalizeConcrete(version, {
1797
+ parents: 1,
1798
+ interior: {
1799
+ X3: [
1800
+ {
1801
+ Parachain: params.destination.parachainId
1802
+ },
1803
+ {
1804
+ PalletInstance: assetInDestination.getAssetPalletInstance()
1805
+ },
1806
+ {
1807
+ AccountKey20: {
1808
+ key: assetInDestination.address
1809
+ }
1810
+ }
1811
+ ]
1812
+ }
1813
+ }),
1814
+ fun: {
1815
+ Fungible: params.asset.amount
1816
+ }
1817
+ }
1818
+ ]
1819
+ });
1820
+ }
1821
+ })
1822
+ }),
1725
1823
  X2AndFeeHere: () => ({
1726
1824
  build: (params) => new ExtrinsicConfig({
1727
1825
  module: pallet2,
@@ -2576,7 +2674,6 @@ function BuildVersionedAsset() {
2576
2674
  parents: 2
2577
2675
  }),
2578
2676
  fromPalletInstance: (asset) => {
2579
- validatePalletInstance(asset);
2580
2677
  return {
2581
2678
  interior: {
2582
2679
  X1: [
@@ -2589,7 +2686,6 @@ function BuildVersionedAsset() {
2589
2686
  };
2590
2687
  },
2591
2688
  fromPalletInstanceAndGeneralIndex: (asset) => {
2592
- validatePalletInstance(asset);
2593
2689
  return {
2594
2690
  interior: {
2595
2691
  X2: [
@@ -2610,7 +2706,6 @@ function BuildVersionedAsset() {
2610
2706
  );
2611
2707
  }
2612
2708
  const sourceAsset = source.getChainAsset(asset);
2613
- validatePalletInstance(sourceAsset);
2614
2709
  return {
2615
2710
  interior: {
2616
2711
  X3: [
@@ -2629,7 +2724,6 @@ function BuildVersionedAsset() {
2629
2724
  );
2630
2725
  }
2631
2726
  const sourceAsset = source.getChainAsset(asset);
2632
- validatePalletInstance(sourceAsset);
2633
2727
  return {
2634
2728
  interior: {
2635
2729
  X2: [
@@ -2649,7 +2743,6 @@ function BuildVersionedAsset() {
2649
2743
  );
2650
2744
  }
2651
2745
  const sourceAsset = source.getChainAsset(asset);
2652
- validatePalletInstance(sourceAsset);
2653
2746
  return {
2654
2747
  interior: {
2655
2748
  X3: [
@@ -2696,13 +2789,6 @@ function QueryVersionedAsset() {
2696
2789
  }
2697
2790
  };
2698
2791
  }
2699
- var validatePalletInstance = (asset) => {
2700
- if (!asset.getAssetPalletInstance()) {
2701
- throw new Error(
2702
- `No pallet instance configured for the asset ${asset.key} for XcmPaymentApi fee calculation`
2703
- );
2704
- }
2705
- };
2706
2792
 
2707
2793
  // src/fee/xcmPaymentApi/xcmPaymentApi.utils.ts
2708
2794
  async function getVersionedAssets({