New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kohin-app-v2-sdk

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kohin-app-v2-sdk

The Kohin SDK 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 an

  • 1.0.11
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Kohin SDK

The Kohin SDK 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 analytics for user bets, coverage, and liquidity pools.

Installation

npm install kohin-sdk

Requirements

  • Access Key and Secret Key
  • Polygon Network RPC URL

Network Support

  • Test: Polygon Amoy (Chain ID: 80002)
  • Pre-Production: Polygon (Chain ID: 137)
  • Production: Polygon Mainnet

Quick Start

import { Kohin } from "kohin-sdk";

// Initialize SDK with credentials
const kohin = new Kohin({
  accessKey: "<ACCESS_KEY>",
  secretKey: "<SECRET_KEY>",
  rpcUrl: "<RPC_URL>",
  envMode: "<ENV_MODE>", // Choose between "test", "preProd", or "prod"
});

Core Features

Betting Operations

// Get Active Bets
const activeBets = await kohin.getActiveBetData({
  bettorAddress: "0x...",
  pageCount: 1,
});

// Get Bet Details
const details = await kohin.getBetDetails({
  betId: "0x...",
});

// Get Odds History
const history = await kohin.getOddsHistory({
  conditionId: "0x...",
});

Insurance Operations

// Calculate Premium
const premium = await kohin.calculatePremium({
  betId: 123,
  betType: "Combo", // For an "Express" bet, pass betType as "Combo" and for an "Ordinar" bet, pass betType as "Single."
  odds: 2.5,
  betAmount: 100,
  numLegs: 2,
});

// Buy Cover
const cover = await kohin.buyCover({
  betId: 123,
  betAmount: 100,
  betType: "Combo", // For an "Express" bet, pass betType as "Combo" and for an "Ordinar" bet, pass betType as "Single."
  slippagePercent: 5, // Pass a slippagePercent value between 0 and 100. For example, 5 represents 5%.
  coverPremium: BigInt(1000000), // 1 USDT (6 decimals)
});

Liquidity Management

// Add Liquidity
await kohin.approveAmount({ amount: 1000 }); // for 1000 USDT
const deposit = await kohin.addLiquidity({ amount: 1000 }); // for 1000 USDT

// Remove Liquidity
const withdrawal = await kohin.removeLiquidity({
  depositId: 1099511627894,
  percent: 16, // Pass a percent value between 0 and 100. For example, 16 represents 16%.
});

Response Types

All methods return a consistent response format:

interface ResponseData<T> {
  success: boolean;
  data?: T;
  error?: string;
}

Error Handling

try {
  const result = await kohin.someOperation(params);
  if (result.success) {
    // Handle success
  } else {
    // Handle error
  }
} catch (error) {
  // Handle unexpected errors
}

Dependencies

  • viem: Web3 interactions
  • axios: API requests
  • typescript: Type definitions

Security Best Practices

  • Store credentials securely
  • Validate all transaction parameters
  • Maintain sufficient gas for transactions

License

MIT

Keywords

FAQs

Package last updated on 13 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc