mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-17 00:31:34 +03:00
23 lines
595 B
TypeScript
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;
|