diff --git a/packages/builder/CHANGELOG.md b/packages/builder/CHANGELOG.md index 7ac5b9bf..ae6a9311 100644 --- a/packages/builder/CHANGELOG.md +++ b/packages/builder/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-builder +## 2.4.7 + +### Patch Changes + +- [#345](https://github.com/moonbeam-foundation/xcm-sdk/pull/345) [`6fe69b2`](https://github.com/moonbeam-foundation/xcm-sdk/commit/6fe69b230b4d44c717d9ec7ff73bbc6282b1385e) Thanks [@mmaurello](https://github.com/mmaurello)! - Add transferAssetsUsingTypeAndThen function to xcmPallet and implement it to relay chains + ## 2.4.6 ### Patch Changes diff --git a/packages/builder/package.json b/packages/builder/package.json index 50ee7ea8..b9fe6e6b 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-builder", - "version": "2.4.6", + "version": "2.4.7", "description": "Moonbeam XCM builder", "scripts": { "build": "tsup", diff --git a/packages/builder/src/extrinsic/pallets/xcmPallet/xcmPallet.ts b/packages/builder/src/extrinsic/pallets/xcmPallet/xcmPallet.ts index 0fe4e84f..cf7d0a04 100644 --- a/packages/builder/src/extrinsic/pallets/xcmPallet/xcmPallet.ts +++ b/packages/builder/src/extrinsic/pallets/xcmPallet/xcmPallet.ts @@ -1,8 +1,10 @@ import { ExtrinsicConfig } from '../../../types/substrate/ExtrinsicConfig'; -import type { - ExtrinsicConfigBuilder, - Parents, +import { + type ExtrinsicConfigBuilder, + type Parents, + XcmVersion, } from '../../ExtrinsicBuilder.interfaces'; +import { getExtrinsicAccount } from '../../ExtrinsicBuilder.utils'; import { getPolkadotXcmExtrinsicArgs } from '../polkadotXcm/polkadotXcm.util'; const pallet = 'xcmPallet'; @@ -41,5 +43,76 @@ export function xcmPallet() { }), }; }, + transferAssetsUsingTypeAndThen: () => { + const func = 'transferAssetsUsingTypeAndThen'; + + return { + here: (): ExtrinsicConfigBuilder => ({ + build: (params) => + new ExtrinsicConfig({ + module: pallet, + func, + getArgs: () => { + const version = XcmVersion.v4; + return [ + { + [version]: { + parents: 0, + interior: { + X1: [ + { + Parachain: params.destination.parachainId, + }, + ], + }, + }, + }, + { + [version]: [ + { + id: { + parents: 0, + interior: 'Here', + }, + fun: { + Fungible: params.asset.amount, + }, + }, + ], + }, + 'LocalReserve', + { + [version]: { + parents: 0, + interior: 'Here', + }, + }, + 'LocalReserve', + { + [version]: [ + { + DepositAsset: { + assets: { + Wild: { AllCounted: 1 }, + }, + beneficiary: { + parents: 0, + interior: { + X1: [ + getExtrinsicAccount(params.destinationAddress), + ], + }, + }, + }, + }, + ], + }, + 'Unlimited', + ]; + }, + }), + }), + }; + }, }; } diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index 2c38b1b5..63c1e6ab 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,14 @@ # @moonbeam-network/xcm-config +## 2.5.12 + +### Patch Changes + +- [#345](https://github.com/moonbeam-foundation/xcm-sdk/pull/345) [`6fe69b2`](https://github.com/moonbeam-foundation/xcm-sdk/commit/6fe69b230b4d44c717d9ec7ff73bbc6282b1385e) Thanks [@mmaurello](https://github.com/mmaurello)! - Add transferAssetsUsingTypeAndThen function to xcmPallet and implement it to relay chains + +- Updated dependencies [[`6fe69b2`](https://github.com/moonbeam-foundation/xcm-sdk/commit/6fe69b230b4d44c717d9ec7ff73bbc6282b1385e)]: + - @moonbeam-network/xcm-builder@2.4.7 + ## 2.5.11 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 526be0b4..53cb2003 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "2.5.11", + "version": "2.5.12", "description": "All necessary configuration to transfer assets from Moonbeam, Moonriver, Moonbase to other parachains and back", "scripts": { "build": "tsup", diff --git a/packages/config/src/xcm-configs/alphanetRelay.ts b/packages/config/src/xcm-configs/alphanetRelay.ts index 3616cabc..e7b72532 100644 --- a/packages/config/src/xcm-configs/alphanetRelay.ts +++ b/packages/config/src/xcm-configs/alphanetRelay.ts @@ -28,7 +28,7 @@ export const alphanetRelayRoutes = new ChainRoutes({ }, extrinsic: ExtrinsicBuilder() .xcmPallet() - .limitedReserveTransferAssets(0) + .transferAssetsUsingTypeAndThen() .here(), }, ], diff --git a/packages/config/src/xcm-configs/kusama.ts b/packages/config/src/xcm-configs/kusama.ts index 7fcf2c70..65e5dd6d 100644 --- a/packages/config/src/xcm-configs/kusama.ts +++ b/packages/config/src/xcm-configs/kusama.ts @@ -33,7 +33,7 @@ export const kusamaRoutes = new ChainRoutes({ }, extrinsic: ExtrinsicBuilder() .xcmPallet() - .limitedReserveTransferAssets(0) + .transferAssetsUsingTypeAndThen() .here(), }, ], diff --git a/packages/config/src/xcm-configs/polkadot.ts b/packages/config/src/xcm-configs/polkadot.ts index 7ad9165a..8e96f887 100644 --- a/packages/config/src/xcm-configs/polkadot.ts +++ b/packages/config/src/xcm-configs/polkadot.ts @@ -33,7 +33,7 @@ export const polkadotRoutes = new ChainRoutes({ }, extrinsic: ExtrinsicBuilder() .xcmPallet() - .limitedReserveTransferAssets(0) + .transferAssetsUsingTypeAndThen() .here(), }, ], diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index c3f498f1..3688d1a0 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,13 @@ # @moonbeam-network/xcm-sdk +## 2.5.13 + +### Patch Changes + +- Updated dependencies [[`6fe69b2`](https://github.com/moonbeam-foundation/xcm-sdk/commit/6fe69b230b4d44c717d9ec7ff73bbc6282b1385e)]: + - @moonbeam-network/xcm-builder@2.4.7 + - @moonbeam-network/xcm-config@2.5.12 + ## 2.5.12 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index ac521ac7..dd0dd19a 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "2.5.12", + "version": "2.5.13", "description": "The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem", "scripts": { "build": "tsup",