If you find any problems using the key, please contact the technical team via Telegram, Discord or email to operations@insurace.io .
Project teams or institutional users who need larger traffic, kindly reach out to our marketing/BD team via Telegram, Discord to request for an exclusive key for Partners.
Get $INSUR token information
To get the total and circulating supply of $INSUR, you can call these APIs:
getCirculation : get the sum of $INSUR in circulation on different networks
getTotalAmount : get the sum of all $INSUR on different networks
Retrieve product information
To retrieve product information such as product price, capacity, protocol name and etc. (Access Key required)
getProductList : Return a list of all products covered with details such as product id, name, capacity, product price, etc.
getCurrencyList : Return a list of tokens that can be used to purchase the cover with details such as token name, contract address, etc.
getCoverPremiumV2 : Return the price for a cover.
Buy cover
The full sample code for buying cover using JS code can be found here
You can follow the instruction there to run the test code.
Below is a step-by-step illustration of the JS code:
Step 1: Configuration
Prior to calling the APIs, you need to configure the following parameters first, here is a sample code:
//---------------------------------------// Configuration//---------------------------------------// The JSON RPC URL that connects to an Ethereum node.constjsonRpcUrl='';// The private key of a wallet that is used to purchase this cover.constprivateKey='';// The address of InsurAce Cover contract. Please contact InsurAce team to get the contract address.// Different chains have different addresses.constcontractAddress='';// The URL of InsurAce API.consthttpApiUrl='https://api.insurace.io/ops/v1';// The API key that allows consumers to access InsurAce API.consthttpApiCode='';// The blockchain that the cover purchase transaction is sent to. Valid values are ETH, BSC,// POLYGON, AVALANCHE.constchain='ETH';// The address of the token used to specify the cover amount. Please check// https://api.insurace.io/docs for a list of tokens that can be used to purchase covers.constcoverCurrency='';// The address of the token used to purchase this cover. Must be the same as coverCurrency.constpremiumCurrency='';// The product IDs for this cover purchase. Can be more than 1 product IDs. Please check// https://docs.insurace.io/landing-page/documentation/protocol-design/product-design/product-list// for a complete list of products.constproductIds= [1,2];// The cover period (in days) for each product.constcoverDays= [30,90];// The cover amount for each product.constcoverAmounts= [utils.parseEther('1000').toString(),utils.parseEther('2000').toString()];// The wallet addresses protected by the cover for each product. Each product must correspond to// a wallet addresses (the same wallet address may be specified multiple times).constcoveredAddresses= [];// The referral code used in this cover purchase, may be null.constreferralCode=null;
httpApiCode: API access key
productIds: Can be more than 1 IDs, which can be retrieved from Product List or by calling getProductList API
coverCurrency: token address can be retrieved by calling getCurrencyList API
Step 2: Call function
To buy covers, you need to use the following functions:
getCoverPremium()
Get the price of the cover by calling getCoverPremium API with the parameters specified in Step 1 includes chain, productIds, coverDays, coverAmounts, coverCurrency, owner wallet address and referralCode.
You can follow the instruction there to run the test code.
Below is a step-by-step illustration of the JS code:
Step 1: Configuration
Prior to calling the APIs, you need to configure the following parameters first, here is a sample code:
//---------------------------------------// Configuration//---------------------------------------// The JSON RPC URL that connects to an Ethereum node.constjsonRpcUrl='';// The private key of a wallet that is used to cancel the cover.constprivateKey='';// The address of InsurAce Cover contract, ask InsurAce team to get address// different chain has different addresses.constcontractAddress='';// The ID of the cover pending to be cancelled.constcoverId='';
Step 2: Call function
To cancel cover, you need to use the function below:
cancelCover()
Cancel the cover with the coverID set in step 1 above.