@percolatorct/sdk 1.0.0-beta.28 → 1.0.0-beta.30
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/abi/accounts.d.ts +9 -10
- package/dist/abi/instructions.d.ts +6 -37
- package/dist/index.js +16 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/abi/accounts.d.ts
CHANGED
|
@@ -73,21 +73,11 @@ export declare const ACCOUNTS_UPDATE_CONFIG: readonly AccountSpec[];
|
|
|
73
73
|
* SetMaintenanceFee: 2 accounts
|
|
74
74
|
*/
|
|
75
75
|
export declare const ACCOUNTS_SET_MAINTENANCE_FEE: readonly AccountSpec[];
|
|
76
|
-
/**
|
|
77
|
-
* SetOracleAuthority: 2 accounts
|
|
78
|
-
* Sets the oracle price authority (admin only)
|
|
79
|
-
*/
|
|
80
|
-
export declare const ACCOUNTS_SET_ORACLE_AUTHORITY: readonly AccountSpec[];
|
|
81
76
|
/**
|
|
82
77
|
* SetOraclePriceCap: 2 accounts
|
|
83
78
|
* Set oracle price circuit breaker cap (admin only)
|
|
84
79
|
*/
|
|
85
80
|
export declare const ACCOUNTS_SET_ORACLE_PRICE_CAP: readonly AccountSpec[];
|
|
86
|
-
/**
|
|
87
|
-
* PushOraclePrice: 2 accounts
|
|
88
|
-
* Push oracle price (oracle authority only)
|
|
89
|
-
*/
|
|
90
|
-
export declare const ACCOUNTS_PUSH_ORACLE_PRICE: readonly AccountSpec[];
|
|
91
81
|
/**
|
|
92
82
|
* ResolveMarket: 2 accounts
|
|
93
83
|
* Resolves a binary/premarket (admin only)
|
|
@@ -98,6 +88,15 @@ export declare const ACCOUNTS_RESOLVE_MARKET: readonly AccountSpec[];
|
|
|
98
88
|
* Withdraw insurance fund after market resolution (admin only)
|
|
99
89
|
*/
|
|
100
90
|
export declare const ACCOUNTS_WITHDRAW_INSURANCE: readonly AccountSpec[];
|
|
91
|
+
/**
|
|
92
|
+
* WithdrawInsuranceLimited (tag 23): 7 or 8 accounts.
|
|
93
|
+
* On live markets the 8th oracle account is REQUIRED (upstream 8ce8d54):
|
|
94
|
+
* the handler does a same-instruction accrue_market_to against the fresh
|
|
95
|
+
* oracle price to prevent withdrawals against overstated insurance.
|
|
96
|
+
* On resolved markets the oracle is frozen — 7 accounts suffice.
|
|
97
|
+
*/
|
|
98
|
+
export declare const ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_RESOLVED: readonly AccountSpec[];
|
|
99
|
+
export declare const ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_LIVE: readonly AccountSpec[];
|
|
101
100
|
/**
|
|
102
101
|
* PauseMarket: 2 accounts
|
|
103
102
|
*/
|
|
@@ -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;
|
|
@@ -359,35 +352,6 @@ export interface SetMaintenanceFeeArgs {
|
|
|
359
352
|
}
|
|
360
353
|
/** @deprecated Tag 15 removed in v12.17. Will fail on-chain. */
|
|
361
354
|
export declare function encodeSetMaintenanceFee(args: SetMaintenanceFeeArgs): Uint8Array;
|
|
362
|
-
/**
|
|
363
|
-
* SetOracleAuthority instruction data (33 bytes)
|
|
364
|
-
* Sets the oracle price authority. Pass zero pubkey to disable and require Pyth/Chainlink.
|
|
365
|
-
*/
|
|
366
|
-
export interface SetOracleAuthorityArgs {
|
|
367
|
-
newAuthority: PublicKey | string;
|
|
368
|
-
}
|
|
369
|
-
export declare function encodeSetOracleAuthority(args: SetOracleAuthorityArgs): Uint8Array;
|
|
370
|
-
/**
|
|
371
|
-
* PushOraclePrice instruction data (17 bytes)
|
|
372
|
-
* Push a new oracle price (oracle authority only).
|
|
373
|
-
* The price should be in e6 format and already include any inversion/scaling.
|
|
374
|
-
*/
|
|
375
|
-
export interface PushOraclePriceArgs {
|
|
376
|
-
priceE6: bigint | string;
|
|
377
|
-
timestamp: bigint | string;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Encode PushOraclePrice instruction data with validation.
|
|
381
|
-
*
|
|
382
|
-
* Validates oracle price constraints:
|
|
383
|
-
* - Price cannot be zero (division by zero in on-chain engine)
|
|
384
|
-
* - Price cannot exceed MAX_ORACLE_PRICE (prevents overflow in price math)
|
|
385
|
-
*
|
|
386
|
-
* @param args - PushOraclePrice arguments
|
|
387
|
-
* @returns Encoded instruction data (17 bytes)
|
|
388
|
-
* @throws Error if price is 0 or exceeds MAX_ORACLE_PRICE
|
|
389
|
-
*/
|
|
390
|
-
export declare function encodePushOraclePrice(args: PushOraclePriceArgs): Uint8Array;
|
|
391
355
|
/**
|
|
392
356
|
* SetOraclePriceCap instruction data (9 bytes)
|
|
393
357
|
* Set oracle price circuit breaker cap (admin only).
|
|
@@ -1062,7 +1026,12 @@ export interface SetInsuranceWithdrawPolicyArgs {
|
|
|
1062
1026
|
cooldownSlots: bigint | string;
|
|
1063
1027
|
}
|
|
1064
1028
|
export declare function encodeSetInsuranceWithdrawPolicy(args: SetInsuranceWithdrawPolicyArgs): Uint8Array;
|
|
1065
|
-
/**
|
|
1029
|
+
/**
|
|
1030
|
+
* WithdrawInsuranceLimited (tag 23): amount.
|
|
1031
|
+
* Account count is 7 (resolved markets) or 8 (live markets — oracle required
|
|
1032
|
+
* for same-instruction accrue_market_to per upstream 8ce8d54).
|
|
1033
|
+
* See ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_LIVE / _RESOLVED in accounts.ts.
|
|
1034
|
+
*/
|
|
1066
1035
|
export declare function encodeWithdrawInsuranceLimited(args: {
|
|
1067
1036
|
amount: bigint | string;
|
|
1068
1037
|
}): Uint8Array;
|
package/dist/index.js
CHANGED
|
@@ -96,7 +96,6 @@ function concatBytes(...arrays) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// src/abi/instructions.ts
|
|
99
|
-
var MAX_ORACLE_PRICE = 1000000000000n;
|
|
100
99
|
var IX_TAG = {
|
|
101
100
|
InitMarket: 0,
|
|
102
101
|
InitUser: 1,
|
|
@@ -114,8 +113,7 @@ var IX_TAG = {
|
|
|
114
113
|
CloseSlab: 13,
|
|
115
114
|
UpdateConfig: 14,
|
|
116
115
|
SetMaintenanceFee: 15,
|
|
117
|
-
|
|
118
|
-
PushOraclePrice: 17,
|
|
116
|
+
// 16, 17 — removed in v1.0.0-beta.29 (Phase G admin-push oracle removal)
|
|
119
117
|
SetOraclePriceCap: 18,
|
|
120
118
|
ResolveMarket: 19,
|
|
121
119
|
WithdrawInsurance: 20,
|
|
@@ -427,26 +425,6 @@ function encodeSetMaintenanceFee(args) {
|
|
|
427
425
|
encU128(args.newFee)
|
|
428
426
|
);
|
|
429
427
|
}
|
|
430
|
-
function encodeSetOracleAuthority(args) {
|
|
431
|
-
return concatBytes(
|
|
432
|
-
encU8(IX_TAG.SetOracleAuthority),
|
|
433
|
-
encPubkey(args.newAuthority)
|
|
434
|
-
);
|
|
435
|
-
}
|
|
436
|
-
function encodePushOraclePrice(args) {
|
|
437
|
-
const price = typeof args.priceE6 === "string" ? BigInt(args.priceE6) : args.priceE6;
|
|
438
|
-
if (price === 0n) {
|
|
439
|
-
throw new Error("encodePushOraclePrice: price cannot be zero (division by zero in engine)");
|
|
440
|
-
}
|
|
441
|
-
if (price > MAX_ORACLE_PRICE) {
|
|
442
|
-
throw new Error(`encodePushOraclePrice: price exceeds maximum (${MAX_ORACLE_PRICE}), got ${price}`);
|
|
443
|
-
}
|
|
444
|
-
return concatBytes(
|
|
445
|
-
encU8(IX_TAG.PushOraclePrice),
|
|
446
|
-
encU64(price),
|
|
447
|
-
encI64(args.timestamp)
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
428
|
function encodeSetOraclePriceCap(args) {
|
|
451
429
|
return concatBytes(
|
|
452
430
|
encU8(IX_TAG.SetOraclePriceCap),
|
|
@@ -908,18 +886,10 @@ var ACCOUNTS_SET_MAINTENANCE_FEE = [
|
|
|
908
886
|
{ name: "admin", signer: true, writable: true },
|
|
909
887
|
{ name: "slab", signer: false, writable: true }
|
|
910
888
|
];
|
|
911
|
-
var ACCOUNTS_SET_ORACLE_AUTHORITY = [
|
|
912
|
-
{ name: "admin", signer: true, writable: true },
|
|
913
|
-
{ name: "slab", signer: false, writable: true }
|
|
914
|
-
];
|
|
915
889
|
var ACCOUNTS_SET_ORACLE_PRICE_CAP = [
|
|
916
890
|
{ name: "admin", signer: true, writable: true },
|
|
917
891
|
{ name: "slab", signer: false, writable: true }
|
|
918
892
|
];
|
|
919
|
-
var ACCOUNTS_PUSH_ORACLE_PRICE = [
|
|
920
|
-
{ name: "authority", signer: true, writable: true },
|
|
921
|
-
{ name: "slab", signer: false, writable: true }
|
|
922
|
-
];
|
|
923
893
|
var ACCOUNTS_RESOLVE_MARKET = [
|
|
924
894
|
{ name: "admin", signer: true, writable: true },
|
|
925
895
|
{ name: "slab", signer: false, writable: true }
|
|
@@ -932,6 +902,19 @@ var ACCOUNTS_WITHDRAW_INSURANCE = [
|
|
|
932
902
|
{ name: "tokenProgram", signer: false, writable: false },
|
|
933
903
|
{ name: "vaultPda", signer: false, writable: false }
|
|
934
904
|
];
|
|
905
|
+
var ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_RESOLVED = [
|
|
906
|
+
{ name: "authority", signer: true, writable: true },
|
|
907
|
+
{ name: "slab", signer: false, writable: true },
|
|
908
|
+
{ name: "authorityAta", signer: false, writable: true },
|
|
909
|
+
{ name: "vault", signer: false, writable: true },
|
|
910
|
+
{ name: "tokenProgram", signer: false, writable: false },
|
|
911
|
+
{ name: "vaultPda", signer: false, writable: false },
|
|
912
|
+
{ name: "clock", signer: false, writable: false }
|
|
913
|
+
];
|
|
914
|
+
var ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_LIVE = [
|
|
915
|
+
...ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_RESOLVED,
|
|
916
|
+
{ name: "oracle", signer: false, writable: false }
|
|
917
|
+
];
|
|
935
918
|
var ACCOUNTS_PAUSE_MARKET = [
|
|
936
919
|
{ name: "admin", signer: true, writable: true },
|
|
937
920
|
{ name: "slab", signer: false, writable: true }
|
|
@@ -6443,7 +6426,6 @@ export {
|
|
|
6443
6426
|
ACCOUNTS_NFT_EMERGENCY_BURN,
|
|
6444
6427
|
ACCOUNTS_NFT_MINT,
|
|
6445
6428
|
ACCOUNTS_PAUSE_MARKET,
|
|
6446
|
-
ACCOUNTS_PUSH_ORACLE_PRICE,
|
|
6447
6429
|
ACCOUNTS_QUEUE_WITHDRAWAL,
|
|
6448
6430
|
ACCOUNTS_RECLAIM_SLAB_RENT,
|
|
6449
6431
|
ACCOUNTS_RESOLVE_MARKET,
|
|
@@ -6451,7 +6433,6 @@ export {
|
|
|
6451
6433
|
ACCOUNTS_SET_INSURANCE_ISOLATION,
|
|
6452
6434
|
ACCOUNTS_SET_MAINTENANCE_FEE,
|
|
6453
6435
|
ACCOUNTS_SET_OI_IMBALANCE_HARD_BLOCK,
|
|
6454
|
-
ACCOUNTS_SET_ORACLE_AUTHORITY,
|
|
6455
6436
|
ACCOUNTS_SET_ORACLE_PRICE_CAP,
|
|
6456
6437
|
ACCOUNTS_SET_PENDING_SETTLEMENT,
|
|
6457
6438
|
ACCOUNTS_SET_RISK_THRESHOLD,
|
|
@@ -6465,6 +6446,8 @@ export {
|
|
|
6465
6446
|
ACCOUNTS_UPDATE_CONFIG,
|
|
6466
6447
|
ACCOUNTS_WITHDRAW_COLLATERAL,
|
|
6467
6448
|
ACCOUNTS_WITHDRAW_INSURANCE,
|
|
6449
|
+
ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_LIVE,
|
|
6450
|
+
ACCOUNTS_WITHDRAW_INSURANCE_LIMITED_RESOLVED,
|
|
6468
6451
|
ACCOUNTS_WITHDRAW_INSURANCE_LP,
|
|
6469
6452
|
AccountKind,
|
|
6470
6453
|
CHAINLINK_ANSWER_OFFSET,
|
|
@@ -6485,7 +6468,6 @@ export {
|
|
|
6485
6468
|
MARK_PRICE_EMA_ALPHA_E6,
|
|
6486
6469
|
MARK_PRICE_EMA_WINDOW_SLOTS,
|
|
6487
6470
|
MAX_DECIMALS,
|
|
6488
|
-
MAX_ORACLE_PRICE,
|
|
6489
6471
|
METEORA_DLMM_PROGRAM_ID,
|
|
6490
6472
|
NFT_IX_TAG,
|
|
6491
6473
|
NFT_PROGRAM_ID,
|
|
@@ -6635,7 +6617,6 @@ export {
|
|
|
6635
6617
|
encodeNftMint,
|
|
6636
6618
|
encodeNftSettleFunding,
|
|
6637
6619
|
encodePauseMarket,
|
|
6638
|
-
encodePushOraclePrice,
|
|
6639
6620
|
encodeQueueWithdrawal,
|
|
6640
6621
|
encodeQueueWithdrawalSV,
|
|
6641
6622
|
encodeReclaimSlabRent,
|
|
@@ -6654,7 +6635,6 @@ export {
|
|
|
6654
6635
|
encodeSetOffsetPair,
|
|
6655
6636
|
encodeSetOiCapMultiplier,
|
|
6656
6637
|
encodeSetOiImbalanceHardBlock,
|
|
6657
|
-
encodeSetOracleAuthority,
|
|
6658
6638
|
encodeSetOraclePriceCap,
|
|
6659
6639
|
encodeSetPendingSettlement,
|
|
6660
6640
|
encodeSetPythOracle,
|