@theliem/xmarket-sdk 3.1.3 → 3.2.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.
@@ -64,7 +64,7 @@
64
64
  "docs": [
65
65
  "Initialize a shared collateral vault for a given collateral mint (e.g. USDC).",
66
66
  "One vault per collateral type, shared across all conditions.",
67
- "Requires ctf_config authority only CTF owner can create vaults."
67
+ "Requires ctf_config authority \u2014 only CTF owner can create vaults."
68
68
  ],
69
69
  "discriminator": [
70
70
  48,
@@ -96,7 +96,7 @@
96
96
  {
97
97
  "name": "ctf_config",
98
98
  "docs": [
99
- "CTF config verifies authority is the CTF owner"
99
+ "CTF config \u2014 verifies authority is the CTF owner"
100
100
  ],
101
101
  "pda": {
102
102
  "seeds": [
@@ -230,7 +230,7 @@
230
230
  {
231
231
  "name": "payer",
232
232
  "docs": [
233
- "Pays tx fee (BE wallet user wallet needs zero SOL)"
233
+ "Pays tx fee (BE wallet \u2014 user wallet needs zero SOL)"
234
234
  ],
235
235
  "writable": true,
236
236
  "signer": true
@@ -479,7 +479,7 @@
479
479
  {
480
480
  "name": "clob_authority",
481
481
  "docs": [
482
- "CLOB config PDA signs via invoke_signed from CLOB program.",
482
+ "CLOB config PDA \u2014 signs via invoke_signed from CLOB program.",
483
483
  "Must match condition.authorized_clob."
484
484
  ],
485
485
  "signer": true
@@ -533,7 +533,7 @@
533
533
  {
534
534
  "name": "vault_token_account",
535
535
  "docs": [
536
- "Read-only balance checked to verify CLOB already deposited collateral."
536
+ "Read-only \u2014 balance checked to verify CLOB already deposited collateral."
537
537
  ]
538
538
  },
539
539
  {
@@ -650,7 +650,7 @@
650
650
  {
651
651
  "name": "condition",
652
652
  "docs": [
653
- "Condition PDA seeds: [CONDITION_SEED, oracle, question_id]"
653
+ "Condition PDA \u2014 seeds: [CONDITION_SEED, oracle, question_id]"
654
654
  ],
655
655
  "writable": true,
656
656
  "pda": {
@@ -683,7 +683,7 @@
683
683
  {
684
684
  "name": "yes_mint",
685
685
  "docs": [
686
- "YES Token-2022 mint deterministic PDA from [YES_MINT_SEED, condition]"
686
+ "YES Token-2022 mint \u2014 deterministic PDA from [YES_MINT_SEED, condition]"
687
687
  ],
688
688
  "writable": true,
689
689
  "pda": {
@@ -711,7 +711,7 @@
711
711
  {
712
712
  "name": "no_mint",
713
713
  "docs": [
714
- "NO Token-2022 mint deterministic PDA from [NO_MINT_SEED, condition]"
714
+ "NO Token-2022 mint \u2014 deterministic PDA from [NO_MINT_SEED, condition]"
715
715
  ],
716
716
  "writable": true,
717
717
  "pda": {
@@ -738,7 +738,7 @@
738
738
  {
739
739
  "name": "mint_authority",
740
740
  "docs": [
741
- "Mint authority PDA signs mint_to / burn during split/merge/redeem",
741
+ "Mint authority PDA \u2014 signs mint_to / burn during split/merge/redeem",
742
742
  "seeds: [MINT_AUTHORITY_SEED, condition]"
743
743
  ],
744
744
  "pda": {
@@ -873,7 +873,7 @@
873
873
  {
874
874
  "name": "payer",
875
875
  "docs": [
876
- "Pays tx fee (BE wallet user wallet needs zero SOL)"
876
+ "Pays tx fee (BE wallet \u2014 user wallet needs zero SOL)"
877
877
  ],
878
878
  "writable": true,
879
879
  "signer": true
@@ -966,7 +966,7 @@
966
966
  {
967
967
  "name": "report_payouts",
968
968
  "docs": [
969
- "Report payouts directly as the oracle resolves the condition.",
969
+ "Report payouts directly as the oracle \u2014 resolves the condition.",
970
970
  "The signer must match condition.oracle."
971
971
  ],
972
972
  "discriminator": [
@@ -1007,7 +1007,7 @@
1007
1007
  {
1008
1008
  "name": "set_payout",
1009
1009
  "docs": [
1010
- "Set payout and mark condition as resolved ONLY callable by QuestionMarket via CPI."
1010
+ "Set payout and mark condition as resolved \u2014 ONLY callable by QuestionMarket via CPI."
1011
1011
  ],
1012
1012
  "discriminator": [
1013
1013
  55,
@@ -1023,7 +1023,7 @@
1023
1023
  {
1024
1024
  "name": "authority",
1025
1025
  "docs": [
1026
- "QuestionMarket config PDA or Oracle config PDA must sign via CPI"
1026
+ "QuestionMarket config PDA or Oracle config PDA \u2014 must sign via CPI"
1027
1027
  ],
1028
1028
  "signer": true
1029
1029
  },
@@ -1061,7 +1061,7 @@
1061
1061
  {
1062
1062
  "name": "user",
1063
1063
  "docs": [
1064
- "Economic actor must hold collateral, receives YES/NO tokens"
1064
+ "Economic actor \u2014 must hold collateral, receives YES/NO tokens"
1065
1065
  ],
1066
1066
  "signer": true
1067
1067
  },
@@ -1306,7 +1306,7 @@
1306
1306
  {
1307
1307
  "name": "transfer_position",
1308
1308
  "docs": [
1309
- "Transfer positions between users ONLY callable by the authorized CLOB program.",
1309
+ "Transfer positions between users \u2014 ONLY callable by the authorized CLOB program.",
1310
1310
  "Used during order matching to redistribute YES/NO tokens."
1311
1311
  ],
1312
1312
  "discriminator": [
@@ -1389,7 +1389,7 @@
1389
1389
  {
1390
1390
  "name": "update_authorized_clob",
1391
1391
  "docs": [
1392
- "Update the authorized CLOB on a condition only callable by the condition's oracle."
1392
+ "Update the authorized CLOB on a condition \u2014 only callable by the condition's oracle."
1393
1393
  ],
1394
1394
  "discriminator": [
1395
1395
  163,
@@ -1405,7 +1405,7 @@
1405
1405
  {
1406
1406
  "name": "oracle",
1407
1407
  "docs": [
1408
- "The oracle that owns this condition must sign"
1408
+ "The oracle that owns this condition \u2014 must sign"
1409
1409
  ],
1410
1410
  "writable": true,
1411
1411
  "signer": true
package/dist/index.d.mts CHANGED
@@ -490,10 +490,10 @@ declare class MarketClient {
490
490
  */
491
491
  rejectPresale(presalePda: PublicKey, caller?: PublicKey): Promise<Transaction>;
492
492
  /**
493
- * Whitelist-only: distribute presale vault funds agents_rev% + company_rev% + rest to creator.
494
- * Must be called after approvePresale.
493
+ * Whitelist-only: distribute presale vault → 10% agents + 10% company + 80% botmm.
494
+ * Closes presale_vault ATA and presale PDA after distribution; lamports returned to payer.
495
495
  */
496
- collectPresaleRevenue(presalePda: PublicKey, currencyMint: PublicKey, referralAddress: PublicKey, companyAddress: PublicKey, caller?: PublicKey): Promise<Transaction>;
496
+ collectPresaleRevenue(presalePda: PublicKey, currencyMint: PublicKey, referralAddress: PublicKey, companyAddress: PublicKey, botmmAddress: PublicKey, caller?: PublicKey, payer?: PublicKey): Promise<Transaction>;
497
497
  /**
498
498
  * Whitelist-only: snapshot MST supply so holders can claim trading fees.
499
499
  * Call after oracle resolves the question.
@@ -718,15 +718,6 @@ declare class PresaleClient {
718
718
  * Only callable when presale status = Rejected.
719
719
  */
720
720
  refund(presalePda: PublicKey, user?: PublicKey): Promise<Transaction>;
721
- /**
722
- * Creator claims their share of presale revenue after distribute_presale_revenue.
723
- */
724
- claimRevenue(presalePda: PublicKey, creator?: PublicKey): Promise<Transaction>;
725
- /**
726
- * Transfer creator_claimable_revenue (80%) to BOTMM wallet.
727
- * Call after collectPresaleRevenue (distribute_presale_revenue).
728
- */
729
- distributeBotmmRevenue(presalePda: PublicKey, botmmAddress: PublicKey, currencyMint?: PublicKey): Promise<Transaction>;
730
721
  fetchPresale(presalePda: PublicKey): Promise<PresaleInfo | null>;
731
722
  fetchUserBuyRecord(presalePda: PublicKey, user: PublicKey): Promise<UserBuyRecord | null>;
732
723
  }
package/dist/index.d.ts CHANGED
@@ -490,10 +490,10 @@ declare class MarketClient {
490
490
  */
491
491
  rejectPresale(presalePda: PublicKey, caller?: PublicKey): Promise<Transaction>;
492
492
  /**
493
- * Whitelist-only: distribute presale vault funds agents_rev% + company_rev% + rest to creator.
494
- * Must be called after approvePresale.
493
+ * Whitelist-only: distribute presale vault → 10% agents + 10% company + 80% botmm.
494
+ * Closes presale_vault ATA and presale PDA after distribution; lamports returned to payer.
495
495
  */
496
- collectPresaleRevenue(presalePda: PublicKey, currencyMint: PublicKey, referralAddress: PublicKey, companyAddress: PublicKey, caller?: PublicKey): Promise<Transaction>;
496
+ collectPresaleRevenue(presalePda: PublicKey, currencyMint: PublicKey, referralAddress: PublicKey, companyAddress: PublicKey, botmmAddress: PublicKey, caller?: PublicKey, payer?: PublicKey): Promise<Transaction>;
497
497
  /**
498
498
  * Whitelist-only: snapshot MST supply so holders can claim trading fees.
499
499
  * Call after oracle resolves the question.
@@ -718,15 +718,6 @@ declare class PresaleClient {
718
718
  * Only callable when presale status = Rejected.
719
719
  */
720
720
  refund(presalePda: PublicKey, user?: PublicKey): Promise<Transaction>;
721
- /**
722
- * Creator claims their share of presale revenue after distribute_presale_revenue.
723
- */
724
- claimRevenue(presalePda: PublicKey, creator?: PublicKey): Promise<Transaction>;
725
- /**
726
- * Transfer creator_claimable_revenue (80%) to BOTMM wallet.
727
- * Call after collectPresaleRevenue (distribute_presale_revenue).
728
- */
729
- distributeBotmmRevenue(presalePda: PublicKey, botmmAddress: PublicKey, currencyMint?: PublicKey): Promise<Transaction>;
730
721
  fetchPresale(presalePda: PublicKey): Promise<PresaleInfo | null>;
731
722
  fetchUserBuyRecord(presalePda: PublicKey, user: PublicKey): Promise<UserBuyRecord | null>;
732
723
  }
package/dist/index.js CHANGED
@@ -6,11 +6,11 @@ var crypto = require('crypto');
6
6
  var splToken = require('@solana/spl-token');
7
7
  var oracleIdl = require('./oracle-O53KMXDK.json');
8
8
  var hookIdl = require('./hook-THBRGUM6.json');
9
- var questionMarketIdl = require('./question_market-RP3J3N2M.json');
10
- var conditionalTokensIdl = require('./conditional_tokens-3O5V46N5.json');
9
+ var questionMarketIdl = require('./question_market-CD4WRZLT.json');
10
+ var conditionalTokensIdl = require('./conditional_tokens-X53GZYAY.json');
11
11
  var clobExchangeIdl = require('./clob_exchange-MQF4NI27.json');
12
12
  var feeManagementIdl = require('./fee_management-VGF77YXG.json');
13
- var presaleIdl = require('./presale-Q4NDVQFN.json');
13
+ var presaleIdl = require('./presale-D7EQAQDZ.json');
14
14
  var marketOracleIdl = require('./market_oracle-E6UUARGR.json');
15
15
  var BN4 = require('bn.js');
16
16
  var nacl = require('tweetnacl');
@@ -762,6 +762,9 @@ var MarketClient = class {
762
762
  systemProgram: web3_js.SystemProgram.programId,
763
763
  rent: web3_js.SYSVAR_RENT_PUBKEY
764
764
  }).transaction();
765
+ tx.instructions.unshift(
766
+ web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 })
767
+ );
765
768
  return { tx, presalePda, qtMint };
766
769
  }
767
770
  /**
@@ -835,14 +838,15 @@ var MarketClient = class {
835
838
  }).transaction();
836
839
  }
837
840
  /**
838
- * Whitelist-only: distribute presale vault funds agents_rev% + company_rev% + rest to creator.
839
- * Must be called after approvePresale.
841
+ * Whitelist-only: distribute presale vault → 10% agents + 10% company + 80% botmm.
842
+ * Closes presale_vault ATA and presale PDA after distribution; lamports returned to payer.
840
843
  */
841
- async collectPresaleRevenue(presalePda, currencyMint, referralAddress, companyAddress, caller = this.walletPubkey) {
844
+ async collectPresaleRevenue(presalePda, currencyMint, referralAddress, companyAddress, botmmAddress, caller = this.walletPubkey, payer = this.walletPubkey) {
842
845
  if (!this.programIds.presale) throw new Error("presale program ID not configured");
843
846
  const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
844
847
  const referralTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, referralAddress);
845
848
  const companyTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, companyAddress);
849
+ const botmmTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, botmmAddress);
846
850
  return this.program.methods.collectPresaleRevenue().accounts({
847
851
  caller,
848
852
  config: this.configPda,
@@ -851,6 +855,8 @@ var MarketClient = class {
851
855
  currencyMint,
852
856
  referralTokenAccount,
853
857
  companyTokenAccount,
858
+ botmmTokenAccount,
859
+ payer,
854
860
  presaleProgram: this.programIds.presale,
855
861
  tokenProgram: splToken.TOKEN_PROGRAM_ID,
856
862
  associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
@@ -2137,46 +2143,6 @@ var PresaleClient = class {
2137
2143
  systemProgram: web3_js.SystemProgram.programId
2138
2144
  }).transaction();
2139
2145
  }
2140
- /**
2141
- * Creator claims their share of presale revenue after distribute_presale_revenue.
2142
- */
2143
- async claimRevenue(presalePda, creator = this.walletPubkey) {
2144
- const presale = await this.fetchPresale(presalePda);
2145
- if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
2146
- const currencyMint = presale.currencyMint;
2147
- const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
2148
- const creatorCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, creator);
2149
- return this.program.methods.claimRevenue().accounts({
2150
- creator,
2151
- presale: presalePda,
2152
- presaleVault,
2153
- creatorCurrencyAta,
2154
- currencyMint,
2155
- tokenProgram: splToken.TOKEN_PROGRAM_ID,
2156
- associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
2157
- systemProgram: web3_js.SystemProgram.programId
2158
- }).transaction();
2159
- }
2160
- /**
2161
- * Transfer creator_claimable_revenue (80%) to BOTMM wallet.
2162
- * Call after collectPresaleRevenue (distribute_presale_revenue).
2163
- */
2164
- async distributeBotmmRevenue(presalePda, botmmAddress, currencyMint) {
2165
- if (!currencyMint) {
2166
- const presale = await this.fetchPresale(presalePda);
2167
- if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
2168
- currencyMint = presale.currencyMint;
2169
- }
2170
- const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
2171
- const botmmTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, botmmAddress);
2172
- return this.program.methods.distributeBotmmRevenue().accounts({
2173
- presale: presalePda,
2174
- presaleVault,
2175
- currencyMint,
2176
- botmmTokenAccount,
2177
- tokenProgram: splToken.TOKEN_PROGRAM_ID
2178
- }).transaction();
2179
- }
2180
2146
  // ─── Queries ─────────────────────────────────────────────────────────────────
2181
2147
  async fetchPresale(presalePda) {
2182
2148
  try {