From a2a4e2d68941ef18f457e102a172590e20aae682 Mon Sep 17 00:00:00 2001 From: Vincent Brunet Date: Wed, 23 Aug 2023 21:56:13 +0900 Subject: [PATCH] published --- package-lock.json | 4 ++-- package.json | 2 +- src/credix_lp/credixIdl.ts | 2 +- src/credix_lp/depository.ts | 12 ++++++------ src/mercurial/utils.ts | 3 +++ 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 92a49ae..7c7f4f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@uxd-protocol/uxd-client", - "version": "8.1.4-rc5", + "version": "8.1.4-rc6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@uxd-protocol/uxd-client", - "version": "8.1.4-rc5", + "version": "8.1.4-rc6", "license": "MIT", "dependencies": { "@project-serum/anchor": "0.26.0", diff --git a/package.json b/package.json index 524b4cd..aa5c841 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@uxd-protocol/uxd-client", - "version": "8.1.4-rc5", + "version": "8.1.4-rc6", "description": "JavaScript Client for the UXD Solana Program", "keywords": [ "solana", diff --git a/src/credix_lp/credixIdl.ts b/src/credix_lp/credixIdl.ts index a41a410..da358e6 100644 --- a/src/credix_lp/credixIdl.ts +++ b/src/credix_lp/credixIdl.ts @@ -9901,7 +9901,7 @@ export type Credix = { } ]; }; -export const IDL = { +export const IDL: Credix = { version: '3.11.0', name: 'credix', instructions: [ diff --git a/src/credix_lp/depository.ts b/src/credix_lp/depository.ts index fcae418..1ec9d40 100644 --- a/src/credix_lp/depository.ts +++ b/src/credix_lp/depository.ts @@ -329,7 +329,7 @@ export class CredixLpDepository { ); if (!credixGlobalMarketStateAccount) { throw new Error( - 'Could not read credixGlobalMarketState account:' + + 'Could not read credixGlobalMarketState account: ' + credixGlobalMarketState.toString() ); } @@ -346,7 +346,7 @@ export class CredixLpDepository { ); if (!credixProgramStateAccount) { throw new Error( - 'Could not read credixProgramState account:' + + 'Could not read credixProgramState account: ' + credixProgramState.toString() ); } @@ -361,7 +361,7 @@ export class CredixLpDepository { await credixProgram.account.credixPass.fetchNullable(credixPass); if (!credixPassAccount) { throw new Error( - 'Could not read credixPass account:' + credixPass.toString() + 'Could not read credixPass account: ' + credixPass.toString() ); } return credixPassAccount; @@ -377,7 +377,7 @@ export class CredixLpDepository { ); if (!credixWithdrawEpochAccount) { throw new Error( - 'Could not read credixWithdrawEpoch account:' + + 'Could not read credixWithdrawEpoch account: ' + credixWithdrawEpoch.toString() ); } @@ -394,7 +394,7 @@ export class CredixLpDepository { ); if (!credixWithdrawRequestAccount) { throw new Error( - 'Could not read credixWithdrawRequest account:' + + 'Could not read credixWithdrawRequest account: ' + credixWithdrawRequest.toString() ); } @@ -408,7 +408,7 @@ export class CredixLpDepository { const collateralMintData = await getMint(connection, collateralMint); if (!collateralMintData) { throw new Error( - 'Could not read collateralMint account:' + collateralMint.toString() + 'Could not read collateralMint account: ' + collateralMint.toString() ); } return collateralMintData.decimals; diff --git a/src/mercurial/utils.ts b/src/mercurial/utils.ts index cefc93b..c752891 100644 --- a/src/mercurial/utils.ts +++ b/src/mercurial/utils.ts @@ -26,6 +26,9 @@ export function getAmountByShare( withdrawableAmount: BN, totalSupply: BN ): BN { + if (totalSupply.isZero()) { + return new BN(0); + } return share.mul(withdrawableAmount).div(totalSupply); }