@theliem/xmarket-sdk 3.1.2 → 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.
- package/dist/{conditional_tokens-3O5V46N5.json → conditional_tokens-X53GZYAY.json} +17 -17
- package/dist/index.d.mts +9 -21
- package/dist/index.d.ts +9 -21
- package/dist/index.js +28 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -71
- package/dist/index.mjs.map +1 -1
- package/dist/{presale-Q4NDVQFN.json → presale-D7EQAQDZ.json} +16 -320
- package/dist/{question_market-RP3J3N2M.json → question_market-CD4WRZLT.json} +15 -1
- package/package.json +1 -1
- package/src/idls/conditional_tokens.json +17 -17
- package/src/idls/presale.json +16 -320
- package/src/idls/question_market.json +15 -1
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as anchor from '@coral-xyz/anchor';
|
|
2
2
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
3
|
-
import { PublicKey,
|
|
3
|
+
import { PublicKey, Transaction, Keypair, TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js';
|
|
4
4
|
import BN from 'bn.js';
|
|
5
5
|
|
|
6
6
|
interface ProgramIds {
|
|
@@ -247,12 +247,9 @@ declare class OracleClient {
|
|
|
247
247
|
removeFromWhitelist(address: PublicKey, ownerPubkey?: PublicKey): Promise<TxResult>;
|
|
248
248
|
/**
|
|
249
249
|
* Whitelisted reporter resolves a question.
|
|
250
|
-
*
|
|
251
|
-
* @param conditionPda - CTF condition account (oracle_config = oraclePda, question_id must match)
|
|
252
|
-
* @param ownerPubkey - oracle config owner (defaults to wallet)
|
|
253
|
-
* @param payer - fee payer (defaults to wallet)
|
|
250
|
+
* reporter signs the instruction; payer covers the tx fee (Kora pattern).
|
|
254
251
|
*/
|
|
255
|
-
resolveQuestion(questionId: Uint8Array, outcomeCount: number, payoutNumerators: number[], conditionPda: PublicKey,
|
|
252
|
+
resolveQuestion(questionId: Uint8Array, outcomeCount: number, payoutNumerators: number[], conditionPda: PublicKey, reporter?: PublicKey, payer?: PublicKey, ownerPubkey?: PublicKey): Promise<Transaction>;
|
|
256
253
|
/** Owner updates the admin. */
|
|
257
254
|
updateAdmin(newAdmin: PublicKey, ownerPubkey?: PublicKey): Promise<TxResult>;
|
|
258
255
|
/** Owner transfers ownership to a new keypair. */
|
|
@@ -493,10 +490,10 @@ declare class MarketClient {
|
|
|
493
490
|
*/
|
|
494
491
|
rejectPresale(presalePda: PublicKey, caller?: PublicKey): Promise<Transaction>;
|
|
495
492
|
/**
|
|
496
|
-
* Whitelist-only: distribute presale vault
|
|
497
|
-
*
|
|
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.
|
|
498
495
|
*/
|
|
499
|
-
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>;
|
|
500
497
|
/**
|
|
501
498
|
* Whitelist-only: snapshot MST supply so holders can claim trading fees.
|
|
502
499
|
* Call after oracle resolves the question.
|
|
@@ -715,21 +712,12 @@ declare class PresaleClient {
|
|
|
715
712
|
* qtAmount: amount of MST to receive (9 decimals).
|
|
716
713
|
* USDC cost = qtAmount * price / 1e9.
|
|
717
714
|
*/
|
|
718
|
-
buy(presalePda: PublicKey, qtAmount: anchor.BN, buyer?: PublicKey, payer?: PublicKey
|
|
715
|
+
buy(presalePda: PublicKey, qtAmount: anchor.BN, buyer?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
719
716
|
/**
|
|
720
717
|
* Refund: burn user's MST and return USDC.
|
|
721
718
|
* Only callable when presale status = Rejected.
|
|
722
719
|
*/
|
|
723
|
-
refund(presalePda: PublicKey, user?: PublicKey
|
|
724
|
-
/**
|
|
725
|
-
* Creator claims their share of presale revenue after distribute_presale_revenue.
|
|
726
|
-
*/
|
|
727
|
-
claimRevenue(presalePda: PublicKey, creator?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
|
|
728
|
-
/**
|
|
729
|
-
* Transfer creator_claimable_revenue (80%) to BOTMM wallet.
|
|
730
|
-
* Call after collectPresaleRevenue (distribute_presale_revenue).
|
|
731
|
-
*/
|
|
732
|
-
distributeBotmmRevenue(presalePda: PublicKey, botmmAddress: PublicKey, currencyMint?: PublicKey): Promise<Transaction>;
|
|
720
|
+
refund(presalePda: PublicKey, user?: PublicKey): Promise<Transaction>;
|
|
733
721
|
fetchPresale(presalePda: PublicKey): Promise<PresaleInfo | null>;
|
|
734
722
|
fetchUserBuyRecord(presalePda: PublicKey, user: PublicKey): Promise<UserBuyRecord | null>;
|
|
735
723
|
}
|
|
@@ -764,7 +752,7 @@ declare class MarketOracleClient {
|
|
|
764
752
|
* User burns their MST and claims proportional share of oracle vault USDC.
|
|
765
753
|
* Call after market.collectTradingFee snapshotted qt supply.
|
|
766
754
|
*/
|
|
767
|
-
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey
|
|
755
|
+
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
768
756
|
fetchMarketOracle(marketOraclePda: PublicKey): Promise<MarketOracleInfo | null>;
|
|
769
757
|
fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
|
|
770
758
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as anchor from '@coral-xyz/anchor';
|
|
2
2
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
3
|
-
import { PublicKey,
|
|
3
|
+
import { PublicKey, Transaction, Keypair, TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js';
|
|
4
4
|
import BN from 'bn.js';
|
|
5
5
|
|
|
6
6
|
interface ProgramIds {
|
|
@@ -247,12 +247,9 @@ declare class OracleClient {
|
|
|
247
247
|
removeFromWhitelist(address: PublicKey, ownerPubkey?: PublicKey): Promise<TxResult>;
|
|
248
248
|
/**
|
|
249
249
|
* Whitelisted reporter resolves a question.
|
|
250
|
-
*
|
|
251
|
-
* @param conditionPda - CTF condition account (oracle_config = oraclePda, question_id must match)
|
|
252
|
-
* @param ownerPubkey - oracle config owner (defaults to wallet)
|
|
253
|
-
* @param payer - fee payer (defaults to wallet)
|
|
250
|
+
* reporter signs the instruction; payer covers the tx fee (Kora pattern).
|
|
254
251
|
*/
|
|
255
|
-
resolveQuestion(questionId: Uint8Array, outcomeCount: number, payoutNumerators: number[], conditionPda: PublicKey,
|
|
252
|
+
resolveQuestion(questionId: Uint8Array, outcomeCount: number, payoutNumerators: number[], conditionPda: PublicKey, reporter?: PublicKey, payer?: PublicKey, ownerPubkey?: PublicKey): Promise<Transaction>;
|
|
256
253
|
/** Owner updates the admin. */
|
|
257
254
|
updateAdmin(newAdmin: PublicKey, ownerPubkey?: PublicKey): Promise<TxResult>;
|
|
258
255
|
/** Owner transfers ownership to a new keypair. */
|
|
@@ -493,10 +490,10 @@ declare class MarketClient {
|
|
|
493
490
|
*/
|
|
494
491
|
rejectPresale(presalePda: PublicKey, caller?: PublicKey): Promise<Transaction>;
|
|
495
492
|
/**
|
|
496
|
-
* Whitelist-only: distribute presale vault
|
|
497
|
-
*
|
|
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.
|
|
498
495
|
*/
|
|
499
|
-
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>;
|
|
500
497
|
/**
|
|
501
498
|
* Whitelist-only: snapshot MST supply so holders can claim trading fees.
|
|
502
499
|
* Call after oracle resolves the question.
|
|
@@ -715,21 +712,12 @@ declare class PresaleClient {
|
|
|
715
712
|
* qtAmount: amount of MST to receive (9 decimals).
|
|
716
713
|
* USDC cost = qtAmount * price / 1e9.
|
|
717
714
|
*/
|
|
718
|
-
buy(presalePda: PublicKey, qtAmount: anchor.BN, buyer?: PublicKey, payer?: PublicKey
|
|
715
|
+
buy(presalePda: PublicKey, qtAmount: anchor.BN, buyer?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
719
716
|
/**
|
|
720
717
|
* Refund: burn user's MST and return USDC.
|
|
721
718
|
* Only callable when presale status = Rejected.
|
|
722
719
|
*/
|
|
723
|
-
refund(presalePda: PublicKey, user?: PublicKey
|
|
724
|
-
/**
|
|
725
|
-
* Creator claims their share of presale revenue after distribute_presale_revenue.
|
|
726
|
-
*/
|
|
727
|
-
claimRevenue(presalePda: PublicKey, creator?: PublicKey, signers?: Keypair[]): Promise<TxResult>;
|
|
728
|
-
/**
|
|
729
|
-
* Transfer creator_claimable_revenue (80%) to BOTMM wallet.
|
|
730
|
-
* Call after collectPresaleRevenue (distribute_presale_revenue).
|
|
731
|
-
*/
|
|
732
|
-
distributeBotmmRevenue(presalePda: PublicKey, botmmAddress: PublicKey, currencyMint?: PublicKey): Promise<Transaction>;
|
|
720
|
+
refund(presalePda: PublicKey, user?: PublicKey): Promise<Transaction>;
|
|
733
721
|
fetchPresale(presalePda: PublicKey): Promise<PresaleInfo | null>;
|
|
734
722
|
fetchUserBuyRecord(presalePda: PublicKey, user: PublicKey): Promise<UserBuyRecord | null>;
|
|
735
723
|
}
|
|
@@ -764,7 +752,7 @@ declare class MarketOracleClient {
|
|
|
764
752
|
* User burns their MST and claims proportional share of oracle vault USDC.
|
|
765
753
|
* Call after market.collectTradingFee snapshotted qt supply.
|
|
766
754
|
*/
|
|
767
|
-
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey
|
|
755
|
+
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
768
756
|
fetchMarketOracle(marketOraclePda: PublicKey): Promise<MarketOracleInfo | null>;
|
|
769
757
|
fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
|
|
770
758
|
}
|
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-
|
|
10
|
-
var conditionalTokensIdl = require('./conditional_tokens-
|
|
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-
|
|
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');
|
|
@@ -307,28 +307,24 @@ var OracleClient = class {
|
|
|
307
307
|
}
|
|
308
308
|
/**
|
|
309
309
|
* Whitelisted reporter resolves a question.
|
|
310
|
-
*
|
|
311
|
-
* @param conditionPda - CTF condition account (oracle_config = oraclePda, question_id must match)
|
|
312
|
-
* @param ownerPubkey - oracle config owner (defaults to wallet)
|
|
313
|
-
* @param payer - fee payer (defaults to wallet)
|
|
310
|
+
* reporter signs the instruction; payer covers the tx fee (Kora pattern).
|
|
314
311
|
*/
|
|
315
|
-
async resolveQuestion(questionId, outcomeCount, payoutNumerators, conditionPda,
|
|
312
|
+
async resolveQuestion(questionId, outcomeCount, payoutNumerators, conditionPda, reporter = this.walletPubkey, payer = this.walletPubkey, ownerPubkey) {
|
|
316
313
|
const oracleConfig = this.configPda(ownerPubkey);
|
|
317
314
|
const [questionResultPda] = PDA.questionResult(oracleConfig, questionId, this.programIds);
|
|
318
|
-
|
|
315
|
+
return this.program.methods.resolveQuestion(
|
|
319
316
|
Array.from(questionId),
|
|
320
317
|
outcomeCount,
|
|
321
318
|
payoutNumerators.map((n) => new anchor4__namespace.BN(n))
|
|
322
319
|
).accounts({
|
|
323
|
-
reporter
|
|
320
|
+
reporter,
|
|
324
321
|
oracleConfig,
|
|
325
322
|
questionResult: questionResultPda,
|
|
326
323
|
condition: conditionPda,
|
|
327
324
|
conditionalTokensProgram: this.programIds.conditionalTokens,
|
|
328
|
-
payer
|
|
325
|
+
payer,
|
|
329
326
|
systemProgram: web3_js.SystemProgram.programId
|
|
330
|
-
}).
|
|
331
|
-
return { signature: sig };
|
|
327
|
+
}).transaction();
|
|
332
328
|
}
|
|
333
329
|
/** Owner updates the admin. */
|
|
334
330
|
async updateAdmin(newAdmin, ownerPubkey) {
|
|
@@ -766,6 +762,9 @@ var MarketClient = class {
|
|
|
766
762
|
systemProgram: web3_js.SystemProgram.programId,
|
|
767
763
|
rent: web3_js.SYSVAR_RENT_PUBKEY
|
|
768
764
|
}).transaction();
|
|
765
|
+
tx.instructions.unshift(
|
|
766
|
+
web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 })
|
|
767
|
+
);
|
|
769
768
|
return { tx, presalePda, qtMint };
|
|
770
769
|
}
|
|
771
770
|
/**
|
|
@@ -839,14 +838,15 @@ var MarketClient = class {
|
|
|
839
838
|
}).transaction();
|
|
840
839
|
}
|
|
841
840
|
/**
|
|
842
|
-
* Whitelist-only: distribute presale vault
|
|
843
|
-
*
|
|
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.
|
|
844
843
|
*/
|
|
845
|
-
async collectPresaleRevenue(presalePda, currencyMint, referralAddress, companyAddress, caller = this.walletPubkey) {
|
|
844
|
+
async collectPresaleRevenue(presalePda, currencyMint, referralAddress, companyAddress, botmmAddress, caller = this.walletPubkey, payer = this.walletPubkey) {
|
|
846
845
|
if (!this.programIds.presale) throw new Error("presale program ID not configured");
|
|
847
846
|
const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
848
847
|
const referralTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, referralAddress);
|
|
849
848
|
const companyTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, companyAddress);
|
|
849
|
+
const botmmTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, botmmAddress);
|
|
850
850
|
return this.program.methods.collectPresaleRevenue().accounts({
|
|
851
851
|
caller,
|
|
852
852
|
config: this.configPda,
|
|
@@ -855,6 +855,8 @@ var MarketClient = class {
|
|
|
855
855
|
currencyMint,
|
|
856
856
|
referralTokenAccount,
|
|
857
857
|
companyTokenAccount,
|
|
858
|
+
botmmTokenAccount,
|
|
859
|
+
payer,
|
|
858
860
|
presaleProgram: this.programIds.presale,
|
|
859
861
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
860
862
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
@@ -1404,8 +1406,8 @@ var ClobClient = class {
|
|
|
1404
1406
|
async _sendLegacyTx(instructions) {
|
|
1405
1407
|
const { connection } = this.provider;
|
|
1406
1408
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1407
|
-
const { Transaction:
|
|
1408
|
-
const tx = new
|
|
1409
|
+
const { Transaction: Transaction7 } = await import('@solana/web3.js');
|
|
1410
|
+
const tx = new Transaction7();
|
|
1409
1411
|
tx.recentBlockhash = blockhash;
|
|
1410
1412
|
tx.feePayer = this.walletPubkey;
|
|
1411
1413
|
tx.add(...instructions);
|
|
@@ -2088,7 +2090,7 @@ var PresaleClient = class {
|
|
|
2088
2090
|
* qtAmount: amount of MST to receive (9 decimals).
|
|
2089
2091
|
* USDC cost = qtAmount * price / 1e9.
|
|
2090
2092
|
*/
|
|
2091
|
-
async buy(presalePda, qtAmount, buyer = this.walletPubkey, payer = this.walletPubkey
|
|
2093
|
+
async buy(presalePda, qtAmount, buyer = this.walletPubkey, payer = this.walletPubkey) {
|
|
2092
2094
|
const presale = await this.fetchPresale(presalePda);
|
|
2093
2095
|
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2094
2096
|
const qtMint = presale.qtMint;
|
|
@@ -2098,7 +2100,7 @@ var PresaleClient = class {
|
|
|
2098
2100
|
const buyerQtAta = splToken.getAssociatedTokenAddressSync(qtMint, buyer);
|
|
2099
2101
|
const buyerCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, buyer);
|
|
2100
2102
|
const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2101
|
-
|
|
2103
|
+
return this.program.methods.buy(qtAmount).accounts({
|
|
2102
2104
|
buyer,
|
|
2103
2105
|
payer,
|
|
2104
2106
|
presale: presalePda,
|
|
@@ -2112,14 +2114,13 @@ var PresaleClient = class {
|
|
|
2112
2114
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
2113
2115
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2114
2116
|
systemProgram: web3_js.SystemProgram.programId
|
|
2115
|
-
}).
|
|
2116
|
-
return { signature: sig };
|
|
2117
|
+
}).transaction();
|
|
2117
2118
|
}
|
|
2118
2119
|
/**
|
|
2119
2120
|
* Refund: burn user's MST and return USDC.
|
|
2120
2121
|
* Only callable when presale status = Rejected.
|
|
2121
2122
|
*/
|
|
2122
|
-
async refund(presalePda, user = this.walletPubkey
|
|
2123
|
+
async refund(presalePda, user = this.walletPubkey) {
|
|
2123
2124
|
const presale = await this.fetchPresale(presalePda);
|
|
2124
2125
|
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2125
2126
|
const qtMint = presale.qtMint;
|
|
@@ -2128,7 +2129,7 @@ var PresaleClient = class {
|
|
|
2128
2129
|
const userQtAta = splToken.getAssociatedTokenAddressSync(qtMint, user);
|
|
2129
2130
|
const userCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, user);
|
|
2130
2131
|
const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2131
|
-
|
|
2132
|
+
return this.program.methods.refund().accounts({
|
|
2132
2133
|
user,
|
|
2133
2134
|
presale: presalePda,
|
|
2134
2135
|
qtMint,
|
|
@@ -2140,48 +2141,6 @@ var PresaleClient = class {
|
|
|
2140
2141
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
2141
2142
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2142
2143
|
systemProgram: web3_js.SystemProgram.programId
|
|
2143
|
-
}).signers(signers).rpc();
|
|
2144
|
-
return { signature: sig };
|
|
2145
|
-
}
|
|
2146
|
-
/**
|
|
2147
|
-
* Creator claims their share of presale revenue after distribute_presale_revenue.
|
|
2148
|
-
*/
|
|
2149
|
-
async claimRevenue(presalePda, creator = this.walletPubkey, signers = []) {
|
|
2150
|
-
const presale = await this.fetchPresale(presalePda);
|
|
2151
|
-
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2152
|
-
const currencyMint = presale.currencyMint;
|
|
2153
|
-
const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2154
|
-
const creatorCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, creator);
|
|
2155
|
-
const sig = await this.program.methods.claimRevenue().accounts({
|
|
2156
|
-
creator,
|
|
2157
|
-
presale: presalePda,
|
|
2158
|
-
presaleVault,
|
|
2159
|
-
creatorCurrencyAta,
|
|
2160
|
-
currencyMint,
|
|
2161
|
-
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
2162
|
-
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2163
|
-
systemProgram: web3_js.SystemProgram.programId
|
|
2164
|
-
}).signers(signers).rpc();
|
|
2165
|
-
return { signature: sig };
|
|
2166
|
-
}
|
|
2167
|
-
/**
|
|
2168
|
-
* Transfer creator_claimable_revenue (80%) to BOTMM wallet.
|
|
2169
|
-
* Call after collectPresaleRevenue (distribute_presale_revenue).
|
|
2170
|
-
*/
|
|
2171
|
-
async distributeBotmmRevenue(presalePda, botmmAddress, currencyMint) {
|
|
2172
|
-
if (!currencyMint) {
|
|
2173
|
-
const presale = await this.fetchPresale(presalePda);
|
|
2174
|
-
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2175
|
-
currencyMint = presale.currencyMint;
|
|
2176
|
-
}
|
|
2177
|
-
const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2178
|
-
const botmmTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, botmmAddress);
|
|
2179
|
-
return this.program.methods.distributeBotmmRevenue().accounts({
|
|
2180
|
-
presale: presalePda,
|
|
2181
|
-
presaleVault,
|
|
2182
|
-
currencyMint,
|
|
2183
|
-
botmmTokenAccount,
|
|
2184
|
-
tokenProgram: splToken.TOKEN_PROGRAM_ID
|
|
2185
2144
|
}).transaction();
|
|
2186
2145
|
}
|
|
2187
2146
|
// ─── Queries ─────────────────────────────────────────────────────────────────
|
|
@@ -2249,7 +2208,7 @@ var MarketOracleClient = class {
|
|
|
2249
2208
|
* User burns their MST and claims proportional share of oracle vault USDC.
|
|
2250
2209
|
* Call after market.collectTradingFee snapshotted qt supply.
|
|
2251
2210
|
*/
|
|
2252
|
-
async claimFeesShare(marketOraclePda, user = this.walletPubkey, payer = this.walletPubkey
|
|
2211
|
+
async claimFeesShare(marketOraclePda, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
2253
2212
|
const oracle = await this.fetchMarketOracle(marketOraclePda);
|
|
2254
2213
|
if (!oracle) throw new Error(`MarketOracle not found: ${marketOraclePda.toBase58()}`);
|
|
2255
2214
|
const currencyMint = oracle.currencyMint;
|
|
@@ -2258,7 +2217,7 @@ var MarketOracleClient = class {
|
|
|
2258
2217
|
const userQtAta = splToken.getAssociatedTokenAddressSync(qtMint, user);
|
|
2259
2218
|
const userCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, user);
|
|
2260
2219
|
const userClaimRecord = this.userClaimRecordPda(marketOraclePda, user);
|
|
2261
|
-
|
|
2220
|
+
return this.program.methods.claimFeesShare().accounts({
|
|
2262
2221
|
user,
|
|
2263
2222
|
payer,
|
|
2264
2223
|
marketOracle: marketOraclePda,
|
|
@@ -2271,8 +2230,7 @@ var MarketOracleClient = class {
|
|
|
2271
2230
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
2272
2231
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2273
2232
|
systemProgram: web3_js.SystemProgram.programId
|
|
2274
|
-
}).
|
|
2275
|
-
return { signature: sig };
|
|
2233
|
+
}).transaction();
|
|
2276
2234
|
}
|
|
2277
2235
|
// ─── Queries ─────────────────────────────────────────────────────────────────
|
|
2278
2236
|
async fetchMarketOracle(marketOraclePda) {
|