Socket
Socket
Sign inDemoInstall

@blockworks-foundation/mango-v4

Package Overview
Dependencies
Maintainers
7
Versions
239
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockworks-foundation/mango-v4 - npm Package Compare versions

Comparing version 0.16.4 to 0.16.5

14

dist/cjs/src/accounts/mangoAccount.d.ts

@@ -361,3 +361,3 @@ /// <reference types="bn.js" />

isActive(): boolean;
getBasePositionNative(perpMarket: PerpMarket): I80F48;
getBasePosition(perpMarket: PerpMarket): I80F48;
getBasePositionUi(perpMarket: PerpMarket, useEventQueue?: boolean): number;

@@ -368,4 +368,4 @@ getQuotePositionUi(perpMarket: PerpMarket, useEventQueue?: boolean): number;

getUnsettledFundingUi(perpMarket: PerpMarket): number;
getEquity(perpMarket: PerpMarket): I80F48;
getEquityUi(perpMarket: PerpMarket): number;
getEquity(perpMarket: PerpMarket): I80F48;
hasOpenOrders(): boolean;

@@ -375,11 +375,13 @@ getAverageEntryPrice(perpMarket: PerpMarket): I80F48;

getBreakEvenPriceUi(perpMarket: PerpMarket): number;
cumulativePnlOverPositionLifetimeUi(perpMarket: PerpMarket): number;
getUnsettledPnl(perpMarket: PerpMarket): I80F48;
getUnsettledPnlUi(perpMarket: PerpMarket): number;
canSettlePnl(group: Group, perpMarket: PerpMarket, account: MangoAccount): boolean;
updateSettleLimit(perpMarket: PerpMarket): void;
availableSettleLimit(perpMarket: PerpMarket): [BN, BN];
applyPnlSettleLimit(pnl: I80F48, perpMarket: PerpMarket): I80F48;
getUnsettledPnl(perpMarket: PerpMarket): I80F48;
getUnsettledPnlUi(perpMarket: PerpMarket): number;
getSettleablePnl(group: Group, perpMarket: PerpMarket, account: MangoAccount): I80F48;
getSettleablePnlUi(group: Group, perpMarket: PerpMarket, account: MangoAccount): number;
canSettlePnl(group: Group, perpMarket: PerpMarket, account: MangoAccount): boolean;
cumulativePnlOverPositionLifetimeUi(perpMarket: PerpMarket): number;
getUnRealizedPnlUi(perpMarket: PerpMarket): number;
getRealizedPnlUi(): number;
toString(perpMarket?: PerpMarket): string;

