Merge remote-tracking branch 'origin/main' into feat/ethers-v6

# Conflicts:
#	package-lock.json
#	package.json
This commit is contained in:
Mikhail Gladchenko
2023-10-02 15:46:31 +01:00
4 changed files with 20 additions and 19 deletions

View File

@@ -45,8 +45,8 @@ export default async function generateSwapCalldata({
const curveRegistryAddress = safeGet(unit.contracts, 'curveRegistry')
const { assetToAddress, swapExecutorContractAddress, exchangeContractAddress } = await simpleFetch(unit.blockchainService.getInfo)();
let path = SafeArray.from(path_).map((swapInfo) => {
swapInfo.assetIn = safeGet(assetToAddress, swapInfo.assetIn);
swapInfo.assetOut = safeGet(assetToAddress, swapInfo.assetOut);
swapInfo.assetIn = assetToAddress[swapInfo.assetIn] ?? swapInfo.assetIn.toLowerCase();
swapInfo.assetOut = assetToAddress[swapInfo.assetOut] ?? swapInfo.assetOut.toLowerCase();
return swapInfo;
})
const factory = path.first().factory

View File

@@ -59,6 +59,13 @@ type AtomicSwapHistoryTargetQuery = AtomicSwapHistoryBaseQuery & {
expiredRedeem?: 0 | 1
state?: 'REDEEMED' | 'BEFORE-REDEEM'
}
type PlatformFees = {
assetIn: string
assetOut: string
walletAddress?: string | undefined
fromWidget?: string | undefined
}
class BlockchainService {
private readonly apiUrl: string;
@@ -231,23 +238,17 @@ class BlockchainService {
{ headers: this.basicAuthHeaders }
);
getPlatformFees = (
{ assetIn, assetOut, walletAddress, fromWidget }: {
assetIn?: string | undefined,
assetOut?: string | undefined,
walletAddress?: string | undefined,
fromWidget?: string | undefined
}
getPlatformFees = ({
assetIn,
assetOut,
walletAddress,
fromWidget
}: PlatformFees
) => {
const url = new URL(`${this.apiUrl}/api/platform-fees`);
if (assetIn !== undefined) {
url.searchParams.append('assetIn', assetIn);
}
if (assetOut !== undefined) {
url.searchParams.append('assetOut', assetOut);
}
url.searchParams.append('assetIn', assetIn);
url.searchParams.append('assetOut', assetOut);
if (walletAddress !== undefined) {
url.searchParams.append('walletAddress', walletAddress);