@sovryn/perpetual-swap
v5.0.4
Published
Install the package Read the [Whitepaper](https://github.com/DistributedCollective/sovryn-perpetual-swap/blob/main/docs/SovrynPerpetualsV1_1.9.pdf).
Downloads
21
Keywords
Readme
Usage
Install the package Read the Whitepaper.
$ npm install --save @sovryn/perpetual-swap
Then in your script:
import { perpQueries, perpUtils } from "@sovryn/perpetual-swap";
And to use the functions from, let's say, scripts/utils/perpQueries.ts
:
const { queryTraderState, queryAMMState, queryPerpParameters } = perpQueries;
The same works for the rest of the files:
const { getMarkPrice } = perpUtils;
- See here the docs for the functions exported by
perpUtils
. - See here the docs for the functions exported by
perpQueries
. - See here the docs for the functions exported by
perpMath
. - See here the docs for the functions exported by
walletUtils
.
Observation
In order to use walletUtils
(only works on the backend. It doesn't work in UI because it needs to read the ABIs from disk) you'll have to import it like this:
import * as walletUtils from '@sovryn/perpetual-swap/dist/scripts/utils/walletUtils';