@theliem/xmarket-sdk 3.22.0 → 3.25.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
@@ -37,7 +37,11 @@ var SEEDS = {
37
37
  userClaim: Buffer.from("user_claim"),
38
38
  // Admin Contract
39
39
  adminConfig: Buffer.from("admin_config"),
40
- claimRecord: Buffer.from("claim_record")
40
+ claimRecord: Buffer.from("claim_record"),
41
+ // Dispute
42
+ disputeConfig: Buffer.from("dispute_config"),
43
+ disputeMarket: Buffer.from("dispute_market"),
44
+ userDispute: Buffer.from("user_dispute")
41
45
  };
42
46
  var PDA = class {
43
47
  // ─── Question Market ────────────────────────────────────────────────────────
@@ -157,6 +161,14 @@ var PDA = class {
157
161
  programIds.clobExchange
158
162
  );
159
163
  }
164
+ static collectFeeOrderRecord(user, nonce, programIds) {
165
+ const nonceBuf = Buffer.alloc(8);
166
+ nonceBuf.writeBigUInt64LE(BigInt(nonce.toString()));
167
+ return PublicKey.findProgramAddressSync(
168
+ [Buffer.from("collect_order"), user.toBuffer(), nonceBuf],
169
+ programIds.clobExchange
170
+ );
171
+ }
160
172
  // ─── Fee Management ─────────────────────────────────────────────────────────
161
173
  static feeConfig(owner, programIds) {
162
174
  if (!programIds.feeManagement) throw new Error("feeManagement program ID not configured");
@@ -248,6 +260,28 @@ var PDA = class {
248
260
  programIds.adminContract
249
261
  );
250
262
  }
263
+ // ─── Dispute ─────────────────────────────────────────────────────────────
264
+ static disputeConfig(owner, programIds) {
265
+ if (!programIds.dispute) throw new Error("dispute program ID not configured");
266
+ return PublicKey.findProgramAddressSync(
267
+ [SEEDS.disputeConfig, owner.toBuffer()],
268
+ programIds.dispute
269
+ );
270
+ }
271
+ static disputeMarket(conditionId, programIds) {
272
+ if (!programIds.dispute) throw new Error("dispute program ID not configured");
273
+ return PublicKey.findProgramAddressSync(
274
+ [SEEDS.disputeMarket, Buffer.from(conditionId)],
275
+ programIds.dispute
276
+ );
277
+ }
278
+ static userDispute(user, conditionId, programIds) {
279
+ if (!programIds.dispute) throw new Error("dispute program ID not configured");
280
+ return PublicKey.findProgramAddressSync(
281
+ [SEEDS.userDispute, user.toBuffer(), Buffer.from(conditionId)],
282
+ programIds.dispute
283
+ );
284
+ }
251
285
  };
252
286
  function generateQuestionId(content, salt) {
253
287
  const input = content + (salt ?? Date.now());
@@ -1592,6 +1626,39 @@ var ClobClient = class {
1592
1626
  this._marketOracleVaultCache.set(key, vault);
1593
1627
  return vault;
1594
1628
  }
1629
+ /**
1630
+ * Returns a createATA ix for the oracle vault when:
1631
+ * - takerFee > 0
1632
+ * - marketFeeOverride exists for the condition
1633
+ * - oracle vault ATA is not yet initialized
1634
+ * Idempotent — safe to call every tx; returns null if vault already exists.
1635
+ */
1636
+ async buildInitOracleVaultIfNeeded(condition, collateralMint, takerFee, payer) {
1637
+ if (takerFee.isZero()) return null;
1638
+ if (!this.feeConfigOwner || !this.programIds.feeManagement) return null;
1639
+ if (!this.ctfClient || !this.qmConfigPda || !this.programIds.marketOracle) return null;
1640
+ const companyAddr = await this.companyAddress();
1641
+ const refVault = await this.referralVault();
1642
+ if (!companyAddr || !refVault) return null;
1643
+ const feeOverridePda = PDA.marketFeeOverride(condition, this.programIds)[0];
1644
+ const cond = await this.ctfClient.fetchCondition(condition);
1645
+ if (!cond) return null;
1646
+ const [questionPda] = PDA.question(this.qmConfigPda, cond.questionId, this.programIds);
1647
+ const [marketOraclePda] = PDA.marketOraclePda(questionPda, this.programIds);
1648
+ const vault = getAssociatedTokenAddressSync(collateralMint, marketOraclePda, true);
1649
+ const [feeOverrideInfo, vaultInfo] = await Promise.all([
1650
+ this.provider.connection.getAccountInfo(feeOverridePda),
1651
+ this.provider.connection.getAccountInfo(vault)
1652
+ ]);
1653
+ if (!feeOverrideInfo) return null;
1654
+ if (vaultInfo) return null;
1655
+ return createAssociatedTokenAccountIdempotentInstruction(
1656
+ payer,
1657
+ vault,
1658
+ marketOraclePda,
1659
+ collateralMint
1660
+ );
1661
+ }
1595
1662
  get walletPubkey() {
1596
1663
  return this.provider.wallet.publicKey;
1597
1664
  }
@@ -1730,8 +1797,8 @@ var ClobClient = class {
1730
1797
  async _sendLegacyTxSig(instructions) {
1731
1798
  const { connection } = this.provider;
1732
1799
  const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
1733
- const { Transaction: Transaction10 } = await import('@solana/web3.js');
1734
- const tx = new Transaction10();
1800
+ const { Transaction: Transaction12 } = await import('@solana/web3.js');
1801
+ const tx = new Transaction12();
1735
1802
  tx.recentBlockhash = blockhash;
1736
1803
  tx.feePayer = this.walletPubkey;
1737
1804
  tx.add(...instructions);
@@ -1757,10 +1824,10 @@ ${logs.join("\n")}`);
1757
1824
  connection.getAccountInfo(clobYesAta),
1758
1825
  connection.getAccountInfo(clobNoAta)
1759
1826
  ]);
1760
- const { createAssociatedTokenAccountIdempotentInstruction: createAssociatedTokenAccountIdempotentInstruction4 } = await import('@solana/spl-token');
1827
+ const { createAssociatedTokenAccountIdempotentInstruction: createAssociatedTokenAccountIdempotentInstruction5 } = await import('@solana/spl-token');
1761
1828
  const ixs = [];
1762
1829
  if (!yesInfo) {
1763
- ixs.push(createAssociatedTokenAccountIdempotentInstruction4(
1830
+ ixs.push(createAssociatedTokenAccountIdempotentInstruction5(
1764
1831
  this.walletPubkey,
1765
1832
  clobYesAta,
1766
1833
  clobConfig,
@@ -1769,7 +1836,7 @@ ${logs.join("\n")}`);
1769
1836
  ));
1770
1837
  }
