@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 CHANGED
@@ -12,6 +12,7 @@ interface ProgramIds {
12
12
  feeManagement?: PublicKey;
13
13
  presale?: PublicKey;
14
14
  marketOracle?: PublicKey;
15
+ adminContract?: PublicKey;
15
16
  }
16
17
  interface CollateralConfig {
17
18
  mint: PublicKey;
@@ -490,7 +491,16 @@ declare class MarketClient {
490
491
  * Whitelist-only: distribute presale vault → 10% agents + 10% company + 80% botmm.
491
492
  * Closes presale_vault ATA and presale PDA after distribution; lamports returned to payer.
492
493
  */
493
- collectPresaleRevenue(presalePda: PublicKey, currencyMint: PublicKey, referralAddress: PublicKey, companyAddress: PublicKey, botmmAddress: PublicKey, caller?: PublicKey, payer?: PublicKey): Promise<Transaction>;
494
+ collectPresaleRevenue(params: {
495
+ presalePda: PublicKey;
496
+ currencyMint: PublicKey;
497
+ conditionId: Uint8Array;
498
+ referralAddress: PublicKey;
499
+ companyAddress: PublicKey;
500
+ adminOwner: PublicKey;
501
+ caller?: PublicKey;
502
+ payer?: PublicKey;
503
+ }): Promise<Transaction>;
494
504
  /**
495
505
  * Whitelist-only: snapshot MST supply so holders can claim trading fees.
496
506
  * Call after oracle resolves the question.
@@ -732,6 +742,50 @@ declare class MarketOracleClient {
732
742
  fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
733
743
  }
734
744
 
745
+ interface AdminConfigInfo {
746
+ version: number;
747
+ owner: PublicKey;
748
+ collateralMint: PublicKey;
749
+ authorizedCaller: PublicKey;
750
+ adminWhitelist: PublicKey[];
751
+ whitelist: PublicKey[];
752
+ bump: number;
753
+ }
754
+ interface ClaimRecordInfo {
755
+ conditionId: number[];
756
+ amount: anchor.BN;
757
+ bump: number;
758
+ }
759
+ declare class AdminClient {
760
+ private readonly program;
761
+ private readonly provider;
762
+ private readonly programIds;
763
+ constructor(program: anchor.Program, provider: anchor.AnchorProvider, programIds: ProgramIds);
764
+ get walletPubkey(): PublicKey;
765
+ get configPda(): PublicKey;
766
+ configPdaFor(owner: PublicKey): PublicKey;
767
+ adminVault(owner: PublicKey, collateralMint: PublicKey): PublicKey;
768
+ fetchConfig(owner?: anchor.web3.PublicKey): Promise<AdminConfigInfo | null>;
769
+ fetchClaimRecord(conditionId: Uint8Array): Promise<ClaimRecordInfo | null>;
770
+ initialize(authorizedCaller: PublicKey, collateralMint: PublicKey, owner?: PublicKey): Promise<Transaction>;
771
+ addAdmin(address: PublicKey, owner?: PublicKey): Promise<Transaction>;
772
+ removeAdmin(address: PublicKey, owner?: PublicKey): Promise<Transaction>;
773
+ addToWhitelist(address: PublicKey, owner: PublicKey, admin?: PublicKey, payer?: PublicKey): Promise<Transaction>;
774
+ removeFromWhitelist(address: PublicKey, owner: PublicKey, admin?: PublicKey, payer?: PublicKey): Promise<Transaction>;
775
+ /**
776
+ * Normally called via CPI from question_market (authorized_caller signs).
777
+ * For testing: initialize with authorizedCaller = wallet, call directly.
778
+ */
779
+ setPresaleAmount(conditionId: Uint8Array, amount: anchor.BN, owner?: PublicKey, caller?: PublicKey, payer?: PublicKey): Promise<Transaction>;
780
+ claim(conditionId: Uint8Array, collateralMint: PublicKey, owner: PublicKey, claimer?: PublicKey, payer?: PublicKey): Promise<Transaction>;
781
+ updateConfig(authorizedCaller: PublicKey, owner?: PublicKey): Promise<Transaction>;
782
+ /**
783
+ * BOTMM sends USDC from their wallet to the market_oracle vault for a condition.
784
+ * Whitelist-only. No amount validation — caller responsible.
785
+ */
786
+ distributeMarket(conditionId: Uint8Array, amount: anchor.BN, collateralMint: PublicKey, marketOracleVault: PublicKey, owner: PublicKey, claimer?: PublicKey, payer?: PublicKey): Promise<Transaction>;
787
+ }
788
+
735
789
  declare class XMarketSDK {
736
790
  readonly provider: anchor.AnchorProvider;
737
791
  readonly networkConfig: NetworkConfig;
@@ -745,6 +799,7 @@ declare class XMarketSDK {
745
799
  private _fee?;
746
800
  private _presale?;
747
801
  private _marketOracle?;
802
+ private _admin?;
748
803
  constructor(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey);
749
804
  private _withAddress;
750
805
  get oracle(): OracleClient;
@@ -755,6 +810,7 @@ declare class XMarketSDK {
755
810
  get fee(): FeeManagementClient;
756
811
  get presale(): PresaleClient;
757
812
  get marketOracle(): MarketOracleClient;
813
+ get admin(): AdminClient;
758
814
  }
759
815
 
760
816
  declare const SEEDS: {
@@ -783,6 +839,8 @@ declare const SEEDS: {
783
839
  readonly userBuy: Buffer<ArrayBuffer>;
784
840
  readonly marketOracle: Buffer<ArrayBuffer>;
785
841
  readonly userClaim: Buffer<ArrayBuffer>;
842
+ readonly adminConfig: Buffer<ArrayBuffer>;
843
+ readonly claimRecord: Buffer<ArrayBuffer>;
786
844
  };
787
845
  declare class PDA {
788
846
  static questionMarketConfig(owner: PublicKey, programIds: Pick<ProgramIds, "questionMarket">): [PublicKey, number];
@@ -812,6 +870,8 @@ declare class PDA {
812
870
  static userBuyRecord(presalePda: PublicKey, user: PublicKey, programIds: Pick<ProgramIds, "presale">): [PublicKey, number];
813
871
  static marketOraclePda(questionPda: PublicKey, programIds: Pick<ProgramIds, "marketOracle">): [PublicKey, number];
814
872
  static userClaimRecord(marketOraclePda: PublicKey, user: PublicKey, programIds: Pick<ProgramIds, "marketOracle">): [PublicKey, number];
873
+ static adminConfig(owner: PublicKey, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
874
+ static claimRecord(conditionId: Uint8Array, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
815
875
  }
816
876
  /** Unique 32-byte question ID: SHA-256(content + timestamp). Different each call. */
817
877
  declare function generateQuestionId(content: string, salt?: number): Uint8Array;
@@ -945,4 +1005,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
945
1005
  */
946
1006
  declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
947
1007
 
948
- export { AccountNotFoundError, ClobClient, type ClobConfig, type CollateralConfig, type CollateralVault, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig, FEE_DENOMINATOR, FeeManagementClient, HookClient, type HookConfig, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, MarketOracleClient, type MarketOracleInfo, type MatchType, type NetworkConfig, type NetworkName, OracleClient, type OracleConfig, type Order, type OrderStatus, PDA, type Position, PresaleClient, type PresaleInfo, type ProgramIds, type Question, type QuestionFee, type QuestionMarketConfig, type QuestionResult, QuestionStatus, SEEDS, type SignedOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedEd25519Instruction, buildOrder, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
1008
+ export { AccountNotFoundError, AdminClient, type AdminConfigInfo, type ClaimRecordInfo, ClobClient, type ClobConfig, type CollateralConfig, type CollateralVault, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig, FEE_DENOMINATOR, FeeManagementClient, HookClient, type HookConfig, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, MarketOracleClient, type MarketOracleInfo, type MatchType, type NetworkConfig, type NetworkName, OracleClient, type OracleConfig, type Order, type OrderStatus, PDA, type Position, PresaleClient, type PresaleInfo, type ProgramIds, type Question, type QuestionFee, type QuestionMarketConfig, type QuestionResult, QuestionStatus, SEEDS, type SignedOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedEd25519Instruction, buildOrder, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ interface ProgramIds {
12
12
  feeManagement?: PublicKey;
13
13
  presale?: PublicKey;
14
14
  marketOracle?: PublicKey;
15
+ adminContract?: PublicKey;
15
16
  }
16
17
  interface CollateralConfig {
17
18
  mint: PublicKey;
@@ -490,7 +491,16 @@ declare class MarketClient {
490
491
  * Whitelist-only: distribute presale vault → 10% agents + 10% company + 80% botmm.
491
492
  * Closes presale_vault ATA and presale PDA after distribution; lamports returned to payer.
492
493
  */
493
- collectPresaleRevenue(presalePda: PublicKey, currencyMint: PublicKey, referralAddress: PublicKey, companyAddress: PublicKey, botmmAddress: PublicKey, caller?: PublicKey, payer?: PublicKey): Promise<Transaction>;
494
+ collectPresaleRevenue(params: {
495
+ presalePda: PublicKey;
496
+ currencyMint: PublicKey;
497
+ conditionId: Uint8Array;
498
+ referralAddress: PublicKey;
499
+ companyAddress: PublicKey;
500
+ adminOwner: PublicKey;
501
+ caller?: PublicKey;
502
+ payer?: PublicKey;
503
+ }): Promise<Transaction>;
494
504
  /**
495
505
  * Whitelist-only: snapshot MST supply so holders can claim trading fees.
496
506
  * Call after oracle resolves the question.
@@ -732,6 +742,50 @@ declare class MarketOracleClient {
732
742
  fetchUserClaimRecord(marketOraclePda: PublicKey, user: PublicKey): Promise<UserClaimRecord | null>;
733
743
  }
734
744
 
745
+ interface AdminConfigInfo {
746
+ version: number;
747
+ owner: PublicKey;
748
+ collateralMint: PublicKey;
749
+ authorizedCaller: PublicKey;
750
+ adminWhitelist: PublicKey[];
751
+ whitelist: PublicKey[];
752
+ bump: number;
753
+ }
754
+ interface ClaimRecordInfo {
755
+ conditionId: number[];
756
+ amount: anchor.BN;
757
+ bump: number;
758
+ }
759
+ declare class AdminClient {
760
+ private readonly program;
761
+ private readonly provider;
762
+ private readonly programIds;
763
+ constructor(program: anchor.Program, provider: anchor.AnchorProvider, programIds: ProgramIds);
764
+ get walletPubkey(): PublicKey;
765
+ get configPda(): PublicKey;
766
+ configPdaFor(owner: PublicKey): PublicKey;
767
+ adminVault(owner: PublicKey, collateralMint: PublicKey): PublicKey;
768
+ fetchConfig(owner?: anchor.web3.PublicKey): Promise<AdminConfigInfo | null>;
769
+ fetchClaimRecord(conditionId: Uint8Array): Promise<ClaimRecordInfo | null>;
770
+ initialize(authorizedCaller: PublicKey, collateralMint: PublicKey, owner?: PublicKey): Promise<Transaction>;
771
+ addAdmin(address: PublicKey, owner?: PublicKey): Promise<Transaction>;
772
+ removeAdmin(address: PublicKey, owner?: PublicKey): Promise<Transaction>;
773
+ addToWhitelist(address: PublicKey, owner: PublicKey, admin?: PublicKey, payer?: PublicKey): Promise<Transaction>;
774
+ removeFromWhitelist(address: PublicKey, owner: PublicKey, admin?: PublicKey, payer?: PublicKey): Promise<Transaction>;
775
+ /**
776
+ * Normally called via CPI from question_market (authorized_caller signs).
777
+ * For testing: initialize with authorizedCaller = wallet, call directly.
778
+ */
779
+ setPresaleAmount(conditionId: Uint8Array, amount: anchor.BN, owner?: PublicKey, caller?: PublicKey, payer?: PublicKey): Promise<Transaction>;
780
+ claim(conditionId: Uint8Array, collateralMint: PublicKey, owner: PublicKey, claimer?: PublicKey, payer?: PublicKey): Promise<Transaction>;
781
+ updateConfig(authorizedCaller: PublicKey, owner?: PublicKey): Promise<Transaction>;
782
+ /**
783
+ * BOTMM sends USDC from their wallet to the market_oracle vault for a condition.
784
+ * Whitelist-only. No amount validation — caller responsible.
785
+ */
786
+ distributeMarket(conditionId: Uint8Array, amount: anchor.BN, collateralMint: PublicKey, marketOracleVault: PublicKey, owner: PublicKey, claimer?: PublicKey, payer?: PublicKey): Promise<Transaction>;
787
+ }
788
+
735
789
  declare class XMarketSDK {
736
790
  readonly provider: anchor.AnchorProvider;
737
791
  readonly networkConfig: NetworkConfig;
@@ -745,6 +799,7 @@ declare class XMarketSDK {
745
799
  private _fee?;
746
800
  private _presale?;
747
801
  private _marketOracle?;
802
+ private _admin?;
748
803
  constructor(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey);
749
804
  private _withAddress;
750
805
  get oracle(): OracleClient;
@@ -755,6 +810,7 @@ declare class XMarketSDK {
755
810
  get fee(): FeeManagementClient;
756
811
  get presale(): PresaleClient;
757
812
  get marketOracle(): MarketOracleClient;
813
+ get admin(): AdminClient;
758
814
  }
759
815
 
760
816
  declare const SEEDS: {
@@ -783,6 +839,8 @@ declare const SEEDS: {
783
839
  readonly userBuy: Buffer<ArrayBuffer>;
784
840
  readonly marketOracle: Buffer<ArrayBuffer>;
785
841
  readonly userClaim: Buffer<ArrayBuffer>;
842
+ readonly adminConfig: Buffer<ArrayBuffer>;
843
+ readonly claimRecord: Buffer<ArrayBuffer>;
786
844
  };
787
845
  declare class PDA {
788
846
  static questionMarketConfig(owner: PublicKey, programIds: Pick<ProgramIds, "questionMarket">): [PublicKey, number];
@@ -812,6 +870,8 @@ declare class PDA {
812
870
  static userBuyRecord(presalePda: PublicKey, user: PublicKey, programIds: Pick<ProgramIds, "presale">): [PublicKey, number];
813
871
  static marketOraclePda(questionPda: PublicKey, programIds: Pick<ProgramIds, "marketOracle">): [PublicKey, number];
814
872
  static userClaimRecord(marketOraclePda: PublicKey, user: PublicKey, programIds: Pick<ProgramIds, "marketOracle">): [PublicKey, number];
873
+ static adminConfig(owner: PublicKey, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
874
+ static claimRecord(conditionId: Uint8Array, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
815
875
  }
816
876
  /** Unique 32-byte question ID: SHA-256(content + timestamp). Different each call. */
817
877
  declare function generateQuestionId(content: string, salt?: number): Uint8Array;
@@ -945,4 +1005,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
945
1005
  */
946
1006
  declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
947
1007
 
948
- export { AccountNotFoundError, ClobClient, type ClobConfig, type CollateralConfig, type CollateralVault, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig, FEE_DENOMINATOR, FeeManagementClient, HookClient, type HookConfig, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, MarketOracleClient, type MarketOracleInfo, type MatchType, type NetworkConfig, type NetworkName, OracleClient, type OracleConfig, type Order, type OrderStatus, PDA, type Position, PresaleClient, type PresaleInfo, type ProgramIds, type Question, type QuestionFee, type QuestionMarketConfig, type QuestionResult, QuestionStatus, SEEDS, type SignedOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedEd25519Instruction, buildOrder, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
1008
+ export { AccountNotFoundError, AdminClient, type AdminConfigInfo, type ClaimRecordInfo, ClobClient, type ClobConfig, type CollateralConfig, type CollateralVault, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig, FEE_DENOMINATOR, FeeManagementClient, HookClient, type HookConfig, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, MarketOracleClient, type MarketOracleInfo, type MatchType, type NetworkConfig, type NetworkName, OracleClient, type OracleConfig, type Order, type OrderStatus, PDA, type Position, PresaleClient, type PresaleInfo, type ProgramIds, type Question, type QuestionFee, type QuestionMarketConfig, type QuestionResult, QuestionStatus, SEEDS, type SignedOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedEd25519Instruction, buildOrder, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };