@moonbeam-network/xcm-builder 1.0.0-dev.280 → 1.0.0-dev.281

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,12 @@ 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: [
3933
+ asset.address,
3934
+ destination.parachainId,
3935
+ 10000000000000n
3936
+ // TODO mjm get from config? if not possible, we could default this, as it doesn't affect when sending to relay chain
3937
+ ],
3933
3938
  func: "quoteSendTokenFee",
3934
3939
  module: "Gateway"
3935
3940
  });
@@ -4780,8 +4785,161 @@ function ethereumTokenTransfers() {
4780
4785
  };
4781
4786
  }
4782
4787
 
4783
- // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
4788
+ // src/mrl/providers/snowbridge/extrinsic/polkadotXcm/polkadotXcm.ts
4784
4789
  import { EvmChain as EvmChain2 } from "@moonbeam-network/xcm-types";
4790
+ var pallet7 = "polkadotXcm";
4791
+ function polkadotXcm2() {
4792
+ return {
4793
+ transferAssetsUsingTypeAndThen: () => {
4794
+ const func = "transferAssetsUsingTypeAndThen";
4795
+ const provider = "snowbridge" /* Snowbridge */;
4796
+ return {
4797
+ // TODO mjm rename ? nativeEth?
4798
+ canonicalEth: () => ({
4799
+ provider,
4800
+ build: ({ asset, destination, destinationAddress, protocolFee }) => {
4801
+ if (!EvmChain2.is(destination)) {
4802
+ throw new Error(
4803
+ "Destination must be an EVM chain for globalConsensus function"
4804
+ );
4805
+ }
4806
+ return new ExtrinsicConfig({
4807
+ module: pallet7,
4808
+ func,
4809
+ getArgs: (extrinsicFunction) => {
4810
+ const version = getExtrinsicArgumentVersion(extrinsicFunction);
4811
+ const dest = {
4812
+ [version]: {
4813
+ parents: 1,
4814
+ interior: "Here"
4815
+ }
4816
+ };
4817
+ const assets3 = {
4818
+ [version]: [
4819
+ {
4820
+ id: {
4821
+ parents: 1,
4822
+ interior: "Here"
4823
+ },
4824
+ fun: { Fungible: protocolFee?.amount }
4825
+ // TODO mjm
4826
+ },
4827
+ {
4828
+ id: {
4829
+ parents: 2,
4830
+ interior: {
4831
+ X1: [
4832
+ {
4833
+ GlobalConsensus: {
4834
+ Ethereum: { chainId: destination.id }
4835
+ }
4836
+ }
4837
+ ]
4838
+ }
4839
+ },
4840
+ fun: { Fungible: asset.amount }
4841
+ }
4842
+ ]
4843
+ };
4844
+ const assetsTransferType = 2 /* DestinationReserve */;
4845
+ const remoteFeesId = {
4846
+ [version]: {
4847
+ parents: 1,
4848
+ interior: "Here"
4849
+ }
4850
+ };
4851
+ const feesTransferType = 2 /* DestinationReserve */;
4852
+ const customXcmOnDest = {
4853
+ [version]: [
4854
+ {
4855
+ InitiateReserveWithdraw: {
4856
+ assets: {
4857
+ Definite: [
4858
+ {
4859
+ id: {
4860
+ parents: 1,
4861
+ interior: {
4862
+ X1: [
4863
+ {
4864
+ GlobalConsensus: {
4865
+ Ethereum: { chainId: destination.id }
4866
+ }
4867
+ }
4868
+ ]
4869
+ }
4870
+ },
4871
+ fun: { Fungible: asset.amount }
4872
+ }
4873
+ ]
4874
+ },
4875
+ reserve: {
4876
+ parents: 1,
4877
+ interior: {
4878
+ X1: [
4879
+ {
4880
+ GlobalConsensus: {
4881
+ Ethereum: { chainId: destination.id }
4882
+ }
4883
+ }
4884
+ ]
4885
+ }
4886
+ },
4887
+ xcm: [
4888
+ {
4889
+ DepositAsset: {
4890
+ assets: {
4891
+ Definite: [
4892
+ {
4893
+ id: {
4894
+ parents: 0,
4895
+ interior: "Here"
4896
+ },
4897
+ fun: { Fungible: asset.amount }
4898
+ }
4899
+ ]
4900
+ },
4901
+ beneficiary: {
4902
+ parents: 0,
4903
+ interior: {
4904
+ X1: [
4905
+ {
4906
+ AccountKey20: {
4907
+ network: {
4908
+ Ethereum: { chainId: destination.id }
4909
+ },
4910
+ key: destinationAddress
4911
+ }
4912
+ }
4913
+ ]
4914
+ }
4915
+ }
4916
+ }
4917
+ }
4918
+ ]
4919
+ }
4920
+ }
4921
+ ]
4922
+ };
4923
+ return [
4924
+ dest,
4925
+ assets3,
4926
+ assetsTransferType,
4927
+ remoteFeesId,
4928
+ feesTransferType,
4929
+ customXcmOnDest,
4930
+ "Unlimited"
4931
+ ];
4932
+ }
4933
+ });
4934
+ }
4935
+ })
4936
+ };
4937
+ }
4938
+ };
4939
+ }
4940
+
4941
+ // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
4942
+ import { EvmChain as EvmChain3 } from "@moonbeam-network/xcm-types";
4785
4943
 