1771
1838
  if (!noInfo) {
1772
- ixs.push(createAssociatedTokenAccountIdempotentInstruction4(
1839
+ ixs.push(createAssociatedTokenAccountIdempotentInstruction5(
1773
1840
  this.walletPubkey,
1774
1841
  clobNoAta,
1775
1842
  clobConfig,
@@ -1852,6 +1919,49 @@ ${logs.join("\n")}`);
1852
1919
  await this.registerOrder(signed);
1853
1920
  }
1854
1921
  }
1922
+ // ─── Register CollectFeeOrder ────────────────────────────────────────────────
1923
+ /**
1924
+ * Build a legacy Transaction to register a CollectFeeOrder on-chain.
1925
+ * Must be signed and sent before calling buildBatchCollectRedeemEarlyTx.
1926
+ *
1927
+ * Flow: [Ed25519 ix (1 user sig) + register_collect_fee_order ix]
1928
+ * Caller signs with payer keypair and sends.
1929
+ */
1930
+ async buildRegisterCollectFeeOrderTx(signedOrder, payer) {
1931
+ const { order } = signedOrder;
1932
+ const [collectFeeOrderRecord] = PDA.collectFeeOrderRecord(order.user, order.nonce, this.programIds);
1933
+ const ed25519Ix = buildBatchedCollectFeeEd25519Instruction([signedOrder]);
1934
+ const registerIx = await this.program.methods.registerCollectFeeOrder(order.nonce).accounts({
1935
+ payer,
1936
+ clobConfig: this.configPda(),
1937
+ ixSysvar: IX_SYSVAR,
1938
+ orderSigner: order.user,
1939
+ collectFeeOrderRecord,
1940
+ systemProgram: SystemProgram.programId
1941
+ }).instruction();
1942
+ const { blockhash } = await this.provider.connection.getLatestBlockhash();
1943
+ const tx = new Transaction();
1944
+ tx.recentBlockhash = blockhash;
1945
+ tx.feePayer = payer;
1946
+ tx.add(ed25519Ix, registerIx);
1947
+ return tx;
1948
+ }
1949
+ /**
1950
+ * Register a CollectFeeOrder on-chain and send immediately (operator-signed flow).
1951
+ * Idempotent — skips if PDA already exists.
1952
+ */
1953
+ async registerCollectFeeOrderIfNeeded(signedOrder) {
1954
+ const [pda] = PDA.collectFeeOrderRecord(
1955
+ signedOrder.order.user,
1956
+ signedOrder.order.nonce,
1957
+ this.programIds
1958
+ );
1959
+ const existing = await this.program.account.collectFeeOrderRecord?.fetchNullable(pda);
1960
+ if (!existing) {
1961
+ const tx = await this.buildRegisterCollectFeeOrderTx(signedOrder, this.walletPubkey);
1962
+ await this._sendLegacyTx(tx.instructions);
1963
+ }
1964
+ }
1855
1965
  /** Cancel an order — closes its OrderRecord PDA and returns rent to maker. */
1856
1966
  async cancelOrder(nonce) {
1857
1967
  const [orderRecord] = PDA.orderRecord(this.walletPubkey, nonce, this.programIds);
@@ -2434,6 +2544,13 @@ ${logs.join("\n")}`);
2434
2544
  if (yIx) hookInitIxs.push(yIx);
2435
2545
  if (nIx) hookInitIxs.push(nIx);
2436
2546
  }
2547
+ const oracleVaultInitIx = await this.buildInitOracleVaultIfNeeded(
2548
+ t.condition,
2549
+ collateralMint,
2550
+ t.fee,
2551
+ payer
2552
+ );
2553
+ const preIxs = oracleVaultInitIx ? [...hookInitIxs, oracleVaultInitIx] : hookInitIxs;
2437
2554
  if (t.tokenId === m0.tokenId) {
2438
2555
  let buySignedOrder, sellCandidates;
2439
2556
  if (t.side === SIDE_BUY && makers.every((m) => m.order.side === SIDE_SELL)) {
@@ -2453,7 +2570,7 @@ ${logs.join("\n")}`);
2453
2570
  opts,
2454
2571
  false
2455
2572
  );
2456
- return this._buildUnsignedVtx([...hookInitIxs, ...ixs3], alt, payer);
2573
+ return this._buildUnsignedVtx([...preIxs, ...ixs3], alt, payer);
2457
2574
  } else {
2458
2575
  throw new InvalidParamError("COMPLEMENTARY requires one BUY and one or more SELLs on same tokenId");
2459
2576
  }
@@ -2469,7 +2586,7 @@ ${logs.join("\n")}`);
2469
2586
  operator,
2470
2587
  opts
2471
2588
  );
2472
- return this._buildUnsignedVtx([...hookInitIxs, ...ixs2], alt, payer);
2589
+ return this._buildUnsignedVtx([...preIxs, ...ixs2], alt, payer);
2473
2590
  }
2474
2591
  const allBuy = t.side === SIDE_BUY && makers.every((m) => m.order.side === SIDE_BUY);
2475
2592
  const allSell = t.side === SIDE_SELL && makers.every((m) => m.order.side === SIDE_SELL);
@@ -2490,7 +2607,7 @@ ${logs.join("\n")}`);
2490
2607
  ]);
2491
2608
  await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
2492
2609
  const ix = allBuy ? await this._buildMintIx(taker, makers, collateralMint, operator, payer) : await this._buildMergeIx(taker, makers, collateralMint, operator, payer, opts);
2493
- return this._buildUnsignedVtx([...hookInitIxs, ix], alt, payer);
2610
+ return this._buildUnsignedVtx([...preIxs, ix], alt, payer);
2494
2611
  }
2495
2612
  await Promise.all([
2496
2613
  this.registerOrderIfNeeded(taker),
@@ -2502,17 +2619,19 @@ ${logs.join("\n")}`);
2502
2619
  const ix = allBuy ? await this._buildMintIx(yesMaker, [taker], collateralMint, operator, payer) : await this._buildMergeIx(yesMaker, [taker], collateralMint, operator, payer, opts);
2503
2620
  ixs.push(ix);
2504
2621
  }
2505
- return this._buildUnsignedVtx([...hookInitIxs, ...ixs], alt, payer);
2622
+ return this._buildUnsignedVtx([...preIxs, ...ixs], alt, payer);
2506
2623
  }
2507
2624
  // ─── batchCollectRedeemEarly ─────────────────────────────────────────────────
2508
2625
  /**
2509
2626
  * Build VersionedTransaction for batchCollectRedeemEarly.
2510
2627
  *
2511
- * Flow: Ed25519 ix (user sigs) + batchCollectRedeemEarly ix.
2512
- * Each SignedCollectFeeOrder authorizes CLOB to collect `amount` winning tokens
2513
- * from that user, redeem via CTF, then distribute as fees.
2628
+ * Prerequisite: each user's CollectFeeOrder must be registered on-chain via
2629
+ * buildRegisterCollectFeeOrderTx (one tx per user).
2630
+ *
2631
+ * Flow: batchCollectRedeemEarly ix reads CollectFeeOrderRecord PDAs — no Ed25519 inline.
2632
+ * No tx-size limit from signatures, supports 10+ orders in one tx.
2514
2633
  *
2515
- * @param signedOrders - Array of { order, signature } from winning users
2634
+ * @param signedOrders - Array of { order, signature } (used to derive record PDAs)
2516
2635
  * @param condition - Market condition PDA
2517
2636
  * @param outcomeIndex - 0 = NO wins, 1 = YES wins
2518
2637
  * @param operator - Whitelisted operator pubkey (must sign)
@@ -2538,9 +2657,11 @@ ${logs.join("\n")}`);
2538
2657
  const [clobNoPosition] = PDA.position(condition, 0, clobConfig, this.programIds);
2539
2658
  const userAccounts = [];
2540
2659
  for (const { order } of signedOrders) {
2660
+ const [collectFeeOrderRecord] = PDA.collectFeeOrderRecord(order.user, order.nonce, this.programIds);
2541
2661
  const userTokenAta = getAssociatedTokenAddressSync(outcomeMint, order.user, false, TOKEN_2022_PROGRAM_ID);
2542
2662
  const [userPosition] = PDA.position(condition, outcomeIndex, order.user, this.programIds);
2543
2663
  userAccounts.push(
2664
+ { pubkey: collectFeeOrderRecord, isSigner: false, isWritable: true },
2544
2665
  { pubkey: order.user, isSigner: false, isWritable: false },
2545
2666
  { pubkey: userTokenAta, isSigner: false, isWritable: true },
2546
2667
  { pubkey: userPosition, isSigner: false, isWritable: true }
@@ -2577,11 +2698,7 @@ ${logs.join("\n")}`);
2577
2698
  const ix = await this.hookClient.buildInitHookIxIfNeeded(outcomeMint, payer);
2578
2699
  if (ix) hookInitIxs.push(ix);
2579
2700
  }
2580
- const ed25519Ix = buildBatchedCollectFeeEd25519Instruction(signedOrders);
2581
- const ed25519IxIndex = 2 + hookInitIxs.length;
2582
2701
  const collectIx = await this.program.methods.batchCollectRedeemEarly(
2583
- ed25519IxIndex,
2584
- // ix_index: adjusted for any prepended hook init ixs
2585
2702
  signedOrders.length,
2586
2703
  outcomeIndex
2587
2704
  ).accounts({
@@ -2598,14 +2715,96 @@ ${logs.join("\n")}`);
2598
2715
  clobNoAta,
2599
2716
  clobYesPosition,
2600
2717
  clobNoPosition,
2601
- ixSysvar: IX_SYSVAR,
2602
2718
  conditionalTokensProgram: this.programIds.conditionalTokens,
2603
2719
  tokenProgram: TOKEN_PROGRAM_ID,
2604
2720
  token2022Program: TOKEN_2022_PROGRAM_ID,
2605
2721
  systemProgram: SystemProgram.programId
2606
2722
  }).remainingAccounts([...userAccounts, ...hookAccounts, ...feeAccounts]).instruction();
2607
- const alt = opts?.lookupTable ?? this._altCache.get(condition.toBase58()) ?? await this.buildAltForCondition(condition, payer, collateralMint);
2608
- return this._buildUnsignedVtx([...hookInitIxs, ed25519Ix, collectIx], alt, payer);
2723
+ const alt = opts?.lookupTable ?? await this.buildAltForCollectBatch(condition, payer, collateralMint, signedOrders, outcomeIndex);
2724
+ return this._buildUnsignedVtx([...hookInitIxs, collectIx], alt, payer);
2725
+ }
2726
+ /**
2727
+ * Build ALT for batchCollectRedeemEarly — includes per-user accounts so all
2728
+ * remaining_accounts fit as 1-byte ALT indices instead of 32-byte inline addresses.
2729
+ */
2730
+ async buildAltForCollectBatch(condition, payer, collateralMint, signedOrders, outcomeIndex) {
2731
+ const userKeys = signedOrders.map((o) => o.order.user.toBase58()).sort((a, b) => a.localeCompare(b)).join(",");
2732
+ const cacheKey = `${condition.toBase58()}:collect:${userKeys}`;
2733
+ if (this._altCache.has(cacheKey)) return this._altCache.get(cacheKey);
2734
+ const { connection } = this.provider;
2735
+ const clobConfigPda = this.configPda();
2736
+ const [yesMint] = PDA.yesMint(condition, this.programIds);
2737
+ const [noMint] = PDA.noMint(condition, this.programIds);
2738
+ const outcomeMint = outcomeIndex === 1 ? yesMint : noMint;
2739
+ const [extraAccountMeta] = PDA.extraAccountMetaList(outcomeMint, this.programIds);
2740
+ const [hookConfig] = PDA.hookConfig(this.programIds);
2741
+ const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
2742
+ const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
2743
+ const clobYesAta = getAssociatedTokenAddressSync(yesMint, clobConfigPda, true, TOKEN_2022_PROGRAM_ID);
2744
+ const clobNoAta = getAssociatedTokenAddressSync(noMint, clobConfigPda, true, TOKEN_2022_PROGRAM_ID);
2745
+ const [clobYesPos] = PDA.position(condition, 1, clobConfigPda, this.programIds);
2746
+ const [clobNoPos] = PDA.position(condition, 0, clobConfigPda, this.programIds);
2747
+ const feeRecipientAddr = (await this.fetchConfig())?.feeRecipient;
2748
+ const addresses = [
2749
+ this.programIds.clobExchange,
2750
+ this.programIds.conditionalTokens,
2751
+ this.programIds.hook,
2752
+ TOKEN_PROGRAM_ID,
2753
+ TOKEN_2022_PROGRAM_ID,
2754
+ SystemProgram.programId,
2755
+ clobConfigPda,
2756
+ hookConfig,
2757
+ condition,
2758
+ yesMint,
2759
+ noMint,
2760
+ extraAccountMeta,
2761
+ collateralVault,
2762
+ vaultTokenAccount,
2763
+ clobYesAta,
2764
+ clobNoAta,
2765
+ clobYesPos,
2766
+ clobNoPos
2767
+ ];
2768
+ if (feeRecipientAddr) addresses.push(feeRecipientAddr);
2769
+ if (this.feeConfigOwner && this.programIds.feeManagement) {
2770
+ const companyAddr = await this.companyAddress();
2771
+ const refVault = await this.referralVault();
2772
+ addresses.push(this.programIds.feeManagement);
2773
+ addresses.push(PDA.feeConfig(this.feeConfigOwner, this.programIds)[0]);
2774
+ addresses.push(PDA.marketFeeOverride(condition, this.programIds)[0]);
2775
+ if (companyAddr) addresses.push(getAssociatedTokenAddressSync(collateralMint, companyAddr));
2776
+ if (refVault) addresses.push(refVault);
2777
+ const oracleVault = await this.getMarketOracleVault(condition, collateralMint) ?? payer;
2778
+ addresses.push(oracleVault);
2779
+ }
2780
+ for (const { order } of signedOrders) {
2781
+ const [collectFeeOrderRecord] = PDA.collectFeeOrderRecord(order.user, order.nonce, this.programIds);
2782
+ const userTokenAta = getAssociatedTokenAddressSync(outcomeMint, order.user, false, TOKEN_2022_PROGRAM_ID);
2783
+ const [userPosition] = PDA.position(condition, outcomeIndex, order.user, this.programIds);
2784
+ addresses.push(collectFeeOrderRecord, order.user, userTokenAta, userPosition);
2785
+ }
2786
+ const slot = await connection.getSlot("finalized");
2787
+ const [createIx, altAddress] = AddressLookupTableProgram.createLookupTable(
2788
+ { authority: payer, payer, recentSlot: slot }
2789
+ );
2790
+ const BATCH = 30;
2791
+ const extendIxs = [];
2792
+ for (let i = 0; i < addresses.length; i += BATCH) {
2793
+ extendIxs.push(AddressLookupTableProgram.extendLookupTable(
2794
+ { payer, authority: payer, lookupTable: altAddress, addresses: addresses.slice(i, i + BATCH) }
2795
+ ));
2796
+ }
2797
+ await this._sendLegacyTx([createIx, extendIxs[0]]);
2798
+ for (let i = 1; i < extendIxs.length; i++) await this._sendLegacyTx([extendIxs[i]]);
2799
+ for (let attempt = 0; attempt < 30; attempt++) {
2800
+ await new Promise((r) => setTimeout(r, 1e3));
2801
+ const res = await connection.getAddressLookupTable(altAddress);
2802
+ if (res.value && res.value.state.addresses.length === addresses.length) {
2803
+ this._altCache.set(cacheKey, res.value);
2804
+ return res.value;
2805
+ }
2806
+ }
2807
+ throw new Error(`ALT ${altAddress.toBase58()} not active after 30s`);
2609
2808
  }
