Skip to content

Commit

Permalink
feat: add token in payment fee (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwer951123 committed Jan 17, 2024
1 parent d4b7030 commit c62b359
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@
"jest": "^28.1.1",
"typescript": "^4.7.4"
},
"stableVersion": "0.1.5-27"
"stableVersion": "0.1.5-28"
}
8 changes: 7 additions & 1 deletion src/base-chain-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ export abstract class BaseCrossChainAdapter {
...params,
amount: new FN("10000000000"),
});
const fromApi = this.api as AnyApi;
const paymentToken = fromApi.registry.chainTokens[0];
const decimals = fromApi.registry.chainDecimals[0];

return combineLatest({
minInput: minInput$,
Expand All @@ -116,7 +119,10 @@ export abstract class BaseCrossChainAdapter {
maxInput: maxInput.max(FN.ZERO),
ss58Prefix: chains[to].ss58Prefix,
destFee,
estimateFee,
estimateFee: {
token: paymentToken,
balance: FN.fromInner(estimateFee, decimals),
},
};
})
);
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export interface InputConfig {
maxInput: FixedPointNumber;
ss58Prefix: number;
destFee: TokenBalance;
estimateFee: string;
estimateFee: TokenBalance;
}

export interface RouterFilter {
Expand Down

0 comments on commit c62b359

Please sign in to comment.