@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.mjs CHANGED
@@ -2237,8 +2237,8 @@ ${logs.join("\n")}`);
2237
2237
  * vtx.sign([feePayerKeypair, operatorKeypair]);
2238
2238
  * await connection.sendRawTransaction(vtx.serialize());
2239
2239
  *
2240
- * Returns an array because NO-taker MINT/MERGE decomposes into N txs (one per YES maker).
2241
- * Most direct/single-pair cases return a single-element array.
2240
+ * All match types pack into a single VersionedTransaction same as createQuestionAdmin pattern.
2241
+ * NO-taker MINT/MERGE decomposes into N instructions but all packed in 1 tx.
2242
2242
  *
2243
2243
  * @param operator - Whitelisted CLOB operator pubkey (must sign)
2244
2244
  * @param payer - Fee payer pubkey (must sign, pays tx fee + rent)
@@ -2264,21 +2264,16 @@ ${logs.join("\n")}`);
2264
2264
  this.registerOrderIfNeeded(taker),
2265
2265
  ...makers.map((m) => this.registerOrderIfNeeded(m))
2266
2266
  ]);
2267
- const ixs2 = [];
2268
- for (const buyMaker of makers) {
2269
- const built = await this.buildMatchComplementaryIxs(
2270
- buyMaker,
2271
- [taker],
2272
- collateralMint,
2273
- feeRecipient,
2274
- operator,
2275
- opts,
2276
- true,
2277
- true
2278
- );
2279
- ixs2.push(...built);
2280
- }
2281
- return [await this._buildUnsignedVtx(ixs2, alt, payer)];
2267
+ const ixs3 = await this.buildMatchComplementaryIxs(
2268
+ taker,
2269
+ makers,
2270
+ collateralMint,
2271
+ feeRecipient,
2272
+ operator,
2273
+ opts,
2274
+ false
2275
+ );
2276
+ return this._buildUnsignedVtx(ixs3, alt, payer);
2282
2277
  } else {
2283
2278
  throw new InvalidParamError("COMPLEMENTARY requires one BUY and one or more SELLs on same tokenId");
2284
2279
  }
@@ -2286,7 +2281,7 @@ ${logs.join("\n")}`);
2286
2281
  this.registerOrderIfNeeded(buySignedOrder),
2287
2282
  ...sellCandidates.map((m) => this.registerOrderIfNeeded(m))
2288
2283
  ]);
2289
- const ixs = await this.buildMatchComplementaryIxs(
2284
+ const ixs2 = await this.buildMatchComplementaryIxs(
2290
2285
  buySignedOrder,
2291
2286
  sellCandidates,
2292
2287
  collateralMint,
@@ -2294,7 +2289,7 @@ ${logs.join("\n")}`);
2294
2289
  operator,
2295
2290
  opts
2296
2291
  );
2297
- return [await this._buildUnsignedVtx(ixs, alt, payer)];
2292
+ return this._buildUnsignedVtx(ixs2, alt, payer);
2298
2293
  }
2299
2294
  const allBuy = t.side === SIDE_BUY && makers.every((m) => m.order.side === SIDE_BUY);
2300
2295
  const allSell = t.side === SIDE_SELL && makers.every((m) => m.order.side === SIDE_SELL);
@@ -2315,19 +2310,19 @@ ${logs.join("\n")}`);
2315
2310
  ]);
2316
2311
  await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
2317
2312
  const ix = allBuy ? await this._buildMintIx(taker, makers, collateralMint, operator, payer) : await this._buildMergeIx(taker, makers, collateralMint, operator, payer, opts);
2318
- return [await this._buildUnsignedVtx([ix], alt, payer)];
2313
+ return this._buildUnsignedVtx([ix], alt, payer);
2319
2314
  }
2320
- const vtxs = [];
2315
+ await Promise.all([
2316
+ this.registerOrderIfNeeded(taker),
2317
+ ...makers.map((m) => this.registerOrderIfNeeded(m))
2318
+ ]);
2319
+ await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
2320
+ const ixs = [];
2321
2321
  for (const yesMaker of makers) {
2322
- await Promise.all([
2323
- this.registerOrderIfNeeded(yesMaker),
2324
- this.registerOrderIfNeeded(taker)
2325
- ]);
2326
- await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
2327
2322
  const ix = allBuy ? await this._buildMintIx(yesMaker, [taker], collateralMint, operator, payer) : await this._buildMergeIx(yesMaker, [taker], collateralMint, operator, payer, opts);
2328
- vtxs.push(await this._buildUnsignedVtx([ix], alt, payer));
2323
+ ixs.push(ix);
2329
2324
  }
2330
- return vtxs;
2325
+ return this._buildUnsignedVtx(ixs, alt, payer);
2331
2326
  }
2332
2327
  // ─── Queries ─────────────────────────────────────────────────────────────────
2333
2328
  async fetchConfig() {