@theliem/xmarket-sdk 3.26.0 → 3.27.0

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/index.mjs CHANGED
@@ -3560,6 +3560,17 @@ var MarketOracleClient = class {
3560
3560
  return null;
3561
3561
  }
3562
3562
  }
3563
+ /**
3564
+ * Derive marketOracleVault from presaleAddress and return its USDS balance.
3565
+ * presaleAddress is used as the questionId seed in the question PDA.
3566
+ */
3567
+ async getOracleVaultBalance(presaleAddress, qmConfigPda, collateralMint) {
3568
+ const [questionPda] = PDA.question(qmConfigPda, presaleAddress.toBytes(), this.programIds);
3569
+ const [marketOraclePda] = PDA.marketOraclePda(questionPda, this.programIds);
3570
+ const vault = getAssociatedTokenAddressSync(collateralMint, marketOraclePda, true);
3571
+ const bal = await this.program.provider.connection.getTokenAccountBalance(vault);
3572
+ return bal.value.uiAmount ?? 0;
3573
+ }
3563
3574
  async fetchUserClaimRecord(marketOraclePda, user) {
3564
3575
  try {
3565
3576
  const pda = this.userClaimRecordPda(marketOraclePda, user);