move atomic fee method to blockchain service

This commit is contained in:
TheJuze
2024-06-17 15:47:02 +03:00
parent 5dce6e520d
commit ad6de65143
4 changed files with 16 additions and 15 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@orionprotocol/sdk",
"version": "0.23.0-rc3",
"version": "0.23.0-rc4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@orionprotocol/sdk",
"version": "0.23.0-rc3",
"version": "0.23.0-rc4",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.23.0-rc3",
"version": "0.23.0-rc4",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -71,7 +71,6 @@ class Aggregator {
this.getTradeProfits = this.getTradeProfits.bind(this);
this.getStableCoins = this.getStableCoins.bind(this);
this.placeAtomicSwap = this.placeAtomicSwap.bind(this);
this.getAtomicSwapFee = this.getAtomicSwapFee.bind(this);
this.placeOrder = this.placeOrder.bind(this);
this.placeLockOrder = this.placeLockOrder.bind(this);
this.cancelOrder = this.cancelOrder.bind(this);
@@ -445,17 +444,6 @@ class Aggregator {
errorSchema,
);
/**
* Get atomic swap fee in current chain
* @returns Fee in percents
*/
getAtomicSwapFee = () => fetchWithValidation(
`${this.apiUrl}/api/v1/atomic/swap-fee`,
z.string(),
{ headers: this.basicAuthHeaders },
errorSchema,
);
/**
* Get placed atomic swaps. Each atomic swap received from this list has a target chain corresponding to this Aggregator
* @param sender Sender address

View File

@@ -20,6 +20,7 @@ import { makePartial } from '../../utils';
import type { networkCodes } from '../../constants/index.js';
import { fetchWithValidation } from 'simple-typed-fetch';
import type { BasicAuthCredentials } from '../../types.js';
import errorSchema from '../Aggregator/schemas/errorSchema';
type IAdminAuthHeaders = {
auth: string
@@ -115,6 +116,7 @@ class BlockchainService {
this.claimOrder = this.claimOrder.bind(this);
this.getGasLimits = this.getGasLimits.bind(this);
this.getExchangeContractWalletBalance = this.getExchangeContractWalletBalance.bind(this);
this.getAtomicSwapFee = this.getAtomicSwapFee.bind(this);
}
get basicAuthHeaders() {
@@ -491,6 +493,17 @@ class BlockchainService {
},
);
/**
* Get atomic swap fee in current chain
* @returns Fee in percents
*/
getAtomicSwapFee = () => fetchWithValidation(
`${this.apiUrl}/api/v1/atomic/swap-fee`,
z.string(),
{ headers: this.basicAuthHeaders },
errorSchema,
);
getGasLimits = () => fetchWithValidation(
`${this.apiUrl}/api/baseLimits`,
z.record(z.number()),