mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-25 15:17:40 +03:00
@@ -61,7 +61,8 @@ export default async function getSwapMarketFeeInfo({
|
||||
assetIn,
|
||||
assetOut,
|
||||
amount.toString(),
|
||||
options?.poolOnly ? ['ORION_POOL'] : undefined,
|
||||
false,
|
||||
options?.poolOnly ? 'pools' : undefined,
|
||||
);
|
||||
|
||||
if (swapInfo.orderInfo !== null && options?.poolOnly === true && options.poolOnly !== swapInfo.isThroughPoolOptimal) {
|
||||
|
||||
@@ -22,6 +22,7 @@ export type SwapMarketParams = {
|
||||
orionUnit: OrionUnit,
|
||||
options?: {
|
||||
poolOnly?: boolean,
|
||||
instantSettlement?: boolean,
|
||||
logger?: (message: string) => void,
|
||||
autoApprove?: boolean,
|
||||
developer?: {
|
||||
@@ -124,6 +125,7 @@ export default async function swapMarket({
|
||||
assetIn,
|
||||
assetOut,
|
||||
amount.toString(),
|
||||
options?.instantSettlement,
|
||||
options?.poolOnly ? ['ORION_POOL'] : undefined,
|
||||
);
|
||||
|
||||
|
||||
@@ -151,7 +151,8 @@ class OrionAggregator {
|
||||
assetIn: string,
|
||||
assetOut: string,
|
||||
amount: string,
|
||||
exchanges?: Exchange[],
|
||||
instantSettlement?: boolean,
|
||||
exchanges?: Exchange[] | 'cex' | 'pools',
|
||||
) => {
|
||||
const url = new URL(`${this.apiUrl}/api/v1/swap`);
|
||||
url.searchParams.append('assetIn', assetIn);
|
||||
@@ -162,9 +163,16 @@ class OrionAggregator {
|
||||
url.searchParams.append('amountOut', amount);
|
||||
}
|
||||
if (exchanges) {
|
||||
exchanges.forEach((exchange) => {
|
||||
url.searchParams.append('exchanges', exchange);
|
||||
});
|
||||
if (Array.isArray(exchanges)) {
|
||||
exchanges.forEach((exchange) => {
|
||||
url.searchParams.append('exchanges', exchange);
|
||||
});
|
||||
} else {
|
||||
url.searchParams.append('exchanges', exchanges);
|
||||
}
|
||||
}
|
||||
if (instantSettlement) {
|
||||
url.searchParams.append('instantSettlement', 'true');
|
||||
}
|
||||
|
||||
return fetchWithValidation(
|
||||
|
||||
@@ -70,8 +70,9 @@ type SwapSubscriptionRequest = {
|
||||
i: string, // asset in
|
||||
o: string, // asset out
|
||||
a: number // amount IN/OUT
|
||||
es?: Exchange[], // exchange list
|
||||
es?: Exchange[] | 'cex' | 'pools', // exchange list of all cex or all pools (ORION_POOL, UNISWAP, PANCAKESWAP etc)
|
||||
e?: boolean; // is amount IN? Value `false` means a = amount OUT, `true` if omitted
|
||||
is?: boolean; // instant settlement
|
||||
}
|
||||
|
||||
type BrokerTradableAtomicSwapBalanceSubscription = {
|
||||
|
||||
Reference in New Issue
Block a user