@percolatorct/sdk 1.0.0-beta.32 → 1.0.0-beta.34
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/README.md +1 -1
- package/dist/abi/accounts.d.ts +20 -0
- package/dist/abi/instructions.d.ts +27 -7
- package/dist/abi/nft.d.ts +3 -1
- package/dist/index.js +269 -97
- package/dist/index.js.map +1 -1
- package/dist/solana/stake.d.ts +24 -7
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for building clients, bots, and UIs on top of the [Percolator](https://github.com/dcccrypto/percolator) perpetual futures protocol on Solana.
|
|
4
4
|
|
|
5
|
-
> **EXPERIMENTAL — NOT AUDITED.** `1.0.0-beta.
|
|
5
|
+
> **EXPERIMENTAL — NOT AUDITED.** `1.0.0-beta.33`. 765 tests passing. Do NOT use with real funds.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@percolator/sdk)
|
|
8
8
|
[](LICENSE)
|
package/dist/abi/accounts.d.ts
CHANGED
|
@@ -210,6 +210,9 @@ export declare const ACCOUNTS_CANCEL_QUEUED_WITHDRAWAL: readonly AccountSpec[];
|
|
|
210
210
|
* pass additional oracle accounts at accounts[4..].
|
|
211
211
|
*/
|
|
212
212
|
export declare const ACCOUNTS_EXECUTE_ADL: readonly AccountSpec[];
|
|
213
|
+
export declare const ACCOUNTS_RESOLVE_PERMISSIONLESS: readonly AccountSpec[];
|
|
214
|
+
export declare const ACCOUNTS_FORCE_CLOSE_RESOLVED: readonly AccountSpec[];
|
|
215
|
+
export declare const ACCOUNTS_ADMIN_FORCE_CLOSE: readonly AccountSpec[];
|
|
213
216
|
/**
|
|
214
217
|
* CloseStaleSlabs: 2 accounts (tag 51)
|
|
215
218
|
* Admin closes a slab of an invalid/old layout and recovers rent SOL.
|
|
@@ -230,11 +233,25 @@ export declare const ACCOUNTS_AUDIT_CRANK: readonly AccountSpec[];
|
|
|
230
233
|
* Permissionless — no signer required beyond fee payer.
|
|
231
234
|
*/
|
|
232
235
|
export declare const ACCOUNTS_ADVANCE_ORACLE_PHASE: readonly AccountSpec[];
|
|
236
|
+
export declare const ACCOUNTS_UPDATE_HYPERP_MARK: readonly AccountSpec[];
|
|
237
|
+
export declare const ACCOUNTS_CREATE_LP_VAULT: readonly AccountSpec[];
|
|
238
|
+
export declare const ACCOUNTS_LP_VAULT_DEPOSIT: readonly AccountSpec[];
|
|
239
|
+
export declare const ACCOUNTS_LP_VAULT_CRANK_FEES: readonly AccountSpec[];
|
|
240
|
+
export declare const ACCOUNTS_CHALLENGE_SETTLEMENT: readonly AccountSpec[];
|
|
241
|
+
export declare const ACCOUNTS_RESOLVE_DISPUTE: readonly AccountSpec[];
|
|
242
|
+
export declare const ACCOUNTS_DEPOSIT_LP_COLLATERAL: readonly AccountSpec[];
|
|
243
|
+
export declare const ACCOUNTS_WITHDRAW_LP_COLLATERAL: readonly AccountSpec[];
|
|
244
|
+
export declare const ACCOUNTS_SET_OFFSET_PAIR: readonly AccountSpec[];
|
|
245
|
+
export declare const ACCOUNTS_ATTEST_CROSS_MARGIN: readonly AccountSpec[];
|
|
233
246
|
/**
|
|
234
247
|
* SetOiImbalanceHardBlock: 2 accounts
|
|
235
248
|
* Sets the OI imbalance hard-block threshold (admin only)
|
|
236
249
|
*/
|
|
237
250
|
export declare const ACCOUNTS_SET_OI_IMBALANCE_HARD_BLOCK: readonly AccountSpec[];
|
|
251
|
+
export declare const ACCOUNTS_SET_MAX_PNL_CAP: readonly AccountSpec[];
|
|
252
|
+
export declare const ACCOUNTS_SET_OI_CAP_MULTIPLIER: readonly AccountSpec[];
|
|
253
|
+
export declare const ACCOUNTS_SET_DISPUTE_PARAMS: readonly AccountSpec[];
|
|
254
|
+
export declare const ACCOUNTS_SET_LP_COLLATERAL_PARAMS: readonly AccountSpec[];
|
|
238
255
|
/**
|
|
239
256
|
* MintPositionNft: 10 accounts
|
|
240
257
|
* Creates a Token-2022 position NFT for an open position.
|
|
@@ -262,11 +279,14 @@ export declare const ACCOUNTS_SET_PENDING_SETTLEMENT: readonly AccountSpec[];
|
|
|
262
279
|
* Protected by admin allowlist (GH#1475).
|
|
263
280
|
*/
|
|
264
281
|
export declare const ACCOUNTS_CLEAR_PENDING_SETTLEMENT: readonly AccountSpec[];
|
|
282
|
+
export declare const ACCOUNTS_TRANSFER_OWNERSHIP_CPI: readonly AccountSpec[];
|
|
265
283
|
/**
|
|
266
284
|
* SetWalletCap: 2 accounts
|
|
267
285
|
* Sets the per-wallet position cap (admin only). capE6=0 disables.
|
|
268
286
|
*/
|
|
269
287
|
export declare const ACCOUNTS_SET_WALLET_CAP: readonly AccountSpec[];
|
|
288
|
+
export declare const ACCOUNTS_RESCUE_ORPHAN_VAULT: readonly AccountSpec[];
|
|
289
|
+
export declare const ACCOUNTS_CLOSE_ORPHAN_SLAB: readonly AccountSpec[];
|
|
270
290
|
/**
|
|
271
291
|
* SetDexPool: 3 accounts
|
|
272
292
|
* Admin pins the approved DEX pool address for a HYPERP market.
|
|
@@ -382,7 +382,7 @@ export interface TradeCpiV2Args {
|
|
|
382
382
|
bump: number;
|
|
383
383
|
}
|
|
384
384
|
/** @deprecated Tag 35 removed in v12.17. Use encodeTradeCpi with limitPriceE6 instead. */
|
|
385
|
-
export declare function encodeTradeCpiV2(
|
|
385
|
+
export declare function encodeTradeCpiV2(_args: TradeCpiV2Args): Uint8Array;
|
|
386
386
|
/**
|
|
387
387
|
* @deprecated Tag 36 removed in v12.17. Will fail on-chain with InvalidInstructionData.
|
|
388
388
|
*/
|
|
@@ -390,7 +390,7 @@ export interface UnresolveMarketArgs {
|
|
|
390
390
|
confirmation: bigint | string;
|
|
391
391
|
}
|
|
392
392
|
/** @deprecated Tag 36 removed in v12.17. Will fail on-chain. */
|
|
393
|
-
export declare function encodeUnresolveMarket(
|
|
393
|
+
export declare function encodeUnresolveMarket(_args: UnresolveMarketArgs): Uint8Array;
|
|
394
394
|
/**
|
|
395
395
|
* @deprecated Tag 11 removed in v12.17. Insurance floor is now set at InitMarket.
|
|
396
396
|
* Sending this instruction will fail with InvalidInstructionData.
|
|
@@ -399,7 +399,7 @@ export interface SetRiskThresholdArgs {
|
|
|
399
399
|
newThreshold: bigint | string;
|
|
400
400
|
}
|
|
401
401
|
/** @deprecated Tag 11 removed in v12.17. Will fail on-chain. */
|
|
402
|
-
export declare function encodeSetRiskThreshold(
|
|
402
|
+
export declare function encodeSetRiskThreshold(_args: SetRiskThresholdArgs): Uint8Array;
|
|
403
403
|
/**
|
|
404
404
|
* UpdateAdmin instruction data (33 bytes)
|
|
405
405
|
*/
|
|
@@ -433,7 +433,7 @@ export interface SetMaintenanceFeeArgs {
|
|
|
433
433
|
newFee: bigint | string;
|
|
434
434
|
}
|
|
435
435
|
/** @deprecated Tag 15 removed in v12.17. Will fail on-chain. */
|
|
436
|
-
export declare function encodeSetMaintenanceFee(
|
|
436
|
+
export declare function encodeSetMaintenanceFee(_args: SetMaintenanceFeeArgs): Uint8Array;
|
|
437
437
|
/**
|
|
438
438
|
* SetOraclePriceCap instruction data (9 bytes)
|
|
439
439
|
* Set oracle price circuit breaker cap (admin only).
|
|
@@ -482,7 +482,7 @@ export interface UpdateRiskParamsArgs {
|
|
|
482
482
|
tradingFeeBps?: bigint | string;
|
|
483
483
|
}
|
|
484
484
|
/** @deprecated Use encodeSetInsuranceWithdrawPolicy (tag 22). This sends wrong wire format. */
|
|
485
|
-
export declare function encodeUpdateRiskParams(
|
|
485
|
+
export declare function encodeUpdateRiskParams(_args: UpdateRiskParamsArgs): Uint8Array;
|
|
486
486
|
/**
|
|
487
487
|
* On-chain confirmation code for RenounceAdmin (must match program constant).
|
|
488
488
|
* ASCII "RENOUNCE" as u64 LE = 0x52454E4F554E4345.
|
|
@@ -727,10 +727,30 @@ export interface VammMatcherParams {
|
|
|
727
727
|
impactKBps: number;
|
|
728
728
|
liquidityNotionalE6: bigint;
|
|
729
729
|
}
|
|
730
|
-
/** Magic bytes identifying a vAMM matcher context: "PERCMATC" as u64 LE */
|
|
730
|
+
/** Magic bytes identifying a vAMM matcher context: "PERCMATC" as u64 LE = 0x504552434d415443 */
|
|
731
731
|
export declare const VAMM_MAGIC = 5784119745439683651n;
|
|
732
|
-
/**
|
|
732
|
+
/** Alias matching the Rust constant name for parity tests */
|
|
733
|
+
export declare const MATCHER_MAGIC = 5784119745439683651n;
|
|
734
|
+
/** Offset where matcher return is written in the context account (always 0 per ABI) */
|
|
735
|
+
export declare const CTX_RETURN_OFFSET = 0;
|
|
736
|
+
/** Byte length of the MatcherReturn section of the context account */
|
|
737
|
+
export declare const MATCHER_RETURN_LEN = 64;
|
|
738
|
+
/** Offset into matcher context where vAMM params start (= MATCHER_RETURN_LEN) */
|
|
733
739
|
export declare const CTX_VAMM_OFFSET = 64;
|
|
740
|
+
/** Byte length of the MatcherCtx (vAMM state) section of the context account */
|
|
741
|
+
export declare const CTX_VAMM_LEN = 256;
|
|
742
|
+
/** Total matcher context account size: MATCHER_RETURN_LEN + CTX_VAMM_LEN */
|
|
743
|
+
export declare const MATCHER_CONTEXT_LEN = 320;
|
|
744
|
+
/** Byte length of a MatcherCall instruction (tag 0 CPI payload) */
|
|
745
|
+
export declare const MATCHER_CALL_LEN = 67;
|
|
746
|
+
/**
|
|
747
|
+
* Byte length of an InitMatcherCtx instruction payload sent to the matcher program.
|
|
748
|
+
* Layout: tag(1) + kind(1) + trading_fee_bps(4) + base_spread_bps(4) +
|
|
749
|
+
* max_total_bps(4) + impact_k_bps(4) + liquidity_notional_e6(16) +
|
|
750
|
+
* max_fill_abs(16) + max_inventory_abs(16) + fee_to_insurance_bps(2) +
|
|
751
|
+
* skew_spread_mult_bps(2) + lp_account_id(8) = 78
|
|
752
|
+
*/
|
|
753
|
+
export declare const INIT_CTX_LEN = 78;
|
|
734
754
|
/**
|
|
735
755
|
* Compute execution price for a given LP quote.
|
|
736
756
|
* For buys (isLong=true): price above oracle.
|
package/dist/abi/nft.d.ts
CHANGED
|
@@ -109,7 +109,8 @@ export declare function deriveMintAuthority(programId?: PublicKey): [PublicKey,
|
|
|
109
109
|
* [128..144] last_funding_index_e18 i128
|
|
110
110
|
* [144..152] minted_at i64
|
|
111
111
|
* [152..160] account_id u64
|
|
112
|
-
* [160..
|
|
112
|
+
* [160..192] position_owner [u8; 32]
|
|
113
|
+
* [192..208] _reserved
|
|
113
114
|
*/
|
|
114
115
|
export declare const POSITION_NFT_STATE_LEN = 208;
|
|
115
116
|
export interface PositionNftState {
|
|
@@ -118,6 +119,7 @@ export interface PositionNftState {
|
|
|
118
119
|
slab: PublicKey;
|
|
119
120
|
userIdx: number;
|
|
120
121
|
nftMint: PublicKey;
|
|
122
|
+
positionOwner: PublicKey;
|
|
121
123
|
entryPriceE6: bigint;
|
|
122
124
|
positionSize: bigint;
|
|
123
125
|
isLong: boolean;
|