@theliem/xmarket-sdk 3.1.1 → 3.1.3
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 +10 -13
- package/dist/index.d.ts +10 -13
- package/dist/index.js +29 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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, Keypair, TransactionInstruction,
|
|
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. */
|
|
@@ -342,17 +339,17 @@ declare class CtfClient {
|
|
|
342
339
|
* Split `amount` collateral into equal YES + NO tokens.
|
|
343
340
|
* ATAs created automatically via `init_if_needed`.
|
|
344
341
|
*/
|
|
345
|
-
splitPosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey
|
|
342
|
+
splitPosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
346
343
|
/**
|
|
347
344
|
* Merge `amount` YES + NO tokens back into collateral.
|
|
348
345
|
* Both token balances must be ≥ amount.
|
|
349
346
|
*/
|
|
350
|
-
mergePosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey
|
|
347
|
+
mergePosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
351
348
|
/**
|
|
352
349
|
* After condition resolves: burn outcome tokens proportional to payout
|
|
353
350
|
* and receive USDC. Works for winning, losing, or both positions.
|
|
354
351
|
*/
|
|
355
|
-
redeemPositions(condition: PublicKey, collateralMint: PublicKey, user?: PublicKey, payer?: PublicKey
|
|
352
|
+
redeemPositions(condition: PublicKey, collateralMint: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
356
353
|
/**
|
|
357
354
|
* Oracle directly resolves a condition with payout numerators.
|
|
358
355
|
* Bypasses QuestionMarket — only for oracle-owned conditions.
|
|
@@ -715,16 +712,16 @@ 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
|
|
720
|
+
refund(presalePda: PublicKey, user?: PublicKey): Promise<Transaction>;
|
|
724
721
|
/**
|
|
725
722
|
* Creator claims their share of presale revenue after distribute_presale_revenue.
|
|
726
723
|
*/
|
|
727
|
-
claimRevenue(presalePda: PublicKey, creator?: PublicKey
|
|
724
|
+
claimRevenue(presalePda: PublicKey, creator?: PublicKey): Promise<Transaction>;
|
|
728
725
|
/**
|
|
729
726
|
* Transfer creator_claimable_revenue (80%) to BOTMM wallet.
|
|
730
727
|
* Call after collectPresaleRevenue (distribute_presale_revenue).
|
|
@@ -764,7 +761,7 @@ declare class MarketOracleClient {
|
|
|
764
761
|
* User burns their MST and claims proportional share of oracle vault USDC.
|
|
765
762
|
* Call after market.collectTradingFee snapshotted qt supply.
|
|
766
763
|
*/
|
|
767
|
-
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey
|
|
764
|
+
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
768
765
|
fetchMarketOracle(marketOraclePda: PublicKey): Promise<MarketOracleInfo | null>;
|
|
769
766
|
fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
|
|
770
767
|
}
|
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, Keypair, TransactionInstruction,
|
|
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. */
|
|
@@ -342,17 +339,17 @@ declare class CtfClient {
|
|
|
342
339
|
* Split `amount` collateral into equal YES + NO tokens.
|
|
343
340
|
* ATAs created automatically via `init_if_needed`.
|
|
344
341
|
*/
|
|
345
|
-
splitPosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey
|
|
342
|
+
splitPosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
346
343
|
/**
|
|
347
344
|
* Merge `amount` YES + NO tokens back into collateral.
|
|
348
345
|
* Both token balances must be ≥ amount.
|
|
349
346
|
*/
|
|
350
|
-
mergePosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey
|
|
347
|
+
mergePosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
351
348
|
/**
|
|
352
349
|
* After condition resolves: burn outcome tokens proportional to payout
|
|
353
350
|
* and receive USDC. Works for winning, losing, or both positions.
|
|
354
351
|
*/
|
|
355
|
-
redeemPositions(condition: PublicKey, collateralMint: PublicKey, user?: PublicKey, payer?: PublicKey
|
|
352
|
+
redeemPositions(condition: PublicKey, collateralMint: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
356
353
|
/**
|
|
357
354
|
* Oracle directly resolves a condition with payout numerators.
|
|
358
355
|
* Bypasses QuestionMarket — only for oracle-owned conditions.
|
|
@@ -715,16 +712,16 @@ 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
|
|
720
|
+
refund(presalePda: PublicKey, user?: PublicKey): Promise<Transaction>;
|
|
724
721
|
/**
|
|
725
722
|
* Creator claims their share of presale revenue after distribute_presale_revenue.
|
|
726
723
|
*/
|
|
727
|
-
claimRevenue(presalePda: PublicKey, creator?: PublicKey
|
|
724
|
+
claimRevenue(presalePda: PublicKey, creator?: PublicKey): Promise<Transaction>;
|
|
728
725
|
/**
|
|
729
726
|
* Transfer creator_claimable_revenue (80%) to BOTMM wallet.
|
|
730
727
|
* Call after collectPresaleRevenue (distribute_presale_revenue).
|
|
@@ -764,7 +761,7 @@ declare class MarketOracleClient {
|
|
|
764
761
|
* User burns their MST and claims proportional share of oracle vault USDC.
|
|
765
762
|
* Call after market.collectTradingFee snapshotted qt supply.
|
|
766
763
|
*/
|
|
767
|
-
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey
|
|
764
|
+
claimFeesShare(marketOraclePda: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
768
765
|
fetchMarketOracle(marketOraclePda: PublicKey): Promise<MarketOracleInfo | null>;
|
|
769
766
|
fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
|
|
770
767
|
}
|
package/dist/index.js
CHANGED
|
@@ -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) {
|
|
@@ -970,7 +966,7 @@ var CtfClient = class {
|
|
|
970
966
|
* Split `amount` collateral into equal YES + NO tokens.
|
|
971
967
|
* ATAs created automatically via `init_if_needed`.
|
|
972
968
|
*/
|
|
973
|
-
async splitPosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey
|
|
969
|
+
async splitPosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
974
970
|
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
975
971
|
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
976
972
|
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
@@ -981,7 +977,7 @@ var CtfClient = class {
|
|
|
981
977
|
const userYesAta = splToken.getAssociatedTokenAddressSync(yesMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
982
978
|
const userNoAta = splToken.getAssociatedTokenAddressSync(noMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
983
979
|
const userCollateral = splToken.getAssociatedTokenAddressSync(collateralMint, user);
|
|
984
|
-
|
|
980
|
+
return this.program.methods.splitPosition(amount).accounts({
|
|
985
981
|
user,
|
|
986
982
|
payer,
|
|
987
983
|
condition,
|
|
@@ -999,14 +995,13 @@ var CtfClient = class {
|
|
|
999
995
|
token2022Program: splToken.TOKEN_2022_PROGRAM_ID,
|
|
1000
996
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
1001
997
|
systemProgram: web3_js.SystemProgram.programId
|
|
1002
|
-
}).
|
|
1003
|
-
return { signature: sig };
|
|
998
|
+
}).transaction();
|
|
1004
999
|
}
|
|
1005
1000
|
/**
|
|
1006
1001
|
* Merge `amount` YES + NO tokens back into collateral.
|
|
1007
1002
|
* Both token balances must be ≥ amount.
|
|
1008
1003
|
*/
|
|
1009
|
-
async mergePosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey
|
|
1004
|
+
async mergePosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
1010
1005
|
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
1011
1006
|
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
1012
1007
|
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
@@ -1016,7 +1011,7 @@ var CtfClient = class {
|
|
|
1016
1011
|
const userYesAta = splToken.getAssociatedTokenAddressSync(yesMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
1017
1012
|
const userNoAta = splToken.getAssociatedTokenAddressSync(noMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
1018
1013
|
const userCollateral = splToken.getAssociatedTokenAddressSync(collateralMint, user);
|
|
1019
|
-
|
|
1014
|
+
return this.program.methods.mergePosition(amount).accounts({
|
|
1020
1015
|
user,
|
|
1021
1016
|
payer,
|
|
1022
1017
|
condition,
|
|
@@ -1032,14 +1027,13 @@ var CtfClient = class {
|
|
|
1032
1027
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
1033
1028
|
token2022Program: splToken.TOKEN_2022_PROGRAM_ID,
|
|
1034
1029
|
systemProgram: web3_js.SystemProgram.programId
|
|
1035
|
-
}).
|
|
1036
|
-
return { signature: sig };
|
|
1030
|
+
}).transaction();
|
|
1037
1031
|
}
|
|
1038
1032
|
/**
|
|
1039
1033
|
* After condition resolves: burn outcome tokens proportional to payout
|
|
1040
1034
|
* and receive USDC. Works for winning, losing, or both positions.
|
|
1041
1035
|
*/
|
|
1042
|
-
async redeemPositions(condition, collateralMint, user = this.walletPubkey, payer = this.walletPubkey
|
|
1036
|
+
async redeemPositions(condition, collateralMint, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
1043
1037
|
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
1044
1038
|
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
1045
1039
|
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
@@ -1049,7 +1043,7 @@ var CtfClient = class {
|
|
|
1049
1043
|
const userYesAta = splToken.getAssociatedTokenAddressSync(yesMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
1050
1044
|
const userNoAta = splToken.getAssociatedTokenAddressSync(noMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
1051
1045
|
const userCollateral = splToken.getAssociatedTokenAddressSync(collateralMint, user);
|
|
1052
|
-
|
|
1046
|
+
return this.program.methods.redeemPositions().accounts({
|
|
1053
1047
|
user,
|
|
1054
1048
|
payer,
|
|
1055
1049
|
condition,
|
|
@@ -1065,8 +1059,7 @@ var CtfClient = class {
|
|
|
1065
1059
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
1066
1060
|
token2022Program: splToken.TOKEN_2022_PROGRAM_ID,
|
|
1067
1061
|
systemProgram: web3_js.SystemProgram.programId
|
|
1068
|
-
}).
|
|
1069
|
-
return { signature: sig };
|
|
1062
|
+
}).transaction();
|
|
1070
1063
|
}
|
|
1071
1064
|
/**
|
|
1072
1065
|
* Oracle directly resolves a condition with payout numerators.
|
|
@@ -1407,8 +1400,8 @@ var ClobClient = class {
|
|
|
1407
1400
|
async _sendLegacyTx(instructions) {
|
|
1408
1401
|
const { connection } = this.provider;
|
|
1409
1402
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1410
|
-
const { Transaction:
|
|
1411
|
-
const tx = new
|
|
1403
|
+
const { Transaction: Transaction7 } = await import('@solana/web3.js');
|
|
1404
|
+
const tx = new Transaction7();
|
|
1412
1405
|
tx.recentBlockhash = blockhash;
|
|
1413
1406
|
tx.feePayer = this.walletPubkey;
|
|
1414
1407
|
tx.add(...instructions);
|
|
@@ -2091,7 +2084,7 @@ var PresaleClient = class {
|
|
|
2091
2084
|
* qtAmount: amount of MST to receive (9 decimals).
|
|
2092
2085
|
* USDC cost = qtAmount * price / 1e9.
|
|
2093
2086
|
*/
|
|
2094
|
-
async buy(presalePda, qtAmount, buyer = this.walletPubkey, payer = this.walletPubkey
|
|
2087
|
+
async buy(presalePda, qtAmount, buyer = this.walletPubkey, payer = this.walletPubkey) {
|
|
2095
2088
|
const presale = await this.fetchPresale(presalePda);
|
|
2096
2089
|
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2097
2090
|
const qtMint = presale.qtMint;
|
|
@@ -2101,7 +2094,7 @@ var PresaleClient = class {
|
|
|
2101
2094
|
const buyerQtAta = splToken.getAssociatedTokenAddressSync(qtMint, buyer);
|
|
2102
2095
|
const buyerCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, buyer);
|
|
2103
2096
|
const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2104
|
-
|
|
2097
|
+
return this.program.methods.buy(qtAmount).accounts({
|
|
2105
2098
|
buyer,
|
|
2106
2099
|
payer,
|
|
2107
2100
|
presale: presalePda,
|
|
@@ -2115,14 +2108,13 @@ var PresaleClient = class {
|
|
|
2115
2108
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
2116
2109
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2117
2110
|
systemProgram: web3_js.SystemProgram.programId
|
|
2118
|
-
}).
|
|
2119
|
-
return { signature: sig };
|
|
2111
|
+
}).transaction();
|
|
2120
2112
|
}
|
|
2121
2113
|
/**
|
|
2122
2114
|
* Refund: burn user's MST and return USDC.
|
|
2123
2115
|
* Only callable when presale status = Rejected.
|
|
2124
2116
|
*/
|
|
2125
|
-
async refund(presalePda, user = this.walletPubkey
|
|
2117
|
+
async refund(presalePda, user = this.walletPubkey) {
|
|
2126
2118
|
const presale = await this.fetchPresale(presalePda);
|
|
2127
2119
|
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2128
2120
|
const qtMint = presale.qtMint;
|
|
@@ -2131,7 +2123,7 @@ var PresaleClient = class {
|
|
|
2131
2123
|
const userQtAta = splToken.getAssociatedTokenAddressSync(qtMint, user);
|
|
2132
2124
|
const userCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, user);
|
|
2133
2125
|
const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2134
|
-
|
|
2126
|
+
return this.program.methods.refund().accounts({
|
|
2135
2127
|
user,
|
|
2136
2128
|
presale: presalePda,
|
|
2137
2129
|
qtMint,
|
|
@@ -2143,19 +2135,18 @@ var PresaleClient = class {
|
|
|
2143
2135
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
2144
2136
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2145
2137
|
systemProgram: web3_js.SystemProgram.programId
|
|
2146
|
-
}).
|
|
2147
|
-
return { signature: sig };
|
|
2138
|
+
}).transaction();
|
|
2148
2139
|
}
|
|
2149
2140
|
/**
|
|
2150
2141
|
* Creator claims their share of presale revenue after distribute_presale_revenue.
|
|
2151
2142
|
*/
|
|
2152
|
-
async claimRevenue(presalePda, creator = this.walletPubkey
|
|
2143
|
+
async claimRevenue(presalePda, creator = this.walletPubkey) {
|
|
2153
2144
|
const presale = await this.fetchPresale(presalePda);
|
|
2154
2145
|
if (!presale) throw new Error(`Presale not found: ${presalePda.toBase58()}`);
|
|
2155
2146
|
const currencyMint = presale.currencyMint;
|
|
2156
2147
|
const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
2157
2148
|
const creatorCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, creator);
|
|
2158
|
-
|
|
2149
|
+
return this.program.methods.claimRevenue().accounts({
|
|
2159
2150
|
creator,
|
|
2160
2151
|
presale: presalePda,
|
|
2161
2152
|
presaleVault,
|
|
@@ -2164,8 +2155,7 @@ var PresaleClient = class {
|
|
|
2164
2155
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
2165
2156
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2166
2157
|
systemProgram: web3_js.SystemProgram.programId
|
|
2167
|
-
}).
|
|
2168
|
-
return { signature: sig };
|
|
2158
|
+
}).transaction();
|
|
2169
2159
|
}
|
|
2170
2160
|
/**
|
|
2171
2161
|
* Transfer creator_claimable_revenue (80%) to BOTMM wallet.
|
|
@@ -2252,7 +2242,7 @@ var MarketOracleClient = class {
|
|
|
2252
2242
|
* User burns their MST and claims proportional share of oracle vault USDC.
|
|
2253
2243
|
* Call after market.collectTradingFee snapshotted qt supply.
|
|
2254
2244
|
*/
|
|
2255
|
-
async claimFeesShare(marketOraclePda, user = this.walletPubkey, payer = this.walletPubkey
|
|
2245
|
+
async claimFeesShare(marketOraclePda, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
2256
2246
|
const oracle = await this.fetchMarketOracle(marketOraclePda);
|
|
2257
2247
|
if (!oracle) throw new Error(`MarketOracle not found: ${marketOraclePda.toBase58()}`);
|
|
2258
2248
|
const currencyMint = oracle.currencyMint;
|
|
@@ -2261,7 +2251,7 @@ var MarketOracleClient = class {
|
|
|
2261
2251
|
const userQtAta = splToken.getAssociatedTokenAddressSync(qtMint, user);
|
|
2262
2252
|
const userCurrencyAta = splToken.getAssociatedTokenAddressSync(currencyMint, user);
|
|
2263
2253
|
const userClaimRecord = this.userClaimRecordPda(marketOraclePda, user);
|
|
2264
|
-
|
|
2254
|
+
return this.program.methods.claimFeesShare().accounts({
|
|
2265
2255
|
user,
|
|
2266
2256
|
payer,
|
|
2267
2257
|
marketOracle: marketOraclePda,
|
|
@@ -2274,8 +2264,7 @@ var MarketOracleClient = class {
|
|
|
2274
2264
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
2275
2265
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2276
2266
|
systemProgram: web3_js.SystemProgram.programId
|
|
2277
|
-
}).
|
|
2278
|
-
return { signature: sig };
|
|
2267
|
+
}).transaction();
|
|
2279
2268
|
}
|
|
2280
2269
|
// ─── Queries ─────────────────────────────────────────────────────────────────
|
|
2281
2270
|
async fetchMarketOracle(marketOraclePda) {
|