2.0.6 • Published 10 months ago

bqjs v2.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

BQJS - JavaScript SDK for Insurance Cover

BQJS is a Javascript library designed to simplify interactions with insurance cover services. It provides easy-to-use functions for retrieving insurance cover details and facilitating insurance purchases.

Features

  • Retrieve Cover Information: Fetch details about available cover for a specific client.
  • Purchase Insurance Cover: Easily manage cover purchases, including setting cover value and period.

Installation

To install the BQJS SDK, add it to your project using cargo:

npm install bqjs

Documentation Comprehensive documentation is coming soon! Stay tuned.

For now, check out our examples for sample usage.

Getting Started

Import the SDK

Begin by importing the necessary modules from the SDK:

import { CoverClientConfig } from "bqjs";

Create a client instance

Set up the client instance by specifying your client name and ID cover. You can get the Cover IDs here

const protocolName = "Lorenzo Smart Contract";
const coverId = 21000001;

const client = new CoverClientConfig(protocolName, coverId);

Retrieve Cover Information

Before every user cover purchase , retrieve the current cover details, including the maximum available amount:

const coverInfo = await client.coverInfo();

This returns a CoverInfo object containing key details like the risk, capacity, cost, and maximum available coverage.

return {
  id: Number(coverInfo[0]),
  name: coverInfo[1],
  risk: Number(coverInfo[2]),
  chains: coverInfo[3],
  capacity: Number(coverInfo[4]),
  cost: Number(coverInfo[5]),
  capacityAmount: Number(coverInfo[6]),
  coverValues: Number(coverInfo[7]),
  maxAmount: Number(coverInfo[8]),
  poolId: Number(coverInfo[9]),
  cid: coverInfo[10],
};

Purchase Insurance Cover

This function be called to purchase cover for the client. Takes the cover value, the cover period and the cover fee (to be changed).

let hash = await client.userPurchaseCover(1000000000000000, 120, 10000);

It returns the tx hash of the cover purchase tx.

0xd3ccd983403fa4dca40e16f3cd6fbe0ead0f359a22246dfe66db535a47fc8e36

Network/ Cover IDs

The network IDs/ Cover IDs for the clients.

NetworkTestnet Chain IDMainnet Chain ID
Babylon11
Infstone22
Merlin6868684200
Core DAO11151116
PWR21000001 (Bitcoin+)-
Lorenzo832918329
Lombard33
Pump BTC44
Octopus Bridge55
Avalon Finance66
Omni BTC77
Zest Protocol88
Liquidium99
Ordeez Protocol1010
Eastblue Protocol1111
Yona Network1212
Satoshi Protocol1313
Palladium1414
Bima BTC1515
BitStable1616
Rye Harvest1717
2.0.3

10 months ago

2.0.2

10 months ago

2.0.5

10 months ago

2.0.4

10 months ago

2.0.6

10 months ago

2.0.1

10 months ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.7

5 years ago

1.0.5

5 years ago

1.0.3

5 years ago

1.0.0

5 years ago