@theliem/xmarket-sdk 3.4.2 → 3.5.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
@@ -1381,15 +1381,39 @@ var ClobClient = class {
1381
1381
  takerOrderRecord
1382
1382
  ];
1383
1383
  if (feeRecipientAddr) addresses.push(feeRecipientAddr);
1384
+ const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
1385
+ const [vaultToken] = PDA.vaultToken(collateralMint, this.programIds);
1386
+ const [mintAuth] = PDA.mintAuthority(condition, this.programIds);
1387
+ const [extraMetaNo] = PDA.extraAccountMetaList(noMint, this.programIds);
1388
+ const clobUsdcAta = getAssociatedTokenAddressSync(collateralMint, clobConfigPda, true);
1389
+ const clobYesAta = getAssociatedTokenAddressSync(yesMint, clobConfigPda, true, TOKEN_2022_PROGRAM_ID);
1390
+ const clobNoAta = getAssociatedTokenAddressSync(noMint, clobConfigPda, true, TOKEN_2022_PROGRAM_ID);
1391
+ const [clobYesPos] = PDA.position(condition, 1, clobConfigPda, this.programIds);
1392
+ const [clobNoPos] = PDA.position(condition, 0, clobConfigPda, this.programIds);
1393
+ addresses.push(
1394
+ collateralVault,
1395
+ vaultToken,
1396
+ mintAuth,
1397
+ extraMetaNo,
1398
+ clobUsdcAta,
1399
+ clobYesAta,
1400
+ clobNoAta,
1401
+ clobYesPos,
1402
+ clobNoPos,
1403
+ collateralMint,
1404
+ ASSOCIATED_TOKEN_PROGRAM_ID
1405
+ );
1384
1406
  for (const m of makers) {
1385
1407
  const seller = m.order.maker;
1386
- const [sellerPos] = PDA.position(condition, tokenId, seller, this.programIds);
1408
+ const makerTokenId = m.order.tokenId;
1409
+ const makerMint = makerTokenId === 1 ? yesMint : noMint;
1410
+ const [sellerPos] = PDA.position(condition, makerTokenId, seller, this.programIds);
1387
1411
  const [sellerStatus] = PDA.orderStatus(seller, m.order.nonce, this.programIds);
1388
1412
  const [sellerRecord] = PDA.orderRecord(seller, m.order.nonce, this.programIds);
1389
1413
  addresses.push(
1390
1414
  seller,
1391
1415
  sellerRecord,
1392
- getAssociatedTokenAddressSync(outcomeMint, seller, false, TOKEN_2022_PROGRAM_ID),
1416
+ getAssociatedTokenAddressSync(makerMint, seller, false, TOKEN_2022_PROGRAM_ID),
1393
1417
  getAssociatedTokenAddressSync(collateralMint, seller),
1394
1418
  sellerPos,
1395
1419
  sellerStatus
@@ -1461,6 +1485,36 @@ ${logs.join("\n")}`);
1461
1485
  async _sendLegacyTx(instructions) {
1462
1486
  await this._sendLegacyTxSig(instructions);
1463
1487
  }
1488
+ async _ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta) {
1489
+ const { connection } = this.provider;
1490
+ const [yesInfo, noInfo] = await Promise.all([
1491
+ connection.getAccountInfo(clobYesAta),
1492
+ connection.getAccountInfo(clobNoAta)
1493
+ ]);
1494
+ const { createAssociatedTokenAccountIdempotentInstruction: createAssociatedTokenAccountIdempotentInstruction2 } = await import('@solana/spl-token');
1495
+ const ixs = [];
1496
+ if (!yesInfo) {
1497
+ ixs.push(createAssociatedTokenAccountIdempotentInstruction2(
1498
+ this.walletPubkey,
1499
+ clobYesAta,
1500
+ clobConfig,
1501
+ yesMint,
1502
+ TOKEN_2022_PROGRAM_ID
1503
+ ));
1504
+ }
1505
+ if (!noInfo) {
1506
+ ixs.push(createAssociatedTokenAccountIdempotentInstruction2(
1507
+ this.walletPubkey,
1508
+ clobNoAta,
1509
+ clobConfig,
1510
+ noMint,
1511
+ TOKEN_2022_PROGRAM_ID
1512
+ ));
1513
+ }
1514
+ if (ixs.length > 0) {
1515
+ await this._sendLegacyTx(ixs);
1516
+ }
1517
+ }
1464
1518
  /**
1465
1519
  * Send a match transaction as versioned (v0) with optional ALT.
1466
1520
  * Both operator wallet and payer (this.provider.wallet) sign.
@@ -1468,11 +1522,12 @@ ${logs.join("\n")}`);
1468
1522
  async sendMatchTx(instructions, lookupTable, whitelistedWallet) {
1469
1523
  const { connection } = this.provider;
1470
1524
  const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
1471
- const cuLimit = ComputeBudgetProgram.setComputeUnitLimit({ units: 8e5 });
1525
+ const cuLimit = ComputeBudgetProgram.setComputeUnitLimit({ units: 14e5 });
1526
+ const heapFrame = ComputeBudgetProgram.requestHeapFrame({ bytes: 262144 });
1472
1527
  const message = new TransactionMessage({
1473
1528
  payerKey: this.walletPubkey,
1474
1529
  recentBlockhash: blockhash,
1475
- instructions: [cuLimit, ...instructions]
1530
+ instructions: [cuLimit, heapFrame, ...instructions]
1476
1531
  }).compileToV0Message(lookupTable ? [lookupTable] : []);
1477
1532
  const vtx = new VersionedTransaction(message);
1478
1533
  const signers = [this.provider.wallet.payer];
@@ -1481,7 +1536,7 @@ ${logs.join("\n")}`);
1481
1536
  }
1482
1537
  vtx.sign(signers);
1483
1538
  const sig = await connection.sendRawTransaction(vtx.serialize(), {
1484
- skipPreflight: true
1539
+ skipPreflight: false
1485
1540
  });
1486
1541
  const result = await connection.confirmTransaction(
1487
1542
  { signature: sig, blockhash, lastValidBlockHeight },
@@ -1684,6 +1739,47 @@ ${logs.join("\n")}`);
1684
1739
  const sig = await this.sendMatchTx(ixs, lookupTable, operatorWallet);
1685
1740
  return { signature: sig };
1686
1741
  }
