Skip to content

Commit

Permalink
feat: Export RelayerFeeDetails (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai authored Jan 11, 2023
1 parent 36209d4 commit 2f91546
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@across-protocol/sdk-v2",
"author": "UMA Team",
"version": "0.3.6",
"version": "0.3.7",
"license": "AGPL-3.0",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
23 changes: 22 additions & 1 deletion src/relayFeeCalculator/relayFeeCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ export interface RelayFeeCalculatorConfig {
queries: QueryInterface;
}

export interface RelayerFeeDetails {
amountToRelay: string;
tokenSymbol: string;
gasFeePercent: string;
gasFeeTotal: string;
gasDiscountPercent: number;
capitalFeePercent: string;
capitalFeeTotal: string;
capitalDiscountPercent: number;
relayFeePercent: string;
relayFeeTotal: string;
feeLimitPercent: number;
isAmountTooLow: boolean;
maxGasFeePercent: string;
minDeposit: string;
}

export interface LoggingFunction {
(data: { at: string; message: string; [key: string]: any }): void;
}
Expand Down Expand Up @@ -162,7 +179,11 @@ export class RelayFeeCalculator {

return defaultFee;
}
async relayerFeeDetails(amountToRelay: BigNumberish, tokenSymbol: string, tokenPrice?: number) {
async relayerFeeDetails(
amountToRelay: BigNumberish,
tokenSymbol: string,
tokenPrice?: number
): Promise<RelayerFeeDetails> {
const gasFeePercent = await this.gasFeePercent(amountToRelay, tokenSymbol, tokenPrice);
const gasFeeTotal = gasFeePercent.mul(amountToRelay).div(fixedPointAdjustment);
const capitalFeePercent = await this.capitalFeePercent(amountToRelay, tokenSymbol);
Expand Down

0 comments on commit 2f91546

Please sign in to comment.