2610
2809
  /**
2611
2810
  * Build ALT with static accounts for a condition — no order-specific PDAs needed.
@@ -3319,6 +3518,137 @@ var ReferralClient = class {
3319
3518
  ).transaction();
3320
3519
  }
3321
3520
  };
3521
+ var DisputeClient = class {
3522
+ constructor(program, provider, programIds) {
3523
+ this.program = program;
3524
+ this.provider = provider;
3525
+ this.programIds = programIds;
3526
+ }
3527
+ get walletPubkey() {
3528
+ return this.provider.wallet.publicKey;
3529
+ }
3530
+ configPdaFor(owner) {
3531
+ const [pda] = PDA.disputeConfig(owner, this.programIds);
3532
+ return pda;
3533
+ }
3534
+ disputeVault(owner, collateralMint) {
3535
+ const configPda = this.configPdaFor(owner);
3536
+ return getAssociatedTokenAddressSync(collateralMint, configPda, true);
3537
+ }
3538
+ // ─── Fetch ────────────────────────────────────────────────────────────────
3539
+ async fetchConfig(owner = this.walletPubkey) {
3540
+ const [configPda] = PDA.disputeConfig(owner, this.programIds);
3541
+ try {
3542
+ const acc = await this.program.account.disputeConfig.fetch(configPda);
3543
+ return {
3544
+ version: acc.version,
3545
+ owner: acc.owner,
3546
+ admin: acc.admin,
3547
+ collateralMint: acc.collateralMint,
3548
+ bump: acc.bump
3549
+ };
3550
+ } catch {
3551
+ return null;
3552
+ }
3553
+ }
3554
+ async fetchDisputeMarket(conditionId) {
3555
+ const [pda] = PDA.disputeMarket(conditionId, this.programIds);
3556
+ try {
3557
+ const acc = await this.program.account.disputeMarket.fetch(pda);
3558
+ return {
3559
+ version: acc.version,
3560
+ conditionId: acc.conditionId,
3561
+ deadline: acc.deadline,
3562
+ bond: acc.bond,
3563
+ amount: acc.amount,
3564
+ isResolved: acc.isResolved,
3565
+ bump: acc.bump
3566
+ };
3567
+ } catch {
3568
+ return null;
3569
+ }
3570
+ }
3571
+ async fetchUserDispute(user, conditionId) {
3572
+ const [pda] = PDA.userDispute(user, conditionId, this.programIds);
3573
+ try {
3574
+ const acc = await this.program.account.userDispute.fetch(pda);
3575
+ return {
3576
+ version: acc.version,
3577
+ user: acc.user,
3578
+ conditionId: acc.conditionId,
3579
+ amount: acc.amount,
3580
+ bump: acc.bump
3581
+ };
3582
+ } catch {
3583
+ return null;
3584
+ }
3585
+ }
3586
+ // ─── Instructions ─────────────────────────────────────────────────────────
3587
+ async initialize(collateralMint, owner = this.walletPubkey) {
3588
+ const [configPda] = PDA.disputeConfig(owner, this.programIds);
3589
+ const vault = getAssociatedTokenAddressSync(collateralMint, configPda, true);
3590
+ return this.program.methods.initialize().accounts({
3591
+ owner,
3592
+ disputeConfig: configPda,
3593
+ collateralMint,
3594
+ disputeVault: vault,
3595
+ tokenProgram: TOKEN_PROGRAM_ID,
3596
+ associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
3597
+ systemProgram: SystemProgram.programId
3598
+ }).transaction();
3599
+ }
3600
+ async buildSetAdminTx(newAdmin, owner = this.walletPubkey) {
3601
+ const [configPda] = PDA.disputeConfig(owner, this.programIds);
3602
+ return this.program.methods.setAdmin(newAdmin).accounts({
3603
+ owner,
3604
+ disputeConfig: configPda
3605
+ }).transaction();
3606
+ }
3607
+ async buildRaiseDisputeTx(conditionId, collateralMint, owner, user = this.walletPubkey, payer = user) {
3608
+ const [configPda] = PDA.disputeConfig(owner, this.programIds);
3609
+ const [disputeMarket] = PDA.disputeMarket(conditionId, this.programIds);
3610
+ const [userDispute] = PDA.userDispute(user, conditionId, this.programIds);
3611
+ const userAta = getAssociatedTokenAddressSync(collateralMint, user);
3612
+ const vault = getAssociatedTokenAddressSync(collateralMint, configPda, true);
3613
+ return this.program.methods.raiseDispute(Array.from(conditionId)).accounts({
3614
+ user,
3615
+ payer,
3616
+ disputeConfig: configPda,
3617
+ disputeMarket,
3618
+ userDispute,
3619
+ userAta,
3620
+ disputeVault: vault,
3621
+ tokenProgram: TOKEN_PROGRAM_ID,
3622
+ associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
3623
+ systemProgram: SystemProgram.programId
3624
+ }).transaction();
3625
+ }
3626
+ async buildClaimTx(conditionId, collateralMint, owner, user = this.walletPubkey) {
3627
+ const [configPda] = PDA.disputeConfig(owner, this.programIds);
3628
+ const [disputeMarket] = PDA.disputeMarket(conditionId, this.programIds);
3629
+ const [userDispute] = PDA.userDispute(user, conditionId, this.programIds);
3630
+ const vault = getAssociatedTokenAddressSync(collateralMint, configPda, true);
3631
+ const userAta = getAssociatedTokenAddressSync(collateralMint, user);
3632
+ return this.program.methods.claim(Array.from(conditionId)).accounts({
3633
+ user,
3634
+ disputeConfig: configPda,
3635
+ disputeMarket,
3636
+ userDispute,
3637
+ disputeVault: vault,
3638
+ userAta,
3639
+ tokenProgram: TOKEN_PROGRAM_ID
3640
+ }).transaction();
3641
+ }
3642
+ async buildResolveDisputeTx(conditionId, amount, isRefunded, owner, admin = this.walletPubkey) {
3643
+ const [configPda] = PDA.disputeConfig(owner, this.programIds);
3644
+ const [disputeMarket] = PDA.disputeMarket(conditionId, this.programIds);
3645
+ return this.program.methods.resolveDispute(Array.from(conditionId), amount, isRefunded).accounts({
3646
+ admin,
3647
+ disputeConfig: configPda,
3648
+ disputeMarket
3649
+ }).transaction();
3650
+ }
3651
+ };
3322
3652
 
3323
3653
  // src/idls/oracle.json
3324
3654
  var oracle_default = {
@@ -9237,7 +9567,8 @@ var clob_exchange_default = {
9237
9567
  name: "batch_collect_redeem_early",
9238
9568
  docs: [
9239
9569
  "Batch collect fee tokens from winning users after question resolution,",
9240
- "redeem them via CTF, and distribute USDS via fee_management."
9570
+ "redeem them via CTF, and distribute USDS via fee_management.",
9571
+ "Requires each user's CollectFeeOrderRecord to be registered via register_collect_fee_order."
9241
9572
  ],
9242
9573
  discriminator: [
9243
9574
  87,
@@ -9347,7 +9678,7 @@ var clob_exchange_default = {
9347
9678
  {
9348
9679
  name: "clob_yes_ata",
9349
9680
  docs: [
9350
- "CLOB's YES ATA (Token-2022) \u2014 must be pre-initialized (created during prior matchOrders)."
9681
+ "CLOB's YES ATA (Token-2022) \u2014 must be pre-initialized."
9351
9682
  ],
9352
9683
  writable: true
9353
9684
  },
@@ -9366,9 +9697,6 @@ var clob_exchange_default = {
9366
9697
  name: "clob_no_position",
9367
9698
  writable: true
9368
9699
  },
9369
- {
9370
- name: "ix_sysvar"
9371
- },
9372
9700
  {
9373
9701
  name: "conditional_tokens_program",
9374
9702
  address: "A6N1F8MRsdgcojAx8p6FaECvw8mo8w6qJcWsbKQBANK4"
@@ -9387,10 +9715,6 @@ var clob_exchange_default = {
9387
9715
  }
9388
9716
  ],
9389
9717
  args: [
9390
- {
9391
- name: "ix_index",
9392
- type: "u8"
9393
- },
9394
9718
  {
9395
9719
  name: "order_count",
9396
9720
  type: "u8"
@@ -10337,27 +10661,25 @@ var clob_exchange_default = {
10337
10661
  ]
10338
10662
  },
10339
10663
  {
10340
- name: "register_order",
10664
+ name: "register_collect_fee_order",
10341
10665
  docs: [
10342
- "Register a signed order on-chain (Ed25519 verify at registration time).",
10343
- "ix[0] must be Ed25519 precompile with 1 entry for order.signer."
10666
+ "Register a signed CollectFeeOrder on-chain (Ed25519 verify at registration time).",
10667
+ "ix[0] must be Ed25519 precompile with 1 entry for order.user.",
10668
+ "Call once per user before batch_collect_redeem_early."
10344
10669
  ],
10345
10670
  discriminator: [
10346
- 92,
10347
- 37,
10348
- 29,
10349
- 46,
10350
- 77,
10351
- 250,
10352
- 219,
10353
- 6
10671
+ 63,
10672
+ 26,
10673
+ 202,
10674
+ 98,
10675
+ 195,
10676
+ 2,
10677
+ 211,
10678
+ 36
10354
10679
  ],
10355
10680
  accounts: [
10356
10681
  {
10357
10682
  name: "payer",
10358
- docs: [
10359
- "Operator pays rent for the OrderRecord PDA."
10360
- ],
10361
10683
  writable: true,
10362
10684
  signer: true
10363
10685
  },
@@ -10392,25 +10714,26 @@ var clob_exchange_default = {
10392
10714
  name: "order_signer"
10393
10715
  },
10394
10716
  {
10395
- name: "order_record",
10717
+ name: "collect_fee_order_record",
10396
10718
  writable: true,
10397
10719
  pda: {
10398
10720
  seeds: [
10399
10721
  {
10400
10722
  kind: "const",
10401
10723
  value: [
10724
+ 99,
10402
10725
  111,
10403
- 114,
10404
- 100,
10405
- 101,
10406
- 114,
10407
- 95,
10408
- 114,
10726
+ 108,
10727
+ 108,
10409
10728
  101,
10410
10729
  99,
10730
+ 116,
10731
+ 95,
10411
10732
  111,
10412
10733
  114,
10413
- 100
10734
+ 100,
10735
+ 101,
10736
+ 114
10414
10737
  ]
10415
10738
  },
10416
10739
  {
@@ -10425,16 +10748,116 @@ var clob_exchange_default = {
10425
10748
  }
10426
10749
  },
10427
10750
  {
10428
- name: "order_status",
10429
- writable: true,
10430
- pda: {
10431
- seeds: [
10432
- {
10433
- kind: "const",
10434
- value: [
10435
- 111,
10436
- 114,
10437
- 100,
10751
+ name: "system_program",
10752
+ address: "11111111111111111111111111111111"
10753
+ }
10754
+ ],
10755
+ args: [
10756
+ {
10757
+ name: "nonce",
10758
+ type: "u64"
10759
+ }
10760
+ ]
10761
+ },
10762
+ {
10763
+ name: "register_order",
10764
+ docs: [
10765
+ "Register a signed order on-chain (Ed25519 verify at registration time).",
10766
+ "ix[0] must be Ed25519 precompile with 1 entry for order.signer."
10767
+ ],
10768
+ discriminator: [
10769
+ 92,
10770
+ 37,
10771
+ 29,
10772
+ 46,
10773
+ 77,
10774
+ 250,
10775
+ 219,
10776
+ 6
10777
+ ],
10778
+ accounts: [
10779
+ {
10780
+ name: "payer",
10781
+ docs: [
10782
+ "Operator pays rent for the OrderRecord PDA."
10783
+ ],
10784
+ writable: true,
10785
+ signer: true
10786
+ },
10787
+ {
10788
+ name: "clob_config",
10789
+ pda: {
10790
+ seeds: [
10791
+ {
10792
+ kind: "const",
10793
+ value: [
10794
+ 99,
10795
+ 108,
10796
+ 111,
10797
+ 98,
10798
+ 95,
10799
+ 99,
10800
+ 111,
10801
+ 110,
10802
+ 102,
10803
+ 105,
10804
+ 103
10805
+ ]
10806
+ }
10807
+ ]
10808
+ }
10809
+ },
10810
+ {
10811
+ name: "ix_sysvar",
10812
+ address: "Sysvar1nstructions1111111111111111111111111"
10813
+ },
10814
+ {
10815
+ name: "order_signer"
10816
+ },
10817
+ {
10818
+ name: "order_record",
10819
+ writable: true,
10820
+ pda: {
10821
+ seeds: [
10822
+ {
10823
+ kind: "const",
10824
+ value: [
10825
+ 111,
10826
+ 114,
10827
+ 100,
10828
+ 101,
10829
+ 114,
10830
+ 95,
10831
+ 114,
10832
+ 101,
10833
+ 99,
10834
+ 111,
10835
+ 114,
10836
+ 100
10837
+ ]
10838
+ },
10839
+ {
10840
+ kind: "account",
10841
+ path: "order_signer"
10842
+ },
10843
+ {
10844
+ kind: "arg",
10845
+ path: "nonce"
10846
+ }
10847
+ ]
10848
+ }
10849
+ },
10850
+ {
10851
+ name: "order_status",
10852
+ writable: true,
10853
+ pda: {
10854
+ seeds: [
10855
+ {
10856
+ kind: "const",
10857
+ value: [
10858
+ 111,
10859
+ 114,
10860
+ 100,
10438
10861
  101,
10439
10862
  114
10440
10863
  ]
@@ -10626,6 +11049,19 @@ var clob_exchange_default = {
10626
11049
  160
10627
11050
  ]
10628
11051
  },
11052
+ {
11053
+ name: "CollectFeeOrderRecord",
11054
+ discriminator: [
11055
+ 145,
11056
+ 140,
11057
+ 193,
11058
+ 74,
11059
+ 12,
11060
+ 98,
11061
+ 74,
11062
+ 130
11063
+ ]
11064
+ },
10629
11065
  {
10630
11066
  name: "OrderStatus",
10631
11067
  discriminator: [
@@ -10835,6 +11271,53 @@ var clob_exchange_default = {
10835
11271
  ]
10836
11272
  }
10837
11273
  },
11274
+ {
11275
+ name: "CollectFeeOrderRecord",
11276
+ docs: [
11277
+ "On-chain record of a signed CollectFeeOrder.",
11278
+ "Created by `register_collect_fee_order` after Ed25519 verification.",
11279
+ "Read and marked collected by `batch_collect_redeem_early`.",
11280
+ "",
11281
+ 'PDA seeds: [b"collect_order", user, nonce_le_bytes]'
11282
+ ],
11283
+ type: {
11284
+ kind: "struct",
11285
+ fields: [
11286
+ {
11287
+ name: "user",
11288
+ type: "pubkey"
11289
+ },
11290
+ {
11291
+ name: "condition",
11292
+ type: "pubkey"
11293
+ },
11294
+ {
11295
+ name: "token_mint",
11296
+ type: "pubkey"
11297
+ },
11298
+ {
11299
+ name: "amount",
11300
+ type: "u64"
11301
+ },
11302
+ {
11303
+ name: "nonce",
11304
+ type: "u64"
11305
+ },
11306
+ {
11307
+ name: "expiry",
11308
+ type: "i64"
11309
+ },
11310
+ {
11311
+ name: "is_collected",
11312
+ type: "bool"
11313
+ },
11314
+ {
11315
+ name: "bump",
11316
+ type: "u8"
11317
+ }
11318
+ ]
11319
+ }
11320
+ },
10838
11321
  {
10839
11322
  name: "ComplementaryMatchEvent",
10840
11323
  type: {
@@ -16440,106 +16923,1135 @@ var referral_default = {
16440
16923
  ]
16441
16924
  };
16442
16925
 
16443
- // src/sdk.ts
16444
- var XMarketSDK = class {
16445
- constructor(config, wallet, marketOwner) {
16446
- this.networkConfig = config;
16447
- this.provider = new anchor5.AnchorProvider(
16448
- new Connection(config.rpcUrl, "confirmed"),
16449
- wallet,
16450
- { commitment: "confirmed", preflightCommitment: "confirmed" }
16451
- );
16452
- anchor5.setProvider(this.provider);
16453
- this._programIds = config.programIds;
16454
- this._marketOwner = marketOwner ?? wallet.publicKey;
16455
- }
16456
- _withAddress(idl, address) {
16457
- return { ...idl, address: address.toBase58() };
16458
- }
16459
- get oracle() {
16460
- if (!this._oracle) {
16461
- const program = new anchor5.Program(this._withAddress(oracle_default, this._programIds.oracle), this.provider);
16462
- this._oracle = new OracleClient(program, this.provider, this._programIds);
16463
- }
16464
- return this._oracle;
16465
- }
16466
- get hook() {
16467
- if (!this._hook) {
16468
- const program = new anchor5.Program(this._withAddress(hook_default, this._programIds.hook), this.provider);
16469
- this._hook = new HookClient(program, this.provider, this._programIds);
16470
- }
16471
- return this._hook;
16472
- }
16473
- get market() {
16474
- if (!this._market) {
16475
- const program = new anchor5.Program(this._withAddress(question_market_default, this._programIds.questionMarket), this.provider);
16476
- this._market = new MarketClient(program, this.provider, this._programIds, this._marketOwner);
16477
- this._market.ctfClient = this.ctf;
16478
- this._market.feeConfigOwner = this.networkConfig.feeConfigOwner ?? this._marketOwner;
16479
- }
16480
- return this._market;
16481
- }
16482
- get ctf() {
16483
- if (!this._ctf) {
16484
- const program = new anchor5.Program(this._withAddress(conditional_tokens_default, this._programIds.conditionalTokens), this.provider);
16485
- this._ctf = new CtfClient(program, this.provider, this._programIds);
16486
- }
16487
- return this._ctf;
16488
- }
16489
- get clob() {
16490
- if (!this._clob) {
16491
- const program = new anchor5.Program(this._withAddress(clob_exchange_default, this._programIds.clobExchange), this.provider);
16492
- this._clob = new ClobClient(program, this.provider, this._programIds, this.networkConfig);
16493
- if (this.networkConfig.feeConfigOwner && this._programIds.feeManagement) {
16494
- this._clob.feeConfigOwner = this.networkConfig.feeConfigOwner;
16495
- this._clob.feeClient = this.fee;
16496
- }
16497
- this._clob.ctfClient = this.ctf;
16498
- this._clob.qmConfigPda = this.market.configPda;
16499
- this._clob.hookClient = this.hook;
16500
- }
16501
- return this._clob;
16502
- }
16503
- get fee() {
16504
- if (!this._fee) {
16505
- if (!this._programIds.feeManagement) throw new Error("feeManagement program ID not configured in NetworkConfig");
16506
- const program = new anchor5.Program(this._withAddress(fee_management_default, this._programIds.feeManagement), this.provider);
16507
- this._fee = new FeeManagementClient(program, this.provider, this._programIds);
16508
- }
16509
- return this._fee;
16510
- }
16511
- get presale() {
16512
- if (!this._presale) {
16513
- if (!this._programIds.presale) throw new Error("presale program ID not configured in NetworkConfig");
16514
- const program = new anchor5.Program(this._withAddress(presale_default, this._programIds.presale), this.provider);
16515
- this._presale = new PresaleClient(program, this.provider, this._programIds);
16516
- }
16517
- return this._presale;
16518
- }
16519
- get marketOracle() {
16520
- if (!this._marketOracle) {
16521
- if (!this._programIds.marketOracle) throw new Error("marketOracle program ID not configured in NetworkConfig");
16522
- const program = new anchor5.Program(this._withAddress(market_oracle_default, this._programIds.marketOracle), this.provider);
16523
- this._marketOracle = new MarketOracleClient(program, this.provider, this._programIds);
16524
- }
16525
- return this._marketOracle;
16526
- }
16527
- get admin() {
16528
- if (!this._admin) {
16529
- if (!this._programIds.adminContract) throw new Error("adminContract program ID not configured in NetworkConfig");
16530
- const program = new anchor5.Program(this._withAddress(admin_contract_default, this._programIds.adminContract), this.provider);
16531
- this._admin = new AdminClient(program, this.provider, this._programIds);
16532
- }
16533
- return this._admin;
16534
- }
16535
- get referral() {
16536
- if (!this._referral) {
16537
- if (!this._programIds.referral) throw new Error("referral program ID not configured in NetworkConfig");
16538
- const program = new anchor5.Program(this._withAddress(referral_default, this._programIds.referral), this.provider);
16926
+ // src/idls/dispute.json
16927
+ var dispute_default = {
16928
+ address: "4toSDWDCcx37R6HZ78P71nDp3NNoJvcmQpzP4sfivVvL",
16929
+ metadata: {
16930
+ name: "dispute",
16931
+ version: "0.1.0",
16932
+ spec: "0.1.0",
16933
+ description: "Dispute program for XMarket \u2014 raise/resolve/claim disputes on prediction markets"
16934
+ },
16935
+ instructions: [
16936
+ {
16937
+ name: "claim",
16938
+ discriminator: [
16939
+ 62,
16940
+ 198,
16941
+ 214,
16942
+ 193,
16943
+ 213,
16944
+ 159,
16945
+ 108,
16946
+ 210
16947
+ ],
16948
+ accounts: [
16949
+ {
16950
+ name: "user",
16951
+ signer: true
16952
+ },
16953
+ {
16954
+ name: "dispute_config",
16955
+ pda: {
16956
+ seeds: [
16957
+ {
16958
+ kind: "const",
16959
+ value: [
16960
+ 100,
16961
+ 105,
16962
+ 115,
16963
+ 112,
16964
+ 117,
16965
+ 116,
16966
+ 101,
16967
+ 95,
16968
+ 99,
16969
+ 111,
16970
+ 110,
16971
+ 102,
16972
+ 105,
16973
+ 103
16974
+ ]
16975
+ },
16976
+ {
16977
+ kind: "account",
16978
+ path: "dispute_config.owner",
16979
+ account: "DisputeConfig"
16980
+ }
16981
+ ]
16982
+ }
16983
+ },
16984
+ {
16985
+ name: "dispute_market",
16986
+ pda: {
16987
+ seeds: [
16988
+ {
16989
+ kind: "const",
16990
+ value: [
16991
+ 100,
16992
+ 105,
16993
+ 115,
16994
+ 112,
16995
+ 117,
16996
+ 116,
16997
+ 101,
16998
+ 95,
16999
+ 109,
17000
+ 97,
17001
+ 114,
17002
+ 107,
17003
+ 101,
17004
+ 116
17005
+ ]
17006
+ },
17007
+ {
17008
+ kind: "arg",
17009
+ path: "condition_id"
17010
+ }
17011
+ ]
17012
+ }
17013
+ },
17014
+ {
17015
+ name: "user_dispute",
17016
+ writable: true,
17017
+ pda: {
17018
+ seeds: [
17019
+ {
17020
+ kind: "const",
17021
+ value: [
17022
+ 117,
17023
+ 115,
17024
+ 101,
17025
+ 114,
17026
+ 95,
17027
+ 100,
17028
+ 105,
17029
+ 115,
17030
+ 112,
17031
+ 117,
17032
+ 116,
17033
+ 101
17034
+ ]
17035
+ },
17036
+ {
17037
+ kind: "account",
17038
+ path: "user"
17039
+ },
17040
+ {
17041
+ kind: "arg",
17042
+ path: "condition_id"
17043
+ }
17044
+ ]
17045
+ }
17046
+ },
17047
+ {
17048
+ name: "dispute_vault",
17049
+ writable: true,
17050
+ pda: {
17051
+ seeds: [
17052
+ {
17053
+ kind: "account",
17054
+ path: "dispute_config"
17055
+ },
17056
+ {
17057
+ kind: "const",
17058
+ value: [
17059
+ 6,
17060
+ 221,
17061
+ 246,
17062
+ 225,
17063
+ 215,
17064
+ 101,
17065
+ 161,
17066
+ 147,
17067
+ 217,
17068
+ 203,
17069
+ 225,
17070
+ 70,
17071
+ 206,
17072
+ 235,
17073
+ 121,
17074
+ 172,
17075
+ 28,
17076
+ 180,
17077
+ 133,
17078
+ 237,
17079
+ 95,
17080
+ 91,
17081
+ 55,
17082
+ 145,
17083
+ 58,
17084
+ 140,
17085
+ 245,
17086
+ 133,
17087
+ 126,
17088
+ 255,
17089
+ 0,
17090
+ 169
17091
+ ]
17092
+ },
17093
+ {
17094
+ kind: "account",
17095
+ path: "dispute_config.collateral_mint",
17096
+ account: "DisputeConfig"
17097
+ }
17098
+ ],
17099
+ program: {
17100
+ kind: "const",
17101
+ value: [
17102
+ 140,
17103
+ 151,
17104
+ 37,
17105
+ 143,
17106
+ 78,
17107
+ 36,
17108
+ 137,
17109
+ 241,
17110
+ 187,
17111
+ 61,
17112
+ 16,
17113
+ 41,
17114
+ 20,
17115
+ 142,
17116
+ 13,
17117
+ 131,
17118
+ 11,
17119
+ 90,
17120
+ 19,
17121
+ 153,
17122
+ 218,
17123
+ 255,
17124
+ 16,
17125
+ 132,
17126
+ 4,
17127
+ 142,
17128
+ 123,
17129
+ 216,
17130
+ 219,
17131
+ 233,
17132
+ 248,
17133
+ 89
17134
+ ]
17135
+ }
17136
+ }
17137
+ },
17138
+ {
17139
+ name: "user_ata",
17140
+ writable: true
17141
+ },
17142
+ {
17143
+ name: "token_program",
17144
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
17145
+ }
17146
+ ],
17147
+ args: [
17148
+ {
17149
+ name: "condition_id",
17150
+ type: {
17151
+ array: [
17152
+ "u8",
17153
+ 32
17154
+ ]
17155
+ }
17156
+ }
17157
+ ]
17158
+ },
17159
+ {
17160
+ name: "initialize",
17161
+ discriminator: [
17162
+ 175,
17163
+ 175,
17164
+ 109,
17165
+ 31,
17166
+ 13,
17167
+ 152,
17168
+ 155,
17169
+ 237
17170
+ ],
17171
+ accounts: [
17172
+ {
17173
+ name: "owner",
17174
+ writable: true,
17175
+ signer: true
17176
+ },
17177
+ {
17178
+ name: "dispute_config",
17179
+ writable: true,
17180
+ pda: {
17181
+ seeds: [
17182
+ {
17183
+ kind: "const",
17184
+ value: [
17185
+ 100,
17186
+ 105,
17187
+ 115,
17188
+ 112,
17189
+ 117,
17190
+ 116,
17191
+ 101,
17192
+ 95,
17193
+ 99,
17194
+ 111,
17195
+ 110,
17196
+ 102,
17197
+ 105,
17198
+ 103
17199
+ ]
17200
+ },
17201
+ {
17202
+ kind: "account",
17203
+ path: "owner"
17204
+ }
17205
+ ]
17206
+ }
17207
+ },
17208
+ {
17209
+ name: "collateral_mint"
17210
+ },
17211
+ {
17212
+ name: "dispute_vault",
17213
+ docs: [
17214
+ "ATA owned by dispute_config PDA \u2014 holds USDS bonds from all dispute raisers"
17215
+ ],
17216
+ writable: true,
17217
+ pda: {
17218
+ seeds: [
17219
+ {
17220
+ kind: "account",
17221
+ path: "dispute_config"
17222
+ },
17223
+ {
17224
+ kind: "const",
17225
+ value: [
17226
+ 6,
17227
+ 221,
17228
+ 246,
17229
+ 225,
17230
+ 215,
17231
+ 101,
17232
+ 161,
17233
+ 147,
17234
+ 217,
17235
+ 203,
17236
+ 225,
17237
+ 70,
17238
+ 206,
17239
+ 235,
17240
+ 121,
17241
+ 172,
17242
+ 28,
17243
+ 180,
17244
+ 133,
17245
+ 237,
17246
+ 95,
17247
+ 91,
17248
+ 55,
17249
+ 145,
17250
+ 58,
17251
+ 140,
17252
+ 245,
17253
+ 133,
17254
+ 126,
17255
+ 255,
17256
+ 0,
17257
+ 169
17258
+ ]
17259
+ },
17260
+ {
17261
+ kind: "account",
17262
+ path: "collateral_mint"
17263
+ }
17264
+ ],
17265
+ program: {
17266
+ kind: "const",
17267
+ value: [
17268
+ 140,
17269
+ 151,
17270
+ 37,
17271
+ 143,
17272
+ 78,
17273
+ 36,
17274
+ 137,
17275
+ 241,
17276
+ 187,
17277
+ 61,
17278
+ 16,
17279
+ 41,
17280
+ 20,
17281
+ 142,
17282
+ 13,
17283
+ 131,
17284
+ 11,
17285
+ 90,
17286
+ 19,
17287
+ 153,
17288
+ 218,
17289
+ 255,
17290
+ 16,
17291
+ 132,
17292
+ 4,
17293
+ 142,
17294
+ 123,
17295
+ 216,
17296
+ 219,
17297
+ 233,
17298
+ 248,
17299
+ 89
17300
+ ]
17301
+ }
17302
+ }
17303
+ },
17304
+ {
17305
+ name: "token_program",
17306
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
17307
+ },
17308
+ {
17309
+ name: "associated_token_program",
17310
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
17311
+ },
17312
+ {
17313
+ name: "system_program",
17314
+ address: "11111111111111111111111111111111"
17315
+ }
17316
+ ],
17317
+ args: []
17318
+ },
17319
+ {
17320
+ name: "raise_dispute",
17321
+ discriminator: [
17322
+ 41,
17323
+ 243,
17324
+ 1,
17325
+ 51,
17326
+ 150,
17327
+ 95,
17328
+ 246,
17329
+ 73
17330
+ ],
17331
+ accounts: [
17332
+ {
17333
+ name: "user",
17334
+ signer: true
17335
+ },
17336
+ {
17337
+ name: "payer",
17338
+ writable: true,
17339
+ signer: true
17340
+ },
17341
+ {
17342
+ name: "dispute_config",
17343
+ pda: {
17344
+ seeds: [
17345
+ {
17346
+ kind: "const",
17347
+ value: [
17348
+ 100,
17349
+ 105,
17350
+ 115,
17351
+ 112,
17352
+ 117,
17353
+ 116,
17354
+ 101,
17355
+ 95,
17356
+ 99,
17357
+ 111,
17358
+ 110,
17359
+ 102,
17360
+ 105,
17361
+ 103
17362
+ ]
17363
+ },
17364
+ {
17365
+ kind: "account",
17366
+ path: "dispute_config.owner",
17367
+ account: "DisputeConfig"
17368
+ }
17369
+ ]
17370
+ }
17371
+ },
17372
+ {
17373
+ name: "dispute_market",
17374
+ writable: true,
17375
+ pda: {
17376
+ seeds: [
17377
+ {
17378
+ kind: "const",
17379
+ value: [
17380
+ 100,
17381
+ 105,
17382
+ 115,
17383
+ 112,
17384
+ 117,
17385
+ 116,
17386
+ 101,
17387
+ 95,
17388
+ 109,
17389
+ 97,
17390
+ 114,
17391
+ 107,
17392
+ 101,
17393
+ 116
17394
+ ]
17395
+ },
17396
+ {
17397
+ kind: "arg",
17398
+ path: "condition_id"
17399
+ }
17400
+ ]
17401
+ }
17402
+ },
17403
+ {
17404
+ name: "user_dispute",
17405
+ writable: true,
17406
+ pda: {
17407
+ seeds: [
17408
+ {
17409
+ kind: "const",
17410
+ value: [
17411
+ 117,
17412
+ 115,
17413
+ 101,
17414
+ 114,
17415
+ 95,
17416
+ 100,
17417
+ 105,
17418
+ 115,
17419
+ 112,
17420
+ 117,
17421
+ 116,
17422
+ 101
17423
+ ]
17424
+ },
17425
+ {
17426
+ kind: "account",
17427
+ path: "user"
17428
+ },
17429
+ {
17430
+ kind: "arg",
17431
+ path: "condition_id"
17432
+ }
17433
+ ]
17434
+ }
17435
+ },
17436
+ {
17437
+ name: "user_ata",
17438
+ writable: true,
17439
+ pda: {
17440
+ seeds: [
17441
+ {
17442
+ kind: "account",
17443
+ path: "user"
17444
+ },
17445
+ {
17446
+ kind: "const",
17447
+ value: [
17448
+ 6,
17449
+ 221,
17450
+ 246,
17451
+ 225,
17452
+ 215,
17453
+ 101,
17454
+ 161,
17455
+ 147,
17456
+ 217,
17457
+ 203,
17458
+ 225,
17459
+ 70,
17460
+ 206,
17461
+ 235,
17462
+ 121,
17463
+ 172,
17464
+ 28,
17465
+ 180,
17466
+ 133,
17467
+ 237,
17468
+ 95,
17469
+ 91,
17470
+ 55,
17471
+ 145,
17472
+ 58,
17473
+ 140,
17474
+ 245,
17475
+ 133,
17476
+ 126,
17477
+ 255,
17478
+ 0,
17479
+ 169
17480
+ ]
17481
+ },
17482
+ {
17483
+ kind: "account",
17484
+ path: "dispute_config.collateral_mint",
17485
+ account: "DisputeConfig"
17486
+ }
17487
+ ],
17488
+ program: {
17489
+ kind: "const",
17490
+ value: [
17491
+ 140,
17492
+ 151,
17493
+ 37,
17494
+ 143,
17495
+ 78,
17496
+ 36,
17497
+ 137,
17498
+ 241,
17499
+ 187,
17500
+ 61,
17501
+ 16,
17502
+ 41,
17503
+ 20,
17504
+ 142,
17505
+ 13,
17506
+ 131,
17507
+ 11,
17508
+ 90,
17509
+ 19,
17510
+ 153,
17511
+ 218,
17512
+ 255,
17513
+ 16,
17514
+ 132,
17515
+ 4,
17516
+ 142,
17517
+ 123,
17518
+ 216,
17519
+ 219,
17520
+ 233,
17521
+ 248,
17522
+ 89
17523
+ ]
17524
+ }
17525
+ }
17526
+ },
17527
+ {
17528
+ name: "dispute_vault",
17529
+ writable: true,
17530
+ pda: {
17531
+ seeds: [
17532
+ {
17533
+ kind: "account",
17534
+ path: "dispute_config"
17535
+ },
17536
+ {
17537
+ kind: "const",
17538
+ value: [
17539
+ 6,
17540
+ 221,
17541
+ 246,
17542
+ 225,
17543
+ 215,
17544
+ 101,
17545
+ 161,
17546
+ 147,
17547
+ 217,
17548
+ 203,
17549
+ 225,
17550
+ 70,
17551
+ 206,
17552
+ 235,
17553
+ 121,
17554
+ 172,
17555
+ 28,
17556
+ 180,
17557
+ 133,
17558
+ 237,
17559
+ 95,
17560
+ 91,
17561
+ 55,
17562
+ 145,
17563
+ 58,
17564
+ 140,
17565
+ 245,
17566
+ 133,
17567
+ 126,
17568
+ 255,
17569
+ 0,
17570
+ 169
17571
+ ]
17572
+ },
17573
+ {
17574
+ kind: "account",
17575
+ path: "dispute_config.collateral_mint",
17576
+ account: "DisputeConfig"
17577
+ }
17578
+ ],
17579
+ program: {
17580
+ kind: "const",
17581
+ value: [
17582
+ 140,
17583
+ 151,
17584
+ 37,
17585
+ 143,
17586
+ 78,
17587
+ 36,
17588
+ 137,
17589
+ 241,
17590
+ 187,
17591
+ 61,
17592
+ 16,
17593
+ 41,
17594
+ 20,
17595
+ 142,
17596
+ 13,
17597
+ 131,
17598
+ 11,
17599
+ 90,
17600
+ 19,
17601
+ 153,
17602
+ 218,
17603
+ 255,
17604
+ 16,
17605
+ 132,
17606
+ 4,
17607
+ 142,
17608
+ 123,
17609
+ 216,
17610
+ 219,
17611
+ 233,
17612
+ 248,
17613
+ 89
17614
+ ]
17615
+ }
17616
+ }
17617
+ },
17618
+ {
17619
+ name: "token_program",
17620
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
17621
+ },
17622
+ {
17623
+ name: "associated_token_program",
17624
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
17625
+ },
17626
+ {
17627
+ name: "system_program",
17628
+ address: "11111111111111111111111111111111"
17629
+ }
17630
+ ],
17631
+ args: [
17632
+ {
17633
+ name: "condition_id",
17634
+ type: {
17635
+ array: [
17636
+ "u8",
17637
+ 32
17638
+ ]
17639
+ }
17640
+ }
17641
+ ]
17642
+ },
17643
+ {
17644
+ name: "resolve_dispute",
17645
+ discriminator: [
17646
+ 231,
17647
+ 6,
17648
+ 202,
17649
+ 6,
17650
+ 96,
17651
+ 103,
17652
+ 12,
17653
+ 230
17654
+ ],
17655
+ accounts: [
17656
+ {
17657
+ name: "admin",
17658
+ signer: true
17659
+ },
17660
+ {
17661
+ name: "dispute_config",
17662
+ pda: {
17663
+ seeds: [
17664
+ {
17665
+ kind: "const",
17666
+ value: [
17667
+ 100,
17668
+ 105,
17669
+ 115,
17670
+ 112,
17671
+ 117,
17672
+ 116,
17673
+ 101,
17674
+ 95,
17675
+ 99,
17676
+ 111,
17677
+ 110,
17678
+ 102,
17679
+ 105,
17680
+ 103
17681
+ ]
17682
+ },
17683
+ {
17684
+ kind: "account",
17685
+ path: "dispute_config.owner",
17686
+ account: "DisputeConfig"
17687
+ }
17688
+ ]
17689
+ }
17690
+ },
17691
+ {
17692
+ name: "dispute_market",
17693
+ writable: true,
17694
+ pda: {
17695
+ seeds: [
17696
+ {
17697
+ kind: "const",
17698
+ value: [
17699
+ 100,
17700
+ 105,
17701
+ 115,
17702
+ 112,
17703
+ 117,
17704
+ 116,
17705
+ 101,
17706
+ 95,
17707
+ 109,
17708
+ 97,
17709
+ 114,
17710
+ 107,
17711
+ 101,
17712
+ 116
17713
+ ]
17714
+ },
17715
+ {
17716
+ kind: "arg",
17717
+ path: "condition_id"
17718
+ }
17719
+ ]
17720
+ }
17721
+ }
17722
+ ],
17723
+ args: [
17724
+ {
17725
+ name: "condition_id",
17726
+ type: {
17727
+ array: [
17728
+ "u8",
17729
+ 32
17730
+ ]
17731
+ }
17732
+ },
17733
+ {
17734
+ name: "amount",
17735
+ type: "u64"
17736
+ },
17737
+ {
17738
+ name: "is_refunded",
17739
+ type: "bool"
17740
+ }
17741
+ ]
17742
+ },
17743
+ {
17744
+ name: "set_admin",
17745
+ discriminator: [
17746
+ 251,
17747
+ 163,
17748
+ 0,
17749
+ 52,
17750
+ 91,
17751
+ 194,
17752
+ 187,
17753
+ 92
17754
+ ],
17755
+ accounts: [
17756
+ {
17757
+ name: "owner",
17758
+ signer: true
17759
+ },
17760
+ {
17761
+ name: "dispute_config",
17762
+ writable: true,
17763
+ pda: {
17764
+ seeds: [
17765
+ {
17766
+ kind: "const",
17767
+ value: [
17768
+ 100,
17769
+ 105,
17770
+ 115,
17771
+ 112,
17772
+ 117,
17773
+ 116,
17774
+ 101,
17775
+ 95,
17776
+ 99,
17777
+ 111,
17778
+ 110,
17779
+ 102,
17780
+ 105,
17781
+ 103
17782
+ ]
17783
+ },
17784
+ {
17785
+ kind: "account",
17786
+ path: "owner"
17787
+ }
17788
+ ]
17789
+ }
17790
+ }
17791
+ ],
17792
+ args: [
17793
+ {
17794
+ name: "new_admin",
17795
+ type: "pubkey"
17796
+ }
17797
+ ]
17798
+ }
17799
+ ],
17800
+ accounts: [
17801
+ {
17802
+ name: "DisputeConfig",
17803
+ discriminator: [
17804
+ 230,
17805
+ 88,
17806
+ 200,
17807
+ 99,
17808
+ 12,
17809
+ 93,
17810
+ 56,
17811
+ 156
17812
+ ]
17813
+ },
17814
+ {
17815
+ name: "DisputeMarket",
17816
+ discriminator: [
17817
+ 235,
17818
+ 222,
17819
+ 113,
17820
+ 250,
17821
+ 83,
17822
+ 196,
17823
+ 239,
17824
+ 159
17825
+ ]
17826
+ },
17827
+ {
17828
+ name: "UserDispute",
17829
+ discriminator: [
17830
+ 54,
17831
+ 252,
17832
+ 42,
17833
+ 67,
17834
+ 211,
17835
+ 11,
17836
+ 192,
17837
+ 188
17838
+ ]
17839
+ }
17840
+ ],
17841
+ types: [
17842
+ {
17843
+ name: "DisputeConfig",
17844
+ type: {
17845
+ kind: "struct",
17846
+ fields: [
17847
+ {
17848
+ name: "version",
17849
+ type: "u8"
17850
+ },
17851
+ {
17852
+ name: "owner",
17853
+ type: "pubkey"
17854
+ },
17855
+ {
17856
+ name: "admin",
17857
+ type: "pubkey"
17858
+ },
17859
+ {
17860
+ name: "collateral_mint",
17861
+ type: "pubkey"
17862
+ },
17863
+ {
17864
+ name: "bump",
17865
+ type: "u8"
17866
+ }
17867
+ ]
17868
+ }
17869
+ },
17870
+ {
17871
+ name: "DisputeMarket",
17872
+ type: {
17873
+ kind: "struct",
17874
+ fields: [
17875
+ {
17876
+ name: "version",
17877
+ type: "u8"
17878
+ },
17879
+ {
17880
+ name: "condition_id",
17881
+ type: {
17882
+ array: [
17883
+ "u8",
17884
+ 32
17885
+ ]
17886
+ }
17887
+ },
17888
+ {
17889
+ name: "deadline",
17890
+ type: "i64"
17891
+ },
17892
+ {
17893
+ name: "bond",
17894
+ type: "u64"
17895
+ },
17896
+ {
17897
+ name: "amount",
17898
+ type: "u64"
17899
+ },
17900
+ {
17901
+ name: "is_resolved",
17902
+ type: "bool"
17903
+ },
17904
+ {
17905
+ name: "bump",
17906
+ type: "u8"
17907
+ }
17908
+ ]
17909
+ }
17910
+ },
17911
+ {
17912
+ name: "UserDispute",
17913
+ type: {
17914
+ kind: "struct",
17915
+ fields: [
17916
+ {
17917
+ name: "version",
17918
+ type: "u8"
17919
+ },
17920
+ {
17921
+ name: "user",
17922
+ type: "pubkey"
17923
+ },
17924
+ {
17925
+ name: "condition_id",
17926
+ type: {
17927
+ array: [
17928
+ "u8",
17929
+ 32
17930
+ ]
17931
+ }
17932
+ },
17933
+ {
17934
+ name: "amount",
17935
+ type: "u64"
17936
+ },
17937
+ {
17938
+ name: "bump",
17939
+ type: "u8"
17940
+ }
17941
+ ]
17942
+ }
17943
+ }
17944
+ ]
17945
+ };
17946
+
17947
+ // src/sdk.ts
17948
+ var XMarketSDK = class {
17949
+ constructor(config, wallet, marketOwner) {
17950
+ this.networkConfig = config;
17951
+ this.provider = new anchor5.AnchorProvider(
17952
+ new Connection(config.rpcUrl, "confirmed"),
17953
+ wallet,
17954
+ { commitment: "confirmed", preflightCommitment: "confirmed" }
17955
+ );
17956
+ anchor5.setProvider(this.provider);
17957
+ this._programIds = config.programIds;
17958
+ this._marketOwner = marketOwner ?? wallet.publicKey;
17959
+ }
17960
+ _withAddress(idl, address) {
17961
+ return { ...idl, address: address.toBase58() };
17962
+ }
17963
+ get oracle() {
17964
+ if (!this._oracle) {
17965
+ const program = new anchor5.Program(this._withAddress(oracle_default, this._programIds.oracle), this.provider);
17966
+ this._oracle = new OracleClient(program, this.provider, this._programIds);
17967
+ }
17968
+ return this._oracle;
17969
+ }
17970
+ get hook() {
17971
+ if (!this._hook) {
17972
+ const program = new anchor5.Program(this._withAddress(hook_default, this._programIds.hook), this.provider);
17973
+ this._hook = new HookClient(program, this.provider, this._programIds);
17974
+ }
17975
+ return this._hook;
17976
+ }
17977
+ get market() {
17978
+ if (!this._market) {
17979
+ const program = new anchor5.Program(this._withAddress(question_market_default, this._programIds.questionMarket), this.provider);
17980
+ this._market = new MarketClient(program, this.provider, this._programIds, this._marketOwner);
17981
+ this._market.ctfClient = this.ctf;
17982
+ this._market.feeConfigOwner = this.networkConfig.feeConfigOwner ?? this._marketOwner;
17983
+ }
17984
+ return this._market;
17985
+ }
17986
+ get ctf() {
17987
+ if (!this._ctf) {
17988
+ const program = new anchor5.Program(this._withAddress(conditional_tokens_default, this._programIds.conditionalTokens), this.provider);
17989
+ this._ctf = new CtfClient(program, this.provider, this._programIds);
17990
+ }
17991
+ return this._ctf;
17992
+ }
17993
+ get clob() {
17994
+ if (!this._clob) {
17995
+ const program = new anchor5.Program(this._withAddress(clob_exchange_default, this._programIds.clobExchange), this.provider);
17996
+ this._clob = new ClobClient(program, this.provider, this._programIds, this.networkConfig);
17997
+ if (this.networkConfig.feeConfigOwner && this._programIds.feeManagement) {
17998
+ this._clob.feeConfigOwner = this.networkConfig.feeConfigOwner;
17999
+ this._clob.feeClient = this.fee;
18000
+ }
18001
+ this._clob.ctfClient = this.ctf;
18002
+ this._clob.qmConfigPda = this.market.configPda;
18003
+ this._clob.hookClient = this.hook;
18004
+ }
18005
+ return this._clob;
18006
+ }
18007
+ get fee() {
18008
+ if (!this._fee) {
18009
+ if (!this._programIds.feeManagement) throw new Error("feeManagement program ID not configured in NetworkConfig");
18010
+ const program = new anchor5.Program(this._withAddress(fee_management_default, this._programIds.feeManagement), this.provider);
18011
+ this._fee = new FeeManagementClient(program, this.provider, this._programIds);
18012
+ }
18013
+ return this._fee;
18014
+ }
18015
+ get presale() {
18016
+ if (!this._presale) {
18017
+ if (!this._programIds.presale) throw new Error("presale program ID not configured in NetworkConfig");
18018
+ const program = new anchor5.Program(this._withAddress(presale_default, this._programIds.presale), this.provider);
18019
+ this._presale = new PresaleClient(program, this.provider, this._programIds);
18020
+ }
18021
+ return this._presale;
18022
+ }
18023
+ get marketOracle() {
18024
+ if (!this._marketOracle) {
18025
+ if (!this._programIds.marketOracle) throw new Error("marketOracle program ID not configured in NetworkConfig");
18026
+ const program = new anchor5.Program(this._withAddress(market_oracle_default, this._programIds.marketOracle), this.provider);
18027
+ this._marketOracle = new MarketOracleClient(program, this.provider, this._programIds);
18028
+ }
18029
+ return this._marketOracle;
18030
+ }
18031
+ get admin() {
18032
+ if (!this._admin) {
18033
+ if (!this._programIds.adminContract) throw new Error("adminContract program ID not configured in NetworkConfig");
18034
+ const program = new anchor5.Program(this._withAddress(admin_contract_default, this._programIds.adminContract), this.provider);
18035
+ this._admin = new AdminClient(program, this.provider, this._programIds);
18036
+ }
18037
+ return this._admin;
18038
+ }
18039
+ get referral() {
18040
+ if (!this._referral) {
18041
+ if (!this._programIds.referral) throw new Error("referral program ID not configured in NetworkConfig");
18042
+ const program = new anchor5.Program(this._withAddress(referral_default, this._programIds.referral), this.provider);
16539
18043
  this._referral = new ReferralClient(program, this.provider, this._programIds);
16540
18044
  }
16541
18045
  return this._referral;
16542
18046
  }
18047
+ get dispute() {
18048
+ if (!this._dispute) {
18049
+ if (!this._programIds.dispute) throw new Error("dispute program ID not configured in NetworkConfig");
18050
+ const program = new anchor5.Program(this._withAddress(dispute_default, this._programIds.dispute), this.provider);
18051
+ this._dispute = new DisputeClient(program, this.provider, this._programIds);
18052
+ }
18053
+ return this._dispute;
18054
+ }
16543
18055
  };
16544
18056
  var MAX_APPROVE_AMOUNT = new BN4("18446744073709551615");
16545
18057
  function buildCreateUserAtasTx(condition, user, payer, programIds) {
@@ -16612,6 +18124,6 @@ function buildApproveAllOutcomeTokensTx(condition, signer, payer, delegate, prog
16612
18124
  return tx;
16613
18125
  }
16614
18126
 
16615
- export { AccountNotFoundError, AdminClient, ClobClient, CtfClient, FEE_DENOMINATOR, FeeManagementClient, HookClient, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, MarketOracleClient, OracleClient, PDA, PresaleClient, QuestionStatus, ReferralClient, SEEDS, UnauthorizedError, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedCollectFeeEd25519Instruction, buildBatchedEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeCollectFeeOrderToBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
18127
+ export { AccountNotFoundError, AdminClient, ClobClient, CtfClient, DisputeClient, FEE_DENOMINATOR, FeeManagementClient, HookClient, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, MarketOracleClient, OracleClient, PDA, PresaleClient, QuestionStatus, ReferralClient, SEEDS, UnauthorizedError, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedCollectFeeEd25519Instruction, buildBatchedEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeCollectFeeOrderToBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
16616
18128
  //# sourceMappingURL=index.mjs.map
16617
18129
  //# sourceMappingURL=index.mjs.map