diff --git a/package.json b/package.json index b2aa81c..2e0f74e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.20.38", + "version": "0.20.39", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/Unit/Exchange/index.ts b/src/Unit/Exchange/index.ts index 23e71da..284ddef 100644 --- a/src/Unit/Exchange/index.ts +++ b/src/Unit/Exchange/index.ts @@ -1,8 +1,12 @@ import type Unit from '../index.js'; import deposit, { type DepositParams } from './deposit.js'; import getSwapInfo, { type GetSwapInfoParams } from './getSwapInfo.js'; -import {generateSwapCalldataWithUnit, type GenerateSwapCalldataWithUnitParams } from './generateSwapCalldata.js'; +import { generateSwapCalldataWithUnit, type GenerateSwapCalldataWithUnitParams } from './generateSwapCalldata.js'; import withdraw, { type WithdrawParams } from './withdraw.js'; +import type { SwapLimitParams } from './swapLimit.js'; +import swapLimit from './swapLimit.js'; +import swapMarket from './swapMarket.js'; +import type { SwapMarketParams } from './swapMarket.js'; type PureDepositParams = Omit type PureWithdrawParams = Omit @@ -44,4 +48,12 @@ export default class Exchange { unit: this.unit }) } + + public swapLimit(params: SwapLimitParams) { + return swapLimit(params); + } + + public swapMarket(params: SwapMarketParams) { + return swapMarket(params); + } } diff --git a/src/Unit/Exchange/swapLimit.ts b/src/Unit/Exchange/swapLimit.ts index d69a9e0..8ea85c2 100644 --- a/src/Unit/Exchange/swapLimit.ts +++ b/src/Unit/Exchange/swapLimit.ts @@ -334,7 +334,7 @@ export default async function swapLimit({ options?.logger?.(`Transaction sent. Tx hash: ${swapThroughOrionPoolTxResponse.hash}`); return { amountOut: swapInfo.amountOut, - wait: swapThroughOrionPoolTxResponse.wait, + wait: swapThroughOrionPoolTxResponse.wait.bind(swapThroughOrionPoolTxResponse), through: 'pool', txHash: swapThroughOrionPoolTxResponse.hash, }; diff --git a/src/Unit/Exchange/swapMarket.ts b/src/Unit/Exchange/swapMarket.ts index 0557e56..afcbaf0 100644 --- a/src/Unit/Exchange/swapMarket.ts +++ b/src/Unit/Exchange/swapMarket.ts @@ -45,7 +45,7 @@ export default async function swapMarket({ options, }: SwapMarketParams): Promise { if (options?.developer) options.logger?.('YOU SPECIFIED A DEVELOPER OPTIONS. BE CAREFUL!'); - + if (amount === '') throw new Error('Amount can not be empty'); if (assetIn === '') throw new Error('AssetIn can not be empty'); if (assetOut === '') throw new Error('AssetOut can not be empty'); @@ -285,7 +285,7 @@ export default async function swapMarket({ options?.logger?.(`Transaction sent. Tx hash: ${swapThroughOrionPoolTxResponse.hash}`); return { amountOut: swapInfo.amountOut, - wait: swapThroughOrionPoolTxResponse.wait, + wait: swapThroughOrionPoolTxResponse.wait.bind(swapThroughOrionPoolTxResponse), through: 'pool', txHash: swapThroughOrionPoolTxResponse.hash, };