JSPM

  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q91020F
  • License ISC

Brightjs is a set of javascript tools to interact with the Bright Union's risk platform aggregator's protocol on Ethereum, Binance Smart Chain and Polygon blockchains.

Package Exports

  • @brightunion/sdk
  • @brightunion/sdk/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@brightunion/sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Bright Union

Bright Union SDK

The Bright Union SDK is a set of javascript utilities that enables an easy integration of the Bright Union's multi-chain protocol into any web project.

This SDK will give you access to the Bright Union aggregator contract that combines risk coverage services from:

A swagger API documentation can be found here.

Prerequisites

  • Node v14+
  • Blockchain client node provider:
    • infura, quicknode, anyblock etc...

Installation

npm install @brightunion/sdk

Basic Use

const BrightClient = require('@Brightunion/SDK');

const brightClient= new BrightClient({ <web3_instance> });

// Initialize the client
await brightClient.initialize();

// Get catalog of all risk covers available
const catalog = brightClient.getCatalog();

// Get quotes for a catalog item from all risk providers available
const quotes = brightClient.getQuotes( <amount> , <currency>, <period>, <catalog_item> )

// Buy quoted cover
brightClient.buyQuote( <quote> ).then(data => {
  // transaction done
})

// Get purchased cover count from all distributors
const coversCount = await brightClient.getAllCoversCount();

// Get purchased covers from all distributors
const coversAll = await brightClient.getAllCovers();

Quote and buy a specific cover product

const BrightClient = require('@Brightunion/SDK');B

const brightClient= new BrightClient({ <web3_instance> });

// Initialize the client
await brightClient.initialize();


//Define a Catalog Item from a supported insurance distributor
//INSURACE catalog item example
const catalogItemInsurace = { productId: <Insurace_product_id> };
//BRIDGE catalog item example
const catalogItemBridge = { bridgeProductAddress: <Bridge_product_address> };
//NEXUS catalog item example
const catalogItemNexus = { nexusCoverable: <Nexus_product_address> };

// Get quote from specific distributor on a catalog item
const quote = await brightClient.getQuoteFrom( <distributorName>, <amount> , <currency>, <period>, <catalog_item>);

// Buy quoted cover
brightClient.buyQuote( <quote> ).then(data => {
  // transaction done
})