1742
+ /**
1743
+ * 1 SELL taker vs N BUY makers.
1744
+ * Rust program only supports BUY-as-taker, so we decompose into N instructions
1745
+ * (BUY_i as taker, SELL as single maker) combined into one atomic transaction.
1746
+ * Engine must use limitPrice for BUY.makerAmount to pass per-pair crossing check.
1747
+ */
1748
+ async matchComplementarySellVsMultiBuy(sellTaker, buyMakers, collateralMint, feeRecipient, operatorWallet, lookupTable, opts) {
1749
+ await Promise.all([
1750
+ this.registerOrderIfNeeded(sellTaker),
1751
+ ...buyMakers.map((m) => this.registerOrderIfNeeded(m))
1752
+ ]);
1753
+ const sell = sellTaker.order;
1754
+ const crossingBuys = buyMakers.filter((b) => {
1755
+ const buy = b.order;
1756
+ const lhs = BigInt(buy.makerAmount.toString()) * BigInt(sell.makerAmount.toString());
1757
+ const rhs = BigInt(buy.takerAmount.toString()) * BigInt(sell.takerAmount.toString());
1758
+ return lhs >= rhs;
1759
+ });
1760
+ if (crossingBuys.length === 0) {
1761
+ throw new InvalidParamError("COMPLEMENTARY: no BUY maker orders cross with the SELL taker");
1762
+ }
1763
+ if (crossingBuys.length < buyMakers.length) {
1764
+ console.warn(`[matchOrders] SELL+BUY: filtered ${buyMakers.length - crossingBuys.length} non-crossing BUY(s)`);
1765
+ }
1766
+ const allIxs = [];
1767
+ for (const buyMaker of crossingBuys) {
1768
+ const ixs = await this.buildMatchComplementaryIxs(
1769
+ buyMaker,
1770
+ // BUY as taker
1771
+ [sellTaker],
1772
+ // SELL as maker
1773
+ collateralMint,
1774
+ feeRecipient,
1775
+ operatorWallet.publicKey,
1776
+ opts
1777
+ );
1778
+ allIxs.push(...ixs);
1779
+ }
1780
+ const sig = await this.sendMatchTx(allIxs, lookupTable, operatorWallet);
1781
+ return { signature: sig };
1782
+ }
1687
1783
  /**
1688
1784
  * MINT: 1 YES buyer (taker) + N NO buyers (makers).
1689
1785
  * Phase 1: register taker + all NO makers in parallel.
@@ -1701,6 +1797,7 @@ ${logs.join("\n")}`);
1701
1797
  const taker = yesSigned.order.maker;
1702
1798
  const takerNonce = yesSigned.order.nonce;
1703
1799
  const fillAmount = new anchor5.BN("18446744073709551615");
1800
+ const clobConfig = this.configPda();
1704
1801
  const [yesMint] = PDA.yesMint(condition, this.programIds);
1705
1802
  const [noMint] = PDA.noMint(condition, this.programIds);
1706
1803
  const [mintAuthority] = PDA.mintAuthority(condition, this.programIds);
@@ -1711,6 +1808,15 @@ ${logs.join("\n")}`);
1711
1808
  const takerYesToken = getAssociatedTokenAddressSync(yesMint, taker, false, TOKEN_2022_PROGRAM_ID);
1712
1809
  const [takerYesPosition] = PDA.position(condition, 1, taker, this.programIds);
1713
1810
  const [takerOrderStatus] = PDA.orderStatus(taker, takerNonce, this.programIds);
1811
+ const clobUsdcAta = getAssociatedTokenAddressSync(collateralMint, clobConfig, true);
1812
+ const clobYesAta = getAssociatedTokenAddressSync(yesMint, clobConfig, true, TOKEN_2022_PROGRAM_ID);
1813
+ const clobNoAta = getAssociatedTokenAddressSync(noMint, clobConfig, true, TOKEN_2022_PROGRAM_ID);
1814
+ const [clobYesPos] = PDA.position(condition, 1, clobConfig, this.programIds);
1815
+ const [clobNoPos] = PDA.position(condition, 0, clobConfig, this.programIds);
1816
+ const [extraMetaYes] = PDA.extraAccountMetaList(yesMint, this.programIds);
1817
+ const [extraMetaNo] = PDA.extraAccountMetaList(noMint, this.programIds);
1818
+ const [hookConfig] = PDA.hookConfig(this.programIds);
1819
+ const hookProgram = this.programIds.hook;
1714
1820
  const remainingAccounts = [];
1715
1821
  for (const nm of noMakers) {
1716
1822
  const noMaker = nm.order.maker;
@@ -1720,6 +1826,7 @@ ${logs.join("\n")}`);
1720
1826
  const [noPosition] = PDA.position(condition, 0, noMaker, this.programIds);
1721
1827
  const [noStatus] = PDA.orderStatus(noMaker, nm.order.nonce, this.programIds);
1722
1828
  remainingAccounts.push(
1829
+ { pubkey: noMaker, isSigner: false, isWritable: false },
1723
1830
  { pubkey: noRecord, isSigner: false, isWritable: false },
1724
1831
  { pubkey: noToken, isSigner: false, isWritable: true },
1725
1832
  { pubkey: noCollateral, isSigner: false, isWritable: true },
@@ -1727,10 +1834,16 @@ ${logs.join("\n")}`);
1727
1834
  { pubkey: noStatus, isSigner: false, isWritable: true }
1728
1835
  );
1729
1836
  }
1837
+ remainingAccounts.push(
1838
+ { pubkey: extraMetaYes, isSigner: false, isWritable: false },
1839
+ { pubkey: extraMetaNo, isSigner: false, isWritable: false },
1840
+ { pubkey: hookConfig, isSigner: false, isWritable: false },
1841
+ { pubkey: hookProgram, isSigner: false, isWritable: false }
1842
+ );
1730
1843
  const matchIx = await this.program.methods.matchMintOrders(takerNonce, fillAmount).accounts({
1731
1844
  operator: operatorWallet.publicKey,
1732
1845
  payer: this.walletPubkey,
1733
- clobConfig: this.configPda(),
1846
+ clobConfig,
1734
1847
  condition,
1735
1848
  taker,
1736
1849
  takerOrderRecord,
@@ -1738,16 +1851,25 @@ ${logs.join("\n")}`);
1738
1851
  takerYesToken,
1739
1852
  takerYesPosition,
1740
1853
  takerOrderStatus,
1854
+ clobUsdcAta,
1855
+ clobYesAta,
1856
+ clobNoAta,
1857
+ clobYesPosition: clobYesPos,
1858
+ clobNoPosition: clobNoPos,
1741
1859
  collateralVault,
1742
1860
  vaultTokenAccount,
1861
+ collateralMint,
1743
1862
  yesMint,
1744
1863
  noMint,
1745
1864
  mintAuthority,
1746
- clobAuthority: this.configPda(),
1865
+ clobAuthority: clobConfig,
1747
1866
  conditionalTokensProgram: this.programIds.conditionalTokens,
1748
1867
  collateralTokenProgram: TOKEN_PROGRAM_ID,
1868
+ token2022Program: TOKEN_2022_PROGRAM_ID,
1869
+ associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
1749
1870
  systemProgram: SystemProgram.programId
1750
1871
  }).remainingAccounts(remainingAccounts).instruction();
1872
+ await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
1751
1873
  const sig = await this.sendMatchTx([matchIx], lookupTable, operatorWallet);
1752
1874
  return { signature: sig };
1753
1875
  }
@@ -1769,9 +1891,9 @@ ${logs.join("\n")}`);
1769
1891
  const sellerYes = yesSigned.order.maker;
1770
1892
  const takerNonce = yesSigned.order.nonce;
1771
1893
  const fillAmount = new anchor5.BN("18446744073709551615");
1894
+ const clobConfig = this.configPda();
1772
1895
  const [yesMint] = PDA.yesMint(condition, this.programIds);
1773
1896
  const [noMint] = PDA.noMint(condition, this.programIds);
1774
- const [mintAuthority] = PDA.mintAuthority(condition, this.programIds);
1775
1897
  const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
1776
1898
  const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
1777
1899
  const [takerOrderRecord] = PDA.orderRecord(sellerYes, takerNonce, this.programIds);
@@ -1779,6 +1901,15 @@ ${logs.join("\n")}`);
1779
1901
  const [takerYesPosition] = PDA.position(condition, 1, sellerYes, this.programIds);
1780
1902
  const takerCollateral = getAssociatedTokenAddressSync(collateralMint, sellerYes);
1781
1903
  const [takerOrderStatus] = PDA.orderStatus(sellerYes, takerNonce, this.programIds);
1904
+ const clobUsdcAta = getAssociatedTokenAddressSync(collateralMint, clobConfig, true);
1905
+ const clobYesAta = getAssociatedTokenAddressSync(yesMint, clobConfig, true, TOKEN_2022_PROGRAM_ID);
1906
+ const clobNoAta = getAssociatedTokenAddressSync(noMint, clobConfig, true, TOKEN_2022_PROGRAM_ID);
1907
+ const [clobYesPos] = PDA.position(condition, 1, clobConfig, this.programIds);
1908
+ const [clobNoPos] = PDA.position(condition, 0, clobConfig, this.programIds);
1909
+ const [extraMetaYes] = PDA.extraAccountMetaList(yesMint, this.programIds);
1910
+ const [extraMetaNo] = PDA.extraAccountMetaList(noMint, this.programIds);
1911
+ const [hookConfig] = PDA.hookConfig(this.programIds);
1912
+ const hookProgram = this.programIds.hook;
1782
1913
  const remainingAccounts = [];
1783
1914
  for (const nm of noMakers) {
1784
1915
  const noMaker = nm.order.maker;
@@ -1788,6 +1919,7 @@ ${logs.join("\n")}`);
1788
1919
  const [noPosition] = PDA.position(condition, 0, noMaker, this.programIds);
1789
1920
  const [noStatus] = PDA.orderStatus(noMaker, nm.order.nonce, this.programIds);
1790
1921
  remainingAccounts.push(
1922
+ { pubkey: noMaker, isSigner: false, isWritable: false },
1791
1923
  { pubkey: noRecord, isSigner: false, isWritable: false },
1792
1924
  { pubkey: noToken, isSigner: false, isWritable: true },
1793
1925
  { pubkey: noCollateral, isSigner: false, isWritable: true },
@@ -1795,6 +1927,12 @@ ${logs.join("\n")}`);
1795
1927
  { pubkey: noStatus, isSigner: false, isWritable: true }
1796
1928
  );
1797
1929
  }
1930
+ remainingAccounts.push(
1931
+ { pubkey: extraMetaYes, isSigner: false, isWritable: false },
1932
+ { pubkey: extraMetaNo, isSigner: false, isWritable: false },
1933
+ { pubkey: hookConfig, isSigner: false, isWritable: false },
1934
+ { pubkey: hookProgram, isSigner: false, isWritable: false }
1935
+ );
1798
1936
  if (yesSigned.order.fee.gtn(0) && this.programIds.feeManagement && this.feeConfigOwner) {
1799
1937
  const companyAddr = await this.companyAddress();
1800
1938
  if (companyAddr) {
@@ -1811,7 +1949,7 @@ ${logs.join("\n")}`);
1811
1949
  const matchIx = await this.program.methods.matchMergeOrders(takerNonce, fillAmount).accounts({
1812
1950
  operator: operatorWallet.publicKey,
1813
1951
  payer: this.walletPubkey,
1814
- clobConfig: this.configPda(),
1952
+ clobConfig,
1815
1953
  condition,
1816
1954
  taker: sellerYes,
1817
1955
  takerOrderRecord,
@@ -1819,17 +1957,24 @@ ${logs.join("\n")}`);
1819
1957
  takerYesPosition,
1820
1958
  takerCollateral,
1821
1959
  takerOrderStatus,
1960
+ clobUsdcAta,
1961
+ clobYesAta,
1962
+ clobNoAta,
1963
+ clobYesPosition: clobYesPos,
1964
+ clobNoPosition: clobNoPos,
1822
1965
  collateralVault,
1823
1966
  vaultTokenAccount,
1967
+ collateralMint,
1824
1968
  yesMint,
1825
1969
  noMint,
1826
- mintAuthority,
1827
- feeRecipient,
1828
- clobAuthority: this.configPda(),
1970
+ clobAuthority: clobConfig,
1829
1971
  conditionalTokensProgram: this.programIds.conditionalTokens,
1830
1972
  collateralTokenProgram: TOKEN_PROGRAM_ID,
1973
+ token2022Program: TOKEN_2022_PROGRAM_ID,
1974
+ associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
1831
1975
  systemProgram: SystemProgram.programId
1832
1976
  }).remainingAccounts(remainingAccounts).instruction();
1977
+ await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
1833
1978
  const sig = await this.sendMatchTx([matchIx], lookupTable, operatorWallet);
1834
1979
  return { signature: sig };
1835
1980
  }
@@ -1870,38 +2015,22 @@ ${logs.join("\n")}`);
1870
2015
  buySignedOrder = taker;
1871
2016
  sellCandidates = makers;
1872
2017
  } else if (t.side === SIDE_SELL && makers.every((m) => m.order.side === SIDE_BUY)) {
1873
- buySignedOrder = makers[0];
1874
- sellCandidates = [taker, ...makers.slice(1)];
2018
+ return this.matchComplementarySellVsMultiBuy(taker, makers, collateralMint, feeRecipient, operatorWallet, alt, opts);
1875
2019
  } else {
1876
2020
  throw new InvalidParamError("COMPLEMENTARY requires one BUY and one or more SELLs on same tokenId");
1877
2021
  }
1878
- const budget = BigInt(buySignedOrder.order.makerAmount.toString());
1879
- const totalAsk = sellCandidates.reduce(
1880
- (s, m) => s + BigInt(m.order.takerAmount.toString()),
1881
- BigInt(0)
1882
- );
1883
- let finalSells;
1884
- if (budget >= totalAsk) {
1885
- finalSells = sellCandidates;
1886
- } else {
1887
- const sorted = [...sellCandidates].sort((a, b) => {
1888
- const pa = BigInt(a.order.takerAmount.toString()) * BigInt(b.order.makerAmount.toString());
1889
- const pb = BigInt(b.order.takerAmount.toString()) * BigInt(a.order.makerAmount.toString());
1890
- return pa < pb ? -1 : pa > pb ? 1 : 0;
1891
- });
1892
- finalSells = [];
1893
- let remaining = budget;
1894
- for (const s of sorted) {
1895
- const cost = BigInt(s.order.takerAmount.toString());
1896
- if (remaining >= cost) {
1897
- finalSells.push(s);
1898
- remaining -= cost;
1899
- }
1900
- }
1901
- if (finalSells.length === 0) {
1902
- throw new InvalidParamError("COMPLEMENTARY: taker budget insufficient for any maker");
1903
- }
1904
- console.warn(`[matchOrders] budget ${budget} < totalAsk ${totalAsk}: matched ${finalSells.length}/${sellCandidates.length} makers`);
2022
+ const buy = buySignedOrder.order;
2023
+ const finalSells = sellCandidates.filter((s) => {
2024
+ const sell = s.order;
2025
+ const lhs = BigInt(buy.makerAmount.toString()) * BigInt(sell.makerAmount.toString());
2026
+ const rhs = BigInt(buy.takerAmount.toString()) * BigInt(sell.takerAmount.toString());
2027
+ return lhs >= rhs;
2028
+ });
2029
+ if (finalSells.length === 0) {
2030
+ throw new InvalidParamError("COMPLEMENTARY: no maker orders cross with the buy order");
2031
+ }
2032
+ if (finalSells.length < sellCandidates.length) {
2033
+ console.warn(`[matchOrders] filtered ${sellCandidates.length - finalSells.length} non-crossing maker(s)`);
1905
2034
  }
1906
2035
  return this.matchComplementary(buySignedOrder, finalSells, collateralMint, feeRecipient, operatorWallet, alt, opts);
1907
2036
  }
@@ -8604,7 +8733,8 @@ var clob_exchange_default = {
8604
8733
  }
8605
8734
  },
8606
8735
  {
8607
- name: "condition"
8736
+ name: "condition",
8737
+ writable: true
8608
8738
  },
8609
8739
  {
8610
8740
  name: "taker"
@@ -8680,27 +8810,98 @@ var clob_exchange_default = {
8680
8810
  }
8681
8811
  },
8682
8812
  {
8683
- name: "collateral_vault",
8813
+ name: "clob_usdc_ata",
8814
+ docs: [
8815
+ "USDC ATA owned by clob_config \u2014 receives USDC from vault after merge"
8816
+ ],
8817
+ writable: true,
8818
+ pda: {
8819
+ seeds: [
8820
+ {
8821
+ kind: "account",
8822
+ path: "clob_config"
8823
+ },
8824
+ {
8825
+ kind: "account",
8826
+ path: "collateral_token_program"
8827
+ },
8828
+ {
8829
+ kind: "account",
8830
+ path: "collateral_mint"
8831
+ }
8832
+ ],
8833
+ program: {
8834
+ kind: "const",
8835
+ value: [
8836
+ 140,
8837
+ 151,
8838
+ 37,
8839
+ 143,
8840
+ 78,
8841
+ 36,
8842
+ 137,
8843
+ 241,
8844
+ 187,
8845
+ 61,
8846
+ 16,
8847
+ 41,
8848
+ 20,
8849
+ 142,
8850
+ 13,
8851
+ 131,
8852
+ 11,
8853
+ 90,
8854
+ 19,
8855
+ 153,
8856
+ 218,
8857
+ 255,
8858
+ 16,
8859
+ 132,
8860
+ 4,
8861
+ 142,
8862
+ 123,
8863
+ 216,
8864
+ 219,
8865
+ 233,
8866
+ 248,
8867
+ 89
8868
+ ]
8869
+ }
8870
+ }
8871
+ },
8872
+ {
8873
+ name: "clob_yes_ata",
8684
8874
  writable: true
8685
8875
  },
8686
8876
  {
8687
- name: "vault_token_account",
8877
+ name: "clob_no_ata",
8688
8878
  writable: true
8689
8879
  },
8690
8880
  {
8691
- name: "yes_mint",
8881
+ name: "clob_yes_position",
8692
8882
  writable: true
8693
8883
  },
8694
8884
  {
8695
- name: "no_mint",
8885
+ name: "clob_no_position",
8696
8886
  writable: true
8697
8887
  },
8698
8888
  {
8699
- name: "mint_authority",
8889
+ name: "collateral_vault",
8700
8890
  writable: true
8701
8891
  },
8702
8892
  {
8703
- name: "fee_recipient",
8893
+ name: "vault_token_account",
8894
+ writable: true
8895
+ },
8896
+ {
8897
+ name: "collateral_mint"
8898
+ },
8899
+ {
8900
+ name: "yes_mint",
8901
+ writable: true
8902
+ },
8903
+ {
8904
+ name: "no_mint",
8704
8905
  writable: true
8705
8906
  },
8706
8907
  {
@@ -8734,6 +8935,14 @@ var clob_exchange_default = {
8734
8935
  name: "collateral_token_program",
8735
8936
  address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
8736
8937
  },
8938
+ {
8939
+ name: "token_2022_program",
8940
+ address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
8941
+ },
8942
+ {
8943
+ name: "associated_token_program",
8944
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
8945
+ },
8737
8946
  {
8738
8947
  name: "system_program",
8739
8948
  address: "11111111111111111111111111111111"
@@ -8799,7 +9008,8 @@ var clob_exchange_default = {
8799
9008
  }
8800
9009
  },
8801
9010
  {
8802
- name: "condition"
9011
+ name: "condition",
9012
+ writable: true
8803
9013
  },
8804
9014
  {
8805
9015
  name: "taker"
@@ -8874,6 +9084,94 @@ var clob_exchange_default = {
8874
9084
  ]
8875
9085
  }
8876
9086
  },
9087
+ {
9088
+ name: "clob_usdc_ata",
9089
+ docs: [
9090
+ "USDC ATA owned by clob_config \u2014 receives combined USDC, then split_position pulls from here"
9091
+ ],
9092
+ writable: true,
9093
+ pda: {
9094
+ seeds: [
9095
+ {
9096
+ kind: "account",
9097
+ path: "clob_config"
9098
+ },
9099
+ {
9100
+ kind: "account",
9101
+ path: "collateral_token_program"
9102
+ },
9103
+ {
9104
+ kind: "account",
9105
+ path: "collateral_mint"
9106
+ }
9107
+ ],
9108
+ program: {
9109
+ kind: "const",
9110
+ value: [
9111
+ 140,
9112
+ 151,
9113
+ 37,
9114
+ 143,
9115
+ 78,
9116
+ 36,
9117
+ 137,
9118
+ 241,
9119
+ 187,
9120
+ 61,
9121
+ 16,
9122
+ 41,
9123
+ 20,
9124
+ 142,
9125
+ 13,
9126
+ 131,
9127
+ 11,
9128
+ 90,
9129
+ 19,
9130
+ 153,
9131
+ 218,
9132
+ 255,
9133
+ 16,
9134
+ 132,
9135
+ 4,
9136
+ 142,
9137
+ 123,
9138
+ 216,
9139
+ 219,
9140
+ 233,
9141
+ 248,
9142
+ 89
9143
+ ]
9144
+ }
9145
+ }
9146
+ },
9147
+ {
9148
+ name: "clob_yes_ata",
9149
+ docs: [
9150
+ "YES Token-2022 ATA owned by clob_config \u2014 receives YES from split, then transferred to taker"
9151
+ ],
9152
+ writable: true
9153
+ },
9154
+ {
9155
+ name: "clob_no_ata",
9156
+ docs: [
9157
+ "NO Token-2022 ATA owned by clob_config \u2014 receives NO from split, then transferred to makers"
9158
+ ],
9159
+ writable: true
9160
+ },
9161
+ {
9162
+ name: "clob_yes_position",
9163
+ docs: [
9164
+ "YES Position PDA for clob_config (set by CTF split_position init_if_needed)"
9165
+ ],
9166
+ writable: true
9167
+ },
9168
+ {
9169
+ name: "clob_no_position",
9170
+ docs: [
9171
+ "NO Position PDA for clob_config (set by CTF split_position init_if_needed)"
9172
+ ],
9173
+ writable: true
9174
+ },
8877
9175
  {
8878
9176
  name: "collateral_vault",
8879
9177
  writable: true
@@ -8882,6 +9180,9 @@ var clob_exchange_default = {
8882
9180
  name: "vault_token_account",
8883
9181
  writable: true
8884
9182
  },
9183
+ {
9184
+ name: "collateral_mint"
9185
+ },
8885
9186
  {
8886
9187
  name: "yes_mint",
8887
9188
  writable: true
@@ -8925,6 +9226,14 @@ var clob_exchange_default = {
8925
9226
  name: "collateral_token_program",
8926
9227
  address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
8927
9228
  },
9229
+ {
9230
+ name: "token_2022_program",
9231
+ address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
9232
+ },
9233
+ {
9234
+ name: "associated_token_program",
9235
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
9236
+ },
8928
9237
  {
8929
9238
  name: "system_program",
8930
9239
  address: "11111111111111111111111111111111"