Merge branch 'ts-client-2' into dev

This commit is contained in:
microwavedcola1 2023-03-14 09:06:32 +01:00
commit f454a06aa6
5 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@blockworks-foundation/mango-v4", "name": "@blockworks-foundation/mango-v4",
"version": "0.5.25", "version": "0.9.2",
"description": "Typescript Client for mango-v4 program.", "description": "Typescript Client for mango-v4 program.",
"repository": "https://github.com/blockworks-foundation/mango-v4", "repository": "https://github.com/blockworks-foundation/mango-v4",
"author": { "author": {

View File

@ -44,6 +44,7 @@ export class Group {
depositLimitQuote: BN; depositLimitQuote: BN;
ixGate: BN; ixGate: BN;
buybackFeesSwapMangoAccount: PublicKey; buybackFeesSwapMangoAccount: PublicKey;
buybackFeesExpiryInterval: BN;
}, },
): Group { ): Group {
return new Group( return new Group(
@ -64,6 +65,7 @@ export class Group {
obj.depositLimitQuote, obj.depositLimitQuote,
obj.ixGate, obj.ixGate,
obj.buybackFeesSwapMangoAccount, obj.buybackFeesSwapMangoAccount,
obj.buybackFeesExpiryInterval,
[], // addressLookupTablesList [], // addressLookupTablesList
new Map(), // banksMapByName new Map(), // banksMapByName
new Map(), // banksMapByMint new Map(), // banksMapByMint
@ -98,6 +100,7 @@ export class Group {
public depositLimitQuote, public depositLimitQuote,
public ixGate: BN, public ixGate: BN,
public buybackFeesSwapMangoAccount: PublicKey, public buybackFeesSwapMangoAccount: PublicKey,
public buybackFeesExpiryInterval: BN,
public addressLookupTablesList: AddressLookupTableAccount[], public addressLookupTablesList: AddressLookupTableAccount[],
public banksMapByName: Map<string, Bank[]>, public banksMapByName: Map<string, Bank[]>,
public banksMapByMint: Map<string, Bank[]>, public banksMapByMint: Map<string, Bank[]>,

View File

@ -869,7 +869,7 @@ export class MangoAccount {
const hc = HealthCache.fromMangoAccount(group, this); const hc = HealthCache.fromMangoAccount(group, this);
const baseLots = hc.getMaxPerpForHealthRatio( const baseLots = hc.getMaxPerpForHealthRatio(
perpMarket, perpMarket,
I80F48.fromNumber(perpMarket.uiPrice), perpMarket.price,
PerpOrderSide.bid, PerpOrderSide.bid,
I80F48.fromNumber(2), I80F48.fromNumber(2),
); );
@ -896,7 +896,7 @@ export class MangoAccount {
const hc = HealthCache.fromMangoAccount(group, this); const hc = HealthCache.fromMangoAccount(group, this);
const baseLots = hc.getMaxPerpForHealthRatio( const baseLots = hc.getMaxPerpForHealthRatio(
perpMarket, perpMarket,
I80F48.fromNumber(perpMarket.uiPrice), perpMarket.price,
PerpOrderSide.ask, PerpOrderSide.ask,
I80F48.fromNumber(2), I80F48.fromNumber(2),
); );
@ -919,7 +919,7 @@ export class MangoAccount {
: PerpPosition.emptyFromPerpMarketIndex(perpMarket.perpMarketIndex), : PerpPosition.emptyFromPerpMarketIndex(perpMarket.perpMarketIndex),
PerpOrderSide.bid, PerpOrderSide.bid,
perpMarket.uiBaseToLots(size), perpMarket.uiBaseToLots(size),
I80F48.fromNumber(perpMarket.uiPrice), perpMarket.price,
HealthType.init, HealthType.init,
) )
.toNumber(); .toNumber();
@ -941,7 +941,7 @@ export class MangoAccount {
: PerpPosition.emptyFromPerpMarketIndex(perpMarket.perpMarketIndex), : PerpPosition.emptyFromPerpMarketIndex(perpMarket.perpMarketIndex),
PerpOrderSide.ask, PerpOrderSide.ask,
perpMarket.uiBaseToLots(size), perpMarket.uiBaseToLots(size),
I80F48.fromNumber(perpMarket.uiPrice), perpMarket.price,
HealthType.init, HealthType.init,
) )
.toNumber(); .toNumber();

View File

@ -1,6 +1,7 @@
{ {
"extends": "./tsconfig", "extends": "./tsconfig",
"compilerOptions": { "compilerOptions": {
"noEmit": false,
"outDir": "./dist/types", "outDir": "./dist/types",
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,

View File

@ -2473,7 +2473,7 @@ tsutils@^3.21.0:
dependencies: dependencies:
tslib "^1.8.1" tslib "^1.8.1"
tweetnacl@^1.0.3: tweetnacl@^1.0.0, tweetnacl@^1.0.3:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596"
integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==