@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as anchor from '@coral-xyz/anchor';
2
2
  import * as _solana_web3_js from '@solana/web3.js';
3
- import { PublicKey, Keypair, Transaction, TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js';
3
+ import { PublicKey, Transaction, Keypair, TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js';
4
4
  import BN from 'bn.js';
5
5
 
6
6
  interface ProgramIds {
@@ -247,12 +247,9 @@ declare class OracleClient {
247
247
  removeFromWhitelist(address: PublicKey, ownerPubkey?: PublicKey): Promise<TxResult>;
248
248
  /**
249
249
  * Whitelisted reporter resolves a question.
250
- * CPIs directly into CTF.set_payout condition is resolved in one tx.
251
- * @param conditionPda - CTF condition account (oracle_config = oraclePda, question_id must match)
252
- * @param ownerPubkey - oracle config owner (defaults to wallet)
253
- * @param payer - fee payer (defaults to wallet)
250
+ * reporter signs the instruction; payer covers the tx fee (Kora pattern).
254
251
  */
255
- resolveQuestion(questionId: Uint8Array, outcomeCount: number, payoutNumerators: number[], conditionPda: PublicKey, ownerPubkey?: PublicKey, payer?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
252
+ resolveQuestion(questionId: Uint8Array, outcomeCount: number, payoutNumerators: number[], conditionPda: PublicKey, reporter?: PublicKey, payer?: PublicKey, ownerPubkey?: PublicKey): Promise<Transaction>;
256
253
  /** Owner updates the admin. */
257
254
  updateAdmin(newAdmin: PublicKey, ownerPubkey?: PublicKey): Promise<TxResult>;
258
255
  /** Owner transfers ownership to a new keypair. */
@@ -715,16 +712,16 @@ declare class PresaleClient {
715
712
  * qtAmount: amount of MST to receive (9 decimals).
716
713
  * USDC cost = qtAmount * price / 1e9.
717
714
  */
718
- buy(presalePda: PublicKey, qtAmount: anchor.BN, buyer?: PublicKey, payer?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
715
+ buy(presalePda: PublicKey, qtAmount: anchor.BN, buyer?: PublicKey, payer?: PublicKey): Promise<Transaction>;
719
716
  /**
720
717
  * Refund: burn user's MST and return USDC.
721
718
  * Only callable when presale status = Rejected.
722
719
  */
723
- refund(presalePda: PublicKey, user?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
720
+ refund(presalePda: PublicKey, user?: PublicKey): Promise<Transaction>;
724
721
  /**
725
722
  * Creator claims their share of presale revenue after distribute_presale_revenue.
726
723
  */
727
- claimRevenue(presalePda: PublicKey, creator?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
724
+ claimRevenue(presalePda: PublicKey, creator?: PublicKey): Promise<Transaction>;
728
725
  /**
729
726
  * Transfer creator_claimable_revenue (80%) to BOTMM wallet.
730
727
  * Call after collectPresaleRevenue (distribute_presale_revenue).
@@ -764,7 +761,7 @@ declare class MarketOracleClient {
764
761
  * User burns their MST and claims proportional share of oracle vault USDC.
765
762
  * Call after market.collectTradingFee snapshotted qt supply.
766
763
  */
767
- claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
764
+ claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
768
765
  fetchMarketOracle(marketOraclePda: PublicKey): Promise<MarketOracleInfo | null>;
769
766
  fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
770
767
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as anchor from '@coral-xyz/anchor';
2
2
  import * as _solana_web3_js from '@solana/web3.js';
3
- import { PublicKey, Keypair, Transaction, TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js';
3
+ import { PublicKey, Transaction, Keypair, TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js';
4
4
  import BN from 'bn.js';
5
5
 
6
6
  interface ProgramIds {
@@ -247,12 +247,9 @@ declare class OracleClient {
247
247
  removeFromWhitelist(address: PublicKey, ownerPubkey?: PublicKey): Promise<TxResult>;
248
248
  /**
249
249
  * Whitelisted reporter resolves a question.
250
- * CPIs directly into CTF.set_payout condition is resolved in one tx.
251
- * @param conditionPda - CTF condition account (oracle_config = oraclePda, question_id must match)
252
- * @param ownerPubkey - oracle config owner (defaults to wallet)
253
- * @param payer - fee payer (defaults to wallet)
250
+ * reporter signs the instruction; payer covers the tx fee (Kora pattern).
254
251
  */
255
- resolveQuestion(questionId: Uint8Array, outcomeCount: number, payoutNumerators: number[], conditionPda: PublicKey, ownerPubkey?: PublicKey, payer?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
252
+ resolveQuestion(questionId: Uint8Array, outcomeCount: number, payoutNumerators: number[], conditionPda: PublicKey, reporter?: PublicKey, payer?: PublicKey, ownerPubkey?: PublicKey): Promise<Transaction>;
256
253
  /** Owner updates the admin. */
257
254
  updateAdmin(newAdmin: PublicKey, ownerPubkey?: PublicKey): Promise<TxResult>;
258
255
  /** Owner transfers ownership to a new keypair. */
@@ -715,16 +712,16 @@ declare class PresaleClient {
715
712
  * qtAmount: amount of MST to receive (9 decimals).
716
713
  * USDC cost = qtAmount * price / 1e9.
717
714
  */
718
- buy(presalePda: PublicKey, qtAmount: anchor.BN, buyer?: PublicKey, payer?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
715
+ buy(presalePda: PublicKey, qtAmount: anchor.BN, buyer?: PublicKey, payer?: PublicKey): Promise<Transaction>;
719
716
  /**
720
717
  * Refund: burn user's MST and return USDC.
721
718
  * Only callable when presale status = Rejected.
722
719
  */
723
- refund(presalePda: PublicKey, user?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
720
+ refund(presalePda: PublicKey, user?: PublicKey): Promise<Transaction>;
724
721
  /**
725
722
  * Creator claims their share of presale revenue after distribute_presale_revenue.
726
723
  */
727
- claimRevenue(presalePda: PublicKey, creator?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
724
+ claimRevenue(presalePda: PublicKey, creator?: PublicKey): Promise<Transaction>;
728
725
  /**
729
726
  * Transfer creator_claimable_revenue (80%) to BOTMM wallet.
730
727
  * Call after collectPresaleRevenue (distribute_presale_revenue).
@@ -764,7 +761,7 @@ declare class MarketOracleClient {
764
761
  * User burns their MST and claims proportional share of oracle vault USDC.
765
762
  * Call after market.collectTradingFee snapshotted qt supply.
766
763
  */
767
- claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
764
+ claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
768
765
  fetchMarketOracle(marketOraclePda: PublicKey): Promise<MarketOracleInfo | null>;
769
766
  fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
770
767
  }
package/dist/index.js CHANGED
@@ -307,28 +307,24 @@ var OracleClient = class {
307
307
  }
308
308
  /**
309
309
  * Whitelisted reporter resolves a question.
310
- * CPIs directly into CTF.set_payout condition is resolved in one tx.
311
- * @param conditionPda - CTF condition account (oracle_config = oraclePda, question_id must match)
312
- * @param ownerPubkey - oracle config owner (defaults to wallet)
313
- * @param payer - fee payer (defaults to wallet)
310
+ * reporter signs the instruction; payer covers the tx fee (Kora pattern).
314
311
  */
315
- async resolveQuestion(questionId, outcomeCount, payoutNumerators, conditionPda, ownerPubkey, payer, signers = []) {
312
+ async resolveQuestion(questionId, outcomeCount, payoutNumerators, conditionPda, reporter = this.walletPubkey, payer = this.walletPubkey, ownerPubkey) {
316
313
  const oracleConfig = this.configPda(ownerPubkey);
317
314
  const [questionResultPda] = PDA.questionResult(oracleConfig, questionId, this.programIds);
318
- const sig = await this.program.methods.resolveQuestion(
315
+ return this.program.methods.resolveQuestion(
319
316
  Array.from(questionId),
320
317
  outcomeCount,
321
318
  payoutNumerators.map((n) => new anchor4__namespace.BN(n))
322
319
  ).accounts({
323
- reporter: this.walletPubkey,
320
+ reporter,
324
321
  oracleConfig,
325
322
  questionResult: questionResultPda,
326
323
  condition: conditionPda,
327
324
  conditionalTokensProgram: this.programIds.conditionalTokens,
328
- payer: payer ?? this.walletPubkey,
325
+ payer,
329
326
  systemProgram: web3_js.SystemProgram.programId
330
- }).signers(signers).rpc();
331
- return { signature: sig };
327
+ }).transaction();
332
328
  }
333
329
  /** Owner updates the admin. */
334
330
  async updateAdmin(newAdmin, ownerPubkey) {
@@ -1404,8 +1400,8 @@ var ClobClient = class {
1404
1400
  async _sendLegacyTx(instructions) {
1405
1401
  const { connection } = this.provider;
1406
1402
  const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
1407
- const { Transaction: Transaction5 } = await import('@solana/web3.js');
1408
- const tx = new Transaction5();
1403
+ const { Transaction: Transaction7 } = await import('@solana/web3.js');
1404
+ const tx = new Transaction7();
1409
1405
  tx.recentBlockhash = blockhash;
1410
1406
  tx.feePayer = this.walletPubkey;
1411
1407
  tx.add(...instructions);
@@ -2088,7 +2084,7 @@ var PresaleClient = class {
2088
2084
  * qtAmount: amount of MST to receive (9 decimals).
2089
2085
  * USDC cost = qtAmount * price / 1e9.
2090
2086
  */
2091
- async buy(presalePda, qtAmount, buyer = this.walletPubkey, payer = this.walletPubkey, signers = []) {
2087
+ async buy(presalePda, qtAmount, buyer = this.walletPubkey, payer = this.walletPubkey) {
2092
2088
  const presale = await this.fetchPresale(presalePda);
2093
2089
  if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
2094
2090
  const qtMint = presale.qtMint;
@@ -2098,7 +2094,7 @@ var PresaleClient = class {
2098
2094
  const buyerQtAta = splToken.getAssociatedTokenAddressSync(qtMint, buyer);
2099
2095
  const buyerCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, buyer);
2100
2096
  const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
2101
- const sig = await this.program.methods.buy(qtAmount).accounts({
2097
+ return this.program.methods.buy(qtAmount).accounts({
2102
2098
  buyer,
2103
2099
  payer,
2104
2100
  presale: presalePda,
@@ -2112,14 +2108,13 @@ var PresaleClient = class {
2112
2108
  tokenProgram: splToken.TOKEN_PROGRAM_ID,
2113
2109
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
2114
2110
  systemProgram: web3_js.SystemProgram.programId
2115
- }).signers(signers).rpc();
2116
- return { signature: sig };
2111
+ }).transaction();
2117
2112
  }
2118
2113
  /**
2119
2114
  * Refund: burn user's MST and return USDC.
2120
2115
  * Only callable when presale status = Rejected.
2121
2116
  */
2122
- async refund(presalePda, user = this.walletPubkey, signers = []) {
2117
+ async refund(presalePda, user = this.walletPubkey) {
2123
2118
  const presale = await this.fetchPresale(presalePda);
2124
2119
  if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
2125
2120
  const qtMint = presale.qtMint;
@@ -2128,7 +2123,7 @@ var PresaleClient = class {
2128
2123
  const userQtAta = splToken.getAssociatedTokenAddressSync(qtMint, user);
2129
2124
  const userCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, user);
2130
2125
  const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
2131
- const sig = await this.program.methods.refund().accounts({
2126
+ return this.program.methods.refund().accounts({
2132
2127
  user,
2133
2128
  presale: presalePda,
2134
2129
  qtMint,
@@ -2140,19 +2135,18 @@ var PresaleClient = class {
2140
2135
  tokenProgram: splToken.TOKEN_PROGRAM_ID,
2141
2136
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
2142
2137
  systemProgram: web3_js.SystemProgram.programId
2143
- }).signers(signers).rpc();
2144
- return { signature: sig };
2138
+ }).transaction();
2145
2139
  }
2146
2140
  /**
2147
2141
  * Creator claims their share of presale revenue after distribute_presale_revenue.
2148
2142
  */
2149
- async claimRevenue(presalePda, creator = this.walletPubkey, signers = []) {
2143
+ async claimRevenue(presalePda, creator = this.walletPubkey) {
2150
2144
  const presale = await this.fetchPresale(presalePda);
2151
2145
  if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
2152
2146
  const currencyMint = presale.currencyMint;
2153
2147
  const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
2154
2148
  const creatorCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, creator);
2155
- const sig = await this.program.methods.claimRevenue().accounts({
2149
+ return this.program.methods.claimRevenue().accounts({
2156
2150
  creator,
2157
2151
  presale: presalePda,
2158
2152
  presaleVault,
@@ -2161,8 +2155,7 @@ var PresaleClient = class {
2161
2155
  tokenProgram: splToken.TOKEN_PROGRAM_ID,
2162
2156
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
2163
2157
  systemProgram: web3_js.SystemProgram.programId
2164
- }).signers(signers).rpc();
2165
- return { signature: sig };
2158
+ }).transaction();
2166
2159
  }
2167
2160
  /**
2168
2161
  * Transfer creator_claimable_revenue (80%) to BOTMM wallet.
@@ -2249,7 +2242,7 @@ var MarketOracleClient = class {
2249
2242
  * User burns their MST and claims proportional share of oracle vault USDC.
2250
2243
  * Call after market.collectTradingFee snapshotted qt supply.
2251
2244
  */
2252
- async claimFeesShare(marketOraclePda, user = this.walletPubkey, payer = this.walletPubkey, signers = []) {
2245
+ async claimFeesShare(marketOraclePda, user = this.walletPubkey, payer = this.walletPubkey) {
2253
2246
  const oracle = await this.fetchMarketOracle(marketOraclePda);
2254
2247
  if (!oracle) throw new Error(`MarketOracle not found: ${marketOraclePda.toBase58()}`);
2255
2248
  const currencyMint = oracle.currencyMint;
@@ -2258,7 +2251,7 @@ var MarketOracleClient = class {
2258
2251
  const userQtAta = splToken.getAssociatedTokenAddressSync(qtMint, user);
2259
2252
  const userCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, user);
2260
2253
  const userClaimRecord = this.userClaimRecordPda(marketOraclePda, user);
2261
- const sig = await this.program.methods.claimFeesShare().accounts({
2254
+ return this.program.methods.claimFeesShare().accounts({
2262
2255
  user,
2263
2256
  payer,
2264
2257
  marketOracle: marketOraclePda,
@@ -2271,8 +2264,7 @@ var MarketOracleClient = class {
2271
2264
  tokenProgram: splToken.TOKEN_PROGRAM_ID,
2272
2265
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
2273
2266
  systemProgram: web3_js.SystemProgram.programId
2274
- }).signers(signers).rpc();
2275
- return { signature: sig };
2267
+ }).transaction();
2276
2268
  }
2277
2269
  // ─── Queries ─────────────────────────────────────────────────────────────────
2278
2270
  async fetchMarketOracle(marketOraclePda) {