make PlatformFees fields optional. temporary solution

This commit is contained in:
TheJuze
2023-09-29 17:01:22 +03:00
parent 020b153597
commit bed0aac578
5 changed files with 16 additions and 10 deletions

View File

@@ -12,3 +12,4 @@ export * from './gasLimits.js';
export * from './timings.js';
export const SERVICE_TOKEN = 'ORN';
export const INITIAL_VEORN_ADJUSTMENT_FACTOR = 5;

View File

@@ -61,8 +61,8 @@ type AtomicSwapHistoryTargetQuery = AtomicSwapHistoryBaseQuery & {
}
type PlatformFees = {
assetIn: string
assetOut: string
assetIn?: string // TODO: return types from main branch
assetOut?: string
walletAddress?: string | undefined
fromWidget?: string | undefined
}
@@ -247,8 +247,13 @@ class BlockchainService {
) => {
const url = new URL(`${this.apiUrl}/api/platform-fees`);
url.searchParams.append('assetIn', assetIn);
url.searchParams.append('assetOut', assetOut);
if (assetIn !== undefined) { // TODO: make same as in main branch
url.searchParams.append('assetIn', assetIn);
}
if (assetOut !== undefined) {
url.searchParams.append('assetOut', assetOut);
}
if (walletAddress !== undefined) {
url.searchParams.append('walletAddress', walletAddress);

View File

@@ -9,7 +9,7 @@ import {
} from './schemas/index.js';
import { fetchWithValidation } from 'simple-typed-fetch';
import { BigNumber } from 'bignumber.js';
import { DAY, LOCK_START_TIME, YEAR } from '../../constants/index.js';
import { DAY, INITIAL_VEORN_ADJUSTMENT_FACTOR, LOCK_START_TIME, YEAR } from '../../constants/index.js';
type BasePayload = {
chainId: number
@@ -109,7 +109,7 @@ class IntegratorService {
})
}
getAmountAtCurrent = (amount: number) => {
getAmountAtCurrent = async (amount: number) => {
const timestamp = Date.now() / 1000;
// sqrt
@@ -191,7 +191,7 @@ class IntegratorService {
}
// sqrt
return BigNumber(amountToken).multipliedBy(BigNumber(deltaDays).sqrt()).dividedBy(5);
return BigNumber(amountToken).multipliedBy(BigNumber(deltaDays).sqrt()).dividedBy(INITIAL_VEORN_ADJUSTMENT_FACTOR);
}
private readonly getVotingInfo = (userAddress: number) => {