@frakt-protocol/frakt-sdk
Version:
Frakt SDK for interacting with frakt.xyz protocols
76 lines (75 loc) • 2.21 kB
TypeScript
import { web3 } from '@project-serum/anchor';
import { Wallet } from '../../common/classes/nodewallet';
import { SignAndSendAllTransactions, SignAndSendTransaction } from './transactions';
interface BorrowNftTimeBasedParams {
returnPeriodDays: number;
ltvPercents: number;
fee: string;
feeDiscountPercents: string;
repayValue: string;
liquidityPoolPubkey: string;
loanValue: string;
isCanStake: boolean;
}
interface BorrowNftPriceBasedParams {
liquidityPoolPubkey: string;
ltvPercents: number;
borrowAPRPercents: number;
collaterizationRate: number;
isCanStake: boolean;
}
export interface BorrowNft {
mint: string;
name: string;
imageUrl: string;
valuation: string;
maxLoanValue: string;
isCanFreeze: boolean;
timeBased: BorrowNftTimeBasedParams;
priceBased?: BorrowNftPriceBasedParams;
}
interface BorrowNftBulkPriceBasedParams extends BorrowNftPriceBasedParams {
ltv?: number;
suggestedLoanValue?: number;
}
export interface BorrowNftBulk extends BorrowNft {
solLoanValue: number;
isPriceBased?: boolean;
priceBased?: BorrowNftBulkPriceBasedParams;
}
export declare enum BulkTypes {
BEST = "best",
CHEAPEST = "cheapest",
SAFEST = "safest",
MAX = "max"
}
export declare type BulkSuggestion = {
[key in BulkTypes]?: BorrowNftBulk[];
};
export declare type FetchWalletNfts = (props: {
walletPublicKey: web3.PublicKey;
limit?: number;
offset?: number;
}) => Promise<BorrowNft[]>;
export declare type FetchBulkSuggestion = (props: {
walletPublicKey: web3.PublicKey;
totalValue: string | number;
}) => Promise<BulkSuggestion>;
export declare type ProposeLoan = (props: {
nftMint: string;
valuation: number;
ltv: number;
isPriceBased?: boolean;
connection: web3.Connection;
wallet: Wallet;
onAfterSend?: () => void;
onBeforeApprove?: () => void;
}) => ReturnType<SignAndSendTransaction>;
export declare type ProposeLoans = (props: {
bulkNfts: BorrowNftBulk[];
connection: web3.Connection;
wallet: Wallet;
onAfterSend?: () => void;
onBeforeApprove?: () => void;
}) => ReturnType<SignAndSendAllTransactions>;
export {};