UNPKG

@rainfi/sdk

Version:

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

265 lines (264 loc) 8.77 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 { PoolStatus } from '../types/PoolStatus'; import { Curve } from '../types/Curve'; import { PoolCondition } from '../types/PoolCondition'; import { PoolLiquidation } from '../types/PoolLiquidation'; import { PoolCollection } from '../types/PoolCollection'; /** * Arguments used to create {@link Pool} * @category Accounts * @category generated */ export type PoolArgs = { bump: number; owner: web3.PublicKey; currency: web3.PublicKey; oraclePoolUsd: web3.PublicKey; oracleSolUsd: web3.PublicKey; status: PoolStatus; isCompounded: boolean; isShared: boolean; totalAmount: beet.bignum; borrowedAmount: beet.bignum; availableAmount: beet.bignum; usableAmount: beet.bignum; loanCurve: Curve; mortgageCurve: Curve; isMortgageEnabled: boolean; nftLocked: beet.bignum; totalLiquidations: beet.bignum; totalLoans: beet.bignum; totalMortgages: beet.bignum; totalInterest: beet.bignum; depositedAt: beet.bignum; createdAt: beet.bignum; updatedAt: beet.bignum; collectionsUpdatedAt: beet.bignum; lastLoanAt: beet.bignum; lastMortgageAt: beet.bignum; conditions: PoolCondition; liquidation: PoolLiquidation; whitelist: web3.PublicKey; depositedAmount: beet.bignum; minAmountPerLoan: beet.bignum; padding: beet.bignum[]; collections: PoolCollection[]; }; export declare const poolDiscriminator: number[]; /** * Holds the data for the {@link Pool} Account and provides de/serialization * functionality for that data * * @category Accounts * @category generated */ export declare class Pool implements PoolArgs { readonly bump: number; readonly owner: web3.PublicKey; readonly currency: web3.PublicKey; readonly oraclePoolUsd: web3.PublicKey; readonly oracleSolUsd: web3.PublicKey; readonly status: PoolStatus; readonly isCompounded: boolean; readonly isShared: boolean; readonly totalAmount: beet.bignum; readonly borrowedAmount: beet.bignum; readonly availableAmount: beet.bignum; readonly usableAmount: beet.bignum; readonly loanCurve: Curve; readonly mortgageCurve: Curve; readonly isMortgageEnabled: boolean; readonly nftLocked: beet.bignum; readonly totalLiquidations: beet.bignum; readonly totalLoans: beet.bignum; readonly totalMortgages: beet.bignum; readonly totalInterest: beet.bignum; readonly depositedAt: beet.bignum; readonly createdAt: beet.bignum; readonly updatedAt: beet.bignum; readonly collectionsUpdatedAt: beet.bignum; readonly lastLoanAt: beet.bignum; readonly lastMortgageAt: beet.bignum; readonly conditions: PoolCondition; readonly liquidation: PoolLiquidation; readonly whitelist: web3.PublicKey; readonly depositedAmount: beet.bignum; readonly minAmountPerLoan: beet.bignum; readonly padding: beet.bignum[]; readonly collections: PoolCollection[]; private constructor(); /** * Creates a {@link Pool} instance from the provided args. */ static fromArgs(args: PoolArgs): Pool; /** * Deserializes the {@link Pool} 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): [Pool, number]; /** * Retrieves the account info from the provided address and deserializes * the {@link Pool} 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<Pool>; /** * 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; nftLocked: any; createdAt: any; updatedAt: any; currency: any; status: any; liquidation: any; padding: any; bump: any; owner: any; oraclePoolUsd: any; oracleSolUsd: any; isCompounded: any; isShared: any; totalAmount: any; borrowedAmount: any; availableAmount: any; usableAmount: any; loanCurve: any; mortgageCurve: any; isMortgageEnabled: any; totalLiquidations: any; totalLoans: any; totalMortgages: any; totalInterest: any; depositedAt: any; collectionsUpdatedAt: any; lastLoanAt: any; lastMortgageAt: any; conditions: any; whitelist: any; depositedAmount: any; minAmountPerLoan: any; collections: any; }>; /** * Deserializes the {@link Pool} 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): [Pool, number]; /** * Serializes the {@link Pool} 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 Pool} */ static get byteSize(): number; /** * Fetches the minimum balance needed to exempt an account holding * {@link Pool} 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 Pool} data. */ static hasCorrectByteSize(buf: Buffer, offset?: number): boolean; /** * Returns a readable version of {@link Pool} properties * and can be used to convert to JSON and/or logging */ pretty(): { bump: number; owner: string; currency: string; oraclePoolUsd: string; oracleSolUsd: string; status: string; isCompounded: boolean; isShared: boolean; totalAmount: number | { toNumber: () => number; }; borrowedAmount: number | { toNumber: () => number; }; availableAmount: number | { toNumber: () => number; }; usableAmount: number | { toNumber: () => number; }; loanCurve: Curve; mortgageCurve: Curve; isMortgageEnabled: boolean; nftLocked: number | { toNumber: () => number; }; totalLiquidations: number | { toNumber: () => number; }; totalLoans: number | { toNumber: () => number; }; totalMortgages: number | { toNumber: () => number; }; totalInterest: number | { toNumber: () => number; }; depositedAt: number | { toNumber: () => number; }; createdAt: number | { toNumber: () => number; }; updatedAt: number | { toNumber: () => number; }; collectionsUpdatedAt: number | { toNumber: () => number; }; lastLoanAt: number | { toNumber: () => number; }; lastMortgageAt: number | { toNumber: () => number; }; conditions: PoolCondition; liquidation: PoolLiquidation; whitelist: string; depositedAmount: number | { toNumber: () => number; }; minAmountPerLoan: number | { toNumber: () => number; }; padding: beet.bignum[]; collections: PoolCollection[]; }; } /** * @category Accounts * @category generated */ export declare const poolBeet: beet.BeetStruct<Pool, PoolArgs & { accountDiscriminator: number[]; }>;