@xchainjs/xchain-thorchain-query 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { Asset } from '@xchainjs/xchain-util';
2
2
  import { CryptoAmount } from './crypto-amount';
3
3
  import { ThorchainCache } from './thorchain-cache';
4
- import { AddliquidityPosition, ChainAttributes, EstimateAddLP, EstimateAddSaver, EstimateWithdrawLP, EstimateWithdrawSaver, LiquidityPosition, PoolRatios, QuoteSwapParams, SaversPosition, SaversWithdraw, TotalFees, TxDetails, WithdrawLiquidityPosition, getSaver } from './types';
4
+ import { AddliquidityPosition, ChainAttributes, EstimateAddLP, EstimateAddSaver, EstimateWithdrawLP, EstimateWithdrawSaver, LiquidityPosition, LoanCloseParams, LoanCloseQuote, LoanOpenParams, LoanOpenQuote, PoolRatios, QuoteSwapParams, SaversPosition, SaversWithdraw, TotalFees, TxDetails, WithdrawLiquidityPosition, getSaver } from './types';
5
5
  /**
6
6
  * THORChain Class for interacting with THORChain.
7
7
  * Recommended main class to use for swapping with THORChain
@@ -113,4 +113,16 @@ export declare class ThorchainQuery {
113
113
  */
114
114
  getSaverPosition(params: getSaver): Promise<SaversPosition>;
115
115
  private getAddSaversEstimateErrors;
116
+ /**
117
+ *
118
+ * @param loanOpenParams - params needed for the end Point
119
+ * @returns
120
+ */
121
+ getLoanQuoteOpen({ asset, amount, targetAsset, destination, minOut, affiliateBps, affiliate, height, }: LoanOpenParams): Promise<LoanOpenQuote>;
122
+ /**
123
+ *
124
+ * @param loanOpenParams - params needed for the end Point
125
+ * @returns
126
+ */
127
+ getLoanQuoteClose({ asset, amount, fromAddress, loanAsset, loanOwner, minOut, height, }: LoanCloseParams): Promise<LoanCloseQuote>;
116
128
  }
package/lib/types.d.ts CHANGED
@@ -214,6 +214,12 @@ export type SaverFees = {
214
214
  asset: Asset;
215
215
  outbound: CryptoAmount;
216
216
  };
