@theliem/xmarket-sdk 3.21.0 → 3.23.0

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
@@ -14,6 +14,7 @@ interface ProgramIds {
14
14
  marketOracle?: PublicKey;
15
15
  adminContract?: PublicKey;
16
16
  referral?: PublicKey;
17
+ dispute?: PublicKey;
17
18
  }
18
19
  interface CollateralConfig {
19
20
  mint: PublicKey;
@@ -838,7 +839,13 @@ declare class ClobClient {
838
839
  */
839
840
  buildBatchCollectRedeemEarlyTx(signedOrders: SignedCollectFeeOrder[], condition: PublicKey, outcomeIndex: 0 | 1, operator: PublicKey, payer: PublicKey, opts?: {
840
841
  marketOracleVault?: PublicKey;
842
+ lookupTable?: AddressLookupTableAccount;
841
843
  }): Promise<VersionedTransaction>;
844
+ /**
845
+ * Build ALT with static accounts for a condition — no order-specific PDAs needed.
846
+ * Use before buildBatchCollectRedeemEarlyTx when no prior buildMatchOrdersTx ran in this session.
847
+ */
848
+ buildAltForCondition(condition: PublicKey, _payer: PublicKey, collateralMint?: PublicKey): Promise<AddressLookupTableAccount>;
842
849
  fetchConfig(): Promise<ClobConfig | null>;
843
850
  fetchOrderStatus(maker: PublicKey, nonce: anchor.BN): Promise<OrderStatus | null>;
844
851
  fetchOrderRecord(maker: PublicKey, nonce: anchor.BN): Promise<{
@@ -1027,6 +1034,47 @@ declare class ReferralClient {
1027
1034
  buildBatchSendUsdsTx(recipients: PublicKey[], amounts: BN[], configOwner: PublicKey, collateralMint: PublicKey, authority?: PublicKey, payer?: PublicKey): Promise<Transaction>;
1028
1035
  }
1029
1036
 
1037
+ interface DisputeConfigInfo {
1038
+ version: number;
1039
+ owner: PublicKey;
1040
+ admin: PublicKey;
1041
+ collateralMint: PublicKey;
1042
+ bump: number;
1043
+ }
1044
+ interface DisputeMarketInfo {
1045
+ version: number;
1046
+ conditionId: number[];
1047
+ deadline: anchor.BN;
1048
+ bond: anchor.BN;
1049
+ amount: anchor.BN;
1050
+ isResolved: boolean;
1051
+ bump: number;
1052
+ }
1053
+ interface UserDisputeInfo {
1054
+ version: number;
1055
+ user: PublicKey;
1056
+ conditionId: number[];
1057
+ amount: anchor.BN;
1058
+ bump: number;
1059
+ }
1060
+ declare class DisputeClient {
1061
+ private readonly program;
1062
+ private readonly provider;
1063
+ private readonly programIds;
1064
+ constructor(program: anchor.Program, provider: anchor.AnchorProvider, programIds: ProgramIds);
1065
+ get walletPubkey(): PublicKey;
1066
+ configPdaFor(owner: PublicKey): PublicKey;
1067
+ disputeVault(owner: PublicKey, collateralMint: PublicKey): PublicKey;
1068
+ fetchConfig(owner?: anchor.web3.PublicKey): Promise<DisputeConfigInfo | null>;
1069
+ fetchDisputeMarket(conditionId: Uint8Array): Promise<DisputeMarketInfo | null>;
1070
+ fetchUserDispute(user: PublicKey, conditionId: Uint8Array): Promise<UserDisputeInfo | null>;
1071
+ initialize(collateralMint: PublicKey, owner?: PublicKey): Promise<Transaction>;
1072
+ buildSetAdminTx(newAdmin: PublicKey, owner?: PublicKey): Promise<Transaction>;
1073
+ buildRaiseDisputeTx(conditionId: Uint8Array, collateralMint: PublicKey, owner: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
1074
+ buildClaimTx(conditionId: Uint8Array, collateralMint: PublicKey, owner: PublicKey, user?: PublicKey): Promise<Transaction>;
1075
+ buildResolveDisputeTx(conditionId: Uint8Array, amount: anchor.BN, isRefunded: boolean, owner: PublicKey, admin?: PublicKey): Promise<Transaction>;
1076
+ }
1077
+
1030
1078
  declare class XMarketSDK {
1031
1079
  readonly provider: anchor.AnchorProvider;
1032
1080
  readonly networkConfig: NetworkConfig;
@@ -1042,6 +1090,7 @@ declare class XMarketSDK {
1042
1090
  private _marketOracle?;
1043
1091
  private _admin?;
1044
1092
  private _referral?;
1093
+ private _dispute?;
1045
1094
  constructor(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey);
1046
1095
  private _withAddress;
1047
1096
  get oracle(): OracleClient;
@@ -1054,6 +1103,7 @@ declare class XMarketSDK {
1054
1103
  get marketOracle(): MarketOracleClient;
1055
1104
  get admin(): AdminClient;
1056
1105
  get referral(): ReferralClient;
1106
+ get dispute(): DisputeClient;
1057
1107
  }
1058
1108
 
1059
1109
  declare const SEEDS: {
@@ -1085,6 +1135,9 @@ declare const SEEDS: {
1085
1135
  readonly userClaim: Buffer<ArrayBuffer>;
1086
1136
  readonly adminConfig: Buffer<ArrayBuffer>;
1087
1137
  readonly claimRecord: Buffer<ArrayBuffer>;
1138
+ readonly disputeConfig: Buffer<ArrayBuffer>;
1139
+ readonly disputeMarket: Buffer<ArrayBuffer>;
1140
+ readonly userDispute: Buffer<ArrayBuffer>;
1088
1141
  };
1089
1142
  declare class PDA {
1090
1143
  static questionMarketConfig(owner: PublicKey, programIds: Pick<ProgramIds, "questionMarket">): [PublicKey, number];
@@ -1117,6 +1170,9 @@ declare class PDA {
1117
1170
  static referralConfig(owner: PublicKey, programIds: Pick<ProgramIds, "referral">): [PublicKey, number];
1118
1171
  static adminConfig(owner: PublicKey, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
1119
1172
  static claimRecord(conditionId: Uint8Array, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
1173
+ static disputeConfig(owner: PublicKey, programIds: Pick<ProgramIds, "dispute">): [PublicKey, number];
1174
+ static disputeMarket(conditionId: Uint8Array, programIds: Pick<ProgramIds, "dispute">): [PublicKey, number];
1175
+ static userDispute(user: PublicKey, conditionId: Uint8Array, programIds: Pick<ProgramIds, "dispute">): [PublicKey, number];
1120
1176
  }
1121
1177
  /** Unique 32-byte question ID: SHA-256(content + timestamp). Different each call. */
1122
1178
  declare function generateQuestionId(content: string, salt?: number): Uint8Array;
@@ -1326,4 +1382,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
1326
1382
  */
1327
1383
  declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
1328
1384
 
1329
- export { AccountNotFoundError, AdminClient, type AdminConfigInfo, type ClaimRecordInfo, ClobClient, type ClobConfig, type CollateralConfig, type CollateralVault, type CollectFeeOrder, 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, ReferralClient, type ReferralConfigInfo, SEEDS, type SignedCollectFeeOrder, type SignedOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedCollectFeeEd25519Instruction, buildBatchedEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeCollectFeeOrderToBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
1385
+ export { AccountNotFoundError, AdminClient, type AdminConfigInfo, type ClaimRecordInfo, ClobClient, type ClobConfig, type CollateralConfig, type CollateralVault, type CollectFeeOrder, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig, DisputeClient, type DisputeConfigInfo, type DisputeMarketInfo, 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, ReferralClient, type ReferralConfigInfo, SEEDS, type SignedCollectFeeOrder, type SignedOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, type UserDisputeInfo, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedCollectFeeEd25519Instruction, buildBatchedEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeCollectFeeOrderToBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ interface ProgramIds {
14
14
  marketOracle?: PublicKey;
15
15
  adminContract?: PublicKey;
16
16
  referral?: PublicKey;
17
+ dispute?: PublicKey;
17
18
  }
18
19
  interface CollateralConfig {
19
20
  mint: PublicKey;
@@ -838,7 +839,13 @@ declare class ClobClient {
838
839
  */
839
840
  buildBatchCollectRedeemEarlyTx(signedOrders: SignedCollectFeeOrder[], condition: PublicKey, outcomeIndex: 0 | 1, operator: PublicKey, payer: PublicKey, opts?: {
840
841
  marketOracleVault?: PublicKey;
842
+ lookupTable?: AddressLookupTableAccount;
841
843
  }): Promise<VersionedTransaction>;
844
+ /**
845
+ * Build ALT with static accounts for a condition — no order-specific PDAs needed.
846
+ * Use before buildBatchCollectRedeemEarlyTx when no prior buildMatchOrdersTx ran in this session.
847
+ */
848
+ buildAltForCondition(condition: PublicKey, _payer: PublicKey, collateralMint?: PublicKey): Promise<AddressLookupTableAccount>;
842
849
  fetchConfig(): Promise<ClobConfig | null>;
843
850
  fetchOrderStatus(maker: PublicKey, nonce: anchor.BN): Promise<OrderStatus | null>;
844
851
  fetchOrderRecord(maker: PublicKey, nonce: anchor.BN): Promise<{
@@ -1027,6 +1034,47 @@ declare class ReferralClient {
1027
1034
  buildBatchSendUsdsTx(recipients: PublicKey[], amounts: BN[], configOwner: PublicKey, collateralMint: PublicKey, authority?: PublicKey, payer?: PublicKey): Promise<Transaction>;
1028
1035
  }
1029
1036
 
1037
+ interface DisputeConfigInfo {
1038
+ version: number;
1039
+ owner: PublicKey;
1040
+ admin: PublicKey;
1041
+ collateralMint: PublicKey;
1042
+ bump: number;
1043
+ }
1044
+ interface DisputeMarketInfo {
1045
+ version: number;
1046
+ conditionId: number[];
1047
+ deadline: anchor.BN;
1048
+ bond: anchor.BN;
1049
+ amount: anchor.BN;
1050
+ isResolved: boolean;
1051
+ bump: number;
1052
+ }
1053
+ interface UserDisputeInfo {
1054
+ version: number;
1055
+ user: PublicKey;
1056
+ conditionId: number[];
1057
+ amount: anchor.BN;
1058
+ bump: number;
1059
+ }
1060
+ declare class DisputeClient {
1061
+ private readonly program;
1062
+ private readonly provider;
1063
+ private readonly programIds;
1064
+ constructor(program: anchor.Program, provider: anchor.AnchorProvider, programIds: ProgramIds);
1065
+ get walletPubkey(): PublicKey;
1066
+ configPdaFor(owner: PublicKey): PublicKey;
1067
+ disputeVault(owner: PublicKey, collateralMint: PublicKey): PublicKey;
1068
+ fetchConfig(owner?: anchor.web3.PublicKey): Promise<DisputeConfigInfo | null>;
1069
+ fetchDisputeMarket(conditionId: Uint8Array): Promise<DisputeMarketInfo | null>;
1070
+ fetchUserDispute(user: PublicKey, conditionId: Uint8Array): Promise<UserDisputeInfo | null>;
1071
+ initialize(collateralMint: PublicKey, owner?: PublicKey): Promise<Transaction>;
1072
+ buildSetAdminTx(newAdmin: PublicKey, owner?: PublicKey): Promise<Transaction>;
1073
+ buildRaiseDisputeTx(conditionId: Uint8Array, collateralMint: PublicKey, owner: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
1074
+ buildClaimTx(conditionId: Uint8Array, collateralMint: PublicKey, owner: PublicKey, user?: PublicKey): Promise<Transaction>;
1075
+ buildResolveDisputeTx(conditionId: Uint8Array, amount: anchor.BN, isRefunded: boolean, owner: PublicKey, admin?: PublicKey): Promise<Transaction>;
1076
+ }
1077
+
1030
1078
  declare class XMarketSDK {
1031
1079
  readonly provider: anchor.AnchorProvider;
1032
1080
  readonly networkConfig: NetworkConfig;
@@ -1042,6 +1090,7 @@ declare class XMarketSDK {
1042
1090
  private _marketOracle?;
1043
1091
  private _admin?;
1044
1092
  private _referral?;
1093
+ private _dispute?;
1045
1094
  constructor(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey);
1046
1095
  private _withAddress;
1047
1096
  get oracle(): OracleClient;
@@ -1054,6 +1103,7 @@ declare class XMarketSDK {
1054
1103
  get marketOracle(): MarketOracleClient;
1055
1104
  get admin(): AdminClient;
1056
1105
  get referral(): ReferralClient;
1106
+ get dispute(): DisputeClient;
1057
1107
  }
1058
1108
 
1059
1109
  declare const SEEDS: {
@@ -1085,6 +1135,9 @@ declare const SEEDS: {
1085
1135
  readonly userClaim: Buffer<ArrayBuffer>;
1086
1136
  readonly adminConfig: Buffer<ArrayBuffer>;
1087
1137
  readonly claimRecord: Buffer<ArrayBuffer>;
1138
+ readonly disputeConfig: Buffer<ArrayBuffer>;
1139
+ readonly disputeMarket: Buffer<ArrayBuffer>;
1140
+ readonly userDispute: Buffer<ArrayBuffer>;
1088
1141
  };
1089
1142
  declare class PDA {
1090
1143
  static questionMarketConfig(owner: PublicKey, programIds: Pick<ProgramIds, "questionMarket">): [PublicKey, number];
@@ -1117,6 +1170,9 @@ declare class PDA {
1117
1170
  static referralConfig(owner: PublicKey, programIds: Pick<ProgramIds, "referral">): [PublicKey, number];
1118
1171
  static adminConfig(owner: PublicKey, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
1119
1172
  static claimRecord(conditionId: Uint8Array, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
1173
+ static disputeConfig(owner: PublicKey, programIds: Pick<ProgramIds, "dispute">): [PublicKey, number];
1174
+ static disputeMarket(conditionId: Uint8Array, programIds: Pick<ProgramIds, "dispute">): [PublicKey, number];
1175
+ static userDispute(user: PublicKey, conditionId: Uint8Array, programIds: Pick<ProgramIds, "dispute">): [PublicKey, number];
1120
1176
  }
1121
1177
  /** Unique 32-byte question ID: SHA-256(content + timestamp). Different each call. */
1122
1178
  declare function generateQuestionId(content: string, salt?: number): Uint8Array;
@@ -1326,4 +1382,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
1326
1382
  */
1327
1383
  declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
1328
1384
 
1329
- export { AccountNotFoundError, AdminClient, type AdminConfigInfo, type ClaimRecordInfo, ClobClient, type ClobConfig, type CollateralConfig, type CollateralVault, type CollectFeeOrder, 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, ReferralClient, type ReferralConfigInfo, SEEDS, type SignedCollectFeeOrder, type SignedOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedCollectFeeEd25519Instruction, buildBatchedEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeCollectFeeOrderToBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
1385
+ export { AccountNotFoundError, AdminClient, type AdminConfigInfo, type ClaimRecordInfo, ClobClient, type ClobConfig, type CollateralConfig, type CollateralVault, type CollectFeeOrder, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig, DisputeClient, type DisputeConfigInfo, type DisputeMarketInfo, 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, ReferralClient, type ReferralConfigInfo, SEEDS, type SignedCollectFeeOrder, type SignedOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, type UserDisputeInfo, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedCollectFeeEd25519Instruction, buildBatchedEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeCollectFeeOrderToBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };