UNPKG

@rainfi/sdk

Version:

This package is used to interact with Rain.fi protocol on Solana

235 lines (234 loc) 7.45 kB
/** * This code was GENERATED using the solita package. * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. * * See: https://github.com/metaplex-foundation/solita */ /// <reference types="node" /> import * as web3 from '@solana/web3.js'; import * as beet from '@metaplex-foundation/beet'; import * as beetSolana from '@metaplex-foundation/beet-solana'; import { LoanKind } from '../types/LoanKind'; import { LoanStatus } from '../types/LoanStatus'; import { Marketplace } from '../types/Marketplace'; import { Sale } from '../types/Sale'; import { Listing } from '../types/Listing'; /** * Arguments used to create {@link Loan} * @category Accounts * @category generated */ export type LoanArgs = { kind: LoanKind; status: LoanStatus; borrower: web3.PublicKey; lender: web3.PublicKey; pool: web3.PublicKey; mint: web3.PublicKey; currency: web3.PublicKey; isCustom: boolean; isFrozen: boolean; price: beet.bignum; interest: beet.bignum; amount: beet.bignum; duration: beet.bignum; collection: number; liquidation: number; marketplace: Marketplace; sale: Sale; createdAt: beet.bignum; expiredAt: beet.bignum; repaidAt: beet.bignum; soldAt: beet.bignum; liquidatedAt: beet.bignum; listing: Listing; isCompressedLoan: boolean; isDefi: boolean; collateralAmount: beet.bignum; collateralDecimals: number; padding: beet.bignum[]; padding1: number; }; export declare const loanDiscriminator: number[]; /** * Holds the data for the {@link Loan} Account and provides de/serialization * functionality for that data * * @category Accounts * @category generated */ export declare class Loan implements LoanArgs { readonly kind: LoanKind; readonly status: LoanStatus; readonly borrower: web3.PublicKey; readonly lender: web3.PublicKey; readonly pool: web3.PublicKey; readonly mint: web3.PublicKey; readonly currency: web3.PublicKey; readonly isCustom: boolean; readonly isFrozen: boolean; readonly price: beet.bignum; readonly interest: beet.bignum; readonly amount: beet.bignum; readonly duration: beet.bignum; readonly collection: number; readonly liquidation: number; readonly marketplace: Marketplace; readonly sale: Sale; readonly createdAt: beet.bignum; readonly expiredAt: beet.bignum; readonly repaidAt: beet.bignum; readonly soldAt: beet.bignum; readonly liquidatedAt: beet.bignum; readonly listing: Listing; readonly isCompressedLoan: boolean; readonly isDefi: boolean; readonly collateralAmount: beet.bignum; readonly collateralDecimals: number; readonly padding: beet.bignum[]; readonly padding1: number; private constructor(); /** * Creates a {@link Loan} instance from the provided args. */ static fromArgs(args: LoanArgs): Loan; /** * Deserializes the {@link Loan} from the data of the provided {@link web3.AccountInfo}. * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ static fromAccountInfo(accountInfo: web3.AccountInfo<Buffer>, offset?: number): [Loan, number]; /** * Retrieves the account info from the provided address and deserializes * the {@link Loan} from its data. * * @throws Error if no account info is found at the address or if deserialization fails */ static fromAccountAddress(connection: web3.Connection, address: web3.PublicKey, commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig): Promise<Loan>; /** * Provides a {@link web3.Connection.getProgramAccounts} config builder, * to fetch accounts matching filters that can be specified via that builder. * * @param programId - the program that owns the accounts we are filtering */ static gpaBuilder(programId?: web3.PublicKey): beetSolana.GpaBuilder<{ accountDiscriminator: any; collection: any; createdAt: any; padding1: any; currency: any; price: any; kind: any; status: any; borrower: any; lender: any; pool: any; mint: any; isCustom: any; isFrozen: any; interest: any; amount: any; duration: any; liquidation: any; marketplace: any; sale: any; expiredAt: any; repaidAt: any; soldAt: any; liquidatedAt: any; listing: any; isCompressedLoan: any; isDefi: any; collateralAmount: any; collateralDecimals: any; padding: any; }>; /** * Deserializes the {@link Loan} from the provided data Buffer. * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ static deserialize(buf: Buffer, offset?: number): [Loan, number]; /** * Serializes the {@link Loan} into a Buffer. * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. */ serialize(): [Buffer, number]; /** * Returns the byteSize of a {@link Buffer} holding the serialized data of * {@link Loan} */ static get byteSize(): number; /** * Fetches the minimum balance needed to exempt an account holding * {@link Loan} data from rent * * @param connection used to retrieve the rent exemption information */ static getMinimumBalanceForRentExemption(connection: web3.Connection, commitment?: web3.Commitment): Promise<number>; /** * Determines if the provided {@link Buffer} has the correct byte size to * hold {@link Loan} data. */ static hasCorrectByteSize(buf: Buffer, offset?: number): boolean; /** * Returns a readable version of {@link Loan} properties * and can be used to convert to JSON and/or logging */ pretty(): { kind: string; status: string; borrower: string; lender: string; pool: string; mint: string; currency: string; isCustom: boolean; isFrozen: boolean; price: number | { toNumber: () => number; }; interest: number | { toNumber: () => number; }; amount: number | { toNumber: () => number; }; duration: number | { toNumber: () => number; }; collection: number; liquidation: number; marketplace: string; sale: Sale; createdAt: number | { toNumber: () => number; }; expiredAt: number | { toNumber: () => number; }; repaidAt: number | { toNumber: () => number; }; soldAt: number | { toNumber: () => number; }; liquidatedAt: number | { toNumber: () => number; }; listing: Listing; isCompressedLoan: boolean; isDefi: boolean; collateralAmount: number | { toNumber: () => number; }; collateralDecimals: number; padding: beet.bignum[]; padding1: number; }; } /** * @category Accounts * @category generated */ export declare const loanBeet: beet.BeetStruct<Loan, LoanArgs & { accountDiscriminator: number[]; }>;