@theliem/xmarket-sdk 3.22.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;
@@ -1033,6 +1034,47 @@ declare class ReferralClient {
1033
1034
  buildBatchSendUsdsTx(recipients: PublicKey[], amounts: BN[], configOwner: PublicKey, collateralMint: PublicKey, authority?: PublicKey, payer?: PublicKey): Promise<Transaction>;
1034
1035
  }
1035
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
+
1036
1078
  declare class XMarketSDK {
1037
1079
  readonly provider: anchor.AnchorProvider;
1038
1080
  readonly networkConfig: NetworkConfig;
@@ -1048,6 +1090,7 @@ declare class XMarketSDK {
1048
1090
  private _marketOracle?;
1049
1091
  private _admin?;
1050
1092
  private _referral?;
1093
+ private _dispute?;
1051
1094
  constructor(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey);
1052
1095
  private _withAddress;
1053
1096
  get oracle(): OracleClient;
@@ -1060,6 +1103,7 @@ declare class XMarketSDK {
1060
1103
  get marketOracle(): MarketOracleClient;
1061
1104
  get admin(): AdminClient;
1062
1105
  get referral(): ReferralClient;
1106
+ get dispute(): DisputeClient;
1063
1107
  }
1064
1108
 
1065
1109
  declare const SEEDS: {
@@ -1091,6 +1135,9 @@ declare const SEEDS: {
1091
1135
  readonly userClaim: Buffer<ArrayBuffer>;
1092
1136
  readonly adminConfig: Buffer<ArrayBuffer>;
1093
1137
  readonly claimRecord: Buffer<ArrayBuffer>;
1138
+ readonly disputeConfig: Buffer<ArrayBuffer>;
1139
+ readonly disputeMarket: Buffer<ArrayBuffer>;
1140
+ readonly userDispute: Buffer<ArrayBuffer>;
1094
1141
  };
1095
1142
  declare class PDA {
1096
1143
  static questionMarketConfig(owner: PublicKey, programIds: Pick<ProgramIds, "questionMarket">): [PublicKey, number];
@@ -1123,6 +1170,9 @@ declare class PDA {
1123
1170
  static referralConfig(owner: PublicKey, programIds: Pick<ProgramIds, "referral">): [PublicKey, number];
1124
1171
  static adminConfig(owner: PublicKey, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
1125
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];
1126
1176
  }
1127
1177
  /** Unique 32-byte question ID: SHA-256(content + timestamp). Different each call. */
1128
1178
  declare function generateQuestionId(content: string, salt?: number): Uint8Array;
@@ -1332,4 +1382,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
1332
1382
  */
1333
1383
  declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
1334
1384
 
1335
- 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;
@@ -1033,6 +1034,47 @@ declare class ReferralClient {
1033
1034
  buildBatchSendUsdsTx(recipients: PublicKey[], amounts: BN[], configOwner: PublicKey, collateralMint: PublicKey, authority?: PublicKey, payer?: PublicKey): Promise<Transaction>;
1034
1035
  }
1035
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
+
1036
1078
  declare class XMarketSDK {
1037
1079
  readonly provider: anchor.AnchorProvider;
1038
1080
  readonly networkConfig: NetworkConfig;
@@ -1048,6 +1090,7 @@ declare class XMarketSDK {
1048
1090
  private _marketOracle?;
1049
1091
  private _admin?;
1050
1092
  private _referral?;
1093
+ private _dispute?;
1051
1094
  constructor(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey);
1052
1095
  private _withAddress;
1053
1096
  get oracle(): OracleClient;
@@ -1060,6 +1103,7 @@ declare class XMarketSDK {
1060
1103
  get marketOracle(): MarketOracleClient;
1061
1104
  get admin(): AdminClient;
1062
1105
  get referral(): ReferralClient;
1106
+ get dispute(): DisputeClient;
1063
1107
  }
1064
1108
 
1065
1109
  declare const SEEDS: {
@@ -1091,6 +1135,9 @@ declare const SEEDS: {
1091
1135
  readonly userClaim: Buffer<ArrayBuffer>;
1092
1136
  readonly adminConfig: Buffer<ArrayBuffer>;
1093
1137
  readonly claimRecord: Buffer<ArrayBuffer>;
1138
+ readonly disputeConfig: Buffer<ArrayBuffer>;
1139
+ readonly disputeMarket: Buffer<ArrayBuffer>;
1140
+ readonly userDispute: Buffer<ArrayBuffer>;
1094
1141
  };
1095
1142
  declare class PDA {
1096
1143
  static questionMarketConfig(owner: PublicKey, programIds: Pick<ProgramIds, "questionMarket">): [PublicKey, number];
@@ -1123,6 +1170,9 @@ declare class PDA {
1123
1170
  static referralConfig(owner: PublicKey, programIds: Pick<ProgramIds, "referral">): [PublicKey, number];
1124
1171
  static adminConfig(owner: PublicKey, programIds: Pick<ProgramIds, "adminContract">): [PublicKey, number];
1125
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];
1126
1176
  }
1127
1177
  /** Unique 32-byte question ID: SHA-256(content + timestamp). Different each call. */
1128
1178
  declare function generateQuestionId(content: string, salt?: number): Uint8Array;
@@ -1332,4 +1382,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
1332
1382
  */
1333
1383
  declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
1334
1384
 
1335
- 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 };