@percolatorct/sdk 1.0.0-beta.4 → 1.0.0-beta.6

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.
@@ -30,13 +30,20 @@ export declare const IX_TAG: {
30
30
  readonly ResolveMarket: 19;
31
31
  readonly WithdrawInsurance: 20;
32
32
  readonly AdminForceClose: 21;
33
- readonly UpdateRiskParams: 22;
34
- readonly RenounceAdmin: 23;
35
- readonly PauseMarket: 27;
36
- readonly UnpauseMarket: 28;
37
- readonly AcceptAdmin: 29;
38
- readonly SetInsuranceWithdrawPolicy: 30;
39
- readonly WithdrawInsuranceLimited: 31;
33
+ readonly SetInsuranceWithdrawPolicy: 22;
34
+ /** @deprecated Use SetInsuranceWithdrawPolicy */ readonly UpdateRiskParams: 22;
35
+ readonly WithdrawInsuranceLimited: 23;
36
+ /** @deprecated Use WithdrawInsuranceLimited */ readonly RenounceAdmin: 23;
37
+ readonly QueryLpFees: 24;
38
+ readonly ReclaimEmptyAccount: 25;
39
+ readonly SettleAccount: 26;
40
+ readonly DepositFeeCredits: 27;
41
+ /** @deprecated No on-chain PauseMarket instruction */ readonly PauseMarket: 27;
42
+ readonly ConvertReleasedPnl: 28;
43
+ /** @deprecated No on-chain UnpauseMarket instruction */ readonly UnpauseMarket: 28;
44
+ readonly ResolvePermissionless: 29;
45
+ /** @deprecated Use ResolvePermissionless */ readonly AcceptAdmin: 29;
46
+ readonly ForceCloseResolved: 30;
40
47
  readonly SetPythOracle: 32;
41
48
  readonly UpdateMarkPrice: 33;
42
49
  readonly UpdateHyperpMark: 34;
@@ -135,6 +142,9 @@ export interface InitMarketArgs {
135
142
  invert: number;
136
143
  unitScale: number;
137
144
  initialMarkPriceE6: bigint | string;
145
+ maxMaintenanceFeePerSlot?: bigint | string;
146
+ maxInsuranceFloor?: bigint | string;
147
+ minOraclePriceCap?: bigint | string;
138
148
  warmupPeriodSlots: bigint | string;
139
149
  maintenanceMarginBps: bigint | string;
140
150
  initialMarginBps: bigint | string;
@@ -148,6 +158,9 @@ export interface InitMarketArgs {
148
158
  liquidationFeeCap: bigint | string;
149
159
  liquidationBufferBps: bigint | string;
150
160
  minLiquidationAbs: bigint | string;
161
+ minInitialDeposit: bigint | string;
162
+ minNonzeroMmReq: bigint | string;
163
+ minNonzeroImReq: bigint | string;
151
164
  }
152
165
  export declare function encodeInitMarket(args: InitMarketArgs): Uint8Array;
153
166
  /**
@@ -1032,3 +1045,67 @@ export interface InitMatcherCtxArgs {
1032
1045
  skewSpreadMultBps: number;
1033
1046
  }
1034
1047
  export declare function encodeInitMatcherCtx(args: InitMatcherCtxArgs): Uint8Array;
1048
+ /** SetInsuranceWithdrawPolicy (tag 22): authority + min_withdraw_base + max_withdraw_bps + cooldown_slots */
1049
+ export interface SetInsuranceWithdrawPolicyArgs {
1050
+ authority: PublicKey | string;
1051
+ minWithdrawBase: bigint | string;
1052
+ maxWithdrawBps: number;
1053
+ cooldownSlots: bigint | string;
1054
+ }
1055
+ export declare function encodeSetInsuranceWithdrawPolicy(args: SetInsuranceWithdrawPolicyArgs): Uint8Array;
1056
+ /** WithdrawInsuranceLimited (tag 23): amount */
1057
+ export declare function encodeWithdrawInsuranceLimited(args: {
1058
+ amount: bigint | string;
1059
+ }): Uint8Array;
1060
+ /** ResolvePermissionless (tag 29): no args */
1061
+ export declare function encodeResolvePermissionless(): Uint8Array;
1062
+ /** ForceCloseResolved (tag 30): user_idx */
1063
+ export declare function encodeForceCloseResolved(args: {
1064
+ userIdx: number;
1065
+ }): Uint8Array;
1066
+ /** CreateLpVault (tag 37): fee_share_bps + util_curve_enabled */
1067
+ export declare function encodeCreateLpVault(args: {
1068
+ feeShareBps: bigint | string;
1069
+ utilCurveEnabled?: boolean;
1070
+ }): Uint8Array;
1071
+ /** LpVaultDeposit (tag 38): amount */
1072
+ export declare function encodeLpVaultDeposit(args: {
1073
+ amount: bigint | string;
1074
+ }): Uint8Array;
1075
+ /** LpVaultCrankFees (tag 40): no args */
1076
+ export declare function encodeLpVaultCrankFees(): Uint8Array;
1077
+ /** ChallengeSettlement (tag 43): proposed_price_e6 */
1078
+ export declare function encodeChallengeSettlement(args: {
1079
+ proposedPriceE6: bigint | string;
1080
+ }): Uint8Array;
1081
+ /** ResolveDispute (tag 44): accept (0 = reject, 1 = accept) */
1082
+ export declare function encodeResolveDispute(args: {
1083
+ accept: number;
1084
+ }): Uint8Array;
1085
+ /** DepositLpCollateral (tag 45): user_idx + lp_amount */
1086
+ export declare function encodeDepositLpCollateral(args: {
1087
+ userIdx: number;
1088
+ lpAmount: bigint | string;
1089
+ }): Uint8Array;
1090
+ /** WithdrawLpCollateral (tag 46): user_idx + lp_amount */
1091
+ export declare function encodeWithdrawLpCollateral(args: {
1092
+ userIdx: number;
1093
+ lpAmount: bigint | string;
1094
+ }): Uint8Array;
1095
+ /** SetOffsetPair (tag 54): offset_bps */
1096
+ export declare function encodeSetOffsetPair(args: {
1097
+ offsetBps: number;
1098
+ }): Uint8Array;
1099
+ /** AttestCrossMargin (tag 55): user_idx_a + user_idx_b */
1100
+ export declare function encodeAttestCrossMargin(args: {
1101
+ userIdxA: number;
1102
+ userIdxB: number;
1103
+ }): Uint8Array;
1104
+ /** RescueOrphanVault (tag 72): no args */
1105
+ export declare function encodeRescueOrphanVault(): Uint8Array;
1106
+ /** CloseOrphanSlab (tag 73): no args */
1107
+ export declare function encodeCloseOrphanSlab(): Uint8Array;
1108
+ /** SetDexPool (tag 74): pool pubkey */
1109
+ export declare function encodeSetDexPool(args: {
1110
+ pool: PublicKey | string;
1111
+ }): Uint8Array;
@@ -17,7 +17,7 @@ export declare const PROGRAM_IDS: {
17
17
  readonly matcher: "GTRgyTDfrMvBubALAqtHuQwT8tbGyXid7svXZKtWfC9k";
18
18
  };
19
19
  readonly mainnet: {
20
- readonly percolator: "GM8zjJ8LTBMv9xEsverh6H6wLyevgMHEJXcEzyY3rY24";
20
+ readonly percolator: "ESa89R5Es3rJ5mnwGybVRG1GrNt9etP11Z5V2QWD4edv";
21
21
  readonly matcher: "DHP6DtwXP1yJsz8YzfoeigRFPB979gzmumkmCxDLSkUX";
22
22
  };
23
23
  };
package/dist/index.js CHANGED
@@ -117,15 +117,33 @@ var IX_TAG = {
117
117
  ResolveMarket: 19,
118
118
  WithdrawInsurance: 20,
119
119
  AdminForceClose: 21,
120
+ // Tags 22-23: on-chain these are SetInsuranceWithdrawPolicy / WithdrawInsuranceLimited.
121
+ // Legacy aliases (UpdateRiskParams/RenounceAdmin) kept for backward compat.
122
+ SetInsuranceWithdrawPolicy: 22,
123
+ /** @deprecated Use SetInsuranceWithdrawPolicy */
120
124
  UpdateRiskParams: 22,
125
+ WithdrawInsuranceLimited: 23,
126
+ /** @deprecated Use WithdrawInsuranceLimited */
121
127
  RenounceAdmin: 23,
122
- // Tags 24–26 (CreateInsuranceMint / DepositInsuranceLP / WithdrawInsuranceLP)
123
- // were removed in SDK v1.0.0-beta.3. Replaced by percolator-stake.
128
+ // Tags 24–26: on-chain = QueryLpFees/ReclaimEmptyAccount/SettleAccount.
129
+ // Old insurance LP tags removed those moved to percolator-stake.
130
+ QueryLpFees: 24,
131
+ ReclaimEmptyAccount: 25,
132
+ SettleAccount: 26,
133
+ // Tags 27-28: on-chain = DepositFeeCredits/ConvertReleasedPnl.
134
+ // Legacy aliases (PauseMarket/UnpauseMarket) kept — those instructions don't exist on-chain.
135
+ DepositFeeCredits: 27,
136
+ /** @deprecated No on-chain PauseMarket instruction */
124
137
  PauseMarket: 27,
138
+ ConvertReleasedPnl: 28,
139
+ /** @deprecated No on-chain UnpauseMarket instruction */
125
140
  UnpauseMarket: 28,
141
+ // Tags 29-30: on-chain = ResolvePermissionless/ForceCloseResolved.
142
+ ResolvePermissionless: 29,
143
+ /** @deprecated Use ResolvePermissionless */
126
144
  AcceptAdmin: 29,
127
- SetInsuranceWithdrawPolicy: 30,
128
- WithdrawInsuranceLimited: 31,
145
+ ForceCloseResolved: 30,
146
+ // Tag 31: gap (no decode arm on-chain)
129
147
  SetPythOracle: 32,
130
148
  UpdateMarkPrice: 33,
131
149
  UpdateHyperpMark: 34,
@@ -230,7 +248,7 @@ function encodeFeedId(feedId) {
230
248
  }
231
249
  return bytes;
232
250
  }
233
- var INIT_MARKET_DATA_LEN = 264;
251
+ var INIT_MARKET_DATA_LEN = 352;
234
252
  function encodeInitMarket(args) {
235
253
  const data = concatBytes(
236
254
  encU8(IX_TAG.InitMarket),
@@ -242,6 +260,11 @@ function encodeInitMarket(args) {
242
260
  encU8(args.invert),
243
261
  encU32(args.unitScale),
244
262
  encU64(args.initialMarkPriceE6),
263
+ // 3 fields between header and RiskParams (immutable after init)
264
+ encU128(args.maxMaintenanceFeePerSlot ?? 0n),
265
+ encU128(args.maxInsuranceFloor ?? 0n),
266
+ encU64(args.minOraclePriceCap ?? 0n),
267
+ // RiskParams block (15 fields)
245
268
  encU64(args.warmupPeriodSlots),
246
269
  encU64(args.maintenanceMarginBps),
247
270
  encU64(args.initialMarginBps),
@@ -254,7 +277,10 @@ function encodeInitMarket(args) {
254
277
  encU64(args.liquidationFeeBps),
255
278
  encU128(args.liquidationFeeCap),
256
279
  encU64(args.liquidationBufferBps),
257
- encU128(args.minLiquidationAbs)
280
+ encU128(args.minLiquidationAbs),
281
+ encU128(args.minInitialDeposit),
282
+ encU128(args.minNonzeroMmReq),
283
+ encU128(args.minNonzeroImReq)
258
284
  );
259
285
  if (data.length !== INIT_MARKET_DATA_LEN) {
260
286
  throw new Error(
@@ -642,6 +668,58 @@ function encodeInitMatcherCtx(args) {
642
668
  encU16(args.skewSpreadMultBps)
643
669
  );
644
670
  }
671
+ function encodeSetInsuranceWithdrawPolicy(args) {
672
+ return concatBytes(encU8(IX_TAG.SetInsuranceWithdrawPolicy), encPubkey(args.authority), encU64(args.minWithdrawBase), encU16(args.maxWithdrawBps), encU64(args.cooldownSlots));
673
+ }
674
+ function encodeWithdrawInsuranceLimited(args) {
675
+ return concatBytes(encU8(IX_TAG.WithdrawInsuranceLimited), encU64(args.amount));
676
+ }
677
+ function encodeResolvePermissionless() {
678
+ return concatBytes(encU8(IX_TAG.ResolvePermissionless));
679
+ }
680
+ function encodeForceCloseResolved(args) {
681
+ return concatBytes(encU8(IX_TAG.ForceCloseResolved), encU16(args.userIdx));
682
+ }
683
+ function encodeCreateLpVault(args) {
684
+ const parts = [encU8(IX_TAG.CreateLpVault), encU64(args.feeShareBps)];
685
+ if (args.utilCurveEnabled !== void 0) {
686
+ parts.push(encU8(args.utilCurveEnabled ? 1 : 0));
687
+ }
688
+ return concatBytes(...parts);
689
+ }
690
+ function encodeLpVaultDeposit(args) {
691
+ return concatBytes(encU8(IX_TAG.LpVaultDeposit), encU64(args.amount));
692
+ }
693
+ function encodeLpVaultCrankFees() {
694
+ return concatBytes(encU8(IX_TAG.LpVaultCrankFees));
695
+ }
696
+ function encodeChallengeSettlement(args) {
697
+ return concatBytes(encU8(IX_TAG.ChallengeSettlement), encU64(args.proposedPriceE6));
698
+ }
699
+ function encodeResolveDispute(args) {
700
+ return concatBytes(encU8(IX_TAG.ResolveDispute), encU8(args.accept));
701
+ }
702
+ function encodeDepositLpCollateral(args) {
703
+ return concatBytes(encU8(IX_TAG.DepositLpCollateral), encU16(args.userIdx), encU64(args.lpAmount));
704
+ }
705
+ function encodeWithdrawLpCollateral(args) {
706
+ return concatBytes(encU8(IX_TAG.WithdrawLpCollateral), encU16(args.userIdx), encU64(args.lpAmount));
707
+ }
708
+ function encodeSetOffsetPair(args) {
709
+ return concatBytes(encU8(IX_TAG.SetOffsetPair), encU16(args.offsetBps));
710
+ }
711
+ function encodeAttestCrossMargin(args) {
712
+ return concatBytes(encU8(IX_TAG.AttestCrossMargin), encU16(args.userIdxA), encU16(args.userIdxB));
713
+ }
714
+ function encodeRescueOrphanVault() {
715
+ return concatBytes(encU8(IX_TAG.RescueOrphanVault));
716
+ }
717
+ function encodeCloseOrphanSlab() {
718
+ return concatBytes(encU8(IX_TAG.CloseOrphanSlab));
719
+ }
720
+ function encodeSetDexPool(args) {
721
+ return concatBytes(encU8(IX_TAG.SetDexPool), encPubkey(args.pool));
722
+ }
645
723
 
646
724
  // src/abi/accounts.ts
647
725
  import {
@@ -1491,6 +1569,7 @@ var V_ADL_ACCT_FEE_CREDITS_OFF = 224;
1491
1569
  var V_ADL_ACCT_LAST_FEE_SLOT_OFF = 240;
1492
1570
  var V12_1_ENGINE_OFF = 648;
1493
1571
  var V12_1_ACCOUNT_SIZE = 320;
1572
+ var V12_1_ACCOUNT_SIZE_SBF = 280;
1494
1573
  var V12_1_ENGINE_BITMAP_OFF = 1016;
1495
1574
  var V12_1_ENGINE_PARAMS_OFF = 96;
1496
1575
  var V12_1_PARAMS_SIZE = 352;
@@ -1526,8 +1605,8 @@ var V12_1_ACCT_MATCHER_CONTEXT_OFF = 176;
1526
1605
  var V12_1_ACCT_OWNER_OFF = 208;
1527
1606
  var V12_1_ACCT_FEE_CREDITS_OFF = 240;
1528
1607
  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;
1608
+ var V12_1_ACCT_POSITION_SIZE_OFF = 88;
1609
+ var V12_1_ACCT_ENTRY_PRICE_OFF = -1;
1531
1610
  var V12_1_ACCT_FUNDING_INDEX_OFF = 288;
1532
1611
  var V1M_ENGINE_OFF = 640;
1533
1612
  var V1M_CONFIG_LEN = 536;
@@ -1602,6 +1681,15 @@ for (const n of TIERS) {
1602
1681
  V_SETDEXPOOL_SIZES.set(computeSlabSize(V_SETDEXPOOL_ENGINE_OFF, V_ADL_ENGINE_BITMAP_OFF, V_ADL_ACCOUNT_SIZE, n, 18), n);
1603
1682
  V12_1_SIZES.set(computeSlabSize(V12_1_ENGINE_OFF, V12_1_ENGINE_BITMAP_OFF, V12_1_ACCOUNT_SIZE, n, 18), n);
1604
1683
  }
1684
+ var V12_1_SBF_ACCOUNT_SIZE = 280;
1685
+ var V12_1_SBF_ENGINE_PREAMBLE = 558;
1686
+ for (const [, n] of [["Micro", 64], ["Small", 256], ["Medium", 1024], ["Large", 4096]]) {
1687
+ const bitmapBytes = Math.ceil(n / 64) * 8;
1688
+ const preAccLen = V12_1_SBF_ENGINE_PREAMBLE + bitmapBytes + 18 + n * 2;
1689
+ const accountsOff = Math.ceil(preAccLen / 8) * 8;
1690
+ const total = V12_1_ENGINE_OFF + accountsOff + n * V12_1_SBF_ACCOUNT_SIZE;
1691
+ V12_1_SIZES.set(total, n);
1692
+ }
1605
1693
  var SLAB_TIERS_V2 = {
1606
1694
  small: { maxAccounts: 256, dataSize: 65088, label: "Small", description: "256 slots (V2 BPF intermediate)" },
1607
1695
  large: { maxAccounts: 4096, dataSize: 1025568, label: "Large", description: "4,096 slots (V2 BPF intermediate)" }
@@ -2126,10 +2214,12 @@ function buildLayoutVSetDexPool(maxAccounts) {
2126
2214
  engineInsuranceIsolationBpsOff: 64
2127
2215
  };
2128
2216
  }
2129
- function buildLayoutV12_1(maxAccounts) {
2217
+ function buildLayoutV12_1(maxAccounts, dataLen) {
2130
2218
  const engineOff = V12_1_ENGINE_OFF;
2131
2219
  const bitmapOff = V12_1_ENGINE_BITMAP_OFF;
2132
- const accountSize = V12_1_ACCOUNT_SIZE;
2220
+ const hostSize = computeSlabSize(engineOff, bitmapOff, V12_1_ACCOUNT_SIZE, maxAccounts, 18);
2221
+ const isSbf = dataLen !== void 0 && dataLen !== hostSize;
2222
+ const accountSize = isSbf ? V12_1_ACCOUNT_SIZE_SBF : V12_1_ACCOUNT_SIZE;
2133
2223
  const bitmapWords = Math.ceil(maxAccounts / 64);
2134
2224
  const bitmapBytes = bitmapWords * 8;
2135
2225
  const postBitmap = 18;
@@ -2138,10 +2228,14 @@ function buildLayoutV12_1(maxAccounts) {
2138
2228
  const accountsOffRel = Math.ceil(preAccountsLen / 8) * 8;
2139
2229
  return {
2140
2230
  version: 1,
2141
- headerLen: V1_HEADER_LEN,
2142
- configOffset: V1_HEADER_LEN,
2143
- configLen: V_SETDEXPOOL_CONFIG_LEN,
2144
- // 544 (same as V_SETDEXPOOL)
2231
+ // V12_1 upstream rebase uses 72-byte header (SlabHeader only, no V1 extension).
2232
+ // Empirically verified: USDC mint found at offset 72 on mainnet slab BVjPc6rd.
2233
+ headerLen: V0_HEADER_LEN,
2234
+ // 72 (not 104 — V12_1 removed the 32-byte header extension)
2235
+ configOffset: V0_HEADER_LEN,
2236
+ // 72
2237
+ configLen: 576,
2238
+ // 544 + 32 (dex_pool: [u8;32] added in V12_1)
2145
2239
  reservedOff: V1_RESERVED_OFF,
2146
2240
  engineOff,
2147
2241
  accountSize,
@@ -2188,7 +2282,7 @@ function buildLayoutV12_1(maxAccounts) {
2188
2282
  }
2189
2283
  function detectSlabLayout(dataLen, data) {
2190
2284
  const v121n = V12_1_SIZES.get(dataLen);
2191
- if (v121n !== void 0) return buildLayoutV12_1(v121n);
2285
+ if (v121n !== void 0) return buildLayoutV12_1(v121n, dataLen);
2192
2286
  const vsdpn = V_SETDEXPOOL_SIZES.get(dataLen);
2193
2287
  if (vsdpn !== void 0) return buildLayoutVSetDexPool(vsdpn);
2194
2288
  const v1m2n = V1M2_SIZES.get(dataLen);
@@ -2618,8 +2712,8 @@ function parseAccount(data, idx) {
2618
2712
  if (data.length < base + layout.accountSize) {
2619
2713
  throw new Error("Slab data too short for account");
2620
2714
  }
2621
- const isV12_1 = layout.accountSize >= 320;
2622
- const isAdl = layout.accountSize >= 312;
2715
+ const isV12_1 = layout.engineOff === V12_1_ENGINE_OFF && (layout.accountSize === V12_1_ACCOUNT_SIZE || layout.accountSize === V12_1_ACCOUNT_SIZE_SBF);
2716
+ const isAdl = layout.accountSize >= 312 || isV12_1;
2623
2717
  const warmupStartedOff = isAdl ? V_ADL_ACCT_WARMUP_STARTED_OFF : ACCT_WARMUP_STARTED_OFF;
2624
2718
  const warmupSlopeOff = isAdl ? V_ADL_ACCT_WARMUP_SLOPE_OFF : ACCT_WARMUP_SLOPE_OFF;
2625
2719
  const positionSizeOff = isV12_1 ? V12_1_ACCT_POSITION_SIZE_OFF : isAdl ? V_ADL_ACCT_POSITION_SIZE_OFF : ACCT_POSITION_SIZE_OFF;
@@ -2640,7 +2734,8 @@ function parseAccount(data, idx) {
2640
2734
  warmupStartedAtSlot: readU64LE(data, base + warmupStartedOff),
2641
2735
  warmupSlopePerStep: readU128LE(data, base + warmupSlopeOff),
2642
2736
  positionSize: readI128LE(data, base + positionSizeOff),
2643
- entryPrice: readU64LE(data, base + entryPriceOff),
2737
+ entryPrice: entryPriceOff >= 0 ? readU64LE(data, base + entryPriceOff) : 0n,
2738
+ // V12_1: entry_price removed
2644
2739
  // V12_1 changed funding_index from i128 to i64 (legacy field moved to end of account)
2645
2740
  fundingIndex: isV12_1 ? BigInt(readI64LE(data, base + fundingIndexOff)) : readI128LE(data, base + fundingIndexOff),
2646
2741
  matcherProgram: new PublicKey3(data.subarray(base + matcherProgOff, base + matcherProgOff + 32)),
@@ -3720,7 +3815,7 @@ var PROGRAM_IDS = {
3720
3815
  matcher: "GTRgyTDfrMvBubALAqtHuQwT8tbGyXid7svXZKtWfC9k"
3721
3816
  },
3722
3817
  mainnet: {
3723
- percolator: "GM8zjJ8LTBMv9xEsverh6H6wLyevgMHEJXcEzyY3rY24",
3818
+ percolator: "ESa89R5Es3rJ5mnwGybVRG1GrNt9etP11Z5V2QWD4edv",
3724
3819
  matcher: "DHP6DtwXP1yJsz8YzfoeigRFPB979gzmumkmCxDLSkUX"
3725
3820
  }
3726
3821
  };
@@ -3790,7 +3885,7 @@ function getStakeProgramId(network) {
3790
3885
  }
3791
3886
  return new PublicKey10(id);
3792
3887
  }
3793
- var STAKE_PROGRAM_ID = new PublicKey10(STAKE_PROGRAM_IDS.devnet);
3888
+ var STAKE_PROGRAM_ID = new PublicKey10(STAKE_PROGRAM_IDS.mainnet);
3794
3889
  var STAKE_IX = {
3795
3890
  InitPool: 0,
3796
3891
  Deposit: 1,
@@ -5011,7 +5106,7 @@ function computeFeeSplit(totalFee, config) {
5011
5106
  const creator = totalFee - lp - protocol;
5012
5107
  if (creator < 0n) {
5013
5108
  throw new Error(
5014
- `Internal error: creator fee is negative (${creator}). This should not happen if lpBps + protocolBps + creatorBps <= 10000.`
5109
+ `Internal error: creator fee is negative (${creator}). This should not happen if lpBps + protocolBps + creatorBps === 10000.`
5015
5110
  );
5016
5111
  }
5017
5112
  return [lp, protocol, creator];
@@ -5731,17 +5826,23 @@ export {
5731
5826
  encodeAdvanceEpoch,
5732
5827
  encodeAdvanceOraclePhase,
5733
5828
  encodeAllocateMarket,
5829
+ encodeAttestCrossMargin,
5734
5830
  encodeAuditCrank,
5735
5831
  encodeBurnPositionNft,
5736
5832
  encodeCancelQueuedWithdrawal,
5833
+ encodeChallengeSettlement,
5737
5834
  encodeClaimEpochWithdrawal,
5738
5835
  encodeClaimQueuedWithdrawal,
5739
5836
  encodeClearPendingSettlement,
5740
5837
  encodeCloseAccount,
5838
+ encodeCloseOrphanSlab,
5741
5839
  encodeCloseSlab,
5742
5840
  encodeCloseStaleSlabs,
5841
+ encodeCreateLpVault,
5743
5842
  encodeDepositCollateral,
5843
+ encodeDepositLpCollateral,
5744
5844
  encodeExecuteAdl,
5845
+ encodeForceCloseResolved,
5745
5846
  encodeFundMarketInsurance,
5746
5847
  encodeInitLP,
5747
5848
  encodeInitMarket,
@@ -5750,6 +5851,8 @@ export {
5750
5851
  encodeInitUser,
5751
5852
  encodeKeeperCrank,
5752
5853
  encodeLiquidateAtOracle,
5854
+ encodeLpVaultCrankFees,
5855
+ encodeLpVaultDeposit,
5753
5856
  encodeLpVaultWithdraw,
5754
5857
  encodeMintPositionNft,
5755
5858
  encodePauseMarket,
@@ -5758,9 +5861,15 @@ export {
5758
5861
  encodeQueueWithdrawalSV,
5759
5862
  encodeReclaimSlabRent,
5760
5863
  encodeRenounceAdmin,
5864
+ encodeRescueOrphanVault,
5865
+ encodeResolveDispute,
5761
5866
  encodeResolveMarket,
5867
+ encodeResolvePermissionless,
5868
+ encodeSetDexPool,
5762
5869
  encodeSetInsuranceIsolation,
5870
+ encodeSetInsuranceWithdrawPolicy,
5763
5871
  encodeSetMaintenanceFee,
5872
+ encodeSetOffsetPair,
5764
5873
  encodeSetOiImbalanceHardBlock,
5765
5874
  encodeSetOracleAuthority,
5766
5875
  encodeSetOraclePriceCap,
@@ -5801,6 +5910,8 @@ export {
5801
5910
  encodeUpdateRiskParams,
5802
5911
  encodeWithdrawCollateral,
5803
5912
  encodeWithdrawInsurance,
5913
+ encodeWithdrawInsuranceLimited,
5914
+ encodeWithdrawLpCollateral,
5804
5915
  fetchAdlRankedPositions,
5805
5916
  fetchAdlRankings,
5806
5917
  fetchSlab,