From 876c5eb937b1b0f44943a0fee8c0accb19f3747d Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Mon, 28 Aug 2023 14:54:19 +0200 Subject: [PATCH] Return destinationFeeBalance amount for controlling balance (#127) * return destinationFeeBalance amount for controling balance * remove hydraDXAlphanet config * add changeset * Update packages/sdk/src/getTransferData/getSourceData.ts Co-authored-by: elmar * fix linter --------- Co-authored-by: elmar --- .changeset/chilly-waves-decide.md | 6 +++ packages/config/src/configs/acala.ts | 3 ++ .../config/src/configs/alphanetAssetHub.ts | 1 + packages/config/src/configs/alphanetRelay.ts | 1 + packages/config/src/configs/astar.ts | 2 + packages/config/src/configs/bifrostKusama.ts | 2 + .../config/src/configs/bifrostPolkadot.ts | 2 + packages/config/src/configs/calamari.ts | 2 + packages/config/src/configs/centrifuge.ts | 1 + packages/config/src/configs/crustShadow.ts | 2 + packages/config/src/configs/darwinia.ts | 1 + packages/config/src/configs/darwiniaCrab.ts | 1 + .../config/src/configs/darwiniaPangoro.ts | 1 + packages/config/src/configs/equilibrium.ts | 3 ++ .../config/src/configs/equilibriumAlphanet.ts | 3 ++ packages/config/src/configs/hydraDX.ts | 6 +++ packages/config/src/configs/integritee.ts | 1 + packages/config/src/configs/interlay.ts | 2 + packages/config/src/configs/karura.ts | 3 ++ packages/config/src/configs/khala.ts | 2 + packages/config/src/configs/kintsugi.ts | 2 + packages/config/src/configs/kusama.ts | 1 + packages/config/src/configs/kusamaAssetHub.ts | 2 + .../config/src/configs/litentryAlphanet.ts | 1 + packages/config/src/configs/litmus.ts | 1 + packages/config/src/configs/mangataKusama.ts | 2 + packages/config/src/configs/moonbaseAlpha.ts | 13 ++++++ packages/config/src/configs/moonbaseBeta.ts | 2 + packages/config/src/configs/moonbeam.ts | 27 ++++++++++++ packages/config/src/configs/moonriver.ts | 28 ++++++++++++ packages/config/src/configs/nodle.ts | 1 + packages/config/src/configs/nodleEden.ts | 1 + packages/config/src/configs/parallel.ts | 2 + packages/config/src/configs/parallelHeiko.ts | 2 + packages/config/src/configs/phala.ts | 2 + packages/config/src/configs/polkadot.ts | 1 + .../config/src/configs/polkadotAssetHub.ts | 1 + packages/config/src/configs/robonomics.ts | 1 + packages/config/src/configs/shiden.ts | 2 + .../config/src/configs/subsocialAlphanet.ts | 1 + packages/config/src/configs/turing.ts | 2 + packages/config/src/configs/turingAlphanet.ts | 2 + packages/config/src/configs/uniqueAlpha.ts | 1 + packages/config/src/types/AssetConfig.ts | 3 +- .../sdk/src/getTransferData/getSourceData.ts | 43 ++++++++++++++++--- packages/sdk/src/sdk.interfaces.ts | 1 + 46 files changed, 181 insertions(+), 9 deletions(-) create mode 100644 .changeset/chilly-waves-decide.md diff --git a/.changeset/chilly-waves-decide.md b/.changeset/chilly-waves-decide.md new file mode 100644 index 00000000..8c2c3477 --- /dev/null +++ b/.changeset/chilly-waves-decide.md @@ -0,0 +1,6 @@ +--- +'@moonbeam-network/xcm-config': minor +'@moonbeam-network/xcm-sdk': minor +--- + +Return destination fee balance object for controlling enough balance diff --git a/packages/config/src/configs/acala.ts b/packages/config/src/configs/acala.ts index 236c3e81..92e2cdae 100644 --- a/packages/config/src/configs/acala.ts +++ b/packages/config/src/configs/acala.ts @@ -18,6 +18,7 @@ export const acalaConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: aca, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -28,6 +29,7 @@ export const acalaConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: aseed, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { @@ -43,6 +45,7 @@ export const acalaConfig = new ChainConfig({ destinationFee: { amount: 0.01, asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/alphanetAssetHub.ts b/packages/config/src/configs/alphanetAssetHub.ts index 3b312afd..677fe7e6 100644 --- a/packages/config/src/configs/alphanetAssetHub.ts +++ b/packages/config/src/configs/alphanetAssetHub.ts @@ -18,6 +18,7 @@ export const alphanetAssetHubConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: tt1, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/alphanetRelay.ts b/packages/config/src/configs/alphanetRelay.ts index 5cf51407..fcd7c0f3 100644 --- a/packages/config/src/configs/alphanetRelay.ts +++ b/packages/config/src/configs/alphanetRelay.ts @@ -17,6 +17,7 @@ export const alphanetRelayConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: unit, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .xcmPallet() diff --git a/packages/config/src/configs/astar.ts b/packages/config/src/configs/astar.ts index e6c9a98f..b79a0d52 100644 --- a/packages/config/src/configs/astar.ts +++ b/packages/config/src/configs/astar.ts @@ -17,6 +17,7 @@ export const astarConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: astr, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() @@ -30,6 +31,7 @@ export const astarConfig = new ChainConfig({ destinationFee: { amount: 0.01, asset: glmr, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/bifrostKusama.ts b/packages/config/src/configs/bifrostKusama.ts index 5eba20be..e43e799c 100644 --- a/packages/config/src/configs/bifrostKusama.ts +++ b/packages/config/src/configs/bifrostKusama.ts @@ -18,6 +18,7 @@ export const bifrostKusamaConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: bnc, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -28,6 +29,7 @@ export const bifrostKusamaConfig = new ChainConfig({ destinationFee: { amount: 0.0001, asset: movr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/bifrostPolkadot.ts b/packages/config/src/configs/bifrostPolkadot.ts index 86f08f54..6db00afb 100644 --- a/packages/config/src/configs/bifrostPolkadot.ts +++ b/packages/config/src/configs/bifrostPolkadot.ts @@ -18,6 +18,7 @@ export const bifrostPolkadotConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: bnc, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -28,6 +29,7 @@ export const bifrostPolkadotConfig = new ChainConfig({ destinationFee: { amount: 0.01, asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/calamari.ts b/packages/config/src/configs/calamari.ts index 7c3c64b6..aee2b28c 100644 --- a/packages/config/src/configs/calamari.ts +++ b/packages/config/src/configs/calamari.ts @@ -18,6 +18,7 @@ export const calamariConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: kma, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -28,6 +29,7 @@ export const calamariConfig = new ChainConfig({ destinationFee: { amount: 0.0001, asset: movr, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/centrifuge.ts b/packages/config/src/configs/centrifuge.ts index 7e0066f9..86b89f36 100644 --- a/packages/config/src/configs/centrifuge.ts +++ b/packages/config/src/configs/centrifuge.ts @@ -17,6 +17,7 @@ export const centrifugeConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: cfg, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), diff --git a/packages/config/src/configs/crustShadow.ts b/packages/config/src/configs/crustShadow.ts index f0879501..1ce592f6 100644 --- a/packages/config/src/configs/crustShadow.ts +++ b/packages/config/src/configs/crustShadow.ts @@ -17,6 +17,7 @@ export const crustShadowConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: csm, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() @@ -30,6 +31,7 @@ export const crustShadowConfig = new ChainConfig({ destinationFee: { amount: 0.0001, asset: movr, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/darwinia.ts b/packages/config/src/configs/darwinia.ts index bcd0462e..84e2bfff 100644 --- a/packages/config/src/configs/darwinia.ts +++ b/packages/config/src/configs/darwinia.ts @@ -17,6 +17,7 @@ export const darwiniaConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: ring, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/darwiniaCrab.ts b/packages/config/src/configs/darwiniaCrab.ts index 8661e058..70ba3c40 100644 --- a/packages/config/src/configs/darwiniaCrab.ts +++ b/packages/config/src/configs/darwiniaCrab.ts @@ -17,6 +17,7 @@ export const darwiniaCrabConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: crab, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/darwiniaPangoro.ts b/packages/config/src/configs/darwiniaPangoro.ts index 616ec667..3b488844 100644 --- a/packages/config/src/configs/darwiniaPangoro.ts +++ b/packages/config/src/configs/darwiniaPangoro.ts @@ -17,6 +17,7 @@ export const darwiniaPangoroConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: paring, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/equilibrium.ts b/packages/config/src/configs/equilibrium.ts index bd7434b3..6486a540 100644 --- a/packages/config/src/configs/equilibrium.ts +++ b/packages/config/src/configs/equilibrium.ts @@ -17,6 +17,7 @@ export const equilibriumConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: eq, + balance: BalanceBuilder().substrate().system().accountEquilibrium(), }, extrinsic: ExtrinsicBuilder().eqBalances().transferXcm(), }), @@ -27,6 +28,7 @@ export const equilibriumConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: eq, + balance: BalanceBuilder().substrate().system().accountEquilibrium(), }, extrinsic: ExtrinsicBuilder().eqBalances().transferXcm(), fee: { @@ -41,6 +43,7 @@ export const equilibriumConfig = new ChainConfig({ destinationFee: { amount: 0.01, asset: glmr, + balance: BalanceBuilder().substrate().system().accountEquilibrium(), }, extrinsic: ExtrinsicBuilder().eqBalances().transferXcm(), fee: { diff --git a/packages/config/src/configs/equilibriumAlphanet.ts b/packages/config/src/configs/equilibriumAlphanet.ts index bfa80180..bc453de0 100644 --- a/packages/config/src/configs/equilibriumAlphanet.ts +++ b/packages/config/src/configs/equilibriumAlphanet.ts @@ -17,6 +17,7 @@ export const equilibriumAlphanetConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: eq, + balance: BalanceBuilder().substrate().system().accountEquilibrium(), }, extrinsic: ExtrinsicBuilder().eqBalances().transferXcm(), }), @@ -27,6 +28,7 @@ export const equilibriumAlphanetConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: eq, + balance: BalanceBuilder().substrate().system().accountEquilibrium(), }, extrinsic: ExtrinsicBuilder().eqBalances().transferXcm(), fee: { @@ -41,6 +43,7 @@ export const equilibriumAlphanetConfig = new ChainConfig({ destinationFee: { amount: 0.00005, asset: dev, + balance: BalanceBuilder().substrate().system().accountEquilibrium(), }, extrinsic: ExtrinsicBuilder().eqBalances().transferXcm(), fee: { diff --git a/packages/config/src/configs/hydraDX.ts b/packages/config/src/configs/hydraDX.ts index 9cba6f9d..de5583f6 100644 --- a/packages/config/src/configs/hydraDX.ts +++ b/packages/config/src/configs/hydraDX.ts @@ -17,6 +17,7 @@ export const hydraDxConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: hdx, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -27,6 +28,7 @@ export const hydraDxConfig = new ChainConfig({ destinationFee: { amount: 0.01, asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -37,6 +39,7 @@ export const hydraDxConfig = new ChainConfig({ destinationFee: { amount: 0.04, asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), fee: { @@ -51,6 +54,7 @@ export const hydraDxConfig = new ChainConfig({ destinationFee: { amount: 0.04, asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), fee: { @@ -65,6 +69,7 @@ export const hydraDxConfig = new ChainConfig({ destinationFee: { amount: 0.04, asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), fee: { @@ -79,6 +84,7 @@ export const hydraDxConfig = new ChainConfig({ destinationFee: { amount: 0.04, asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), fee: { diff --git a/packages/config/src/configs/integritee.ts b/packages/config/src/configs/integritee.ts index b32f2f50..28739e8e 100644 --- a/packages/config/src/configs/integritee.ts +++ b/packages/config/src/configs/integritee.ts @@ -17,6 +17,7 @@ export const integriteeConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: teer, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), diff --git a/packages/config/src/configs/interlay.ts b/packages/config/src/configs/interlay.ts index 6290fd0d..6fb73b9c 100644 --- a/packages/config/src/configs/interlay.ts +++ b/packages/config/src/configs/interlay.ts @@ -17,6 +17,7 @@ export const interlayConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: intr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -27,6 +28,7 @@ export const interlayConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: intr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), fee: { diff --git a/packages/config/src/configs/karura.ts b/packages/config/src/configs/karura.ts index 2fe71baf..8f7302ff 100644 --- a/packages/config/src/configs/karura.ts +++ b/packages/config/src/configs/karura.ts @@ -18,6 +18,7 @@ export const karuraConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: kar, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -28,6 +29,7 @@ export const karuraConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: aseed, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { @@ -43,6 +45,7 @@ export const karuraConfig = new ChainConfig({ destinationFee: { amount: 0.0001, asset: movr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/khala.ts b/packages/config/src/configs/khala.ts index e8faaf0c..e56ec5ca 100644 --- a/packages/config/src/configs/khala.ts +++ b/packages/config/src/configs/khala.ts @@ -17,6 +17,7 @@ export const khalaConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: pha, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTransfer().transfer().here(), }), @@ -27,6 +28,7 @@ export const khalaConfig = new ChainConfig({ destinationFee: { amount: 0.0001, asset: movr, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder().xTransfer().transfer().X2(), fee: { diff --git a/packages/config/src/configs/kintsugi.ts b/packages/config/src/configs/kintsugi.ts index 1cd13c18..99c03ce6 100644 --- a/packages/config/src/configs/kintsugi.ts +++ b/packages/config/src/configs/kintsugi.ts @@ -17,6 +17,7 @@ export const kintsugiConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: kint, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -27,6 +28,7 @@ export const kintsugiConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: kint, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), fee: { diff --git a/packages/config/src/configs/kusama.ts b/packages/config/src/configs/kusama.ts index 96aa3810..00b7dd24 100644 --- a/packages/config/src/configs/kusama.ts +++ b/packages/config/src/configs/kusama.ts @@ -17,6 +17,7 @@ export const kusamaConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: ksm, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .xcmPallet() diff --git a/packages/config/src/configs/kusamaAssetHub.ts b/packages/config/src/configs/kusamaAssetHub.ts index 91fe004a..f7c9ea99 100644 --- a/packages/config/src/configs/kusamaAssetHub.ts +++ b/packages/config/src/configs/kusamaAssetHub.ts @@ -18,6 +18,7 @@ export const kusamaAssetHubConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: rmrk, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() @@ -36,6 +37,7 @@ export const kusamaAssetHubConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: usdt, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/litentryAlphanet.ts b/packages/config/src/configs/litentryAlphanet.ts index 4fdb75ff..9d76b5a0 100644 --- a/packages/config/src/configs/litentryAlphanet.ts +++ b/packages/config/src/configs/litentryAlphanet.ts @@ -17,6 +17,7 @@ export const litentryAlphanetConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: lit, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), diff --git a/packages/config/src/configs/litmus.ts b/packages/config/src/configs/litmus.ts index 6e1c0af6..441cadba 100644 --- a/packages/config/src/configs/litmus.ts +++ b/packages/config/src/configs/litmus.ts @@ -17,6 +17,7 @@ export const litmusConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: lit, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), diff --git a/packages/config/src/configs/mangataKusama.ts b/packages/config/src/configs/mangataKusama.ts index e91aab33..7b075cc2 100644 --- a/packages/config/src/configs/mangataKusama.ts +++ b/packages/config/src/configs/mangataKusama.ts @@ -17,6 +17,7 @@ export const mangataKusamaConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: mgx, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), @@ -27,6 +28,7 @@ export const mangataKusamaConfig = new ChainConfig({ destinationFee: { amount: 0.000008, asset: movr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/moonbaseAlpha.ts b/packages/config/src/configs/moonbaseAlpha.ts index 19de182d..5290d863 100644 --- a/packages/config/src/configs/moonbaseAlpha.ts +++ b/packages/config/src/configs/moonbaseAlpha.ts @@ -37,6 +37,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 4, asset: dev, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -47,6 +48,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 0.00001, asset: dev, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -57,6 +59,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 0.0002, asset: dev, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -67,6 +70,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 0.0002, asset: dev, + balance: BalanceBuilder().substrate().system().account(), }, fee: { asset: dev, @@ -96,6 +100,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 14, asset: eq, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: dev, @@ -110,6 +115,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 4, asset: eqd, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: dev, @@ -124,6 +130,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 0.032, asset: lit, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: dev, @@ -138,6 +145,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 0.02, asset: nodl, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: dev, @@ -152,6 +160,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 4, asset: paring, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: dev, @@ -166,6 +175,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 0.4, asset: soon, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: dev, @@ -180,6 +190,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 5, asset: tt1, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: dev, @@ -194,6 +205,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 0.2, asset: tur, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: dev, @@ -208,6 +220,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ destinationFee: { amount: 0.0506, asset: unit, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: dev, diff --git a/packages/config/src/configs/moonbaseBeta.ts b/packages/config/src/configs/moonbaseBeta.ts index 3d4582f7..1900a417 100644 --- a/packages/config/src/configs/moonbaseBeta.ts +++ b/packages/config/src/configs/moonbaseBeta.ts @@ -16,6 +16,7 @@ export const moonbaseBetaConfig = new ChainConfig({ destinationFee: { amount: 0.0002, asset: dev, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { @@ -30,6 +31,7 @@ export const moonbaseBetaConfig = new ChainConfig({ destinationFee: { amount: 0.0002, asset: dev, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), fee: { diff --git a/packages/config/src/configs/moonbeam.ts b/packages/config/src/configs/moonbeam.ts index bdb6510c..fbc711d9 100644 --- a/packages/config/src/configs/moonbeam.ts +++ b/packages/config/src/configs/moonbeam.ts @@ -51,6 +51,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.01, asset: glmr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -61,6 +62,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.0002, asset: glmr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -71,6 +73,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.000001, asset: glmr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -81,6 +84,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.5, asset: glmr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -91,6 +95,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.05, asset: glmr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -101,6 +106,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.000000032, asset: glmr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -111,6 +117,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.0002, asset: glmr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -121,6 +128,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.032, asset: aca, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -135,6 +143,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.032, asset: astr, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -149,6 +158,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.256, asset: aseed, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -163,6 +173,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.256, asset: bnc, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -177,6 +188,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.01, asset: cfg, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -191,6 +203,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.052, asset: dot, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -205,6 +218,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 400, asset: eq, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -219,6 +233,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.15, asset: eqd, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -233,6 +248,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.0002476, asset: ibtc, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -247,6 +263,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.748, asset: intr, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -261,6 +278,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.02, asset: nodl, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -275,6 +293,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.064, asset: para, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -289,6 +308,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.32, asset: pha, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -303,6 +323,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 4, asset: ring, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -317,6 +338,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.7, asset: usdt, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -331,6 +353,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.6, asset: hdx, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: glmr, @@ -345,6 +368,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.004, asset: dai, + balance: BalanceBuilder().evm().erc20(), }, fee: { asset: glmr, @@ -359,6 +383,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.004, asset: usdc, + balance: BalanceBuilder().evm().erc20(), }, fee: { asset: glmr, @@ -373,6 +398,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.0000001, asset: wbtc, + balance: BalanceBuilder().evm().erc20(), }, fee: { asset: glmr, @@ -387,6 +413,7 @@ export const moonbeamConfig = new ChainConfig({ destinationFee: { amount: 0.000002, asset: weth, + balance: BalanceBuilder().evm().erc20(), }, fee: { asset: glmr, diff --git a/packages/config/src/configs/moonriver.ts b/packages/config/src/configs/moonriver.ts index e77b87e1..0b68303f 100644 --- a/packages/config/src/configs/moonriver.ts +++ b/packages/config/src/configs/moonriver.ts @@ -53,6 +53,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.0008544, asset: movr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -63,6 +64,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.001, asset: movr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -73,6 +75,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.0002, asset: movr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -83,6 +86,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.001, asset: movr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -93,6 +97,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.0002, asset: movr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -103,6 +108,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.002, asset: movr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -113,6 +119,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.00000000192, asset: movr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -123,6 +130,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.0002, asset: movr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -133,6 +141,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.004, asset: movr, + balance: BalanceBuilder().substrate().system().account(), }, }), new AssetConfig({ @@ -143,6 +152,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.256, asset: aseed, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -157,6 +167,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.0256, asset: bnc, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -171,6 +182,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 4, asset: crab, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -185,6 +197,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.004, asset: csm, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -199,6 +212,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.0192, asset: hko, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -213,6 +227,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.032, asset: kar, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -227,6 +242,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.00000428, asset: kbtc, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -241,6 +257,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.00084, asset: kint, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -255,6 +272,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.000004, asset: kma, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -269,6 +287,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.00168, asset: ksm, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -283,6 +302,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.0032, asset: lit, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -297,6 +317,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 5.5, asset: mgx, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -311,6 +332,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.32, asset: pha, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -325,6 +347,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.0000504, asset: rmrk, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -339,6 +362,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.032, asset: sdn, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -353,6 +377,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.004, asset: teer, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -367,6 +392,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.2, asset: tur, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -381,6 +407,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.00504, asset: usdt, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, @@ -395,6 +422,7 @@ export const moonriverConfig = new ChainConfig({ destinationFee: { amount: 0.000032, asset: xrt, + balance: BalanceBuilder().substrate().assets().account(), }, fee: { asset: movr, diff --git a/packages/config/src/configs/nodle.ts b/packages/config/src/configs/nodle.ts index 37157299..de532b5d 100644 --- a/packages/config/src/configs/nodle.ts +++ b/packages/config/src/configs/nodle.ts @@ -17,6 +17,7 @@ export const nodleConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: nodl, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), diff --git a/packages/config/src/configs/nodleEden.ts b/packages/config/src/configs/nodleEden.ts index 7e1afed4..a803187b 100644 --- a/packages/config/src/configs/nodleEden.ts +++ b/packages/config/src/configs/nodleEden.ts @@ -17,6 +17,7 @@ export const nodleEdenConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: nodl, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), diff --git a/packages/config/src/configs/parallel.ts b/packages/config/src/configs/parallel.ts index 75da5f5e..50320dac 100644 --- a/packages/config/src/configs/parallel.ts +++ b/packages/config/src/configs/parallel.ts @@ -17,6 +17,7 @@ export const parallelConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: para, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .xTokens() @@ -30,6 +31,7 @@ export const parallelConfig = new ChainConfig({ destinationFee: { amount: 0.01, asset: glmr, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/parallelHeiko.ts b/packages/config/src/configs/parallelHeiko.ts index b27217df..135fd72e 100644 --- a/packages/config/src/configs/parallelHeiko.ts +++ b/packages/config/src/configs/parallelHeiko.ts @@ -17,6 +17,7 @@ export const parallelHeikoConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: hko, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .xTokens() @@ -30,6 +31,7 @@ export const parallelHeikoConfig = new ChainConfig({ destinationFee: { amount: 0.0001, asset: movr, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/phala.ts b/packages/config/src/configs/phala.ts index b7a32495..62310462 100644 --- a/packages/config/src/configs/phala.ts +++ b/packages/config/src/configs/phala.ts @@ -17,6 +17,7 @@ export const phalaConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: pha, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder().xTransfer().transfer().here(), }), @@ -27,6 +28,7 @@ export const phalaConfig = new ChainConfig({ destinationFee: { amount: 0.01, asset: glmr, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder().xTransfer().transfer().X2(), fee: { diff --git a/packages/config/src/configs/polkadot.ts b/packages/config/src/configs/polkadot.ts index f423054b..17774553 100644 --- a/packages/config/src/configs/polkadot.ts +++ b/packages/config/src/configs/polkadot.ts @@ -17,6 +17,7 @@ export const polkadotConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: dot, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .xcmPallet() diff --git a/packages/config/src/configs/polkadotAssetHub.ts b/packages/config/src/configs/polkadotAssetHub.ts index bef24957..bb459261 100644 --- a/packages/config/src/configs/polkadotAssetHub.ts +++ b/packages/config/src/configs/polkadotAssetHub.ts @@ -18,6 +18,7 @@ export const polkadotAssetHubConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: usdt, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/robonomics.ts b/packages/config/src/configs/robonomics.ts index 70b79d52..7cb942b1 100644 --- a/packages/config/src/configs/robonomics.ts +++ b/packages/config/src/configs/robonomics.ts @@ -17,6 +17,7 @@ export const robonomicsConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: xrt, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/shiden.ts b/packages/config/src/configs/shiden.ts index 64749ffb..967f592a 100644 --- a/packages/config/src/configs/shiden.ts +++ b/packages/config/src/configs/shiden.ts @@ -17,6 +17,7 @@ export const shidenConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: sdn, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() @@ -30,6 +31,7 @@ export const shidenConfig = new ChainConfig({ destinationFee: { amount: 0.0001, asset: movr, + balance: BalanceBuilder().substrate().assets().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/subsocialAlphanet.ts b/packages/config/src/configs/subsocialAlphanet.ts index 5d709601..84de6e89 100644 --- a/packages/config/src/configs/subsocialAlphanet.ts +++ b/packages/config/src/configs/subsocialAlphanet.ts @@ -17,6 +17,7 @@ export const subsocialAlphanetConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: soon, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .polkadotXcm() diff --git a/packages/config/src/configs/turing.ts b/packages/config/src/configs/turing.ts index 9d698b32..71c8806a 100644 --- a/packages/config/src/configs/turing.ts +++ b/packages/config/src/configs/turing.ts @@ -17,6 +17,7 @@ export const turingConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: tur, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .xTokens() @@ -30,6 +31,7 @@ export const turingConfig = new ChainConfig({ destinationFee: { amount: 0.00001, asset: movr, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/turingAlphanet.ts b/packages/config/src/configs/turingAlphanet.ts index ce3433ff..40994519 100644 --- a/packages/config/src/configs/turingAlphanet.ts +++ b/packages/config/src/configs/turingAlphanet.ts @@ -17,6 +17,7 @@ export const turingAlphanetConfig = new ChainConfig({ destinationFee: { amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), asset: tur, + balance: BalanceBuilder().substrate().system().account(), }, extrinsic: ExtrinsicBuilder() .xTokens() @@ -30,6 +31,7 @@ export const turingAlphanetConfig = new ChainConfig({ destinationFee: { amount: 0.04, asset: dev, + balance: BalanceBuilder().substrate().tokens().accounts(), }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { diff --git a/packages/config/src/configs/uniqueAlpha.ts b/packages/config/src/configs/uniqueAlpha.ts index 40e40ef0..322a9266 100644 --- a/packages/config/src/configs/uniqueAlpha.ts +++ b/packages/config/src/configs/uniqueAlpha.ts @@ -11,6 +11,7 @@ export const uniqueAlphaConfig = new ChainConfig({ // destinationFee: { // amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), // asset: auq, + // balance: BalanceBuilder().substrate().assets().account(), // }, // extrinsic: ExtrinsicBuilder().xTokens().transfer(), // }), diff --git a/packages/config/src/types/AssetConfig.ts b/packages/config/src/types/AssetConfig.ts index 489e436a..ed4e1cf8 100644 --- a/packages/config/src/types/AssetConfig.ts +++ b/packages/config/src/types/AssetConfig.ts @@ -18,8 +18,7 @@ export interface AssetConfigConstructorParams { min?: AssetMinConfigBuilder; } -export interface DestinationFeeConfig { - asset: Asset; +export interface DestinationFeeConfig extends FeeAssetConfig { amount: number | FeeConfigBuilder; } diff --git a/packages/sdk/src/getTransferData/getSourceData.ts b/packages/sdk/src/getTransferData/getSourceData.ts index 96ec2ee9..60298f19 100644 --- a/packages/sdk/src/getTransferData/getSourceData.ts +++ b/packages/sdk/src/getTransferData/getSourceData.ts @@ -4,7 +4,7 @@ import { ExtrinsicConfig, SubstrateQueryConfig, } from '@moonbeam-network/xcm-builder'; -import { AssetConfig, TransferConfig } from '@moonbeam-network/xcm-config'; +import { FeeAssetConfig, TransferConfig } from '@moonbeam-network/xcm-config'; import { AssetAmount } from '@moonbeam-network/xcm-types'; import { convertDecimals } from '@moonbeam-network/xcm-utils'; import Big from 'big.js'; @@ -57,6 +57,18 @@ export async function getSourceData({ }), }) : zeroAmount; + const zeroDestinationFeeAmount = config.destinationFee?.asset + ? AssetAmount.fromAsset(config.destinationFee.asset, { + amount: 0n, + decimals: await getDecimals({ + address: destinationAddress, + asset: config.destinationFee.asset, + config, + ethersSigner, + polkadot, + }), + }) + : zeroAmount; const balance = await getBalance({ address: sourceAddress, @@ -64,12 +76,25 @@ export async function getSourceData({ ethersSigner, polkadot, }); + const feeBalance = await getFeeBalances({ address: sourceAddress, balance, - config, + feeConfig: config.fee, polkadot, }); + + const destinationFeeBalance = config.asset.isEqual( + config.destinationFee.asset, + ) + ? balance + : await getFeeBalances({ + address: sourceAddress, + balance, + feeConfig: config.destinationFee, + polkadot, + }); + const min = await getMin(config, polkadot); const extrinsic = config.extrinsic?.build({ @@ -104,6 +129,9 @@ export async function getSourceData({ const { existentialDeposit } = polkadot; const feeAmount = zeroFeeAmount.copyWith({ amount: fee }); const feeBalanceAmount = zeroFeeAmount.copyWith({ amount: feeBalance }); + const destinationFeeBalanceAmount = zeroDestinationFeeAmount.copyWith({ + amount: destinationFeeBalance, + }); const minAmount = zeroAmount.copyWith({ amount: min }); const maxAmount = getMax({ balanceAmount, @@ -115,6 +143,7 @@ export async function getSourceData({ return { balance: balanceAmount, chain, + destinationFeeBalance: destinationFeeBalanceAmount, existentialDeposit, fee: feeAmount, feeBalance: feeBalanceAmount, @@ -126,21 +155,21 @@ export async function getSourceData({ export interface GetBalancesParams { address: string; balance: bigint; - config: AssetConfig; + feeConfig: FeeAssetConfig | undefined; polkadot: PolkadotService; } export async function getFeeBalances({ address, balance, - config, + feeConfig, polkadot, }: GetBalancesParams) { - return config.fee + return feeConfig ? polkadot.query( - config.fee.balance.build({ + feeConfig.balance.build({ address, - asset: polkadot.chain.getBalanceAssetId(config.fee.asset), + asset: polkadot.chain.getBalanceAssetId(feeConfig.asset), }) as SubstrateQueryConfig, ) : balance; diff --git a/packages/sdk/src/sdk.interfaces.ts b/packages/sdk/src/sdk.interfaces.ts index 10edd623..82927000 100644 --- a/packages/sdk/src/sdk.interfaces.ts +++ b/packages/sdk/src/sdk.interfaces.ts @@ -20,6 +20,7 @@ export interface TransferData { } export interface SourceChainTransferData extends ChainTransferData { + destinationFeeBalance: AssetAmount; feeBalance: AssetAmount; max: AssetAmount; }