import { NolusWallet } from '../../wallet'; import { StdFee } from '@cosmjs/stargate'; import { Coin } from '@cosmjs/proto-signing'; import { CosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'; import { LeaseStatus } from '../types/LeaseStatus'; import { Asset } from '../types'; /** * Each Lease instance is an isolated margin position opened by a user. * * Usage: * * ```ts * import { NolusClient, NolusContracts } from '@nolus/nolusjs'; * * const cosm = await NolusClient.getInstance().getCosmWasmClient(); * leaseInstance = new NolusContracts.Lease(cosm, leaseContractAddress); * ``` * * There are also methods for simulating contract operations in order to obtain preliminary information about the transaction. */ export declare class Lease { private cosmWasmClient; private _contractAddress; constructor(cosmWasmClient: CosmWasmClient, contractAddress: string); private findOperationType; /** * Retrieves the current status of the margin position (lease). * * Optionally, a projection time in seconds can be provided to estimate * the loan interest and protocol (margin) interest due at that point in the future. * * @param dueProjectionSecs - Optional. Future projection time in seconds. * * @returns A `Promise` resolving to the current lease state, including: * - The leased asset and size of the position. * - Principal and interest amounts due. * - Overdue amounts (if any) and repayment deadline. * - Applied loan and protocol interest rates. * - Close policy (`stop_loss`, `take_profit`) if set. * - Lease status (e.g. `"idle"`, `"opened"`, `"closed"`). */ getLeaseStatus(dueProjectionSecs?: number): Promise; /** * Executes a repayment toward the margin position’s outstanding debt. * * The repayment may include interest and/or principal. Any party can repay the lease, * not just the original borrower. * * @param nolusWallet - The wallet initiating the repayment. * @param fee - The gas fee for the transaction. * @param fundCoin - The amount and denomination of tokens used for repayment. * * @returns A `Promise` resolving to the transaction result, including: * - Transaction hash, gas used, and emitted repayment events. */ repayLease(nolusWallet: NolusWallet, fee: StdFee | 'auto' | number, fundCoin?: Coin[]): Promise; /** * Simulates a repayment toward the margin position without executing it. * * @param nolusWallet - The wallet used for simulation. * @param fundCoin - The amount of tokens to simulate as repayment. * * @returns A `Promise` resolving to the simulated gas and fee data. */ simulateRepayLeaseTx(nolusWallet: NolusWallet, fundCoin?: Coin[]): Promise; /** * Executes a partial or full market closure on an active position. * * If an amount is specified, only that portion of the position is closed. * Otherwise, the full position is closed (swapping the entire position for the LPN - liquidity pool's native - asset). * * @param nolusWallet - The wallet initiating the close. * @param fee - The gas fee for the transaction. * @param amount - Optional. The amount of the lease asset to close (partial close). * @param fundCoin - Optional. Additional tokens to fund the transaction. * * @returns A `Promise` resolving to the transaction result, including: * - Transaction hash, gas used, and emitted events for the partial/full market closing. */ closePositionLease(nolusWallet: NolusWallet, fee: StdFee | 'auto' | number, amount?: Asset, fundCoin?: Coin[]): Promise; /** * Simulates a partial or full close on an active lease. * * @param nolusWallet - The wallet used for simulation. * @param amount - Optional. The lease asset amount to simulate closing. * @param fundCoin - Optional. Tokens to simulate as funding source. * * @returns A `Promise` resolving to the simulated gas and fee estimate. */ simulateClosePositionLeaseTx(nolusWallet: NolusWallet, amount?: Asset, fundCoin?: Coin[]): Promise; /** * Adjusts the `stop_loss` (SL) and/or `take_profit` (TP) thresholds for the margin position. * * These thresholds are expressed as LTV (loan-to-value) ratios in permilles. * To remove an existing stop-loss or take-profit, set the respective value to `null`. * * @param nolusWallet - The wallet requesting the update. * @param fee - The gas fee for the transaction. * @param stopLoss - Optional stop-loss threshold in permilles. * @param takeProfit - Optional take-profit threshold in permilles. * @param fundCoin - Optional. Additional tokens to fund the transaction. * * @returns A `Promise` resolving to the transaction result, including: * - Transaction hash, gas used, and emitted events for setting the SL/TP policy. */ changeClosePolicy(nolusWallet: NolusWallet, fee: StdFee | 'auto' | number, stopLoss?: number | null, takeProfit?: number | null, fundCoin?: Coin[]): Promise; /** * Simulates a change to the `stop_loss` and/or `take_profit` thresholds * without executing the update. * * @param nolusWallet - The wallet used for simulation. * @param stopLoss - Optional stop-loss threshold in permilles. * @param takeProfit - Optional take-profit threshold in permilles. * @param fundCoin - Optional. Tokens to simulate as funding source. * * @returns A `Promise` resolving to the simulated gas and fee estimate. */ simulateChangeClosePolicyTx(nolusWallet: NolusWallet, stopLoss?: number | null, takeProfit?: number | null, fundCoin?: Coin[]): Promise; }