@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.mjs
CHANGED
|
@@ -33,7 +33,10 @@ var SEEDS = {
|
|
|
33
33
|
userBuy: Buffer.from("user_buy"),
|
|
34
34
|
// Market Oracle
|
|
35
35
|
marketOracle: Buffer.from("market_oracle"),
|
|
36
|
-
userClaim: Buffer.from("user_claim")
|
|
36
|
+
userClaim: Buffer.from("user_claim"),
|
|
37
|
+
// Admin Contract
|
|
38
|
+
adminConfig: Buffer.from("admin_config"),
|
|
39
|
+
claimRecord: Buffer.from("claim_record")
|
|
37
40
|
};
|
|
38
41
|
var PDA = class {
|
|
39
42
|
// ─── Question Market ────────────────────────────────────────────────────────
|
|
@@ -221,6 +224,21 @@ var PDA = class {
|
|
|
221
224
|
programIds.marketOracle
|
|
222
225
|
);
|
|
223
226
|
}
|
|
227
|
+
// ─── Admin Contract ──────────────────────────────────────────────────────
|
|
228
|
+
static adminConfig(owner, programIds) {
|
|
229
|
+
if (!programIds.adminContract) throw new Error("adminContract program ID not configured");
|
|
230
|
+
return PublicKey.findProgramAddressSync(
|
|
231
|
+
[SEEDS.adminConfig, owner.toBuffer()],
|
|
232
|
+
programIds.adminContract
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
static claimRecord(conditionId, programIds) {
|
|
236
|
+
if (!programIds.adminContract) throw new Error("adminContract program ID not configured");
|
|
237
|
+
return PublicKey.findProgramAddressSync(
|
|
238
|
+
[SEEDS.claimRecord, conditionId],
|
|
239
|
+
programIds.adminContract
|
|
240
|
+
);
|
|
241
|
+
}
|
|
224
242
|
};
|
|
225
243
|
function generateQuestionId(content, salt) {
|
|
226
244
|
const input = content + (salt ?? Date.now());
|
|
@@ -823,13 +841,26 @@ var MarketClient = class {
|
|
|
823
841
|
* Whitelist-only: distribute presale vault → 10% agents + 10% company + 80% botmm.
|
|
824
842
|
* Closes presale_vault ATA and presale PDA after distribution; lamports returned to payer.
|
|
825
843
|
*/
|
|
826
|
-
async collectPresaleRevenue(
|
|
844
|
+
async collectPresaleRevenue(params) {
|
|
845
|
+
const {
|
|
846
|
+
presalePda,
|
|
847
|
+
currencyMint,
|
|
848
|
+
conditionId,
|
|
849
|
+
referralAddress,
|
|
850
|
+
companyAddress,
|
|
851
|
+
adminOwner
|
|
852
|
+
} = params;
|
|
853
|
+
const caller = params.caller ?? this.walletPubkey;
|
|
854
|
+
const payer = params.payer ?? this.walletPubkey;
|
|
827
855
|
if (!this.programIds.presale) throw new Error("presale program ID not configured");
|
|
856
|
+
if (!this.programIds.adminContract) throw new Error("adminContract program ID not configured");
|
|
828
857
|
const presaleVault = getAssociatedTokenAddressSync(currencyMint, presalePda, true);
|
|
829
858
|
const referralTokenAccount = getAssociatedTokenAddressSync(currencyMint, referralAddress);
|
|
830
859
|
const companyTokenAccount = getAssociatedTokenAddressSync(currencyMint, companyAddress);
|
|
831
|
-
const
|
|
832
|
-
|
|
860
|
+
const [adminConfig] = PDA.adminConfig(adminOwner, this.programIds);
|
|
861
|
+
const [claimRecord] = PDA.claimRecord(conditionId, this.programIds);
|
|
862
|
+
const adminVault = getAssociatedTokenAddressSync(currencyMint, adminConfig, true);
|
|
863
|
+
return this.program.methods.collectPresaleRevenue(Array.from(conditionId)).accounts({
|
|
833
864
|
caller,
|
|
834
865
|
config: this.configPda,
|
|
835
866
|
presale: presalePda,
|
|
@@ -837,9 +868,12 @@ var MarketClient = class {
|
|
|
837
868
|
currencyMint,
|
|
838
869
|
referralTokenAccount,
|
|
839
870
|
companyTokenAccount,
|
|
840
|
-
|
|
871
|
+
adminVault,
|
|
872
|
+
adminConfig,
|
|
873
|
+
claimRecord,
|
|
841
874
|
payer,
|
|
842
875
|
presaleProgram: this.programIds.presale,
|
|
876
|
+
adminProgram: this.programIds.adminContract,
|
|
843
877
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
844
878
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
845
879
|
systemProgram: SystemProgram.programId
|
|
@@ -1406,8 +1440,8 @@ var ClobClient = class {
|
|
|
1406
1440
|
async _sendLegacyTxSig(instructions) {
|
|
1407
1441
|
const { connection } = this.provider;
|
|
1408
1442
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1409
|
-
const { Transaction:
|
|
1410
|
-
const tx = new
|
|
1443
|
+
const { Transaction: Transaction8 } = await import('@solana/web3.js');
|
|
1444
|
+
const tx = new Transaction8();
|
|
1411
1445
|
tx.recentBlockhash = blockhash;
|
|
1412
1446
|
tx.feePayer = this.walletPubkey;
|
|
1413
1447
|
tx.add(...instructions);
|
|
@@ -1831,10 +1865,30 @@ ${logs.join("\n")}`);
|
|
|
1831
1865
|
const SIDE_BUY = 0;
|
|
1832
1866
|
const SIDE_SELL = 1;
|
|
1833
1867
|
if (t.tokenId === m0.tokenId) {
|
|
1868
|
+
let buySignedOrder, sellCandidates;
|
|
1834
1869
|
if (t.side === SIDE_BUY && makers.every((m) => m.order.side === SIDE_SELL)) {
|
|
1835
|
-
|
|
1870
|
+
buySignedOrder = taker;
|
|
1871
|
+
sellCandidates = makers;
|
|
1872
|
+
} else if (t.side === SIDE_SELL && makers.every((m) => m.order.side === SIDE_BUY)) {
|
|
1873
|
+
buySignedOrder = makers[0];
|
|
1874
|
+
sellCandidates = [taker, ...makers.slice(1)];
|
|
1875
|
+
} else {
|
|
1876
|
+
throw new InvalidParamError("COMPLEMENTARY requires one BUY and one or more SELLs on same tokenId");
|
|
1877
|
+
}
|
|
1878
|
+
const crossingSells = sellCandidates.filter((s) => {
|
|
1879
|
+
const buy = buySignedOrder.order;
|
|
1880
|
+
const sell = s.order;
|
|
1881
|
+
const lhs = BigInt(buy.makerAmount.toString()) * BigInt(sell.makerAmount.toString());
|
|
1882
|
+
const rhs = BigInt(buy.takerAmount.toString()) * BigInt(sell.takerAmount.toString());
|
|
1883
|
+
return lhs >= rhs;
|
|
1884
|
+
});
|
|
1885
|
+
if (crossingSells.length === 0) {
|
|
1886
|
+
throw new InvalidParamError("COMPLEMENTARY: no maker orders cross with the buy order");
|
|
1836
1887
|
}
|
|
1837
|
-
|
|
1888
|
+
if (crossingSells.length < sellCandidates.length) {
|
|
1889
|
+
console.warn(`[matchOrders] filtered ${sellCandidates.length - crossingSells.length} non-crossing maker(s)`);
|
|
1890
|
+
}
|
|
1891
|
+
return this.matchComplementary(buySignedOrder, crossingSells, collateralMint, feeRecipient, operatorWallet, alt, opts);
|
|
1838
1892
|
}
|
|
1839
1893
|
const allBuy = t.side === SIDE_BUY && makers.every((m) => m.order.side === SIDE_BUY);
|
|
1840
1894
|
const allSell = t.side === SIDE_SELL && makers.every((m) => m.order.side === SIDE_SELL);
|
|
@@ -2228,6 +2282,139 @@ var MarketOracleClient = class {
|
|
|
2228
2282
|
}
|
|
2229
2283
|
}
|
|
2230
2284
|
};
|
|
2285
|
+
var AdminClient = class {
|
|
2286
|
+
constructor(program, provider, programIds) {
|
|
2287
|
+
this.program = program;
|
|
2288
|
+
this.provider = provider;
|
|
2289
|
+
this.programIds = programIds;
|
|
2290
|
+
}
|
|
2291
|
+
get walletPubkey() {
|
|
2292
|
+
return this.provider.wallet.publicKey;
|
|
2293
|
+
}
|
|
2294
|
+
get configPda() {
|
|
2295
|
+
const [pda] = PDA.adminConfig(this.walletPubkey, this.programIds);
|
|
2296
|
+
return pda;
|
|
2297
|
+
}
|
|
2298
|
+
configPdaFor(owner) {
|
|
2299
|
+
const [pda] = PDA.adminConfig(owner, this.programIds);
|
|
2300
|
+
return pda;
|
|
2301
|
+
}
|
|
2302
|
+
adminVault(owner, collateralMint) {
|
|
2303
|
+
const configPda = this.configPdaFor(owner);
|
|
2304
|
+
return getAssociatedTokenAddressSync(collateralMint, configPda, true);
|
|
2305
|
+
}
|
|
2306
|
+
// ─── Fetch ────────────────────────────────────────────────────────────────
|
|
2307
|
+
async fetchConfig(owner = this.walletPubkey) {
|
|
2308
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2309
|
+
try {
|
|
2310
|
+
const acc = await this.program.account.adminConfig.fetch(configPda);
|
|
2311
|
+
return {
|
|
2312
|
+
version: acc.version,
|
|
2313
|
+
owner: acc.owner,
|
|
2314
|
+
collateralMint: acc.collateralMint,
|
|
2315
|
+
authorizedCaller: acc.authorizedCaller,
|
|
2316
|
+
adminWhitelist: acc.adminWhitelist.slice(0, acc.adminWhitelistLen),
|
|
2317
|
+
whitelist: acc.whitelist.slice(0, acc.whitelistLen),
|
|
2318
|
+
bump: acc.bump
|
|
2319
|
+
};
|
|
2320
|
+
} catch {
|
|
2321
|
+
return null;
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
async fetchClaimRecord(conditionId) {
|
|
2325
|
+
const [pda] = PDA.claimRecord(conditionId, this.programIds);
|
|
2326
|
+
try {
|
|
2327
|
+
const acc = await this.program.account.claimRecord.fetch(pda);
|
|
2328
|
+
return {
|
|
2329
|
+
conditionId: acc.conditionId,
|
|
2330
|
+
amount: acc.amount,
|
|
2331
|
+
bump: acc.bump
|
|
2332
|
+
};
|
|
2333
|
+
} catch {
|
|
2334
|
+
return null;
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
// ─── Instructions ─────────────────────────────────────────────────────────
|
|
2338
|
+
async initialize(authorizedCaller, collateralMint, owner = this.walletPubkey) {
|
|
2339
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2340
|
+
const vault = getAssociatedTokenAddressSync(collateralMint, configPda, true);
|
|
2341
|
+
return this.program.methods.initialize(authorizedCaller).accounts({
|
|
2342
|
+
owner,
|
|
2343
|
+
config: configPda,
|
|
2344
|
+
collateralMint,
|
|
2345
|
+
adminVault: vault,
|
|
2346
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
2347
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
2348
|
+
systemProgram: SystemProgram.programId
|
|
2349
|
+
}).transaction();
|
|
2350
|
+
}
|
|
2351
|
+
async addAdmin(address, owner = this.walletPubkey) {
|
|
2352
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2353
|
+
return this.program.methods.addAdmin(address).accounts({ owner, config: configPda }).transaction();
|
|
2354
|
+
}
|
|
2355
|
+
async removeAdmin(address, owner = this.walletPubkey) {
|
|
2356
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2357
|
+
return this.program.methods.removeAdmin(address).accounts({ owner, config: configPda }).transaction();
|
|
2358
|
+
}
|
|
2359
|
+
async addToWhitelist(address, owner, admin = this.walletPubkey, payer = admin) {
|
|
2360
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2361
|
+
return this.program.methods.addToWhitelist(address).accounts({ admin, payer, config: configPda }).transaction();
|
|
2362
|
+
}
|
|
2363
|
+
async removeFromWhitelist(address, owner, admin = this.walletPubkey, payer = admin) {
|
|
2364
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2365
|
+
return this.program.methods.removeFromWhitelist(address).accounts({ admin, payer, config: configPda }).transaction();
|
|
2366
|
+
}
|
|
2367
|
+
/**
|
|
2368
|
+
* Normally called via CPI from question_market (authorized_caller signs).
|
|
2369
|
+
* For testing: initialize with authorizedCaller = wallet, call directly.
|
|
2370
|
+
*/
|
|
2371
|
+
async setPresaleAmount(conditionId, amount, owner = this.walletPubkey, caller = this.walletPubkey, payer = caller) {
|
|
2372
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2373
|
+
const [claimRecord] = PDA.claimRecord(conditionId, this.programIds);
|
|
2374
|
+
return this.program.methods.setPresaleAmount(Array.from(conditionId), amount).accounts({
|
|
2375
|
+
caller,
|
|
2376
|
+
payer,
|
|
2377
|
+
config: configPda,
|
|
2378
|
+
claimRecord,
|
|
2379
|
+
systemProgram: SystemProgram.programId
|
|
2380
|
+
}).transaction();
|
|
2381
|
+
}
|
|
2382
|
+
async claim(conditionId, collateralMint, owner, claimer = this.walletPubkey, payer = claimer) {
|
|
2383
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2384
|
+
const [claimRecord] = PDA.claimRecord(conditionId, this.programIds);
|
|
2385
|
+
const vault = getAssociatedTokenAddressSync(collateralMint, configPda, true);
|
|
2386
|
+
const claimerAta = getAssociatedTokenAddressSync(collateralMint, claimer);
|
|
2387
|
+
return this.program.methods.claim(Array.from(conditionId)).accounts({
|
|
2388
|
+
claimer,
|
|
2389
|
+
payer,
|
|
2390
|
+
config: configPda,
|
|
2391
|
+
adminVault: vault,
|
|
2392
|
+
claimRecord,
|
|
2393
|
+
claimerTokenAccount: claimerAta,
|
|
2394
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
2395
|
+
}).transaction();
|
|
2396
|
+
}
|
|
2397
|
+
async updateConfig(authorizedCaller, owner = this.walletPubkey) {
|
|
2398
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2399
|
+
return this.program.methods.updateConfig(authorizedCaller).accounts({ owner, config: configPda }).transaction();
|
|
2400
|
+
}
|
|
2401
|
+
/**
|
|
2402
|
+
* BOTMM sends USDC from their wallet to the market_oracle vault for a condition.
|
|
2403
|
+
* Whitelist-only. No amount validation — caller responsible.
|
|
2404
|
+
*/
|
|
2405
|
+
async distributeMarket(conditionId, amount, collateralMint, marketOracleVault, owner, claimer = this.walletPubkey, payer = claimer) {
|
|
2406
|
+
const [configPda] = PDA.adminConfig(owner, this.programIds);
|
|
2407
|
+
const claimerTokenAcct = getAssociatedTokenAddressSync(collateralMint, claimer);
|
|
2408
|
+
return this.program.methods.distributeMarket(Array.from(conditionId), amount).accounts({
|
|
2409
|
+
claimer,
|
|
2410
|
+
payer,
|
|
2411
|
+
config: configPda,
|
|
2412
|
+
claimerTokenAccount: claimerTokenAcct,
|
|
2413
|
+
marketOracleVault,
|
|
2414
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
2415
|
+
}).transaction();
|
|
2416
|
+
}
|
|
2417
|
+
};
|
|
2231
2418
|
|
|
2232
2419
|
// src/idls/oracle.json
|
|
2233
2420
|
var oracle_default = {
|
|
@@ -3794,7 +3981,7 @@ var question_market_default = {
|
|
|
3794
3981
|
{
|
|
3795
3982
|
name: "presale_vault",
|
|
3796
3983
|
docs: [
|
|
3797
|
-
"Presale USDC vault \u2014 closed inside presale program"
|
|
3984
|
+
"Presale USDC vault \u2014 read balance before CPI, closed inside presale program"
|
|
3798
3985
|
],
|
|
3799
3986
|
writable: true
|
|
3800
3987
|
},
|
|
@@ -3804,24 +3991,66 @@ var question_market_default = {
|
|
|
3804
3991
|
{
|
|
3805
3992
|
name: "referral_token_account",
|
|
3806
3993
|
docs: [
|
|
3807
|
-
"Referral address USDC token account"
|
|
3994
|
+
"Referral address USDC token account (10%)"
|
|
3808
3995
|
],
|
|
3809
3996
|
writable: true
|
|
3810
3997
|
},
|
|
3811
3998
|
{
|
|
3812
3999
|
name: "company_token_account",
|
|
3813
4000
|
docs: [
|
|
3814
|
-
"Company address USDC token account"
|
|
4001
|
+
"Company address USDC token account (10%)"
|
|
3815
4002
|
],
|
|
3816
4003
|
writable: true
|
|
3817
4004
|
},
|
|
3818
4005
|
{
|
|
3819
|
-
name: "
|
|
4006
|
+
name: "admin_vault",
|
|
3820
4007
|
docs: [
|
|
3821
|
-
"
|
|
4008
|
+
"admin_contract vault ATA \u2014 receives 80% instead of BOTMM wallet directly"
|
|
3822
4009
|
],
|
|
3823
4010
|
writable: true
|
|
3824
4011
|
},
|
|
4012
|
+
{
|
|
4013
|
+
name: "admin_config",
|
|
4014
|
+
docs: [
|
|
4015
|
+
"admin_contract config PDA"
|
|
4016
|
+
]
|
|
4017
|
+
},
|
|
4018
|
+
{
|
|
4019
|
+
name: "claim_record",
|
|
4020
|
+
docs: [
|
|
4021
|
+
"ClaimRecord PDA for this conditionId (created by admin_contract CPI)"
|
|
4022
|
+
],
|
|
4023
|
+
writable: true,
|
|
4024
|
+
pda: {
|
|
4025
|
+
seeds: [
|
|
4026
|
+
{
|
|
4027
|
+
kind: "const",
|
|
4028
|
+
value: [
|
|
4029
|
+
99,
|
|
4030
|
+
108,
|
|
4031
|
+
97,
|
|
4032
|
+
105,
|
|
4033
|
+
109,
|
|
4034
|
+
95,
|
|
4035
|
+
114,
|
|
4036
|
+
101,
|
|
4037
|
+
99,
|
|
4038
|
+
111,
|
|
4039
|
+
114,
|
|
4040
|
+
100
|
|
4041
|
+
]
|
|
4042
|
+
},
|
|
4043
|
+
{
|
|
4044
|
+
kind: "arg",
|
|
4045
|
+
path: "condition_id"
|
|
4046
|
+
}
|
|
4047
|
+
],
|
|
4048
|
+
program: {
|
|
4049
|
+
kind: "account",
|
|
4050
|
+
path: "admin_program"
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
},
|
|
3825
4054
|
{
|
|
3826
4055
|
name: "payer",
|
|
3827
4056
|
docs: [
|
|
@@ -3833,6 +4062,10 @@ var question_market_default = {
|
|
|
3833
4062
|
name: "presale_program",
|
|
3834
4063
|
address: "2Rnw1VoEtsUMQ7wkvYZjDehqSqRob6uNkeymDfvKrquB"
|
|
3835
4064
|
},
|
|
4065
|
+
{
|
|
4066
|
+
name: "admin_program",
|
|
4067
|
+
address: "4NdD5962SfGqofmeyjfifJpdGnwTAiKaUKB5Z42UDc9T"
|
|
4068
|
+
},
|
|
3836
4069
|
{
|
|
3837
4070
|
name: "token_program",
|
|
3838
4071
|
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
@@ -3846,7 +4079,17 @@ var question_market_default = {
|
|
|
3846
4079
|
address: "11111111111111111111111111111111"
|
|
3847
4080
|
}
|
|
3848
4081
|
],
|
|
3849
|
-
args: [
|
|
4082
|
+
args: [
|
|
4083
|
+
{
|
|
4084
|
+
name: "condition_id",
|
|
4085
|
+
type: {
|
|
4086
|
+
array: [
|
|
4087
|
+
"u8",
|
|
4088
|
+
32
|
|
4089
|
+
]
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4092
|
+
]
|
|
3850
4093
|
},
|
|
3851
4094
|
{
|
|
3852
4095
|
name: "collect_trading_fee",
|
|
@@ -13194,85 +13437,1067 @@ var market_oracle_default = {
|
|
|
13194
13437
|
]
|
|
13195
13438
|
};
|
|
13196
13439
|
|
|
13197
|
-
// src/
|
|
13198
|
-
var
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
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
|
-
|
|
13440
|
+
// src/idls/admin_contract.json
|
|
13441
|
+
var admin_contract_default = {
|
|
13442
|
+
address: "4NdD5962SfGqofmeyjfifJpdGnwTAiKaUKB5Z42UDc9T",
|
|
13443
|
+
metadata: {
|
|
13444
|
+
name: "admin_contract",
|
|
13445
|
+
version: "0.1.0",
|
|
13446
|
+
spec: "0.1.0",
|
|
13447
|
+
description: "Admin contract for XMarket \u2014 whitelist, presale revenue custody, claim"
|
|
13448
|
+
},
|
|
13449
|
+
instructions: [
|
|
13450
|
+
{
|
|
13451
|
+
name: "add_admin",
|
|
13452
|
+
discriminator: [
|
|
13453
|
+
177,
|
|
13454
|
+
236,
|
|
13455
|
+
33,
|
|
13456
|
+
205,
|
|
13457
|
+
124,
|
|
13458
|
+
152,
|
|
13459
|
+
55,
|
|
13460
|
+
186
|
|
13461
|
+
],
|
|
13462
|
+
accounts: [
|
|
13463
|
+
{
|
|
13464
|
+
name: "owner",
|
|
13465
|
+
signer: true
|
|
13466
|
+
},
|
|
13467
|
+
{
|
|
13468
|
+
name: "config",
|
|
13469
|
+
writable: true,
|
|
13470
|
+
pda: {
|
|
13471
|
+
seeds: [
|
|
13472
|
+
{
|
|
13473
|
+
kind: "const",
|
|
13474
|
+
value: [
|
|
13475
|
+
97,
|
|
13476
|
+
100,
|
|
13477
|
+
109,
|
|
13478
|
+
105,
|
|
13479
|
+
110,
|
|
13480
|
+
95,
|
|
13481
|
+
99,
|
|
13482
|
+
111,
|
|
13483
|
+
110,
|
|
13484
|
+
102,
|
|
13485
|
+
105,
|
|
13486
|
+
103
|
|
13487
|
+
]
|
|
13488
|
+
},
|
|
13489
|
+
{
|
|
13490
|
+
kind: "account",
|
|
13491
|
+
path: "config.owner",
|
|
13492
|
+
account: "AdminConfig"
|
|
13493
|
+
}
|
|
13494
|
+
]
|
|
13495
|
+
}
|
|
13496
|
+
}
|
|
13497
|
+
],
|
|
13498
|
+
args: [
|
|
13499
|
+
{
|
|
13500
|
+
name: "address",
|
|
13501
|
+
type: "pubkey"
|
|
13502
|
+
}
|
|
13503
|
+
]
|
|
13504
|
+
},
|
|
13505
|
+
{
|
|
13506
|
+
name: "add_to_whitelist",
|
|
13507
|
+
discriminator: [
|
|
13508
|
+
157,
|
|
13509
|
+
211,
|
|
13510
|
+
52,
|
|
13511
|
+
54,
|
|
13512
|
+
144,
|
|
13513
|
+
81,
|
|
13514
|
+
5,
|
|
13515
|
+
55
|
|
13516
|
+
],
|
|
13517
|
+
accounts: [
|
|
13518
|
+
{
|
|
13519
|
+
name: "admin",
|
|
13520
|
+
signer: true
|
|
13521
|
+
},
|
|
13522
|
+
{
|
|
13523
|
+
name: "payer",
|
|
13524
|
+
writable: true,
|
|
13525
|
+
signer: true
|
|
13526
|
+
},
|
|
13527
|
+
{
|
|
13528
|
+
name: "config",
|
|
13529
|
+
writable: true,
|
|
13530
|
+
pda: {
|
|
13531
|
+
seeds: [
|
|
13532
|
+
{
|
|
13533
|
+
kind: "const",
|
|
13534
|
+
value: [
|
|
13535
|
+
97,
|
|
13536
|
+
100,
|
|
13537
|
+
109,
|
|
13538
|
+
105,
|
|
13539
|
+
110,
|
|
13540
|
+
95,
|
|
13541
|
+
99,
|
|
13542
|
+
111,
|
|
13543
|
+
110,
|
|
13544
|
+
102,
|
|
13545
|
+
105,
|
|
13546
|
+
103
|
|
13547
|
+
]
|
|
13548
|
+
},
|
|
13549
|
+
{
|
|
13550
|
+
kind: "account",
|
|
13551
|
+
path: "config.owner",
|
|
13552
|
+
account: "AdminConfig"
|
|
13553
|
+
}
|
|
13554
|
+
]
|
|
13555
|
+
}
|
|
13556
|
+
}
|
|
13557
|
+
],
|
|
13558
|
+
args: [
|
|
13559
|
+
{
|
|
13560
|
+
name: "address",
|
|
13561
|
+
type: "pubkey"
|
|
13562
|
+
}
|
|
13563
|
+
]
|
|
13564
|
+
},
|
|
13565
|
+
{
|
|
13566
|
+
name: "claim",
|
|
13567
|
+
discriminator: [
|
|
13568
|
+
62,
|
|
13569
|
+
198,
|
|
13570
|
+
214,
|
|
13571
|
+
193,
|
|
13572
|
+
213,
|
|
13573
|
+
159,
|
|
13574
|
+
108,
|
|
13575
|
+
210
|
|
13576
|
+
],
|
|
13577
|
+
accounts: [
|
|
13578
|
+
{
|
|
13579
|
+
name: "claimer",
|
|
13580
|
+
signer: true
|
|
13581
|
+
},
|
|
13582
|
+
{
|
|
13583
|
+
name: "payer",
|
|
13584
|
+
writable: true,
|
|
13585
|
+
signer: true
|
|
13586
|
+
},
|
|
13587
|
+
{
|
|
13588
|
+
name: "config",
|
|
13589
|
+
pda: {
|
|
13590
|
+
seeds: [
|
|
13591
|
+
{
|
|
13592
|
+
kind: "const",
|
|
13593
|
+
value: [
|
|
13594
|
+
97,
|
|
13595
|
+
100,
|
|
13596
|
+
109,
|
|
13597
|
+
105,
|
|
13598
|
+
110,
|
|
13599
|
+
95,
|
|
13600
|
+
99,
|
|
13601
|
+
111,
|
|
13602
|
+
110,
|
|
13603
|
+
102,
|
|
13604
|
+
105,
|
|
13605
|
+
103
|
|
13606
|
+
]
|
|
13607
|
+
},
|
|
13608
|
+
{
|
|
13609
|
+
kind: "account",
|
|
13610
|
+
path: "config.owner",
|
|
13611
|
+
account: "AdminConfig"
|
|
13612
|
+
}
|
|
13613
|
+
]
|
|
13614
|
+
}
|
|
13615
|
+
},
|
|
13616
|
+
{
|
|
13617
|
+
name: "admin_vault",
|
|
13618
|
+
docs: [
|
|
13619
|
+
"ATA owned by config PDA"
|
|
13620
|
+
],
|
|
13621
|
+
writable: true,
|
|
13622
|
+
pda: {
|
|
13623
|
+
seeds: [
|
|
13624
|
+
{
|
|
13625
|
+
kind: "account",
|
|
13626
|
+
path: "config"
|
|
13627
|
+
},
|
|
13628
|
+
{
|
|
13629
|
+
kind: "const",
|
|
13630
|
+
value: [
|
|
13631
|
+
6,
|
|
13632
|
+
221,
|
|
13633
|
+
246,
|
|
13634
|
+
225,
|
|
13635
|
+
215,
|
|
13636
|
+
101,
|
|
13637
|
+
161,
|
|
13638
|
+
147,
|
|
13639
|
+
217,
|
|
13640
|
+
203,
|
|
13641
|
+
225,
|
|
13642
|
+
70,
|
|
13643
|
+
206,
|
|
13644
|
+
235,
|
|
13645
|
+
121,
|
|
13646
|
+
172,
|
|
13647
|
+
28,
|
|
13648
|
+
180,
|
|
13649
|
+
133,
|
|
13650
|
+
237,
|
|
13651
|
+
95,
|
|
13652
|
+
91,
|
|
13653
|
+
55,
|
|
13654
|
+
145,
|
|
13655
|
+
58,
|
|
13656
|
+
140,
|
|
13657
|
+
245,
|
|
13658
|
+
133,
|
|
13659
|
+
126,
|
|
13660
|
+
255,
|
|
13661
|
+
0,
|
|
13662
|
+
169
|
|
13663
|
+
]
|
|
13664
|
+
},
|
|
13665
|
+
{
|
|
13666
|
+
kind: "account",
|
|
13667
|
+
path: "config.collateral_mint",
|
|
13668
|
+
account: "AdminConfig"
|
|
13669
|
+
}
|
|
13670
|
+
],
|
|
13671
|
+
program: {
|
|
13672
|
+
kind: "const",
|
|
13673
|
+
value: [
|
|
13674
|
+
140,
|
|
13675
|
+
151,
|
|
13676
|
+
37,
|
|
13677
|
+
143,
|
|
13678
|
+
78,
|
|
13679
|
+
36,
|
|
13680
|
+
137,
|
|
13681
|
+
241,
|
|
13682
|
+
187,
|
|
13683
|
+
61,
|
|
13684
|
+
16,
|
|
13685
|
+
41,
|
|
13686
|
+
20,
|
|
13687
|
+
142,
|
|
13688
|
+
13,
|
|
13689
|
+
131,
|
|
13690
|
+
11,
|
|
13691
|
+
90,
|
|
13692
|
+
19,
|
|
13693
|
+
153,
|
|
13694
|
+
218,
|
|
13695
|
+
255,
|
|
13696
|
+
16,
|
|
13697
|
+
132,
|
|
13698
|
+
4,
|
|
13699
|
+
142,
|
|
13700
|
+
123,
|
|
13701
|
+
216,
|
|
13702
|
+
219,
|
|
13703
|
+
233,
|
|
13704
|
+
248,
|
|
13705
|
+
89
|
|
13706
|
+
]
|
|
13707
|
+
}
|
|
13708
|
+
}
|
|
13709
|
+
},
|
|
13710
|
+
{
|
|
13711
|
+
name: "claim_record",
|
|
13712
|
+
writable: true,
|
|
13713
|
+
pda: {
|
|
13714
|
+
seeds: [
|
|
13715
|
+
{
|
|
13716
|
+
kind: "const",
|
|
13717
|
+
value: [
|
|
13718
|
+
99,
|
|
13719
|
+
108,
|
|
13720
|
+
97,
|
|
13721
|
+
105,
|
|
13722
|
+
109,
|
|
13723
|
+
95,
|
|
13724
|
+
114,
|
|
13725
|
+
101,
|
|
13726
|
+
99,
|
|
13727
|
+
111,
|
|
13728
|
+
114,
|
|
13729
|
+
100
|
|
13730
|
+
]
|
|
13731
|
+
},
|
|
13732
|
+
{
|
|
13733
|
+
kind: "arg",
|
|
13734
|
+
path: "condition_id"
|
|
13735
|
+
}
|
|
13736
|
+
]
|
|
13737
|
+
}
|
|
13738
|
+
},
|
|
13739
|
+
{
|
|
13740
|
+
name: "claimer_token_account",
|
|
13741
|
+
docs: [
|
|
13742
|
+
"Claimer's USDC token account (receives payout)"
|
|
13743
|
+
],
|
|
13744
|
+
writable: true
|
|
13745
|
+
},
|
|
13746
|
+
{
|
|
13747
|
+
name: "token_program",
|
|
13748
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
13749
|
+
}
|
|
13750
|
+
],
|
|
13751
|
+
args: [
|
|
13752
|
+
{
|
|
13753
|
+
name: "condition_id",
|
|
13754
|
+
type: {
|
|
13755
|
+
array: [
|
|
13756
|
+
"u8",
|
|
13757
|
+
32
|
|
13758
|
+
]
|
|
13759
|
+
}
|
|
13760
|
+
}
|
|
13761
|
+
]
|
|
13762
|
+
},
|
|
13763
|
+
{
|
|
13764
|
+
name: "distribute_market",
|
|
13765
|
+
discriminator: [
|
|
13766
|
+
130,
|
|
13767
|
+
221,
|
|
13768
|
+
123,
|
|
13769
|
+
201,
|
|
13770
|
+
185,
|
|
13771
|
+
168,
|
|
13772
|
+
63,
|
|
13773
|
+
19
|
|
13774
|
+
],
|
|
13775
|
+
accounts: [
|
|
13776
|
+
{
|
|
13777
|
+
name: "claimer",
|
|
13778
|
+
docs: [
|
|
13779
|
+
"BOTMM \u2014 must be in whitelist"
|
|
13780
|
+
],
|
|
13781
|
+
signer: true
|
|
13782
|
+
},
|
|
13783
|
+
{
|
|
13784
|
+
name: "payer",
|
|
13785
|
+
writable: true,
|
|
13786
|
+
signer: true
|
|
13787
|
+
},
|
|
13788
|
+
{
|
|
13789
|
+
name: "config",
|
|
13790
|
+
pda: {
|
|
13791
|
+
seeds: [
|
|
13792
|
+
{
|
|
13793
|
+
kind: "const",
|
|
13794
|
+
value: [
|
|
13795
|
+
97,
|
|
13796
|
+
100,
|
|
13797
|
+
109,
|
|
13798
|
+
105,
|
|
13799
|
+
110,
|
|
13800
|
+
95,
|
|
13801
|
+
99,
|
|
13802
|
+
111,
|
|
13803
|
+
110,
|
|
13804
|
+
102,
|
|
13805
|
+
105,
|
|
13806
|
+
103
|
|
13807
|
+
]
|
|
13808
|
+
},
|
|
13809
|
+
{
|
|
13810
|
+
kind: "account",
|
|
13811
|
+
path: "config.owner",
|
|
13812
|
+
account: "AdminConfig"
|
|
13813
|
+
}
|
|
13814
|
+
]
|
|
13815
|
+
}
|
|
13816
|
+
},
|
|
13817
|
+
{
|
|
13818
|
+
name: "claimer_token_account",
|
|
13819
|
+
docs: [
|
|
13820
|
+
"BOTMM's USDC token account (source \u2014 claimer signs)"
|
|
13821
|
+
],
|
|
13822
|
+
writable: true
|
|
13823
|
+
},
|
|
13824
|
+
{
|
|
13825
|
+
name: "market_oracle_vault",
|
|
13826
|
+
docs: [
|
|
13827
|
+
"market_oracle vault \u2014 MST holder reward pool for this condition"
|
|
13828
|
+
],
|
|
13829
|
+
writable: true
|
|
13830
|
+
},
|
|
13831
|
+
{
|
|
13832
|
+
name: "token_program",
|
|
13833
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
13834
|
+
}
|
|
13835
|
+
],
|
|
13836
|
+
args: [
|
|
13837
|
+
{
|
|
13838
|
+
name: "condition_id",
|
|
13839
|
+
type: {
|
|
13840
|
+
array: [
|
|
13841
|
+
"u8",
|
|
13842
|
+
32
|
|
13843
|
+
]
|
|
13844
|
+
}
|
|
13845
|
+
},
|
|
13846
|
+
{
|
|
13847
|
+
name: "amount",
|
|
13848
|
+
type: "u64"
|
|
13849
|
+
}
|
|
13850
|
+
]
|
|
13851
|
+
},
|
|
13852
|
+
{
|
|
13853
|
+
name: "initialize",
|
|
13854
|
+
discriminator: [
|
|
13855
|
+
175,
|
|
13856
|
+
175,
|
|
13857
|
+
109,
|
|
13858
|
+
31,
|
|
13859
|
+
13,
|
|
13860
|
+
152,
|
|
13861
|
+
155,
|
|
13862
|
+
237
|
|
13863
|
+
],
|
|
13864
|
+
accounts: [
|
|
13865
|
+
{
|
|
13866
|
+
name: "owner",
|
|
13867
|
+
writable: true,
|
|
13868
|
+
signer: true
|
|
13869
|
+
},
|
|
13870
|
+
{
|
|
13871
|
+
name: "config",
|
|
13872
|
+
writable: true,
|
|
13873
|
+
pda: {
|
|
13874
|
+
seeds: [
|
|
13875
|
+
{
|
|
13876
|
+
kind: "const",
|
|
13877
|
+
value: [
|
|
13878
|
+
97,
|
|
13879
|
+
100,
|
|
13880
|
+
109,
|
|
13881
|
+
105,
|
|
13882
|
+
110,
|
|
13883
|
+
95,
|
|
13884
|
+
99,
|
|
13885
|
+
111,
|
|
13886
|
+
110,
|
|
13887
|
+
102,
|
|
13888
|
+
105,
|
|
13889
|
+
103
|
|
13890
|
+
]
|
|
13891
|
+
},
|
|
13892
|
+
{
|
|
13893
|
+
kind: "account",
|
|
13894
|
+
path: "owner"
|
|
13895
|
+
}
|
|
13896
|
+
]
|
|
13897
|
+
}
|
|
13898
|
+
},
|
|
13899
|
+
{
|
|
13900
|
+
name: "collateral_mint"
|
|
13901
|
+
},
|
|
13902
|
+
{
|
|
13903
|
+
name: "admin_vault",
|
|
13904
|
+
docs: [
|
|
13905
|
+
"ATA owned by config PDA \u2014 holds USDC for unclaimed presale revenue"
|
|
13906
|
+
],
|
|
13907
|
+
writable: true,
|
|
13908
|
+
pda: {
|
|
13909
|
+
seeds: [
|
|
13910
|
+
{
|
|
13911
|
+
kind: "account",
|
|
13912
|
+
path: "config"
|
|
13913
|
+
},
|
|
13914
|
+
{
|
|
13915
|
+
kind: "const",
|
|
13916
|
+
value: [
|
|
13917
|
+
6,
|
|
13918
|
+
221,
|
|
13919
|
+
246,
|
|
13920
|
+
225,
|
|
13921
|
+
215,
|
|
13922
|
+
101,
|
|
13923
|
+
161,
|
|
13924
|
+
147,
|
|
13925
|
+
217,
|
|
13926
|
+
203,
|
|
13927
|
+
225,
|
|
13928
|
+
70,
|
|
13929
|
+
206,
|
|
13930
|
+
235,
|
|
13931
|
+
121,
|
|
13932
|
+
172,
|
|
13933
|
+
28,
|
|
13934
|
+
180,
|
|
13935
|
+
133,
|
|
13936
|
+
237,
|
|
13937
|
+
95,
|
|
13938
|
+
91,
|
|
13939
|
+
55,
|
|
13940
|
+
145,
|
|
13941
|
+
58,
|
|
13942
|
+
140,
|
|
13943
|
+
245,
|
|
13944
|
+
133,
|
|
13945
|
+
126,
|
|
13946
|
+
255,
|
|
13947
|
+
0,
|
|
13948
|
+
169
|
|
13949
|
+
]
|
|
13950
|
+
},
|
|
13951
|
+
{
|
|
13952
|
+
kind: "account",
|
|
13953
|
+
path: "collateral_mint"
|
|
13954
|
+
}
|
|
13955
|
+
],
|
|
13956
|
+
program: {
|
|
13957
|
+
kind: "const",
|
|
13958
|
+
value: [
|
|
13959
|
+
140,
|
|
13960
|
+
151,
|
|
13961
|
+
37,
|
|
13962
|
+
143,
|
|
13963
|
+
78,
|
|
13964
|
+
36,
|
|
13965
|
+
137,
|
|
13966
|
+
241,
|
|
13967
|
+
187,
|
|
13968
|
+
61,
|
|
13969
|
+
16,
|
|
13970
|
+
41,
|
|
13971
|
+
20,
|
|
13972
|
+
142,
|
|
13973
|
+
13,
|
|
13974
|
+
131,
|
|
13975
|
+
11,
|
|
13976
|
+
90,
|
|
13977
|
+
19,
|
|
13978
|
+
153,
|
|
13979
|
+
218,
|
|
13980
|
+
255,
|
|
13981
|
+
16,
|
|
13982
|
+
132,
|
|
13983
|
+
4,
|
|
13984
|
+
142,
|
|
13985
|
+
123,
|
|
13986
|
+
216,
|
|
13987
|
+
219,
|
|
13988
|
+
233,
|
|
13989
|
+
248,
|
|
13990
|
+
89
|
|
13991
|
+
]
|
|
13992
|
+
}
|
|
13993
|
+
}
|
|
13994
|
+
},
|
|
13995
|
+
{
|
|
13996
|
+
name: "token_program",
|
|
13997
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
13998
|
+
},
|
|
13999
|
+
{
|
|
14000
|
+
name: "associated_token_program",
|
|
14001
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
14002
|
+
},
|
|
14003
|
+
{
|
|
14004
|
+
name: "system_program",
|
|
14005
|
+
address: "11111111111111111111111111111111"
|
|
14006
|
+
}
|
|
14007
|
+
],
|
|
14008
|
+
args: [
|
|
14009
|
+
{
|
|
14010
|
+
name: "authorized_caller",
|
|
14011
|
+
type: "pubkey"
|
|
14012
|
+
}
|
|
14013
|
+
]
|
|
14014
|
+
},
|
|
14015
|
+
{
|
|
14016
|
+
name: "remove_admin",
|
|
14017
|
+
discriminator: [
|
|
14018
|
+
74,
|
|
14019
|
+
202,
|
|
14020
|
+
71,
|
|
14021
|
+
106,
|
|
14022
|
+
252,
|
|
14023
|
+
31,
|
|
14024
|
+
72,
|
|
14025
|
+
183
|
|
14026
|
+
],
|
|
14027
|
+
accounts: [
|
|
14028
|
+
{
|
|
14029
|
+
name: "owner",
|
|
14030
|
+
signer: true
|
|
14031
|
+
},
|
|
14032
|
+
{
|
|
14033
|
+
name: "config",
|
|
14034
|
+
writable: true,
|
|
14035
|
+
pda: {
|
|
14036
|
+
seeds: [
|
|
14037
|
+
{
|
|
14038
|
+
kind: "const",
|
|
14039
|
+
value: [
|
|
14040
|
+
97,
|
|
14041
|
+
100,
|
|
14042
|
+
109,
|
|
14043
|
+
105,
|
|
14044
|
+
110,
|
|
14045
|
+
95,
|
|
14046
|
+
99,
|
|
14047
|
+
111,
|
|
14048
|
+
110,
|
|
14049
|
+
102,
|
|
14050
|
+
105,
|
|
14051
|
+
103
|
|
14052
|
+
]
|
|
14053
|
+
},
|
|
14054
|
+
{
|
|
14055
|
+
kind: "account",
|
|
14056
|
+
path: "config.owner",
|
|
14057
|
+
account: "AdminConfig"
|
|
14058
|
+
}
|
|
14059
|
+
]
|
|
14060
|
+
}
|
|
14061
|
+
}
|
|
14062
|
+
],
|
|
14063
|
+
args: [
|
|
14064
|
+
{
|
|
14065
|
+
name: "address",
|
|
14066
|
+
type: "pubkey"
|
|
14067
|
+
}
|
|
14068
|
+
]
|
|
14069
|
+
},
|
|
14070
|
+
{
|
|
14071
|
+
name: "remove_from_whitelist",
|
|
14072
|
+
discriminator: [
|
|
14073
|
+
7,
|
|
14074
|
+
144,
|
|
14075
|
+
216,
|
|
14076
|
+
239,
|
|
14077
|
+
243,
|
|
14078
|
+
236,
|
|
14079
|
+
193,
|
|
14080
|
+
235
|
|
14081
|
+
],
|
|
14082
|
+
accounts: [
|
|
14083
|
+
{
|
|
14084
|
+
name: "admin",
|
|
14085
|
+
signer: true
|
|
14086
|
+
},
|
|
14087
|
+
{
|
|
14088
|
+
name: "payer",
|
|
14089
|
+
writable: true,
|
|
14090
|
+
signer: true
|
|
14091
|
+
},
|
|
14092
|
+
{
|
|
14093
|
+
name: "config",
|
|
14094
|
+
writable: true,
|
|
14095
|
+
pda: {
|
|
14096
|
+
seeds: [
|
|
14097
|
+
{
|
|
14098
|
+
kind: "const",
|
|
14099
|
+
value: [
|
|
14100
|
+
97,
|
|
14101
|
+
100,
|
|
14102
|
+
109,
|
|
14103
|
+
105,
|
|
14104
|
+
110,
|
|
14105
|
+
95,
|
|
14106
|
+
99,
|
|
14107
|
+
111,
|
|
14108
|
+
110,
|
|
14109
|
+
102,
|
|
14110
|
+
105,
|
|
14111
|
+
103
|
|
14112
|
+
]
|
|
14113
|
+
},
|
|
14114
|
+
{
|
|
14115
|
+
kind: "account",
|
|
14116
|
+
path: "config.owner",
|
|
14117
|
+
account: "AdminConfig"
|
|
14118
|
+
}
|
|
14119
|
+
]
|
|
14120
|
+
}
|
|
14121
|
+
}
|
|
14122
|
+
],
|
|
14123
|
+
args: [
|
|
14124
|
+
{
|
|
14125
|
+
name: "address",
|
|
14126
|
+
type: "pubkey"
|
|
14127
|
+
}
|
|
14128
|
+
]
|
|
14129
|
+
},
|
|
14130
|
+
{
|
|
14131
|
+
name: "set_presale_amount",
|
|
14132
|
+
discriminator: [
|
|
14133
|
+
73,
|
|
14134
|
+
71,
|
|
14135
|
+
238,
|
|
14136
|
+
3,
|
|
14137
|
+
202,
|
|
14138
|
+
163,
|
|
14139
|
+
8,
|
|
14140
|
+
254
|
|
14141
|
+
],
|
|
14142
|
+
accounts: [
|
|
14143
|
+
{
|
|
14144
|
+
name: "caller",
|
|
14145
|
+
docs: [
|
|
14146
|
+
"question_market config PDA \u2014 signs this CPI call via seeds"
|
|
14147
|
+
],
|
|
14148
|
+
signer: true
|
|
14149
|
+
},
|
|
14150
|
+
{
|
|
14151
|
+
name: "payer",
|
|
14152
|
+
writable: true,
|
|
14153
|
+
signer: true
|
|
14154
|
+
},
|
|
14155
|
+
{
|
|
14156
|
+
name: "config",
|
|
14157
|
+
pda: {
|
|
14158
|
+
seeds: [
|
|
14159
|
+
{
|
|
14160
|
+
kind: "const",
|
|
14161
|
+
value: [
|
|
14162
|
+
97,
|
|
14163
|
+
100,
|
|
14164
|
+
109,
|
|
14165
|
+
105,
|
|
14166
|
+
110,
|
|
14167
|
+
95,
|
|
14168
|
+
99,
|
|
14169
|
+
111,
|
|
14170
|
+
110,
|
|
14171
|
+
102,
|
|
14172
|
+
105,
|
|
14173
|
+
103
|
|
14174
|
+
]
|
|
14175
|
+
},
|
|
14176
|
+
{
|
|
14177
|
+
kind: "account",
|
|
14178
|
+
path: "config.owner",
|
|
14179
|
+
account: "AdminConfig"
|
|
14180
|
+
}
|
|
14181
|
+
]
|
|
14182
|
+
}
|
|
14183
|
+
},
|
|
14184
|
+
{
|
|
14185
|
+
name: "claim_record",
|
|
14186
|
+
writable: true,
|
|
14187
|
+
pda: {
|
|
14188
|
+
seeds: [
|
|
14189
|
+
{
|
|
14190
|
+
kind: "const",
|
|
14191
|
+
value: [
|
|
14192
|
+
99,
|
|
14193
|
+
108,
|
|
14194
|
+
97,
|
|
14195
|
+
105,
|
|
14196
|
+
109,
|
|
14197
|
+
95,
|
|
14198
|
+
114,
|
|
14199
|
+
101,
|
|
14200
|
+
99,
|
|
14201
|
+
111,
|
|
14202
|
+
114,
|
|
14203
|
+
100
|
|
14204
|
+
]
|
|
14205
|
+
},
|
|
14206
|
+
{
|
|
14207
|
+
kind: "arg",
|
|
14208
|
+
path: "condition_id"
|
|
14209
|
+
}
|
|
14210
|
+
]
|
|
14211
|
+
}
|
|
14212
|
+
},
|
|
14213
|
+
{
|
|
14214
|
+
name: "system_program",
|
|
14215
|
+
address: "11111111111111111111111111111111"
|
|
14216
|
+
}
|
|
14217
|
+
],
|
|
14218
|
+
args: [
|
|
14219
|
+
{
|
|
14220
|
+
name: "condition_id",
|
|
14221
|
+
type: {
|
|
14222
|
+
array: [
|
|
14223
|
+
"u8",
|
|
14224
|
+
32
|
|
14225
|
+
]
|
|
14226
|
+
}
|
|
14227
|
+
},
|
|
14228
|
+
{
|
|
14229
|
+
name: "amount",
|
|
14230
|
+
type: "u64"
|
|
14231
|
+
}
|
|
14232
|
+
]
|
|
14233
|
+
},
|
|
14234
|
+
{
|
|
14235
|
+
name: "update_config",
|
|
14236
|
+
discriminator: [
|
|
14237
|
+
29,
|
|
14238
|
+
158,
|
|
14239
|
+
252,
|
|
14240
|
+
191,
|
|
14241
|
+
10,
|
|
14242
|
+
83,
|
|
14243
|
+
219,
|
|
14244
|
+
99
|
|
14245
|
+
],
|
|
14246
|
+
accounts: [
|
|
14247
|
+
{
|
|
14248
|
+
name: "owner",
|
|
14249
|
+
signer: true
|
|
14250
|
+
},
|
|
14251
|
+
{
|
|
14252
|
+
name: "config",
|
|
14253
|
+
writable: true,
|
|
14254
|
+
pda: {
|
|
14255
|
+
seeds: [
|
|
14256
|
+
{
|
|
14257
|
+
kind: "const",
|
|
14258
|
+
value: [
|
|
14259
|
+
97,
|
|
14260
|
+
100,
|
|
14261
|
+
109,
|
|
14262
|
+
105,
|
|
14263
|
+
110,
|
|
14264
|
+
95,
|
|
14265
|
+
99,
|
|
14266
|
+
111,
|
|
14267
|
+
110,
|
|
14268
|
+
102,
|
|
14269
|
+
105,
|
|
14270
|
+
103
|
|
14271
|
+
]
|
|
14272
|
+
},
|
|
14273
|
+
{
|
|
14274
|
+
kind: "account",
|
|
14275
|
+
path: "config.owner",
|
|
14276
|
+
account: "AdminConfig"
|
|
14277
|
+
}
|
|
14278
|
+
]
|
|
14279
|
+
}
|
|
14280
|
+
}
|
|
14281
|
+
],
|
|
14282
|
+
args: [
|
|
14283
|
+
{
|
|
14284
|
+
name: "authorized_caller",
|
|
14285
|
+
type: "pubkey"
|
|
14286
|
+
}
|
|
14287
|
+
]
|
|
14288
|
+
}
|
|
14289
|
+
],
|
|
14290
|
+
accounts: [
|
|
14291
|
+
{
|
|
14292
|
+
name: "AdminConfig",
|
|
14293
|
+
discriminator: [
|
|
14294
|
+
156,
|
|
14295
|
+
10,
|
|
14296
|
+
79,
|
|
14297
|
+
161,
|
|
14298
|
+
71,
|
|
14299
|
+
9,
|
|
14300
|
+
62,
|
|
14301
|
+
77
|
|
14302
|
+
]
|
|
14303
|
+
},
|
|
14304
|
+
{
|
|
14305
|
+
name: "ClaimRecord",
|
|
14306
|
+
discriminator: [
|
|
14307
|
+
57,
|
|
14308
|
+
229,
|
|
14309
|
+
0,
|
|
14310
|
+
9,
|
|
14311
|
+
65,
|
|
14312
|
+
62,
|
|
14313
|
+
96,
|
|
14314
|
+
7
|
|
14315
|
+
]
|
|
14316
|
+
}
|
|
14317
|
+
],
|
|
14318
|
+
types: [
|
|
14319
|
+
{
|
|
14320
|
+
name: "AdminConfig",
|
|
14321
|
+
type: {
|
|
14322
|
+
kind: "struct",
|
|
14323
|
+
fields: [
|
|
14324
|
+
{
|
|
14325
|
+
name: "version",
|
|
14326
|
+
type: "u8"
|
|
14327
|
+
},
|
|
14328
|
+
{
|
|
14329
|
+
name: "owner",
|
|
14330
|
+
type: "pubkey"
|
|
14331
|
+
},
|
|
14332
|
+
{
|
|
14333
|
+
name: "collateral_mint",
|
|
14334
|
+
type: "pubkey"
|
|
14335
|
+
},
|
|
14336
|
+
{
|
|
14337
|
+
name: "authorized_caller",
|
|
14338
|
+
docs: [
|
|
14339
|
+
"question_market config PDA \u2014 only this can call set_presale_amount"
|
|
14340
|
+
],
|
|
14341
|
+
type: "pubkey"
|
|
14342
|
+
},
|
|
14343
|
+
{
|
|
14344
|
+
name: "admin_whitelist",
|
|
14345
|
+
type: {
|
|
14346
|
+
array: [
|
|
14347
|
+
"pubkey",
|
|
14348
|
+
10
|
|
14349
|
+
]
|
|
14350
|
+
}
|
|
14351
|
+
},
|
|
14352
|
+
{
|
|
14353
|
+
name: "admin_whitelist_len",
|
|
14354
|
+
type: "u8"
|
|
14355
|
+
},
|
|
14356
|
+
{
|
|
14357
|
+
name: "whitelist",
|
|
14358
|
+
type: {
|
|
14359
|
+
array: [
|
|
14360
|
+
"pubkey",
|
|
14361
|
+
30
|
|
14362
|
+
]
|
|
14363
|
+
}
|
|
14364
|
+
},
|
|
14365
|
+
{
|
|
14366
|
+
name: "whitelist_len",
|
|
14367
|
+
type: "u8"
|
|
14368
|
+
},
|
|
14369
|
+
{
|
|
14370
|
+
name: "bump",
|
|
14371
|
+
type: "u8"
|
|
14372
|
+
},
|
|
14373
|
+
{
|
|
14374
|
+
name: "_reserved",
|
|
14375
|
+
type: {
|
|
14376
|
+
array: [
|
|
14377
|
+
"u8",
|
|
14378
|
+
64
|
|
14379
|
+
]
|
|
14380
|
+
}
|
|
14381
|
+
}
|
|
14382
|
+
]
|
|
14383
|
+
}
|
|
14384
|
+
},
|
|
14385
|
+
{
|
|
14386
|
+
name: "ClaimRecord",
|
|
14387
|
+
type: {
|
|
14388
|
+
kind: "struct",
|
|
14389
|
+
fields: [
|
|
14390
|
+
{
|
|
14391
|
+
name: "condition_id",
|
|
14392
|
+
type: {
|
|
14393
|
+
array: [
|
|
14394
|
+
"u8",
|
|
14395
|
+
32
|
|
14396
|
+
]
|
|
14397
|
+
}
|
|
14398
|
+
},
|
|
14399
|
+
{
|
|
14400
|
+
name: "amount",
|
|
14401
|
+
type: "u64"
|
|
14402
|
+
},
|
|
14403
|
+
{
|
|
14404
|
+
name: "bump",
|
|
14405
|
+
type: "u8"
|
|
14406
|
+
}
|
|
14407
|
+
]
|
|
14408
|
+
}
|
|
14409
|
+
}
|
|
14410
|
+
]
|
|
14411
|
+
};
|
|
14412
|
+
|
|
14413
|
+
// src/sdk.ts
|
|
14414
|
+
var XMarketSDK = class {
|
|
14415
|
+
// lazy-init in get admin()
|
|
14416
|
+
constructor(config, wallet, marketOwner) {
|
|
14417
|
+
this.networkConfig = config;
|
|
14418
|
+
this.provider = new anchor5.AnchorProvider(
|
|
14419
|
+
new Connection(config.rpcUrl, "confirmed"),
|
|
14420
|
+
wallet,
|
|
14421
|
+
{ commitment: "confirmed", preflightCommitment: "confirmed" }
|
|
14422
|
+
);
|
|
14423
|
+
anchor5.setProvider(this.provider);
|
|
14424
|
+
this._programIds = config.programIds;
|
|
14425
|
+
this._marketOwner = marketOwner ?? wallet.publicKey;
|
|
14426
|
+
}
|
|
14427
|
+
_withAddress(idl, address) {
|
|
14428
|
+
return { ...idl, address: address.toBase58() };
|
|
14429
|
+
}
|
|
14430
|
+
get oracle() {
|
|
14431
|
+
if (!this._oracle) {
|
|
14432
|
+
const program = new anchor5.Program(this._withAddress(oracle_default, this._programIds.oracle), this.provider);
|
|
14433
|
+
this._oracle = new OracleClient(program, this.provider, this._programIds);
|
|
14434
|
+
}
|
|
14435
|
+
return this._oracle;
|
|
14436
|
+
}
|
|
14437
|
+
get hook() {
|
|
14438
|
+
if (!this._hook) {
|
|
14439
|
+
const program = new anchor5.Program(this._withAddress(hook_default, this._programIds.hook), this.provider);
|
|
14440
|
+
this._hook = new HookClient(program, this.provider, this._programIds);
|
|
14441
|
+
}
|
|
14442
|
+
return this._hook;
|
|
14443
|
+
}
|
|
14444
|
+
get market() {
|
|
14445
|
+
if (!this._market) {
|
|
14446
|
+
const program = new anchor5.Program(this._withAddress(question_market_default, this._programIds.questionMarket), this.provider);
|
|
14447
|
+
this._market = new MarketClient(program, this.provider, this._programIds, this._marketOwner);
|
|
14448
|
+
this._market.ctfClient = this.ctf;
|
|
14449
|
+
}
|
|
14450
|
+
return this._market;
|
|
14451
|
+
}
|
|
14452
|
+
get ctf() {
|
|
14453
|
+
if (!this._ctf) {
|
|
14454
|
+
const program = new anchor5.Program(this._withAddress(conditional_tokens_default, this._programIds.conditionalTokens), this.provider);
|
|
14455
|
+
this._ctf = new CtfClient(program, this.provider, this._programIds);
|
|
14456
|
+
}
|
|
14457
|
+
return this._ctf;
|
|
14458
|
+
}
|
|
14459
|
+
get clob() {
|
|
14460
|
+
if (!this._clob) {
|
|
14461
|
+
const program = new anchor5.Program(this._withAddress(clob_exchange_default, this._programIds.clobExchange), this.provider);
|
|
14462
|
+
this._clob = new ClobClient(program, this.provider, this._programIds, this.networkConfig);
|
|
14463
|
+
if (this.networkConfig.feeConfigOwner && this._programIds.feeManagement) {
|
|
14464
|
+
this._clob.feeConfigOwner = this.networkConfig.feeConfigOwner;
|
|
14465
|
+
this._clob.feeClient = this.fee;
|
|
14466
|
+
}
|
|
14467
|
+
}
|
|
14468
|
+
return this._clob;
|
|
14469
|
+
}
|
|
14470
|
+
get fee() {
|
|
14471
|
+
if (!this._fee) {
|
|
14472
|
+
if (!this._programIds.feeManagement) throw new Error("feeManagement program ID not configured in NetworkConfig");
|
|
14473
|
+
const program = new anchor5.Program(this._withAddress(fee_management_default, this._programIds.feeManagement), this.provider);
|
|
14474
|
+
this._fee = new FeeManagementClient(program, this.provider, this._programIds);
|
|
14475
|
+
}
|
|
14476
|
+
return this._fee;
|
|
14477
|
+
}
|
|
14478
|
+
get presale() {
|
|
14479
|
+
if (!this._presale) {
|
|
14480
|
+
if (!this._programIds.presale) throw new Error("presale program ID not configured in NetworkConfig");
|
|
14481
|
+
const program = new anchor5.Program(this._withAddress(presale_default, this._programIds.presale), this.provider);
|
|
14482
|
+
this._presale = new PresaleClient(program, this.provider, this._programIds);
|
|
14483
|
+
}
|
|
14484
|
+
return this._presale;
|
|
14485
|
+
}
|
|
14486
|
+
get marketOracle() {
|
|
14487
|
+
if (!this._marketOracle) {
|
|
14488
|
+
if (!this._programIds.marketOracle) throw new Error("marketOracle program ID not configured in NetworkConfig");
|
|
14489
|
+
const program = new anchor5.Program(this._withAddress(market_oracle_default, this._programIds.marketOracle), this.provider);
|
|
14490
|
+
this._marketOracle = new MarketOracleClient(program, this.provider, this._programIds);
|
|
14491
|
+
}
|
|
14492
|
+
return this._marketOracle;
|
|
14493
|
+
}
|
|
14494
|
+
get admin() {
|
|
14495
|
+
if (!this._admin) {
|
|
14496
|
+
if (!this._programIds.adminContract) throw new Error("adminContract program ID not configured in NetworkConfig");
|
|
14497
|
+
const program = new anchor5.Program(this._withAddress(admin_contract_default, this._programIds.adminContract), this.provider);
|
|
14498
|
+
this._admin = new AdminClient(program, this.provider, this._programIds);
|
|
14499
|
+
}
|
|
14500
|
+
return this._admin;
|
|
13276
14501
|
}
|
|
13277
14502
|
};
|
|
13278
14503
|
function buildOrder(params) {
|
|
@@ -13403,6 +14628,6 @@ function buildApproveAllOutcomeTokensTx(condition, signer, payer, delegate, prog
|
|
|
13403
14628
|
return tx;
|
|
13404
14629
|
}
|
|
13405
14630
|
|
|
13406
|
-
export { AccountNotFoundError, 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, buildOrder, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
|
|
14631
|
+
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, buildOrder, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
|
|
13407
14632
|
//# sourceMappingURL=index.mjs.map
|
|
13408
14633
|
//# sourceMappingURL=index.mjs.map
|