@@ -386,0 +388,0 @@ }

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

}
getBasePositionNative(perpMarket) {
getBasePosition(perpMarket) {
return I80F48_1.I80F48.fromI64(this.basePositionLots.mul(perpMarket.baseLotSize));

@@ -940,8 +940,2 @@ }

}
getEquityUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
return (0, utils_1.toUiDecimalsForQuote)(this.getEquity(perpMarket));
}
getEquity(perpMarket) {

@@ -960,2 +954,8 @@ if (perpMarket.perpMarketIndex !== this.marketIndex) {

}
getEquityUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
return (0, utils_1.toUiDecimalsForQuote)(this.getEquity(perpMarket));
}
hasOpenOrders() {

@@ -984,18 +984,5 @@ const zero = new anchor_1.BN(0);

}
cumulativePnlOverPositionLifetimeUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
const priceChange = perpMarket.price.sub(this.getAverageEntryPrice(perpMarket));
return (0, utils_1.toUiDecimalsForQuote)(this.realizedPnlForPositionNative.add(this.getBasePositionNative(perpMarket).mul(priceChange)));
canSettlePnl(group, perpMarket, account) {
return !this.getSettleablePnl(group, perpMarket, account).eq((0, I80F48_1.ZERO_I80F48)());
}
getUnsettledPnl(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
return this.quotePositionNative.add(this.getBasePositionNative(perpMarket).mul(perpMarket.price));
}
getUnsettledPnlUi(perpMarket) {
return (0, utils_1.toUiDecimalsForQuote)(this.getUnsettledPnl(perpMarket));
}
updateSettleLimit(perpMarket) {

@@ -1061,2 +1048,11 @@ if (perpMarket.perpMarketIndex !== this.marketIndex) {

}
getUnsettledPnl(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
return this.quotePositionNative.add(this.getBasePosition(perpMarket).mul(perpMarket.price));
}
getUnsettledPnlUi(perpMarket) {
return (0, utils_1.toUiDecimalsForQuote)(this.getUnsettledPnl(perpMarket));
}
getSettleablePnl(group, perpMarket, account) {

@@ -1077,5 +1073,19 @@ if (perpMarket.perpMarketIndex !== this.marketIndex) {

}
canSettlePnl(group, perpMarket, account) {
return !this.getSettleablePnl(group, perpMarket, account).eq((0, I80F48_1.ZERO_I80F48)());
cumulativePnlOverPositionLifetimeUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
const priceChange = perpMarket.price.sub(this.getAverageEntryPrice(perpMarket));
return (0, utils_1.toUiDecimalsForQuote)(this.realizedPnlForPositionNative.add(this.getBasePosition(perpMarket).mul(priceChange)));
}
getUnRealizedPnlUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
const priceChange = perpMarket.price.sub(this.getAverageEntryPrice(perpMarket));
return (0, utils_1.toUiDecimalsForQuote)(this.getBasePosition(perpMarket).mul(priceChange));
}
getRealizedPnlUi() {
return (0, utils_1.toUiDecimalsForQuote)(this.realizedPnlForPositionNative);
}
toString(perpMarket) {

@@ -1082,0 +1092,0 @@ return perpMarket

@@ -889,3 +889,3 @@ import { BN } from '@coral-xyz/anchor';

}
getBasePositionNative(perpMarket) {
getBasePosition(perpMarket) {
return I80F48.fromI64(this.basePositionLots.mul(perpMarket.baseLotSize));

@@ -932,8 +932,2 @@ }

}
getEquityUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
return toUiDecimalsForQuote(this.getEquity(perpMarket));
}
getEquity(perpMarket) {

@@ -952,2 +946,8 @@ if (perpMarket.perpMarketIndex !== this.marketIndex) {

}
getEquityUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
return toUiDecimalsForQuote(this.getEquity(perpMarket));
}
hasOpenOrders() {

@@ -976,18 +976,5 @@ const zero = new BN(0);

}
cumulativePnlOverPositionLifetimeUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
const priceChange = perpMarket.price.sub(this.getAverageEntryPrice(perpMarket));
return toUiDecimalsForQuote(this.realizedPnlForPositionNative.add(this.getBasePositionNative(perpMarket).mul(priceChange)));
canSettlePnl(group, perpMarket, account) {
return !this.getSettleablePnl(group, perpMarket, account).eq(ZERO_I80F48());
}
getUnsettledPnl(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
return this.quotePositionNative.add(this.getBasePositionNative(perpMarket).mul(perpMarket.price));
}
getUnsettledPnlUi(perpMarket) {
return toUiDecimalsForQuote(this.getUnsettledPnl(perpMarket));
}
updateSettleLimit(perpMarket) {

@@ -1053,2 +1040,11 @@ if (perpMarket.perpMarketIndex !== this.marketIndex) {

}
getUnsettledPnl(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
return this.quotePositionNative.add(this.getBasePosition(perpMarket).mul(perpMarket.price));
}
getUnsettledPnlUi(perpMarket) {
return toUiDecimalsForQuote(this.getUnsettledPnl(perpMarket));
}
getSettleablePnl(group, perpMarket, account) {

@@ -1069,5 +1065,19 @@ if (perpMarket.perpMarketIndex !== this.marketIndex) {

}
canSettlePnl(group, perpMarket, account) {
return !this.getSettleablePnl(group, perpMarket, account).eq(ZERO_I80F48());
cumulativePnlOverPositionLifetimeUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
const priceChange = perpMarket.price.sub(this.getAverageEntryPrice(perpMarket));
return toUiDecimalsForQuote(this.realizedPnlForPositionNative.add(this.getBasePosition(perpMarket).mul(priceChange)));
}
getUnRealizedPnlUi(perpMarket) {
if (perpMarket.perpMarketIndex !== this.marketIndex) {
throw new Error("PerpPosition doesn't belong to the given market!");
}
const priceChange = perpMarket.price.sub(this.getAverageEntryPrice(perpMarket));
return toUiDecimalsForQuote(this.getBasePosition(perpMarket).mul(priceChange));
}
getRealizedPnlUi() {
return toUiDecimalsForQuote(this.realizedPnlForPositionNative);
}
toString(perpMarket) {

@@ -1074,0 +1084,0 @@ return perpMarket

@@ -361,3 +361,3 @@ /// <reference types="bn.js" />

isActive(): boolean;
getBasePositionNative(perpMarket: PerpMarket): I80F48;
getBasePosition(perpMarket: PerpMarket): I80F48;
getBasePositionUi(perpMarket: PerpMarket, useEventQueue?: boolean): number;

@@ -368,4 +368,4 @@ getQuotePositionUi(perpMarket: PerpMarket, useEventQueue?: boolean): number;

getUnsettledFundingUi(perpMarket: PerpMarket): number;
getEquity(perpMarket: PerpMarket): I80F48;
getEquityUi(perpMarket: PerpMarket): number;
getEquity(perpMarket: PerpMarket): I80F48;
hasOpenOrders(): boolean;

@@ -375,11 +375,13 @@ getAverageEntryPrice(perpMarket: PerpMarket): I80F48;

getBreakEvenPriceUi(perpMarket: PerpMarket): number;
cumulativePnlOverPositionLifetimeUi(perpMarket: PerpMarket): number;
getUnsettledPnl(perpMarket: PerpMarket): I80F48;
getUnsettledPnlUi(perpMarket: PerpMarket): number;
canSettlePnl(group: Group, perpMarket: PerpMarket, account: MangoAccount): boolean;
updateSettleLimit(perpMarket: PerpMarket): void;
availableSettleLimit(perpMarket: PerpMarket): [BN, BN];
applyPnlSettleLimit(pnl: I80F48, perpMarket: PerpMarket): I80F48;
getUnsettledPnl(perpMarket: PerpMarket): I80F48;
getUnsettledPnlUi(perpMarket: PerpMarket): number;
getSettleablePnl(group: Group, perpMarket: PerpMarket, account: MangoAccount): I80F48;
getSettleablePnlUi(group: Group, perpMarket: PerpMarket, account: MangoAccount): number;
canSettlePnl(group: Group, perpMarket: PerpMarket, account: MangoAccount): boolean;
cumulativePnlOverPositionLifetimeUi(perpMarket: PerpMarket): number;
getUnRealizedPnlUi(perpMarket: PerpMarket): number;
getRealizedPnlUi(): number;
toString(perpMarket?: PerpMarket): string;

@@ -386,0 +388,0 @@ }

{
"name": "@blockworks-foundation/mango-v4",
"version": "0.16.4",
"version": "0.16.5",
"description": "Typescript Client for mango-v4 program.",

@@ -5,0 +5,0 @@ "repository": "https://github.com/blockworks-foundation/mango-v4",

Sorry, the diff of this file is not supported yet

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