@percolatorct/sdk 1.0.0-beta.1 → 1.0.0-beta.3
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 +0 -15
- package/dist/abi/instructions.d.ts +0 -24
- package/dist/index.js +19 -64
- package/dist/index.js.map +1 -1
- package/dist/solana/pda.d.ts +0 -5
- package/package.json +1 -1
package/dist/abi/accounts.d.ts
CHANGED
|
@@ -117,21 +117,6 @@ export declare const ACCOUNTS_UNPAUSE_MARKET: readonly AccountSpec[];
|
|
|
117
117
|
* remember the positional order, and errors clearly on missing names.
|
|
118
118
|
*/
|
|
119
119
|
export declare function buildAccountMetas(spec: readonly AccountSpec[], keys: PublicKey[] | Record<string, PublicKey>): AccountMeta[];
|
|
120
|
-
/**
|
|
121
|
-
* CreateInsuranceMint: 9 accounts
|
|
122
|
-
* Creates SPL mint PDA for insurance LP tokens. Admin only, once per market.
|
|
123
|
-
*/
|
|
124
|
-
export declare const ACCOUNTS_CREATE_INSURANCE_MINT: readonly AccountSpec[];
|
|
125
|
-
/**
|
|
126
|
-
* DepositInsuranceLP: 8 accounts
|
|
127
|
-
* Deposit collateral into insurance fund, receive LP tokens.
|
|
128
|
-
*/
|
|
129
|
-
export declare const ACCOUNTS_DEPOSIT_INSURANCE_LP: readonly AccountSpec[];
|
|
130
|
-
/**
|
|
131
|
-
* WithdrawInsuranceLP: 8 accounts
|
|
132
|
-
* Burn LP tokens and withdraw proportional share of insurance fund.
|
|
133
|
-
*/
|
|
134
|
-
export declare const ACCOUNTS_WITHDRAW_INSURANCE_LP: readonly AccountSpec[];
|
|
135
120
|
/**
|
|
136
121
|
* LpVaultWithdraw: 10 accounts (tag 39, PERC-627 / GH#1926 / PERC-8287)
|
|
137
122
|
*
|
|
@@ -32,9 +32,6 @@ export declare const IX_TAG: {
|
|
|
32
32
|
readonly AdminForceClose: 21;
|
|
33
33
|
readonly UpdateRiskParams: 22;
|
|
34
34
|
readonly RenounceAdmin: 23;
|
|
35
|
-
readonly CreateInsuranceMint: 24;
|
|
36
|
-
readonly DepositInsuranceLP: 25;
|
|
37
|
-
readonly WithdrawInsuranceLP: 26;
|
|
38
35
|
readonly PauseMarket: 27;
|
|
39
36
|
readonly UnpauseMarket: 28;
|
|
40
37
|
readonly AcceptAdmin: 29;
|
|
@@ -390,27 +387,6 @@ export declare const UNRESOLVE_CONFIRMATION = 16045690984503054900n;
|
|
|
390
387
|
* to prevent accidental invocation.
|
|
391
388
|
*/
|
|
392
389
|
export declare function encodeRenounceAdmin(): Uint8Array;
|
|
393
|
-
/**
|
|
394
|
-
* CreateInsuranceMint instruction data (1 byte)
|
|
395
|
-
* Creates the SPL mint PDA for insurance LP tokens. Admin only, once per market.
|
|
396
|
-
*/
|
|
397
|
-
export declare function encodeCreateInsuranceMint(): Uint8Array;
|
|
398
|
-
/**
|
|
399
|
-
* DepositInsuranceLP instruction data (9 bytes)
|
|
400
|
-
* Deposit collateral into insurance fund, receive LP tokens proportional to share.
|
|
401
|
-
*/
|
|
402
|
-
export interface DepositInsuranceLPArgs {
|
|
403
|
-
amount: bigint | string;
|
|
404
|
-
}
|
|
405
|
-
export declare function encodeDepositInsuranceLP(args: DepositInsuranceLPArgs): Uint8Array;
|
|
406
|
-
/**
|
|
407
|
-
* WithdrawInsuranceLP instruction data (9 bytes)
|
|
408
|
-
* Burn LP tokens and withdraw proportional share of insurance fund.
|
|
409
|
-
*/
|
|
410
|
-
export interface WithdrawInsuranceLPArgs {
|
|
411
|
-
lpAmount: bigint | string;
|
|
412
|
-
}
|
|
413
|
-
export declare function encodeWithdrawInsuranceLP(args: WithdrawInsuranceLPArgs): Uint8Array;
|
|
414
390
|
/**
|
|
415
391
|
* LpVaultWithdraw (Tag 39, PERC-627 / GH#1926 / PERC-8287) — burn LP vault tokens and
|
|
416
392
|
* withdraw proportional collateral.
|
package/dist/index.js
CHANGED
|
@@ -119,9 +119,8 @@ var IX_TAG = {
|
|
|
119
119
|
AdminForceClose: 21,
|
|
120
120
|
UpdateRiskParams: 22,
|
|
121
121
|
RenounceAdmin: 23,
|
|
122
|
-
CreateInsuranceMint
|
|
123
|
-
|
|
124
|
-
WithdrawInsuranceLP: 26,
|
|
122
|
+
// Tags 24–26 (CreateInsuranceMint / DepositInsuranceLP / WithdrawInsuranceLP)
|
|
123
|
+
// were removed in SDK v1.0.0-beta.3. Replaced by percolator-stake.
|
|
125
124
|
PauseMarket: 27,
|
|
126
125
|
UnpauseMarket: 28,
|
|
127
126
|
AcceptAdmin: 29,
|
|
@@ -428,15 +427,6 @@ function encodeRenounceAdmin() {
|
|
|
428
427
|
encU64(RENOUNCE_ADMIN_CONFIRMATION)
|
|
429
428
|
);
|
|
430
429
|
}
|
|
431
|
-
function encodeCreateInsuranceMint() {
|
|
432
|
-
return encU8(IX_TAG.CreateInsuranceMint);
|
|
433
|
-
}
|
|
434
|
-
function encodeDepositInsuranceLP(args) {
|
|
435
|
-
return concatBytes(encU8(IX_TAG.DepositInsuranceLP), encU64(args.amount));
|
|
436
|
-
}
|
|
437
|
-
function encodeWithdrawInsuranceLP(args) {
|
|
438
|
-
return concatBytes(encU8(IX_TAG.WithdrawInsuranceLP), encU64(args.lpAmount));
|
|
439
|
-
}
|
|
440
430
|
function encodeLpVaultWithdraw(args) {
|
|
441
431
|
return concatBytes(encU8(IX_TAG.LpVaultWithdraw), encU64(args.lpAmount));
|
|
442
432
|
}
|
|
@@ -826,37 +816,6 @@ function buildAccountMetas(spec, keys) {
|
|
|
826
816
|
isWritable: s.writable
|
|
827
817
|
}));
|
|
828
818
|
}
|
|
829
|
-
var ACCOUNTS_CREATE_INSURANCE_MINT = [
|
|
830
|
-
{ name: "admin", signer: true, writable: false },
|
|
831
|
-
{ name: "slab", signer: false, writable: false },
|
|
832
|
-
{ name: "insLpMint", signer: false, writable: true },
|
|
833
|
-
{ name: "vaultAuthority", signer: false, writable: false },
|
|
834
|
-
{ name: "collateralMint", signer: false, writable: false },
|
|
835
|
-
{ name: "systemProgram", signer: false, writable: false },
|
|
836
|
-
{ name: "tokenProgram", signer: false, writable: false },
|
|
837
|
-
{ name: "rent", signer: false, writable: false },
|
|
838
|
-
{ name: "payer", signer: true, writable: true }
|
|
839
|
-
];
|
|
840
|
-
var ACCOUNTS_DEPOSIT_INSURANCE_LP = [
|
|
841
|
-
{ name: "depositor", signer: true, writable: false },
|
|
842
|
-
{ name: "slab", signer: false, writable: true },
|
|
843
|
-
{ name: "depositorAta", signer: false, writable: true },
|
|
844
|
-
{ name: "vault", signer: false, writable: true },
|
|
845
|
-
{ name: "tokenProgram", signer: false, writable: false },
|
|
846
|
-
{ name: "insLpMint", signer: false, writable: true },
|
|
847
|
-
{ name: "depositorLpAta", signer: false, writable: true },
|
|
848
|
-
{ name: "vaultAuthority", signer: false, writable: false }
|
|
849
|
-
];
|
|
850
|
-
var ACCOUNTS_WITHDRAW_INSURANCE_LP = [
|
|
851
|
-
{ name: "withdrawer", signer: true, writable: false },
|
|
852
|
-
{ name: "slab", signer: false, writable: true },
|
|
853
|
-
{ name: "withdrawerAta", signer: false, writable: true },
|
|
854
|
-
{ name: "vault", signer: false, writable: true },
|
|
855
|
-
{ name: "tokenProgram", signer: false, writable: false },
|
|
856
|
-
{ name: "insLpMint", signer: false, writable: true },
|
|
857
|
-
{ name: "withdrawerLpAta", signer: false, writable: true },
|
|
858
|
-
{ name: "vaultAuthority", signer: false, writable: false }
|
|
859
|
-
];
|
|
860
819
|
var ACCOUNTS_LP_VAULT_WITHDRAW = [
|
|
861
820
|
{ name: "withdrawer", signer: true, writable: false },
|
|
862
821
|
{ name: "slab", signer: false, writable: true },
|
|
@@ -1562,7 +1521,14 @@ var V12_1_ENGINE_EMERGENCY_OI_MODE_OFF = 968;
|
|
|
1562
1521
|
var V12_1_ENGINE_EMERGENCY_START_SLOT_OFF = 976;
|
|
1563
1522
|
var V12_1_ENGINE_LAST_BREAKER_SLOT_OFF = 984;
|
|
1564
1523
|
var V12_1_ENGINE_LIFETIME_FORCE_CLOSES_OFF = 1008;
|
|
1524
|
+
var V12_1_ACCT_MATCHER_PROGRAM_OFF = 144;
|
|
1525
|
+
var V12_1_ACCT_MATCHER_CONTEXT_OFF = 176;
|
|
1565
1526
|
var V12_1_ACCT_OWNER_OFF = 208;
|
|
1527
|
+
var V12_1_ACCT_FEE_CREDITS_OFF = 240;
|
|
1528
|
+
var V12_1_ACCT_LAST_FEE_SLOT_OFF = 256;
|
|
1529
|
+
var V12_1_ACCT_POSITION_SIZE_OFF = 296;
|
|
1530
|
+
var V12_1_ACCT_ENTRY_PRICE_OFF = 280;
|
|
1531
|
+
var V12_1_ACCT_FUNDING_INDEX_OFF = 288;
|
|
1566
1532
|
var V1M_ENGINE_OFF = 640;
|
|
1567
1533
|
var V1M_CONFIG_LEN = 536;
|
|
1568
1534
|
var V1M_ACCOUNT_SIZE = 248;
|
|
@@ -2652,16 +2618,17 @@ function parseAccount(data, idx) {
|
|
|
2652
2618
|
if (data.length < base + layout.accountSize) {
|
|
2653
2619
|
throw new Error("Slab data too short for account");
|
|
2654
2620
|
}
|
|
2621
|
+
const isV12_1 = layout.accountSize >= 320;
|
|
2655
2622
|
const isAdl = layout.accountSize >= 312;
|
|
2656
2623
|
const warmupStartedOff = isAdl ? V_ADL_ACCT_WARMUP_STARTED_OFF : ACCT_WARMUP_STARTED_OFF;
|
|
2657
2624
|
const warmupSlopeOff = isAdl ? V_ADL_ACCT_WARMUP_SLOPE_OFF : ACCT_WARMUP_SLOPE_OFF;
|
|
2658
|
-
const positionSizeOff = isAdl ? V_ADL_ACCT_POSITION_SIZE_OFF : ACCT_POSITION_SIZE_OFF;
|
|
2659
|
-
const entryPriceOff = isAdl ? V_ADL_ACCT_ENTRY_PRICE_OFF : ACCT_ENTRY_PRICE_OFF;
|
|
2660
|
-
const fundingIndexOff = isAdl ? V_ADL_ACCT_FUNDING_INDEX_OFF : ACCT_FUNDING_INDEX_OFF;
|
|
2661
|
-
const matcherProgOff = isAdl ? V_ADL_ACCT_MATCHER_PROGRAM_OFF : ACCT_MATCHER_PROGRAM_OFF;
|
|
2662
|
-
const matcherCtxOff = isAdl ? V_ADL_ACCT_MATCHER_CONTEXT_OFF : ACCT_MATCHER_CONTEXT_OFF;
|
|
2663
|
-
const feeCreditsOff = isAdl ? V_ADL_ACCT_FEE_CREDITS_OFF : ACCT_FEE_CREDITS_OFF;
|
|
2664
|
-
const lastFeeSlotOff = isAdl ? V_ADL_ACCT_LAST_FEE_SLOT_OFF : ACCT_LAST_FEE_SLOT_OFF;
|
|
2625
|
+
const positionSizeOff = isV12_1 ? V12_1_ACCT_POSITION_SIZE_OFF : isAdl ? V_ADL_ACCT_POSITION_SIZE_OFF : ACCT_POSITION_SIZE_OFF;
|
|
2626
|
+
const entryPriceOff = isV12_1 ? V12_1_ACCT_ENTRY_PRICE_OFF : isAdl ? V_ADL_ACCT_ENTRY_PRICE_OFF : ACCT_ENTRY_PRICE_OFF;
|
|
2627
|
+
const fundingIndexOff = isV12_1 ? V12_1_ACCT_FUNDING_INDEX_OFF : isAdl ? V_ADL_ACCT_FUNDING_INDEX_OFF : ACCT_FUNDING_INDEX_OFF;
|
|
2628
|
+
const matcherProgOff = isV12_1 ? V12_1_ACCT_MATCHER_PROGRAM_OFF : isAdl ? V_ADL_ACCT_MATCHER_PROGRAM_OFF : ACCT_MATCHER_PROGRAM_OFF;
|
|
2629
|
+
const matcherCtxOff = isV12_1 ? V12_1_ACCT_MATCHER_CONTEXT_OFF : isAdl ? V_ADL_ACCT_MATCHER_CONTEXT_OFF : ACCT_MATCHER_CONTEXT_OFF;
|
|
2630
|
+
const feeCreditsOff = isV12_1 ? V12_1_ACCT_FEE_CREDITS_OFF : isAdl ? V_ADL_ACCT_FEE_CREDITS_OFF : ACCT_FEE_CREDITS_OFF;
|
|
2631
|
+
const lastFeeSlotOff = isV12_1 ? V12_1_ACCT_LAST_FEE_SLOT_OFF : isAdl ? V_ADL_ACCT_LAST_FEE_SLOT_OFF : ACCT_LAST_FEE_SLOT_OFF;
|
|
2665
2632
|
const kindByte = readU8(data, base + ACCT_KIND_OFF);
|
|
2666
2633
|
const kind = kindByte === 1 ? 1 /* LP */ : 0 /* User */;
|
|
2667
2634
|
return {
|
|
@@ -2674,7 +2641,8 @@ function parseAccount(data, idx) {
|
|
|
2674
2641
|
warmupSlopePerStep: readU128LE(data, base + warmupSlopeOff),
|
|
2675
2642
|
positionSize: readI128LE(data, base + positionSizeOff),
|
|
2676
2643
|
entryPrice: readU64LE(data, base + entryPriceOff),
|
|
2677
|
-
|
|
2644
|
+
// V12_1 changed funding_index from i128 to i64 (legacy field moved to end of account)
|
|
2645
|
+
fundingIndex: isV12_1 ? BigInt(readI64LE(data, base + fundingIndexOff)) : readI128LE(data, base + fundingIndexOff),
|
|
2678
2646
|
matcherProgram: new PublicKey3(data.subarray(base + matcherProgOff, base + matcherProgOff + 32)),
|
|
2679
2647
|
matcherContext: new PublicKey3(data.subarray(base + matcherCtxOff, base + matcherCtxOff + 32)),
|
|
2680
2648
|
owner: new PublicKey3(data.subarray(base + layout.acctOwnerOff, base + layout.acctOwnerOff + 32)),
|
|
@@ -2707,12 +2675,6 @@ function deriveVaultAuthority(programId, slab) {
|
|
|
2707
2675
|
programId
|
|
2708
2676
|
);
|
|
2709
2677
|
}
|
|
2710
|
-
function deriveInsuranceLpMint(programId, slab) {
|
|
2711
|
-
return PublicKey4.findProgramAddressSync(
|
|
2712
|
-
[textEncoder.encode("ins_lp"), slab.toBytes()],
|
|
2713
|
-
programId
|
|
2714
|
-
);
|
|
2715
|
-
}
|
|
2716
2678
|
var LP_INDEX_U16_MAX = 65535;
|
|
2717
2679
|
function deriveLpPda(programId, slab, lpIdx) {
|
|
2718
2680
|
if (typeof lpIdx !== "number" || !Number.isInteger(lpIdx) || lpIdx < 0 || lpIdx > LP_INDEX_U16_MAX) {
|
|
@@ -5613,9 +5575,7 @@ export {
|
|
|
5613
5575
|
ACCOUNTS_CLOSE_ACCOUNT,
|
|
5614
5576
|
ACCOUNTS_CLOSE_SLAB,
|
|
5615
5577
|
ACCOUNTS_CLOSE_STALE_SLABS,
|
|
5616
|
-
ACCOUNTS_CREATE_INSURANCE_MINT,
|
|
5617
5578
|
ACCOUNTS_DEPOSIT_COLLATERAL,
|
|
5618
|
-
ACCOUNTS_DEPOSIT_INSURANCE_LP,
|
|
5619
5579
|
ACCOUNTS_EXECUTE_ADL,
|
|
5620
5580
|
ACCOUNTS_FUND_MARKET_INSURANCE,
|
|
5621
5581
|
ACCOUNTS_INIT_LP,
|
|
@@ -5649,7 +5609,6 @@ export {
|
|
|
5649
5609
|
ACCOUNTS_UPDATE_CONFIG,
|
|
5650
5610
|
ACCOUNTS_WITHDRAW_COLLATERAL,
|
|
5651
5611
|
ACCOUNTS_WITHDRAW_INSURANCE,
|
|
5652
|
-
ACCOUNTS_WITHDRAW_INSURANCE_LP,
|
|
5653
5612
|
AccountKind,
|
|
5654
5613
|
CHAINLINK_ANSWER_OFFSET,
|
|
5655
5614
|
CHAINLINK_DECIMALS_OFFSET,
|
|
@@ -5746,7 +5705,6 @@ export {
|
|
|
5746
5705
|
depositAccounts,
|
|
5747
5706
|
deriveCreatorLockPda,
|
|
5748
5707
|
deriveDepositPda,
|
|
5749
|
-
deriveInsuranceLpMint,
|
|
5750
5708
|
deriveKeeperFund,
|
|
5751
5709
|
deriveLpPda,
|
|
5752
5710
|
derivePythPriceUpdateAccount,
|
|
@@ -5783,9 +5741,7 @@ export {
|
|
|
5783
5741
|
encodeCloseAccount,
|
|
5784
5742
|
encodeCloseSlab,
|
|
5785
5743
|
encodeCloseStaleSlabs,
|
|
5786
|
-
encodeCreateInsuranceMint,
|
|
5787
5744
|
encodeDepositCollateral,
|
|
5788
|
-
encodeDepositInsuranceLP,
|
|
5789
5745
|
encodeExecuteAdl,
|
|
5790
5746
|
encodeFundMarketInsurance,
|
|
5791
5747
|
encodeInitLP,
|
|
@@ -5846,7 +5802,6 @@ export {
|
|
|
5846
5802
|
encodeUpdateRiskParams,
|
|
5847
5803
|
encodeWithdrawCollateral,
|
|
5848
5804
|
encodeWithdrawInsurance,
|
|
5849
|
-
encodeWithdrawInsuranceLP,
|
|
5850
5805
|
fetchAdlRankedPositions,
|
|
5851
5806
|
fetchAdlRankings,
|
|
5852
5807
|
fetchSlab,
|