Guides

Quick Start

The full SDK is free to use and open-source, currently available in the following languages:

  • Typescript / Javascript

💡 The full SDK can be used trustlessly to execute any action or query any data from the protocol.

To get started just install the latest stable version of the package with,

yarn install "@premia/v3-sdk-public"

Then use the following code to get started with the minimal setup,

API_KEY = '<infura-api-key>'
PRIVATE_KEY = '<private-key>'

premia = await Premia.initialize({
    provider: `https://arbitrum-mainnet.infura.io/v3/${API_KEY}`,
    chainId: SupportedChainId.ARBITRUM,
    privateKey: PRIVATE_KEY
})

The Premia v3 SDK is meant to be an all-in-one solution, just instantiate the Premia object and you will have access to the following:

Walkthrough

Making Trades

First, we want to initialize the SDK with the proper configuration

Then we need to query the subgraph to see what pools are deployed because this will dictate which listings we end up selecting to get a quote for.

Now that we have a list of available pools, we can filter and sort through them to find out in particular which pools are closest to the strike, maturity, and option type we are aiming for. For the sake of the example, however, we are just going to pick the first pool to demonstrate how to obtain a quote.

Now that we have our quote and it seems like it fits our target price range, let's send the transaction and make the trade.

There you have it, we've made our first trade on Premia!

API Reference

Detailed API documentation is available herearrow-up-right.

Last updated

Was this helpful?