@theliem/xmarket-sdk 3.23.0 → 3.26.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 +105 -5
- package/dist/index.d.ts +105 -5
- package/dist/index.js +1198 -121
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1197 -122
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -231,6 +231,30 @@ interface SignedCollectFeeOrder {
|
|
|
231
231
|
/** Ed25519 signature (64 bytes) from order.user over serializeCollectFeeOrderToBytes() */
|
|
232
232
|
signature: Uint8Array;
|
|
233
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Authorization for CLOB to collect YES or NO tokens for redeem/merge, returning net USDS after fee.
|
|
236
|
+
* Used with batchRedeemWithFee and batchMergeWithFee instructions.
|
|
237
|
+
*/
|
|
238
|
+
interface RedeemFeeOrder {
|
|
239
|
+
user: PublicKey;
|
|
240
|
+
condition: PublicKey;
|
|
241
|
+
tokenMint: PublicKey;
|
|
242
|
+
amount: BN;
|
|
243
|
+
/** Net USDS to receive back after fee deduction. 0 for the losing side. */
|
|
244
|
+
takerAmount: BN;
|
|
245
|
+
nonce: BN;
|
|
246
|
+
expiry: BN;
|
|
247
|
+
}
|
|
248
|
+
interface SignedRedeemFeeOrder {
|
|
249
|
+
order: RedeemFeeOrder;
|
|
250
|
+
/** Ed25519 signature (64 bytes) from order.user over serializeRedeemFeeOrderToBytes() */
|
|
251
|
+
signature: Uint8Array;
|
|
252
|
+
}
|
|
253
|
+
/** A pair of YES + NO orders for one user in batchRedeemWithFee / batchMergeWithFee. */
|
|
254
|
+
interface RedeemFeeOrderPair {
|
|
255
|
+
yes: SignedRedeemFeeOrder;
|
|
256
|
+
no: SignedRedeemFeeOrder;
|
|
257
|
+
}
|
|
234
258
|
declare class XMarketError extends Error {
|
|
235
259
|
code?: string | undefined;
|
|
236
260
|
constructor(message: string, code?: string | undefined);
|
|
@@ -661,6 +685,14 @@ declare class ClobClient {
|
|
|
661
685
|
* Returns undefined if ctfClient/qmConfigPda not injected or marketOracle not configured.
|
|
662
686
|
*/
|
|
663
687
|
private getMarketOracleVault;
|
|
688
|
+
/**
|
|
689
|
+
* Returns a createATA ix for the oracle vault when:
|
|
690
|
+
* - takerFee > 0
|
|
691
|
+
* - marketFeeOverride exists for the condition
|
|
692
|
+
* - oracle vault ATA is not yet initialized
|
|
693
|
+
* Idempotent — safe to call every tx; returns null if vault already exists.
|
|
694
|
+
*/
|
|
695
|
+
private buildInitOracleVaultIfNeeded;
|
|
664
696
|
get walletPubkey(): PublicKey;
|
|
665
697
|
/**
|
|
666
698
|
* Get or create an ALT for a condition.
|
|
@@ -684,6 +716,19 @@ declare class ClobClient {
|
|
|
684
716
|
registerOrder(signed: SignedOrder): Promise<string>;
|
|
685
717
|
/** Register only if the PDA doesn't exist yet (idempotent). */
|
|
686
718
|
private registerOrderIfNeeded;
|
|
719
|
+
/**
|
|
720
|
+
* Build a legacy Transaction to register a CollectFeeOrder on-chain.
|
|
721
|
+
* Must be signed and sent before calling buildBatchCollectRedeemEarlyTx.
|
|
722
|
+
*
|
|
723
|
+
* Flow: [Ed25519 ix (1 user sig) + register_collect_fee_order ix]
|
|
724
|
+
* Caller signs with payer keypair and sends.
|
|
725
|
+
*/
|
|
726
|
+
buildRegisterCollectFeeOrderTx(signedOrder: SignedCollectFeeOrder, payer: PublicKey): Promise<Transaction>;
|
|
727
|
+
/**
|
|
728
|
+
* Register a CollectFeeOrder on-chain and send immediately (operator-signed flow).
|
|
729
|
+
* Idempotent — skips if PDA already exists.
|
|
730
|
+
*/
|
|
731
|
+
registerCollectFeeOrderIfNeeded(signedOrder: SignedCollectFeeOrder): Promise<void>;
|
|
687
732
|
/** Cancel an order — closes its OrderRecord PDA and returns rent to maker. */
|
|
688
733
|
cancelOrder(nonce: anchor.BN): Promise<TxResult>;
|
|
689
734
|
initialize(operators: PublicKey[], feeRecipient: PublicKey, feeRateBps: number): Promise<TxResult>;
|
|
@@ -826,11 +871,13 @@ declare class ClobClient {
|
|
|
826
871
|
/**
|
|
827
872
|
* Build VersionedTransaction for batchCollectRedeemEarly.
|
|
828
873
|
*
|
|
829
|
-
*
|
|
830
|
-
*
|
|
831
|
-
*
|
|
874
|
+
* Prerequisite: each user's CollectFeeOrder must be registered on-chain via
|
|
875
|
+
* buildRegisterCollectFeeOrderTx (one tx per user).
|
|
876
|
+
*
|
|
877
|
+
* Flow: batchCollectRedeemEarly ix reads CollectFeeOrderRecord PDAs — no Ed25519 inline.
|
|
878
|
+
* No tx-size limit from signatures, supports 10+ orders in one tx.
|
|
832
879
|
*
|
|
833
|
-
* @param signedOrders - Array of { order, signature }
|
|
880
|
+
* @param signedOrders - Array of { order, signature } (used to derive record PDAs)
|
|
834
881
|
* @param condition - Market condition PDA
|
|
835
882
|
* @param outcomeIndex - 0 = NO wins, 1 = YES wins
|
|
836
883
|
* @param operator - Whitelisted operator pubkey (must sign)
|
|
@@ -841,6 +888,41 @@ declare class ClobClient {
|
|
|
841
888
|
marketOracleVault?: PublicKey;
|
|
842
889
|
lookupTable?: AddressLookupTableAccount;
|
|
843
890
|
}): Promise<VersionedTransaction>;
|
|
891
|
+
/**
|
|
892
|
+
* Build a Transaction to register a RedeemFeeOrder on-chain (Ed25519 verify + PDA).
|
|
893
|
+
* Must be sent before calling buildBatchRedeemWithFeeTx / buildBatchMergeWithFeeTx.
|
|
894
|
+
*
|
|
895
|
+
* ix[0]: batched Ed25519 { pubkey=order.user, sig, msg=128 bytes }
|
|
896
|
+
* ix[1]: register_redeem_fee_order(nonce)
|
|
897
|
+
*/
|
|
898
|
+
buildRegisterRedeemFeeOrderTx(signedOrder: SignedRedeemFeeOrder, payer: PublicKey): Promise<anchor.web3.Transaction>;
|
|
899
|
+
/**
|
|
900
|
+
* Build a VersionedTransaction for batchRedeemWithFee.
|
|
901
|
+
* Each pair has a YES order + NO order for the same user (same signer or different).
|
|
902
|
+
* After resolution: YES holder taker_amount > 0, NO holder taker_amount = 0 (or vice versa).
|
|
903
|
+
*
|
|
904
|
+
* Prerequisite: each order's RedeemFeeOrderRecord must be registered via buildRegisterRedeemFeeOrderTx.
|
|
905
|
+
*/
|
|
906
|
+
buildBatchRedeemWithFeeTx(orderPairs: RedeemFeeOrderPair[], condition: PublicKey, operator: PublicKey, payer: PublicKey, opts?: {
|
|
907
|
+
marketOracleVault?: PublicKey;
|
|
908
|
+
lookupTable?: AddressLookupTableAccount;
|
|
909
|
+
}): Promise<VersionedTransaction>;
|
|
910
|
+
/**
|
|
911
|
+
* Build a VersionedTransaction for batchMergeWithFee (pre-resolution merge with fee).
|
|
912
|
+
* Each pair: YES order + NO order with equal amounts for the same user.
|
|
913
|
+
* Only yes_signer receives net USDS (mirrors EVM _matchMergeOrder).
|
|
914
|
+
*
|
|
915
|
+
* Prerequisite: each order's RedeemFeeOrderRecord must be registered via buildRegisterRedeemFeeOrderTx.
|
|
916
|
+
*/
|
|
917
|
+
buildBatchMergeWithFeeTx(orderPairs: RedeemFeeOrderPair[], condition: PublicKey, operator: PublicKey, payer: PublicKey, opts?: {
|
|
918
|
+
marketOracleVault?: PublicKey;
|
|
919
|
+
lookupTable?: AddressLookupTableAccount;
|
|
920
|
+
}): Promise<VersionedTransaction>;
|
|
921
|
+
/**
|
|
922
|
+
* Build ALT for batchCollectRedeemEarly — includes per-user accounts so all
|
|
923
|
+
* remaining_accounts fit as 1-byte ALT indices instead of 32-byte inline addresses.
|
|
924
|
+
*/
|
|
925
|
+
buildAltForCollectBatch(condition: PublicKey, payer: PublicKey, collateralMint: PublicKey, signedOrders: SignedCollectFeeOrder[], outcomeIndex: 0 | 1): Promise<AddressLookupTableAccount>;
|
|
844
926
|
/**
|
|
845
927
|
* Build ALT with static accounts for a condition — no order-specific PDAs needed.
|
|
846
928
|
* Use before buildBatchCollectRedeemEarlyTx when no prior buildMatchOrdersTx ran in this session.
|
|
@@ -1158,6 +1240,8 @@ declare class PDA {
|
|
|
1158
1240
|
static clobConfig(programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1159
1241
|
static orderStatus(maker: PublicKey, nonce: BN, programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1160
1242
|
static orderRecord(maker: PublicKey, nonce: BN, programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1243
|
+
static collectFeeOrderRecord(user: PublicKey, nonce: BN, programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1244
|
+
static redeemFeeOrderRecord(user: PublicKey, nonce: BN, programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1161
1245
|
static feeConfig(owner: PublicKey, programIds: Pick<ProgramIds, "feeManagement">): [PublicKey, number];
|
|
1162
1246
|
static questionFee(conditionPda: PublicKey, programIds: Pick<ProgramIds, "feeManagement">): [PublicKey, number];
|
|
1163
1247
|
static marketFeeOverride(conditionPda: PublicKey, programIds: Pick<ProgramIds, "feeManagement">): [PublicKey, number];
|
|
@@ -1230,6 +1314,22 @@ declare function serializeCollectFeeOrderToBytes(order: CollectFeeOrder): Uint8A
|
|
|
1230
1314
|
* Same layout as buildBatchedEd25519Instruction but with 120-byte messages.
|
|
1231
1315
|
*/
|
|
1232
1316
|
declare function buildBatchedCollectFeeEd25519Instruction(orders: SignedCollectFeeOrder[]): TransactionInstruction;
|
|
1317
|
+
/**
|
|
1318
|
+
* Serialize a RedeemFeeOrder to 128 bytes — must match Rust `RedeemFeeOrder::to_signable_bytes()`.
|
|
1319
|
+
* [0..32] user pubkey
|
|
1320
|
+
* [32..64] condition pubkey
|
|
1321
|
+
* [64..96] token_mint pubkey
|
|
1322
|
+
* [96..104] amount (u64 le)
|
|
1323
|
+
* [104..112] taker_amount (u64 le)
|
|
1324
|
+
* [112..120] nonce (u64 le)
|
|
1325
|
+
* [120..128] expiry (i64 le)
|
|
1326
|
+
*/
|
|
1327
|
+
declare function serializeRedeemFeeOrderToBytes(order: RedeemFeeOrder): Uint8Array;
|
|
1328
|
+
/**
|
|
1329
|
+
* Build a batched Ed25519 precompile instruction for N signed RedeemFeeOrders.
|
|
1330
|
+
* Same layout as buildBatchedCollectFeeEd25519Instruction but with 128-byte messages.
|
|
1331
|
+
*/
|
|
1332
|
+
declare function buildBatchedRedeemFeeEd25519Instruction(orders: SignedRedeemFeeOrder[]): TransactionInstruction;
|
|
1233
1333
|
|
|
1234
1334
|
/**
|
|
1235
1335
|
* High-level order utilities — build, sign, serialize, verify, detect match type.
|
|
@@ -1382,4 +1482,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
|
|
|
1382
1482
|
*/
|
|
1383
1483
|
declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
|
|
1384
1484
|
|
|
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 };
|
|
1485
|
+
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, type RedeemFeeOrder, type RedeemFeeOrderPair, ReferralClient, type ReferralConfigInfo, SEEDS, type SignedCollectFeeOrder, type SignedOrder, type SignedRedeemFeeOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, type UserDisputeInfo, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedCollectFeeEd25519Instruction, buildBatchedEd25519Instruction, buildBatchedRedeemFeeEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeCollectFeeOrderToBytes, serializeOrderToBytes, serializeRedeemFeeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
|
package/dist/index.d.ts
CHANGED
|
@@ -231,6 +231,30 @@ interface SignedCollectFeeOrder {
|
|
|
231
231
|
/** Ed25519 signature (64 bytes) from order.user over serializeCollectFeeOrderToBytes() */
|
|
232
232
|
signature: Uint8Array;
|
|
233
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Authorization for CLOB to collect YES or NO tokens for redeem/merge, returning net USDS after fee.
|
|
236
|
+
* Used with batchRedeemWithFee and batchMergeWithFee instructions.
|
|
237
|
+
*/
|
|
238
|
+
interface RedeemFeeOrder {
|
|
239
|
+
user: PublicKey;
|
|
240
|
+
condition: PublicKey;
|
|
241
|
+
tokenMint: PublicKey;
|
|
242
|
+
amount: BN;
|
|
243
|
+
/** Net USDS to receive back after fee deduction. 0 for the losing side. */
|
|
244
|
+
takerAmount: BN;
|
|
245
|
+
nonce: BN;
|
|
246
|
+
expiry: BN;
|
|
247
|
+
}
|
|
248
|
+
interface SignedRedeemFeeOrder {
|
|
249
|
+
order: RedeemFeeOrder;
|
|
250
|
+
/** Ed25519 signature (64 bytes) from order.user over serializeRedeemFeeOrderToBytes() */
|
|
251
|
+
signature: Uint8Array;
|
|
252
|
+
}
|
|
253
|
+
/** A pair of YES + NO orders for one user in batchRedeemWithFee / batchMergeWithFee. */
|
|
254
|
+
interface RedeemFeeOrderPair {
|
|
255
|
+
yes: SignedRedeemFeeOrder;
|
|
256
|
+
no: SignedRedeemFeeOrder;
|
|
257
|
+
}
|
|
234
258
|
declare class XMarketError extends Error {
|
|
235
259
|
code?: string | undefined;
|
|
236
260
|
constructor(message: string, code?: string | undefined);
|
|
@@ -661,6 +685,14 @@ declare class ClobClient {
|
|
|
661
685
|
* Returns undefined if ctfClient/qmConfigPda not injected or marketOracle not configured.
|
|
662
686
|
*/
|
|
663
687
|
private getMarketOracleVault;
|
|
688
|
+
/**
|
|
689
|
+
* Returns a createATA ix for the oracle vault when:
|
|
690
|
+
* - takerFee > 0
|
|
691
|
+
* - marketFeeOverride exists for the condition
|
|
692
|
+
* - oracle vault ATA is not yet initialized
|
|
693
|
+
* Idempotent — safe to call every tx; returns null if vault already exists.
|
|
694
|
+
*/
|
|
695
|
+
private buildInitOracleVaultIfNeeded;
|
|
664
696
|
get walletPubkey(): PublicKey;
|
|
665
697
|
/**
|
|
666
698
|
* Get or create an ALT for a condition.
|
|
@@ -684,6 +716,19 @@ declare class ClobClient {
|
|
|
684
716
|
registerOrder(signed: SignedOrder): Promise<string>;
|
|
685
717
|
/** Register only if the PDA doesn't exist yet (idempotent). */
|
|
686
718
|
private registerOrderIfNeeded;
|
|
719
|
+
/**
|
|
720
|
+
* Build a legacy Transaction to register a CollectFeeOrder on-chain.
|
|
721
|
+
* Must be signed and sent before calling buildBatchCollectRedeemEarlyTx.
|
|
722
|
+
*
|
|
723
|
+
* Flow: [Ed25519 ix (1 user sig) + register_collect_fee_order ix]
|
|
724
|
+
* Caller signs with payer keypair and sends.
|
|
725
|
+
*/
|
|
726
|
+
buildRegisterCollectFeeOrderTx(signedOrder: SignedCollectFeeOrder, payer: PublicKey): Promise<Transaction>;
|
|
727
|
+
/**
|
|
728
|
+
* Register a CollectFeeOrder on-chain and send immediately (operator-signed flow).
|
|
729
|
+
* Idempotent — skips if PDA already exists.
|
|
730
|
+
*/
|
|
731
|
+
registerCollectFeeOrderIfNeeded(signedOrder: SignedCollectFeeOrder): Promise<void>;
|
|
687
732
|
/** Cancel an order — closes its OrderRecord PDA and returns rent to maker. */
|
|
688
733
|
cancelOrder(nonce: anchor.BN): Promise<TxResult>;
|
|
689
734
|
initialize(operators: PublicKey[], feeRecipient: PublicKey, feeRateBps: number): Promise<TxResult>;
|
|
@@ -826,11 +871,13 @@ declare class ClobClient {
|
|
|
826
871
|
/**
|
|
827
872
|
* Build VersionedTransaction for batchCollectRedeemEarly.
|
|
828
873
|
*
|
|
829
|
-
*
|
|
830
|
-
*
|
|
831
|
-
*
|
|
874
|
+
* Prerequisite: each user's CollectFeeOrder must be registered on-chain via
|
|
875
|
+
* buildRegisterCollectFeeOrderTx (one tx per user).
|
|
876
|
+
*
|
|
877
|
+
* Flow: batchCollectRedeemEarly ix reads CollectFeeOrderRecord PDAs — no Ed25519 inline.
|
|
878
|
+
* No tx-size limit from signatures, supports 10+ orders in one tx.
|
|
832
879
|
*
|
|
833
|
-
* @param signedOrders - Array of { order, signature }
|
|
880
|
+
* @param signedOrders - Array of { order, signature } (used to derive record PDAs)
|
|
834
881
|
* @param condition - Market condition PDA
|
|
835
882
|
* @param outcomeIndex - 0 = NO wins, 1 = YES wins
|
|
836
883
|
* @param operator - Whitelisted operator pubkey (must sign)
|
|
@@ -841,6 +888,41 @@ declare class ClobClient {
|
|
|
841
888
|
marketOracleVault?: PublicKey;
|
|
842
889
|
lookupTable?: AddressLookupTableAccount;
|
|
843
890
|
}): Promise<VersionedTransaction>;
|
|
891
|
+
/**
|
|
892
|
+
* Build a Transaction to register a RedeemFeeOrder on-chain (Ed25519 verify + PDA).
|
|
893
|
+
* Must be sent before calling buildBatchRedeemWithFeeTx / buildBatchMergeWithFeeTx.
|
|
894
|
+
*
|
|
895
|
+
* ix[0]: batched Ed25519 { pubkey=order.user, sig, msg=128 bytes }
|
|
896
|
+
* ix[1]: register_redeem_fee_order(nonce)
|
|
897
|
+
*/
|
|
898
|
+
buildRegisterRedeemFeeOrderTx(signedOrder: SignedRedeemFeeOrder, payer: PublicKey): Promise<anchor.web3.Transaction>;
|
|
899
|
+
/**
|
|
900
|
+
* Build a VersionedTransaction for batchRedeemWithFee.
|
|
901
|
+
* Each pair has a YES order + NO order for the same user (same signer or different).
|
|
902
|
+
* After resolution: YES holder taker_amount > 0, NO holder taker_amount = 0 (or vice versa).
|
|
903
|
+
*
|
|
904
|
+
* Prerequisite: each order's RedeemFeeOrderRecord must be registered via buildRegisterRedeemFeeOrderTx.
|
|
905
|
+
*/
|
|
906
|
+
buildBatchRedeemWithFeeTx(orderPairs: RedeemFeeOrderPair[], condition: PublicKey, operator: PublicKey, payer: PublicKey, opts?: {
|
|
907
|
+
marketOracleVault?: PublicKey;
|
|
908
|
+
lookupTable?: AddressLookupTableAccount;
|
|
909
|
+
}): Promise<VersionedTransaction>;
|
|
910
|
+
/**
|
|
911
|
+
* Build a VersionedTransaction for batchMergeWithFee (pre-resolution merge with fee).
|
|
912
|
+
* Each pair: YES order + NO order with equal amounts for the same user.
|
|
913
|
+
* Only yes_signer receives net USDS (mirrors EVM _matchMergeOrder).
|
|
914
|
+
*
|
|
915
|
+
* Prerequisite: each order's RedeemFeeOrderRecord must be registered via buildRegisterRedeemFeeOrderTx.
|
|
916
|
+
*/
|
|
917
|
+
buildBatchMergeWithFeeTx(orderPairs: RedeemFeeOrderPair[], condition: PublicKey, operator: PublicKey, payer: PublicKey, opts?: {
|
|
918
|
+
marketOracleVault?: PublicKey;
|
|
919
|
+
lookupTable?: AddressLookupTableAccount;
|
|
920
|
+
}): Promise<VersionedTransaction>;
|
|
921
|
+
/**
|
|
922
|
+
* Build ALT for batchCollectRedeemEarly — includes per-user accounts so all
|
|
923
|
+
* remaining_accounts fit as 1-byte ALT indices instead of 32-byte inline addresses.
|
|
924
|
+
*/
|
|
925
|
+
buildAltForCollectBatch(condition: PublicKey, payer: PublicKey, collateralMint: PublicKey, signedOrders: SignedCollectFeeOrder[], outcomeIndex: 0 | 1): Promise<AddressLookupTableAccount>;
|
|
844
926
|
/**
|
|
845
927
|
* Build ALT with static accounts for a condition — no order-specific PDAs needed.
|
|
846
928
|
* Use before buildBatchCollectRedeemEarlyTx when no prior buildMatchOrdersTx ran in this session.
|
|
@@ -1158,6 +1240,8 @@ declare class PDA {
|
|
|
1158
1240
|
static clobConfig(programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1159
1241
|
static orderStatus(maker: PublicKey, nonce: BN, programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1160
1242
|
static orderRecord(maker: PublicKey, nonce: BN, programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1243
|
+
static collectFeeOrderRecord(user: PublicKey, nonce: BN, programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1244
|
+
static redeemFeeOrderRecord(user: PublicKey, nonce: BN, programIds: Pick<ProgramIds, "clobExchange">): [PublicKey, number];
|
|
1161
1245
|
static feeConfig(owner: PublicKey, programIds: Pick<ProgramIds, "feeManagement">): [PublicKey, number];
|
|
1162
1246
|
static questionFee(conditionPda: PublicKey, programIds: Pick<ProgramIds, "feeManagement">): [PublicKey, number];
|
|
1163
1247
|
static marketFeeOverride(conditionPda: PublicKey, programIds: Pick<ProgramIds, "feeManagement">): [PublicKey, number];
|
|
@@ -1230,6 +1314,22 @@ declare function serializeCollectFeeOrderToBytes(order: CollectFeeOrder): Uint8A
|
|
|
1230
1314
|
* Same layout as buildBatchedEd25519Instruction but with 120-byte messages.
|
|
1231
1315
|
*/
|
|
1232
1316
|
declare function buildBatchedCollectFeeEd25519Instruction(orders: SignedCollectFeeOrder[]): TransactionInstruction;
|
|
1317
|
+
/**
|
|
1318
|
+
* Serialize a RedeemFeeOrder to 128 bytes — must match Rust `RedeemFeeOrder::to_signable_bytes()`.
|
|
1319
|
+
* [0..32] user pubkey
|
|
1320
|
+
* [32..64] condition pubkey
|
|
1321
|
+
* [64..96] token_mint pubkey
|
|
1322
|
+
* [96..104] amount (u64 le)
|
|
1323
|
+
* [104..112] taker_amount (u64 le)
|
|
1324
|
+
* [112..120] nonce (u64 le)
|
|
1325
|
+
* [120..128] expiry (i64 le)
|
|
1326
|
+
*/
|
|
1327
|
+
declare function serializeRedeemFeeOrderToBytes(order: RedeemFeeOrder): Uint8Array;
|
|
1328
|
+
/**
|
|
1329
|
+
* Build a batched Ed25519 precompile instruction for N signed RedeemFeeOrders.
|
|
1330
|
+
* Same layout as buildBatchedCollectFeeEd25519Instruction but with 128-byte messages.
|
|
1331
|
+
*/
|
|
1332
|
+
declare function buildBatchedRedeemFeeEd25519Instruction(orders: SignedRedeemFeeOrder[]): TransactionInstruction;
|
|
1233
1333
|
|
|
1234
1334
|
/**
|
|
1235
1335
|
* High-level order utilities — build, sign, serialize, verify, detect match type.
|
|
@@ -1382,4 +1482,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
|
|
|
1382
1482
|
*/
|
|
1383
1483
|
declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
|
|
1384
1484
|
|
|
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 };
|
|
1485
|
+
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, type RedeemFeeOrder, type RedeemFeeOrderPair, ReferralClient, type ReferralConfigInfo, SEEDS, type SignedCollectFeeOrder, type SignedOrder, type SignedRedeemFeeOrder, type TxResult, UnauthorizedError, type UserBuyRecord, type UserClaimRecord, type UserDisputeInfo, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedCollectFeeEd25519Instruction, buildBatchedEd25519Instruction, buildBatchedRedeemFeeEd25519Instruction, buildCreateUserAtasTx, buildOrder, buildOrderFromPrice, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, orderAmountsFromPrice, serializeCollectFeeOrderToBytes, serializeOrderToBytes, serializeRedeemFeeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
|