@theliem/xmarket-sdk 3.12.0 → 3.16.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.d.mts +168 -14
- package/dist/index.d.ts +168 -14
- package/dist/index.js +1420 -201
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1419 -203
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as anchor5 from '@coral-xyz/anchor';
|
|
2
|
-
import { PublicKey, SYSVAR_INSTRUCTIONS_PUBKEY, SystemProgram, SYSVAR_RENT_PUBKEY, ComputeBudgetProgram, Transaction, TransactionInstruction, Ed25519Program, AddressLookupTableProgram,
|
|
2
|
+
import { PublicKey, SYSVAR_INSTRUCTIONS_PUBKEY, SystemProgram, SYSVAR_RENT_PUBKEY, ComputeBudgetProgram, TransactionMessage, VersionedTransaction, Transaction, TransactionInstruction, Ed25519Program, AddressLookupTableProgram, Connection } from '@solana/web3.js';
|
|
3
3
|
import { createHash } from 'crypto';
|
|
4
4
|
import { TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddressSync, ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, createAssociatedTokenAccountIdempotentInstruction, createApproveInstruction } from '@solana/spl-token';
|
|
5
5
|
import BN4 from 'bn.js';
|
|
@@ -24,6 +24,7 @@ var SEEDS = {
|
|
|
24
24
|
clobConfig: Buffer.from("clob_config"),
|
|
25
25
|
order: Buffer.from("order"),
|
|
26
26
|
feeConfig: Buffer.from("fee_config"),
|
|
27
|
+
referralConfig: Buffer.from("referral_config"),
|
|
27
28
|
questionFee: Buffer.from("question_fee"),
|
|
28
29
|
marketFee: Buffer.from("market_fee"),
|
|
29
30
|
// Presale
|
|
@@ -224,6 +225,14 @@ var PDA = class {
|
|
|
224
225
|
programIds.marketOracle
|
|
225
226
|
);
|
|
226
227
|
}
|
|
228
|
+
// ─── Referral Program ────────────────────────────────────────────────────
|
|
229
|
+
static referralConfig(owner, programIds) {
|
|
230
|
+
if (!programIds.referral) throw new Error("referral program ID not configured");
|
|
231
|
+
return PublicKey.findProgramAddressSync(
|
|
232
|
+
[SEEDS.referralConfig, owner.toBuffer()],
|
|
233
|
+
programIds.referral
|
|
234
|
+
);
|
|
235
|
+
}
|
|
227
236
|
// ─── Admin Contract ──────────────────────────────────────────────────────
|
|
228
237
|
static adminConfig(owner, programIds) {
|
|
229
238
|
if (!programIds.adminContract) throw new Error("adminContract program ID not configured");
|
|
@@ -496,7 +505,7 @@ var QuestionStatus = /* @__PURE__ */ ((QuestionStatus2) => {
|
|
|
496
505
|
QuestionStatus2["Resolved"] = "resolved";
|
|
497
506
|
return QuestionStatus2;
|
|
498
507
|
})(QuestionStatus || {});
|
|
499
|
-
var FEE_DENOMINATOR =
|
|
508
|
+
var FEE_DENOMINATOR = 1e4;
|
|
500
509
|
var XMarketError = class extends Error {
|
|
501
510
|
constructor(message, code) {
|
|
502
511
|
super(message);
|
|
@@ -561,6 +570,8 @@ var MarketClient = class {
|
|
|
561
570
|
const [noMint] = PDA.noMint(conditionPda, this.programIds);
|
|
562
571
|
const [mintAuthority] = PDA.mintAuthority(conditionPda, this.programIds);
|
|
563
572
|
const [collateralVault] = PDA.collateralVault(params.collateralMint, this.programIds);
|
|
573
|
+
if (!this.programIds.feeManagement) throw new Error("feeManagement program ID not configured");
|
|
574
|
+
const [questionFeePda] = PDA.questionFee(conditionPda, this.programIds);
|
|
564
575
|
const tx = await this.program.methods.createQuestionAdmin({
|
|
565
576
|
questionId: Array.from(questionId),
|
|
566
577
|
contentHash: Array.from(contentHash),
|
|
@@ -580,6 +591,8 @@ var MarketClient = class {
|
|
|
580
591
|
mintAuthority,
|
|
581
592
|
collateralVault,
|
|
582
593
|
conditionalTokensProgram: this.programIds.conditionalTokens,
|
|
594
|
+
questionFee: questionFeePda,
|
|
595
|
+
feeManagementProgram: this.programIds.feeManagement,
|
|
583
596
|
tokenProgram: TOKEN_2022_PROGRAM_ID,
|
|
584
597
|
systemProgram: SystemProgram.programId,
|
|
585
598
|
rent: SYSVAR_RENT_PUBKEY
|
|
@@ -778,9 +791,25 @@ var MarketClient = class {
|
|
|
778
791
|
* @param creator presale creator pubkey (stored in question)
|
|
779
792
|
* @param currencyMint collateral mint
|
|
780
793
|
*/
|
|
781
|
-
async approvePresale(
|
|
794
|
+
async approvePresale(params) {
|
|
795
|
+
const {
|
|
796
|
+
presalePda,
|
|
797
|
+
contentHash,
|
|
798
|
+
hookProgram,
|
|
799
|
+
authorizedClob,
|
|
800
|
+
expirationTime,
|
|
801
|
+
creator,
|
|
802
|
+
currencyMint,
|
|
803
|
+
referralAddress,
|
|
804
|
+
companyAddress,
|
|
805
|
+
adminOwner
|
|
806
|
+
} = params;
|
|
807
|
+
const caller = params.caller ?? this.walletPubkey;
|
|
808
|
+
const payer = params.payer ?? caller;
|
|
782
809
|
if (!this.programIds.presale) throw new Error("presale program ID not configured");
|
|
783
810
|
if (!this.programIds.marketOracle) throw new Error("marketOracle program ID not configured");
|
|
811
|
+
if (!this.programIds.feeManagement) throw new Error("feeManagement program ID not configured");
|
|
812
|
+
if (!this.programIds.adminContract) throw new Error("adminContract program ID not configured");
|
|
784
813
|
const questionId = presalePda.toBytes();
|
|
785
814
|
const [questionPda] = PDA.question(this.configPda, questionId, this.programIds);
|
|
786
815
|
const marketConfig = await this.fetchConfig();
|
|
@@ -793,7 +822,14 @@ var MarketClient = class {
|
|
|
793
822
|
const [collateralVault] = PDA.collateralVault(currencyMint, this.programIds);
|
|
794
823
|
const [marketOraclePda] = PDA.marketOraclePda(questionPda, this.programIds);
|
|
795
824
|
const marketOracleVault = getAssociatedTokenAddressSync(currencyMint, marketOraclePda, true);
|
|
796
|
-
const
|
|
825
|
+
const [questionFeePda] = PDA.questionFee(conditionPda, this.programIds);
|
|
826
|
+
const presaleVault = getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
827
|
+
const referralTokenAccount = getAssociatedTokenAddressSync(currencyMint, referralAddress);
|
|
828
|
+
const companyTokenAccount = getAssociatedTokenAddressSync(currencyMint, companyAddress);
|
|
829
|
+
const [adminConfig] = PDA.adminConfig(adminOwner, this.programIds);
|
|
830
|
+
const adminVault = getAssociatedTokenAddressSync(currencyMint, adminConfig, true);
|
|
831
|
+
const [claimRecord] = PDA.claimRecord(conditionPda.toBytes(), this.programIds);
|
|
832
|
+
const builder = this.program.methods.approvePresale({
|
|
797
833
|
contentHash: Array.from(contentHash),
|
|
798
834
|
hookProgram,
|
|
799
835
|
authorizedClob,
|
|
@@ -814,15 +850,38 @@ var MarketClient = class {
|
|
|
814
850
|
collateralVault,
|
|
815
851
|
marketOracle: marketOraclePda,
|
|
816
852
|
marketOracleVault,
|
|
853
|
+
presaleVault,
|
|
854
|
+
referralTokenAccount,
|
|
855
|
+
companyTokenAccount,
|
|
856
|
+
adminVault,
|
|
857
|
+
adminConfig,
|
|
858
|
+
claimRecord,
|
|
859
|
+
questionFee: questionFeePda,
|
|
860
|
+
feeManagementProgram: this.programIds.feeManagement,
|
|
817
861
|
conditionalTokensProgram: this.programIds.conditionalTokens,
|
|
818
862
|
presaleProgram: this.programIds.presale,
|
|
819
863
|
marketOracleProgram: this.programIds.marketOracle,
|
|
864
|
+
adminProgram: this.programIds.adminContract,
|
|
820
865
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
821
866
|
token2022Program: TOKEN_2022_PROGRAM_ID,
|
|
822
867
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
823
868
|
systemProgram: SystemProgram.programId,
|
|
824
869
|
rent: SYSVAR_RENT_PUBKEY
|
|
825
|
-
})
|
|
870
|
+
});
|
|
871
|
+
let tx;
|
|
872
|
+
if (params.lookupTable) {
|
|
873
|
+
const ix = await builder.instruction();
|
|
874
|
+
const cu = ComputeBudgetProgram.setComputeUnitLimit({ units: 14e5 });
|
|
875
|
+
const { blockhash } = await this.provider.connection.getLatestBlockhash();
|
|
876
|
+
const msg = new TransactionMessage({
|
|
877
|
+
payerKey: payer,
|
|
878
|
+
recentBlockhash: blockhash,
|
|
879
|
+
instructions: [cu, ix]
|
|
880
|
+
}).compileToV0Message([params.lookupTable]);
|
|
881
|
+
tx = new VersionedTransaction(msg);
|
|
882
|
+
} else {
|
|
883
|
+
tx = await builder.transaction();
|
|
884
|
+
}
|
|
826
885
|
return { tx, questionPda, conditionPda, marketOraclePda, marketOracleVault };
|
|
827
886
|
}
|
|
828
887
|
/**
|
|
@@ -1312,6 +1371,49 @@ function buildBatchedEd25519Instruction(orders) {
|
|
|
1312
1371
|
});
|
|
1313
1372
|
}
|
|
1314
1373
|
var IX_SYSVAR = SYSVAR_INSTRUCTIONS_PUBKEY;
|
|
1374
|
+
function serializeCollectFeeOrderToBytes(order) {
|
|
1375
|
+
const buf = new Uint8Array(120);
|
|
1376
|
+
buf.set(order.user.toBytes(), 0);
|
|
1377
|
+
buf.set(order.condition.toBytes(), 32);
|
|
1378
|
+
buf.set(order.tokenMint.toBytes(), 64);
|
|
1379
|
+
buf.set(order.amount.toArrayLike(Buffer, "le", 8), 96);
|
|
1380
|
+
buf.set(order.nonce.toArrayLike(Buffer, "le", 8), 104);
|
|
1381
|
+
buf.set(order.expiry.toArrayLike(Buffer, "le", 8), 112);
|
|
1382
|
+
return buf;
|
|
1383
|
+
}
|
|
1384
|
+
function buildBatchedCollectFeeEd25519Instruction(orders) {
|
|
1385
|
+
const N = orders.length;
|
|
1386
|
+
if (N === 0) throw new Error("At least 1 order required");
|
|
1387
|
+
const MSG_SIZE = 120;
|
|
1388
|
+
const SIG_SIZE = 64;
|
|
1389
|
+
const PK_SIZE = 32;
|
|
1390
|
+
const HEADER = 2 + N * 14;
|
|
1391
|
+
const sigBase = HEADER;
|
|
1392
|
+
const pkBase = sigBase + N * SIG_SIZE;
|
|
1393
|
+
const msgBase = pkBase + N * PK_SIZE;
|
|
1394
|
+
const totalSize = msgBase + N * MSG_SIZE;
|
|
1395
|
+
const data = Buffer.alloc(totalSize);
|
|
1396
|
+
data[0] = N;
|
|
1397
|
+
data[1] = 0;
|
|
1398
|
+
for (let i = 0; i < N; i++) {
|
|
1399
|
+
const e = 2 + i * 14;
|
|
1400
|
+
data.writeUInt16LE(sigBase + i * SIG_SIZE, e);
|
|
1401
|
+
data.writeUInt16LE(65535, e + 2);
|
|
1402
|
+
data.writeUInt16LE(pkBase + i * PK_SIZE, e + 4);
|
|
1403
|
+
data.writeUInt16LE(65535, e + 6);
|
|
1404
|
+
data.writeUInt16LE(msgBase + i * MSG_SIZE, e + 8);
|
|
1405
|
+
data.writeUInt16LE(MSG_SIZE, e + 10);
|
|
1406
|
+
data.writeUInt16LE(65535, e + 12);
|
|
1407
|
+
data.set(orders[i].signature, sigBase + i * SIG_SIZE);
|
|
1408
|
+
data.set(orders[i].order.user.toBytes(), pkBase + i * PK_SIZE);
|
|
1409
|
+
data.set(serializeCollectFeeOrderToBytes(orders[i].order), msgBase + i * MSG_SIZE);
|
|
1410
|
+
}
|
|
1411
|
+
return new TransactionInstruction({
|
|
1412
|
+
keys: [],
|
|
1413
|
+
programId: Ed25519Program.programId,
|
|
1414
|
+
data
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1315
1417
|
function buildOrder(params) {
|
|
1316
1418
|
return {
|
|
1317
1419
|
maker: params.maker,
|
|
@@ -1429,10 +1531,17 @@ var ClobClient = class {
|
|
|
1429
1531
|
if (!this.feeClient || !this.feeConfigOwner) return void 0;
|
|
1430
1532
|
if (!this._companyAddress) {
|
|
1431
1533
|
const cfg = await this.feeClient.fetchFeeConfig(this.feeConfigOwner);
|
|
1432
|
-
if (cfg)
|
|
1534
|
+
if (cfg) {
|
|
1535
|
+
this._companyAddress = cfg.companyAddress;
|
|
1536
|
+
this._referralVault = cfg.referralVault;
|
|
1537
|
+
}
|
|
1433
1538
|
}
|
|
1434
1539
|
return this._companyAddress;
|
|
1435
1540
|
}
|
|
1541
|
+
async referralVault() {
|
|
1542
|
+
await this.companyAddress();
|
|
1543
|
+
return this._referralVault;
|
|
1544
|
+
}
|
|
1436
1545
|
get walletPubkey() {
|
|
1437
1546
|
return this.provider.wallet.publicKey;
|
|
1438
1547
|
}
|
|
@@ -1523,6 +1632,7 @@ var ClobClient = class {
|
|
|
1523
1632
|
}
|
|
1524
1633
|
if (this.programIds.feeManagement && this.feeConfigOwner) {
|
|
1525
1634
|
const companyAddr = await this.companyAddress();
|
|
1635
|
+
const refVault = await this.referralVault();
|
|
1526
1636
|
addresses.push(
|
|
1527
1637
|
this.programIds.feeManagement,
|
|
1528
1638
|
PDA.feeConfig(this.feeConfigOwner, this.programIds)[0],
|
|
@@ -1532,6 +1642,10 @@ var ClobClient = class {
|
|
|
1532
1642
|
addresses.push(getAssociatedTokenAddressSync(collateralMint, companyAddr));
|
|
1533
1643
|
}
|
|
1534
1644
|
addresses.push(payer);
|
|
1645
|
+
if (refVault) {
|
|
1646
|
+
addresses.push(refVault);
|
|
1647
|
+
}
|
|
1648
|
+
addresses.push(TOKEN_PROGRAM_ID);
|
|
1535
1649
|
}
|
|
1536
1650
|
const slot = await connection.getSlot("finalized");
|
|
1537
1651
|
const [createIx, altAddress] = AddressLookupTableProgram.createLookupTable({
|
|
@@ -1566,8 +1680,8 @@ var ClobClient = class {
|
|
|
1566
1680
|
async _sendLegacyTxSig(instructions) {
|
|
1567
1681
|
const { connection } = this.provider;
|
|
1568
1682
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1569
|
-
const { Transaction:
|
|
1570
|
-
const tx = new
|
|
1683
|
+
const { Transaction: Transaction10 } = await import('@solana/web3.js');
|
|
1684
|
+
const tx = new Transaction10();
|
|
1571
1685
|
tx.recentBlockhash = blockhash;
|
|
1572
1686
|
tx.feePayer = this.walletPubkey;
|
|
1573
1687
|
tx.add(...instructions);
|
|
@@ -1593,10 +1707,10 @@ ${logs.join("\n")}`);
|
|
|
1593
1707
|
connection.getAccountInfo(clobYesAta),
|
|
1594
1708
|
connection.getAccountInfo(clobNoAta)
|
|
1595
1709
|
]);
|
|
1596
|
-
const { createAssociatedTokenAccountIdempotentInstruction:
|
|
1710
|
+
const { createAssociatedTokenAccountIdempotentInstruction: createAssociatedTokenAccountIdempotentInstruction4 } = await import('@solana/spl-token');
|
|
1597
1711
|
const ixs = [];
|
|
1598
1712
|
if (!yesInfo) {
|
|
1599
|
-
ixs.push(
|
|
1713
|
+
ixs.push(createAssociatedTokenAccountIdempotentInstruction4(
|
|
1600
1714
|
this.walletPubkey,
|
|
1601
1715
|
clobYesAta,
|
|
1602
1716
|
clobConfig,
|
|
@@ -1605,7 +1719,7 @@ ${logs.join("\n")}`);
|
|
|
1605
1719
|
));
|
|
1606
1720
|
}
|
|
1607
1721
|
if (!noInfo) {
|
|
1608
|
-
ixs.push(
|
|
1722
|
+
ixs.push(createAssociatedTokenAccountIdempotentInstruction4(
|
|
1609
1723
|
this.walletPubkey,
|
|
1610
1724
|
clobNoAta,
|
|
1611
1725
|
clobConfig,
|
|
@@ -1789,7 +1903,8 @@ ${logs.join("\n")}`);
|
|
|
1789
1903
|
let feeAccounts = [];
|
|
1790
1904
|
if (takerSigned.order.fee.gtn(0) && this.programIds.feeManagement && this.feeConfigOwner) {
|
|
1791
1905
|
const companyAddr = await this.companyAddress();
|
|
1792
|
-
|
|
1906
|
+
const refVault = await this.referralVault();
|
|
1907
|
+
if (companyAddr && refVault) {
|
|
1793
1908
|
const feeOverridePda = PDA.marketFeeOverride(condition, this.programIds)[0];
|
|
1794
1909
|
const feeOverrideExists = await this.provider.connection.getAccountInfo(feeOverridePda);
|
|
1795
1910
|
if (feeOverrideExists) {
|
|
@@ -1799,7 +1914,8 @@ ${logs.join("\n")}`);
|
|
|
1799
1914
|
{ pubkey: PDA.feeConfig(this.feeConfigOwner, this.programIds)[0], isSigner: false, isWritable: false },
|
|
1800
1915
|
{ pubkey: feeOverridePda, isSigner: false, isWritable: false },
|
|
1801
1916
|
{ pubkey: getAssociatedTokenAddressSync(collateralMint, companyAddr), isSigner: false, isWritable: true },
|
|
1802
|
-
{ pubkey: oracleVault, isSigner: false, isWritable: true }
|
|
1917
|
+
{ pubkey: oracleVault, isSigner: false, isWritable: true },
|
|
1918
|
+
{ pubkey: refVault, isSigner: false, isWritable: true }
|
|
1803
1919
|
];
|
|
1804
1920
|
}
|
|
1805
1921
|
}
|
|
@@ -2043,7 +2159,8 @@ ${logs.join("\n")}`);
|
|
|
2043
2159
|
);
|
|
2044
2160
|
if (yesSigned.order.fee.gtn(0) && this.programIds.feeManagement && this.feeConfigOwner) {
|
|
2045
2161
|
const companyAddr = await this.companyAddress();
|
|
2046
|
-
|
|
2162
|
+
const refVault = await this.referralVault();
|
|
2163
|
+
if (companyAddr && refVault) {
|
|
2047
2164
|
const feeOverridePda = PDA.marketFeeOverride(condition, this.programIds)[0];
|
|
2048
2165
|
const feeOverrideExists = await this.provider.connection.getAccountInfo(feeOverridePda);
|
|
2049
2166
|
if (feeOverrideExists) {
|
|
@@ -2053,7 +2170,9 @@ ${logs.join("\n")}`);
|
|
|
2053
2170
|
{ pubkey: PDA.feeConfig(this.feeConfigOwner, this.programIds)[0], isSigner: false, isWritable: false },
|
|
2054
2171
|
{ pubkey: feeOverridePda, isSigner: false, isWritable: false },
|
|
2055
2172
|
{ pubkey: getAssociatedTokenAddressSync(collateralMint, companyAddr), isSigner: false, isWritable: true },
|
|
2056
|
-
{ pubkey: oracleVault, isSigner: false, isWritable: true }
|
|
2173
|
+
{ pubkey: oracleVault, isSigner: false, isWritable: true },
|
|
2174
|
+
{ pubkey: refVault, isSigner: false, isWritable: true },
|
|
2175
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
2057
2176
|
);
|
|
2058
2177
|
}
|
|
2059
2178
|
}
|
|
@@ -2324,6 +2443,103 @@ ${logs.join("\n")}`);
|
|
|
2324
2443
|
}
|
|
2325
2444
|
return this._buildUnsignedVtx(ixs, alt, payer);
|
|
2326
2445
|
}
|
|
2446
|
+
// ─── batchCollectRedeemEarly ─────────────────────────────────────────────────
|
|
2447
|
+
/**
|
|
2448
|
+
* Build VersionedTransaction for batchCollectRedeemEarly.
|
|
2449
|
+
*
|
|
2450
|
+
* Flow: Ed25519 ix (user sigs) + batchCollectRedeemEarly ix.
|
|
2451
|
+
* Each SignedCollectFeeOrder authorizes CLOB to collect `amount` winning tokens
|
|
2452
|
+
* from that user, redeem via CTF, then distribute as fees.
|
|
2453
|
+
*
|
|
2454
|
+
* @param signedOrders - Array of { order, signature } from winning users
|
|
2455
|
+
* @param condition - Market condition PDA
|
|
2456
|
+
* @param outcomeIndex - 0 = NO wins, 1 = YES wins
|
|
2457
|
+
* @param operator - Whitelisted operator pubkey (must sign)
|
|
2458
|
+
* @param payer - Fee payer pubkey (must sign)
|
|
2459
|
+
* @param opts.marketOracleVault - MarketOracle vault for fee distribution
|
|
2460
|
+
*/
|
|
2461
|
+
async buildBatchCollectRedeemEarlyTx(signedOrders, condition, outcomeIndex, operator, payer, opts) {
|
|
2462
|
+
if (signedOrders.length === 0) throw new InvalidParamError("At least 1 order required");
|
|
2463
|
+
const collateralMint = this.networkConfig.defaultCollateral.mint;
|
|
2464
|
+
const cfg = await this.fetchConfig();
|
|
2465
|
+
if (!cfg) throw new InvalidParamError("CLOB config not found on-chain");
|
|
2466
|
+
const clobConfig = this.configPda();
|
|
2467
|
+
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
2468
|
+
const [noMint] = PDA.noMint(condition, this.programIds);
|
|
2469
|
+
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
2470
|
+
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
2471
|
+
const clobYesAta = getAssociatedTokenAddressSync(yesMint, clobConfig, true, TOKEN_2022_PROGRAM_ID);
|
|
2472
|
+
const clobNoAta = getAssociatedTokenAddressSync(noMint, clobConfig, true, TOKEN_2022_PROGRAM_ID);
|
|
2473
|
+
const outcomeMint = outcomeIndex === 1 ? yesMint : noMint;
|
|
2474
|
+
const [extraAccountMeta] = PDA.extraAccountMetaList(outcomeMint, this.programIds);
|
|
2475
|
+
const [hookConfig] = PDA.hookConfig(this.programIds);
|
|
2476
|
+
const [clobYesPosition] = PDA.position(condition, 1, clobConfig, this.programIds);
|
|
2477
|
+
const [clobNoPosition] = PDA.position(condition, 0, clobConfig, this.programIds);
|
|
2478
|
+
const userAccounts = [];
|
|
2479
|
+
for (const { order } of signedOrders) {
|
|
2480
|
+
const userTokenAta = getAssociatedTokenAddressSync(outcomeMint, order.user, false, TOKEN_2022_PROGRAM_ID);
|
|
2481
|
+
const [userPosition] = PDA.position(condition, outcomeIndex, order.user, this.programIds);
|
|
2482
|
+
userAccounts.push(
|
|
2483
|
+
{ pubkey: order.user, isSigner: false, isWritable: false },
|
|
2484
|
+
{ pubkey: userTokenAta, isSigner: false, isWritable: true },
|
|
2485
|
+
{ pubkey: userPosition, isSigner: false, isWritable: true }
|
|
2486
|
+
);
|
|
2487
|
+
}
|
|
2488
|
+
const hookAccounts = [
|
|
2489
|
+
{ pubkey: extraAccountMeta, isSigner: false, isWritable: false },
|
|
2490
|
+
{ pubkey: hookConfig, isSigner: false, isWritable: false },
|
|
2491
|
+
{ pubkey: this.programIds.hook, isSigner: false, isWritable: false }
|
|
2492
|
+
];
|
|
2493
|
+
let feeAccounts = [];
|
|
2494
|
+
if (this.programIds.feeManagement && this.feeConfigOwner) {
|
|
2495
|
+
const companyAddr = await this.companyAddress();
|
|
2496
|
+
const refVault = await this.referralVault();
|
|
2497
|
+
if (companyAddr && refVault) {
|
|
2498
|
+
const feeOverridePda = PDA.marketFeeOverride(condition, this.programIds)[0];
|
|
2499
|
+
const feeOverrideExists = await this.provider.connection.getAccountInfo(feeOverridePda);
|
|
2500
|
+
if (feeOverrideExists) {
|
|
2501
|
+
const oracleVault = opts?.marketOracleVault ?? payer;
|
|
2502
|
+
feeAccounts = [
|
|
2503
|
+
{ pubkey: this.programIds.feeManagement, isSigner: false, isWritable: false },
|
|
2504
|
+
{ pubkey: PDA.feeConfig(this.feeConfigOwner, this.programIds)[0], isSigner: false, isWritable: false },
|
|
2505
|
+
{ pubkey: feeOverridePda, isSigner: false, isWritable: false },
|
|
2506
|
+
{ pubkey: getAssociatedTokenAddressSync(collateralMint, companyAddr), isSigner: false, isWritable: true },
|
|
2507
|
+
{ pubkey: oracleVault, isSigner: false, isWritable: true },
|
|
2508
|
+
{ pubkey: refVault, isSigner: false, isWritable: true }
|
|
2509
|
+
];
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
|
|
2514
|
+
const ed25519Ix = buildBatchedCollectFeeEd25519Instruction(signedOrders);
|
|
2515
|
+
const collectIx = await this.program.methods.batchCollectRedeemEarly(
|
|
2516
|
+
2,
|
|
2517
|
+
// ix_index: Ed25519 ix is ix[2] (cuLimit=0, heapFrame=1, ed25519=2)
|
|
2518
|
+
signedOrders.length,
|
|
2519
|
+
outcomeIndex
|
|
2520
|
+
).accounts({
|
|
2521
|
+
operator,
|
|
2522
|
+
payer,
|
|
2523
|
+
clobConfig,
|
|
2524
|
+
condition,
|
|
2525
|
+
collateralVault,
|
|
2526
|
+
vaultTokenAccount,
|
|
2527
|
+
feeRecipient: cfg.feeRecipient,
|
|
2528
|
+
yesMint,
|
|
2529
|
+
noMint,
|
|
2530
|
+
clobYesAta,
|
|
2531
|
+
clobNoAta,
|
|
2532
|
+
clobYesPosition,
|
|
2533
|
+
clobNoPosition,
|
|
2534
|
+
ixSysvar: IX_SYSVAR,
|
|
2535
|
+
conditionalTokensProgram: this.programIds.conditionalTokens,
|
|
2536
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
2537
|
+
token2022Program: TOKEN_2022_PROGRAM_ID,
|
|
2538
|
+
systemProgram: SystemProgram.programId
|
|
2539
|
+
}).remainingAccounts([...userAccounts, ...hookAccounts, ...feeAccounts]).instruction();
|
|
2540
|
+
const cachedAlt = this._altCache.get(condition.toBase58());
|
|
2541
|
+
return this._buildUnsignedVtx([ed25519Ix, collectIx], cachedAlt, payer);
|
|
2542
|
+
}
|
|
2327
2543
|
// ─── Queries ─────────────────────────────────────────────────────────────────
|
|
2328
2544
|
async fetchConfig() {
|
|
2329
2545
|
try {
|
|
@@ -2372,20 +2588,22 @@ var FeeManagementClient = class {
|
|
|
2372
2588
|
this.provider = provider;
|
|
2373
2589
|
this.programIds = programIds;
|
|
2374
2590
|
}
|
|
2375
|
-
async initFeeConfig(
|
|
2376
|
-
const [feeConfigPda] = PDA.feeConfig(authority, this.programIds);
|
|
2591
|
+
async initFeeConfig(params) {
|
|
2592
|
+
const [feeConfigPda] = PDA.feeConfig(params.authority, this.programIds);
|
|
2377
2593
|
const sig = await this.program.methods.initialize({
|
|
2378
|
-
admin,
|
|
2379
|
-
companyAddress,
|
|
2380
|
-
referralAddress,
|
|
2381
|
-
presaleRevenueAddress,
|
|
2382
|
-
investorsMarketRev,
|
|
2383
|
-
companyMarketRev,
|
|
2384
|
-
agentsPresaleRev,
|
|
2385
|
-
companyPresaleRev
|
|
2594
|
+
admin: params.admin,
|
|
2595
|
+
companyAddress: params.companyAddress,
|
|
2596
|
+
referralAddress: params.referralAddress,
|
|
2597
|
+
presaleRevenueAddress: params.presaleRevenueAddress,
|
|
2598
|
+
investorsMarketRev: params.investorsMarketRev,
|
|
2599
|
+
companyMarketRev: params.companyMarketRev,
|
|
2600
|
+
agentsPresaleRev: params.agentsPresaleRev,
|
|
2601
|
+
companyPresaleRev: params.companyPresaleRev,
|
|
2602
|
+
referralMarketRev: params.referralMarketRev,
|
|
2603
|
+
referralVault: params.referralVault
|
|
2386
2604
|
}).accounts({
|
|
2387
|
-
authority,
|
|
2388
|
-
payer,
|
|
2605
|
+
authority: params.authority,
|
|
2606
|
+
payer: params.payer,
|
|
2389
2607
|
feeConfig: feeConfigPda,
|
|
2390
2608
|
systemProgram: SystemProgram.programId
|
|
2391
2609
|
}).signers([]).rpc();
|
|
@@ -2400,9 +2618,14 @@ var FeeManagementClient = class {
|
|
|
2400
2618
|
}
|
|
2401
2619
|
}
|
|
2402
2620
|
/**
|
|
2403
|
-
* Fetch per-
|
|
2404
|
-
* Returns null if
|
|
2621
|
+
* Fetch per-market fees for a condition.
|
|
2622
|
+
* Returns null if fees have not been initialized yet.
|
|
2623
|
+
* Fees are set automatically via CPI when create_question_admin / approve_presale runs.
|
|
2624
|
+
* Defaults: swapFee=200 (2%), redeemFee=0, mergeFee=2000 (20%), out of FEE_DENOMINATOR=10_000.
|
|
2405
2625
|
*/
|
|
2626
|
+
async getMarketFee(conditionPda) {
|
|
2627
|
+
return this.fetchQuestionFee(conditionPda);
|
|
2628
|
+
}
|
|
2406
2629
|
async fetchQuestionFee(conditionPda) {
|
|
2407
2630
|
try {
|
|
2408
2631
|
const [pda] = PDA.questionFee(conditionPda, this.programIds);
|
|
@@ -2419,28 +2642,30 @@ var FeeManagementClient = class {
|
|
|
2419
2642
|
}
|
|
2420
2643
|
}
|
|
2421
2644
|
/**
|
|
2422
|
-
* Set per-question fees for a condition.
|
|
2645
|
+
* Set per-question fees for a condition (whitelist-only edit after market creation).
|
|
2423
2646
|
* @param conditionPda - condition PDA from the question
|
|
2424
|
-
* @param mergeFee - fee out of FEE_DENOMINATOR (
|
|
2647
|
+
* @param mergeFee - fee out of FEE_DENOMINATOR (10_000), e.g. 2_000 = 20%
|
|
2425
2648
|
* @param redeemFee - fee out of FEE_DENOMINATOR
|
|
2426
|
-
* @param swapFee - trading fee out of FEE_DENOMINATOR
|
|
2649
|
+
* @param swapFee - trading fee out of FEE_DENOMINATOR, e.g. 200 = 2%
|
|
2427
2650
|
* @param feeConfigOwner - pubkey that owns the fee_config PDA (usually market deployer)
|
|
2428
2651
|
* @param authority - signer authorized in fee_config whitelist / admin / owner
|
|
2429
2652
|
* @param payer - rent + tx fee payer
|
|
2430
2653
|
*/
|
|
2431
|
-
async updateFeeConfig(
|
|
2432
|
-
const [feeConfigPda] = PDA.feeConfig(authority, this.programIds);
|
|
2654
|
+
async updateFeeConfig(params) {
|
|
2655
|
+
const [feeConfigPda] = PDA.feeConfig(params.authority, this.programIds);
|
|
2433
2656
|
const sig = await this.program.methods.updateConfig({
|
|
2434
|
-
companyAddress,
|
|
2435
|
-
referralAddress,
|
|
2436
|
-
presaleRevenueAddress,
|
|
2437
|
-
investorsMarketRev,
|
|
2438
|
-
companyMarketRev,
|
|
2439
|
-
agentsPresaleRev,
|
|
2440
|
-
companyPresaleRev
|
|
2657
|
+
companyAddress: params.companyAddress,
|
|
2658
|
+
referralAddress: params.referralAddress,
|
|
2659
|
+
presaleRevenueAddress: params.presaleRevenueAddress,
|
|
2660
|
+
investorsMarketRev: params.investorsMarketRev,
|
|
2661
|
+
companyMarketRev: params.companyMarketRev,
|
|
2662
|
+
agentsPresaleRev: params.agentsPresaleRev,
|
|
2663
|
+
companyPresaleRev: params.companyPresaleRev,
|
|
2664
|
+
referralMarketRev: params.referralMarketRev,
|
|
2665
|
+
referralVault: params.referralVault
|
|
2441
2666
|
}).accounts({
|
|
2442
|
-
authority,
|
|
2443
|
-
payer,
|
|
2667
|
+
authority: params.authority,
|
|
2668
|
+
payer: params.payer,
|
|
2444
2669
|
feeConfig: feeConfigPda
|
|
2445
2670
|
}).signers([]).rpc();
|
|
2446
2671
|
return { signature: sig };
|
|
@@ -2457,33 +2682,33 @@ var FeeManagementClient = class {
|
|
|
2457
2682
|
}).signers([]).rpc();
|
|
2458
2683
|
return { signature: sig };
|
|
2459
2684
|
}
|
|
2460
|
-
|
|
2685
|
+
/**
|
|
2686
|
+
* Build editMarketFee transaction (whitelist-only).
|
|
2687
|
+
* @param conditionPda - condition PDA (market identifier)
|
|
2688
|
+
* @param mergeFee - out of FEE_DENOMINATOR (10_000), e.g. 2_000 = 20%
|
|
2689
|
+
* @param redeemFee - out of FEE_DENOMINATOR
|
|
2690
|
+
* @param swapFee - trading fee out of FEE_DENOMINATOR, e.g. 200 = 2%
|
|
2691
|
+
* @param feeConfigOwner - owner of fee_config PDA
|
|
2692
|
+
* @param authority - whitelisted signer (signs tx externally)
|
|
2693
|
+
* @param payer - fee payer (can differ from authority)
|
|
2694
|
+
*/
|
|
2695
|
+
async buildEditMarketFeeTx(conditionPda, mergeFee, redeemFee, swapFee, feeConfigOwner, authority, payer = authority) {
|
|
2461
2696
|
const [feeConfigPda] = PDA.feeConfig(feeConfigOwner, this.programIds);
|
|
2462
|
-
const [
|
|
2463
|
-
return this.program.methods.
|
|
2464
|
-
|
|
2465
|
-
|
|
2697
|
+
const [questionFeePda] = PDA.questionFee(conditionPda, this.programIds);
|
|
2698
|
+
return this.program.methods.setQuestionFee(
|
|
2699
|
+
Array.from(conditionPda.toBytes()),
|
|
2700
|
+
mergeFee,
|
|
2701
|
+
redeemFee,
|
|
2702
|
+
swapFee
|
|
2703
|
+
).accounts({
|
|
2466
2704
|
authority,
|
|
2467
|
-
|
|
2468
|
-
companyAta,
|
|
2469
|
-
marketOracleVault,
|
|
2470
|
-
tokenProgram: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")
|
|
2471
|
-
}).instruction();
|
|
2472
|
-
}
|
|
2473
|
-
async distributeFee(conditionPda, amount, feeConfigOwner, sourceAta, companyAta, marketOracleVault, authority) {
|
|
2474
|
-
const [feeConfigPda] = PDA.feeConfig(feeConfigOwner, this.programIds);
|
|
2475
|
-
const [marketFeeOverridePda] = PDA.marketFeeOverride(conditionPda, this.programIds);
|
|
2476
|
-
const sig = await this.program.methods.distributeFee(conditionPda, amount).accounts({
|
|
2705
|
+
payer,
|
|
2477
2706
|
feeConfig: feeConfigPda,
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
companyAta,
|
|
2482
|
-
marketOracleVault,
|
|
2483
|
-
tokenProgram: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")
|
|
2484
|
-
}).signers([]).rpc();
|
|
2485
|
-
return { signature: sig };
|
|
2707
|
+
questionFee: questionFeePda,
|
|
2708
|
+
systemProgram: SystemProgram.programId
|
|
2709
|
+
}).transaction();
|
|
2486
2710
|
}
|
|
2711
|
+
/** @deprecated use buildEditMarketFeeTx */
|
|
2487
2712
|
async setQuestionFee(conditionPda, mergeFee, redeemFee, swapFee, feeConfigOwner, authority, payer) {
|
|
2488
2713
|
const [feeConfigPda] = PDA.feeConfig(feeConfigOwner, this.programIds);
|
|
2489
2714
|
const [questionFeePda] = PDA.questionFee(conditionPda, this.programIds);
|
|
@@ -2841,6 +3066,98 @@ var AdminClient = class {
|
|
|
2841
3066
|
}).transaction();
|
|
2842
3067
|
}
|
|
2843
3068
|
};
|
|
3069
|
+
var ReferralClient = class {
|
|
3070
|
+
constructor(program, provider, programIds) {
|
|
3071
|
+
this.program = program;
|
|
3072
|
+
this.provider = provider;
|
|
3073
|
+
this.programIds = programIds;
|
|
3074
|
+
}
|
|
3075
|
+
get walletPubkey() {
|
|
3076
|
+
return this.provider.wallet.publicKey;
|
|
3077
|
+
}
|
|
3078
|
+
referralVault(owner, collateralMint) {
|
|
3079
|
+
const [configPda] = PDA.referralConfig(owner, this.programIds);
|
|
3080
|
+
return getAssociatedTokenAddressSync(collateralMint, configPda, true);
|
|
3081
|
+
}
|
|
3082
|
+
async fetchConfig(owner) {
|
|
3083
|
+
try {
|
|
3084
|
+
const [pda] = PDA.referralConfig(owner, this.programIds);
|
|
3085
|
+
const acc = await this.program.account.referralConfig.fetch(pda);
|
|
3086
|
+
return {
|
|
3087
|
+
owner: acc.owner,
|
|
3088
|
+
collateralMint: acc.collateralMint,
|
|
3089
|
+
whitelist: acc.whitelist.slice(0, acc.whitelistLen),
|
|
3090
|
+
bump: acc.bump
|
|
3091
|
+
};
|
|
3092
|
+
} catch {
|
|
3093
|
+
return null;
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
/**
|
|
3097
|
+
* Build initialize tx — creates referral config PDA.
|
|
3098
|
+
* Also prepends an ATA creation instruction for the referral vault (idempotent).
|
|
3099
|
+
* Build-tx pattern.
|
|
3100
|
+
*/
|
|
3101
|
+
async buildInitializeTx(collateralMint, owner = this.walletPubkey, payer = owner) {
|
|
3102
|
+
if (!this.programIds.referral) throw new Error("referral program ID not configured");
|
|
3103
|
+
const [configPda] = PDA.referralConfig(owner, this.programIds);
|
|
3104
|
+
const vaultAta = getAssociatedTokenAddressSync(collateralMint, configPda, true);
|
|
3105
|
+
const createVaultIx = createAssociatedTokenAccountIdempotentInstruction(
|
|
3106
|
+
payer,
|
|
3107
|
+
vaultAta,
|
|
3108
|
+
configPda,
|
|
3109
|
+
collateralMint
|
|
3110
|
+
);
|
|
3111
|
+
const initTx = await this.program.methods.initialize().accounts({
|
|
3112
|
+
owner,
|
|
3113
|
+
payer,
|
|
3114
|
+
config: configPda,
|
|
3115
|
+
collateralMint,
|
|
3116
|
+
systemProgram: SystemProgram.programId
|
|
3117
|
+
}).transaction();
|
|
3118
|
+
const tx = new Transaction().add(createVaultIx, ...initTx.instructions);
|
|
3119
|
+
return { tx, configPda, vaultAta };
|
|
3120
|
+
}
|
|
3121
|
+
/** Build add-to-whitelist tx. Build-tx pattern. */
|
|
3122
|
+
async buildAddToWhitelistTx(address, owner = this.walletPubkey, payer = owner) {
|
|
3123
|
+
if (!this.programIds.referral) throw new Error("referral program ID not configured");
|
|
3124
|
+
const [configPda] = PDA.referralConfig(owner, this.programIds);
|
|
3125
|
+
return this.program.methods.addToWhitelist(address).accounts({ owner, payer, config: configPda }).transaction();
|
|
3126
|
+
}
|
|
3127
|
+
/** Build remove-from-whitelist tx. Build-tx pattern. */
|
|
3128
|
+
async buildRemoveFromWhitelistTx(address, owner = this.walletPubkey, payer = owner) {
|
|
3129
|
+
if (!this.programIds.referral) throw new Error("referral program ID not configured");
|
|
3130
|
+
const [configPda] = PDA.referralConfig(owner, this.programIds);
|
|
3131
|
+
return this.program.methods.removeFromWhitelist(address).accounts({ owner, payer, config: configPda }).transaction();
|
|
3132
|
+
}
|
|
3133
|
+
/**
|
|
3134
|
+
* Build batchSendUsds tx. Build-tx pattern.
|
|
3135
|
+
* @param recipients - wallet addresses to send to
|
|
3136
|
+
* @param amounts - corresponding amounts in token smallest units
|
|
3137
|
+
* @param configOwner - owner of referral config (used to derive config + vault)
|
|
3138
|
+
* @param collateralMint - token mint
|
|
3139
|
+
* @param authority - whitelisted signer
|
|
3140
|
+
* @param payer - fee payer (can differ from authority)
|
|
3141
|
+
*/
|
|
3142
|
+
async buildBatchSendUsdsTx(recipients, amounts, configOwner, collateralMint, authority = this.walletPubkey, payer = authority) {
|
|
3143
|
+
if (!this.programIds.referral) throw new Error("referral program ID not configured");
|
|
3144
|
+
if (recipients.length !== amounts.length) throw new Error("recipients and amounts must have same length");
|
|
3145
|
+
if (recipients.length === 0) throw new Error("recipients array is empty");
|
|
3146
|
+
const [configPda] = PDA.referralConfig(configOwner, this.programIds);
|
|
3147
|
+
const referralVault = getAssociatedTokenAddressSync(collateralMint, configPda, true);
|
|
3148
|
+
const recipientAtas = recipients.map(
|
|
3149
|
+
(wallet) => getAssociatedTokenAddressSync(collateralMint, wallet)
|
|
3150
|
+
);
|
|
3151
|
+
return this.program.methods.batchSendUsds(amounts).accounts({
|
|
3152
|
+
authority,
|
|
3153
|
+
config: configPda,
|
|
3154
|
+
referralVault,
|
|
3155
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
3156
|
+
}).remainingAccounts(
|
|
3157
|
+
recipientAtas.map((ata) => ({ pubkey: ata, isSigner: false, isWritable: true }))
|
|
3158
|
+
).transaction();
|
|
3159
|
+
}
|
|
3160
|
+
};
|
|
2844
3161
|
|
|
2845
3162
|
// src/idls/oracle.json
|
|
2846
3163
|
var oracle_default = {
|
|
@@ -4260,9 +4577,59 @@ var question_market_default = {
|
|
|
4260
4577
|
],
|
|
4261
4578
|
writable: true
|
|
4262
4579
|
},
|
|
4580
|
+
{
|
|
4581
|
+
name: "presale_vault",
|
|
4582
|
+
writable: true
|
|
4583
|
+
},
|
|
4584
|
+
{
|
|
4585
|
+
name: "referral_token_account",
|
|
4586
|
+
docs: [
|
|
4587
|
+
"Referral address USDC ATA (receives agents_fee 10%)"
|
|
4588
|
+
],
|
|
4589
|
+
writable: true
|
|
4590
|
+
},
|
|
4591
|
+
{
|
|
4592
|
+
name: "company_token_account",
|
|
4593
|
+
docs: [
|
|
4594
|
+
"Company address USDC ATA (receives company_fee 10%)"
|
|
4595
|
+
],
|
|
4596
|
+
writable: true
|
|
4597
|
+
},
|
|
4598
|
+
{
|
|
4599
|
+
name: "admin_vault",
|
|
4600
|
+
docs: [
|
|
4601
|
+
"admin_contract vault ATA (receives botmm_revenue 80%)"
|
|
4602
|
+
],
|
|
4603
|
+
writable: true
|
|
4604
|
+
},
|
|
4605
|
+
{
|
|
4606
|
+
name: "admin_config",
|
|
4607
|
+
docs: [
|
|
4608
|
+
"admin_contract config PDA (seeds=[ADMIN_CONFIG_SEED, owner] \u2014 validated by admin_contract CPI)"
|
|
4609
|
+
]
|
|
4610
|
+
},
|
|
4611
|
+
{
|
|
4612
|
+
name: "claim_record",
|
|
4613
|
+
docs: [
|
|
4614
|
+
"ClaimRecord PDA for this presale's conditionId (seeds=[CLAIM_RECORD_SEED, condition_id])",
|
|
4615
|
+
"condition_id computed inside handler \u2014 seeds validated by admin_contract CPI"
|
|
4616
|
+
],
|
|
4617
|
+
writable: true
|
|
4618
|
+
},
|
|
4263
4619
|
{
|
|
4264
4620
|
name: "conditional_tokens_program"
|
|
4265
4621
|
},
|
|
4622
|
+
{
|
|
4623
|
+
name: "question_fee",
|
|
4624
|
+
docs: [
|
|
4625
|
+
"QuestionFee PDA \u2014 initialized with default fees via CPI to fee-management"
|
|
4626
|
+
],
|
|
4627
|
+
writable: true
|
|
4628
|
+
},
|
|
4629
|
+
{
|
|
4630
|
+
name: "fee_management_program",
|
|
4631
|
+
address: "DuYyXguB5PVSKg6E2p4XPrrXZSCJnuBhoGpkGCBN5bBb"
|
|
4632
|
+
},
|
|
4266
4633
|
{
|
|
4267
4634
|
name: "presale_program",
|
|
4268
4635
|
address: "2Rnw1VoEtsUMQ7wkvYZjDehqSqRob6uNkeymDfvKrquB"
|
|
@@ -4271,6 +4638,10 @@ var question_market_default = {
|
|
|
4271
4638
|
name: "market_oracle_program",
|
|
4272
4639
|
address: "ADWF4J3nCJ2kWnCtycuem2jhu7amUqJWQG3oa5xF67QJ"
|
|
4273
4640
|
},
|
|
4641
|
+
{
|
|
4642
|
+
name: "admin_program",
|
|
4643
|
+
address: "4NdD5962SfGqofmeyjfifJpdGnwTAiKaUKB5Z42UDc9T"
|
|
4644
|
+
},
|
|
4274
4645
|
{
|
|
4275
4646
|
name: "token_program",
|
|
4276
4647
|
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
@@ -4914,12 +5285,53 @@ var question_market_default = {
|
|
|
4914
5285
|
name: "conditional_tokens_program"
|
|
4915
5286
|
},
|
|
4916
5287
|
{
|
|
4917
|
-
name: "
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
5288
|
+
name: "question_fee",
|
|
5289
|
+
docs: [
|
|
5290
|
+
"QuestionFee PDA \u2014 initialized with default fees via CPI to fee-management.",
|
|
5291
|
+
"Seed uses condition.key() bytes (consistent with existing set_question_fee SDK convention)."
|
|
5292
|
+
],
|
|
5293
|
+
writable: true,
|
|
5294
|
+
pda: {
|
|
5295
|
+
seeds: [
|
|
5296
|
+
{
|
|
5297
|
+
kind: "const",
|
|
5298
|
+
value: [
|
|
5299
|
+
113,
|
|
5300
|
+
117,
|
|
5301
|
+
101,
|
|
5302
|
+
115,
|
|
5303
|
+
116,
|
|
5304
|
+
105,
|
|
5305
|
+
111,
|
|
5306
|
+
110,
|
|
5307
|
+
95,
|
|
5308
|
+
102,
|
|
5309
|
+
101,
|
|
5310
|
+
101
|
|
5311
|
+
]
|
|
5312
|
+
},
|
|
5313
|
+
{
|
|
5314
|
+
kind: "account",
|
|
5315
|
+
path: "condition"
|
|
5316
|
+
}
|
|
5317
|
+
],
|
|
5318
|
+
program: {
|
|
5319
|
+
kind: "account",
|
|
5320
|
+
path: "fee_management_program"
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
},
|
|
5324
|
+
{
|
|
5325
|
+
name: "fee_management_program",
|
|
5326
|
+
address: "DuYyXguB5PVSKg6E2p4XPrrXZSCJnuBhoGpkGCBN5bBb"
|
|
5327
|
+
},
|
|
5328
|
+
{
|
|
5329
|
+
name: "token_program",
|
|
5330
|
+
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
5331
|
+
},
|
|
5332
|
+
{
|
|
5333
|
+
name: "system_program",
|
|
5334
|
+
address: "11111111111111111111111111111111"
|
|
4923
5335
|
},
|
|
4924
5336
|
{
|
|
4925
5337
|
name: "rent",
|
|
@@ -6029,6 +6441,18 @@ var question_market_default = {
|
|
|
6029
6441
|
{
|
|
6030
6442
|
name: "creator",
|
|
6031
6443
|
type: "pubkey"
|
|
6444
|
+
},
|
|
6445
|
+
{
|
|
6446
|
+
name: "agents_fee",
|
|
6447
|
+
type: "u64"
|
|
6448
|
+
},
|
|
6449
|
+
{
|
|
6450
|
+
name: "company_fee",
|
|
6451
|
+
type: "u64"
|
|
6452
|
+
},
|
|
6453
|
+
{
|
|
6454
|
+
name: "botmm_revenue",
|
|
6455
|
+
type: "u64"
|
|
6032
6456
|
}
|
|
6033
6457
|
]
|
|
6034
6458
|
}
|
|
@@ -8595,6 +9019,174 @@ var clob_exchange_default = {
|
|
|
8595
9019
|
}
|
|
8596
9020
|
]
|
|
8597
9021
|
},
|
|
9022
|
+
{
|
|
9023
|
+
name: "batch_collect_redeem_early",
|
|
9024
|
+
docs: [
|
|
9025
|
+
"Batch collect fee tokens from winning users after question resolution,",
|
|
9026
|
+
"redeem them via CTF, and distribute USDS via fee_management."
|
|
9027
|
+
],
|
|
9028
|
+
discriminator: [
|
|
9029
|
+
87,
|
|
9030
|
+
149,
|
|
9031
|
+
45,
|
|
9032
|
+
245,
|
|
9033
|
+
249,
|
|
9034
|
+
25,
|
|
9035
|
+
207,
|
|
9036
|
+
82
|
|
9037
|
+
],
|
|
9038
|
+
accounts: [
|
|
9039
|
+
{
|
|
9040
|
+
name: "operator",
|
|
9041
|
+
signer: true
|
|
9042
|
+
},
|
|
9043
|
+
{
|
|
9044
|
+
name: "payer",
|
|
9045
|
+
writable: true,
|
|
9046
|
+
signer: true
|
|
9047
|
+
},
|
|
9048
|
+
{
|
|
9049
|
+
name: "clob_config",
|
|
9050
|
+
writable: true,
|
|
9051
|
+
pda: {
|
|
9052
|
+
seeds: [
|
|
9053
|
+
{
|
|
9054
|
+
kind: "const",
|
|
9055
|
+
value: [
|
|
9056
|
+
99,
|
|
9057
|
+
108,
|
|
9058
|
+
111,
|
|
9059
|
+
98,
|
|
9060
|
+
95,
|
|
9061
|
+
99,
|
|
9062
|
+
111,
|
|
9063
|
+
110,
|
|
9064
|
+
102,
|
|
9065
|
+
105,
|
|
9066
|
+
103
|
|
9067
|
+
]
|
|
9068
|
+
}
|
|
9069
|
+
]
|
|
9070
|
+
}
|
|
9071
|
+
},
|
|
9072
|
+
{
|
|
9073
|
+
name: "condition",
|
|
9074
|
+
writable: true
|
|
9075
|
+
},
|
|
9076
|
+
{
|
|
9077
|
+
name: "collateral_vault",
|
|
9078
|
+
writable: true,
|
|
9079
|
+
pda: {
|
|
9080
|
+
seeds: [
|
|
9081
|
+
{
|
|
9082
|
+
kind: "const",
|
|
9083
|
+
value: [
|
|
9084
|
+
99,
|
|
9085
|
+
111,
|
|
9086
|
+
108,
|
|
9087
|
+
108,
|
|
9088
|
+
97,
|
|
9089
|
+
116,
|
|
9090
|
+
101,
|
|
9091
|
+
114,
|
|
9092
|
+
97,
|
|
9093
|
+
108,
|
|
9094
|
+
95,
|
|
9095
|
+
118,
|
|
9096
|
+
97,
|
|
9097
|
+
117,
|
|
9098
|
+
108,
|
|
9099
|
+
116
|
|
9100
|
+
]
|
|
9101
|
+
},
|
|
9102
|
+
{
|
|
9103
|
+
kind: "account",
|
|
9104
|
+
path: "condition.collateral_mint",
|
|
9105
|
+
account: "Condition"
|
|
9106
|
+
}
|
|
9107
|
+
],
|
|
9108
|
+
program: {
|
|
9109
|
+
kind: "account",
|
|
9110
|
+
path: "conditional_tokens_program"
|
|
9111
|
+
}
|
|
9112
|
+
}
|
|
9113
|
+
},
|
|
9114
|
+
{
|
|
9115
|
+
name: "vault_token_account",
|
|
9116
|
+
writable: true
|
|
9117
|
+
},
|
|
9118
|
+
{
|
|
9119
|
+
name: "fee_recipient",
|
|
9120
|
+
docs: [
|
|
9121
|
+
"CLOB's USDS ATA \u2014 receives USDS payout from redeem, then distribute_fee draws from it."
|
|
9122
|
+
],
|
|
9123
|
+
writable: true
|
|
9124
|
+
},
|
|
9125
|
+
{
|
|
9126
|
+
name: "yes_mint",
|
|
9127
|
+
writable: true
|
|
9128
|
+
},
|
|
9129
|
+
{
|
|
9130
|
+
name: "no_mint",
|
|
9131
|
+
writable: true
|
|
9132
|
+
},
|
|
9133
|
+
{
|
|
9134
|
+
name: "clob_yes_ata",
|
|
9135
|
+
docs: [
|
|
9136
|
+
"CLOB's YES ATA (Token-2022) \u2014 must be pre-initialized (created during prior matchOrders)."
|
|
9137
|
+
],
|
|
9138
|
+
writable: true
|
|
9139
|
+
},
|
|
9140
|
+
{
|
|
9141
|
+
name: "clob_no_ata",
|
|
9142
|
+
docs: [
|
|
9143
|
+
"CLOB's NO ATA (Token-2022) \u2014 must be pre-initialized."
|
|
9144
|
+
],
|
|
9145
|
+
writable: true
|
|
9146
|
+
},
|
|
9147
|
+
{
|
|
9148
|
+
name: "clob_yes_position",
|
|
9149
|
+
writable: true
|
|
9150
|
+
},
|
|
9151
|
+
{
|
|
9152
|
+
name: "clob_no_position",
|
|
9153
|
+
writable: true
|
|
9154
|
+
},
|
|
9155
|
+
{
|
|
9156
|
+
name: "ix_sysvar"
|
|
9157
|
+
},
|
|
9158
|
+
{
|
|
9159
|
+
name: "conditional_tokens_program",
|
|
9160
|
+
address: "A6N1F8MRsdgcojAx8p6FaECvw8mo8w6qJcWsbKQBANK4"
|
|
9161
|
+
},
|
|
9162
|
+
{
|
|
9163
|
+
name: "token_program",
|
|
9164
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
9165
|
+
},
|
|
9166
|
+
{
|
|
9167
|
+
name: "token_2022_program",
|
|
9168
|
+
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
9169
|
+
},
|
|
9170
|
+
{
|
|
9171
|
+
name: "system_program",
|
|
9172
|
+
address: "11111111111111111111111111111111"
|
|
9173
|
+
}
|
|
9174
|
+
],
|
|
9175
|
+
args: [
|
|
9176
|
+
{
|
|
9177
|
+
name: "ix_index",
|
|
9178
|
+
type: "u8"
|
|
9179
|
+
},
|
|
9180
|
+
{
|
|
9181
|
+
name: "order_count",
|
|
9182
|
+
type: "u8"
|
|
9183
|
+
},
|
|
9184
|
+
{
|
|
9185
|
+
name: "outcome_index",
|
|
9186
|
+
type: "u8"
|
|
9187
|
+
}
|
|
9188
|
+
]
|
|
9189
|
+
},
|
|
8598
9190
|
{
|
|
8599
9191
|
name: "cancel_order",
|
|
8600
9192
|
docs: [
|
|
@@ -8808,7 +9400,7 @@ var clob_exchange_default = {
|
|
|
8808
9400
|
{
|
|
8809
9401
|
name: "match_complementary",
|
|
8810
9402
|
docs: [
|
|
8811
|
-
"COMPLEMENTARY match: 1 taker (BUY) + N makers (
|
|
9403
|
+
"COMPLEMENTARY match: 1 taker (BUY or SELL) + N makers (opposite side) via remaining_accounts."
|
|
8812
9404
|
],
|
|
8813
9405
|
discriminator: [
|
|
8814
9406
|
100,
|
|
@@ -9101,9 +9693,6 @@ var clob_exchange_default = {
|
|
|
9101
9693
|
},
|
|
9102
9694
|
{
|
|
9103
9695
|
name: "clob_usdc_ata",
|
|
9104
|
-
docs: [
|
|
9105
|
-
"USDC ATA owned by clob_config \u2014 receives USDC from vault after merge"
|
|
9106
|
-
],
|
|
9107
9696
|
writable: true,
|
|
9108
9697
|
pda: {
|
|
9109
9698
|
seeds: [
|
|
@@ -9380,9 +9969,6 @@ var clob_exchange_default = {
|
|
|
9380
9969
|
},
|
|
9381
9970
|
{
|
|
9382
9971
|
name: "clob_usdc_ata",
|
|
9383
|
-
docs: [
|
|
9384
|
-
"USDC ATA owned by clob_config \u2014 receives combined USDC, then split_position pulls from here"
|
|
9385
|
-
],
|
|
9386
9972
|
writable: true,
|
|
9387
9973
|
pda: {
|
|
9388
9974
|
seeds: [
|
|
@@ -9440,30 +10026,18 @@ var clob_exchange_default = {
|
|
|
9440
10026
|
},
|
|
9441
10027
|
{
|
|
9442
10028
|
name: "clob_yes_ata",
|
|
9443
|
-
docs: [
|
|
9444
|
-
"YES Token-2022 ATA owned by clob_config \u2014 receives YES from split, then transferred to taker"
|
|
9445
|
-
],
|
|
9446
10029
|
writable: true
|
|
9447
10030
|
},
|
|
9448
10031
|
{
|
|
9449
10032
|
name: "clob_no_ata",
|
|
9450
|
-
docs: [
|
|
9451
|
-
"NO Token-2022 ATA owned by clob_config \u2014 receives NO from split, then transferred to makers"
|
|
9452
|
-
],
|
|
9453
10033
|
writable: true
|
|
9454
10034
|
},
|
|
9455
10035
|
{
|
|
9456
10036
|
name: "clob_yes_position",
|
|
9457
|
-
docs: [
|
|
9458
|
-
"YES Position PDA for clob_config (set by CTF split_position init_if_needed)"
|
|
9459
|
-
],
|
|
9460
10037
|
writable: true
|
|
9461
10038
|
},
|
|
9462
10039
|
{
|
|
9463
10040
|
name: "clob_no_position",
|
|
9464
|
-
docs: [
|
|
9465
|
-
"NO Position PDA for clob_config (set by CTF split_position init_if_needed)"
|
|
9466
|
-
],
|
|
9467
10041
|
writable: true
|
|
9468
10042
|
},
|
|
9469
10043
|
{
|
|
@@ -10499,11 +11073,18 @@ var fee_management_default = {
|
|
|
10499
11073
|
{
|
|
10500
11074
|
name: "market_oracle_vault",
|
|
10501
11075
|
docs: [
|
|
10502
|
-
"Writable: tokens are transferred here when is_admin=false.",
|
|
11076
|
+
"Writable: tokens are transferred here (investors share) when is_admin=false.",
|
|
10503
11077
|
"For admin questions pass any writable account (no transfer occurs)."
|
|
10504
11078
|
],
|
|
10505
11079
|
writable: true
|
|
10506
11080
|
},
|
|
11081
|
+
{
|
|
11082
|
+
name: "referral_vault",
|
|
11083
|
+
docs: [
|
|
11084
|
+
"Must match fee_config.referral_vault."
|
|
11085
|
+
],
|
|
11086
|
+
writable: true
|
|
11087
|
+
},
|
|
10507
11088
|
{
|
|
10508
11089
|
name: "token_program",
|
|
10509
11090
|
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
@@ -10521,40 +11102,104 @@ var fee_management_default = {
|
|
|
10521
11102
|
]
|
|
10522
11103
|
},
|
|
10523
11104
|
{
|
|
10524
|
-
name: "
|
|
11105
|
+
name: "init_question_fee",
|
|
10525
11106
|
discriminator: [
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
11107
|
+
115,
|
|
11108
|
+
49,
|
|
11109
|
+
110,
|
|
11110
|
+
164,
|
|
11111
|
+
33,
|
|
11112
|
+
202,
|
|
11113
|
+
115,
|
|
11114
|
+
79
|
|
10534
11115
|
],
|
|
10535
11116
|
accounts: [
|
|
10536
|
-
{
|
|
10537
|
-
name: "authority",
|
|
10538
|
-
signer: true
|
|
10539
|
-
},
|
|
10540
11117
|
{
|
|
10541
11118
|
name: "payer",
|
|
10542
11119
|
writable: true,
|
|
10543
11120
|
signer: true
|
|
10544
11121
|
},
|
|
10545
11122
|
{
|
|
10546
|
-
name: "
|
|
11123
|
+
name: "question_fee",
|
|
10547
11124
|
writable: true,
|
|
10548
11125
|
pda: {
|
|
10549
11126
|
seeds: [
|
|
10550
11127
|
{
|
|
10551
11128
|
kind: "const",
|
|
10552
11129
|
value: [
|
|
10553
|
-
|
|
10554
|
-
|
|
11130
|
+
113,
|
|
11131
|
+
117,
|
|
10555
11132
|
101,
|
|
10556
|
-
|
|
10557
|
-
|
|
11133
|
+
115,
|
|
11134
|
+
116,
|
|
11135
|
+
105,
|
|
11136
|
+
111,
|
|
11137
|
+
110,
|
|
11138
|
+
95,
|
|
11139
|
+
102,
|
|
11140
|
+
101,
|
|
11141
|
+
101
|
|
11142
|
+
]
|
|
11143
|
+
},
|
|
11144
|
+
{
|
|
11145
|
+
kind: "arg",
|
|
11146
|
+
path: "condition_id"
|
|
11147
|
+
}
|
|
11148
|
+
]
|
|
11149
|
+
}
|
|
11150
|
+
},
|
|
11151
|
+
{
|
|
11152
|
+
name: "system_program",
|
|
11153
|
+
address: "11111111111111111111111111111111"
|
|
11154
|
+
}
|
|
11155
|
+
],
|
|
11156
|
+
args: [
|
|
11157
|
+
{
|
|
11158
|
+
name: "condition_id",
|
|
11159
|
+
type: {
|
|
11160
|
+
array: [
|
|
11161
|
+
"u8",
|
|
11162
|
+
32
|
|
11163
|
+
]
|
|
11164
|
+
}
|
|
11165
|
+
}
|
|
11166
|
+
]
|
|
11167
|
+
},
|
|
11168
|
+
{
|
|
11169
|
+
name: "initialize",
|
|
11170
|
+
discriminator: [
|
|
11171
|
+
175,
|
|
11172
|
+
175,
|
|
11173
|
+
109,
|
|
11174
|
+
31,
|
|
11175
|
+
13,
|
|
11176
|
+
152,
|
|
11177
|
+
155,
|
|
11178
|
+
237
|
|
11179
|
+
],
|
|
11180
|
+
accounts: [
|
|
11181
|
+
{
|
|
11182
|
+
name: "authority",
|
|
11183
|
+
signer: true
|
|
11184
|
+
},
|
|
11185
|
+
{
|
|
11186
|
+
name: "payer",
|
|
11187
|
+
writable: true,
|
|
11188
|
+
signer: true
|
|
11189
|
+
},
|
|
11190
|
+
{
|
|
11191
|
+
name: "fee_config",
|
|
11192
|
+
writable: true,
|
|
11193
|
+
pda: {
|
|
11194
|
+
seeds: [
|
|
11195
|
+
{
|
|
11196
|
+
kind: "const",
|
|
11197
|
+
value: [
|
|
11198
|
+
102,
|
|
11199
|
+
101,
|
|
11200
|
+
101,
|
|
11201
|
+
95,
|
|
11202
|
+
99,
|
|
10558
11203
|
111,
|
|
10559
11204
|
110,
|
|
10560
11205
|
102,
|
|
@@ -11214,6 +11859,19 @@ var fee_management_default = {
|
|
|
11214
11859
|
235
|
|
11215
11860
|
]
|
|
11216
11861
|
},
|
|
11862
|
+
{
|
|
11863
|
+
name: "QuestionFeeInitialized",
|
|
11864
|
+
discriminator: [
|
|
11865
|
+
147,
|
|
11866
|
+
167,
|
|
11867
|
+
20,
|
|
11868
|
+
219,
|
|
11869
|
+
32,
|
|
11870
|
+
142,
|
|
11871
|
+
227,
|
|
11872
|
+
171
|
|
11873
|
+
]
|
|
11874
|
+
},
|
|
11217
11875
|
{
|
|
11218
11876
|
name: "QuestionFeeUpdated",
|
|
11219
11877
|
discriminator: [
|
|
@@ -11285,7 +11943,8 @@ var fee_management_default = {
|
|
|
11285
11943
|
{
|
|
11286
11944
|
name: "investors_market_rev",
|
|
11287
11945
|
docs: [
|
|
11288
|
-
"Market revenue split
|
|
11946
|
+
"Market revenue split \u2014 three parts must sum to FEE_DENOMINATOR (10_000).",
|
|
11947
|
+
"investors_market_rev + company_market_rev + referral_market_rev == 10_000"
|
|
11289
11948
|
],
|
|
11290
11949
|
type: "u32"
|
|
11291
11950
|
},
|
|
@@ -11296,7 +11955,7 @@ var fee_management_default = {
|
|
|
11296
11955
|
{
|
|
11297
11956
|
name: "agents_presale_rev",
|
|
11298
11957
|
docs: [
|
|
11299
|
-
"Presale revenue split: agents + company (out of FEE_DENOMINATOR =
|
|
11958
|
+
"Presale revenue split: agents + company (out of FEE_DENOMINATOR = 10_000)"
|
|
11300
11959
|
],
|
|
11301
11960
|
type: "u32"
|
|
11302
11961
|
},
|
|
@@ -11321,12 +11980,26 @@ var fee_management_default = {
|
|
|
11321
11980
|
name: "bump",
|
|
11322
11981
|
type: "u8"
|
|
11323
11982
|
},
|
|
11983
|
+
{
|
|
11984
|
+
name: "referral_market_rev",
|
|
11985
|
+
docs: [
|
|
11986
|
+
"Share of market trading fees routed to referral_vault (e.g. 2_000 = 20%)"
|
|
11987
|
+
],
|
|
11988
|
+
type: "u32"
|
|
11989
|
+
},
|
|
11990
|
+
{
|
|
11991
|
+
name: "referral_vault",
|
|
11992
|
+
docs: [
|
|
11993
|
+
"ATA of referral program config PDA \u2014 receives referral_market_rev% of trading fees"
|
|
11994
|
+
],
|
|
11995
|
+
type: "pubkey"
|
|
11996
|
+
},
|
|
11324
11997
|
{
|
|
11325
11998
|
name: "_reserved",
|
|
11326
11999
|
type: {
|
|
11327
12000
|
array: [
|
|
11328
12001
|
"u8",
|
|
11329
|
-
|
|
12002
|
+
28
|
|
11330
12003
|
]
|
|
11331
12004
|
}
|
|
11332
12005
|
}
|
|
@@ -11453,6 +12126,14 @@ var fee_management_default = {
|
|
|
11453
12126
|
{
|
|
11454
12127
|
name: "company_presale_rev",
|
|
11455
12128
|
type: "u32"
|
|
12129
|
+
},
|
|
12130
|
+
{
|
|
12131
|
+
name: "referral_market_rev",
|
|
12132
|
+
type: "u32"
|
|
12133
|
+
},
|
|
12134
|
+
{
|
|
12135
|
+
name: "referral_vault",
|
|
12136
|
+
type: "pubkey"
|
|
11456
12137
|
}
|
|
11457
12138
|
]
|
|
11458
12139
|
}
|
|
@@ -11596,7 +12277,7 @@ var fee_management_default = {
|
|
|
11596
12277
|
{
|
|
11597
12278
|
name: "merge_fee",
|
|
11598
12279
|
docs: [
|
|
11599
|
-
"Fees out of FEE_DENOMINATOR (
|
|
12280
|
+
"Fees out of FEE_DENOMINATOR (10_000). E.g. 200 = 2%, 2_000 = 20%"
|
|
11600
12281
|
],
|
|
11601
12282
|
type: "u64"
|
|
11602
12283
|
},
|
|
@@ -11615,6 +12296,35 @@ var fee_management_default = {
|
|
|
11615
12296
|
]
|
|
11616
12297
|
}
|
|
11617
12298
|
},
|
|
12299
|
+
{
|
|
12300
|
+
name: "QuestionFeeInitialized",
|
|
12301
|
+
type: {
|
|
12302
|
+
kind: "struct",
|
|
12303
|
+
fields: [
|
|
12304
|
+
{
|
|
12305
|
+
name: "condition_id",
|
|
12306
|
+
type: {
|
|
12307
|
+
array: [
|
|
12308
|
+
"u8",
|
|
12309
|
+
32
|
|
12310
|
+
]
|
|
12311
|
+
}
|
|
12312
|
+
},
|
|
12313
|
+
{
|
|
12314
|
+
name: "swap_fee",
|
|
12315
|
+
type: "u64"
|
|
12316
|
+
},
|
|
12317
|
+
{
|
|
12318
|
+
name: "redeem_fee",
|
|
12319
|
+
type: "u64"
|
|
12320
|
+
},
|
|
12321
|
+
{
|
|
12322
|
+
name: "merge_fee",
|
|
12323
|
+
type: "u64"
|
|
12324
|
+
}
|
|
12325
|
+
]
|
|
12326
|
+
}
|
|
12327
|
+
},
|
|
11618
12328
|
{
|
|
11619
12329
|
name: "QuestionFeeUpdated",
|
|
11620
12330
|
type: {
|
|
@@ -11684,6 +12394,14 @@ var fee_management_default = {
|
|
|
11684
12394
|
{
|
|
11685
12395
|
name: "company_presale_rev",
|
|
11686
12396
|
type: "u32"
|
|
12397
|
+
},
|
|
12398
|
+
{
|
|
12399
|
+
name: "referral_market_rev",
|
|
12400
|
+
type: "u32"
|
|
12401
|
+
},
|
|
12402
|
+
{
|
|
12403
|
+
name: "referral_vault",
|
|
12404
|
+
type: "pubkey"
|
|
11687
12405
|
}
|
|
11688
12406
|
]
|
|
11689
12407
|
}
|
|
@@ -15032,94 +15750,592 @@ var admin_contract_default = {
|
|
|
15032
15750
|
]
|
|
15033
15751
|
};
|
|
15034
15752
|
|
|
15035
|
-
// src/
|
|
15036
|
-
var
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15056
|
-
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
|
|
15087
|
-
|
|
15088
|
-
|
|
15089
|
-
|
|
15090
|
-
|
|
15091
|
-
|
|
15092
|
-
|
|
15093
|
-
|
|
15094
|
-
|
|
15095
|
-
|
|
15096
|
-
|
|
15097
|
-
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
|
|
15104
|
-
|
|
15105
|
-
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
|
|
15109
|
-
|
|
15110
|
-
|
|
15111
|
-
|
|
15112
|
-
|
|
15113
|
-
|
|
15114
|
-
|
|
15115
|
-
|
|
15116
|
-
|
|
15117
|
-
|
|
15118
|
-
|
|
15119
|
-
|
|
15120
|
-
|
|
15121
|
-
|
|
15122
|
-
|
|
15753
|
+
// src/idls/referral.json
|
|
15754
|
+
var referral_default = {
|
|
15755
|
+
address: "7b5ohWDqrQ2KRcDJMWwj1dwgRkt5ZJdMavSmrXn9oBgL",
|
|
15756
|
+
metadata: {
|
|
15757
|
+
name: "referral",
|
|
15758
|
+
version: "0.1.0",
|
|
15759
|
+
spec: "0.1.0",
|
|
15760
|
+
description: "Referral program for XMarket \u2014 whitelist-gated batch USDS distribution"
|
|
15761
|
+
},
|
|
15762
|
+
instructions: [
|
|
15763
|
+
{
|
|
15764
|
+
name: "add_to_whitelist",
|
|
15765
|
+
discriminator: [
|
|
15766
|
+
157,
|
|
15767
|
+
211,
|
|
15768
|
+
52,
|
|
15769
|
+
54,
|
|
15770
|
+
144,
|
|
15771
|
+
81,
|
|
15772
|
+
5,
|
|
15773
|
+
55
|
|
15774
|
+
],
|
|
15775
|
+
accounts: [
|
|
15776
|
+
{
|
|
15777
|
+
name: "owner",
|
|
15778
|
+
signer: true
|
|
15779
|
+
},
|
|
15780
|
+
{
|
|
15781
|
+
name: "payer",
|
|
15782
|
+
writable: true,
|
|
15783
|
+
signer: true
|
|
15784
|
+
},
|
|
15785
|
+
{
|
|
15786
|
+
name: "config",
|
|
15787
|
+
writable: true,
|
|
15788
|
+
pda: {
|
|
15789
|
+
seeds: [
|
|
15790
|
+
{
|
|
15791
|
+
kind: "const",
|
|
15792
|
+
value: [
|
|
15793
|
+
114,
|
|
15794
|
+
101,
|
|
15795
|
+
102,
|
|
15796
|
+
101,
|
|
15797
|
+
114,
|
|
15798
|
+
114,
|
|
15799
|
+
97,
|
|
15800
|
+
108,
|
|
15801
|
+
95,
|
|
15802
|
+
99,
|
|
15803
|
+
111,
|
|
15804
|
+
110,
|
|
15805
|
+
102,
|
|
15806
|
+
105,
|
|
15807
|
+
103
|
|
15808
|
+
]
|
|
15809
|
+
},
|
|
15810
|
+
{
|
|
15811
|
+
kind: "account",
|
|
15812
|
+
path: "config.owner",
|
|
15813
|
+
account: "ReferralConfig"
|
|
15814
|
+
}
|
|
15815
|
+
]
|
|
15816
|
+
}
|
|
15817
|
+
}
|
|
15818
|
+
],
|
|
15819
|
+
args: [
|
|
15820
|
+
{
|
|
15821
|
+
name: "address",
|
|
15822
|
+
type: "pubkey"
|
|
15823
|
+
}
|
|
15824
|
+
]
|
|
15825
|
+
},
|
|
15826
|
+
{
|
|
15827
|
+
name: "batch_send_usds",
|
|
15828
|
+
discriminator: [
|
|
15829
|
+
255,
|
|
15830
|
+
33,
|
|
15831
|
+
77,
|
|
15832
|
+
124,
|
|
15833
|
+
42,
|
|
15834
|
+
207,
|
|
15835
|
+
250,
|
|
15836
|
+
162
|
|
15837
|
+
],
|
|
15838
|
+
accounts: [
|
|
15839
|
+
{
|
|
15840
|
+
name: "authority",
|
|
15841
|
+
docs: [
|
|
15842
|
+
"Whitelisted caller (authority, signs tx)"
|
|
15843
|
+
],
|
|
15844
|
+
signer: true
|
|
15845
|
+
},
|
|
15846
|
+
{
|
|
15847
|
+
name: "config",
|
|
15848
|
+
pda: {
|
|
15849
|
+
seeds: [
|
|
15850
|
+
{
|
|
15851
|
+
kind: "const",
|
|
15852
|
+
value: [
|
|
15853
|
+
114,
|
|
15854
|
+
101,
|
|
15855
|
+
102,
|
|
15856
|
+
101,
|
|
15857
|
+
114,
|
|
15858
|
+
114,
|
|
15859
|
+
97,
|
|
15860
|
+
108,
|
|
15861
|
+
95,
|
|
15862
|
+
99,
|
|
15863
|
+
111,
|
|
15864
|
+
110,
|
|
15865
|
+
102,
|
|
15866
|
+
105,
|
|
15867
|
+
103
|
|
15868
|
+
]
|
|
15869
|
+
},
|
|
15870
|
+
{
|
|
15871
|
+
kind: "account",
|
|
15872
|
+
path: "config.owner",
|
|
15873
|
+
account: "ReferralConfig"
|
|
15874
|
+
}
|
|
15875
|
+
]
|
|
15876
|
+
}
|
|
15877
|
+
},
|
|
15878
|
+
{
|
|
15879
|
+
name: "referral_vault",
|
|
15880
|
+
docs: [
|
|
15881
|
+
"Referral vault \u2014 source of transfers (ATA owned by config PDA)"
|
|
15882
|
+
],
|
|
15883
|
+
writable: true,
|
|
15884
|
+
pda: {
|
|
15885
|
+
seeds: [
|
|
15886
|
+
{
|
|
15887
|
+
kind: "account",
|
|
15888
|
+
path: "config"
|
|
15889
|
+
},
|
|
15890
|
+
{
|
|
15891
|
+
kind: "const",
|
|
15892
|
+
value: [
|
|
15893
|
+
6,
|
|
15894
|
+
221,
|
|
15895
|
+
246,
|
|
15896
|
+
225,
|
|
15897
|
+
215,
|
|
15898
|
+
101,
|
|
15899
|
+
161,
|
|
15900
|
+
147,
|
|
15901
|
+
217,
|
|
15902
|
+
203,
|
|
15903
|
+
225,
|
|
15904
|
+
70,
|
|
15905
|
+
206,
|
|
15906
|
+
235,
|
|
15907
|
+
121,
|
|
15908
|
+
172,
|
|
15909
|
+
28,
|
|
15910
|
+
180,
|
|
15911
|
+
133,
|
|
15912
|
+
237,
|
|
15913
|
+
95,
|
|
15914
|
+
91,
|
|
15915
|
+
55,
|
|
15916
|
+
145,
|
|
15917
|
+
58,
|
|
15918
|
+
140,
|
|
15919
|
+
245,
|
|
15920
|
+
133,
|
|
15921
|
+
126,
|
|
15922
|
+
255,
|
|
15923
|
+
0,
|
|
15924
|
+
169
|
|
15925
|
+
]
|
|
15926
|
+
},
|
|
15927
|
+
{
|
|
15928
|
+
kind: "account",
|
|
15929
|
+
path: "config.collateral_mint",
|
|
15930
|
+
account: "ReferralConfig"
|
|
15931
|
+
}
|
|
15932
|
+
],
|
|
15933
|
+
program: {
|
|
15934
|
+
kind: "const",
|
|
15935
|
+
value: [
|
|
15936
|
+
140,
|
|
15937
|
+
151,
|
|
15938
|
+
37,
|
|
15939
|
+
143,
|
|
15940
|
+
78,
|
|
15941
|
+
36,
|
|
15942
|
+
137,
|
|
15943
|
+
241,
|
|
15944
|
+
187,
|
|
15945
|
+
61,
|
|
15946
|
+
16,
|
|
15947
|
+
41,
|
|
15948
|
+
20,
|
|
15949
|
+
142,
|
|
15950
|
+
13,
|
|
15951
|
+
131,
|
|
15952
|
+
11,
|
|
15953
|
+
90,
|
|
15954
|
+
19,
|
|
15955
|
+
153,
|
|
15956
|
+
218,
|
|
15957
|
+
255,
|
|
15958
|
+
16,
|
|
15959
|
+
132,
|
|
15960
|
+
4,
|
|
15961
|
+
142,
|
|
15962
|
+
123,
|
|
15963
|
+
216,
|
|
15964
|
+
219,
|
|
15965
|
+
233,
|
|
15966
|
+
248,
|
|
15967
|
+
89
|
|
15968
|
+
]
|
|
15969
|
+
}
|
|
15970
|
+
}
|
|
15971
|
+
},
|
|
15972
|
+
{
|
|
15973
|
+
name: "token_program",
|
|
15974
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
15975
|
+
}
|
|
15976
|
+
],
|
|
15977
|
+
args: [
|
|
15978
|
+
{
|
|
15979
|
+
name: "amounts",
|
|
15980
|
+
type: {
|
|
15981
|
+
vec: "u64"
|
|
15982
|
+
}
|
|
15983
|
+
}
|
|
15984
|
+
]
|
|
15985
|
+
},
|
|
15986
|
+
{
|
|
15987
|
+
name: "initialize",
|
|
15988
|
+
discriminator: [
|
|
15989
|
+
175,
|
|
15990
|
+
175,
|
|
15991
|
+
109,
|
|
15992
|
+
31,
|
|
15993
|
+
13,
|
|
15994
|
+
152,
|
|
15995
|
+
155,
|
|
15996
|
+
237
|
|
15997
|
+
],
|
|
15998
|
+
accounts: [
|
|
15999
|
+
{
|
|
16000
|
+
name: "owner",
|
|
16001
|
+
writable: true,
|
|
16002
|
+
signer: true
|
|
16003
|
+
},
|
|
16004
|
+
{
|
|
16005
|
+
name: "payer",
|
|
16006
|
+
writable: true,
|
|
16007
|
+
signer: true
|
|
16008
|
+
},
|
|
16009
|
+
{
|
|
16010
|
+
name: "config",
|
|
16011
|
+
writable: true,
|
|
16012
|
+
pda: {
|
|
16013
|
+
seeds: [
|
|
16014
|
+
{
|
|
16015
|
+
kind: "const",
|
|
16016
|
+
value: [
|
|
16017
|
+
114,
|
|
16018
|
+
101,
|
|
16019
|
+
102,
|
|
16020
|
+
101,
|
|
16021
|
+
114,
|
|
16022
|
+
114,
|
|
16023
|
+
97,
|
|
16024
|
+
108,
|
|
16025
|
+
95,
|
|
16026
|
+
99,
|
|
16027
|
+
111,
|
|
16028
|
+
110,
|
|
16029
|
+
102,
|
|
16030
|
+
105,
|
|
16031
|
+
103
|
|
16032
|
+
]
|
|
16033
|
+
},
|
|
16034
|
+
{
|
|
16035
|
+
kind: "account",
|
|
16036
|
+
path: "owner"
|
|
16037
|
+
}
|
|
16038
|
+
]
|
|
16039
|
+
}
|
|
16040
|
+
},
|
|
16041
|
+
{
|
|
16042
|
+
name: "collateral_mint"
|
|
16043
|
+
},
|
|
16044
|
+
{
|
|
16045
|
+
name: "system_program",
|
|
16046
|
+
address: "11111111111111111111111111111111"
|
|
16047
|
+
}
|
|
16048
|
+
],
|
|
16049
|
+
args: []
|
|
16050
|
+
},
|
|
16051
|
+
{
|
|
16052
|
+
name: "remove_from_whitelist",
|
|
16053
|
+
discriminator: [
|
|
16054
|
+
7,
|
|
16055
|
+
144,
|
|
16056
|
+
216,
|
|
16057
|
+
239,
|
|
16058
|
+
243,
|
|
16059
|
+
236,
|
|
16060
|
+
193,
|
|
16061
|
+
235
|
|
16062
|
+
],
|
|
16063
|
+
accounts: [
|
|
16064
|
+
{
|
|
16065
|
+
name: "owner",
|
|
16066
|
+
signer: true
|
|
16067
|
+
},
|
|
16068
|
+
{
|
|
16069
|
+
name: "payer",
|
|
16070
|
+
writable: true,
|
|
16071
|
+
signer: true
|
|
16072
|
+
},
|
|
16073
|
+
{
|
|
16074
|
+
name: "config",
|
|
16075
|
+
writable: true,
|
|
16076
|
+
pda: {
|
|
16077
|
+
seeds: [
|
|
16078
|
+
{
|
|
16079
|
+
kind: "const",
|
|
16080
|
+
value: [
|
|
16081
|
+
114,
|
|
16082
|
+
101,
|
|
16083
|
+
102,
|
|
16084
|
+
101,
|
|
16085
|
+
114,
|
|
16086
|
+
114,
|
|
16087
|
+
97,
|
|
16088
|
+
108,
|
|
16089
|
+
95,
|
|
16090
|
+
99,
|
|
16091
|
+
111,
|
|
16092
|
+
110,
|
|
16093
|
+
102,
|
|
16094
|
+
105,
|
|
16095
|
+
103
|
|
16096
|
+
]
|
|
16097
|
+
},
|
|
16098
|
+
{
|
|
16099
|
+
kind: "account",
|
|
16100
|
+
path: "config.owner",
|
|
16101
|
+
account: "ReferralConfig"
|
|
16102
|
+
}
|
|
16103
|
+
]
|
|
16104
|
+
}
|
|
16105
|
+
}
|
|
16106
|
+
],
|
|
16107
|
+
args: [
|
|
16108
|
+
{
|
|
16109
|
+
name: "address",
|
|
16110
|
+
type: "pubkey"
|
|
16111
|
+
}
|
|
16112
|
+
]
|
|
16113
|
+
}
|
|
16114
|
+
],
|
|
16115
|
+
accounts: [
|
|
16116
|
+
{
|
|
16117
|
+
name: "ReferralConfig",
|
|
16118
|
+
discriminator: [
|
|
16119
|
+
102,
|
|
16120
|
+
148,
|
|
16121
|
+
171,
|
|
16122
|
+
235,
|
|
16123
|
+
148,
|
|
16124
|
+
83,
|
|
16125
|
+
250,
|
|
16126
|
+
140
|
|
16127
|
+
]
|
|
16128
|
+
}
|
|
16129
|
+
],
|
|
16130
|
+
events: [
|
|
16131
|
+
{
|
|
16132
|
+
name: "BatchSent",
|
|
16133
|
+
discriminator: [
|
|
16134
|
+
116,
|
|
16135
|
+
64,
|
|
16136
|
+
207,
|
|
16137
|
+
63,
|
|
16138
|
+
56,
|
|
16139
|
+
97,
|
|
16140
|
+
15,
|
|
16141
|
+
100
|
|
16142
|
+
]
|
|
16143
|
+
},
|
|
16144
|
+
{
|
|
16145
|
+
name: "ReferralInitialized",
|
|
16146
|
+
discriminator: [
|
|
16147
|
+
129,
|
|
16148
|
+
190,
|
|
16149
|
+
249,
|
|
16150
|
+
4,
|
|
16151
|
+
198,
|
|
16152
|
+
5,
|
|
16153
|
+
141,
|
|
16154
|
+
226
|
|
16155
|
+
]
|
|
16156
|
+
}
|
|
16157
|
+
],
|
|
16158
|
+
types: [
|
|
16159
|
+
{
|
|
16160
|
+
name: "BatchSent",
|
|
16161
|
+
type: {
|
|
16162
|
+
kind: "struct",
|
|
16163
|
+
fields: [
|
|
16164
|
+
{
|
|
16165
|
+
name: "config",
|
|
16166
|
+
type: "pubkey"
|
|
16167
|
+
},
|
|
16168
|
+
{
|
|
16169
|
+
name: "sent_by",
|
|
16170
|
+
type: "pubkey"
|
|
16171
|
+
},
|
|
16172
|
+
{
|
|
16173
|
+
name: "recipients",
|
|
16174
|
+
type: "u8"
|
|
16175
|
+
}
|
|
16176
|
+
]
|
|
16177
|
+
}
|
|
16178
|
+
},
|
|
16179
|
+
{
|
|
16180
|
+
name: "ReferralConfig",
|
|
16181
|
+
type: {
|
|
16182
|
+
kind: "struct",
|
|
16183
|
+
fields: [
|
|
16184
|
+
{
|
|
16185
|
+
name: "version",
|
|
16186
|
+
type: "u8"
|
|
16187
|
+
},
|
|
16188
|
+
{
|
|
16189
|
+
name: "owner",
|
|
16190
|
+
type: "pubkey"
|
|
16191
|
+
},
|
|
16192
|
+
{
|
|
16193
|
+
name: "collateral_mint",
|
|
16194
|
+
type: "pubkey"
|
|
16195
|
+
},
|
|
16196
|
+
{
|
|
16197
|
+
name: "whitelist",
|
|
16198
|
+
type: {
|
|
16199
|
+
array: [
|
|
16200
|
+
"pubkey",
|
|
16201
|
+
10
|
|
16202
|
+
]
|
|
16203
|
+
}
|
|
16204
|
+
},
|
|
16205
|
+
{
|
|
16206
|
+
name: "whitelist_len",
|
|
16207
|
+
type: "u8"
|
|
16208
|
+
},
|
|
16209
|
+
{
|
|
16210
|
+
name: "bump",
|
|
16211
|
+
type: "u8"
|
|
16212
|
+
},
|
|
16213
|
+
{
|
|
16214
|
+
name: "_reserved",
|
|
16215
|
+
type: {
|
|
16216
|
+
array: [
|
|
16217
|
+
"u8",
|
|
16218
|
+
64
|
|
16219
|
+
]
|
|
16220
|
+
}
|
|
16221
|
+
}
|
|
16222
|
+
]
|
|
16223
|
+
}
|
|
16224
|
+
},
|
|
16225
|
+
{
|
|
16226
|
+
name: "ReferralInitialized",
|
|
16227
|
+
type: {
|
|
16228
|
+
kind: "struct",
|
|
16229
|
+
fields: [
|
|
16230
|
+
{
|
|
16231
|
+
name: "config",
|
|
16232
|
+
type: "pubkey"
|
|
16233
|
+
},
|
|
16234
|
+
{
|
|
16235
|
+
name: "owner",
|
|
16236
|
+
type: "pubkey"
|
|
16237
|
+
}
|
|
16238
|
+
]
|
|
16239
|
+
}
|
|
16240
|
+
}
|
|
16241
|
+
]
|
|
16242
|
+
};
|
|
16243
|
+
|
|
16244
|
+
// src/sdk.ts
|
|
16245
|
+
var XMarketSDK = class {
|
|
16246
|
+
constructor(config, wallet, marketOwner) {
|
|
16247
|
+
this.networkConfig = config;
|
|
16248
|
+
this.provider = new anchor5.AnchorProvider(
|
|
16249
|
+
new Connection(config.rpcUrl, "confirmed"),
|
|
16250
|
+
wallet,
|
|
16251
|
+
{ commitment: "confirmed", preflightCommitment: "confirmed" }
|
|
16252
|
+
);
|
|
16253
|
+
anchor5.setProvider(this.provider);
|
|
16254
|
+
this._programIds = config.programIds;
|
|
16255
|
+
this._marketOwner = marketOwner ?? wallet.publicKey;
|
|
16256
|
+
}
|
|
16257
|
+
_withAddress(idl, address) {
|
|
16258
|
+
return { ...idl, address: address.toBase58() };
|
|
16259
|
+
}
|
|
16260
|
+
get oracle() {
|
|
16261
|
+
if (!this._oracle) {
|
|
16262
|
+
const program = new anchor5.Program(this._withAddress(oracle_default, this._programIds.oracle), this.provider);
|
|
16263
|
+
this._oracle = new OracleClient(program, this.provider, this._programIds);
|
|
16264
|
+
}
|
|
16265
|
+
return this._oracle;
|
|
16266
|
+
}
|
|
16267
|
+
get hook() {
|
|
16268
|
+
if (!this._hook) {
|
|
16269
|
+
const program = new anchor5.Program(this._withAddress(hook_default, this._programIds.hook), this.provider);
|
|
16270
|
+
this._hook = new HookClient(program, this.provider, this._programIds);
|
|
16271
|
+
}
|
|
16272
|
+
return this._hook;
|
|
16273
|
+
}
|
|
16274
|
+
get market() {
|
|
16275
|
+
if (!this._market) {
|
|
16276
|
+
const program = new anchor5.Program(this._withAddress(question_market_default, this._programIds.questionMarket), this.provider);
|
|
16277
|
+
this._market = new MarketClient(program, this.provider, this._programIds, this._marketOwner);
|
|
16278
|
+
this._market.ctfClient = this.ctf;
|
|
16279
|
+
}
|
|
16280
|
+
return this._market;
|
|
16281
|
+
}
|
|
16282
|
+
get ctf() {
|
|
16283
|
+
if (!this._ctf) {
|
|
16284
|
+
const program = new anchor5.Program(this._withAddress(conditional_tokens_default, this._programIds.conditionalTokens), this.provider);
|
|
16285
|
+
this._ctf = new CtfClient(program, this.provider, this._programIds);
|
|
16286
|
+
}
|
|
16287
|
+
return this._ctf;
|
|
16288
|
+
}
|
|
16289
|
+
get clob() {
|
|
16290
|
+
if (!this._clob) {
|
|
16291
|
+
const program = new anchor5.Program(this._withAddress(clob_exchange_default, this._programIds.clobExchange), this.provider);
|
|
16292
|
+
this._clob = new ClobClient(program, this.provider, this._programIds, this.networkConfig);
|
|
16293
|
+
if (this.networkConfig.feeConfigOwner && this._programIds.feeManagement) {
|
|
16294
|
+
this._clob.feeConfigOwner = this.networkConfig.feeConfigOwner;
|
|
16295
|
+
this._clob.feeClient = this.fee;
|
|
16296
|
+
}
|
|
16297
|
+
}
|
|
16298
|
+
return this._clob;
|
|
16299
|
+
}
|
|
16300
|
+
get fee() {
|
|
16301
|
+
if (!this._fee) {
|
|
16302
|
+
if (!this._programIds.feeManagement) throw new Error("feeManagement program ID not configured in NetworkConfig");
|
|
16303
|
+
const program = new anchor5.Program(this._withAddress(fee_management_default, this._programIds.feeManagement), this.provider);
|
|
16304
|
+
this._fee = new FeeManagementClient(program, this.provider, this._programIds);
|
|
16305
|
+
}
|
|
16306
|
+
return this._fee;
|
|
16307
|
+
}
|
|
16308
|
+
get presale() {
|
|
16309
|
+
if (!this._presale) {
|
|
16310
|
+
if (!this._programIds.presale) throw new Error("presale program ID not configured in NetworkConfig");
|
|
16311
|
+
const program = new anchor5.Program(this._withAddress(presale_default, this._programIds.presale), this.provider);
|
|
16312
|
+
this._presale = new PresaleClient(program, this.provider, this._programIds);
|
|
16313
|
+
}
|
|
16314
|
+
return this._presale;
|
|
16315
|
+
}
|
|
16316
|
+
get marketOracle() {
|
|
16317
|
+
if (!this._marketOracle) {
|
|
16318
|
+
if (!this._programIds.marketOracle) throw new Error("marketOracle program ID not configured in NetworkConfig");
|
|
16319
|
+
const program = new anchor5.Program(this._withAddress(market_oracle_default, this._programIds.marketOracle), this.provider);
|
|
16320
|
+
this._marketOracle = new MarketOracleClient(program, this.provider, this._programIds);
|
|
16321
|
+
}
|
|
16322
|
+
return this._marketOracle;
|
|
16323
|
+
}
|
|
16324
|
+
get admin() {
|
|
16325
|
+
if (!this._admin) {
|
|
16326
|
+
if (!this._programIds.adminContract) throw new Error("adminContract program ID not configured in NetworkConfig");
|
|
16327
|
+
const program = new anchor5.Program(this._withAddress(admin_contract_default, this._programIds.adminContract), this.provider);
|
|
16328
|
+
this._admin = new AdminClient(program, this.provider, this._programIds);
|
|
16329
|
+
}
|
|
16330
|
+
return this._admin;
|
|
16331
|
+
}
|
|
16332
|
+
get referral() {
|
|
16333
|
+
if (!this._referral) {
|
|
16334
|
+
if (!this._programIds.referral) throw new Error("referral program ID not configured in NetworkConfig");
|
|
16335
|
+
const program = new anchor5.Program(this._withAddress(referral_default, this._programIds.referral), this.provider);
|
|
16336
|
+
this._referral = new ReferralClient(program, this.provider, this._programIds);
|
|
16337
|
+
}
|
|
16338
|
+
return this._referral;
|
|
15123
16339
|
}
|
|
15124
16340
|
};
|
|
15125
16341
|
var MAX_APPROVE_AMOUNT = new BN4("18446744073709551615");
|
|
@@ -15193,6 +16409,6 @@ function buildApproveAllOutcomeTokensTx(condition, signer, payer, delegate, prog
|
|
|
15193
16409
|
return tx;
|
|
15194
16410
|
}
|
|
15195
16411
|
|
|
15196
|
-
export { AccountNotFoundError, AdminClient, ClobClient, CtfClient, FEE_DENOMINATOR, FeeManagementClient, HookClient, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, MarketOracleClient, OracleClient, PDA, PresaleClient, QuestionStatus, SEEDS, UnauthorizedError, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
|
|
16412
|
+
export { AccountNotFoundError, AdminClient, ClobClient, CtfClient, FEE_DENOMINATOR, FeeManagementClient, HookClient, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, MarketOracleClient, OracleClient, PDA, PresaleClient, QuestionStatus, ReferralClient, SEEDS, UnauthorizedError, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedCollectFeeEd25519Instruction, buildBatchedEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeCollectFeeOrderToBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
|
|
15197
16413
|
//# sourceMappingURL=index.mjs.map
|
|
15198
16414
|
//# sourceMappingURL=index.mjs.map
|