Skip to content

Commit 95e52db

Browse files
committed
Fixed typecheck errors
1 parent ba9d1ba commit 95e52db

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

packages/sdk/src/getTransferData/getDestinationData.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,26 @@ export async function getFee({
5555
polkadot,
5656
}: GetFeeParams): Promise<AssetAmount> {
5757
// TODO: we have to consider correctly here when an asset is ERC20 to get it from contract
58-
const { amount, asset } = transferConfig.source.config.destinationFee;
59-
const chainAsset = transferConfig.destination.chain.getChainAsset(asset);
58+
const { amount } = transferConfig.source.config.destinationFee;
59+
const asset = AssetAmount.fromChainAsset(
60+
transferConfig.destination.chain.getChainAsset(
61+
transferConfig.source.config.destinationFee.asset,
62+
),
63+
{ amount: 0n },
64+
);
6065

6166
if (Number.isFinite(amount)) {
62-
return chainAsset.toAssetAmount({
67+
return asset.copyWith({
6368
amount: amount as number,
6469
});
6570
}
6671

6772
const cfg = (amount as FeeConfigBuilder).build({
6873
api: polkadot.api,
69-
asset: chainAsset.getAssetId(),
74+
asset: asset.getAssetId(),
7075
});
7176

72-
return chainAsset.toAssetAmount({
77+
return asset.copyWith({
7378
amount: await cfg.call(),
7479
});
7580
}

0 commit comments

Comments
 (0)