@moonbeam-network/xcm-builder 3.3.0 → 3.3.1

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.mjs CHANGED
@@ -3033,29 +3033,32 @@ function buildSendExtrinsic({
3033
3033
  if (!transact) {
3034
3034
  throw new Error("Transact params are required");
3035
3035
  }
3036
+ const version = getExtrinsicArgumentVersion(sourceApi.tx.polkadotXcm.send);
3036
3037
  return sourceApi.tx.polkadotXcm.send(
3037
3038
  {
3038
- // TODO apply XCM versioning
3039
- V3: {
3039
+ [version]: normalizeX1(version, {
3040
3040
  parents: 1,
3041
- interior: { X1: { Parachain: moonChain.parachainId } }
3042
- }
3041
+ interior: {
3042
+ X1: { Parachain: moonChain.parachainId }
3043
+ }
3044
+ })
3043
3045
  },
3044
3046
  {
3045
- V3: [
3047
+ [version]: [
3046
3048
  {
3047
3049
  WithdrawAsset: [
3048
3050
  {
3049
- id: {
3050
- Concrete: {
3051
+ id: normalizeConcrete(
3052
+ version,
3053
+ normalizeX1(version, {
3051
3054
  parents: 0,
3052
3055
  interior: {
3053
3056
  X1: {
3054
3057
  PalletInstance: moonAsset.getAssetPalletInstance()
3055
3058
  }
3056
3059
  }
3057
- }
3058
- },
3060
+ })
3061
+ ),
3059
3062
  fun: { Fungible: BUY_EXECUTION_FEE }
3060
3063
  }
3061
3064
  ]
@@ -3063,16 +3066,17 @@ function buildSendExtrinsic({
3063
3066
  {
3064
3067
  BuyExecution: {
3065
3068
  fees: {
3066
- id: {
3067
- Concrete: {
3069
+ id: normalizeConcrete(
3070
+ version,
3071
+ normalizeX1(version, {
3068
3072
  parents: 0,
3069
3073
  interior: {
3070
3074
  X1: {
3071
3075
  PalletInstance: moonAsset.getAssetPalletInstance()
3072
3076
  }
3073
3077
  }
3074
- }
3075
- },
3078
+ })
3079
+ ),
3076
3080
  fun: { Fungible: BUY_EXECUTION_FEE }
3077
3081
  },
3078
3082
  weightLimit: "Unlimited"
@@ -3096,12 +3100,14 @@ function buildSendExtrinsic({
3096
3100
  {
3097
3101
  DepositAsset: {
3098
3102
  assets: { Wild: { AllCounted: 1 } },
3099
- beneficiary: {
3103
+ beneficiary: normalizeX1(version, {
3100
3104
  parents: 0,
3101
3105
  interior: {
3102
- X1: { AccountKey20: { key: computedOriginAccount } }
3106
+ X1: {
3107
+ AccountKey20: { key: computedOriginAccount }
3108
+ }
3103
3109
  }
3104
- }
3110
+ })
3105
3111
  }
3106
3112
  }
3107
3113
  ]
@@ -3977,9 +3983,10 @@ function getPayload({
3977
3983
  `Destination ${destination.name} is not a Parachain or EvmParachain`
3978
3984
  );
3979
3985
  }
3980
- const isPeaqEvm = destination.key === "peaq-evm-Alphanet" || destination.key === "peaq-evm";
3986
+ const isEvmDestination = EvmParachain4.is(destination);
3987
+ const version = getExtrinsicArgumentVersion(moonApi.tx.polkadotXcm.send);
3981
3988
  const multilocation = moonApi.createType("XcmVersionedLocation", {
3982
- V3: {
3989
+ [version]: {
3983
3990
  parents: 1,
3984
3991
  interior: {
3985
3992
  X2: [
@@ -3987,7 +3994,7 @@ function getPayload({
3987
3994
  Parachain: destination.parachainId
3988
3995
  },
3989
3996
  getExtrinsicAccount(
3990
- isPeaqEvm ? evmToAddress4(destinationAddress) : destinationAddress
3997
+ isEvmDestination ? evmToAddress4(destinationAddress) : destinationAddress
3991
3998
  )
3992
3999
  ]
3993
4000
  }