@theliem/xmarket-sdk 3.11.0 → 3.12.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
@@ -708,15 +708,15 @@ declare class ClobClient {
708
708
  * vtx.sign([feePayerKeypair, operatorKeypair]);
709
709
  * await connection.sendRawTransaction(vtx.serialize());
710
710
  *
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.
711
+ * All match types pack into a single VersionedTransaction same as createQuestionAdmin pattern.
712
+ * NO-taker MINT/MERGE decomposes into N instructions but all packed in 1 tx.
713
713
  *
714
714
  * @param operator - Whitelisted CLOB operator pubkey (must sign)
715
715
  * @param payer - Fee payer pubkey (must sign, pays tx fee + rent)
716
716
  */
717
717
  buildMatchOrdersTx(taker: SignedOrder, makers: SignedOrder[], operator: PublicKey, payer: PublicKey, opts?: {
718
718
  marketOracleVault?: PublicKey;
719
- }): Promise<VersionedTransaction[]>;
719
+ }): Promise<VersionedTransaction>;
720
720
  fetchConfig(): Promise<ClobConfig | null>;
721
721
  fetchOrderStatus(maker: PublicKey, nonce: anchor.BN): Promise<OrderStatus | null>;
722
722
  fetchOrderRecord(maker: PublicKey, nonce: anchor.BN): Promise<{
package/dist/index.d.ts CHANGED
@@ -708,15 +708,15 @@ declare class ClobClient {
708
708
  * vtx.sign([feePayerKeypair, operatorKeypair]);
709
709
  * await connection.sendRawTransaction(vtx.serialize());
710
710
  *
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.
711
+ * All match types pack into a single VersionedTransaction same as createQuestionAdmin pattern.
712
+ * NO-taker MINT/MERGE decomposes into N instructions but all packed in 1 tx.
713
713
  *
714
714
  * @param operator - Whitelisted CLOB operator pubkey (must sign)
715
715
  * @param payer - Fee payer pubkey (must sign, pays tx fee + rent)
716
716
  */
717
717
  buildMatchOrdersTx(taker: SignedOrder, makers: SignedOrder[], operator: PublicKey, payer: PublicKey, opts?: {
718
718
  marketOracleVault?: PublicKey;
719
- }): Promise<VersionedTransaction[]>;
719
+ }): Promise<VersionedTransaction>;
720
720
  fetchConfig(): Promise<ClobConfig | null>;
721
721
  fetchOrderStatus(maker: PublicKey, nonce: anchor.BN): Promise<OrderStatus | null>;
722
722
  fetchOrderRecord(maker: PublicKey, nonce: anchor.BN): Promise<{
package/dist/index.js CHANGED
@@ -2263,8 +2263,8 @@ ${logs.join("\n")}`);
2263
2263
  * vtx.sign([feePayerKeypair, operatorKeypair]);
2264
2264
  * await connection.sendRawTransaction(vtx.serialize());
2265
2265
  *
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.
2266
+ * All match types pack into a single VersionedTransaction same as createQuestionAdmin pattern.
2267
+ * NO-taker MINT/MERGE decomposes into N instructions but all packed in 1 tx.
2268
2268
  *
2269
2269
  * @param operator - Whitelisted CLOB operator pubkey (must sign)
2270
2270
  * @param payer - Fee payer pubkey (must sign, pays tx fee + rent)
@@ -2290,21 +2290,16 @@ ${logs.join("\n")}`);
2290
2290
  this.registerOrderIfNeeded(taker),
2291
2291
  ...makers.map((m) => this.registerOrderIfNeeded(m))
2292
2292
  ]);
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)];
2293
+ const ixs3 = await this.buildMatchComplementaryIxs(
2294
+ taker,
2295
+ makers,
2296
+ collateralMint,
2297
+ feeRecipient,
2298
+ operator,
2299
+ opts,
2300
+ false
2301
+ );
2302
+ return this._buildUnsignedVtx(ixs3, alt, payer);
2308
2303
  } else {
2309
2304
  throw new InvalidParamError("COMPLEMENTARY requires one BUY and one or more SELLs on same tokenId");
2310
2305
  }
@@ -2312,7 +2307,7 @@ ${logs.join("\n")}`);
2312
2307
  this.registerOrderIfNeeded(buySignedOrder),
2313
2308
  ...sellCandidates.map((m) => this.registerOrderIfNeeded(m))
2314
2309
  ]);
2315
- const ixs = await this.buildMatchComplementaryIxs(
2310
+ const ixs2 = await this.buildMatchComplementaryIxs(
2316
2311
  buySignedOrder,
2317
2312
  sellCandidates,
2318
2313
  collateralMint,
@@ -2320,7 +2315,7 @@ ${logs.join("\n")}`);
2320
2315
  operator,
2321
2316
  opts
2322
2317
  );
2323
- return [await this._buildUnsignedVtx(ixs, alt, payer)];
2318
+ return this._buildUnsignedVtx(ixs2, alt, payer);
2324
2319
  }
2325
2320
  const allBuy = t.side === SIDE_BUY && makers.every((m) => m.order.side === SIDE_BUY);
2326
2321
  const allSell = t.side === SIDE_SELL && makers.every((m) => m.order.side === SIDE_SELL);
@@ -2341,19 +2336,19 @@ ${logs.join("\n")}`);
2341
2336
  ]);
2342
2337
  await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
2343
2338
  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)];
2339
+ return this._buildUnsignedVtx([ix], alt, payer);
2345
2340
  }
2346
- const vtxs = [];
2341
+ await Promise.all([
2342
+ this.registerOrderIfNeeded(taker),
2343
+ ...makers.map((m) => this.registerOrderIfNeeded(m))
2344
+ ]);
2345
+ await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
2346
+ const ixs = [];
2347
2347
  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
2348
  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));
2349
+ ixs.push(ix);
2355
2350
  }
2356
- return vtxs;
2351
+ return this._buildUnsignedVtx(ixs, alt, payer);
2357
2352
  }
2358
2353
  // ─── Queries ─────────────────────────────────────────────────────────────────
2359
2354
  async fetchConfig() {