diff --git a/packages/builder/src/extrinsic/pallets/polkadotXcm/polkadotXcm.ts b/packages/builder/src/extrinsic/pallets/polkadotXcm/polkadotXcm.ts index 62c6ecfc..a4146e6d 100644 --- a/packages/builder/src/extrinsic/pallets/polkadotXcm/polkadotXcm.ts +++ b/packages/builder/src/extrinsic/pallets/polkadotXcm/polkadotXcm.ts @@ -182,5 +182,36 @@ export function polkadotXcm() { }), }; }, + trasferAssets: () => { + const func = 'transferAssets'; + + return { + here: (): ExtrinsicConfigBuilder => ({ + build: (params) => + new ExtrinsicConfig({ + module: pallet, + func, + getArgs: (extrinsicFunction) => + getPolkadotXcmExtrinsicArgs({ + ...params, + func: extrinsicFunction, + asset: [ + { + id: { + Concrete: { + parents: 1, + interior: 'Here', + }, + }, + fun: { + Fungible: params.amount, + }, + }, + ], + }), + }), + }), + }; + }, }; } diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index f38a0dce..6b11b8f4 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -671,6 +671,7 @@ export const kusamaAssetHub = new Parachain({ metadataId: 9999999, }, ], + checkSovereignAccountBalances: true, ecosystem: Ecosystem.Kusama, genesisHash: '0x48239ef607d7928874027a43a67689209727dfb3d3dc5e5b03a39bdc2eda771a', diff --git a/packages/config/src/configs/kusamaAssetHub.ts b/packages/config/src/configs/kusamaAssetHub.ts index c25f1468..82060d38 100644 --- a/packages/config/src/configs/kusamaAssetHub.ts +++ b/packages/config/src/configs/kusamaAssetHub.ts @@ -57,6 +57,24 @@ export const kusamaAssetHubConfig = new ChainConfig({ }, min: AssetMinBuilder().assets().asset(), }), + new AssetConfig({ + asset: ksm, + balance: BalanceBuilder().substrate().system().account(), + destination: moonriver, + destinationFee: { + amount: FeeBuilder().xcmPaymentApi().xcmPaymentFee({ + isAssetReserveChain: false, + }), + asset: ksm, + balance: BalanceBuilder().substrate().system().account(), + }, + extrinsic: ExtrinsicBuilder().polkadotXcm().trasferAssets().here(), + fee: { + asset: ksm, + balance: BalanceBuilder().substrate().system().account(), + xcmDeliveryFeeAmount, + }, + }), ], chain: kusamaAssetHub, }); diff --git a/packages/config/src/configs/moonriver.ts b/packages/config/src/configs/moonriver.ts index 5c7658d1..754fe91b 100644 --- a/packages/config/src/configs/moonriver.ts +++ b/packages/config/src/configs/moonriver.ts @@ -282,6 +282,21 @@ export const moonriverConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), + new AssetConfig({ + asset: ksm, + balance: BalanceBuilder().substrate().assets().account(), + contract: ContractBuilder().Xtokens().transfer(), + destination: kusamaAssetHub, + destinationFee: { + amount: 0.0003, + asset: ksm, + balance: BalanceBuilder().substrate().assets().account(), + }, + fee: { + asset: movr, + balance: BalanceBuilder().substrate().system().account(), + }, + }), new AssetConfig({ asset: mgx, balance: BalanceBuilder().substrate().assets().account(), diff --git a/packages/sdk/src/getTransferData/getTransferData.utils.ts b/packages/sdk/src/getTransferData/getTransferData.utils.ts index 0645ba09..b59df1c7 100644 --- a/packages/sdk/src/getTransferData/getTransferData.utils.ts +++ b/packages/sdk/src/getTransferData/getTransferData.utils.ts @@ -4,11 +4,7 @@ import { ContractConfig, SubstrateQueryConfig, } from '@moonbeam-network/xcm-builder'; -import { - AssetConfig, - FeeAssetConfig, - polkadotAssetHub, -} from '@moonbeam-network/xcm-config'; +import { AssetConfig, FeeAssetConfig } from '@moonbeam-network/xcm-config'; import { AnyChain, Asset, EvmParachain } from '@moonbeam-network/xcm-types'; import { convertDecimals, toBigInt } from '@moonbeam-network/xcm-utils'; import { @@ -125,8 +121,7 @@ export function validateSovereignAccountBalances({ destination, }: ValidateSovereignAccountBalancesProps): void { if ( - destination.chain.key !== polkadotAssetHub.key || - // currently we want this only for this chain + !destination.chain.checkSovereignAccountBalances || !destination.sovereignAccountBalances ) { return;