217
+ export type QuoteFees = {
218
+ asset: string;
219
+ liquidity?: string;
220
+ outbound?: string;
221
+ total_bps?: string;
222
+ };
217
223
  export type SaversPosition = {
218
224
  depositValue: CryptoAmount;
219
225
  redeemableValue: CryptoAmount;
@@ -229,3 +235,61 @@ export type SaversWithdraw = {
229
235
  address: Address;
230
236
  withdrawBps: number;
231
237
  };
238
+ export type LoanOpenParams = {
239
+ asset: Asset;
240
+ amount: CryptoAmount;
241
+ targetAsset: Asset;
242
+ destination: string;
243
+ height?: number;
244
+ minOut?: string;
245
+ affiliateBps?: number;
246
+ affiliate?: string;
247
+ };
248
+ export type LoanCloseParams = {
249
+ asset: Asset;
250
+ amount: CryptoAmount;
251
+ loanAsset: Asset;
252
+ loanOwner: Address;
253
+ fromAddress: Address;
254
+ minOut?: string;
255
+ height?: number;
256
+ };
257
+ export type LoanOpenQuote = {
258
+ inboundAddress: string;
259
+ expectedWaitTime: BlockInformation;
260
+ fees: QuoteFees;
261
+ slippageBps?: number;
262
+ router?: string;
263
+ expiry: number;
264
+ warning: string;
265
+ notes: string;
266
+ dustThreshold?: string;
267
+ memo?: string;
268
+ expectedAmountOut: string;
269
+ expectedCollateralizationRation: string;
270
+ expectedCollateralUp: string;
271
+ expectedDebtUp: string;
272
+ errors: string[];
273
+ };
274
+ export type LoanCloseQuote = {
275
+ inboundAddress: string;
276
+ expectedWaitTime: BlockInformation;
277
+ fees: QuoteFees;
278
+ slippageBps?: number;
279
+ router?: string;
280
+ expiry: number;
281
+ warning: string;
282
+ notes: string;
283
+ dustThreshold?: string;
284
+ memo?: string;
285
+ expectedAmountOut: string;
286
+ expectedCollateralDown: string;
287
+ expectedDebtDown: string;
288
+ errors: string[];
289
+ };
290
+ export type BlockInformation = {
291
+ inboundConfirmationBlocks?: number;
292
+ inboundConfirmationSeconds?: number;
293
+ outboundDelayBlocks?: number;
294
+ outbondDelaySeconds?: number;
295
+ };
@@ -1,5 +1,5 @@
1
1
  import { Network } from '@xchainjs/xchain-client';
2
- import { InboundAddress, LastBlock, LiquidityProviderSummary, MimirResponse, Pool, QueueResponse, QuoteSaverDepositResponse, QuoteSaverWithdrawResponse, QuoteSwapResponse, Saver, SaversResponse, TxDetailsResponse, TxOutItem, TxResponse } from '@xchainjs/xchain-thornode';
2
+ import { InboundAddress, LastBlock, LiquidityProviderSummary, MimirResponse, Pool, QueueResponse, QuoteLoanCloseResponse, QuoteLoanOpenResponse, QuoteSaverDepositResponse, QuoteSaverWithdrawResponse, QuoteSwapResponse, Saver, SaversResponse, TxDetailsResponse, TxOutItem, TxResponse } from '@xchainjs/xchain-thornode';
3
3
  import { SaversWithdraw } from '../types';
4
4
  export type ThornodeConfig = {
5
5
  apiRetries: number;
@@ -141,4 +141,30 @@ export declare class Thornode {
141
141
  * @returns quotes swap object response
142
142
  */
143
143
  getSwapQuote(fromAsset: string, toAsset: string, amount: number, destinationAddress?: string, fromAddress?: string, toleranceBps?: number, affiliateBps?: number, affiliate?: string, height?: number): Promise<QuoteSwapResponse>;
144
+ /**
145
+ *
146
+ * @param height
147
+ * @param asset
148
+ * @param amount
149
+ * @param targetAsset
150
+ * @param destination
151
+ * @param minOut
152
+ * @param affiliateBps
153
+ * @param affiliate
154
+ * @returns
155
+ */
156
+ getLoanQuoteOpen(asset: string, amount: number, targetAsset: string, destination: string, minOut?: string, affiliateBps?: number, affiliate?: string, height?: number): Promise<QuoteLoanOpenResponse>;
157
+ /**
158
+ *
159
+ * @param height
160
+ * @param asset
161
+ * @param amount
162
+ * @param targetAsset
163
+ * @param destination
164
+ * @param minOut
165
+ * @param affiliateBps
166
+ * @param affiliate
167
+ * @returns
168
+ */
169
+ getLoanQuoteClose(asset: string, amount: number, fromAddress: string, loanAsset: string, loanOwner: string, minOut?: string, height?: number): Promise<QuoteLoanCloseResponse>;
144
170
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thorchain-query",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "license": "MIT",
5
5
  "description": "Thorchain query module that is resposible for estimating swap calculations and add/remove liquidity for thorchain ",
6
6
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  "devDependencies": {
36
36
  "@xchainjs/xchain-client": "^0.14.1",
37
37
  "@xchainjs/xchain-midgard": "^0.5.0",
38
- "@xchainjs/xchain-thornode": "^0.3.1",
38
+ "@xchainjs/xchain-thornode": "^0.3.2",
39
39
  "@xchainjs/xchain-util": "^0.13.0",
40
40
  "axios": "^1.3.6",
41
41
  "axios-retry": "^3.2.5",
@@ -44,7 +44,7 @@
44
44
  "peerDependencies": {
45
45
  "@xchainjs/xchain-client": "^0.14.1",
46
46
  "@xchainjs/xchain-midgard": "^0.5.0",
47
- "@xchainjs/xchain-thornode": "^0.3.1",
47
+ "@xchainjs/xchain-thornode": "^0.3.2",
48
48
  "@xchainjs/xchain-util": "^0.13.0",
49
49
  "axios": "^1.3.6",
50
50
  "axios-retry": "^3.2.5",
@@ -53,4 +53,4 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  }
56
- }
56
+ }