UNPKG

banx-token-lending-sdk

Version:

Banx Token Lending sdk

153 lines (152 loc) 6.12 kB
import { web3 } from '@coral-xyz/anchor'; import { BondLoanState, BondLoanStruct, BondLoanStructSerialized, BondLoanType, LiquidationState, RedeemResult } from './BondLoan.types'; import { FetchBondLoansFilters } from './BondLoan.fetchers'; import { BondOffer } from '../BondOffer/BondOffer'; import { BanxMarket } from '../BanxMarket/BanxMarket'; import { GetRepayLoanPartialIxnsParams } from '../../../core/instructions/BondLoan/getRepayLoanPartialIxns'; import { GetBorrowerRefinanceIxnsParams } from '../../../core/instructions/BondLoan/getBorrowerRefinanceIxns'; export declare class BondLoan { readonly struct: Readonly<BondLoanStruct>; constructor(bondLoan: BondLoanStruct); static fromSerialized(bondLoanSerialized: BondLoanStructSerialized): BondLoan; serialize(): BondLoanStructSerialized; static fetch(connection: web3.Connection, publicKey: web3.PublicKey): Promise<BondLoan | null>; static fetchMultiple(connection: web3.Connection, publicKeys: web3.PublicKey[]): Promise<BondLoan[]>; static fetchAll(connection: web3.Connection, filters?: FetchBondLoansFilters): Promise<BondLoan[]>; getState(): BondLoanState; getLiquidationState(): LiquidationState; getRedeemResult(): RedeemResult; getRedeemResultNext(): RedeemResult; getBondLoanType(): BondLoanType; calcBorrowerLoanBody(): import("bn.js"); calcLenderLoanBody(): import("bn.js"); calcBorrowerInterest(endTimeUnix: number): import("bn.js"); calcLenderInterest(endTimeUnix: number): import("bn.js"); calcBorrowerDebt(endTimeUnix: number): import("bn.js"); calcLentAmountWithInterest(endTimeUnix: number): import("bn.js"); calcBorrowerApr(): number; calcRepayAmountFromRepaymentCall(endTimeUnix: number): import("bn.js"); getRepayIxns(params: { walletPublicKey: web3.PublicKey; bondOffer: BondOffer; banxMarket: BanxMarket; }, connection: web3.Connection): Promise<{ mutatedAccounts: { bondOffer: web3.PublicKey; bondLoan: web3.PublicKey; }; instructions: web3.TransactionInstruction[]; signers: web3.Signer[]; }>; getRepayPartialIxns(params: GetRepayLoanPartialIxnsParams['args'] & { walletPublicKey: web3.PublicKey; bondOffer: BondOffer; banxMarket: BanxMarket; }, connection: web3.Connection): Promise<{ mutatedAccounts: { bondOffer: web3.PublicKey; prevBondLoan: web3.PublicKey; newBondLoan: web3.PublicKey; }; instructions: web3.TransactionInstruction[]; signers: web3.Signer[]; }>; getTerminateIxns(params: { walletPublicKey: web3.PublicKey; banxMarket: BanxMarket; }, connection: web3.Connection): Promise<{ mutatedAccounts: { bondLoan: web3.PublicKey; bondOffer: web3.PublicKey; }; instructions: web3.TransactionInstruction[]; signers: web3.Signer[]; }>; getRevertTerminationIxns(params: { walletPublicKey: web3.PublicKey; banxMarket: BanxMarket; }, connection: web3.Connection): Promise<{ mutatedAccounts: { bondOffer: web3.PublicKey; bondLoan: web3.PublicKey; }; instructions: web3.TransactionInstruction[]; signers: web3.Signer[]; }>; getRefinanceIxns(params: { walletPublicKey: web3.PublicKey; banxMarket: BanxMarket; }, connection: web3.Connection): Promise<{ mutatedAccounts: { oldBondOffer: web3.PublicKey; oldBondLoan: web3.PublicKey; oldLenderVault: web3.PublicKey; newBondLoan: web3.PublicKey; newBondOffer: web3.PublicKey; newLenderVault: web3.PublicKey; }; instructions: web3.TransactionInstruction[]; signers: web3.Signer[]; }>; getBorrowerRefinanceIxns(params: GetBorrowerRefinanceIxnsParams['args'] & { walletPublicKey: web3.PublicKey; banxMarket: BanxMarket; bondOffer: BondOffer; }, connection: web3.Connection): Promise<{ mutatedAccounts: { oldBondOffer: web3.PublicKey; oldBondLoan: web3.PublicKey; oldLenderVault: web3.PublicKey; newBondLoan: web3.PublicKey; newBondOffer: web3.PublicKey; newLenderVault: web3.PublicKey; }; instructions: web3.TransactionInstruction[]; signers: web3.Signer[]; }>; getLenderInstantRefinanceIxns(params: { walletPublicKey: web3.PublicKey; banxMarket: BanxMarket; bondOffer: BondOffer; }, connection: web3.Connection): Promise<{ mutatedAccounts: { oldBondOffer: web3.PublicKey; oldBondLoan: web3.PublicKey; oldLenderVault: web3.PublicKey; newBondLoan: web3.PublicKey; newBondOffer: web3.PublicKey; newLenderVault: web3.PublicKey; }; instructions: web3.TransactionInstruction[]; signers: web3.Signer[]; }>; getRefinanceLoanFromOfferIxns(params: { walletPublicKey: web3.PublicKey; banxMarket: BanxMarket; bondOffer: BondOffer; }, connection: web3.Connection): Promise<{ mutatedAccounts: { oldBondOffer: web3.PublicKey; oldBondLoan: web3.PublicKey; oldLenderVault: web3.PublicKey; newBondLoan: web3.PublicKey; newBondOffer: web3.PublicKey; newLenderVault: web3.PublicKey; }; instructions: web3.TransactionInstruction[]; signers: web3.Signer[]; }>; getLiquidateIxns(params: { walletPublicKey: web3.PublicKey; banxMarket: BanxMarket; jupInstruction: web3.TransactionInstruction; }, connection: web3.Connection): Promise<{ mutatedAccounts: { bondOffer: web3.PublicKey; bondLoan: web3.PublicKey; lenderVault: web3.PublicKey; }; instructions: web3.TransactionInstruction[]; signers: web3.Signer[]; }>; }