@theliem/xmarket-sdk 4.0.0 → 4.0.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 +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +28 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -418,6 +418,8 @@ declare class MarketClient {
|
|
|
418
418
|
restoreConfig(snapshot: Buffer, owner?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
419
419
|
bumpPresaleCount(count: number, authority: PublicKey): Promise<Transaction>;
|
|
420
420
|
fetchConfig(): Promise<QuestionMarketConfig | null>;
|
|
421
|
+
/** Check if address is in question_market whitelist (can call createQuestion) */
|
|
422
|
+
isWhitelisted(address: PublicKey): Promise<boolean>;
|
|
421
423
|
fetchQuestion(questionPda: PublicKey): Promise<Question | null>;
|
|
422
424
|
questionPda(questionId: Uint8Array): PublicKey;
|
|
423
425
|
private _parseStatus;
|
|
@@ -846,6 +848,8 @@ declare class ClobClient {
|
|
|
846
848
|
*/
|
|
847
849
|
buildAltForCondition(condition: PublicKey, _payer: PublicKey, collateralMint?: PublicKey): Promise<AddressLookupTableAccount>;
|
|
848
850
|
fetchConfig(): Promise<ClobConfig | null>;
|
|
851
|
+
/** Check if address is a CLOB operator (can submit match transactions) */
|
|
852
|
+
isOperator(address: PublicKey): Promise<boolean>;
|
|
849
853
|
fetchOrderStatus(maker: PublicKey, nonce: anchor.BN): Promise<OrderStatus | null>;
|
|
850
854
|
fetchOrderRecord(maker: PublicKey, nonce: anchor.BN): Promise<{
|
|
851
855
|
maker: PublicKey;
|
|
@@ -1007,6 +1011,10 @@ declare class AdminClient {
|
|
|
1007
1011
|
configPdaFor(owner: PublicKey): PublicKey;
|
|
1008
1012
|
adminVault(owner: PublicKey, collateralMint: PublicKey): PublicKey;
|
|
1009
1013
|
fetchConfig(owner?: anchor.web3.PublicKey): Promise<AdminConfigInfo | null>;
|
|
1014
|
+
/** Check if address is in admin_whitelist (can call addToWhitelist, removeFromWhitelist) */
|
|
1015
|
+
isAdmin(address: PublicKey, owner?: anchor.web3.PublicKey): Promise<boolean>;
|
|
1016
|
+
/** Check if address is in whitelist (can call claim) */
|
|
1017
|
+
isWhitelisted(address: PublicKey, owner?: anchor.web3.PublicKey): Promise<boolean>;
|
|
1010
1018
|
fetchClaimRecord(conditionId: Uint8Array): Promise<ClaimRecordInfo | null>;
|
|
1011
1019
|
initialize(authorizedCaller: PublicKey, collateralMint: PublicKey, owner?: PublicKey): Promise<Transaction>;
|
|
1012
1020
|
addAdmin(address: PublicKey, owner?: PublicKey): Promise<Transaction>;
|
|
@@ -1041,6 +1049,8 @@ declare class ReferralClient {
|
|
|
1041
1049
|
get walletPubkey(): PublicKey;
|
|
1042
1050
|
referralVault(owner: PublicKey, collateralMint: PublicKey): PublicKey;
|
|
1043
1051
|
fetchConfig(owner: PublicKey): Promise<ReferralConfigInfo | null>;
|
|
1052
|
+
/** Check if address is whitelisted in referral config (can call batchSendUsds) */
|
|
1053
|
+
isWhitelisted(address: PublicKey, owner?: anchor.web3.PublicKey): Promise<boolean>;
|
|
1044
1054
|
/**
|
|
1045
1055
|
* Build initialize tx — creates referral config PDA.
|
|
1046
1056
|
* Also prepends an ATA creation instruction for the referral vault (idempotent).
|
package/dist/index.d.ts
CHANGED
|
@@ -418,6 +418,8 @@ declare class MarketClient {
|
|
|
418
418
|
restoreConfig(snapshot: Buffer, owner?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
419
419
|
bumpPresaleCount(count: number, authority: PublicKey): Promise<Transaction>;
|
|
420
420
|
fetchConfig(): Promise<QuestionMarketConfig | null>;
|
|
421
|
+
/** Check if address is in question_market whitelist (can call createQuestion) */
|
|
422
|
+
isWhitelisted(address: PublicKey): Promise<boolean>;
|
|
421
423
|
fetchQuestion(questionPda: PublicKey): Promise<Question | null>;
|
|
422
424
|
questionPda(questionId: Uint8Array): PublicKey;
|
|
423
425
|
private _parseStatus;
|
|
@@ -846,6 +848,8 @@ declare class ClobClient {
|
|
|
846
848
|
*/
|
|
847
849
|
buildAltForCondition(condition: PublicKey, _payer: PublicKey, collateralMint?: PublicKey): Promise<AddressLookupTableAccount>;
|
|
848
850
|
fetchConfig(): Promise<ClobConfig | null>;
|
|
851
|
+
/** Check if address is a CLOB operator (can submit match transactions) */
|
|
852
|
+
isOperator(address: PublicKey): Promise<boolean>;
|
|
849
853
|
fetchOrderStatus(maker: PublicKey, nonce: anchor.BN): Promise<OrderStatus | null>;
|
|
850
854
|
fetchOrderRecord(maker: PublicKey, nonce: anchor.BN): Promise<{
|
|
851
855
|
maker: PublicKey;
|
|
@@ -1007,6 +1011,10 @@ declare class AdminClient {
|
|
|
1007
1011
|
configPdaFor(owner: PublicKey): PublicKey;
|
|
1008
1012
|
adminVault(owner: PublicKey, collateralMint: PublicKey): PublicKey;
|
|
1009
1013
|
fetchConfig(owner?: anchor.web3.PublicKey): Promise<AdminConfigInfo | null>;
|
|
1014
|
+
/** Check if address is in admin_whitelist (can call addToWhitelist, removeFromWhitelist) */
|
|
1015
|
+
isAdmin(address: PublicKey, owner?: anchor.web3.PublicKey): Promise<boolean>;
|
|
1016
|
+
/** Check if address is in whitelist (can call claim) */
|
|
1017
|
+
isWhitelisted(address: PublicKey, owner?: anchor.web3.PublicKey): Promise<boolean>;
|
|
1010
1018
|
fetchClaimRecord(conditionId: Uint8Array): Promise<ClaimRecordInfo | null>;
|
|
1011
1019
|
initialize(authorizedCaller: PublicKey, collateralMint: PublicKey, owner?: PublicKey): Promise<Transaction>;
|
|
1012
1020
|
addAdmin(address: PublicKey, owner?: PublicKey): Promise<Transaction>;
|
|
@@ -1041,6 +1049,8 @@ declare class ReferralClient {
|
|
|
1041
1049
|
get walletPubkey(): PublicKey;
|
|
1042
1050
|
referralVault(owner: PublicKey, collateralMint: PublicKey): PublicKey;
|
|
1043
1051
|
fetchConfig(owner: PublicKey): Promise<ReferralConfigInfo | null>;
|
|
1052
|
+
/** Check if address is whitelisted in referral config (can call batchSendUsds) */
|
|
1053
|
+
isWhitelisted(address: PublicKey, owner?: anchor.web3.PublicKey): Promise<boolean>;
|
|
1044
1054
|
/**
|
|
1045
1055
|
* Build initialize tx — creates referral config PDA.
|
|
1046
1056
|
* Also prepends an ATA creation instruction for the referral vault (idempotent).
|
package/dist/index.js
CHANGED
|
@@ -653,6 +653,11 @@ var MarketClient = class {
|
|
|
653
653
|
return null;
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
|
+
/** Check if address is in question_market whitelist (can call createQuestion) */
|
|
657
|
+
async isWhitelisted(address) {
|
|
658
|
+
const cfg = await this.fetchConfig();
|
|
659
|
+
return cfg?.whitelist.some((k) => k.equals(address)) ?? false;
|
|
660
|
+
}
|
|
656
661
|
async fetchQuestion(questionPda) {
|
|
657
662
|
try {
|
|
658
663
|
const acc = await this.program.account.question.fetch(questionPda);
|
|
@@ -2944,6 +2949,11 @@ ${logs.join("\n")}`);
|
|
|
2944
2949
|
return null;
|
|
2945
2950
|
}
|
|
2946
2951
|
}
|
|
2952
|
+
/** Check if address is a CLOB operator (can submit match transactions) */
|
|
2953
|
+
async isOperator(address) {
|
|
2954
|
+
const cfg = await this.fetchConfig();
|
|
2955
|
+
return cfg?.operators.some((k) => k.equals(address)) ?? false;
|
|
2956
|
+
}
|
|
2947
2957
|
async fetchOrderStatus(maker, nonce) {
|
|
2948
2958
|
try {
|
|
2949
2959
|
const [pda] = PDA.orderStatus(maker, nonce, this.programIds);
|
|
@@ -3455,6 +3465,16 @@ var AdminClient = class {
|
|
|
3455
3465
|
return null;
|
|
3456
3466
|
}
|
|
3457
3467
|
}
|
|
3468
|
+
/** Check if address is in admin_whitelist (can call addToWhitelist, removeFromWhitelist) */
|
|
3469
|
+
async isAdmin(address, owner = this.walletPubkey) {
|
|
3470
|
+
const cfg = await this.fetchConfig(owner);
|
|
3471
|
+
return cfg?.adminWhitelist.some((k) => k.equals(address)) ?? false;
|
|
3472
|
+
}
|
|
3473
|
+
/** Check if address is in whitelist (can call claim) */
|
|
3474
|
+
async isWhitelisted(address, owner = this.walletPubkey) {
|
|
3475
|
+
const cfg = await this.fetchConfig(owner);
|
|
3476
|
+
return cfg?.whitelist.some((k) => k.equals(address)) ?? false;
|
|
3477
|
+
}
|
|
3458
3478
|
async fetchClaimRecord(conditionId) {
|
|
3459
3479
|
const [pda] = PDA.claimRecord(conditionId, this.programIds);
|
|
3460
3480
|
try {
|
|
@@ -3576,6 +3596,11 @@ var ReferralClient = class {
|
|
|
3576
3596
|
return null;
|
|
3577
3597
|
}
|
|
3578
3598
|
}
|
|
3599
|
+
/** Check if address is whitelisted in referral config (can call batchSendUsds) */
|
|
3600
|
+
async isWhitelisted(address, owner = this.walletPubkey) {
|
|
3601
|
+
const cfg = await this.fetchConfig(owner);
|
|
3602
|
+
return cfg?.whitelist.some((k) => k.equals(address)) ?? false;
|
|
3603
|
+
}
|
|
3579
3604
|
/**
|
|
3580
3605
|
* Build initialize tx — creates referral config PDA.
|
|
3581
3606
|
* Also prepends an ATA creation instruction for the referral vault (idempotent).
|
|
@@ -16261,29 +16286,11 @@ var admin_contract_default = {
|
|
|
16261
16286
|
accounts: [
|
|
16262
16287
|
{
|
|
16263
16288
|
name: "AdminConfig",
|
|
16264
|
-
discriminator: [
|
|
16265
|
-
156,
|
|
16266
|
-
10,
|
|
16267
|
-
79,
|
|
16268
|
-
161,
|
|
16269
|
-
71,
|
|
16270
|
-
9,
|
|
16271
|
-
62,
|
|
16272
|
-
77
|
|
16273
|
-
]
|
|
16289
|
+
discriminator: [156, 10, 79, 161, 71, 9, 62, 77]
|
|
16274
16290
|
},
|
|
16275
16291
|
{
|
|
16276
16292
|
name: "ClaimRecord",
|
|
16277
|
-
discriminator: [
|
|
16278
|
-
57,
|
|
16279
|
-
229,
|
|
16280
|
-
0,
|
|
16281
|
-
9,
|
|
16282
|
-
65,
|
|
16283
|
-
62,
|
|
16284
|
-
96,
|
|
16285
|
-
7
|
|
16286
|
-
]
|
|
16293
|
+
discriminator: [57, 229, 0, 9, 65, 62, 96, 7]
|
|
16287
16294
|
}
|
|
16288
16295
|
],
|
|
16289
16296
|
types: [
|
|
@@ -16329,7 +16336,7 @@ var admin_contract_default = {
|
|
|
16329
16336
|
type: {
|
|
16330
16337
|
array: [
|
|
16331
16338
|
"pubkey",
|
|
16332
|
-
|
|
16339
|
+
28
|
|
16333
16340
|
]
|
|
16334
16341
|
}
|
|
16335
16342
|
},
|
|
@@ -16340,15 +16347,6 @@ var admin_contract_default = {
|
|
|
16340
16347
|
{
|
|
16341
16348
|
name: "bump",
|
|
16342
16349
|
type: "u8"
|
|
16343
|
-
},
|
|
16344
|
-
{
|
|
16345
|
-
name: "_reserved",
|
|
16346
|
-
type: {
|
|
16347
|
-
array: [
|
|
16348
|
-
"u8",
|
|
16349
|
-
64
|
|
16350
|
-
]
|
|
16351
|
-
}
|
|
16352
16350
|
}
|
|
16353
16351
|
]
|
|
16354
16352
|
}
|