@theliem/xmarket-sdk 3.11.0 → 3.13.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 CHANGED
@@ -162,7 +162,7 @@ interface OrderStatus {
162
162
  filledAmount: BN;
163
163
  bump: number;
164
164
  }
165
- /** Per-question fee rates, all out of FEE_DENOMINATOR (1_000_000). E.g. 2_000 = 0.2% */
165
+ /** Per-question fee rates, all out of FEE_DENOMINATOR (10_000). E.g. 200 = 2%, 2_000 = 20% */
166
166
  interface QuestionFee {
167
167
  conditionId: Uint8Array;
168
168
  mergeFee: BN;
@@ -170,7 +170,7 @@ interface QuestionFee {
170
170
  swapFee: BN;
171
171
  bump: number;
172
172
  }
173
- declare const FEE_DENOMINATOR = 1000000;
173
+ declare const FEE_DENOMINATOR = 10000;
174
174
  /**
175
175
  * Off-chain order struct passed as instruction data.
176
176
  * Operator validates + submits matched order pairs on-chain.
@@ -476,8 +476,24 @@ declare class MarketClient {
476
476
  * @param creator presale creator pubkey (stored in question)
477
477
  * @param currencyMint collateral mint
478
478
  */
479
- approvePresale(presalePda: PublicKey, contentHash: Uint8Array, hookProgram: PublicKey, authorizedClob: PublicKey, expirationTime: anchor.BN, creator: PublicKey, currencyMint: PublicKey, caller?: PublicKey, payer?: PublicKey): Promise<{
480
- tx: Transaction;
479
+ approvePresale(params: {
480
+ presalePda: PublicKey;
481
+ contentHash: Uint8Array;
482
+ hookProgram: PublicKey;
483
+ authorizedClob: PublicKey;
484
+ expirationTime: anchor.BN;
485
+ creator: PublicKey;
486
+ currencyMint: PublicKey;
487
+ /** Revenue distribution — required: approvePresale now distributes 80/10/10 automatically */
488
+ referralAddress: PublicKey;
489
+ companyAddress: PublicKey;
490
+ adminOwner: PublicKey;
491
+ caller?: PublicKey;
492
+ payer?: PublicKey;
493
+ /** Provide an ALT to use VersionedTransaction (required: 31 accounts exceeds legacy tx limit) */
494
+ lookupTable?: AddressLookupTableAccount;
495
+ }): Promise<{
496
+ tx: Transaction | VersionedTransaction;
481
497
  questionPda: PublicKey;
482
498
  conditionPda: PublicKey;
483
499
  marketOraclePda: PublicKey;
@@ -516,16 +532,19 @@ declare class FeeManagementClient {
516
532
  initFeeConfig(admin: PublicKey, companyAddress: PublicKey, referralAddress: PublicKey, presaleRevenueAddress: PublicKey, investorsMarketRev: number, companyMarketRev: number, agentsPresaleRev: number, companyPresaleRev: number, authority: PublicKey, payer: PublicKey): Promise<TxResult>;
517
533
  fetchFeeConfig(owner: PublicKey): Promise<any | null>;
518
534
  /**
519
- * Fetch per-question fees for a condition.
520
- * Returns null if no fees have been set yet.
535
+ * Fetch per-market fees for a condition.
536
+ * Returns null if fees have not been initialized yet.
537
+ * Fees are set automatically via CPI when create_question_admin / approve_presale runs.
538
+ * Defaults: swapFee=200 (2%), redeemFee=0, mergeFee=2000 (20%), out of FEE_DENOMINATOR=10_000.
521
539
  */
540
+ getMarketFee(conditionPda: PublicKey): Promise<QuestionFee | null>;
522
541
  fetchQuestionFee(conditionPda: PublicKey): Promise<QuestionFee | null>;
523
542
  /**
524
- * Set per-question fees for a condition.
543
+ * Set per-question fees for a condition (whitelist-only edit after market creation).
525
544
  * @param conditionPda - condition PDA from the question
526
- * @param mergeFee - fee out of FEE_DENOMINATOR (1_000_000), e.g. 2_000 = 0.2%
545
+ * @param mergeFee - fee out of FEE_DENOMINATOR (10_000), e.g. 2_000 = 20%
527
546
  * @param redeemFee - fee out of FEE_DENOMINATOR
528
- * @param swapFee - trading fee out of FEE_DENOMINATOR
547
+ * @param swapFee - trading fee out of FEE_DENOMINATOR, e.g. 200 = 2%
529
548
  * @param feeConfigOwner - pubkey that owns the fee_config PDA (usually market deployer)
530
549
  * @param authority - signer authorized in fee_config whitelist / admin / owner
531
550
  * @param payer - rent + tx fee payer
@@ -708,15 +727,15 @@ declare class ClobClient {
708
727
  * vtx.sign([feePayerKeypair, operatorKeypair]);
709
728
  * await connection.sendRawTransaction(vtx.serialize());
710
729
  *
711
- * Returns an array because NO-taker MINT/MERGE decomposes into N txs (one per YES maker).
712
- * Most direct/single-pair cases return a single-element array.
730
+ * All match types pack into a single VersionedTransaction same as createQuestionAdmin pattern.
731
+ * NO-taker MINT/MERGE decomposes into N instructions but all packed in 1 tx.
713
732
  *
714
733
  * @param operator - Whitelisted CLOB operator pubkey (must sign)
715
734
  * @param payer - Fee payer pubkey (must sign, pays tx fee + rent)
716
735
  */
717
736
  buildMatchOrdersTx(taker: SignedOrder, makers: SignedOrder[], operator: PublicKey, payer: PublicKey, opts?: {
718
737
  marketOracleVault?: PublicKey;
719
- }): Promise<VersionedTransaction[]>;
738
+ }): Promise<VersionedTransaction>;
720
739
  fetchConfig(): Promise<ClobConfig | null>;
721
740
  fetchOrderStatus(maker: PublicKey, nonce: anchor.BN): Promise<OrderStatus | null>;
722
741
  fetchOrderRecord(maker: PublicKey, nonce: anchor.BN): Promise<{
package/dist/index.d.ts CHANGED
@@ -162,7 +162,7 @@ interface OrderStatus {
162
162
  filledAmount: BN;
163
163
  bump: number;
164
164
  }
165
- /** Per-question fee rates, all out of FEE_DENOMINATOR (1_000_000). E.g. 2_000 = 0.2% */
165
+ /** Per-question fee rates, all out of FEE_DENOMINATOR (10_000). E.g. 200 = 2%, 2_000 = 20% */
166
166
  interface QuestionFee {
167
167
  conditionId: Uint8Array;
168
168
  mergeFee: BN;
@@ -170,7 +170,7 @@ interface QuestionFee {
170
170
  swapFee: BN;
171
171
  bump: number;
172
172
  }
173
- declare const FEE_DENOMINATOR = 1000000;
173
+ declare const FEE_DENOMINATOR = 10000;
174
174
  /**
175
175
  * Off-chain order struct passed as instruction data.
176
176
  * Operator validates + submits matched order pairs on-chain.
@@ -476,8 +476,24 @@ declare class MarketClient {
476
476
  * @param creator presale creator pubkey (stored in question)
477
477
  * @param currencyMint collateral mint
478
478
  */
479
- approvePresale(presalePda: PublicKey, contentHash: Uint8Array, hookProgram: PublicKey, authorizedClob: PublicKey, expirationTime: anchor.BN, creator: PublicKey, currencyMint: PublicKey, caller?: PublicKey, payer?: PublicKey): Promise<{
480
- tx: Transaction;
479
+ approvePresale(params: {
480
+ presalePda: PublicKey;
481
+ contentHash: Uint8Array;
482
+ hookProgram: PublicKey;
483
+ authorizedClob: PublicKey;
484
+ expirationTime: anchor.BN;
485
+ creator: PublicKey;
486
+ currencyMint: PublicKey;
487
+ /** Revenue distribution — required: approvePresale now distributes 80/10/10 automatically */
488
+ referralAddress: PublicKey;
489
+ companyAddress: PublicKey;
490
+ adminOwner: PublicKey;
491
+ caller?: PublicKey;
492
+ payer?: PublicKey;
493
+ /** Provide an ALT to use VersionedTransaction (required: 31 accounts exceeds legacy tx limit) */
494
+ lookupTable?: AddressLookupTableAccount;
495
+ }): Promise<{
496
+ tx: Transaction | VersionedTransaction;
481
497
  questionPda: PublicKey;
482
498
  conditionPda: PublicKey;
483
499
  marketOraclePda: PublicKey;
@@ -516,16 +532,19 @@ declare class FeeManagementClient {
516
532
  initFeeConfig(admin: PublicKey, companyAddress: PublicKey, referralAddress: PublicKey, presaleRevenueAddress: PublicKey, investorsMarketRev: number, companyMarketRev: number, agentsPresaleRev: number, companyPresaleRev: number, authority: PublicKey, payer: PublicKey): Promise<TxResult>;
517
533
  fetchFeeConfig(owner: PublicKey): Promise<any | null>;
518
534
  /**
519
- * Fetch per-question fees for a condition.
520
- * Returns null if no fees have been set yet.
535
+ * Fetch per-market fees for a condition.
536
+ * Returns null if fees have not been initialized yet.
537
+ * Fees are set automatically via CPI when create_question_admin / approve_presale runs.
538
+ * Defaults: swapFee=200 (2%), redeemFee=0, mergeFee=2000 (20%), out of FEE_DENOMINATOR=10_000.
521
539
  */
540
+ getMarketFee(conditionPda: PublicKey): Promise<QuestionFee | null>;
522
541
  fetchQuestionFee(conditionPda: PublicKey): Promise<QuestionFee | null>;
523
542
  /**
524
- * Set per-question fees for a condition.
543
+ * Set per-question fees for a condition (whitelist-only edit after market creation).
525
544
  * @param conditionPda - condition PDA from the question
526
- * @param mergeFee - fee out of FEE_DENOMINATOR (1_000_000), e.g. 2_000 = 0.2%
545
+ * @param mergeFee - fee out of FEE_DENOMINATOR (10_000), e.g. 2_000 = 20%
527
546
  * @param redeemFee - fee out of FEE_DENOMINATOR
528
- * @param swapFee - trading fee out of FEE_DENOMINATOR
547
+ * @param swapFee - trading fee out of FEE_DENOMINATOR, e.g. 200 = 2%
529
548
  * @param feeConfigOwner - pubkey that owns the fee_config PDA (usually market deployer)
530
549
  * @param authority - signer authorized in fee_config whitelist / admin / owner
531
550
  * @param payer - rent + tx fee payer
@@ -708,15 +727,15 @@ declare class ClobClient {
708
727
  * vtx.sign([feePayerKeypair, operatorKeypair]);
709
728
  * await connection.sendRawTransaction(vtx.serialize());
710
729
  *
711
- * Returns an array because NO-taker MINT/MERGE decomposes into N txs (one per YES maker).
712
- * Most direct/single-pair cases return a single-element array.
730
+ * All match types pack into a single VersionedTransaction same as createQuestionAdmin pattern.
731
+ * NO-taker MINT/MERGE decomposes into N instructions but all packed in 1 tx.
713
732
  *
714
733
  * @param operator - Whitelisted CLOB operator pubkey (must sign)
715
734
  * @param payer - Fee payer pubkey (must sign, pays tx fee + rent)
716
735
  */
717
736
  buildMatchOrdersTx(taker: SignedOrder, makers: SignedOrder[], operator: PublicKey, payer: PublicKey, opts?: {
718
737
  marketOracleVault?: PublicKey;
719
- }): Promise<VersionedTransaction[]>;
738
+ }): Promise<VersionedTransaction>;
720
739
  fetchConfig(): Promise<ClobConfig | null>;
721
740
  fetchOrderStatus(maker: PublicKey, nonce: anchor.BN): Promise<OrderStatus | null>;
722
741
  fetchOrderRecord(maker: PublicKey, nonce: anchor.BN): Promise<{
package/dist/index.js CHANGED
@@ -522,7 +522,7 @@ var QuestionStatus = /* @__PURE__ */ ((QuestionStatus2) => {
522
522
  QuestionStatus2["Resolved"] = "resolved";
523
523
  return QuestionStatus2;
524
524
  })(QuestionStatus || {});
525
- var FEE_DENOMINATOR = 1e6;
525
+ var FEE_DENOMINATOR = 1e4;
526
526
  var XMarketError = class extends Error {
527
527
  constructor(message, code) {
528
528
  super(message);
@@ -587,6 +587,8 @@ var MarketClient = class {
587
587
  const [noMint] = PDA.noMint(conditionPda, this.programIds);
588
588
  const [mintAuthority] = PDA.mintAuthority(conditionPda, this.programIds);
589
589
  const [collateralVault] = PDA.collateralVault(params.collateralMint, this.programIds);
590
+ if (!this.programIds.feeManagement) throw new Error("feeManagement program ID not configured");
591
+ const [questionFeePda] = PDA.questionFee(conditionPda, this.programIds);
590
592
  const tx = await this.program.methods.createQuestionAdmin({
591
593
  questionId: Array.from(questionId),
592
594
  contentHash: Array.from(contentHash),
@@ -606,6 +608,8 @@ var MarketClient = class {
606
608
  mintAuthority,
607
609
  collateralVault,
608
610
  conditionalTokensProgram: this.programIds.conditionalTokens,
611
+ questionFee: questionFeePda,
612
+ feeManagementProgram: this.programIds.feeManagement,
609
613
  tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
610
614
  systemProgram: web3_js.SystemProgram.programId,
611
615
  rent: web3_js.SYSVAR_RENT_PUBKEY
@@ -804,9 +808,25 @@ var MarketClient = class {
804
808
  * @param creator presale creator pubkey (stored in question)
805
809
  * @param currencyMint collateral mint
806
810
  */
807
- async approvePresale(presalePda, contentHash, hookProgram, authorizedClob, expirationTime, creator, currencyMint, caller = this.walletPubkey, payer = caller) {
811
+ async approvePresale(params) {
812
+ const {
813
+ presalePda,
814
+ contentHash,
815
+ hookProgram,
816
+ authorizedClob,
817
+ expirationTime,
818
+ creator,
819
+ currencyMint,
820
+ referralAddress,
821
+ companyAddress,
822
+ adminOwner
823
+ } = params;
824
+ const caller = params.caller ?? this.walletPubkey;
825
+ const payer = params.payer ?? caller;
808
826
  if (!this.programIds.presale) throw new Error("presale program ID not configured");
809
827
  if (!this.programIds.marketOracle) throw new Error("marketOracle program ID not configured");
828
+ if (!this.programIds.feeManagement) throw new Error("feeManagement program ID not configured");
829
+ if (!this.programIds.adminContract) throw new Error("adminContract program ID not configured");
810
830
  const questionId = presalePda.toBytes();
811
831
  const [questionPda] = PDA.question(this.configPda, questionId, this.programIds);
812
832
  const marketConfig = await this.fetchConfig();
@@ -819,7 +839,14 @@ var MarketClient = class {
819
839
  const [collateralVault] = PDA.collateralVault(currencyMint, this.programIds);
820
840
  const [marketOraclePda] = PDA.marketOraclePda(questionPda, this.programIds);
821
841
  const marketOracleVault = splToken.getAssociatedTokenAddressSync(currencyMint, marketOraclePda, true);
822
- const tx = await this.program.methods.approvePresale({
842
+ const [questionFeePda] = PDA.questionFee(conditionPda, this.programIds);
843
+ const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
844
+ const referralTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, referralAddress);
845
+ const companyTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, companyAddress);
846
+ const [adminConfig] = PDA.adminConfig(adminOwner, this.programIds);
847
+ const adminVault = splToken.getAssociatedTokenAddressSync(currencyMint, adminConfig, true);
848
+ const [claimRecord] = PDA.claimRecord(conditionPda.toBytes(), this.programIds);
849
+ const builder = this.program.methods.approvePresale({
823
850
  contentHash: Array.from(contentHash),
824
851
  hookProgram,
825
852
  authorizedClob,
@@ -840,15 +867,38 @@ var MarketClient = class {
840
867
  collateralVault,
841
868
  marketOracle: marketOraclePda,
842
869
  marketOracleVault,
870
+ presaleVault,
871
+ referralTokenAccount,
872
+ companyTokenAccount,
873
+ adminVault,
874
+ adminConfig,
875
+ claimRecord,
876
+ questionFee: questionFeePda,
877
+ feeManagementProgram: this.programIds.feeManagement,
843
878
  conditionalTokensProgram: this.programIds.conditionalTokens,
844
879
  presaleProgram: this.programIds.presale,
845
880
  marketOracleProgram: this.programIds.marketOracle,
881
+ adminProgram: this.programIds.adminContract,
846
882
  tokenProgram: splToken.TOKEN_PROGRAM_ID,
847
883
  token2022Program: splToken.TOKEN_2022_PROGRAM_ID,
848
884
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
849
885
  systemProgram: web3_js.SystemProgram.programId,
850
886
  rent: web3_js.SYSVAR_RENT_PUBKEY
851
- }).transaction();
887
+ });
888
+ let tx;
889
+ if (params.lookupTable) {
890
+ const ix = await builder.instruction();
891
+ const cu = web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 14e5 });
892
+ const { blockhash } = await this.provider.connection.getLatestBlockhash();
893
+ const msg = new web3_js.TransactionMessage({
894
+ payerKey: payer,
895
+ recentBlockhash: blockhash,
896
+ instructions: [cu, ix]
897
+ }).compileToV0Message([params.lookupTable]);
898
+ tx = new web3_js.VersionedTransaction(msg);
899
+ } else {
900
+ tx = await builder.transaction();
901
+ }
852
902
  return { tx, questionPda, conditionPda, marketOraclePda, marketOracleVault };
853
903
  }
854
904
  /**
@@ -2263,8 +2313,8 @@ ${logs.join("\n")}`);
2263
2313
  * vtx.sign([feePayerKeypair, operatorKeypair]);
2264
2314
  * await connection.sendRawTransaction(vtx.serialize());
2265
2315
  *
2266
- * Returns an array because NO-taker MINT/MERGE decomposes into N txs (one per YES maker).
2267
- * Most direct/single-pair cases return a single-element array.
2316
+ * All match types pack into a single VersionedTransaction same as createQuestionAdmin pattern.
2317
+ * NO-taker MINT/MERGE decomposes into N instructions but all packed in 1 tx.
2268
2318
  *
2269
2319
  * @param operator - Whitelisted CLOB operator pubkey (must sign)
2270
2320
  * @param payer - Fee payer pubkey (must sign, pays tx fee + rent)
@@ -2290,21 +2340,16 @@ ${logs.join("\n")}`);
2290
2340
  this.registerOrderIfNeeded(taker),
2291
2341
  ...makers.map((m) => this.registerOrderIfNeeded(m))
2292
2342
  ]);
2293
- const ixs2 = [];
2294
- for (const buyMaker of makers) {
2295
- const built = await this.buildMatchComplementaryIxs(
2296
- buyMaker,
2297
- [taker],
2298
- collateralMint,
2299
- feeRecipient,
2300
- operator,
2301
- opts,
2302
- true,
2303
- true
2304
- );
2305
- ixs2.push(...built);
2306
- }
2307
- return [await this._buildUnsignedVtx(ixs2, alt, payer)];
2343
+ const ixs3 = await this.buildMatchComplementaryIxs(
2344
+ taker,
2345
+ makers,
2346
+ collateralMint,
2347
+ feeRecipient,
2348
+ operator,
2349
+ opts,
2350
+ false
2351
+ );
2352
+ return this._buildUnsignedVtx(ixs3, alt, payer);
2308
2353
  } else {
2309
2354
  throw new InvalidParamError("COMPLEMENTARY requires one BUY and one or more SELLs on same tokenId");
2310
2355
  }
@@ -2312,7 +2357,7 @@ ${logs.join("\n")}`);
2312
2357
  this.registerOrderIfNeeded(buySignedOrder),
2313
2358
  ...sellCandidates.map((m) => this.registerOrderIfNeeded(m))
2314
2359
  ]);
2315
- const ixs = await this.buildMatchComplementaryIxs(
2360
+ const ixs2 = await this.buildMatchComplementaryIxs(
2316
2361
  buySignedOrder,
2317
2362
  sellCandidates,
2318
2363
  collateralMint,
@@ -2320,7 +2365,7 @@ ${logs.join("\n")}`);
2320
2365
  operator,
2321
2366
  opts
2322
2367
  );
2323
- return [await this._buildUnsignedVtx(ixs, alt, payer)];
2368
+ return this._buildUnsignedVtx(ixs2, alt, payer);
2324
2369
  }
2325
2370
  const allBuy = t.side === SIDE_BUY && makers.every((m) => m.order.side === SIDE_BUY);
2326
2371
  const allSell = t.side === SIDE_SELL && makers.every((m) => m.order.side === SIDE_SELL);
@@ -2341,19 +2386,19 @@ ${logs.join("\n")}`);
2341
2386
  ]);
2342
2387
  await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
2343
2388
  const ix = allBuy ? await this._buildMintIx(taker, makers, collateralMint, operator, payer) : await this._buildMergeIx(taker, makers, collateralMint, operator, payer, opts);
2344
- return [await this._buildUnsignedVtx([ix], alt, payer)];
2389
+ return this._buildUnsignedVtx([ix], alt, payer);
2345
2390
  }
2346
- const vtxs = [];
2391
+ await Promise.all([
2392
+ this.registerOrderIfNeeded(taker),
2393
+ ...makers.map((m) => this.registerOrderIfNeeded(m))
2394
+ ]);
2395
+ await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
2396
+ const ixs = [];
2347
2397
  for (const yesMaker of makers) {
2348
- await Promise.all([
2349
- this.registerOrderIfNeeded(yesMaker),
2350
- this.registerOrderIfNeeded(taker)
2351
- ]);
2352
- await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
2353
2398
  const ix = allBuy ? await this._buildMintIx(yesMaker, [taker], collateralMint, operator, payer) : await this._buildMergeIx(yesMaker, [taker], collateralMint, operator, payer, opts);
2354
- vtxs.push(await this._buildUnsignedVtx([ix], alt, payer));
2399
+ ixs.push(ix);
2355
2400
  }
2356
- return vtxs;
2401
+ return this._buildUnsignedVtx(ixs, alt, payer);
2357
2402
  }
2358
2403
  // ─── Queries ─────────────────────────────────────────────────────────────────
2359
2404
  async fetchConfig() {
@@ -2431,9 +2476,14 @@ var FeeManagementClient = class {
2431
2476
  }
2432
2477
  }
2433
2478
  /**
2434
- * Fetch per-question fees for a condition.
2435
- * Returns null if no fees have been set yet.
2479
+ * Fetch per-market fees for a condition.
2480
+ * Returns null if fees have not been initialized yet.
2481
+ * Fees are set automatically via CPI when create_question_admin / approve_presale runs.
2482
+ * Defaults: swapFee=200 (2%), redeemFee=0, mergeFee=2000 (20%), out of FEE_DENOMINATOR=10_000.
2436
2483
  */
2484
+ async getMarketFee(conditionPda) {
2485
+ return this.fetchQuestionFee(conditionPda);
2486
+ }
2437
2487
  async fetchQuestionFee(conditionPda) {
2438
2488
  try {
2439
2489
  const [pda] = PDA.questionFee(conditionPda, this.programIds);
@@ -2450,11 +2500,11 @@ var FeeManagementClient = class {
2450
2500
  }
2451
2501
  }
2452
2502
  /**
2453
- * Set per-question fees for a condition.
2503
+ * Set per-question fees for a condition (whitelist-only edit after market creation).
2454
2504
  * @param conditionPda - condition PDA from the question
2455
- * @param mergeFee - fee out of FEE_DENOMINATOR (1_000_000), e.g. 2_000 = 0.2%
2505
+ * @param mergeFee - fee out of FEE_DENOMINATOR (10_000), e.g. 2_000 = 20%
2456
2506
  * @param redeemFee - fee out of FEE_DENOMINATOR
2457
- * @param swapFee - trading fee out of FEE_DENOMINATOR
2507
+ * @param swapFee - trading fee out of FEE_DENOMINATOR, e.g. 200 = 2%
2458
2508
  * @param feeConfigOwner - pubkey that owns the fee_config PDA (usually market deployer)
2459
2509
  * @param authority - signer authorized in fee_config whitelist / admin / owner
2460
2510
  * @param payer - rent + tx fee payer
@@ -4291,9 +4341,59 @@ var question_market_default = {
4291
4341
  ],
4292
4342
  writable: true
4293
4343
  },
4344
+ {
4345
+ name: "presale_vault",
4346
+ writable: true
4347
+ },
4348
+ {
4349
+ name: "referral_token_account",
4350
+ docs: [
4351
+ "Referral address USDC ATA (receives agents_fee 10%)"
4352
+ ],
4353
+ writable: true
4354
+ },
4355
+ {
4356
+ name: "company_token_account",
4357
+ docs: [
4358
+ "Company address USDC ATA (receives company_fee 10%)"
4359
+ ],
4360
+ writable: true
4361
+ },
4362
+ {
4363
+ name: "admin_vault",
4364
+ docs: [
4365
+ "admin_contract vault ATA (receives botmm_revenue 80%)"
4366
+ ],
4367
+ writable: true
4368
+ },
4369
+ {
4370
+ name: "admin_config",
4371
+ docs: [
4372
+ "admin_contract config PDA (seeds=[ADMIN_CONFIG_SEED, owner] \u2014 validated by admin_contract CPI)"
4373
+ ]
4374
+ },
4375
+ {
4376
+ name: "claim_record",
4377
+ docs: [
4378
+ "ClaimRecord PDA for this presale's conditionId (seeds=[CLAIM_RECORD_SEED, condition_id])",
4379
+ "condition_id computed inside handler \u2014 seeds validated by admin_contract CPI"
4380
+ ],
4381
+ writable: true
4382
+ },
4294
4383
  {
4295
4384
  name: "conditional_tokens_program"
4296
4385
  },
4386
+ {
4387
+ name: "question_fee",
4388
+ docs: [
4389
+ "QuestionFee PDA \u2014 initialized with default fees via CPI to fee-management"
4390
+ ],
4391
+ writable: true
4392
+ },
4393
+ {
4394
+ name: "fee_management_program",
4395
+ address: "DuYyXguB5PVSKg6E2p4XPrrXZSCJnuBhoGpkGCBN5bBb"
4396
+ },
4297
4397
  {
4298
4398
  name: "presale_program",
4299
4399
  address: "2Rnw1VoEtsUMQ7wkvYZjDehqSqRob6uNkeymDfvKrquB"
@@ -4302,6 +4402,10 @@ var question_market_default = {
4302
4402
  name: "market_oracle_program",
4303
4403
  address: "ADWF4J3nCJ2kWnCtycuem2jhu7amUqJWQG3oa5xF67QJ"
4304
4404
  },
4405
+ {
4406
+ name: "admin_program",
4407
+ address: "4NdD5962SfGqofmeyjfifJpdGnwTAiKaUKB5Z42UDc9T"
4408
+ },
4305
4409
  {
4306
4410
  name: "token_program",
4307
4411
  address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
@@ -4944,6 +5048,47 @@ var question_market_default = {
4944
5048
  {
4945
5049
  name: "conditional_tokens_program"
4946
5050
  },
5051
+ {
5052
+ name: "question_fee",
5053
+ docs: [
5054
+ "QuestionFee PDA \u2014 initialized with default fees via CPI to fee-management.",
5055
+ "Seed uses condition.key() bytes (consistent with existing set_question_fee SDK convention)."
5056
+ ],
5057
+ writable: true,
5058
+ pda: {
5059
+ seeds: [
5060
+ {
5061
+ kind: "const",
5062
+ value: [
5063
+ 113,
5064
+ 117,
5065
+ 101,
5066
+ 115,
5067
+ 116,
5068
+ 105,
5069
+ 111,
5070
+ 110,
5071
+ 95,
5072
+ 102,
5073
+ 101,
5074
+ 101
5075
+ ]
5076
+ },
5077
+ {
5078
+ kind: "account",
5079
+ path: "condition"
5080
+ }
5081
+ ],
5082
+ program: {
5083
+ kind: "account",
5084
+ path: "fee_management_program"
5085
+ }
5086
+ }
5087
+ },
5088
+ {
5089
+ name: "fee_management_program",
5090
+ address: "DuYyXguB5PVSKg6E2p4XPrrXZSCJnuBhoGpkGCBN5bBb"
5091
+ },
4947
5092
  {
4948
5093
  name: "token_program",
4949
5094
  address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
@@ -6060,6 +6205,18 @@ var question_market_default = {
6060
6205
  {
6061
6206
  name: "creator",
6062
6207
  type: "pubkey"
6208
+ },
6209
+ {
6210
+ name: "agents_fee",
6211
+ type: "u64"
6212
+ },
6213
+ {
6214
+ name: "company_fee",
6215
+ type: "u64"
6216
+ },
6217
+ {
6218
+ name: "botmm_revenue",
6219
+ type: "u64"
6063
6220
  }
6064
6221
  ]
6065
6222
  }
@@ -10551,6 +10708,70 @@ var fee_management_default = {
10551
10708
  }
10552
10709
  ]
10553
10710
  },
10711
+ {
10712
+ name: "init_question_fee",
10713
+ discriminator: [
10714
+ 115,
10715
+ 49,
10716
+ 110,
10717
+ 164,
10718
+ 33,
10719
+ 202,
10720
+ 115,
10721
+ 79
10722
+ ],
10723
+ accounts: [
10724
+ {
10725
+ name: "payer",
10726
+ writable: true,
10727
+ signer: true
10728
+ },
10729
+ {
10730
+ name: "question_fee",
10731
+ writable: true,
10732
+ pda: {
10733
+ seeds: [
10734
+ {
10735
+ kind: "const",
10736
+ value: [
10737
+ 113,
10738
+ 117,
10739
+ 101,
10740
+ 115,
10741
+ 116,
10742
+ 105,
10743
+ 111,
10744
+ 110,
10745
+ 95,
10746
+ 102,
10747
+ 101,
10748
+ 101
10749
+ ]
10750
+ },
10751
+ {
10752
+ kind: "arg",
10753
+ path: "condition_id"
10754
+ }
10755
+ ]
10756
+ }
10757
+ },
10758
+ {
10759
+ name: "system_program",
10760
+ address: "11111111111111111111111111111111"
10761
+ }
10762
+ ],
10763
+ args: [
10764
+ {
10765
+ name: "condition_id",
10766
+ type: {
10767
+ array: [
10768
+ "u8",
10769
+ 32
10770
+ ]
10771
+ }
10772
+ }
10773
+ ]
10774
+ },
10554
10775
  {
10555
10776
  name: "initialize",
10556
10777
  discriminator: [
@@ -11245,6 +11466,19 @@ var fee_management_default = {
11245
11466
  235
11246
11467
  ]
11247
11468
  },
11469
+ {
11470
+ name: "QuestionFeeInitialized",
11471
+ discriminator: [
11472
+ 147,
11473
+ 167,
11474
+ 20,
11475
+ 219,
11476
+ 32,
11477
+ 142,
11478
+ 227,
11479
+ 171
11480
+ ]
11481
+ },
11248
11482
  {
11249
11483
  name: "QuestionFeeUpdated",
11250
11484
  discriminator: [
@@ -11627,7 +11861,7 @@ var fee_management_default = {
11627
11861
  {
11628
11862
  name: "merge_fee",
11629
11863
  docs: [
11630
- "Fees out of FEE_DENOMINATOR (1_000_000). E.g. 2_000 = 0.2%"
11864
+ "Fees out of FEE_DENOMINATOR (10_000). E.g. 200 = 2%, 2_000 = 20%"
11631
11865
  ],
11632
11866
  type: "u64"
11633
11867
  },
@@ -11646,6 +11880,35 @@ var fee_management_default = {
11646
11880
  ]
11647
11881
  }
11648
11882
  },
11883
+ {
11884
+ name: "QuestionFeeInitialized",
11885
+ type: {
11886
+ kind: "struct",
11887
+ fields: [
11888
+ {
11889
+ name: "condition_id",
11890
+ type: {
11891
+ array: [
11892
+ "u8",
11893
+ 32
11894
+ ]
11895
+ }
11896
+ },
11897
+ {
11898
+ name: "swap_fee",
11899
+ type: "u64"
11900
+ },
11901
+ {
11902
+ name: "redeem_fee",
11903
+ type: "u64"
11904
+ },
11905
+ {
11906
+ name: "merge_fee",
11907
+ type: "u64"
11908
+ }
11909
+ ]
11910
+ }
11911
+ },
11649
11912
  {
11650
11913
  name: "QuestionFeeUpdated",
11651
11914
  type: {