SDK Integration

Amulet SDK provides functionalities for other Dapp to integrate with Amulet protocol.

Github

SDK Library

Amulet SDK can be installed from npm package manager

It currently supports the following functions:

  • Get premium

  • Buy Cover

  • Stake and underwrite SOL token

  • Unstake AUWT token and receive a ticket

  • Withdraw AMTSOL token with ticket

The full sample code for buying cover using JS code can be found here

Prerequisites

Before using the SDK, you are required to register an API key with Amulet protocol. The API key is required by the SDK to call the getPremium API from our endpoint. The API key can be requested by submitting the form here.

After receiving your API key, add it on Amulet class apiSecret key parameter, as shown below

Get premium

Get premium function calculates the total premium amount that needs to be paid for a product with respect to the cover duration and cover amount.

Below is a step-by-step illustration of the JS code:

Buy Cover

Buy cover function enables user to purchase a product cover with the input of cover duration and cover amount.

Below is a step-by-step illustration of the JS code:

Stake and underwrite SOL token

This function allows SOL token to be staked on Amulet protocol with earning yield from staking and underwriting pool. AUWT token is minted and transferred to user token account as the representative token.

Below is a step-by-step illustration of the JS code:

Unstake AUWT token and receive a ticket

This function allows user to swap AUWT token for amtSOL token without paying unstaking fee by waiting. A ticket receipt account will be created recording the amount to be withdrawn and waiting period. The ticket can only be used to withdraw amtSOL after the stated waiting period.

Below is a step-by-step illustration of the JS code:

Withdraw amtSOL token with a ticket.

This function allows user to withdraw amtSOL with the ticket receipt generated from the AUWT token unstaking function.

Below is a step-by-step illustration of the JS code:

Last updated