Skip to content

Commit

Permalink
Fixed typecheck errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ekenigs committed Jul 2, 2024
1 parent ba9d1ba commit 95e52db
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/sdk/src/getTransferData/getDestinationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,26 @@ export async function getFee({
polkadot,
}: GetFeeParams): Promise<AssetAmount> {
// TODO: we have to consider correctly here when an asset is ERC20 to get it from contract
const { amount, asset } = transferConfig.source.config.destinationFee;
const chainAsset = transferConfig.destination.chain.getChainAsset(asset);
const { amount } = transferConfig.source.config.destinationFee;
const asset = AssetAmount.fromChainAsset(
transferConfig.destination.chain.getChainAsset(
transferConfig.source.config.destinationFee.asset,
),
{ amount: 0n },
);

if (Number.isFinite(amount)) {
return chainAsset.toAssetAmount({
return asset.copyWith({
amount: amount as number,
});
}

const cfg = (amount as FeeConfigBuilder).build({
api: polkadot.api,
asset: chainAsset.getAssetId(),
asset: asset.getAssetId(),
});

return chainAsset.toAssetAmount({
return asset.copyWith({
amount: await cfg.call(),
});
}

0 comments on commit 95e52db

Please sign in to comment.