feat: add platform fees endpoint

This commit is contained in:
Oleg Nechiporenko
2023-08-22 15:11:23 +02:00
parent 8f618b5854
commit de268b3de1
4 changed files with 38 additions and 4 deletions

View File

@@ -18,7 +18,8 @@ export type GetSwapInfoParams = {
options?: {
instantSettlement?: boolean
poolOnly?: boolean
}
},
walletAddress?: string,
}
export default async function getSwapInfo({
@@ -30,6 +31,7 @@ export default async function getSwapInfo({
blockchainService,
aggregator,
options,
walletAddress,
}: GetSwapInfoParams) {
if (amount === '') throw new Error('Amount can not be empty');
if (assetIn === '') throw new Error('AssetIn can not be empty');
@@ -45,7 +47,7 @@ export default async function getSwapInfo({
} = await simpleFetch(blockchainService.getInfo)();
const nativeCryptocurrencyName = getNativeCryptocurrencyName(assetToAddress);
const feeAssets = await simpleFetch(blockchainService.getTokensFee)();
const feeAssets = await simpleFetch(blockchainService.getPlatformFees)({ walletAddress, assetIn, assetOut });
const allPrices = await simpleFetch(blockchainService.getPricesWithQuoteAsset)();
const gasPriceWei = await simpleFetch(blockchainService.getGasPriceWei)();

View File

@@ -89,7 +89,7 @@ export default async function swapLimit({
const nativeCryptocurrency = getNativeCryptocurrencyName(assetToAddress);
const exchangeContract = Exchange__factory.connect(exchangeContractAddress, provider);
const feeAssets = await simpleFetch(blockchainService.getTokensFee)();
const feeAssets = await simpleFetch(blockchainService.getPlatformFees)({ walletAddress, assetIn, assetOut });
const allPrices = await simpleFetch(blockchainService.getPricesWithQuoteAsset)();
const gasPriceWei = await simpleFetch(blockchainService.getGasPriceWei)();
const { factories } = await simpleFetch(blockchainService.getPoolsConfig)();

View File

@@ -74,7 +74,7 @@ export default async function swapMarket({
const nativeCryptocurrency = getNativeCryptocurrencyName(assetToAddress);
const exchangeContract = Exchange__factory.connect(exchangeContractAddress, provider);
const feeAssets = await simpleFetch(blockchainService.getTokensFee)();
const feeAssets = await simpleFetch(blockchainService.getPlatformFees)({ walletAddress, assetIn, assetOut });
const allPrices = await simpleFetch(blockchainService.getPricesWithQuoteAsset)();
const gasPriceWei = await simpleFetch(blockchainService.getGasPriceWei)();
const { factories } = await simpleFetch(blockchainService.getPoolsConfig)();