File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
packages/sdk/src/getTransferData Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -55,21 +55,26 @@ export async function getFee({
55
55
polkadot,
56
56
} : GetFeeParams ) : Promise < AssetAmount > {
57
57
// 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
+ ) ;
60
65
61
66
if ( Number . isFinite ( amount ) ) {
62
- return chainAsset . toAssetAmount ( {
67
+ return asset . copyWith ( {
63
68
amount : amount as number ,
64
69
} ) ;
65
70
}
66
71
67
72
const cfg = ( amount as FeeConfigBuilder ) . build ( {
68
73
api : polkadot . api ,
69
- asset : chainAsset . getAssetId ( ) ,
74
+ asset : asset . getAssetId ( ) ,
70
75
} ) ;
71
76
72
- return chainAsset . toAssetAmount ( {
77
+ return asset . copyWith ( {
73
78
amount : await cfg . call ( ) ,
74
79
} ) ;
75
80
}
You can’t perform that action at this time.
0 commit comments