@theliem/xmarket-sdk 3.1.2 → 3.1.3
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 +7 -10
- package/dist/index.d.ts +7 -10
- package/dist/index.js +20 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -273,28 +273,24 @@ var OracleClient = class {
|
|
|
273
273
|
}
|
|
274
274
|
/**
|
|
275
275
|
* Whitelisted reporter resolves a question.
|
|
276
|
-
*
|
|
277
|
-
* @param conditionPda - CTF condition account (oracle_config = oraclePda, question_id must match)
|
|
278
|
-
* @param ownerPubkey - oracle config owner (defaults to wallet)
|
|
279
|
-
* @param payer - fee payer (defaults to wallet)
|
|
276
|
+
* reporter signs the instruction; payer covers the tx fee (Kora pattern).
|
|
280
277
|
*/
|
|
281
|
-
async resolveQuestion(questionId, outcomeCount, payoutNumerators, conditionPda,
|
|
278
|
+
async resolveQuestion(questionId, outcomeCount, payoutNumerators, conditionPda, reporter = this.walletPubkey, payer = this.walletPubkey, ownerPubkey) {
|
|
282
279
|
const oracleConfig = this.configPda(ownerPubkey);
|
|
283
280
|
const [questionResultPda] = PDA.questionResult(oracleConfig, questionId, this.programIds);
|
|
284
|
-
|
|
281
|
+
return this.program.methods.resolveQuestion(
|
|
285
282
|
Array.from(questionId),
|
|
286
283
|
outcomeCount,
|
|
287
284
|
payoutNumerators.map((n) => new anchor4.BN(n))
|
|
288
285
|
).accounts({
|
|
289
|
-
reporter
|
|
286
|
+
reporter,
|
|
290
287
|
oracleConfig,
|
|
291
288
|
questionResult: questionResultPda,
|
|
292
289
|
condition: conditionPda,
|
|
293
290
|
conditionalTokensProgram: this.programIds.conditionalTokens,
|
|
294
|
-
payer
|
|
291
|
+
payer,
|
|
295
292
|
systemProgram: SystemProgram.programId
|
|
296
|
-
}).
|
|
297
|
-
return { signature: sig };
|
|
293
|
+
}).transaction();
|
|
298
294
|
}
|
|
299
295
|
/** Owner updates the admin. */
|
|
300
296
|
async updateAdmin(newAdmin, ownerPubkey) {
|
|
@@ -1370,8 +1366,8 @@ var ClobClient = class {
|
|
|
1370
1366
|
async _sendLegacyTx(instructions) {
|
|
1371
1367
|
const { connection } = this.provider;
|
|
1372
1368
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1373
|
-
const { Transaction:
|
|
1374
|
-
const tx = new
|
|
1369
|
+
const { Transaction: Transaction7 } = await import('@solana/web3.js');
|
|
1370
|
+
const tx = new Transaction7();
|
|
1375
1371
|
tx.recentBlockhash = blockhash;
|
|
1376
1372
|
tx.feePayer = this.walletPubkey;
|
|
1377
1373
|
tx.add(...instructions);
|
|
@@ -2054,7 +2050,7 @@ var PresaleClient = class {
|
|
|
2054
2050
|
* qtAmount: amount of MST to receive (9 decimals).
|
|
2055
2051
|
* USDC cost = qtAmount * price / 1e9.
|
|
2056
2052
|
*/
|
|
2057
|
-
async buy(presalePda, qtAmount, buyer = this.walletPubkey, payer = this.walletPubkey
|
|
2053
|
+
async buy(presalePda, qtAmount, buyer = this.walletPubkey, payer = this.walletPubkey) {
|
|
2058
2054
|
const presale = await this.fetchPresale(presalePda);
|
|
2059
2055
|
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2060
2056
|
const qtMint = presale.qtMint;
|
|
@@ -2064,7 +2060,7 @@ var PresaleClient = class {
|
|
|
2064
2060
|
const buyerQtAta = getAssociatedTokenAddressSync(qtMint, buyer);
|
|
2065
2061
|
const buyerCurrencyAta = getAssociatedTokenAddressSync(currencyMint, buyer);
|
|
2066
2062
|
const presaleVault = getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2067
|
-
|
|
2063
|
+
return this.program.methods.buy(qtAmount).accounts({
|
|
2068
2064
|
buyer,
|
|
2069
2065
|
payer,
|
|
2070
2066
|
presale: presalePda,
|
|
@@ -2078,14 +2074,13 @@ var PresaleClient = class {
|
|
|
2078
2074
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
2079
2075
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2080
2076
|
systemProgram: SystemProgram.programId
|
|
2081
|
-
}).
|
|
2082
|
-
return { signature: sig };
|
|
2077
|
+
}).transaction();
|
|
2083
2078
|
}
|
|
2084
2079
|
/**
|
|
2085
2080
|
* Refund: burn user's MST and return USDC.
|
|
2086
2081
|
* Only callable when presale status = Rejected.
|
|
2087
2082
|
*/
|
|
2088
|
-
async refund(presalePda, user = this.walletPubkey
|
|
2083
|
+
async refund(presalePda, user = this.walletPubkey) {
|
|
2089
2084
|
const presale = await this.fetchPresale(presalePda);
|
|
2090
2085
|
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2091
2086
|
const qtMint = presale.qtMint;
|
|
@@ -2094,7 +2089,7 @@ var PresaleClient = class {
|
|
|
2094
2089
|
const userQtAta = getAssociatedTokenAddressSync(qtMint, user);
|
|
2095
2090
|
const userCurrencyAta = getAssociatedTokenAddressSync(currencyMint, user);
|
|
2096
2091
|
const presaleVault = getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2097
|
-
|
|
2092
|
+
return this.program.methods.refund().accounts({
|
|
2098
2093
|
user,
|
|
2099
2094
|
presale: presalePda,
|
|
2100
2095
|
qtMint,
|
|
@@ -2106,19 +2101,18 @@ var PresaleClient = class {
|
|
|
2106
2101
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
2107
2102
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2108
2103
|
systemProgram: SystemProgram.programId
|
|
2109
|
-
}).
|
|
2110
|
-
return { signature: sig };
|
|
2104
|
+
}).transaction();
|
|
2111
2105
|
}
|
|
2112
2106
|
/**
|
|
2113
2107
|
* Creator claims their share of presale revenue after distribute_presale_revenue.
|
|
2114
2108
|
*/
|
|
2115
|
-
async claimRevenue(presalePda, creator = this.walletPubkey
|
|
2109
|
+
async claimRevenue(presalePda, creator = this.walletPubkey) {
|
|
2116
2110
|
const presale = await this.fetchPresale(presalePda);
|
|
2117
2111
|
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2118
2112
|
const currencyMint = presale.currencyMint;
|
|
2119
2113
|
const presaleVault = getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2120
2114
|
const creatorCurrencyAta = getAssociatedTokenAddressSync(currencyMint, creator);
|
|
2121
|
-
|
|
2115
|
+
return this.program.methods.claimRevenue().accounts({
|
|
2122
2116
|
creator,
|
|
2123
2117
|
presale: presalePda,
|
|
2124
2118
|
presaleVault,
|
|
@@ -2127,8 +2121,7 @@ var PresaleClient = class {
|
|
|
2127
2121
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
2128
2122
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2129
2123
|
systemProgram: SystemProgram.programId
|
|
2130
|
-
}).
|
|
2131
|
-
return { signature: sig };
|
|
2124
|
+
}).transaction();
|
|
2132
2125
|
}
|
|
2133
2126
|
/**
|
|
2134
2127
|
* Transfer creator_claimable_revenue (80%) to BOTMM wallet.
|
|
@@ -2215,7 +2208,7 @@ var MarketOracleClient = class {
|
|
|
2215
2208
|
* User burns their MST and claims proportional share of oracle vault USDC.
|
|
2216
2209
|
* Call after market.collectTradingFee snapshotted qt supply.
|
|
2217
2210
|
*/
|
|
2218
|
-
async claimFeesShare(marketOraclePda, user = this.walletPubkey, payer = this.walletPubkey
|
|
2211
|
+
async claimFeesShare(marketOraclePda, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
2219
2212
|
const oracle = await this.fetchMarketOracle(marketOraclePda);
|
|
2220
2213
|
if (!oracle) throw new Error(`MarketOracle not found: ${marketOraclePda.toBase58()}`);
|
|
2221
2214
|
const currencyMint = oracle.currencyMint;
|
|
@@ -2224,7 +2217,7 @@ var MarketOracleClient = class {
|
|
|
2224
2217
|
const userQtAta = getAssociatedTokenAddressSync(qtMint, user);
|
|
2225
2218
|
const userCurrencyAta = getAssociatedTokenAddressSync(currencyMint, user);
|
|
2226
2219
|
const userClaimRecord = this.userClaimRecordPda(marketOraclePda, user);
|
|
2227
|
-
|
|
2220
|
+
return this.program.methods.claimFeesShare().accounts({
|
|
2228
2221
|
user,
|
|
2229
2222
|
payer,
|
|
2230
2223
|
marketOracle: marketOraclePda,
|
|
@@ -2237,8 +2230,7 @@ var MarketOracleClient = class {
|
|
|
2237
2230
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
2238
2231
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2239
2232
|
systemProgram: SystemProgram.programId
|
|
2240
|
-
}).
|
|
2241
|
-
return { signature: sig };
|
|
2233
|
+
}).transaction();
|
|
2242
2234
|
}
|
|
2243
2235
|
// ─── Queries ─────────────────────────────────────────────────────────────────
|
|
2244
2236
|
async fetchMarketOracle(marketOraclePda) {
|