@moonbeam-network/xcm-builder 1.0.0-dev.277 → 1.0.0-dev.279

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
@@ -417,7 +417,7 @@ declare function eqBalances(): {
417
417
  transferXcm: () => ExtrinsicConfigBuilder;
418
418
  };
419
419
 
420
- declare function polkadotXcm$1(): {
420
+ declare function polkadotXcm$2(): {
421
421
  limitedReserveTransferAssets: () => {
422
422
  here: () => ExtrinsicConfigBuilder;
423
423
  X1: () => ExtrinsicConfigBuilder;
@@ -478,7 +478,7 @@ declare function ExtrinsicBuilder(): {
478
478
  eqBalances: typeof eqBalances;
479
479
  xTokens: typeof xTokens;
480
480
  xTransfer: typeof xTransfer;
481
- polkadotXcm: typeof polkadotXcm$1;
481
+ polkadotXcm: typeof polkadotXcm$2;
482
482
  xcmPallet: typeof xcmPallet$1;
483
483
  };
484
484
 
@@ -1770,6 +1770,12 @@ declare function ethereumTokenTransfers(): {
1770
1770
  transferNativeToken: () => MrlConfigBuilder;
1771
1771
  };
1772
1772
 
1773
+ declare function polkadotXcm$1(): {
1774
+ transferAssetsUsingTypeAndThen: () => {
1775
+ canonicalEth: () => MrlConfigBuilder;
1776
+ };
1777
+ };
1778
+
1773
1779
  declare function xcmPallet(): {
1774
1780
  transferAssets: () => {
1775
1781
  globalConsensus: () => MrlConfigBuilder;
@@ -1780,6 +1786,7 @@ declare function xcmPallet(): {
1780
1786
  declare function extrinsic$1(): {
1781
1787
  ethereumTokenTransfers: typeof ethereumTokenTransfers;
1782
1788
  xcmPallet: typeof xcmPallet;
1789
+ polkadotXcm: typeof polkadotXcm$1;
1783
1790
  };
1784
1791
 
1785
1792
  declare function snowbridge(): {
package/build/index.mjs CHANGED
@@ -119,11 +119,11 @@ function AssetMinBuilder() {
119
119
  };
120
120
  }
121
121
  function assetRegistry() {
122
- const pallet8 = "assetRegistry";
122
+ const pallet9 = "assetRegistry";
123
123
  return {
124
124
  assetMetadatas: () => ({
125
125
  build: ({ asset }) => new SubstrateQueryConfig({
126
- module: pallet8,
126
+ module: pallet9,
127
127
  func: "assetMetadatas",
128
128
  args: [asset],
129
129
  // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
@@ -132,7 +132,7 @@ function assetRegistry() {
132
132
  }),
133
133
  currencyMetadatas: () => ({
134
134
  build: ({ asset }) => new SubstrateQueryConfig({
135
- module: pallet8,
135
+ module: pallet9,
136
136
  func: "currencyMetadatas",
137
137
  args: [asset],
138
138
  // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
@@ -141,7 +141,7 @@ function assetRegistry() {
141
141
  }),
142
142
  metadata: () => ({
143
143
  build: ({ asset }) => new SubstrateQueryConfig({
144
- module: pallet8,
144
+ module: pallet9,
145
145
  func: "metadata",
146
146
  args: [asset],
147
147
  // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
@@ -3929,7 +3929,7 @@ function gateway() {
3929
3929
  return new ContractConfig({
3930
3930
  address: source.contracts.Gateway,
3931
3931
  abi: GATEWAY_ABI,
3932
- args: [asset.address, destination.parachainId, 0n],
3932
+ args: [asset.address, destination.parachainId, 10000000000000n],
3933
3933
  func: "quoteSendTokenFee",
3934
3934
  module: "Gateway"
3935
3935
  });
@@ -4780,8 +4780,158 @@ function ethereumTokenTransfers() {
4780
4780
  };
4781
4781
  }
4782
4782
 
4783
- // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
4783
+ // src/mrl/providers/snowbridge/extrinsic/polkadotXcm/polkadotXcm.ts
4784
4784
  import { EvmChain as EvmChain2 } from "@moonbeam-network/xcm-types";
4785
+ var pallet7 = "polkadotXcm";
4786
+ function polkadotXcm2() {
4787
+ return {
4788
+ transferAssetsUsingTypeAndThen: () => {
4789
+ const func = "transferAssetsUsingTypeAndThen";
4790
+ const provider = "snowbridge" /* Snowbridge */;
4791
+ return {
4792
+ // TODO mjm rename
4793
+ canonicalEth: () => ({
4794
+ provider,
4795
+ build: ({ asset, fee, destination, destinationAddress }) => {
4796
+ if (!EvmChain2.is(destination)) {
4797
+ throw new Error(
4798
+ "Destination must be an EVM chain for globalConsensus function"
4799
+ );
4800
+ }
4801
+ return new ExtrinsicConfig({
4802
+ module: pallet7,
4803
+ func,
4804
+ getArgs: (extrinsicFunction) => {
4805
+ const version = getExtrinsicArgumentVersion(extrinsicFunction);
4806
+ const dest = {
4807
+ [version]: {
4808
+ parents: 1,
4809
+ interior: "Here"
4810
+ }
4811
+ };
4812
+ const assets3 = {
4813
+ [version]: [
4814
+ {
4815
+ id: {
4816
+ parents: 1,
4817
+ interior: "Here"
4818
+ },
4819
+ fun: { Fungible: fee.amount }
4820
+ },
4821
+ {
4822
+ id: {
4823
+ parents: 2,
4824
+ interior: {
4825
+ X1: [
4826
+ {
4827
+ GlobalConsensus: {
4828
+ Ethereum: { chainId: destination.id }
4829
+ }
4830
+ }
4831
+ ]
4832
+ }
4833
+ },
4834
+ fun: { Fungible: asset.amount }
4835
+ }
4836
+ ]
4837
+ };
4838
+ const assetsTransferType = 2 /* DestinationReserve */;
4839
+ const remoteFeesId = {
4840
+ [version]: {
4841
+ parents: 1,
4842
+ interior: "Here"
4843
+ }
4844
+ };
4845
+ const feesTransferType = 2 /* DestinationReserve */;
4846
+ const customXcmOnDest = {
4847
+ [version]: [
4848
+ {
4849
+ InitiateReserveWithdraw: {
4850
+ assets: {
4851
+ Definite: [
4852
+ {
4853
+ id: {
4854
+ parents: 1,
4855
+ interior: {
4856
+ X1: [
4857
+ {
4858
+ GlobalConsensus: {
4859
+ Ethereum: { chainId: destination.id }
4860
+ }
4861
+ }
4862
+ ]
4863
+ }
4864
+ },
4865
+ fun: { Fungible: asset.amount }
4866
+ }
4867
+ ]
4868
+ },
4869
+ reserve: {
4870
+ parents: 1,
4871
+ interior: {
4872
+ X1: [
4873
+ {
4874
+ GlobalConsensus: {
4875
+ Ethereum: { chainId: destination.id }
4876
+ }
4877
+ }
4878
+ ]
4879
+ }
4880
+ },
4881
+ xcm: [
4882
+ {
4883
+ DepositAsset: {
4884
+ Definite: [
4885
+ {
4886
+ id: {
4887
+ parents: 0,
4888
+ interior: "Here"
4889
+ },
4890
+ fun: { Fungible: asset.amount }
4891
+ }
4892
+ ]
4893
+ }
4894
+ }
4895
+ ],
4896
+ beneficiary: {
4897
+ parents: 0,
4898
+ interior: {
4899
+ X1: [
4900
+ {
4901
+ AccountKey20: {
4902
+ network: {
4903
+ Ethereum: { chainId: destination.id }
4904
+ },
4905
+ key: destinationAddress
4906
+ }
4907
+ }
4908
+ ]
4909
+ }
4910
+ }
4911
+ }
4912
+ }
4913
+ ]
4914
+ };
4915
+ return [
4916
+ dest,
4917
+ assets3,
4918
+ assetsTransferType,
4919
+ remoteFeesId,
4920
+ feesTransferType,
4921
+ customXcmOnDest,
4922
+ "Unlimited"
4923
+ ];
4924
+ }
4925
+ });
4926
+ }
4927
+ })
4928
+ };
4929
+ }
4930
+ };
4931
+ }
4932
+
4933
+ // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
4934
+ import { EvmChain as EvmChain3 } from "@moonbeam-network/xcm-types";
4785
4935
 
4786
4936
  // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.utils.ts
4787
4937
  function getGlobalConsensusArgs({
@@ -4834,7 +4984,7 @@ function getGlobalConsensusArgs({
4834
4984
  }
4835
4985
 
4836
4986
  // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
4837
- var pallet7 = "xcmPallet";
4987
+ var pallet8 = "xcmPallet";
4838
4988
  function xcmPallet2() {
4839
4989
  return {
4840
4990
  transferAssets: () => {
@@ -4844,13 +4994,13 @@ function xcmPallet2() {
4844
4994
  globalConsensus: () => ({
4845
4995
  provider,
4846
4996
  build: ({ asset, destination, destinationAddress }) => {
4847
- if (!EvmChain2.is(destination)) {
4997
+ if (!EvmChain3.is(destination)) {
4848
4998
  throw new Error(
4849
4999
  "Destination must be an EVM chain for globalConsensus function"
4850
5000
  );
4851
5001
  }
4852
5002
  return new ExtrinsicConfig({
4853
- module: pallet7,
5003
+ module: pallet8,
4854
5004
  func,
4855
5005
  getArgs: (extrinsicFunction) => {
4856
5006
  const assets3 = [
@@ -4883,14 +5033,14 @@ function xcmPallet2() {
4883
5033
  globalConsensusErc20: () => ({
4884
5034
  provider,
4885
5035
  build: ({ asset, destination, destinationAddress }) => {
4886
- if (!EvmChain2.is(destination)) {
5036
+ if (!EvmChain3.is(destination)) {
4887
5037
  throw new Error(
4888
5038
  "Destination must be an EVM chain for globalConsensusErc20 function"
4889
5039
  );
4890
5040
  }
4891
5041
  const assetInDestination = destination.getChainAsset(asset);
4892
5042
  return new ExtrinsicConfig({
4893
- module: pallet7,
5043
+ module: pallet8,
4894
5044
  func,
4895
5045
  getArgs: (extrinsicFunction) => {
4896
5046
  const assets3 = [
@@ -4935,7 +5085,7 @@ function xcmPallet2() {
4935
5085
 
4936
5086
  // src/mrl/providers/snowbridge/extrinsic/index.ts
4937
5087
  function extrinsic() {
4938
- return { ethereumTokenTransfers, xcmPallet: xcmPallet2 };
5088
+ return { ethereumTokenTransfers, xcmPallet: xcmPallet2, polkadotXcm: polkadotXcm2 };
4939
5089
  }
4940
5090
 
4941
5091
  // src/mrl/providers/snowbridge/index.ts
@@ -4962,7 +5112,7 @@ import {
4962
5112
  import { getMultilocationDerivedAddresses } from "@moonbeam-network/xcm-utils";
4963
5113
  var BUY_EXECUTION_FEE = 100000000000000000n;
4964
5114
  var CROSS_CHAIN_FEE = 100000000000000000n;
4965
- function polkadotXcm2() {
5115
+ function polkadotXcm3() {
4966
5116
  const provider = "wormhole" /* Wormhole */;
4967
5117
  return {
4968
5118
  send: () => ({
@@ -5915,7 +6065,7 @@ var WormholeConfig = class _WormholeConfig {
5915
6065
  };
5916
6066
 
5917
6067
  // src/mrl/providers/wormhole/wormhole/wormhole.ts
5918
- import { EvmChain as EvmChain3, EvmParachain as EvmParachain7, Parachain as Parachain3 } from "@moonbeam-network/xcm-types";
6068
+ import { EvmChain as EvmChain4, EvmParachain as EvmParachain7, Parachain as Parachain3 } from "@moonbeam-network/xcm-types";
5919
6069
  import { getMultilocationDerivedAddresses as getMultilocationDerivedAddresses3 } from "@moonbeam-network/xcm-utils";
5920
6070
  import { evmToAddress as evmToAddress4 } from "@polkadot/util-crypto/address";
5921
6071
  import { Wormhole as Wormhole2 } from "@wormhole-foundation/sdk-connect";
@@ -5956,7 +6106,7 @@ function wormhole() {
5956
6106
  }) => {
5957
6107
  const isSourceParachain = Parachain3.is(source);
5958
6108
  const isDestinationMoonChain = destination.isEqual(moonChain);
5959
- const isDestinationEvmChain = EvmChain3.is(destination);
6109
+ const isDestinationEvmChain = EvmChain4.is(destination);
5960
6110
  const isNativeAsset = asset.isSame(
5961
6111
  isDestinationEvmChain ? moonChain.nativeAsset : source.nativeAsset
5962
6112
  );
@@ -7610,7 +7760,7 @@ function ethereumXcm() {
7610
7760
 
7611
7761
  // src/mrl/providers/wormhole/extrinsic/index.ts
7612
7762
  function extrinsic2() {
7613
- return { ethereumXcm, polkadotXcm: polkadotXcm2 };
7763
+ return { ethereumXcm, polkadotXcm: polkadotXcm3 };
7614
7764
  }
7615
7765
 
7616
7766
  // src/mrl/providers/wormhole/index.ts