UNPKG

@rainfi/sdk

Version:

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

54 lines (53 loc) 3.36 kB
import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js"; import BN from 'bn.js'; import { Currency, Loan } from "../types/types"; export declare function removeNull(array: any): any; export declare const parseEnum: (o: any) => string; export declare function getMetadataAddress(mintKey: PublicKey): PublicKey; export declare const getAtaForMint: (mint: PublicKey, buyer: PublicKey) => PublicKey; export declare const getGlobalOfferIdFromCollection: (connection: Connection, collection: PublicKey) => Promise<number>; export declare const getGlobalOfferIdFromMint: (connection: Connection, nftMint: PublicKey) => Promise<number>; export declare const getMintFloorPrice: (connection: Connection, id: number) => Promise<number>; export declare const getPdaGlobalOfferCollection: (collectionAccount: PublicKey) => Promise<PublicKey>; export declare const isValidPubkey: (pubkey: string | PublicKey) => boolean; /** * Construct an AssociatedTokenAccount instruction * * @param payer Payer of the initialization fees * @param associatedToken New associated token account * @param owner Owner of the new account * @param mint Token mint account * @param programId SPL Token program account * @param associatedTokenProgramId SPL Associated Token program account * * @return Instruction to add to a transaction */ export declare function createAssociatedTokenAccountInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction; /** * Get the address of the associated token account for a given mint and owner * * @param mint Token mint account * @param owner Owner of the new account * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address) * @param programId SPL Token program account * @param associatedTokenProgramId SPL Associated Token program account * * @return Address of the associated token account */ export declare function getAssociatedTokenAddressSync(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey; export declare function createSyncNativeInstruction(nativeAccount: PublicKey): TransactionInstruction; export declare function withWrappedSol(connection: Connection, owner: PublicKey, accountAddress: PublicKey, amount?: number): Promise<TransactionInstruction[]>; export declare function initAtaIfNeeded(connection: Connection, signer: PublicKey, signerTa: PublicKey, mint: PublicKey): Promise<TransactionInstruction | null>; export declare function round(value: number, decimals?: number): number; export declare const computeDynamicInterest: (kind: 'loan' | 'mortgage', interest: BN, createdAt: BN, duration: BN) => number; export declare function getCurrentInterest(loan: Loan, loanDecimals: number): { currentInterest: number; currentInterestPercent: number; currentInterestRounded: number; totalInterest: number; totalInterestPercent: number; totalInterestRounded: number; interestWFees: number; finalAmount: number; }; export declare function getCurrency(currency: string): Promise<Currency>;