@theliem/xmarket-sdk 3.3.1 → 3.4.1
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 +62 -2
- package/dist/index.d.ts +62 -2
- package/dist/index.js +1320 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1320 -95
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59,7 +59,10 @@ var SEEDS = {
|
|
|
59
59
|
userBuy: Buffer.from("user_buy"),
|
|
60
60
|
// Market Oracle
|
|
61
61
|
marketOracle: Buffer.from("market_oracle"),
|
|
62
|
-
userClaim: Buffer.from("user_claim")
|
|
62
|
+
userClaim: Buffer.from("user_claim"),
|
|
63
|
+
// Admin Contract
|
|
64
|
+
adminConfig: Buffer.from("admin_config"),
|
|
65
|
+
claimRecord: Buffer.from("claim_record")
|
|
63
66
|
};
|
|
64
67
|
var PDA = class {
|
|
65
68
|
// ─── Question Market ────────────────────────────────────────────────────────
|
|
@@ -247,6 +250,21 @@ var PDA = class {
|
|
|
247
250
|
programIds.marketOracle
|
|
248
251
|
);
|
|
249
252
|
}
|
|
253
|
+
// ─── Admin Contract ──────────────────────────────────────────────────────
|
|
254
|
+
static adminConfig(owner, programIds) {
|
|
255
|
+
if (!programIds.adminContract) throw new Error("adminContract program ID not configured");
|
|
256
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
257
|
+
[SEEDS.adminConfig, owner.toBuffer()],
|
|
258
|
+
programIds.adminContract
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
static claimRecord(conditionId, programIds) {
|
|
262
|
+
if (!programIds.adminContract) throw new Error("adminContract program ID not configured");
|
|
263
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
264
|
+
[SEEDS.claimRecord, conditionId],
|
|
265
|
+
programIds.adminContract
|
|
266
|
+
);
|
|
267
|
+
}
|
|
250
268
|
};
|
|
251
269
|
function generateQuestionId(content, salt) {
|
|
252
270
|
const input = content + (salt ?? Date.now());
|
|
@@ -849,13 +867,26 @@ var MarketClient = class {
|
|
|
849
867
|
* Whitelist-only: distribute presale vault → 10% agents + 10% company + 80% botmm.
|
|
850
868
|
* Closes presale_vault ATA and presale PDA after distribution; lamports returned to payer.
|
|
851
869
|
*/
|
|
852
|
-
async collectPresaleRevenue(
|
|
870
|
+
async collectPresaleRevenue(params) {
|
|
871
|
+
const {
|
|
872
|
+
presalePda,
|
|
873
|
+
currencyMint,
|
|
874
|
+
conditionId,
|
|
875
|
+
referralAddress,
|
|
876
|
+
companyAddress,
|
|
877
|
+
adminOwner
|
|
878
|
+
} = params;
|
|
879
|
+
const caller = params.caller ?? this.walletPubkey;
|
|
880
|
+
const payer = params.payer ?? this.walletPubkey;
|
|
853
881
|
if (!this.programIds.presale) throw new Error("presale program ID not configured");
|
|
882
|
+
if (!this.programIds.adminContract) throw new Error("adminContract program ID not configured");
|
|
854
883
|
const presaleVault = splToken.getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
855
884
|
const referralTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, referralAddress);
|
|
856
885
|
const companyTokenAccount = splToken.getAssociatedTokenAddressSync(currencyMint, companyAddress);
|
|
857
|
-
const
|
|
858
|
-
|
|
886
|
+
const [adminConfig] = PDA.adminConfig(adminOwner, this.programIds);
|
|
887
|
+
const [claimRecord] = PDA.claimRecord(conditionId, this.programIds);
|
|
888
|
+
const adminVault = splToken.getAssociatedTokenAddressSync(currencyMint, adminConfig, true);
|
|
889
|
+
return this.program.methods.collectPresaleRevenue(Array.from(conditionId)).accounts({
|
|
859
890
|
caller,
|
|
860
891
|
config: this.configPda,
|
|
861
892
|
presale: presalePda,
|
|
@@ -863,9 +894,12 @@ var MarketClient = class {
|
|
|
863
894
|
currencyMint,
|
|
864
895
|
referralTokenAccount,
|
|
865
896
|
companyTokenAccount,
|
|
866
|
-
|
|
897
|
+
adminVault,
|
|
898
|
+
adminConfig,
|
|
899
|
+
claimRecord,
|
|
867
900
|
payer,
|
|
868
901
|
presaleProgram: this.programIds.presale,
|
|
902
|
+
adminProgram: this.programIds.adminContract,
|
|
869
903
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
870
904
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
871
905
|
systemProgram: web3_js.SystemProgram.programId
|
|
@@ -1432,8 +1466,8 @@ var ClobClient = class {
|
|
|
1432
1466
|
async _sendLegacyTxSig(instructions) {
|
|
1433
1467
|
const { connection } = this.provider;
|
|
1434
1468
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1435
|
-
const { Transaction:
|
|
1436
|
-
const tx = new
|
|
1469
|
+
const { Transaction: Transaction8 } = await import('@solana/web3.js');
|
|
1470
|
+
const tx = new Transaction8();
|
|
1437
1471
|
tx.recentBlockhash = blockhash;
|
|
1438
1472
|
tx.feePayer = this.walletPubkey;
|
|
1439
1473
|
tx.add(...instructions);
|
|
@@ -1857,10 +1891,30 @@ ${logs.join("\n")}`);
|
|
|
1857
1891
|
const SIDE_BUY = 0;
|
|
1858
1892
|
const SIDE_SELL = 1;
|
|
1859
1893
|
if (t.tokenId === m0.tokenId) {
|
|
1894
|
+
let buySignedOrder, sellCandidates;
|
|
1860
1895
|
if (t.side === SIDE_BUY && makers.every((m) => m.order.side === SIDE_SELL)) {
|
|
1861
|
-
|
|
1896
|
+
buySignedOrder = taker;
|
|
1897
|
+
sellCandidates = makers;
|
|
1898
|
+
} else if (t.side === SIDE_SELL && makers.every((m) => m.order.side === SIDE_BUY)) {
|
|
1899
|
+
buySignedOrder = makers[0];
|
|
1900
|
+
sellCandidates = [taker, ...makers.slice(1)];
|
|
1901
|
+
} else {
|
|
1902
|
+
throw new InvalidParamError("COMPLEMENTARY requires one BUY and one or more SELLs on same tokenId");
|
|
1903
|
+
}
|
|
1904
|
+
const crossingSells = sellCandidates.filter((s) => {
|
|
1905
|
+
const buy = buySignedOrder.order;
|
|
1906
|
+
const sell = s.order;
|
|
1907
|
+
const lhs = BigInt(buy.makerAmount.toString()) * BigInt(sell.makerAmount.toString());
|
|
1908
|
+
const rhs = BigInt(buy.takerAmount.toString()) * BigInt(sell.takerAmount.toString());
|
|
1909
|
+
return lhs >= rhs;
|
|
1910
|
+
});
|
|
1911
|
+
if (crossingSells.length === 0) {
|
|
1912
|
+
throw new InvalidParamError("COMPLEMENTARY: no maker orders cross with the buy order");
|
|
1862
1913
|
}
|
|
1863
|
-
|
|
1914
|
+
if (crossingSells.length < sellCandidates.length) {
|
|
1915
|
+
console.warn(`[matchOrders] filtered ${sellCandidates.length - crossingSells.length} non-crossing maker(s)`);
|
|
1916
|
+
}
|
|
1917
|
+
return this.matchComplementary(buySignedOrder, crossingSells, collateralMint, feeRecipient, operatorWallet, alt, opts);
|
|
1864
1918
|
}
|
|
1865
1919
|
const allBuy = t.side === SIDE_BUY && makers.every((m) => m.order.side === SIDE_BUY);
|
|
1866
1920
|
const allSell = t.side === SIDE_SELL && makers.every((m) => m.order.side === SIDE_SELL);
|
|
@@ -2254,6 +2308,139 @@ var MarketOracleClient = class {
|
|
|
2254
2308
|
}
|
|
2255
2309
|
}
|
|
2256
2310
|
};
|
|
2311
|
+
var AdminClient = class {
|
|
2312
|
+
constructor(program, provider, programIds) {
|
|
2313
|
+
this.program = program;
|
|
2314
|
+
this.provider = provider;
|
|
2315
|
+
this.programIds = programIds;
|
|
2316
|
+
}
|
|
2317
|
+
get walletPubkey() {
|
|
2318
|
+
return this.provider.wallet.publicKey;
|
|
2319
|
+
}
|
|
2320
|
+
get configPda() {
|
|
2321
|
+
const [pda] = PDA.adminConfig(this.walletPubkey, this.programIds);
|
|
2322
|
+
return pda;
|
|
2323
|
+
}
|
|
2324
|
+
configPdaFor(owner) {
|
|
2325
|
+
const [pda] = PDA.adminConfig(owner, this.programIds);
|
|
2326
|
+
return pda;
|
|
2327
|
+
}
|
|
2328
|
+
adminVault(owner, collateralMint) {
|
|
2329
|
+
const configPda = this.configPdaFor(owner);
|
|
2330
|
+
return splToken.getAssociatedTokenAddressSync(collateralMint, configPda, true);
|
|
2331
|
+
}
|
|
2332
|
+
// ─── Fetch ────────────────────────────────────────────────────────────────
|
|
2333
|
+
async fetchConfig(owner = this.walletPubkey) {
|
|
2334
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2335
|
+
try {
|
|
2336
|
+
const acc = await this.program.account.adminConfig.fetch(configPda);
|
|
2337
|
+
return {
|
|
2338
|
+
version: acc.version,
|
|
2339
|
+
owner: acc.owner,
|
|
2340
|
+
collateralMint: acc.collateralMint,
|
|
2341
|
+
authorizedCaller: acc.authorizedCaller,
|
|
2342
|
+
adminWhitelist: acc.adminWhitelist.slice(0, acc.adminWhitelistLen),
|
|
2343
|
+
whitelist: acc.whitelist.slice(0, acc.whitelistLen),
|
|
2344
|
+
bump: acc.bump
|
|
2345
|
+
};
|
|
2346
|
+
} catch {
|
|
2347
|
+
return null;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
async fetchClaimRecord(conditionId) {
|
|
2351
|
+
const [pda] = PDA.claimRecord(conditionId, this.programIds);
|
|
2352
|
+
try {
|
|
2353
|
+
const acc = await this.program.account.claimRecord.fetch(pda);
|
|
2354
|
+
return {
|
|
2355
|
+
conditionId: acc.conditionId,
|
|
2356
|
+
amount: acc.amount,
|
|
2357
|
+
bump: acc.bump
|
|
2358
|
+
};
|
|
2359
|
+
} catch {
|
|
2360
|
+
return null;
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
// ─── Instructions ─────────────────────────────────────────────────────────
|
|
2364
|
+
async initialize(authorizedCaller, collateralMint, owner = this.walletPubkey) {
|
|
2365
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2366
|
+
const vault = splToken.getAssociatedTokenAddressSync(collateralMint, configPda, true);
|
|
2367
|
+
return this.program.methods.initialize(authorizedCaller).accounts({
|
|
2368
|
+
owner,
|
|
2369
|
+
config: configPda,
|
|
2370
|
+
collateralMint,
|
|
2371
|
+
adminVault: vault,
|
|
2372
|
+
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
2373
|
+
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2374
|
+
systemProgram: web3_js.SystemProgram.programId
|
|
2375
|
+
}).transaction();
|
|
2376
|
+
}
|
|
2377
|
+
async addAdmin(address, owner = this.walletPubkey) {
|
|
2378
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2379
|
+
return this.program.methods.addAdmin(address).accounts({ owner, config: configPda }).transaction();
|
|
2380
|
+
}
|
|
2381
|
+
async removeAdmin(address, owner = this.walletPubkey) {
|
|
2382
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2383
|
+
return this.program.methods.removeAdmin(address).accounts({ owner, config: configPda }).transaction();
|
|
2384
|
+
}
|
|
2385
|
+
async addToWhitelist(address, owner, admin = this.walletPubkey, payer = admin) {
|
|
2386
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2387
|
+
return this.program.methods.addToWhitelist(address).accounts({ admin, payer, config: configPda }).transaction();
|
|
2388
|
+
}
|
|
2389
|
+
async removeFromWhitelist(address, owner, admin = this.walletPubkey, payer = admin) {
|
|
2390
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2391
|
+
return this.program.methods.removeFromWhitelist(address).accounts({ admin, payer, config: configPda }).transaction();
|
|
2392
|
+
}
|
|
2393
|
+
/**
|
|
2394
|
+
* Normally called via CPI from question_market (authorized_caller signs).
|
|
2395
|
+
* For testing: initialize with authorizedCaller = wallet, call directly.
|
|
2396
|
+
*/
|
|
2397
|
+
async setPresaleAmount(conditionId, amount, owner = this.walletPubkey, caller = this.walletPubkey, payer = caller) {
|
|
2398
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2399
|
+
const [claimRecord] = PDA.claimRecord(conditionId, this.programIds);
|
|
2400
|
+
return this.program.methods.setPresaleAmount(Array.from(conditionId), amount).accounts({
|
|
2401
|
+
caller,
|
|
2402
|
+
payer,
|
|
2403
|
+
config: configPda,
|
|
2404
|
+
claimRecord,
|
|
2405
|
+
systemProgram: web3_js.SystemProgram.programId
|
|
2406
|
+
}).transaction();
|
|
2407
|
+
}
|
|
2408
|
+
async claim(conditionId, collateralMint, owner, claimer = this.walletPubkey, payer = claimer) {
|
|
2409
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2410
|
+
const [claimRecord] = PDA.claimRecord(conditionId, this.programIds);
|
|
2411
|
+
const vault = splToken.getAssociatedTokenAddressSync(collateralMint, configPda, true);
|
|
2412
|
+
const claimerAta = splToken.getAssociatedTokenAddressSync(collateralMint, claimer);
|
|
2413
|
+
return this.program.methods.claim(Array.from(conditionId)).accounts({
|
|
2414
|
+
claimer,
|
|
2415
|
+
payer,
|
|
2416
|
+
config: configPda,
|
|
2417
|
+
adminVault: vault,
|
|
2418
|
+
claimRecord,
|
|
2419
|
+
claimerTokenAccount: claimerAta,
|
|
2420
|
+
tokenProgram: splToken.TOKEN_PROGRAM_ID
|
|
2421
|
+
}).transaction();
|
|
2422
|
+
}
|
|
2423
|
+
async updateConfig(authorizedCaller, owner = this.walletPubkey) {
|
|
2424
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2425
|
+
return this.program.methods.updateConfig(authorizedCaller).accounts({ owner, config: configPda }).transaction();
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
* BOTMM sends USDC from their wallet to the market_oracle vault for a condition.
|
|
2429
|
+
* Whitelist-only. No amount validation — caller responsible.
|
|
2430
|
+
*/
|
|
2431
|
+
async distributeMarket(conditionId, amount, collateralMint, marketOracleVault, owner, claimer = this.walletPubkey, payer = claimer) {
|
|
2432
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2433
|
+
const claimerTokenAcct = splToken.getAssociatedTokenAddressSync(collateralMint, claimer);
|
|
2434
|
+
return this.program.methods.distributeMarket(Array.from(conditionId), amount).accounts({
|
|
2435
|
+
claimer,
|
|
2436
|
+
payer,
|
|
2437
|
+
config: configPda,
|
|
2438
|
+
claimerTokenAccount: claimerTokenAcct,
|
|
2439
|
+
marketOracleVault,
|
|
2440
|
+
tokenProgram: splToken.TOKEN_PROGRAM_ID
|
|
2441
|
+
}).transaction();
|
|
2442
|
+
}
|
|
2443
|
+
};
|
|
2257
2444
|
|
|
2258
2445
|
// src/idls/oracle.json
|
|
2259
2446
|
var oracle_default = {
|
|
@@ -3820,7 +4007,7 @@ var question_market_default = {
|
|
|
3820
4007
|
{
|
|
3821
4008
|
name: "presale_vault",
|
|
3822
4009
|
docs: [
|
|
3823
|
-
"Presale USDC vault \u2014 closed inside presale program"
|
|
4010
|
+
"Presale USDC vault \u2014 read balance before CPI, closed inside presale program"
|
|
3824
4011
|
],
|
|
3825
4012
|
writable: true
|
|
3826
4013
|
},
|
|
@@ -3830,24 +4017,66 @@ var question_market_default = {
|
|
|
3830
4017
|
{
|
|
3831
4018
|
name: "referral_token_account",
|
|
3832
4019
|
docs: [
|
|
3833
|
-
"Referral address USDC token account"
|
|
4020
|
+
"Referral address USDC token account (10%)"
|
|
3834
4021
|
],
|
|
3835
4022
|
writable: true
|
|
3836
4023
|
},
|
|
3837
4024
|
{
|
|
3838
4025
|
name: "company_token_account",
|
|
3839
4026
|
docs: [
|
|
3840
|
-
"Company address USDC token account"
|
|
4027
|
+
"Company address USDC token account (10%)"
|
|
3841
4028
|
],
|
|
3842
4029
|
writable: true
|
|
3843
4030
|
},
|
|
3844
4031
|
{
|
|
3845
|
-
name: "
|
|
4032
|
+
name: "admin_vault",
|
|
3846
4033
|
docs: [
|
|
3847
|
-
"
|
|
4034
|
+
"admin_contract vault ATA \u2014 receives 80% instead of BOTMM wallet directly"
|
|
3848
4035
|
],
|
|
3849
4036
|
writable: true
|
|
3850
4037
|
},
|
|
4038
|
+
{
|
|
4039
|
+
name: "admin_config",
|
|
4040
|
+
docs: [
|
|
4041
|
+
"admin_contract config PDA"
|
|
4042
|
+
]
|
|
4043
|
+
},
|
|
4044
|
+
{
|
|
4045
|
+
name: "claim_record",
|
|
4046
|
+
docs: [
|
|
4047
|
+
"ClaimRecord PDA for this conditionId (created by admin_contract CPI)"
|
|
4048
|
+
],
|
|
4049
|
+
writable: true,
|
|
4050
|
+
pda: {
|
|
4051
|
+
seeds: [
|
|
4052
|
+
{
|
|
4053
|
+
kind: "const",
|
|
4054
|
+
value: [
|
|
4055
|
+
99,
|
|
4056
|
+
108,
|
|
4057
|
+
97,
|
|
4058
|
+
105,
|
|
4059
|
+
109,
|
|
4060
|
+
95,
|
|
4061
|
+
114,
|
|
4062
|
+
101,
|
|
4063
|
+
99,
|
|
4064
|
+
111,
|
|
4065
|
+
114,
|
|
4066
|
+
100
|
|
4067
|
+
]
|
|
4068
|
+
},
|
|
4069
|
+
{
|
|
4070
|
+
kind: "arg",
|
|
4071
|
+
path: "condition_id"
|
|
4072
|
+
}
|
|
4073
|
+
],
|
|
4074
|
+
program: {
|
|
4075
|
+
kind: "account",
|
|
4076
|
+
path: "admin_program"
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
},
|
|
3851
4080
|
{
|
|
3852
4081
|
name: "payer",
|
|
3853
4082
|
docs: [
|
|
@@ -3859,6 +4088,10 @@ var question_market_default = {
|
|
|
3859
4088
|
name: "presale_program",
|
|
3860
4089
|
address: "2Rnw1VoEtsUMQ7wkvYZjDehqSqRob6uNkeymDfvKrquB"
|
|
3861
4090
|
},
|
|
4091
|
+
{
|
|
4092
|
+
name: "admin_program",
|
|
4093
|
+
address: "4NdD5962SfGqofmeyjfifJpdGnwTAiKaUKB5Z42UDc9T"
|
|
4094
|
+
},
|
|
3862
4095
|
{
|
|
3863
4096
|
name: "token_program",
|
|
3864
4097
|
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
@@ -3872,7 +4105,17 @@ var question_market_default = {
|
|
|
3872
4105
|
address: "11111111111111111111111111111111"
|
|
3873
4106
|
}
|
|
3874
4107
|
],
|
|
3875
|
-
args: [
|
|
4108
|
+
args: [
|
|
4109
|
+
{
|
|
4110
|
+
name: "condition_id",
|
|
4111
|
+
type: {
|
|
4112
|
+
array: [
|
|
4113
|
+
"u8",
|
|
4114
|
+
32
|
|
4115
|
+
]
|
|
4116
|
+
}
|
|
4117
|
+
}
|
|
4118
|
+
]
|
|
3876
4119
|
},
|
|
3877
4120
|
{
|
|
3878
4121
|
name: "collect_trading_fee",
|
|
@@ -13220,85 +13463,1067 @@ var market_oracle_default = {
|
|
|
13220
13463
|
]
|
|
13221
13464
|
};
|
|
13222
13465
|
|
|
13223
|
-
// src/
|
|
13224
|
-
var
|
|
13225
|
-
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
|
|
13262
|
-
|
|
13263
|
-
|
|
13264
|
-
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13466
|
+
// src/idls/admin_contract.json
|
|
13467
|
+
var admin_contract_default = {
|
|
13468
|
+
address: "4NdD5962SfGqofmeyjfifJpdGnwTAiKaUKB5Z42UDc9T",
|
|
13469
|
+
metadata: {
|
|
13470
|
+
name: "admin_contract",
|
|
13471
|
+
version: "0.1.0",
|
|
13472
|
+
spec: "0.1.0",
|
|
13473
|
+
description: "Admin contract for XMarket \u2014 whitelist, presale revenue custody, claim"
|
|
13474
|
+
},
|
|
13475
|
+
instructions: [
|
|
13476
|
+
{
|
|
13477
|
+
name: "add_admin",
|
|
13478
|
+
discriminator: [
|
|
13479
|
+
177,
|
|
13480
|
+
236,
|
|
13481
|
+
33,
|
|
13482
|
+
205,
|
|
13483
|
+
124,
|
|
13484
|
+
152,
|
|
13485
|
+
55,
|
|
13486
|
+
186
|
|
13487
|
+
],
|
|
13488
|
+
accounts: [
|
|
13489
|
+
{
|
|
13490
|
+
name: "owner",
|
|
13491
|
+
signer: true
|
|
13492
|
+
},
|
|
13493
|
+
{
|
|
13494
|
+
name: "config",
|
|
13495
|
+
writable: true,
|
|
13496
|
+
pda: {
|
|
13497
|
+
seeds: [
|
|
13498
|
+
{
|
|
13499
|
+
kind: "const",
|
|
13500
|
+
value: [
|
|
13501
|
+
97,
|
|
13502
|
+
100,
|
|
13503
|
+
109,
|
|
13504
|
+
105,
|
|
13505
|
+
110,
|
|
13506
|
+
95,
|
|
13507
|
+
99,
|
|
13508
|
+
111,
|
|
13509
|
+
110,
|
|
13510
|
+
102,
|
|
13511
|
+
105,
|
|
13512
|
+
103
|
|
13513
|
+
]
|
|
13514
|
+
},
|
|
13515
|
+
{
|
|
13516
|
+
kind: "account",
|
|
13517
|
+
path: "config.owner",
|
|
13518
|
+
account: "AdminConfig"
|
|
13519
|
+
}
|
|
13520
|
+
]
|
|
13521
|
+
}
|
|
13522
|
+
}
|
|
13523
|
+
],
|
|
13524
|
+
args: [
|
|
13525
|
+
{
|
|
13526
|
+
name: "address",
|
|
13527
|
+
type: "pubkey"
|
|
13528
|
+
}
|
|
13529
|
+
]
|
|
13530
|
+
},
|
|
13531
|
+
{
|
|
13532
|
+
name: "add_to_whitelist",
|
|
13533
|
+
discriminator: [
|
|
13534
|
+
157,
|
|
13535
|
+
211,
|
|
13536
|
+
52,
|
|
13537
|
+
54,
|
|
13538
|
+
144,
|
|
13539
|
+
81,
|
|
13540
|
+
5,
|
|
13541
|
+
55
|
|
13542
|
+
],
|
|
13543
|
+
accounts: [
|
|
13544
|
+
{
|
|
13545
|
+
name: "admin",
|
|
13546
|
+
signer: true
|
|
13547
|
+
},
|
|
13548
|
+
{
|
|
13549
|
+
name: "payer",
|
|
13550
|
+
writable: true,
|
|
13551
|
+
signer: true
|
|
13552
|
+
},
|
|
13553
|
+
{
|
|
13554
|
+
name: "config",
|
|
13555
|
+
writable: true,
|
|
13556
|
+
pda: {
|
|
13557
|
+
seeds: [
|
|
13558
|
+
{
|
|
13559
|
+
kind: "const",
|
|
13560
|
+
value: [
|
|
13561
|
+
97,
|
|
13562
|
+
100,
|
|
13563
|
+
109,
|
|
13564
|
+
105,
|
|
13565
|
+
110,
|
|
13566
|
+
95,
|
|
13567
|
+
99,
|
|
13568
|
+
111,
|
|
13569
|
+
110,
|
|
13570
|
+
102,
|
|
13571
|
+
105,
|
|
13572
|
+
103
|
|
13573
|
+
]
|
|
13574
|
+
},
|
|
13575
|
+
{
|
|
13576
|
+
kind: "account",
|
|
13577
|
+
path: "config.owner",
|
|
13578
|
+
account: "AdminConfig"
|
|
13579
|
+
}
|
|
13580
|
+
]
|
|
13581
|
+
}
|
|
13582
|
+
}
|
|
13583
|
+
],
|
|
13584
|
+
args: [
|
|
13585
|
+
{
|
|
13586
|
+
name: "address",
|
|
13587
|
+
type: "pubkey"
|
|
13588
|
+
}
|
|
13589
|
+
]
|
|
13590
|
+
},
|
|
13591
|
+
{
|
|
13592
|
+
name: "claim",
|
|
13593
|
+
discriminator: [
|
|
13594
|
+
62,
|
|
13595
|
+
198,
|
|
13596
|
+
214,
|
|
13597
|
+
193,
|
|
13598
|
+
213,
|
|
13599
|
+
159,
|
|
13600
|
+
108,
|
|
13601
|
+
210
|
|
13602
|
+
],
|
|
13603
|
+
accounts: [
|
|
13604
|
+
{
|
|
13605
|
+
name: "claimer",
|
|
13606
|
+
signer: true
|
|
13607
|
+
},
|
|
13608
|
+
{
|
|
13609
|
+
name: "payer",
|
|
13610
|
+
writable: true,
|
|
13611
|
+
signer: true
|
|
13612
|
+
},
|
|
13613
|
+
{
|
|
13614
|
+
name: "config",
|
|
13615
|
+
pda: {
|
|
13616
|
+
seeds: [
|
|
13617
|
+
{
|
|
13618
|
+
kind: "const",
|
|
13619
|
+
value: [
|
|
13620
|
+
97,
|
|
13621
|
+
100,
|
|
13622
|
+
109,
|
|
13623
|
+
105,
|
|
13624
|
+
110,
|
|
13625
|
+
95,
|
|
13626
|
+
99,
|
|
13627
|
+
111,
|
|
13628
|
+
110,
|
|
13629
|
+
102,
|
|
13630
|
+
105,
|
|
13631
|
+
103
|
|
13632
|
+
]
|
|
13633
|
+
},
|
|
13634
|
+
{
|
|
13635
|
+
kind: "account",
|
|
13636
|
+
path: "config.owner",
|
|
13637
|
+
account: "AdminConfig"
|
|
13638
|
+
}
|
|
13639
|
+
]
|
|
13640
|
+
}
|
|
13641
|
+
},
|
|
13642
|
+
{
|
|
13643
|
+
name: "admin_vault",
|
|
13644
|
+
docs: [
|
|
13645
|
+
"ATA owned by config PDA"
|
|
13646
|
+
],
|
|
13647
|
+
writable: true,
|
|
13648
|
+
pda: {
|
|
13649
|
+
seeds: [
|
|
13650
|
+
{
|
|
13651
|
+
kind: "account",
|
|
13652
|
+
path: "config"
|
|
13653
|
+
},
|
|
13654
|
+
{
|
|
13655
|
+
kind: "const",
|
|
13656
|
+
value: [
|
|
13657
|
+
6,
|
|
13658
|
+
221,
|
|
13659
|
+
246,
|
|
13660
|
+
225,
|
|
13661
|
+
215,
|
|
13662
|
+
101,
|
|
13663
|
+
161,
|
|
13664
|
+
147,
|
|
13665
|
+
217,
|
|
13666
|
+
203,
|
|
13667
|
+
225,
|
|
13668
|
+
70,
|
|
13669
|
+
206,
|
|
13670
|
+
235,
|
|
13671
|
+
121,
|
|
13672
|
+
172,
|
|
13673
|
+
28,
|
|
13674
|
+
180,
|
|
13675
|
+
133,
|
|
13676
|
+
237,
|
|
13677
|
+
95,
|
|
13678
|
+
91,
|
|
13679
|
+
55,
|
|
13680
|
+
145,
|
|
13681
|
+
58,
|
|
13682
|
+
140,
|
|
13683
|
+
245,
|
|
13684
|
+
133,
|
|
13685
|
+
126,
|
|
13686
|
+
255,
|
|
13687
|
+
0,
|
|
13688
|
+
169
|
|
13689
|
+
]
|
|
13690
|
+
},
|
|
13691
|
+
{
|
|
13692
|
+
kind: "account",
|
|
13693
|
+
path: "config.collateral_mint",
|
|
13694
|
+
account: "AdminConfig"
|
|
13695
|
+
}
|
|
13696
|
+
],
|
|
13697
|
+
program: {
|
|
13698
|
+
kind: "const",
|
|
13699
|
+
value: [
|
|
13700
|
+
140,
|
|
13701
|
+
151,
|
|
13702
|
+
37,
|
|
13703
|
+
143,
|
|
13704
|
+
78,
|
|
13705
|
+
36,
|
|
13706
|
+
137,
|
|
13707
|
+
241,
|
|
13708
|
+
187,
|
|
13709
|
+
61,
|
|
13710
|
+
16,
|
|
13711
|
+
41,
|
|
13712
|
+
20,
|
|
13713
|
+
142,
|
|
13714
|
+
13,
|
|
13715
|
+
131,
|
|
13716
|
+
11,
|
|
13717
|
+
90,
|
|
13718
|
+
19,
|
|
13719
|
+
153,
|
|
13720
|
+
218,
|
|
13721
|
+
255,
|
|
13722
|
+
16,
|
|
13723
|
+
132,
|
|
13724
|
+
4,
|
|
13725
|
+
142,
|
|
13726
|
+
123,
|
|
13727
|
+
216,
|
|
13728
|
+
219,
|
|
13729
|
+
233,
|
|
13730
|
+
248,
|
|
13731
|
+
89
|
|
13732
|
+
]
|
|
13733
|
+
}
|
|
13734
|
+
}
|
|
13735
|
+
},
|
|
13736
|
+
{
|
|
13737
|
+
name: "claim_record",
|
|
13738
|
+
writable: true,
|
|
13739
|
+
pda: {
|
|
13740
|
+
seeds: [
|
|
13741
|
+
{
|
|
13742
|
+
kind: "const",
|
|
13743
|
+
value: [
|
|
13744
|
+
99,
|
|
13745
|
+
108,
|
|
13746
|
+
97,
|
|
13747
|
+
105,
|
|
13748
|
+
109,
|
|
13749
|
+
95,
|
|
13750
|
+
114,
|
|
13751
|
+
101,
|
|
13752
|
+
99,
|
|
13753
|
+
111,
|
|
13754
|
+
114,
|
|
13755
|
+
100
|
|
13756
|
+
]
|
|
13757
|
+
},
|
|
13758
|
+
{
|
|
13759
|
+
kind: "arg",
|
|
13760
|
+
path: "condition_id"
|
|
13761
|
+
}
|
|
13762
|
+
]
|
|
13763
|
+
}
|
|
13764
|
+
},
|
|
13765
|
+
{
|
|
13766
|
+
name: "claimer_token_account",
|
|
13767
|
+
docs: [
|
|
13768
|
+
"Claimer's USDC token account (receives payout)"
|
|
13769
|
+
],
|
|
13770
|
+
writable: true
|
|
13771
|
+
},
|
|
13772
|
+
{
|
|
13773
|
+
name: "token_program",
|
|
13774
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
13775
|
+
}
|
|
13776
|
+
],
|
|
13777
|
+
args: [
|
|
13778
|
+
{
|
|
13779
|
+
name: "condition_id",
|
|
13780
|
+
type: {
|
|
13781
|
+
array: [
|
|
13782
|
+
"u8",
|
|
13783
|
+
32
|
|
13784
|
+
]
|
|
13785
|
+
}
|
|
13786
|
+
}
|
|
13787
|
+
]
|
|
13788
|
+
},
|
|
13789
|
+
{
|
|
13790
|
+
name: "distribute_market",
|
|
13791
|
+
discriminator: [
|
|
13792
|
+
130,
|
|
13793
|
+
221,
|
|
13794
|
+
123,
|
|
13795
|
+
201,
|
|
13796
|
+
185,
|
|
13797
|
+
168,
|
|
13798
|
+
63,
|
|
13799
|
+
19
|
|
13800
|
+
],
|
|
13801
|
+
accounts: [
|
|
13802
|
+
{
|
|
13803
|
+
name: "claimer",
|
|
13804
|
+
docs: [
|
|
13805
|
+
"BOTMM \u2014 must be in whitelist"
|
|
13806
|
+
],
|
|
13807
|
+
signer: true
|
|
13808
|
+
},
|
|
13809
|
+
{
|
|
13810
|
+
name: "payer",
|
|
13811
|
+
writable: true,
|
|
13812
|
+
signer: true
|
|
13813
|
+
},
|
|
13814
|
+
{
|
|
13815
|
+
name: "config",
|
|
13816
|
+
pda: {
|
|
13817
|
+
seeds: [
|
|
13818
|
+
{
|
|
13819
|
+
kind: "const",
|
|
13820
|
+
value: [
|
|
13821
|
+
97,
|
|
13822
|
+
100,
|
|
13823
|
+
109,
|
|
13824
|
+
105,
|
|
13825
|
+
110,
|
|
13826
|
+
95,
|
|
13827
|
+
99,
|
|
13828
|
+
111,
|
|
13829
|
+
110,
|
|
13830
|
+
102,
|
|
13831
|
+
105,
|
|
13832
|
+
103
|
|
13833
|
+
]
|
|
13834
|
+
},
|
|
13835
|
+
{
|
|
13836
|
+
kind: "account",
|
|
13837
|
+
path: "config.owner",
|
|
13838
|
+
account: "AdminConfig"
|
|
13839
|
+
}
|
|
13840
|
+
]
|
|
13841
|
+
}
|
|
13842
|
+
},
|
|
13843
|
+
{
|
|
13844
|
+
name: "claimer_token_account",
|
|
13845
|
+
docs: [
|
|
13846
|
+
"BOTMM's USDC token account (source \u2014 claimer signs)"
|
|
13847
|
+
],
|
|
13848
|
+
writable: true
|
|
13849
|
+
},
|
|
13850
|
+
{
|
|
13851
|
+
name: "market_oracle_vault",
|
|
13852
|
+
docs: [
|
|
13853
|
+
"market_oracle vault \u2014 MST holder reward pool for this condition"
|
|
13854
|
+
],
|
|
13855
|
+
writable: true
|
|
13856
|
+
},
|
|
13857
|
+
{
|
|
13858
|
+
name: "token_program",
|
|
13859
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
13860
|
+
}
|
|
13861
|
+
],
|
|
13862
|
+
args: [
|
|
13863
|
+
{
|
|
13864
|
+
name: "condition_id",
|
|
13865
|
+
type: {
|
|
13866
|
+
array: [
|
|
13867
|
+
"u8",
|
|
13868
|
+
32
|
|
13869
|
+
]
|
|
13870
|
+
}
|
|
13871
|
+
},
|
|
13872
|
+
{
|
|
13873
|
+
name: "amount",
|
|
13874
|
+
type: "u64"
|
|
13875
|
+
}
|
|
13876
|
+
]
|
|
13877
|
+
},
|
|
13878
|
+
{
|
|
13879
|
+
name: "initialize",
|
|
13880
|
+
discriminator: [
|
|
13881
|
+
175,
|
|
13882
|
+
175,
|
|
13883
|
+
109,
|
|
13884
|
+
31,
|
|
13885
|
+
13,
|
|
13886
|
+
152,
|
|
13887
|
+
155,
|
|
13888
|
+
237
|
|
13889
|
+
],
|
|
13890
|
+
accounts: [
|
|
13891
|
+
{
|
|
13892
|
+
name: "owner",
|
|
13893
|
+
writable: true,
|
|
13894
|
+
signer: true
|
|
13895
|
+
},
|
|
13896
|
+
{
|
|
13897
|
+
name: "config",
|
|
13898
|
+
writable: true,
|
|
13899
|
+
pda: {
|
|
13900
|
+
seeds: [
|
|
13901
|
+
{
|
|
13902
|
+
kind: "const",
|
|
13903
|
+
value: [
|
|
13904
|
+
97,
|
|
13905
|
+
100,
|
|
13906
|
+
109,
|
|
13907
|
+
105,
|
|
13908
|
+
110,
|
|
13909
|
+
95,
|
|
13910
|
+
99,
|
|
13911
|
+
111,
|
|
13912
|
+
110,
|
|
13913
|
+
102,
|
|
13914
|
+
105,
|
|
13915
|
+
103
|
|
13916
|
+
]
|
|
13917
|
+
},
|
|
13918
|
+
{
|
|
13919
|
+
kind: "account",
|
|
13920
|
+
path: "owner"
|
|
13921
|
+
}
|
|
13922
|
+
]
|
|
13923
|
+
}
|
|
13924
|
+
},
|
|
13925
|
+
{
|
|
13926
|
+
name: "collateral_mint"
|
|
13927
|
+
},
|
|
13928
|
+
{
|
|
13929
|
+
name: "admin_vault",
|
|
13930
|
+
docs: [
|
|
13931
|
+
"ATA owned by config PDA \u2014 holds USDC for unclaimed presale revenue"
|
|
13932
|
+
],
|
|
13933
|
+
writable: true,
|
|
13934
|
+
pda: {
|
|
13935
|
+
seeds: [
|
|
13936
|
+
{
|
|
13937
|
+
kind: "account",
|
|
13938
|
+
path: "config"
|
|
13939
|
+
},
|
|
13940
|
+
{
|
|
13941
|
+
kind: "const",
|
|
13942
|
+
value: [
|
|
13943
|
+
6,
|
|
13944
|
+
221,
|
|
13945
|
+
246,
|
|
13946
|
+
225,
|
|
13947
|
+
215,
|
|
13948
|
+
101,
|
|
13949
|
+
161,
|
|
13950
|
+
147,
|
|
13951
|
+
217,
|
|
13952
|
+
203,
|
|
13953
|
+
225,
|
|
13954
|
+
70,
|
|
13955
|
+
206,
|
|
13956
|
+
235,
|
|
13957
|
+
121,
|
|
13958
|
+
172,
|
|
13959
|
+
28,
|
|
13960
|
+
180,
|
|
13961
|
+
133,
|
|
13962
|
+
237,
|
|
13963
|
+
95,
|
|
13964
|
+
91,
|
|
13965
|
+
55,
|
|
13966
|
+
145,
|
|
13967
|
+
58,
|
|
13968
|
+
140,
|
|
13969
|
+
245,
|
|
13970
|
+
133,
|
|
13971
|
+
126,
|
|
13972
|
+
255,
|
|
13973
|
+
0,
|
|
13974
|
+
169
|
|
13975
|
+
]
|
|
13976
|
+
},
|
|
13977
|
+
{
|
|
13978
|
+
kind: "account",
|
|
13979
|
+
path: "collateral_mint"
|
|
13980
|
+
}
|
|
13981
|
+
],
|
|
13982
|
+
program: {
|
|
13983
|
+
kind: "const",
|
|
13984
|
+
value: [
|
|
13985
|
+
140,
|
|
13986
|
+
151,
|
|
13987
|
+
37,
|
|
13988
|
+
143,
|
|
13989
|
+
78,
|
|
13990
|
+
36,
|
|
13991
|
+
137,
|
|
13992
|
+
241,
|
|
13993
|
+
187,
|
|
13994
|
+
61,
|
|
13995
|
+
16,
|
|
13996
|
+
41,
|
|
13997
|
+
20,
|
|
13998
|
+
142,
|
|
13999
|
+
13,
|
|
14000
|
+
131,
|
|
14001
|
+
11,
|
|
14002
|
+
90,
|
|
14003
|
+
19,
|
|
14004
|
+
153,
|
|
14005
|
+
218,
|
|
14006
|
+
255,
|
|
14007
|
+
16,
|
|
14008
|
+
132,
|
|
14009
|
+
4,
|
|
14010
|
+
142,
|
|
14011
|
+
123,
|
|
14012
|
+
216,
|
|
14013
|
+
219,
|
|
14014
|
+
233,
|
|
14015
|
+
248,
|
|
14016
|
+
89
|
|
14017
|
+
]
|
|
14018
|
+
}
|
|
14019
|
+
}
|
|
14020
|
+
},
|
|
14021
|
+
{
|
|
14022
|
+
name: "token_program",
|
|
14023
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
14024
|
+
},
|
|
14025
|
+
{
|
|
14026
|
+
name: "associated_token_program",
|
|
14027
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
14028
|
+
},
|
|
14029
|
+
{
|
|
14030
|
+
name: "system_program",
|
|
14031
|
+
address: "11111111111111111111111111111111"
|
|
14032
|
+
}
|
|
14033
|
+
],
|
|
14034
|
+
args: [
|
|
14035
|
+
{
|
|
14036
|
+
name: "authorized_caller",
|
|
14037
|
+
type: "pubkey"
|
|
14038
|
+
}
|
|
14039
|
+
]
|
|
14040
|
+
},
|
|
14041
|
+
{
|
|
14042
|
+
name: "remove_admin",
|
|
14043
|
+
discriminator: [
|
|
14044
|
+
74,
|
|
14045
|
+
202,
|
|
14046
|
+
71,
|
|
14047
|
+
106,
|
|
14048
|
+
252,
|
|
14049
|
+
31,
|
|
14050
|
+
72,
|
|
14051
|
+
183
|
|
14052
|
+
],
|
|
14053
|
+
accounts: [
|
|
14054
|
+
{
|
|
14055
|
+
name: "owner",
|
|
14056
|
+
signer: true
|
|
14057
|
+
},
|
|
14058
|
+
{
|
|
14059
|
+
name: "config",
|
|
14060
|
+
writable: true,
|
|
14061
|
+
pda: {
|
|
14062
|
+
seeds: [
|
|
14063
|
+
{
|
|
14064
|
+
kind: "const",
|
|
14065
|
+
value: [
|
|
14066
|
+
97,
|
|
14067
|
+
100,
|
|
14068
|
+
109,
|
|
14069
|
+
105,
|
|
14070
|
+
110,
|
|
14071
|
+
95,
|
|
14072
|
+
99,
|
|
14073
|
+
111,
|
|
14074
|
+
110,
|
|
14075
|
+
102,
|
|
14076
|
+
105,
|
|
14077
|
+
103
|
|
14078
|
+
]
|
|
14079
|
+
},
|
|
14080
|
+
{
|
|
14081
|
+
kind: "account",
|
|
14082
|
+
path: "config.owner",
|
|
14083
|
+
account: "AdminConfig"
|
|
14084
|
+
}
|
|
14085
|
+
]
|
|
14086
|
+
}
|
|
14087
|
+
}
|
|
14088
|
+
],
|
|
14089
|
+
args: [
|
|
14090
|
+
{
|
|
14091
|
+
name: "address",
|
|
14092
|
+
type: "pubkey"
|
|
14093
|
+
}
|
|
14094
|
+
]
|
|
14095
|
+
},
|
|
14096
|
+
{
|
|
14097
|
+
name: "remove_from_whitelist",
|
|
14098
|
+
discriminator: [
|
|
14099
|
+
7,
|
|
14100
|
+
144,
|
|
14101
|
+
216,
|
|
14102
|
+
239,
|
|
14103
|
+
243,
|
|
14104
|
+
236,
|
|
14105
|
+
193,
|
|
14106
|
+
235
|
|
14107
|
+
],
|
|
14108
|
+
accounts: [
|
|
14109
|
+
{
|
|
14110
|
+
name: "admin",
|
|
14111
|
+
signer: true
|
|
14112
|
+
},
|
|
14113
|
+
{
|
|
14114
|
+
name: "payer",
|
|
14115
|
+
writable: true,
|
|
14116
|
+
signer: true
|
|
14117
|
+
},
|
|
14118
|
+
{
|
|
14119
|
+
name: "config",
|
|
14120
|
+
writable: true,
|
|
14121
|
+
pda: {
|
|
14122
|
+
seeds: [
|
|
14123
|
+
{
|
|
14124
|
+
kind: "const",
|
|
14125
|
+
value: [
|
|
14126
|
+
97,
|
|
14127
|
+
100,
|
|
14128
|
+
109,
|
|
14129
|
+
105,
|
|
14130
|
+
110,
|
|
14131
|
+
95,
|
|
14132
|
+
99,
|
|
14133
|
+
111,
|
|
14134
|
+
110,
|
|
14135
|
+
102,
|
|
14136
|
+
105,
|
|
14137
|
+
103
|
|
14138
|
+
]
|
|
14139
|
+
},
|
|
14140
|
+
{
|
|
14141
|
+
kind: "account",
|
|
14142
|
+
path: "config.owner",
|
|
14143
|
+
account: "AdminConfig"
|
|
14144
|
+
}
|
|
14145
|
+
]
|
|
14146
|
+
}
|
|
14147
|
+
}
|
|
14148
|
+
],
|
|
14149
|
+
args: [
|
|
14150
|
+
{
|
|
14151
|
+
name: "address",
|
|
14152
|
+
type: "pubkey"
|
|
14153
|
+
}
|
|
14154
|
+
]
|
|
14155
|
+
},
|
|
14156
|
+
{
|
|
14157
|
+
name: "set_presale_amount",
|
|
14158
|
+
discriminator: [
|
|
14159
|
+
73,
|
|
14160
|
+
71,
|
|
14161
|
+
238,
|
|
14162
|
+
3,
|
|
14163
|
+
202,
|
|
14164
|
+
163,
|
|
14165
|
+
8,
|
|
14166
|
+
254
|
|
14167
|
+
],
|
|
14168
|
+
accounts: [
|
|
14169
|
+
{
|
|
14170
|
+
name: "caller",
|
|
14171
|
+
docs: [
|
|
14172
|
+
"question_market config PDA \u2014 signs this CPI call via seeds"
|
|
14173
|
+
],
|
|
14174
|
+
signer: true
|
|
14175
|
+
},
|
|
14176
|
+
{
|
|
14177
|
+
name: "payer",
|
|
14178
|
+
writable: true,
|
|
14179
|
+
signer: true
|
|
14180
|
+
},
|
|
14181
|
+
{
|
|
14182
|
+
name: "config",
|
|
14183
|
+
pda: {
|
|
14184
|
+
seeds: [
|
|
14185
|
+
{
|
|
14186
|
+
kind: "const",
|
|
14187
|
+
value: [
|
|
14188
|
+
97,
|
|
14189
|
+
100,
|
|
14190
|
+
109,
|
|
14191
|
+
105,
|
|
14192
|
+
110,
|
|
14193
|
+
95,
|
|
14194
|
+
99,
|
|
14195
|
+
111,
|
|
14196
|
+
110,
|
|
14197
|
+
102,
|
|
14198
|
+
105,
|
|
14199
|
+
103
|
|
14200
|
+
]
|
|
14201
|
+
},
|
|
14202
|
+
{
|
|
14203
|
+
kind: "account",
|
|
14204
|
+
path: "config.owner",
|
|
14205
|
+
account: "AdminConfig"
|
|
14206
|
+
}
|
|
14207
|
+
]
|
|
14208
|
+
}
|
|
14209
|
+
},
|
|
14210
|
+
{
|
|
14211
|
+
name: "claim_record",
|
|
14212
|
+
writable: true,
|
|
14213
|
+
pda: {
|
|
14214
|
+
seeds: [
|
|
14215
|
+
{
|
|
14216
|
+
kind: "const",
|
|
14217
|
+
value: [
|
|
14218
|
+
99,
|
|
14219
|
+
108,
|
|
14220
|
+
97,
|
|
14221
|
+
105,
|
|
14222
|
+
109,
|
|
14223
|
+
95,
|
|
14224
|
+
114,
|
|
14225
|
+
101,
|
|
14226
|
+
99,
|
|
14227
|
+
111,
|
|
14228
|
+
114,
|
|
14229
|
+
100
|
|
14230
|
+
]
|
|
14231
|
+
},
|
|
14232
|
+
{
|
|
14233
|
+
kind: "arg",
|
|
14234
|
+
path: "condition_id"
|
|
14235
|
+
}
|
|
14236
|
+
]
|
|
14237
|
+
}
|
|
14238
|
+
},
|
|
14239
|
+
{
|
|
14240
|
+
name: "system_program",
|
|
14241
|
+
address: "11111111111111111111111111111111"
|
|
14242
|
+
}
|
|
14243
|
+
],
|
|
14244
|
+
args: [
|
|
14245
|
+
{
|
|
14246
|
+
name: "condition_id",
|
|
14247
|
+
type: {
|
|
14248
|
+
array: [
|
|
14249
|
+
"u8",
|
|
14250
|
+
32
|
|
14251
|
+
]
|
|
14252
|
+
}
|
|
14253
|
+
},
|
|
14254
|
+
{
|
|
14255
|
+
name: "amount",
|
|
14256
|
+
type: "u64"
|
|
14257
|
+
}
|
|
14258
|
+
]
|
|
14259
|
+
},
|
|
14260
|
+
{
|
|
14261
|
+
name: "update_config",
|
|
14262
|
+
discriminator: [
|
|
14263
|
+
29,
|
|
14264
|
+
158,
|
|
14265
|
+
252,
|
|
14266
|
+
191,
|
|
14267
|
+
10,
|
|
14268
|
+
83,
|
|
14269
|
+
219,
|
|
14270
|
+
99
|
|
14271
|
+
],
|
|
14272
|
+
accounts: [
|
|
14273
|
+
{
|
|
14274
|
+
name: "owner",
|
|
14275
|
+
signer: true
|
|
14276
|
+
},
|
|
14277
|
+
{
|
|
14278
|
+
name: "config",
|
|
14279
|
+
writable: true,
|
|
14280
|
+
pda: {
|
|
14281
|
+
seeds: [
|
|
14282
|
+
{
|
|
14283
|
+
kind: "const",
|
|
14284
|
+
value: [
|
|
14285
|
+
97,
|
|
14286
|
+
100,
|
|
14287
|
+
109,
|
|
14288
|
+
105,
|
|
14289
|
+
110,
|
|
14290
|
+
95,
|
|
14291
|
+
99,
|
|
14292
|
+
111,
|
|
14293
|
+
110,
|
|
14294
|
+
102,
|
|
14295
|
+
105,
|
|
14296
|
+
103
|
|
14297
|
+
]
|
|
14298
|
+
},
|
|
14299
|
+
{
|
|
14300
|
+
kind: "account",
|
|
14301
|
+
path: "config.owner",
|
|
14302
|
+
account: "AdminConfig"
|
|
14303
|
+
}
|
|
14304
|
+
]
|
|
14305
|
+
}
|
|
14306
|
+
}
|
|
14307
|
+
],
|
|
14308
|
+
args: [
|
|
14309
|
+
{
|
|
14310
|
+
name: "authorized_caller",
|
|
14311
|
+
type: "pubkey"
|
|
14312
|
+
}
|
|
14313
|
+
]
|
|
14314
|
+
}
|
|
14315
|
+
],
|
|
14316
|
+
accounts: [
|
|
14317
|
+
{
|
|
14318
|
+
name: "AdminConfig",
|
|
14319
|
+
discriminator: [
|
|
14320
|
+
156,
|
|
14321
|
+
10,
|
|
14322
|
+
79,
|
|
14323
|
+
161,
|
|
14324
|
+
71,
|
|
14325
|
+
9,
|
|
14326
|
+
62,
|
|
14327
|
+
77
|
|
14328
|
+
]
|
|
14329
|
+
},
|
|
14330
|
+
{
|
|
14331
|
+
name: "ClaimRecord",
|
|
14332
|
+
discriminator: [
|
|
14333
|
+
57,
|
|
14334
|
+
229,
|
|
14335
|
+
0,
|
|
14336
|
+
9,
|
|
14337
|
+
65,
|
|
14338
|
+
62,
|
|
14339
|
+
96,
|
|
14340
|
+
7
|
|
14341
|
+
]
|
|
14342
|
+
}
|
|
14343
|
+
],
|
|
14344
|
+
types: [
|
|
14345
|
+
{
|
|
14346
|
+
name: "AdminConfig",
|
|
14347
|
+
type: {
|
|
14348
|
+
kind: "struct",
|
|
14349
|
+
fields: [
|
|
14350
|
+
{
|
|
14351
|
+
name: "version",
|
|
14352
|
+
type: "u8"
|
|
14353
|
+
},
|
|
14354
|
+
{
|
|
14355
|
+
name: "owner",
|
|
14356
|
+
type: "pubkey"
|
|
14357
|
+
},
|
|
14358
|
+
{
|
|
14359
|
+
name: "collateral_mint",
|
|
14360
|
+
type: "pubkey"
|
|
14361
|
+
},
|
|
14362
|
+
{
|
|
14363
|
+
name: "authorized_caller",
|
|
14364
|
+
docs: [
|
|
14365
|
+
"question_market config PDA \u2014 only this can call set_presale_amount"
|
|
14366
|
+
],
|
|
14367
|
+
type: "pubkey"
|
|
14368
|
+
},
|
|
14369
|
+
{
|
|
14370
|
+
name: "admin_whitelist",
|
|
14371
|
+
type: {
|
|
14372
|
+
array: [
|
|
14373
|
+
"pubkey",
|
|
14374
|
+
10
|
|
14375
|
+
]
|
|
14376
|
+
}
|
|
14377
|
+
},
|
|
14378
|
+
{
|
|
14379
|
+
name: "admin_whitelist_len",
|
|
14380
|
+
type: "u8"
|
|
14381
|
+
},
|
|
14382
|
+
{
|
|
14383
|
+
name: "whitelist",
|
|
14384
|
+
type: {
|
|
14385
|
+
array: [
|
|
14386
|
+
"pubkey",
|
|
14387
|
+
30
|
|
14388
|
+
]
|
|
14389
|
+
}
|
|
14390
|
+
},
|
|
14391
|
+
{
|
|
14392
|
+
name: "whitelist_len",
|
|
14393
|
+
type: "u8"
|
|
14394
|
+
},
|
|
14395
|
+
{
|
|
14396
|
+
name: "bump",
|
|
14397
|
+
type: "u8"
|
|
14398
|
+
},
|
|
14399
|
+
{
|
|
14400
|
+
name: "_reserved",
|
|
14401
|
+
type: {
|
|
14402
|
+
array: [
|
|
14403
|
+
"u8",
|
|
14404
|
+
64
|
|
14405
|
+
]
|
|
14406
|
+
}
|
|
14407
|
+
}
|
|
14408
|
+
]
|
|
14409
|
+
}
|
|
14410
|
+
},
|
|
14411
|
+
{
|
|
14412
|
+
name: "ClaimRecord",
|
|
14413
|
+
type: {
|
|
14414
|
+
kind: "struct",
|
|
14415
|
+
fields: [
|
|
14416
|
+
{
|
|
14417
|
+
name: "condition_id",
|
|
14418
|
+
type: {
|
|
14419
|
+
array: [
|
|
14420
|
+
"u8",
|
|
14421
|
+
32
|
|
14422
|
+
]
|
|
14423
|
+
}
|
|
14424
|
+
},
|
|
14425
|
+
{
|
|
14426
|
+
name: "amount",
|
|
14427
|
+
type: "u64"
|
|
14428
|
+
},
|
|
14429
|
+
{
|
|
14430
|
+
name: "bump",
|
|
14431
|
+
type: "u8"
|
|
14432
|
+
}
|
|
14433
|
+
]
|
|
14434
|
+
}
|
|
14435
|
+
}
|
|
14436
|
+
]
|
|
14437
|
+
};
|
|
14438
|
+
|
|
14439
|
+
// src/sdk.ts
|
|
14440
|
+
var XMarketSDK = class {
|
|
14441
|
+
// lazy-init in get admin()
|
|
14442
|
+
constructor(config, wallet, marketOwner) {
|
|
14443
|
+
this.networkConfig = config;
|
|
14444
|
+
this.provider = new anchor5__namespace.AnchorProvider(
|
|
14445
|
+
new web3_js.Connection(config.rpcUrl, "confirmed"),
|
|
14446
|
+
wallet,
|
|
14447
|
+
{ commitment: "confirmed", preflightCommitment: "confirmed" }
|
|
14448
|
+
);
|
|
14449
|
+
anchor5__namespace.setProvider(this.provider);
|
|
14450
|
+
this._programIds = config.programIds;
|
|
14451
|
+
this._marketOwner = marketOwner ?? wallet.publicKey;
|
|
14452
|
+
}
|
|
14453
|
+
_withAddress(idl, address) {
|
|
14454
|
+
return { ...idl, address: address.toBase58() };
|
|
14455
|
+
}
|
|
14456
|
+
get oracle() {
|
|
14457
|
+
if (!this._oracle) {
|
|
14458
|
+
const program = new anchor5__namespace.Program(this._withAddress(oracle_default, this._programIds.oracle), this.provider);
|
|
14459
|
+
this._oracle = new OracleClient(program, this.provider, this._programIds);
|
|
14460
|
+
}
|
|
14461
|
+
return this._oracle;
|
|
14462
|
+
}
|
|
14463
|
+
get hook() {
|
|
14464
|
+
if (!this._hook) {
|
|
14465
|
+
const program = new anchor5__namespace.Program(this._withAddress(hook_default, this._programIds.hook), this.provider);
|
|
14466
|
+
this._hook = new HookClient(program, this.provider, this._programIds);
|
|
14467
|
+
}
|
|
14468
|
+
return this._hook;
|
|
14469
|
+
}
|
|
14470
|
+
get market() {
|
|
14471
|
+
if (!this._market) {
|
|
14472
|
+
const program = new anchor5__namespace.Program(this._withAddress(question_market_default, this._programIds.questionMarket), this.provider);
|
|
14473
|
+
this._market = new MarketClient(program, this.provider, this._programIds, this._marketOwner);
|
|
14474
|
+
this._market.ctfClient = this.ctf;
|
|
14475
|
+
}
|
|
14476
|
+
return this._market;
|
|
14477
|
+
}
|
|
14478
|
+
get ctf() {
|
|
14479
|
+
if (!this._ctf) {
|
|
14480
|
+
const program = new anchor5__namespace.Program(this._withAddress(conditional_tokens_default, this._programIds.conditionalTokens), this.provider);
|
|
14481
|
+
this._ctf = new CtfClient(program, this.provider, this._programIds);
|
|
14482
|
+
}
|
|
14483
|
+
return this._ctf;
|
|
14484
|
+
}
|
|
14485
|
+
get clob() {
|
|
14486
|
+
if (!this._clob) {
|
|
14487
|
+
const program = new anchor5__namespace.Program(this._withAddress(clob_exchange_default, this._programIds.clobExchange), this.provider);
|
|
14488
|
+
this._clob = new ClobClient(program, this.provider, this._programIds, this.networkConfig);
|
|
14489
|
+
if (this.networkConfig.feeConfigOwner && this._programIds.feeManagement) {
|
|
14490
|
+
this._clob.feeConfigOwner = this.networkConfig.feeConfigOwner;
|
|
14491
|
+
this._clob.feeClient = this.fee;
|
|
14492
|
+
}
|
|
14493
|
+
}
|
|
14494
|
+
return this._clob;
|
|
14495
|
+
}
|
|
14496
|
+
get fee() {
|
|
14497
|
+
if (!this._fee) {
|
|
14498
|
+
if (!this._programIds.feeManagement) throw new Error("feeManagement program ID not configured in NetworkConfig");
|
|
14499
|
+
const program = new anchor5__namespace.Program(this._withAddress(fee_management_default, this._programIds.feeManagement), this.provider);
|
|
14500
|
+
this._fee = new FeeManagementClient(program, this.provider, this._programIds);
|
|
14501
|
+
}
|
|
14502
|
+
return this._fee;
|
|
14503
|
+
}
|
|
14504
|
+
get presale() {
|
|
14505
|
+
if (!this._presale) {
|
|
14506
|
+
if (!this._programIds.presale) throw new Error("presale program ID not configured in NetworkConfig");
|
|
14507
|
+
const program = new anchor5__namespace.Program(this._withAddress(presale_default, this._programIds.presale), this.provider);
|
|
14508
|
+
this._presale = new PresaleClient(program, this.provider, this._programIds);
|
|
14509
|
+
}
|
|
14510
|
+
return this._presale;
|
|
14511
|
+
}
|
|
14512
|
+
get marketOracle() {
|
|
14513
|
+
if (!this._marketOracle) {
|
|
14514
|
+
if (!this._programIds.marketOracle) throw new Error("marketOracle program ID not configured in NetworkConfig");
|
|
14515
|
+
const program = new anchor5__namespace.Program(this._withAddress(market_oracle_default, this._programIds.marketOracle), this.provider);
|
|
14516
|
+
this._marketOracle = new MarketOracleClient(program, this.provider, this._programIds);
|
|
14517
|
+
}
|
|
14518
|
+
return this._marketOracle;
|
|
14519
|
+
}
|
|
14520
|
+
get admin() {
|
|
14521
|
+
if (!this._admin) {
|
|
14522
|
+
if (!this._programIds.adminContract) throw new Error("adminContract program ID not configured in NetworkConfig");
|
|
14523
|
+
const program = new anchor5__namespace.Program(this._withAddress(admin_contract_default, this._programIds.adminContract), this.provider);
|
|
14524
|
+
this._admin = new AdminClient(program, this.provider, this._programIds);
|
|
14525
|
+
}
|
|
14526
|
+
return this._admin;
|
|
13302
14527
|
}
|
|
13303
14528
|
};
|
|
13304
14529
|
function buildOrder(params) {
|
|
@@ -13430,6 +14655,7 @@ function buildApproveAllOutcomeTokensTx(condition, signer, payer, delegate, prog
|
|
|
13430
14655
|
}
|
|
13431
14656
|
|
|
13432
14657
|
exports.AccountNotFoundError = AccountNotFoundError;
|
|
14658
|
+
exports.AdminClient = AdminClient;
|
|
13433
14659
|
exports.ClobClient = ClobClient;
|
|
13434
14660
|
exports.CtfClient = CtfClient;
|
|
13435
14661
|
exports.FEE_DENOMINATOR = FEE_DENOMINATOR;
|