@rainfi/sdk
Version:
This package is used to interact with Rain.fi protocol on Solana
73 lines (72 loc) • 6.23 kB
TypeScript
import { BorrowCompressedArgs, ConfigMortgage, ExecuteMortgageRequestArgs, ExtendArgs, LoanRequestArgs } from "./../types/types";
import { Connection, Keypair, PublicKey, TransactionInstruction } from "@solana/web3.js";
import { BorrowArgs, BuyArgs, CreatePoolArgs, ExecuteLoanRequestArgs, MgRequestArgs, UpdatePoolArgs } from "../types/types";
import { PoolStatus } from "../generated";
import { Metadata } from "@metaplex-foundation/mpl-token-metadata";
import { UserInputPoolCollection } from "../generated/types/UserInputPoolCollection";
export declare function createPool(connection: Connection, publicKey: PublicKey, args: CreatePoolArgs, splAddress: PublicKey): Promise<TransactionInstruction[]>;
export declare function updatePool(publicKey: PublicKey, args: UpdatePoolArgs): Promise<TransactionInstruction>;
export declare function updatePoolCollections(publicKey: PublicKey, collections: UserInputPoolCollection[]): Promise<TransactionInstruction>;
export declare function borrow(connection: Connection, publicKey: PublicKey, args: BorrowArgs, referrer?: PublicKey | undefined): Promise<{
instruction: TransactionInstruction[];
signers: Keypair;
}>;
export declare function extendLoan(connection: Connection, publicKey: PublicKey, args: ExtendArgs, amount: number, referrer?: PublicKey | undefined): Promise<{
instruction: TransactionInstruction[];
signers: Keypair;
}>;
export declare function repayLoan(connection: Connection, publicKey: PublicKey, address: PublicKey, amount: number): Promise<TransactionInstruction[]>;
export declare function addLiquidity(connection: Connection, publicKey: PublicKey, amount: number): Promise<TransactionInstruction[]>;
export declare function withdrawLiquidity(connection: Connection, publicKey: PublicKey, amount: number): Promise<TransactionInstruction[]>;
export declare function updatePoolStatus(publicKey: PublicKey, status: PoolStatus): TransactionInstruction;
export declare function closePool(publicKey: PublicKey): TransactionInstruction;
export declare function updatePoolWhitelist(publicKey: PublicKey, lookupTable: PublicKey | undefined): TransactionInstruction;
export declare function setMaxAmountUsable(publicKey: PublicKey, amount: number): TransactionInstruction;
export declare function makeLoanRequest(connection: Connection, publicKey: PublicKey, args: LoanRequestArgs): Promise<TransactionInstruction>;
export declare function cancelLoanRequest(connection: Connection, publicKey: PublicKey, loanRequestAddress: PublicKey): Promise<TransactionInstruction>;
export declare function poolCancelLoanProposal(connection: Connection, publicKey: PublicKey, loanRequestAddress: PublicKey): Promise<TransactionInstruction>;
export declare function acceptLoanRequest(connection: Connection, publicKey: PublicKey, loanRequestAddress: PublicKey): Promise<TransactionInstruction>;
export declare function executeLoanRequest(connection: Connection, publicKey: PublicKey, args: ExecuteLoanRequestArgs): Promise<{
instruction: TransactionInstruction[];
signers: Keypair;
}>;
export declare function configMortgage(publicKey: PublicKey, args: ConfigMortgage): Promise<TransactionInstruction>;
export declare function buyMortgage(connection: Connection, publicKey: PublicKey, args: BuyArgs): Promise<{
instruction: TransactionInstruction[];
signers: Keypair;
}>;
export declare function freeze(connection: Connection, publicKey: PublicKey, mortgageAddress: PublicKey, mintAddress: PublicKey, poolOwner: PublicKey): Promise<TransactionInstruction[]>;
export declare function sellLoanMortgage(publicKey: PublicKey, loanAddress: PublicKey, nftMint: PublicKey, sellPrice: number): TransactionInstruction;
export declare function buyLoanMortgage(connection: Connection, publicKey: PublicKey, mortgageAddress: PublicKey, sellPrice: number): Promise<{
instruction: TransactionInstruction[];
signers: Keypair;
}>;
export declare function liquidate(connection: Connection, publicKey: PublicKey, loanAddress: PublicKey): Promise<TransactionInstruction>;
export declare function makeMortgageRequest(connection: Connection, publicKey: PublicKey, args: MgRequestArgs): Promise<TransactionInstruction>;
export declare function cancelMortgageRequest(connection: Connection, publicKey: PublicKey, mortgageRequestAddress: PublicKey): Promise<TransactionInstruction>;
export declare function poolCancelMortgageProposal(connection: Connection, publicKey: PublicKey, mortgageRequestAddress: PublicKey): Promise<TransactionInstruction>;
export declare function acceptMortgageRequest(connection: Connection, publicKey: PublicKey, loanRequestAddress: PublicKey): Promise<TransactionInstruction>;
export declare function executeMortgageRequest(connection: Connection, publicKey: PublicKey, args: ExecuteMortgageRequestArgs): Promise<{
instruction: TransactionInstruction[];
signers: Keypair;
}>;
export declare function unfreeze(connection: Connection, publicKey: PublicKey, mortgageAddress: PublicKey): Promise<TransactionInstruction[]>;
export declare function sellNft(connection: Connection, publicKey: PublicKey, mortgageAddress: PublicKey, bestOrder: {
address: string;
sellNowPrice: number;
}, amount?: number): Promise<TransactionInstruction[]>;
export declare function listNft(connection: Connection, publicKey: PublicKey, mortgageAddress: PublicKey, price: number): Promise<{
instructions: TransactionInstruction[];
signer: Keypair;
}>;
export declare function delistNft(connection: Connection, publicKey: PublicKey, mortgageAddress: PublicKey): Promise<TransactionInstruction[]>;
export declare function claimSale(connection: Connection, publicKey: PublicKey, mortgageAddress: PublicKey): Promise<TransactionInstruction[]>;
export declare function borrowCompressed(connectionOld: Connection, publicKey: PublicKey, args: BorrowCompressedArgs, referrer?: PublicKey | undefined): Promise<{
instruction: TransactionInstruction[];
signers: Keypair;
}>;
export declare function repayCompressedLoan(connectionOld: Connection, publicKey: PublicKey, address: PublicKey, amount: number): Promise<TransactionInstruction[]>;
export declare function getRuleset(metadata: Metadata): {
isPnft: boolean;
ruleSet: PublicKey;
};