Skip to content

Commit

Permalink
Return destinationFeeBalance amount for controlling balance (#127)
Browse files Browse the repository at this point in the history
* return destinationFeeBalance amount for controling balance

* remove hydraDXAlphanet config

* add changeset

* Update packages/sdk/src/getTransferData/getSourceData.ts

Co-authored-by: elmar <[email protected]>

* fix linter

---------

Co-authored-by: elmar <[email protected]>
  • Loading branch information
mmaurello and ekenigs authored Aug 28, 2023
1 parent 117958b commit 876c5eb
Show file tree
Hide file tree
Showing 46 changed files with 181 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .changeset/chilly-waves-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@moonbeam-network/xcm-config': minor
'@moonbeam-network/xcm-sdk': minor
---

Return destination fee balance object for controlling enough balance
3 changes: 3 additions & 0 deletions packages/config/src/configs/acala.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/alphanetAssetHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const alphanetAssetHubConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: tt1,
balance: BalanceBuilder().substrate().assets().account(),
},
extrinsic: ExtrinsicBuilder()
.polkadotXcm()
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/alphanetRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const alphanetRelayConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: unit,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilder()
.xcmPallet()
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/astar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const astarConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: astr,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilder()
.polkadotXcm()
Expand All @@ -30,6 +31,7 @@ export const astarConfig = new ChainConfig({
destinationFee: {
amount: 0.01,
asset: glmr,
balance: BalanceBuilder().substrate().assets().account(),
},
extrinsic: ExtrinsicBuilder()
.polkadotXcm()
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/bifrostKusama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/bifrostPolkadot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/calamari.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/centrifuge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/crustShadow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const crustShadowConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: csm,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilder()
.polkadotXcm()
Expand All @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/darwinia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const darwiniaConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: ring,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilder()
.polkadotXcm()
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/darwiniaCrab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const darwiniaCrabConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: crab,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilder()
.polkadotXcm()
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/darwiniaPangoro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const darwiniaPangoroConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: paring,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilder()
.polkadotXcm()
Expand Down
3 changes: 3 additions & 0 deletions packages/config/src/configs/equilibrium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down
3 changes: 3 additions & 0 deletions packages/config/src/configs/equilibriumAlphanet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down
6 changes: 6 additions & 0 deletions packages/config/src/configs/hydraDX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -27,6 +28,7 @@ export const hydraDxConfig = new ChainConfig({
destinationFee: {
amount: 0.01,
asset: glmr,
balance: BalanceBuilder().substrate().tokens().accounts(),
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
}),
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/integritee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/interlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand Down
3 changes: 3 additions & 0 deletions packages/config/src/configs/karura.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/khala.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/kintsugi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/kusama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const kusamaConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: ksm,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilder()
.xcmPallet()
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/kusamaAssetHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const kusamaAssetHubConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: rmrk,
balance: BalanceBuilder().substrate().assets().account(),
},
extrinsic: ExtrinsicBuilder()
.polkadotXcm()
Expand All @@ -36,6 +37,7 @@ export const kusamaAssetHubConfig = new ChainConfig({
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: usdt,
balance: BalanceBuilder().substrate().assets().account(),
},
extrinsic: ExtrinsicBuilder()
.polkadotXcm()
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/litentryAlphanet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/configs/litmus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/configs/mangataKusama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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: {
Expand Down
Loading

0 comments on commit 876c5eb

Please sign in to comment.