pinpet-sdk 2.1.30 → 2.1.32

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.
@@ -70,6 +70,12 @@ class ChainModule {
70
70
  * @returns {string} returns.poolTokenAccount - Pool token account address, stores tokens in the liquidity pool
71
71
  * @returns {string} returns.poolSolAccount - Pool SOL account address, stores native SOL in the liquidity pool
72
72
  *
73
+ * **Token Supply Information:**
74
+ * @returns {bigint} returns.totalSupply - Total token supply (smallest unit)
75
+ * @returns {number} returns.decimals - Token decimal places
76
+ * @returns {bigint} returns.initialBorrowPool - Initial borrow pool size = totalSupply - initialVirtualToken
77
+ * @returns {bigint} returns.circulatingSupply - Circulating supply = totalSupply - borrowTokenReserve
78
+ *
73
79
  * **Balance Information:**
74
80
  * @returns {number} returns.baseFeeRecipientBalance - SOL balance of base fee recipient address (lamports)
75
81
  * @returns {number} returns.feeRecipientBalance - SOL balance of fee recipient address (lamports)
@@ -236,18 +242,21 @@ class ChainModule {
236
242
  let feeRecipientBalance = 0;
237
243
  let poolTokenBalance = { value: { amount: '0' } };
238
244
  let poolSolBalance = 0;
245
+ let tokenSupply = { value: { amount: '0', decimals: 0 } };
239
246
 
240
247
  if (!skipBalances) {
241
248
  [
242
249
  baseFeeRecipientBalance,
243
250
  feeRecipientBalance,
244
251
  poolTokenBalance,
245
- poolSolBalance
252
+ poolSolBalance,
253
+ tokenSupply
246
254
  ] = await Promise.all([
247
255
  this.sdk.connection.getBalance(decodedData.baseFeeRecipient),
248
256
  this.sdk.connection.getBalance(decodedData.feeRecipient),
249
257
  this.sdk.connection.getTokenAccountBalance(poolTokenAccountPDA).catch(() => ({ value: { amount: '0' } })),
250
- this.sdk.connection.getBalance(poolSolAccountPDA)
258
+ this.sdk.connection.getBalance(poolSolAccountPDA),
259
+ this.sdk.connection.getTokenSupply(mintPubkey)
251
260
  ]);
252
261
  }
253
262
 
@@ -288,6 +297,13 @@ class ChainModule {
288
297
  poolType: decodedData.poolType, // u8, 0=普通版, 1=高级版
289
298
  borrowPoolRatio: decodedData.borrowPoolRatio, // u8, 5-30表示5%-30%
290
299
 
300
+ // Token Supply 信息
301
+ totalSupply: BigInt(tokenSupply.value.amount),
302
+ decimals: tokenSupply.value.decimals,
303
+ initialBorrowPool: BigInt(tokenSupply.value.amount) - BigInt(decodedData.initialVirtualToken.toString()),
304
+ circulatingSupply: BigInt(decodedData.initialVirtualToken.toString())
305
+ + (BigInt(tokenSupply.value.amount) - BigInt(decodedData.initialVirtualToken.toString()) - BigInt(decodedData.borrowTokenReserve.toString())),
306
+
291
307
  // SOL balance information
292
308
  baseFeeRecipientBalance: baseFeeRecipientBalance, // Unit: lamports
293
309
  feeRecipientBalance: feeRecipientBalance, // Unit: lamports