@percolatorct/sdk 1.0.0-beta.8 → 2.0.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/README.md +24 -4
- package/dist/abi/accounts.d.ts +129 -25
- package/dist/abi/errors.d.ts +0 -11
- package/dist/abi/index.d.ts +1 -0
- package/dist/abi/instructions.d.ts +429 -150
- package/dist/abi/nft.d.ts +136 -0
- package/dist/config/program-ids.d.ts +1 -1
- package/dist/index.js +1897 -700
- package/dist/index.js.map +1 -1
- package/dist/math/trading.d.ts +1 -116
- package/dist/math/warmup.d.ts +0 -50
- package/dist/runtime/lighthouse.d.ts +1 -1
- package/dist/solana/discovery.d.ts +2 -13
- package/dist/solana/oracle.d.ts +2 -10
- package/dist/solana/pda.d.ts +6 -5
- package/dist/solana/slab.d.ts +133 -13
- package/dist/solana/stake.d.ts +51 -9
- package/dist/validation.d.ts +1 -26
- package/package.json +5 -2
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
|
-
/**
|
|
3
|
-
* Oracle price constraints.
|
|
4
|
-
* Maximum oracle price that can be pushed to the on-chain oracle authority.
|
|
5
|
-
*/
|
|
6
|
-
export declare const MAX_ORACLE_PRICE = 1000000000000n;
|
|
7
2
|
/**
|
|
8
3
|
* Instruction tags - exact match to Rust ix::Instruction::decode
|
|
9
4
|
*/
|
|
@@ -24,8 +19,6 @@ export declare const IX_TAG: {
|
|
|
24
19
|
readonly CloseSlab: 13;
|
|
25
20
|
readonly UpdateConfig: 14;
|
|
26
21
|
readonly SetMaintenanceFee: 15;
|
|
27
|
-
readonly SetOracleAuthority: 16;
|
|
28
|
-
readonly PushOraclePrice: 17;
|
|
29
22
|
readonly SetOraclePriceCap: 18;
|
|
30
23
|
readonly ResolveMarket: 19;
|
|
31
24
|
readonly WithdrawInsurance: 20;
|
|
@@ -38,11 +31,8 @@ export declare const IX_TAG: {
|
|
|
38
31
|
readonly ReclaimEmptyAccount: 25;
|
|
39
32
|
readonly SettleAccount: 26;
|
|
40
33
|
readonly DepositFeeCredits: 27;
|
|
41
|
-
/** @deprecated No on-chain PauseMarket instruction */ readonly PauseMarket: 27;
|
|
42
34
|
readonly ConvertReleasedPnl: 28;
|
|
43
|
-
/** @deprecated No on-chain UnpauseMarket instruction */ readonly UnpauseMarket: 28;
|
|
44
35
|
readonly ResolvePermissionless: 29;
|
|
45
|
-
/** @deprecated Use ResolvePermissionless */ readonly AcceptAdmin: 29;
|
|
46
36
|
readonly ForceCloseResolved: 30;
|
|
47
37
|
readonly SetPythOracle: 32;
|
|
48
38
|
readonly UpdateMarkPrice: 33;
|
|
@@ -85,8 +75,6 @@ export declare const IX_TAG: {
|
|
|
85
75
|
readonly AttestCrossMargin: 55;
|
|
86
76
|
/** PERC-622: Advance oracle phase (permissionless crank) */
|
|
87
77
|
readonly AdvanceOraclePhase: 56;
|
|
88
|
-
/** PERC-623: Top up a market's keeper fund (permissionless) */
|
|
89
|
-
readonly TopUpKeeperFund: 57;
|
|
90
78
|
/** PERC-629: Slash a market creator's deposit (permissionless) */
|
|
91
79
|
readonly SlashCreationDeposit: 58;
|
|
92
80
|
/** PERC-628: Initialize the global shared vault (admin) */
|
|
@@ -123,6 +111,26 @@ export declare const IX_TAG: {
|
|
|
123
111
|
readonly SetDexPool: 74;
|
|
124
112
|
/** CPI to the matcher program to initialize a matcher context account for an LP slot. Admin-only. */
|
|
125
113
|
readonly InitMatcherCtx: 75;
|
|
114
|
+
/** PauseMarket (tag 76): admin emergency pause. Blocks Trade/Deposit/Withdraw/InitUser. */
|
|
115
|
+
readonly PauseMarket: 76;
|
|
116
|
+
/** UnpauseMarket (tag 77): admin unpause. Re-enables all operations. */
|
|
117
|
+
readonly UnpauseMarket: 77;
|
|
118
|
+
/** PERC-305 / SECURITY(H-4): Set PnL cap for ADL pre-check (admin only). */
|
|
119
|
+
readonly SetMaxPnlCap: 78;
|
|
120
|
+
/** PERC-309: Set OI cap multiplier for LP withdrawal limits (admin only). Packed u64. */
|
|
121
|
+
readonly SetOiCapMultiplier: 79;
|
|
122
|
+
/** PERC-314: Set dispute params (window_slots + bond_amount, admin only). */
|
|
123
|
+
readonly SetDisputeParams: 80;
|
|
124
|
+
/** PERC-315: Set LP collateral params (enabled + ltv_bps, admin only). */
|
|
125
|
+
readonly SetLpCollateralParams: 81;
|
|
126
|
+
/** Phase E (2026-04-17): Accept a pending admin transfer. Signer must match pending_admin. */
|
|
127
|
+
readonly AcceptAdmin: 82;
|
|
128
|
+
/**
|
|
129
|
+
* v12.18.x 4-way authority split (added 2026-04-22, wrapper 86ea41f).
|
|
130
|
+
* Unified mutator for admin/hyperp_mark/insurance/insurance_operator.
|
|
131
|
+
* Wrapper handler: src/percolator.rs:6876.
|
|
132
|
+
*/
|
|
133
|
+
readonly UpdateAuthority: 83;
|
|
126
134
|
};
|
|
127
135
|
/**
|
|
128
136
|
* InitMarket instruction data (256 bytes total)
|
|
@@ -133,6 +141,46 @@ export declare const IX_TAG: {
|
|
|
133
141
|
* Note: indexFeedId is the Pyth Pull feed ID (32 bytes hex), NOT an oracle pubkey.
|
|
134
142
|
* The program validates PriceUpdateV2 accounts against this feed ID at runtime.
|
|
135
143
|
*/
|
|
144
|
+
/**
|
|
145
|
+
* Optional 66-byte extended tail for InitMarket (S-4).
|
|
146
|
+
*
|
|
147
|
+
* When present and any field is non-zero the encoder appends a 66-byte block
|
|
148
|
+
* in the exact order that the program reads it (percolator.rs:1516-1545):
|
|
149
|
+
* insurance_withdraw_max_bps u16 (2 bytes)
|
|
150
|
+
* insurance_withdraw_cooldown_slots u64 (8 bytes)
|
|
151
|
+
* permissionless_resolve_stale_slots u64 (8 bytes)
|
|
152
|
+
* funding_horizon_slots u64 (8 bytes)
|
|
153
|
+
* funding_k_bps u64 (8 bytes)
|
|
154
|
+
* funding_max_premium_bps i64 (8 bytes)
|
|
155
|
+
* funding_max_bps_per_slot i64 (8 bytes)
|
|
156
|
+
* mark_min_fee u64 (8 bytes)
|
|
157
|
+
* force_close_delay_slots u64 (8 bytes)
|
|
158
|
+
* total = 2 + 8*8 = 66 bytes
|
|
159
|
+
*
|
|
160
|
+
* When absent (or all fields are zero) the encoder omits the tail and the
|
|
161
|
+
* program treats all extended fields as their default zero values. This
|
|
162
|
+
* preserves full backward compatibility with existing 344-byte payloads.
|
|
163
|
+
*/
|
|
164
|
+
export interface InitMarketExtendedTail {
|
|
165
|
+
/** Maximum percentage of insurance fund withdrawable per cooldown window (0–10 000 bps). */
|
|
166
|
+
insuranceWithdrawMaxBps: number;
|
|
167
|
+
/** Slots that must elapse between insurance withdrawals. Required when insuranceWithdrawMaxBps > 0. */
|
|
168
|
+
insuranceWithdrawCooldownSlots: bigint | string;
|
|
169
|
+
/** Slots after which an unresolved market may be permissionlessly resolved. */
|
|
170
|
+
permissionlessResolveStaleSlots: bigint | string;
|
|
171
|
+
/** Funding rate horizon in slots (custom_funding_k denominator). */
|
|
172
|
+
fundingHorizonSlots: bigint | string;
|
|
173
|
+
/** Funding rate K parameter in bps (0 = disabled). */
|
|
174
|
+
fundingKBps: bigint | string;
|
|
175
|
+
/** Maximum funding premium in bps (i64 — may be negative to flip direction). */
|
|
176
|
+
fundingMaxPremiumBps: bigint | string;
|
|
177
|
+
/** Maximum funding rate change per slot in bps (i64). */
|
|
178
|
+
fundingMaxBpsPerSlot: bigint | string;
|
|
179
|
+
/** Minimum fee charged per mark-price update (u64, in collateral base units). */
|
|
180
|
+
markMinFee: bigint | string;
|
|
181
|
+
/** Slots to delay forced close after trigger condition is met (0 = immediate). */
|
|
182
|
+
forceCloseDelaySlots: bigint | string;
|
|
183
|
+
}
|
|
136
184
|
export interface InitMarketArgs {
|
|
137
185
|
admin: PublicKey | string;
|
|
138
186
|
collateralMint: PublicKey | string;
|
|
@@ -143,25 +191,78 @@ export interface InitMarketArgs {
|
|
|
143
191
|
unitScale: number;
|
|
144
192
|
initialMarkPriceE6: bigint | string;
|
|
145
193
|
maxMaintenanceFeePerSlot?: bigint | string;
|
|
194
|
+
/** @deprecated v12.17-only field. v12.19 wrapper does not read it. Kept for source-compat, value ignored. */
|
|
146
195
|
maxInsuranceFloor?: bigint | string;
|
|
196
|
+
/** @deprecated v12.17-only field. v12.19 wrapper does not read it. Kept for source-compat, value ignored. */
|
|
147
197
|
minOraclePriceCap?: bigint | string;
|
|
148
|
-
|
|
198
|
+
/**
|
|
199
|
+
* @deprecated Use hMin and hMax instead (v12.15+). Accepted as fallback for both hMin and hMax
|
|
200
|
+
* when hMin/hMax are not provided.
|
|
201
|
+
*/
|
|
202
|
+
warmupPeriodSlots?: bigint | string;
|
|
203
|
+
/** Minimum horizon slots (v12.15+). Falls back to warmupPeriodSlots if not provided. */
|
|
204
|
+
hMin?: bigint | string;
|
|
205
|
+
/** Maximum horizon slots (v12.15+). Falls back to warmupPeriodSlots if not provided. */
|
|
206
|
+
hMax?: bigint | string;
|
|
149
207
|
maintenanceMarginBps: bigint | string;
|
|
150
208
|
initialMarginBps: bigint | string;
|
|
151
209
|
tradingFeeBps: bigint | string;
|
|
152
210
|
maxAccounts: bigint | string;
|
|
153
211
|
newAccountFee: bigint | string;
|
|
154
|
-
|
|
212
|
+
insuranceFloor?: bigint | string;
|
|
155
213
|
maintenanceFeePerSlot: bigint | string;
|
|
156
214
|
maxCrankStalenessSlots: bigint | string;
|
|
157
215
|
liquidationFeeBps: bigint | string;
|
|
158
216
|
liquidationFeeCap: bigint | string;
|
|
159
|
-
liquidationBufferBps
|
|
217
|
+
liquidationBufferBps?: bigint | string;
|
|
160
218
|
minLiquidationAbs: bigint | string;
|
|
161
|
-
|
|
219
|
+
/** @deprecated v12.17-only top-level field. v12.19 wrapper does not read a separate min_initial_deposit. Kept for source-compat, value ignored. */
|
|
220
|
+
minInitialDeposit?: bigint | string;
|
|
162
221
|
minNonzeroMmReq: bigint | string;
|
|
163
222
|
minNonzeroImReq: bigint | string;
|
|
223
|
+
/**
|
|
224
|
+
* Optional 66-byte extended tail (S-4).
|
|
225
|
+
* When present and any field is non-zero, appended after the 344-byte base payload.
|
|
226
|
+
* When absent (or all zeros), the base 344-byte payload is sent and the program
|
|
227
|
+
* uses default zero values for all extended fields.
|
|
228
|
+
* @see InitMarketExtendedTail
|
|
229
|
+
*/
|
|
230
|
+
extendedTail?: InitMarketExtendedTail;
|
|
164
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Encode InitMarket instruction data.
|
|
234
|
+
*
|
|
235
|
+
* Produces either a 344-byte base payload (no extended tail) or a 410-byte
|
|
236
|
+
* payload (344 + 66 extended tail) depending on whether `args.extendedTail`
|
|
237
|
+
* is provided and contains at least one non-zero field.
|
|
238
|
+
*
|
|
239
|
+
* The program (percolator.rs:1527-1545) treats an empty `rest` as all-zero
|
|
240
|
+
* defaults, so the 344-byte form is fully backward-compatible.
|
|
241
|
+
*
|
|
242
|
+
* @param args InitMarket arguments
|
|
243
|
+
* @returns Encoded instruction bytes
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```ts
|
|
247
|
+
* const ix = encodeInitMarket({
|
|
248
|
+
* admin: adminPk,
|
|
249
|
+
* collateralMint: mintPk,
|
|
250
|
+
* indexFeedId: "0000...0000",
|
|
251
|
+
* // ... required fields ...
|
|
252
|
+
* extendedTail: {
|
|
253
|
+
* insuranceWithdrawMaxBps: 500,
|
|
254
|
+
* insuranceWithdrawCooldownSlots: 216000n,
|
|
255
|
+
* permissionlessResolveStaleSlots: 0n,
|
|
256
|
+
* fundingHorizonSlots: 0n,
|
|
257
|
+
* fundingKBps: 0n,
|
|
258
|
+
* fundingMaxPremiumBps: 0n,
|
|
259
|
+
* fundingMaxBpsPerSlot: 0n,
|
|
260
|
+
* markMinFee: 0n,
|
|
261
|
+
* forceCloseDelaySlots: 0n,
|
|
262
|
+
* },
|
|
263
|
+
* });
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
165
266
|
export declare function encodeInitMarket(args: InitMarketArgs): Uint8Array;
|
|
166
267
|
/**
|
|
167
268
|
* InitUser instruction data (9 bytes)
|
|
@@ -196,12 +297,41 @@ export interface WithdrawCollateralArgs {
|
|
|
196
297
|
}
|
|
197
298
|
export declare function encodeWithdrawCollateral(args: WithdrawCollateralArgs): Uint8Array;
|
|
198
299
|
/**
|
|
199
|
-
* KeeperCrank
|
|
200
|
-
*
|
|
300
|
+
* Liquidation policy for KeeperCrank candidates (v12.17 two-phase crank).
|
|
301
|
+
*
|
|
302
|
+
* On-chain wire tags:
|
|
303
|
+
* 0x00 = FullClose — liquidate the entire position
|
|
304
|
+
* 0x01 = ExactPartial(u128) — reduce position by exactly `quantity` units
|
|
305
|
+
* 0xFF = TouchOnly — accrue fees / sweep dust, do NOT liquidate
|
|
306
|
+
*/
|
|
307
|
+
export declare const LiquidationPolicyTag: {
|
|
308
|
+
readonly FullClose: 0;
|
|
309
|
+
readonly ExactPartial: 1;
|
|
310
|
+
readonly TouchOnly: 255;
|
|
311
|
+
};
|
|
312
|
+
export type KeeperCrankCandidate = {
|
|
313
|
+
policy: typeof LiquidationPolicyTag.FullClose;
|
|
314
|
+
idx: number;
|
|
315
|
+
} | {
|
|
316
|
+
policy: typeof LiquidationPolicyTag.ExactPartial;
|
|
317
|
+
idx: number;
|
|
318
|
+
quantity: bigint | string;
|
|
319
|
+
} | {
|
|
320
|
+
policy: typeof LiquidationPolicyTag.TouchOnly;
|
|
321
|
+
idx: number;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* KeeperCrank instruction data (v12.17 two-phase crank).
|
|
325
|
+
*
|
|
326
|
+
* Wire format: tag(1) + caller_idx(u16) + format_version=1(u8) +
|
|
327
|
+
* candidates: [ idx(u16) + policy_tag(u8) [+ quantity(u128) if ExactPartial] ]*
|
|
328
|
+
*
|
|
329
|
+
* Empty candidates list = simple crank (accrue funding, sweep dust).
|
|
330
|
+
* With candidates = targeted liquidation/touch pass.
|
|
201
331
|
*/
|
|
202
332
|
export interface KeeperCrankArgs {
|
|
203
333
|
callerIdx: number;
|
|
204
|
-
|
|
334
|
+
candidates?: KeeperCrankCandidate[];
|
|
205
335
|
}
|
|
206
336
|
export declare function encodeKeeperCrank(args: KeeperCrankArgs): Uint8Array;
|
|
207
337
|
/**
|
|
@@ -235,21 +365,24 @@ export interface TopUpInsuranceArgs {
|
|
|
235
365
|
}
|
|
236
366
|
export declare function encodeTopUpInsurance(args: TopUpInsuranceArgs): Uint8Array;
|
|
237
367
|
/**
|
|
238
|
-
* TradeCpi instruction data (
|
|
368
|
+
* TradeCpi instruction data (29 bytes)
|
|
369
|
+
*
|
|
370
|
+
* v12.17: limit_price_e6 is now REQUIRED (slippage protection).
|
|
371
|
+
* Set to 0 to accept any price (no slippage protection).
|
|
372
|
+
* For buys: tx reverts if execution price > limitPriceE6.
|
|
373
|
+
* For sells: tx reverts if execution price < limitPriceE6.
|
|
239
374
|
*/
|
|
240
375
|
export interface TradeCpiArgs {
|
|
241
376
|
lpIdx: number;
|
|
242
377
|
userIdx: number;
|
|
243
378
|
size: bigint | string;
|
|
379
|
+
/** Limit price in e6 units. 0 = no limit (accept any price). */
|
|
380
|
+
limitPriceE6: bigint | string;
|
|
244
381
|
}
|
|
245
382
|
export declare function encodeTradeCpi(args: TradeCpiArgs): Uint8Array;
|
|
246
383
|
/**
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* Same as TradeCpi but includes a caller-provided PDA bump byte.
|
|
250
|
-
* Uses create_program_address instead of find_program_address,
|
|
251
|
-
* saving ~1500 CU per trade. The bump should be obtained once via
|
|
252
|
-
* deriveLpPda() and cached for the lifetime of the market.
|
|
384
|
+
* @deprecated Tag 35 removed in v12.17. Use TradeCpi (tag 10) with limitPriceE6 instead.
|
|
385
|
+
* TradeCpi now handles PDA bump internally. Sending tag 35 will fail with InvalidInstructionData.
|
|
253
386
|
*/
|
|
254
387
|
export interface TradeCpiV2Args {
|
|
255
388
|
lpIdx: number;
|
|
@@ -257,14 +390,25 @@ export interface TradeCpiV2Args {
|
|
|
257
390
|
size: bigint | string;
|
|
258
391
|
bump: number;
|
|
259
392
|
}
|
|
260
|
-
|
|
393
|
+
/** @deprecated Tag 35 removed in v12.17. Use encodeTradeCpi with limitPriceE6 instead. */
|
|
394
|
+
export declare function encodeTradeCpiV2(_args: TradeCpiV2Args): Uint8Array;
|
|
261
395
|
/**
|
|
262
|
-
*
|
|
396
|
+
* @deprecated Tag 36 removed in v12.17. Will fail on-chain with InvalidInstructionData.
|
|
397
|
+
*/
|
|
398
|
+
export interface UnresolveMarketArgs {
|
|
399
|
+
confirmation: bigint | string;
|
|
400
|
+
}
|
|
401
|
+
/** @deprecated Tag 36 removed in v12.17. Will fail on-chain. */
|
|
402
|
+
export declare function encodeUnresolveMarket(_args: UnresolveMarketArgs): Uint8Array;
|
|
403
|
+
/**
|
|
404
|
+
* @deprecated Tag 11 removed in v12.17. Insurance floor is now set at InitMarket.
|
|
405
|
+
* Sending this instruction will fail with InvalidInstructionData.
|
|
263
406
|
*/
|
|
264
407
|
export interface SetRiskThresholdArgs {
|
|
265
408
|
newThreshold: bigint | string;
|
|
266
409
|
}
|
|
267
|
-
|
|
410
|
+
/** @deprecated Tag 11 removed in v12.17. Will fail on-chain. */
|
|
411
|
+
export declare function encodeSetRiskThreshold(_args: SetRiskThresholdArgs): Uint8Array;
|
|
268
412
|
/**
|
|
269
413
|
* UpdateAdmin instruction data (33 bytes)
|
|
270
414
|
*/
|
|
@@ -277,61 +421,34 @@ export declare function encodeUpdateAdmin(args: UpdateAdminArgs): Uint8Array;
|
|
|
277
421
|
*/
|
|
278
422
|
export declare function encodeCloseSlab(): Uint8Array;
|
|
279
423
|
/**
|
|
280
|
-
* UpdateConfig instruction data
|
|
281
|
-
*
|
|
424
|
+
* UpdateConfig instruction data.
|
|
425
|
+
*
|
|
426
|
+
* 35 bytes: tag(1) + funding_horizon_slots(8) + funding_k_bps(8) +
|
|
427
|
+
* funding_max_premium_bps(8) + funding_max_e9_per_slot(8) +
|
|
428
|
+
* tvl_insurance_cap_mult(2). Wire layout matches v12.19 wrapper at
|
|
429
|
+
* src/percolator.rs:2027-2041 (handle_update_config decode).
|
|
282
430
|
*/
|
|
283
431
|
export interface UpdateConfigArgs {
|
|
284
432
|
fundingHorizonSlots: bigint | string;
|
|
285
433
|
fundingKBps: bigint | string;
|
|
286
|
-
fundingInvScaleNotionalE6: bigint | string;
|
|
287
434
|
fundingMaxPremiumBps: bigint | string;
|
|
288
435
|
fundingMaxBpsPerSlot: bigint | string;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
threshMin: bigint | string;
|
|
295
|
-
threshMax: bigint | string;
|
|
296
|
-
threshMinStep: bigint | string;
|
|
436
|
+
/**
|
|
437
|
+
* u16 deposit cap multiplier. 0 disables the protocol-enforced cap.
|
|
438
|
+
* Wrapper field added at src/percolator.rs:2031.
|
|
439
|
+
*/
|
|
440
|
+
tvlInsuranceCapMult?: number;
|
|
297
441
|
}
|
|
298
442
|
export declare function encodeUpdateConfig(args: UpdateConfigArgs): Uint8Array;
|
|
299
443
|
/**
|
|
300
|
-
*
|
|
444
|
+
* @deprecated Tag 15 removed in v12.17. Maintenance fee is set at InitMarket only.
|
|
445
|
+
* Sending this instruction will fail with InvalidInstructionData.
|
|
301
446
|
*/
|
|
302
447
|
export interface SetMaintenanceFeeArgs {
|
|
303
448
|
newFee: bigint | string;
|
|
304
449
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
* SetOracleAuthority instruction data (33 bytes)
|
|
308
|
-
* Sets the oracle price authority. Pass zero pubkey to disable and require Pyth/Chainlink.
|
|
309
|
-
*/
|
|
310
|
-
export interface SetOracleAuthorityArgs {
|
|
311
|
-
newAuthority: PublicKey | string;
|
|
312
|
-
}
|
|
313
|
-
export declare function encodeSetOracleAuthority(args: SetOracleAuthorityArgs): Uint8Array;
|
|
314
|
-
/**
|
|
315
|
-
* PushOraclePrice instruction data (17 bytes)
|
|
316
|
-
* Push a new oracle price (oracle authority only).
|
|
317
|
-
* The price should be in e6 format and already include any inversion/scaling.
|
|
318
|
-
*/
|
|
319
|
-
export interface PushOraclePriceArgs {
|
|
320
|
-
priceE6: bigint | string;
|
|
321
|
-
timestamp: bigint | string;
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Encode PushOraclePrice instruction data with validation.
|
|
325
|
-
*
|
|
326
|
-
* Validates oracle price constraints:
|
|
327
|
-
* - Price cannot be zero (division by zero in on-chain engine)
|
|
328
|
-
* - Price cannot exceed MAX_ORACLE_PRICE (prevents overflow in price math)
|
|
329
|
-
*
|
|
330
|
-
* @param args - PushOraclePrice arguments
|
|
331
|
-
* @returns Encoded instruction data (17 bytes)
|
|
332
|
-
* @throws Error if price is 0 or exceeds MAX_ORACLE_PRICE
|
|
333
|
-
*/
|
|
334
|
-
export declare function encodePushOraclePrice(args: PushOraclePriceArgs): Uint8Array;
|
|
450
|
+
/** @deprecated Tag 15 removed in v12.17. Will fail on-chain. */
|
|
451
|
+
export declare function encodeSetMaintenanceFee(_args: SetMaintenanceFeeArgs): Uint8Array;
|
|
335
452
|
/**
|
|
336
453
|
* SetOraclePriceCap instruction data (9 bytes)
|
|
337
454
|
* Set oracle price circuit breaker cap (admin only).
|
|
@@ -370,19 +487,17 @@ export interface AdminForceCloseArgs {
|
|
|
370
487
|
}
|
|
371
488
|
export declare function encodeAdminForceClose(args: AdminForceCloseArgs): Uint8Array;
|
|
372
489
|
/**
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
* R2-S13: The Rust program uses `data.len() >= 25` to detect the optional
|
|
377
|
-
* tradingFeeBps field, so variable-length encoding is safe. When tradingFeeBps
|
|
378
|
-
* is omitted, the data is 17 bytes (tag + 2×u64). When included, 25 bytes.
|
|
490
|
+
* @deprecated Tag 22 is now SetInsuranceWithdrawPolicy in v12.17.
|
|
491
|
+
* This encoder sends the WRONG wire format (u64+u64 instead of pubkey+u64+u16+u64).
|
|
492
|
+
* Use encodeSetInsuranceWithdrawPolicy instead.
|
|
379
493
|
*/
|
|
380
494
|
export interface UpdateRiskParamsArgs {
|
|
381
495
|
initialMarginBps: bigint | string;
|
|
382
496
|
maintenanceMarginBps: bigint | string;
|
|
383
497
|
tradingFeeBps?: bigint | string;
|
|
384
498
|
}
|
|
385
|
-
|
|
499
|
+
/** @deprecated Use encodeSetInsuranceWithdrawPolicy (tag 22). This sends wrong wire format. */
|
|
500
|
+
export declare function encodeUpdateRiskParams(_args: UpdateRiskParamsArgs): Uint8Array;
|
|
386
501
|
/**
|
|
387
502
|
* On-chain confirmation code for RenounceAdmin (must match program constant).
|
|
388
503
|
* ASCII "RENOUNCE" as u64 LE = 0x52454E4F554E4345.
|
|
@@ -393,11 +508,9 @@ export declare const RENOUNCE_ADMIN_CONFIRMATION = 5928230587143701317n;
|
|
|
393
508
|
*/
|
|
394
509
|
export declare const UNRESOLVE_CONFIRMATION = 16045690984503054900n;
|
|
395
510
|
/**
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
* Requires the confirmation code 0x52454E4F554E4345 ("RENOUNCE" as u64 LE)
|
|
400
|
-
* to prevent accidental invocation.
|
|
511
|
+
* @deprecated Tag 23 is now WithdrawInsuranceLimited in v12.17.
|
|
512
|
+
* This encoder sends the confirmation code as a withdrawal amount — DANGEROUS.
|
|
513
|
+
* Use encodeWithdrawInsuranceLimited instead.
|
|
401
514
|
*/
|
|
402
515
|
export declare function encodeRenounceAdmin(): Uint8Array;
|
|
403
516
|
/**
|
|
@@ -456,29 +569,15 @@ export declare function encodePauseMarket(): Uint8Array;
|
|
|
456
569
|
*/
|
|
457
570
|
export declare function encodeUnpauseMarket(): Uint8Array;
|
|
458
571
|
/**
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
* After this instruction:
|
|
462
|
-
* - oracle_authority is cleared → PushOraclePrice is disabled
|
|
463
|
-
* - index_feed_id is set to feed_id → validated on every price read
|
|
464
|
-
* - max_staleness_secs and conf_filter_bps are updated
|
|
465
|
-
* - All price reads go directly to read_pyth_price_e6() with on-chain
|
|
466
|
-
* staleness + confidence + feed-ID validation (no silent fallback)
|
|
467
|
-
*
|
|
468
|
-
* Instruction data: tag(1) + feed_id(32) + max_staleness_secs(8) + conf_filter_bps(2) = 43 bytes
|
|
469
|
-
*
|
|
470
|
-
* Accounts:
|
|
471
|
-
* 0. [signer, writable] Admin
|
|
472
|
-
* 1. [writable] Slab
|
|
572
|
+
* @deprecated Tag 32 removed in v12.17. Pyth oracle is configured at InitMarket via indexFeedId.
|
|
573
|
+
* Sending this instruction will fail with InvalidInstructionData.
|
|
473
574
|
*/
|
|
474
575
|
export interface SetPythOracleArgs {
|
|
475
|
-
/** 32-byte Pyth feed ID. All zeros is invalid (reserved for Hyperp mode). */
|
|
476
576
|
feedId: Uint8Array;
|
|
477
|
-
/** Maximum age of Pyth price in seconds before OracleStale is returned. Must be > 0. */
|
|
478
577
|
maxStalenessSecs: bigint;
|
|
479
|
-
/** Max confidence/price ratio in bps (0 = no confidence check). */
|
|
480
578
|
confFilterBps: number;
|
|
481
579
|
}
|
|
580
|
+
/** @deprecated Tag 32 removed in v12.17. Pyth is configured at InitMarket. */
|
|
482
581
|
export declare function encodeSetPythOracle(args: SetPythOracleArgs): Uint8Array;
|
|
483
582
|
/**
|
|
484
583
|
* Derive the expected Pyth PriceUpdateV2 account address for a given feed ID.
|
|
@@ -490,18 +589,8 @@ export declare function encodeSetPythOracle(args: SetPythOracleArgs): Uint8Array
|
|
|
490
589
|
export declare const PYTH_RECEIVER_PROGRAM_ID = "rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ";
|
|
491
590
|
export declare function derivePythPriceUpdateAccount(feedId: Uint8Array, shardId?: number): Promise<string>;
|
|
492
591
|
/**
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
* Reads the current oracle price on-chain, applies 8-hour EMA smoothing
|
|
496
|
-
* with circuit breaker, and writes result to authority_price_e6.
|
|
497
|
-
*
|
|
498
|
-
* Instruction data: 1 byte (tag only — all params read from on-chain state)
|
|
499
|
-
*
|
|
500
|
-
* Accounts:
|
|
501
|
-
* 0. [writable] Slab
|
|
502
|
-
* 1. [] Oracle account (Pyth PriceUpdateV2 / Chainlink / DEX AMM)
|
|
503
|
-
* 2. [] Clock sysvar (SysvarC1ock11111111111111111111111111111111)
|
|
504
|
-
* 3..N [] Remaining accounts (PumpSwap vaults, etc. if needed)
|
|
592
|
+
* @deprecated Tag 33 removed in v12.17. Use UpdateHyperpMark (tag 34) for DEX-oracle markets.
|
|
593
|
+
* Sending this instruction will fail with InvalidInstructionData.
|
|
505
594
|
*/
|
|
506
595
|
export declare function encodeUpdateMarkPrice(): Uint8Array;
|
|
507
596
|
/**
|
|
@@ -653,10 +742,30 @@ export interface VammMatcherParams {
|
|
|
653
742
|
impactKBps: number;
|
|
654
743
|
liquidityNotionalE6: bigint;
|
|
655
744
|
}
|
|
656
|
-
/** Magic bytes identifying a vAMM matcher context: "PERCMATC" as u64 LE */
|
|
745
|
+
/** Magic bytes identifying a vAMM matcher context: "PERCMATC" as u64 LE = 0x504552434d415443 */
|
|
657
746
|
export declare const VAMM_MAGIC = 5784119745439683651n;
|
|
658
|
-
/**
|
|
747
|
+
/** Alias matching the Rust constant name for parity tests */
|
|
748
|
+
export declare const MATCHER_MAGIC = 5784119745439683651n;
|
|
749
|
+
/** Offset where matcher return is written in the context account (always 0 per ABI) */
|
|
750
|
+
export declare const CTX_RETURN_OFFSET = 0;
|
|
751
|
+
/** Byte length of the MatcherReturn section of the context account */
|
|
752
|
+
export declare const MATCHER_RETURN_LEN = 64;
|
|
753
|
+
/** Offset into matcher context where vAMM params start (= MATCHER_RETURN_LEN) */
|
|
659
754
|
export declare const CTX_VAMM_OFFSET = 64;
|
|
755
|
+
/** Byte length of the MatcherCtx (vAMM state) section of the context account */
|
|
756
|
+
export declare const CTX_VAMM_LEN = 256;
|
|
757
|
+
/** Total matcher context account size: MATCHER_RETURN_LEN + CTX_VAMM_LEN */
|
|
758
|
+
export declare const MATCHER_CONTEXT_LEN = 320;
|
|
759
|
+
/** Byte length of a MatcherCall instruction (tag 0 CPI payload) */
|
|
760
|
+
export declare const MATCHER_CALL_LEN = 67;
|
|
761
|
+
/**
|
|
762
|
+
* Byte length of an InitMatcherCtx instruction payload sent to the matcher program.
|
|
763
|
+
* Layout: tag(1) + kind(1) + trading_fee_bps(4) + base_spread_bps(4) +
|
|
764
|
+
* max_total_bps(4) + impact_k_bps(4) + liquidity_notional_e6(16) +
|
|
765
|
+
* max_fill_abs(16) + max_inventory_abs(16) + fee_to_insurance_bps(2) +
|
|
766
|
+
* skew_spread_mult_bps(2) + lp_account_id(8) = 78
|
|
767
|
+
*/
|
|
768
|
+
export declare const INIT_CTX_LEN = 78;
|
|
660
769
|
/**
|
|
661
770
|
* Compute execution price for a given LP quote.
|
|
662
771
|
* For buys (isLong=true): price above oracle.
|
|
@@ -690,21 +799,6 @@ export declare const PHASE2_MATURITY_SLOTS = 3024000n;
|
|
|
690
799
|
* @returns [newPhase, shouldTransition]
|
|
691
800
|
*/
|
|
692
801
|
export declare function checkPhaseTransition(currentSlot: bigint, marketCreatedSlot: bigint, oraclePhase: number, cumulativeVolumeE6: bigint, phase2DeltaSlots: number, hasMatureOracle: boolean): [number, boolean];
|
|
693
|
-
/**
|
|
694
|
-
* TopUpKeeperFund (Tag 57) — permissionless keeper fund top-up.
|
|
695
|
-
*
|
|
696
|
-
* Instruction data: tag(1) + amount(8) = 9 bytes
|
|
697
|
-
*
|
|
698
|
-
* Accounts:
|
|
699
|
-
* 0. [signer, writable] Funder
|
|
700
|
-
* 1. [writable] Slab
|
|
701
|
-
* 2. [writable] Keeper fund PDA
|
|
702
|
-
* 3. [] System program
|
|
703
|
-
*/
|
|
704
|
-
export interface TopUpKeeperFundArgs {
|
|
705
|
-
amount: bigint | string;
|
|
706
|
-
}
|
|
707
|
-
export declare function encodeTopUpKeeperFund(args: TopUpKeeperFundArgs): Uint8Array;
|
|
708
802
|
/**
|
|
709
803
|
* SlashCreationDeposit (Tag 58) — permissionless: slash a market creator's deposit
|
|
710
804
|
* after the spam grace period has elapsed (PERC-629).
|
|
@@ -836,28 +930,24 @@ export declare function encodeSetOiImbalanceHardBlock(args: {
|
|
|
836
930
|
* Creates a PositionNft PDA + Token-2022 mint with metadata, then mints 1 NFT to the
|
|
837
931
|
* position owner's ATA. The NFT represents ownership of `user_idx` in the slab.
|
|
838
932
|
*
|
|
839
|
-
*
|
|
933
|
+
* The program creates the ATA internally via CPI when the 11th account (Associated Token
|
|
934
|
+
* Program) is provided. This is required because the NFT mint PDA doesn't exist until the
|
|
935
|
+
* program creates it, so the ATA can't be created in a preceding instruction.
|
|
840
936
|
*
|
|
841
|
-
*
|
|
842
|
-
* 0. [signer, writable] payer
|
|
843
|
-
* 1. [writable] slab
|
|
844
|
-
* 2. [writable] position_nft PDA (created — seeds: ["position_nft", slab, user_idx])
|
|
845
|
-
* 3. [writable] nft_mint PDA (created)
|
|
846
|
-
* 4. [writable] owner_ata (Token-2022 ATA for owner)
|
|
847
|
-
* 5. [signer] owner (must match engine account owner)
|
|
848
|
-
* 6. [] vault_authority PDA
|
|
849
|
-
* 7. [] token_2022_program
|
|
850
|
-
* 8. [] system_program
|
|
851
|
-
* 9. [] rent sysvar
|
|
937
|
+
* Instruction data layout: tag(1) + user_idx(2) = 3 bytes
|
|
852
938
|
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
*
|
|
858
|
-
*
|
|
859
|
-
*
|
|
860
|
-
*
|
|
939
|
+
* Accounts (11):
|
|
940
|
+
* 0. [signer, writable] payer
|
|
941
|
+
* 1. [writable] slab
|
|
942
|
+
* 2. [writable] position_nft PDA (created — seeds: ["position_nft", slab, user_idx_u16_le])
|
|
943
|
+
* 3. [writable] nft_mint PDA (created — seeds: ["position_nft_mint", slab, user_idx_u16_le])
|
|
944
|
+
* 4. [writable] owner_ata (Token-2022 ATA for nft_mint — created by program if absent)
|
|
945
|
+
* 5. [signer] owner (must match engine account owner)
|
|
946
|
+
* 6. [] vault_authority PDA (seeds: ["vault", slab])
|
|
947
|
+
* 7. [] token_2022_program (TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb)
|
|
948
|
+
* 8. [] system_program
|
|
949
|
+
* 9. [] rent sysvar
|
|
950
|
+
* 10. [] associated_token_program (ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL)
|
|
861
951
|
*/
|
|
862
952
|
export interface MintPositionNftArgs {
|
|
863
953
|
userIdx: number;
|
|
@@ -1053,7 +1143,12 @@ export interface SetInsuranceWithdrawPolicyArgs {
|
|
|
1053
1143
|
cooldownSlots: bigint | string;
|
|
1054
1144
|
}
|
|
1055
1145
|
export declare function encodeSetInsuranceWithdrawPolicy(args: SetInsuranceWithdrawPolicyArgs): Uint8Array;
|
|
1056
|
-
/**
|
|
1146
|
+
/**
|
|
1147
|
+
* WithdrawInsuranceLimited (tag 23): amount.
|
|
1148
|
+
* Account count is 7 (resolved markets) or 8 (live markets — oracle required
|
|
1149
|
+
* for same-instruction accrue_market_to per upstream 8ce8d54).
|
|
1150
|
+
* See ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_LIVE / _RESOLVED in accounts.ts.
|
|
1151
|
+
*/
|
|
1057
1152
|
export declare function encodeWithdrawInsuranceLimited(args: {
|
|
1058
1153
|
amount: bigint | string;
|
|
1059
1154
|
}): Uint8Array;
|
|
@@ -1109,3 +1204,187 @@ export declare function encodeCloseOrphanSlab(): Uint8Array;
|
|
|
1109
1204
|
export declare function encodeSetDexPool(args: {
|
|
1110
1205
|
pool: PublicKey | string;
|
|
1111
1206
|
}): Uint8Array;
|
|
1207
|
+
/** CreateInsuranceMint: creates the insurance LP mint PDA (tag 37, same as CreateLpVault) */
|
|
1208
|
+
export declare function encodeCreateInsuranceMint(): Uint8Array;
|
|
1209
|
+
/** DepositInsuranceLP: deposit collateral, receive LP tokens (tag 38, same as LpVaultDeposit) */
|
|
1210
|
+
export declare function encodeDepositInsuranceLP(args: {
|
|
1211
|
+
amount: bigint | string;
|
|
1212
|
+
}): Uint8Array;
|
|
1213
|
+
/** WithdrawInsuranceLP: burn LP tokens, withdraw collateral (tag 39, same as LpVaultWithdraw) */
|
|
1214
|
+
export declare function encodeWithdrawInsuranceLP(args: {
|
|
1215
|
+
lpAmount: bigint | string;
|
|
1216
|
+
}): Uint8Array;
|
|
1217
|
+
/**
|
|
1218
|
+
* SetMaxPnlCap (Tag 78, PERC-305 / SECURITY(H-4)) — set the PnL cap for ADL
|
|
1219
|
+
* pre-check (admin only). When `pnl_pos_tot <= max_pnl_cap`, ADL returns
|
|
1220
|
+
* early (no deleveraging needed).
|
|
1221
|
+
*
|
|
1222
|
+
* `capE6 = 0` disables the cap (ADL always runs when insurance is depleted).
|
|
1223
|
+
*
|
|
1224
|
+
* Instruction data: tag(1) + cap(u64, 8) = 9 bytes
|
|
1225
|
+
*/
|
|
1226
|
+
export interface SetMaxPnlCapArgs {
|
|
1227
|
+
/** PnL cap in engine quote units (e.g., 1_000_000 = $1 e6). 0 = cap disabled. */
|
|
1228
|
+
cap: bigint | string;
|
|
1229
|
+
}
|
|
1230
|
+
export declare function encodeSetMaxPnlCap(args: SetMaxPnlCapArgs): Uint8Array;
|
|
1231
|
+
/**
|
|
1232
|
+
* SetOiCapMultiplier (Tag 79, PERC-309) — set the OI cap multiplier for LP
|
|
1233
|
+
* withdrawal limits (admin only). Packed u64:
|
|
1234
|
+
* lo 32 bits: multiplier_bps (e.g., 15000 = 1.5× soft cap in stressed state)
|
|
1235
|
+
* hi 32 bits: soft_cap_bps (e.g., 8000 = 80% base cap)
|
|
1236
|
+
*
|
|
1237
|
+
* `packed = 0` disables enforcement (no cap on LP withdrawals).
|
|
1238
|
+
*
|
|
1239
|
+
* Instruction data: tag(1) + packed(u64, 8) = 9 bytes
|
|
1240
|
+
*/
|
|
1241
|
+
export interface SetOiCapMultiplierArgs {
|
|
1242
|
+
/** Packed u64: lo32 = multiplier_bps, hi32 = soft_cap_bps. 0 = disabled. */
|
|
1243
|
+
packed: bigint | string;
|
|
1244
|
+
}
|
|
1245
|
+
export declare function encodeSetOiCapMultiplier(args: SetOiCapMultiplierArgs): Uint8Array;
|
|
1246
|
+
/** Convenience: pack (multiplier_bps, soft_cap_bps) into the u64 expected by SetOiCapMultiplier. */
|
|
1247
|
+
export declare function packOiCap(multiplierBps: number, softCapBps: number): bigint;
|
|
1248
|
+
/**
|
|
1249
|
+
* SetDisputeParams (Tag 80, PERC-314) — configure settlement dispute window
|
|
1250
|
+
* and bond (admin only).
|
|
1251
|
+
*
|
|
1252
|
+
* - `windowSlots = 0` disables disputes (ChallengeSettlement returns
|
|
1253
|
+
* DisputeWindowClosed). Max: 2_000_000 slots (≈ 8 days at 400ms slots) to
|
|
1254
|
+
* prevent DoS via absurd freezes.
|
|
1255
|
+
* - `bondAmount` (collateral tokens): refunded on dispute upheld, forfeited
|
|
1256
|
+
* on reject. 0 = no bond required.
|
|
1257
|
+
*
|
|
1258
|
+
* Instruction data: tag(1) + window_slots(u64, 8) + bond_amount(u64, 8) = 17 bytes
|
|
1259
|
+
*/
|
|
1260
|
+
export interface SetDisputeParamsArgs {
|
|
1261
|
+
/** Dispute window in slots. 0 = disputes disabled. Max 2_000_000. */
|
|
1262
|
+
windowSlots: bigint | string;
|
|
1263
|
+
/** Bond required to open a dispute (collateral units). 0 = no bond. */
|
|
1264
|
+
bondAmount: bigint | string;
|
|
1265
|
+
}
|
|
1266
|
+
export declare function encodeSetDisputeParams(args: SetDisputeParamsArgs): Uint8Array;
|
|
1267
|
+
/**
|
|
1268
|
+
* SetLpCollateralParams (Tag 81, PERC-315) — configure LP token collateral
|
|
1269
|
+
* acceptance (admin only).
|
|
1270
|
+
*
|
|
1271
|
+
* - `enabled = 0`: DepositLpCollateral rejects all new deposits.
|
|
1272
|
+
* - `enabled = 1`: deposits allowed, subject to `ltvBps` haircut on value.
|
|
1273
|
+
* - `ltvBps` max 10_000 (100%). Typical: 5000 (50% LTV).
|
|
1274
|
+
*
|
|
1275
|
+
* Instruction data: tag(1) + enabled(u8, 1) + ltv_bps(u16, 2) = 4 bytes
|
|
1276
|
+
*/
|
|
1277
|
+
export interface SetLpCollateralParamsArgs {
|
|
1278
|
+
/** 0 = disabled (blocks new deposits), 1 = enabled. */
|
|
1279
|
+
enabled: number;
|
|
1280
|
+
/** LTV in bps (0-10000). 5000 = 50% LTV. */
|
|
1281
|
+
ltvBps: number;
|
|
1282
|
+
}
|
|
1283
|
+
export declare function encodeSetLpCollateralParams(args: SetLpCollateralParamsArgs): Uint8Array;
|
|
1284
|
+
/**
|
|
1285
|
+
* AcceptAdmin (Tag 82, Phase E 2026-04-17) — complete a two-step admin transfer.
|
|
1286
|
+
*
|
|
1287
|
+
* Called by the PROPOSED new admin (the pubkey passed to UpdateAdmin with
|
|
1288
|
+
* `new_admin != default()`). The signer must match config.pending_admin
|
|
1289
|
+
* exactly. On success, header.admin is swapped to pending_admin and
|
|
1290
|
+
* pending_admin is cleared.
|
|
1291
|
+
*
|
|
1292
|
+
* Use `try_update_admin` then `try_accept_admin` for a full rotation, or
|
|
1293
|
+
* skip AcceptAdmin entirely to leave a pending transfer that the old
|
|
1294
|
+
* admin can overwrite (propose-again) or the new admin can never accept.
|
|
1295
|
+
*
|
|
1296
|
+
* Accounts:
|
|
1297
|
+
* [0] new admin (signer, must match pending_admin)
|
|
1298
|
+
* [1] slab (writable)
|
|
1299
|
+
*
|
|
1300
|
+
* Instruction data: tag(1) = 1 byte. No payload.
|
|
1301
|
+
*/
|
|
1302
|
+
export declare function encodeAcceptAdmin(): Uint8Array;
|
|
1303
|
+
/**
|
|
1304
|
+
* ReclaimEmptyAccount (Tag 25) — permissionless reclamation of empty/dust
|
|
1305
|
+
* accounts (wrapper §2.6, §10.7).
|
|
1306
|
+
*
|
|
1307
|
+
* Wrapper decode: src/percolator.rs:2088. Wire: tag(1) + user_idx u16(2).
|
|
1308
|
+
*
|
|
1309
|
+
* Accounts: see ACCOUNTS_RECLAIM_EMPTY_ACCOUNT.
|
|
1310
|
+
*/
|
|
1311
|
+
export interface ReclaimEmptyAccountArgs {
|
|
1312
|
+
userIdx: number;
|
|
1313
|
+
}
|
|
1314
|
+
export declare function encodeReclaimEmptyAccount(args: ReclaimEmptyAccountArgs): Uint8Array;
|
|
1315
|
+
/**
|
|
1316
|
+
* SettleAccount (Tag 26) — standalone account settlement (wrapper §10.2).
|
|
1317
|
+
* Permissionless.
|
|
1318
|
+
*
|
|
1319
|
+
* Wrapper decode: src/percolator.rs:2092. Wire: tag(1) + user_idx u16(2).
|
|
1320
|
+
*
|
|
1321
|
+
* Accounts: see ACCOUNTS_SETTLE_ACCOUNT.
|
|
1322
|
+
*/
|
|
1323
|
+
export interface SettleAccountArgs {
|
|
1324
|
+
userIdx: number;
|
|
1325
|
+
}
|
|
1326
|
+
export declare function encodeSettleAccount(args: SettleAccountArgs): Uint8Array;
|
|
1327
|
+
/**
|
|
1328
|
+
* DepositFeeCredits (Tag 27) — direct fee-debt repayment (wrapper §10.3.1).
|
|
1329
|
+
* Owner only.
|
|
1330
|
+
*
|
|
1331
|
+
* Wrapper decode: src/percolator.rs:2097. Wire: tag(1) + user_idx u16(2)
|
|
1332
|
+
* + amount u64(8).
|
|
1333
|
+
*
|
|
1334
|
+
* Accounts: see ACCOUNTS_DEPOSIT_FEE_CREDITS.
|
|
1335
|
+
*/
|
|
1336
|
+
export interface DepositFeeCreditsArgs {
|
|
1337
|
+
userIdx: number;
|
|
1338
|
+
amount: bigint | string;
|
|
1339
|
+
}
|
|
1340
|
+
export declare function encodeDepositFeeCredits(args: DepositFeeCreditsArgs): Uint8Array;
|
|
1341
|
+
/**
|
|
1342
|
+
* ConvertReleasedPnl (Tag 28) — voluntary PnL conversion with open position
|
|
1343
|
+
* (wrapper §10.4.1). Owner only.
|
|
1344
|
+
*
|
|
1345
|
+
* Wrapper decode: src/percolator.rs:2103. Wire: tag(1) + user_idx u16(2)
|
|
1346
|
+
* + amount u64(8).
|
|
1347
|
+
*
|
|
1348
|
+
* Accounts: see ACCOUNTS_CONVERT_RELEASED_PNL.
|
|
1349
|
+
*/
|
|
1350
|
+
export interface ConvertReleasedPnlArgs {
|
|
1351
|
+
userIdx: number;
|
|
1352
|
+
amount: bigint | string;
|
|
1353
|
+
}
|
|
1354
|
+
export declare function encodeConvertReleasedPnl(args: ConvertReleasedPnlArgs): Uint8Array;
|
|
1355
|
+
/**
|
|
1356
|
+
* Authority kind for UpdateAuthority (tag 83). Maps to wrapper constants
|
|
1357
|
+
* AUTHORITY_ADMIN/HYPERP_MARK/INSURANCE/INSURANCE_OPERATOR at
|
|
1358
|
+
* src/percolator.rs:6862-6868.
|
|
1359
|
+
*
|
|
1360
|
+
* Note: kind=3 is reserved (the v12.18.x split uses 0/1/2/4).
|
|
1361
|
+
*/
|
|
1362
|
+
export declare const AUTHORITY_KIND: {
|
|
1363
|
+
readonly Admin: 0;
|
|
1364
|
+
readonly HyperpMark: 1;
|
|
1365
|
+
readonly Insurance: 2;
|
|
1366
|
+
readonly InsuranceOperator: 4;
|
|
1367
|
+
};
|
|
1368
|
+
export type AuthorityKind = (typeof AUTHORITY_KIND)[keyof typeof AUTHORITY_KIND];
|
|
1369
|
+
/**
|
|
1370
|
+
* UpdateAuthority (Tag 83) — unified mutator for the four authority slots
|
|
1371
|
+
* (admin, hyperp_mark, insurance, insurance_operator).
|
|
1372
|
+
*
|
|
1373
|
+
* The instruction takes both the current authority and the new authority as
|
|
1374
|
+
* signers. Setting `newPubkey` to the zero pubkey burns the authority slot;
|
|
1375
|
+
* burning admin requires `permissionless_resolve_stale_slots > 0` AND
|
|
1376
|
+
* `force_close_delay_slots > 0` per the R4-H1 liveness guard.
|
|
1377
|
+
*
|
|
1378
|
+
* H-NEW-1 (closed in wrapper d760fc4): atomic admin rotation through this
|
|
1379
|
+
* tag now clears `config.pending_admin`, invalidating any stale tag-12
|
|
1380
|
+
* proposal.
|
|
1381
|
+
*
|
|
1382
|
+
* Wire: tag(1) + kind u8(1) + new_pubkey Pubkey(32) = 34 bytes.
|
|
1383
|
+
*
|
|
1384
|
+
* Accounts: see ACCOUNTS_UPDATE_AUTHORITY.
|
|
1385
|
+
*/
|
|
1386
|
+
export interface UpdateAuthorityArgs {
|
|
1387
|
+
kind: AuthorityKind;
|
|
1388
|
+
newPubkey: PublicKey | string;
|
|
1389
|
+
}
|
|
1390
|
+
export declare function encodeUpdateAuthority(args: UpdateAuthorityArgs): Uint8Array;
|