From 7103bb0cacf9e448968cd9aafd0e512b82fa348b Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:21:52 +0100 Subject: [PATCH] revert change for getting decimals in destination fees, due to an error (#157) * revert change for getting decimals in destination fees, due to an error * add changeset --- .changeset/quiet-hotels-exist.md | 6 ++++++ packages/config/src/chains.ts | 2 +- packages/config/src/configs/bifrostPolkadot.ts | 8 ++++---- .../sdk/src/getTransferData/getDestinationData.ts | 11 ++--------- 4 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 .changeset/quiet-hotels-exist.md diff --git a/.changeset/quiet-hotels-exist.md b/.changeset/quiet-hotels-exist.md new file mode 100644 index 00000000..c7bde967 --- /dev/null +++ b/.changeset/quiet-hotels-exist.md @@ -0,0 +1,6 @@ +--- +'@moonbeam-network/xcm-config': patch +'@moonbeam-network/xcm-sdk': patch +--- + +Revert decimals change in destination fee diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 9384ed9a..b60b4192 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -182,7 +182,7 @@ export const bifrostKusama = new Parachain({ name: 'Bifrost', parachainId: 2001, ss58Format: 6, - ws: 'wss://bifrost-rpc.liebi.com/ws', + ws: 'wss://us.bifrost-rpc.liebi.com/ws', }); export const bifrostPolkadot = new Parachain({ diff --git a/packages/config/src/configs/bifrostPolkadot.ts b/packages/config/src/configs/bifrostPolkadot.ts index f6d24020..f7542e73 100644 --- a/packages/config/src/configs/bifrostPolkadot.ts +++ b/packages/config/src/configs/bifrostPolkadot.ts @@ -59,11 +59,11 @@ export const bifrostPolkadotConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.01, - asset: vdot, - balance: BalanceBuilder().substrate().tokens().accounts(), + amount: 0.2, + asset: bnc, + balance: BalanceBuilder().substrate().system().account(), }, - extrinsic: ExtrinsicBuilder().xTokens().transfer(), + extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), fee: { asset: bnc, balance: BalanceBuilder().substrate().system().account(), diff --git a/packages/sdk/src/getTransferData/getDestinationData.ts b/packages/sdk/src/getTransferData/getDestinationData.ts index ed56e1cc..d6e51256 100644 --- a/packages/sdk/src/getTransferData/getDestinationData.ts +++ b/packages/sdk/src/getTransferData/getDestinationData.ts @@ -71,19 +71,12 @@ export interface GetFeeParams { } export async function getFee({ - address, config, - evmSigner, polkadot, }: GetFeeParams): Promise { const { amount, asset } = config.source.config.destinationFee; - const decimals = await getDecimals({ - address, - asset, - config: config.destination.config, - evmSigner, - polkadot, - }); + // TODO we have to consider correctly here when an asset is ERC20 to get it from contract + const decimals = await polkadot.getAssetDecimals(asset); const zeroAmount = AssetAmount.fromAsset(asset, { amount: 0n, decimals,