@moonbeam-network/xcm-builder 1.0.0-dev.241 → 1.0.0-dev.243

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
@@ -379,7 +379,8 @@ declare function polkadotXcm$1(): {
379
379
  X2AndFeeHere: () => ExtrinsicConfigBuilder;
380
380
  };
381
381
  transferAssetsUsingTypeAndThen: () => {
382
- here: () => ExtrinsicConfigBuilder;
382
+ here: (parents?: number) => ExtrinsicConfigBuilder;
383
+ X2: (parents?: number) => ExtrinsicConfigBuilder;
383
384
  globalConsensusEthereum: () => ExtrinsicConfigBuilder;
384
385
  };
385
386
  transferAssetsToEcosystem: () => {
package/build/index.mjs CHANGED
@@ -2048,7 +2048,7 @@ function polkadotXcm() {
2048
2048
  transferAssetsUsingTypeAndThen: () => {
2049
2049
  const func = "transferAssetsUsingTypeAndThen";
2050
2050
  return {
2051
- here: () => ({
2051
+ here: (parents = 0) => ({
2052
2052
  build: (params) => new ExtrinsicConfig({
2053
2053
  module: pallet2,
2054
2054
  func,
@@ -2071,7 +2071,7 @@ function polkadotXcm() {
2071
2071
  [version]: [
2072
2072
  {
2073
2073
  id: {
2074
- parents: 0,
2074
+ parents,
2075
2075
  interior: "Here"
2076
2076
  },
2077
2077
  fun: {
@@ -2083,7 +2083,7 @@ function polkadotXcm() {
2083
2083
  "LocalReserve",
2084
2084
  {
2085
2085
  [version]: {
2086
- parents: 0,
2086
+ parents,
2087
2087
  interior: "Here"
2088
2088
  }
2089
2089
  },
@@ -2112,6 +2112,92 @@ function polkadotXcm() {
2112
2112
  }
2113
2113
  })
2114
2114
  }),
2115
+ X2: (parents = 0) => ({
2116
+ build: (params) => new ExtrinsicConfig({
2117
+ module: pallet2,
2118
+ func,
2119
+ getArgs: (extrinsicFunction) => {
2120
+ const version = getExtrinsicArgumentVersion(extrinsicFunction);
2121
+ const isSameAsset = params.asset.isSame(params.fee);
2122
+ const shouldFeeAssetPrecede = shouldFeeAssetPrecedeAsset(params);
2123
+ const asset = {
2124
+ parents: 0,
2125
+ interior: {
2126
+ X2: [
2127
+ {
2128
+ PalletInstance: params.asset.getAssetPalletInstance()
2129
+ },
2130
+ {
2131
+ GeneralIndex: params.asset.getAssetId()
2132
+ }
2133
+ ]
2134
+ }
2135
+ };
2136
+ const assetWithAmount = {
2137
+ id: asset,
2138
+ fun: { Fungible: params.asset.amount }
2139
+ };
2140
+ const feeAsset = {
2141
+ parents,
2142
+ interior: "Here"
2143
+ };
2144
+ const feeAssetWithAmount = {
2145
+ id: feeAsset,
2146
+ fun: { Fungible: params.fee.amount }
2147
+ };
2148
+ const assets3 = isSameAsset ? [assetWithAmount] : shouldFeeAssetPrecede ? [feeAssetWithAmount, assetWithAmount] : [assetWithAmount, feeAssetWithAmount];
2149
+ return [
2150
+ // dest
2151
+ {
2152
+ [version]: {
2153
+ parents: 1,
2154
+ interior: {
2155
+ X1: [
2156
+ {
2157
+ Parachain: params.destination.parachainId
2158
+ }
2159
+ ]
2160
+ }
2161
+ }
2162
+ },
2163
+ // assets
2164
+ {
2165
+ [version]: assets3
2166
+ },
2167
+ // assetsTransferType
2168
+ "LocalReserve",
2169
+ // remoteFeesId
2170
+ {
2171
+ [version]: isSameAsset ? asset : feeAsset
2172
+ },
2173
+ // feesTransferType
2174
+ "LocalReserve",
2175
+ // customXcmOnDest
2176
+ {
2177
+ [version]: [
2178
+ {
2179
+ DepositAsset: {
2180
+ assets: {
2181
+ Wild: { AllCounted: isSameAsset ? 1 : 2 }
2182
+ },
2183
+ beneficiary: {
2184
+ parents: 0,
2185
+ interior: {
2186
+ X1: [
2187
+ getExtrinsicAccount(params.destinationAddress)
2188
+ ]
2189
+ }
2190
+ }
2191
+ }
2192
+ }
2193
+ ]
2194
+ },
2195
+ // weightLimit
2196
+ "Unlimited"
2197
+ ];
2198
+ }
2199
+ })
2200
+ }),
2115
2201
  // TODO we could pass a parameter globalConsensus in the chain asset if we need a different one
2116
2202
  globalConsensusEthereum: () => ({
2117
2203
  build: (params) => new ExtrinsicConfig({
@@ -2258,12 +2344,11 @@ function polkadotXcm() {
2258
2344
  }
2259
2345
  }
2260
2346
  ];
2261
- const result = getEcosystemTransferExtrinsicArgs({
2347
+ return getEcosystemTransferExtrinsicArgs({
2262
2348
  ...params,
2263
2349
  func: extrinsicFunction,
2264
2350
  assets: assets3
2265
2351
  });
2266
- return result;
2267
2352
  }
2268
2353
  });
2269
2354
  }
@@ -2375,12 +2460,11 @@ function polkadotXcm() {
2375
2460
  }
2376
2461
  }
2377
2462
  ];
2378
- const result = getEcosystemTransferExtrinsicArgs({
2463
+ return getEcosystemTransferExtrinsicArgs({
2379
2464
  ...params,
2380
2465
  func: extrinsicFunction,
2381
2466
  assets: assets3
2382
2467
  });
2383
- return result;
2384
2468
  }
2385
2469
  });
2386
2470
  }