4786
4944
  // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.utils.ts
4787
4945
  function getGlobalConsensusArgs({
@@ -4834,7 +4992,7 @@ function getGlobalConsensusArgs({
4834
4992
  }
4835
4993
 
4836
4994
  // src/mrl/providers/snowbridge/extrinsic/xcmPallet/xcmPallet.ts
4837
- var pallet7 = "xcmPallet";
4995
+ var pallet8 = "xcmPallet";
4838
4996
  function xcmPallet2() {
4839
4997
  return {
4840
4998
  transferAssets: () => {
@@ -4844,13 +5002,13 @@ function xcmPallet2() {
4844
5002
  globalConsensus: () => ({
4845
5003
  provider,
4846
5004
  build: ({ asset, destination, destinationAddress }) => {
4847
- if (!EvmChain2.is(destination)) {
5005
+ if (!EvmChain3.is(destination)) {
4848
5006
  throw new Error(
4849
5007
  "Destination must be an EVM chain for globalConsensus function"
4850
5008
  );
4851
5009
  }
4852
5010
  return new ExtrinsicConfig({
4853
- module: pallet7,
5011
+ module: pallet8,
4854
5012
  func,
4855
5013
  getArgs: (extrinsicFunction) => {
4856
5014
  const assets3 = [
@@ -4883,14 +5041,14 @@ function xcmPallet2() {
4883
5041
  globalConsensusErc20: () => ({
4884
5042
  provider,
4885
5043
  build: ({ asset, destination, destinationAddress }) => {
4886
- if (!EvmChain2.is(destination)) {
5044
+ if (!EvmChain3.is(destination)) {
4887
5045
  throw new Error(
4888
5046
  "Destination must be an EVM chain for globalConsensusErc20 function"
4889
5047
  );
4890
5048
  }
4891
5049
  const assetInDestination = destination.getChainAsset(asset);
4892
5050
  return new ExtrinsicConfig({
4893
- module: pallet7,
5051
+ module: pallet8,
4894
5052
  func,
4895
5053
  getArgs: (extrinsicFunction) => {
4896
5054
  const assets3 = [
@@ -4935,7 +5093,7 @@ function xcmPallet2() {
4935
5093
 
4936
5094
  // src/mrl/providers/snowbridge/extrinsic/index.ts
4937
5095
  function extrinsic() {
4938
- return { ethereumTokenTransfers, xcmPallet: xcmPallet2 };
5096
+ return { ethereumTokenTransfers, xcmPallet: xcmPallet2, polkadotXcm: polkadotXcm2 };
4939
5097
  }
4940
5098
 
4941
5099
  // src/mrl/providers/snowbridge/index.ts
@@ -4962,7 +5120,7 @@ import {
4962
5120
  import { getMultilocationDerivedAddresses } from "@moonbeam-network/xcm-utils";
4963
5121
  var BUY_EXECUTION_FEE = 100000000000000000n;
4964
5122
  var CROSS_CHAIN_FEE = 100000000000000000n;
4965
- function polkadotXcm2() {
5123
+ function polkadotXcm3() {
4966
5124
  const provider = "wormhole" /* Wormhole */;
4967
5125
  return {
4968
5126
  send: () => ({
@@ -5915,7 +6073,7 @@ var WormholeConfig = class _WormholeConfig {
5915
6073
  };
5916
6074
 
5917
6075
  // src/mrl/providers/wormhole/wormhole/wormhole.ts
5918
- import { EvmChain as EvmChain3, EvmParachain as EvmParachain7, Parachain as Parachain3 } from "@moonbeam-network/xcm-types";
6076
+ import { EvmChain as EvmChain4, EvmParachain as EvmParachain7, Parachain as Parachain3 } from "@moonbeam-network/xcm-types";
5919
6077
  import { getMultilocationDerivedAddresses as getMultilocationDerivedAddresses3 } from "@moonbeam-network/xcm-utils";
5920
6078
  import { evmToAddress as evmToAddress4 } from "@polkadot/util-crypto/address";
5921
6079
  import { Wormhole as Wormhole2 } from "@wormhole-foundation/sdk-connect";
@@ -5956,7 +6114,7 @@ function wormhole() {
5956
6114
  }) => {
5957
6115
  const isSourceParachain = Parachain3.is(source);
5958
6116
  const isDestinationMoonChain = destination.isEqual(moonChain);
5959
- const isDestinationEvmChain = EvmChain3.is(destination);
6117
+ const isDestinationEvmChain = EvmChain4.is(destination);
5960
6118
  const isNativeAsset = asset.isSame(
5961
6119
  isDestinationEvmChain ? moonChain.nativeAsset : source.nativeAsset
5962
6120
  );
@@ -7610,7 +7768,7 @@ function ethereumXcm() {
7610
7768
 
7611
7769
  // src/mrl/providers/wormhole/extrinsic/index.ts
7612
7770
  function extrinsic2() {
7613
- return { ethereumXcm, polkadotXcm: polkadotXcm2 };
7771
+ return { ethereumXcm, polkadotXcm: polkadotXcm3 };
7614
7772
  }
7615
7773
 
7616
7774
  // src/mrl/providers/wormhole/index.ts