UNPKG

kohin-app-v2-sdk

Version:

The Kohin JS is a comprehensive developer toolkit designed to integrate Kohin's decentralized insurance system seamlessly into your applications. It enables efficient interaction with Kohin smart contracts and backend APIs, facilitating management and ana

191 lines (190 loc) 6.01 kB
import { OddHistoryParams, OddsHistory } from "../types/OddHistoryTypes"; import { ResponseData } from "../config/commonResponse"; import { MySlips, MySlipsParams } from "../types/MySlipsTypes"; import { SlipHistory, SlipHistoryParams } from "../types/SlipHistoryTypes"; import { TransactionHistory, TransactionHistoryParams } from "../types/TransactionHistoryTypes"; import { MyDeposits, MyDepositsParams } from "../types/MyDepositTypes"; import { EnvMode } from "../config/serverConstants"; import { BetTypes, BuyCoverParams, BuyCoverResponse } from "../types/BuyCoverTypes"; import { CalculatePremiumParams, CalculatePremiumResponse } from "../types/CalculatePremiumTypes"; import { AddLiquidityParams, AddLiquidityResponse } from "../types/AddLiquidityTypes"; import { ActiveBetParams, Bet } from "../types/ActiveBetTypes"; import { BetDetails, BetDetailsParams } from "../types/BetDetailsTypes"; import { RemoveLiquidityParams, RemoveLiquidityResponse } from "../types/RemoveLiquidityTypes"; import { Cover } from "../types/CoverTypes"; import { BetsStatusParams, BetStatusData } from "../types/BetsStatusTypes"; /** * The `Kohin` class acts as a centralized API service that manages * different functionalities such as fetching odd history, active bets, * and bet details. */ export declare enum BetType { Single = 0, Combo = 1 } export declare class Kohin { private accessKey; private secretKey; private apiCall; private POLYGON_CHAIN; private affiliateAddress; constructor(params: { accessKey: string; secretKey: string; envMode: EnvMode; affiliateAddress: string; rpcUrl?: string; }); getActiveBetData(params: ActiveBetParams): Promise<ResponseData<{ bets: Bet[]; }>>; getBetsStatusData(params: BetsStatusParams): Promise<ResponseData<BetStatusData>>; getBetDetails(params: BetDetailsParams): Promise<ResponseData<BetDetails>>; getOddsHistory(params: OddHistoryParams): Promise<ResponseData<OddsHistory[]>>; getMySlips(params: MySlipsParams): Promise<ResponseData<{ activeSlips: MySlips[]; }>>; getSlipHistory(params: SlipHistoryParams): Promise<ResponseData<{ slipHistory: SlipHistory[]; }>>; getTransactionHistory(params: TransactionHistoryParams): Promise<ResponseData<{ transactionHistory: TransactionHistory[]; }>>; getPoolApr(): Promise<ResponseData<{ apr: string; }>>; getMyDeposits(params: MyDepositsParams): Promise<ResponseData<{ myDeposits: MyDeposits[]; }>>; private static convertBetType; buyCover(params: BuyCoverParams): Promise<BuyCoverResponse>; approveAmount({ amount, walletClient, }: { amount: number; walletClient: any; }): Promise<{ success: boolean; error?: string; approveHash?: string; approveData?: any; }>; addLiquidity(params: AddLiquidityParams): Promise<AddLiquidityResponse>; calculatePremium(params: CalculatePremiumParams): Promise<CalculatePremiumResponse>; hasCoverBooked({ betId, betType, }: { betId: number; betType: BetTypes; }): Promise<{ success: boolean; error?: string; isBooked?: boolean; }>; getWithdrawAfter({ depositId }: { depositId: number; }): Promise<{ success: boolean; error?: string; withdrawAfter?: string; }>; getBetLimits({ betType }: { betType: BetTypes; }): Promise<{ success: boolean; minOdds?: number; maxOdds?: number; minAmount?: number; maxAmount?: number; error?: any; }>; getMaxSubBetLimit(): Promise<{ success: boolean; error?: any; maxSubBetLimit?: number; }>; isEarlyWithdrawalEnabled(): Promise<{ success: boolean; error?: string; isEarlyWithdrawalEnabled?: boolean; }>; checkMLRBeforeBuyCover({ betAmount }: { betAmount: number; }): Promise<{ success: boolean; error: string; } | { success: boolean; error?: undefined; }>; getMinDeposit(): Promise<{ success: boolean; error?: string; minDeposit?: number; }>; getMaxDeposit(): Promise<{ success: boolean; error?: string; maxDeposit?: number; }>; getReserve(): Promise<{ success: boolean; error?: string; reserveAmount?: number; }>; getMaxPoolCap(): Promise<{ success: boolean; error?: string; maxPoolCap?: number; }>; earlyWithdrawalFee(): Promise<{ success: boolean; error?: string; earlyWithdrawalFee?: number; }>; getTokenBalance({ walletClient }: { walletClient: any; }): Promise<{ success: boolean; error?: string; balance?: bigint; }>; getDecimalPrecise(): Promise<{ success: boolean; error?: string; decimalPrecise?: number; }>; getApprovalAmount({ walletClient }: { walletClient: any; }): Promise<{ success: boolean; error?: string; allowance?: number; }>; getBalanceOfDeposit({ depositId }: { depositId: number; }): Promise<{ success: boolean; error?: string; balance?: number; }>; removeLiquidity(params: RemoveLiquidityParams): Promise<RemoveLiquidityResponse>; getCover({ coverId }: { coverId: number; }): Promise<{ success: boolean; error?: string; cover?: Cover; }>; isPaused(): Promise<{ success: boolean; error?: string; isPause?: boolean; }>; settleClaim({ coverId, walletClient, }: { coverId: number; walletClient: any; }): Promise<{ success: boolean; error?: string; amount?: number; transactionHash?: string; transactionData?: any; }>; }