@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.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1029,6 +1029,11 @@ declare class MarketOracleClient {
|
|
|
1029
1029
|
*/
|
|
1030
1030
|
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
1031
1031
|
fetchMarketOracle(marketOraclePda: PublicKey): Promise<MarketOracleInfo | null>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Derive marketOracleVault from presaleAddress and return its USDS balance.
|
|
1034
|
+
* presaleAddress is used as the questionId seed in the question PDA.
|
|
1035
|
+
*/
|
|
1036
|
+
getOracleVaultBalance(presaleAddress: PublicKey, qmConfigPda: PublicKey, collateralMint: PublicKey): Promise<number>;
|
|
1032
1037
|
fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
|
|
1033
1038
|
}
|
|
1034
1039
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1029,6 +1029,11 @@ declare class MarketOracleClient {
|
|
|
1029
1029
|
*/
|
|
1030
1030
|
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
1031
1031
|
fetchMarketOracle(marketOraclePda: PublicKey): Promise<MarketOracleInfo | null>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Derive marketOracleVault from presaleAddress and return its USDS balance.
|
|
1034
|
+
* presaleAddress is used as the questionId seed in the question PDA.
|
|
1035
|
+
*/
|
|
1036
|
+
getOracleVaultBalance(presaleAddress: PublicKey, qmConfigPda: PublicKey, collateralMint: PublicKey): Promise<number>;
|
|
1032
1037
|
fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
|
|
1033
1038
|
}
|
|
1034
1039
|
|
package/dist/index.js
CHANGED
|
@@ -3586,6 +3586,17 @@ var MarketOracleClient = class {
|
|
|
3586
3586
|
return null;
|
|
3587
3587
|
}
|
|
3588
3588
|
}
|
|
3589
|
+
/**
|
|
3590
|
+
* Derive marketOracleVault from presaleAddress and return its USDS balance.
|
|
3591
|
+
* presaleAddress is used as the questionId seed in the question PDA.
|
|
3592
|
+
*/
|
|
3593
|
+
async getOracleVaultBalance(presaleAddress, qmConfigPda, collateralMint) {
|
|
3594
|
+
const [questionPda] = PDA.question(qmConfigPda, presaleAddress.toBytes(), this.programIds);
|
|
3595
|
+
const [marketOraclePda] = PDA.marketOraclePda(questionPda, this.programIds);
|
|
3596
|
+
const vault = splToken.getAssociatedTokenAddressSync(collateralMint, marketOraclePda, true);
|
|
3597
|
+
const bal = await this.program.provider.connection.getTokenAccountBalance(vault);
|
|
3598
|
+
return bal.value.uiAmount ?? 0;
|
|
3599
|
+
}
|
|
3589
3600
|
async fetchUserClaimRecord(marketOraclePda, user) {
|
|
3590
3601
|
try {
|
|
3591
3602
|
const pda = this.userClaimRecordPda(marketOraclePda, user);
|