Files
orionprotocol-sdk/src/utils/calculateNetworkFeeInFeeAsset.ts
Aleksandr Kraiz f9605e3d1a Calculate fee
2023-08-01 21:27:17 +04:00

23 lines
595 B
TypeScript

import type { BigNumber } from 'bignumber.js';
import calculateNetworkFee from './calculateNetworkFee.js';
import convertPrice from './convertPrice.js';
const calculateNetworkFeeInFeeAsset = (
gasPriceGwei: BigNumber.Value,
gasLimit: BigNumber.Value,
baseCurrencyAddress: string,
feeAssetAddress: string,
prices: Partial<Record<string, string>>
) => {
const networkFee = calculateNetworkFee(gasPriceGwei, gasLimit);
return convertPrice(
networkFee,
baseCurrencyAddress, // from
feeAssetAddress, // to
prices
);
};
export default calculateNetworkFeeInFeeAsset;