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,
Then use the following code to get started with the minimal setup,
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:
analytics, query analytics information from the subgraph
contracts, find access to the
Contract
types for each of Premia's main contracts.options, an aggregator for different sources of liquidity.
orders, provide and fill quotes through the orderbook (requires an API key).
pools, interact with all functionalities related to the option pools.
pricing, compare prices of different quotes
tokens, query information about tokens in relation to the pools from the subgraph
pairs, query information about token pairs in relation to the pools from the subgraph
transactions, query information about generic/vault transactions made on the protocol via the subgraph
users, query user information via the subgraph
vaults, interact with all functionalities related to the vaults.
vxPremia, interact with all functionalities related to the vxPremia such as vault votes, user stakes, stake histories, and voting histories.
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 here.
Last updated