Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nftperp/sdk

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nftperp/sdk - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

2

package.json
{
"name": "@nftperp/sdk",
"version": "2.0.5",
"version": "2.0.6",
"description": "SDK for nftperp protocol",

@@ -5,0 +5,0 @@ "main": "sdk.js",

@@ -41,4 +41,4 @@ # nftperp sdk ✨

- `notional` total value of position _margin x leverage_.
- `mark price` nftperp's price of the asset.
- `index price` actual price of the asset. _floor from marketplaces_.
- `mark price` nftperp's price of the amm.
- `index price` actual price of the amm. _floor from marketplaces_.
- `margin ratio` margin to notional ratio.

@@ -84,3 +84,3 @@ - `maintenance margin ratio` minimum margin ratio to be maintained to avoid liquidation.

_note_: _currently limited nft collections are supported. to get a list of supported assets do:_
_note_: _currently limited nft collections are supported. to get a list of supported amms do:_

@@ -121,3 +121,3 @@ ```ts

#### Get asset info
#### Get amm info

@@ -129,3 +129,3 @@ ```ts

{
asset: 'BAYC',
amm: 'BAYC',
markPrice: 82.795,

@@ -132,0 +132,0 @@ indexPrice: 84,

@@ -305,8 +305,12 @@ "use strict";

async _getLiquidationPrice(amm, trader) {
const ratios = await this._getRatios(amm);
const position = await this._getPositionWithFundingPayment(amm, trader);
const reserves = await this._getReserves(amm);
const size = (0, mathUtil_1.fromWei)(position.size);
if (size.eq(0))
return (0, mathUtil_1.toBig)(0);
const mr = (0, mathUtil_1.fromWei)(await this._getMarginRatio(amm, trader));
const leverage = (0, mathUtil_1.toBig)(1).div(mr);
if (leverage.lt(1.0001))
return (0, mathUtil_1.toBig)(0);
const ratios = await this._getRatios(amm);
const reserves = await this._getReserves(amm);
const margin = (0, mathUtil_1.fromWei)(position.margin);

@@ -313,0 +317,0 @@ const openNotional = (0, mathUtil_1.fromWei)(position.openNotional);

@@ -14,3 +14,3 @@ "use strict";

if (!addr) {
(0, commonUtil_1._throw)(`amm ${amm.toString()} does not exist on instance ${instance}`);
(0, commonUtil_1._throw)(`amm ${amm} does not exist on instance ${instance}`);
}

@@ -17,0 +17,0 @@ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc