@kamino-finance/kliquidity-sdk 8.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Kamino.d.ts +5 -0
- package/dist/Kamino.d.ts.map +1 -1
- package/dist/Kamino.js +13 -0
- package/dist/Kamino.js.map +1 -1
- package/package.json +1 -1
- package/src/Kamino.ts +14 -0
package/package.json
CHANGED
package/src/Kamino.ts
CHANGED
|
@@ -1379,6 +1379,20 @@ export class Kamino {
|
|
|
1379
1379
|
}
|
|
1380
1380
|
};
|
|
1381
1381
|
|
|
1382
|
+
/**
|
|
1383
|
+
* Get the token A and B per share for the specified Kamino whirlpool strategy
|
|
1384
|
+
* @param strategy
|
|
1385
|
+
*/
|
|
1386
|
+
getTokenAAndBPerShare = async (strategy: Address | StrategyWithAddress): Promise<TokenAmounts> => {
|
|
1387
|
+
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
1388
|
+
const sharesIssued = new Decimal(strategyState.strategy.sharesIssued.toString());
|
|
1389
|
+
const balances = await this.getStrategyBalances(strategyState.strategy);
|
|
1390
|
+
if (sharesIssued.isZero()) {
|
|
1391
|
+
return { a: new Decimal(0), b: new Decimal(0) };
|
|
1392
|
+
}
|
|
1393
|
+
return { a: balances.tokenAAmounts.div(sharesIssued), b: balances.tokenBAmounts.div(sharesIssued) };
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1382
1396
|
/**
|
|
1383
1397
|
* Batch fetch share data for all or a filtered list of strategies
|
|
1384
1398
|
* @param strategyFilters strategy filters or a list of strategy public keys
|