@theliem/xmarket-sdk 4.0.0 → 4.0.2

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.mjs CHANGED
@@ -627,6 +627,11 @@ var MarketClient = class {
627
627
  return null;
628
628
  }
629
629
  }
630
+ /** Check if address is in question_market whitelist (can call createQuestion) */
631
+ async isWhitelisted(address) {
632
+ const cfg = await this.fetchConfig();
633
+ return cfg?.whitelist.some((k) => k.equals(address)) ?? false;
634
+ }
630
635
  async fetchQuestion(questionPda) {
631
636
  try {
632
637
  const acc = await this.program.account.question.fetch(questionPda);
@@ -2905,7 +2910,7 @@ ${logs.join("\n")}`);
2905
2910
  try {
2906
2911
  const acc = await this.program.account.clobConfig.fetch(this.configPda());
2907
2912
  return {
2908
- owner: acc.owner,
2913
+ admin: acc.admin,
2909
2914
  operators: acc.operators,
2910
2915
  operatorsLen: acc.operatorsLen,
2911
2916
  feeRecipient: acc.feeRecipient,
@@ -2918,6 +2923,11 @@ ${logs.join("\n")}`);
2918
2923
  return null;
2919
2924
  }
2920
2925
  }
2926
+ /** Check if address is a CLOB operator (can submit match transactions) */
2927
+ async isOperator(address) {
2928
+ const cfg = await this.fetchConfig();
2929
+ return cfg?.operators.some((k) => k.equals(address)) ?? false;
2930
+ }
2921
2931
  async fetchOrderStatus(maker, nonce) {
2922
2932
  try {
2923
2933
  const [pda] = PDA.orderStatus(maker, nonce, this.programIds);
@@ -3429,6 +3439,16 @@ var AdminClient = class {
3429
3439
  return null;
3430
3440
  }
3431
3441
  }
3442
+ /** Check if address is in admin_whitelist (can call addToWhitelist, removeFromWhitelist) */
3443
+ async isAdmin(address, owner = this.walletPubkey) {
3444
+ const cfg = await this.fetchConfig(owner);
3445
+ return cfg?.adminWhitelist.some((k) => k.equals(address)) ?? false;
3446
+ }
3447
+ /** Check if address is in whitelist (can call claim) */
3448
+ async isWhitelisted(address, owner = this.walletPubkey) {
3449
+ const cfg = await this.fetchConfig(owner);
3450
+ return cfg?.whitelist.some((k) => k.equals(address)) ?? false;
3451
+ }
3432
3452
  async fetchClaimRecord(conditionId) {
3433
3453
  const [pda] = PDA.claimRecord(conditionId, this.programIds);
3434
3454
  try {
@@ -3550,6 +3570,11 @@ var ReferralClient = class {
3550
3570
  return null;
3551
3571
  }
3552
3572
  }
3573
+ /** Check if address is whitelisted in referral config (can call batchSendUsds) */
3574
+ async isWhitelisted(address, owner = this.walletPubkey) {
3575
+ const cfg = await this.fetchConfig(owner);
3576
+ return cfg?.whitelist.some((k) => k.equals(address)) ?? false;
3577
+ }
3553
3578
  /**
3554
3579
  * Build initialize tx — creates referral config PDA.
3555
3580
  * Also prepends an ATA creation instruction for the referral vault (idempotent).
@@ -16235,29 +16260,11 @@ var admin_contract_default = {
16235
16260
  accounts: [
16236
16261
  {
16237
16262
  name: "AdminConfig",
16238
- discriminator: [
16239
- 156,
16240
- 10,
16241
- 79,
16242
- 161,
16243
- 71,
16244
- 9,
16245
- 62,
16246
- 77
16247
- ]
16263
+ discriminator: [156, 10, 79, 161, 71, 9, 62, 77]
16248
16264
  },
16249
16265
  {
16250
16266
  name: "ClaimRecord",
16251
- discriminator: [
16252
- 57,
16253
- 229,
16254
- 0,
16255
- 9,
16256
- 65,
16257
- 62,
16258
- 96,
16259
- 7
16260
- ]
16267
+ discriminator: [57, 229, 0, 9, 65, 62, 96, 7]
16261
16268
  }
16262
16269
  ],
16263
16270
  types: [
@@ -16303,7 +16310,7 @@ var admin_contract_default = {
16303
16310
  type: {
16304
16311
  array: [
16305
16312
  "pubkey",
16306
- 30
16313
+ 28
16307
16314
  ]
16308
16315
  }
16309
16316
  },
@@ -16314,15 +16321,6 @@ var admin_contract_default = {
16314
16321
  {
16315
16322
  name: "bump",
16316
16323
  type: "u8"
16317
- },
16318
- {
16319
- name: "_reserved",
16320
- type: {
16321
- array: [
16322
- "u8",
16323
- 64
16324
- ]
16325
- }
16326
16324
  }
16327
16325
  ]
16328
16326
  }