@panoptic-eng/sdk 1.0.72 → 1.0.74

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.
@@ -7584,211 +7584,503 @@ const semiFungiblePositionManagerV4Abi = [
7584
7584
  ];
7585
7585
 
7586
7586
  //#endregion
7587
- //#region src/panoptic/v2/clients/blockMeta.ts
7588
- /**
7589
- * Get block metadata for a given block.
7590
- * Used to tag all read results with same-block consistency proof.
7591
- *
7592
- * @param params - The parameters
7593
- * @returns Block metadata
7594
- */
7595
- async function getBlockMeta(params) {
7596
- const { client, blockNumber } = params;
7597
- const block = await client.getBlock({
7598
- blockNumber,
7599
- includeTransactions: false
7600
- });
7601
- return {
7602
- blockNumber: block.number,
7603
- blockHash: block.hash,
7604
- blockTimestamp: block.timestamp
7605
- };
7606
- }
7607
-
7608
- //#endregion
7609
- //#region src/panoptic/v2/errors/base.ts
7610
- /**
7611
- * Base error class for the Panoptic v2 SDK.
7612
- * @module v2/errors/base
7613
- */
7587
+ //#region src/panoptic/v2/abis/stateView.ts
7614
7588
  /**
7615
- * Base error class for all Panoptic SDK errors.
7616
- * All errors thrown by the SDK extend this class.
7617
- *
7618
- * @example
7619
- * ```typescript
7620
- * try {
7621
- * await openPosition(config, params)
7622
- * } catch (error) {
7623
- * if (error instanceof PanopticError) {
7624
- * console.log('Panoptic error:', error.name, error.message)
7625
- * console.log('Original cause:', error.cause)
7626
- * }
7627
- * }
7628
- * ```
7589
+ * Minimal Uniswap V4 StateView ABI for fee growth reads.
7590
+ * Only includes functions needed by streamia history.
7629
7591
  */
7630
- var PanopticError = class extends Error {
7631
- name = "PanopticError";
7632
- /** The Solidity error name (e.g. 'PriceBoundFail', 'InputListFail'). Set by the parser. */
7633
- errorName;
7634
- /**
7635
- * Creates a new PanopticError.
7636
- *
7637
- * @param message - Human-readable error message
7638
- * @param cause - Optional underlying error that caused this error
7639
- */
7640
- constructor(message, cause) {
7641
- super(message);
7642
- this.cause = cause;
7643
- if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
7644
- Object.setPrototypeOf(this, new.target.prototype);
7592
+ const stateViewAbi = [
7593
+ {
7594
+ inputs: [{
7595
+ internalType: "PoolId",
7596
+ name: "poolId",
7597
+ type: "bytes32"
7598
+ }],
7599
+ name: "getSlot0",
7600
+ outputs: [
7601
+ {
7602
+ internalType: "uint160",
7603
+ name: "sqrtPriceX96",
7604
+ type: "uint160"
7605
+ },
7606
+ {
7607
+ internalType: "int24",
7608
+ name: "tick",
7609
+ type: "int24"
7610
+ },
7611
+ {
7612
+ internalType: "uint24",
7613
+ name: "protocolFee",
7614
+ type: "uint24"
7615
+ },
7616
+ {
7617
+ internalType: "uint24",
7618
+ name: "lpFee",
7619
+ type: "uint24"
7620
+ }
7621
+ ],
7622
+ stateMutability: "view",
7623
+ type: "function"
7624
+ },
7625
+ {
7626
+ inputs: [{
7627
+ internalType: "PoolId",
7628
+ name: "poolId",
7629
+ type: "bytes32"
7630
+ }],
7631
+ name: "getFeeGrowthGlobals",
7632
+ outputs: [{
7633
+ internalType: "uint256",
7634
+ name: "feeGrowthGlobal0",
7635
+ type: "uint256"
7636
+ }, {
7637
+ internalType: "uint256",
7638
+ name: "feeGrowthGlobal1",
7639
+ type: "uint256"
7640
+ }],
7641
+ stateMutability: "view",
7642
+ type: "function"
7643
+ },
7644
+ {
7645
+ inputs: [{
7646
+ internalType: "PoolId",
7647
+ name: "poolId",
7648
+ type: "bytes32"
7649
+ }, {
7650
+ internalType: "int24",
7651
+ name: "tick",
7652
+ type: "int24"
7653
+ }],
7654
+ name: "getTickInfo",
7655
+ outputs: [
7656
+ {
7657
+ internalType: "uint128",
7658
+ name: "liquidityGross",
7659
+ type: "uint128"
7660
+ },
7661
+ {
7662
+ internalType: "int128",
7663
+ name: "liquidityNet",
7664
+ type: "int128"
7665
+ },
7666
+ {
7667
+ internalType: "uint256",
7668
+ name: "feeGrowthOutside0X128",
7669
+ type: "uint256"
7670
+ },
7671
+ {
7672
+ internalType: "uint256",
7673
+ name: "feeGrowthOutside1X128",
7674
+ type: "uint256"
7675
+ }
7676
+ ],
7677
+ stateMutability: "view",
7678
+ type: "function"
7679
+ },
7680
+ {
7681
+ inputs: [{
7682
+ internalType: "PoolId",
7683
+ name: "poolId",
7684
+ type: "bytes32"
7685
+ }],
7686
+ name: "getLiquidity",
7687
+ outputs: [{
7688
+ internalType: "uint128",
7689
+ name: "liquidity",
7690
+ type: "uint128"
7691
+ }],
7692
+ stateMutability: "view",
7693
+ type: "function"
7645
7694
  }
7646
- };
7695
+ ];
7647
7696
 
7648
7697
  //#endregion
7649
- //#region src/panoptic/v2/errors/contract.ts
7650
- /**
7651
- * The account is not solvent enough to perform the desired action.
7652
- * @see Errors.sol:9
7653
- */
7654
- var AccountInsolventError = class extends PanopticError {
7655
- name = "AccountInsolventError";
7656
- constructor(solvent, numberOfTicks, cause) {
7657
- super(`Account insolvent: solvent=${solvent}, numberOfTicks=${numberOfTicks}`, cause);
7658
- this.solvent = solvent;
7659
- this.numberOfTicks = numberOfTicks;
7660
- }
7661
- };
7662
- /**
7663
- * Position is still solvent and cannot be liquidated.
7664
- * @see Errors.sol:84
7665
- */
7666
- var NotMarginCalledError = class extends PanopticError {
7667
- name = "NotMarginCalledError";
7668
- constructor(cause) {
7669
- super("Position is still solvent and cannot be liquidated", cause);
7670
- }
7671
- };
7672
- /**
7673
- * The user does not own enough assets to open/close a position.
7674
- * @see Errors.sol:78
7675
- */
7676
- var NotEnoughTokensError = class extends PanopticError {
7677
- name = "NotEnoughTokensError";
7678
- get deficit() {
7679
- return this.assetsRequested > this.assetBalance ? this.assetsRequested - this.assetBalance : 0n;
7680
- }
7681
- constructor(tokenAddress, assetsRequested, assetBalance, cause) {
7682
- super(`Not enough tokens: requested=${assetsRequested}, balance=${assetBalance}, token=${tokenAddress}`, cause);
7683
- this.tokenAddress = tokenAddress;
7684
- this.assetsRequested = assetsRequested;
7685
- this.assetBalance = assetBalance;
7686
- }
7687
- };
7688
- /**
7689
- * There is not enough available liquidity in the chunk for a long leg.
7690
- * @see Errors.sol:75
7691
- */
7692
- var NotEnoughLiquidityInChunkError = class extends PanopticError {
7693
- name = "NotEnoughLiquidityInChunkError";
7694
- constructor(cause) {
7695
- super("Not enough liquidity in chunk for long leg creation or short leg closure", cause);
7696
- }
7697
- };
7698
- /**
7699
- * There is not enough available liquidity to fulfill a credit.
7700
- * @see Errors.sol:47
7701
- */
7702
- var InsufficientCreditLiquidityError = class extends PanopticError {
7703
- name = "InsufficientCreditLiquidityError";
7704
- constructor(cause) {
7705
- super("Insufficient credit liquidity available in the PanopticPool", cause);
7706
- }
7707
- };
7708
- /**
7709
- * The amount deposited is larger than the maximum permitted.
7710
- * @see Errors.sol:25
7711
- */
7712
- var DepositTooLargeError = class extends PanopticError {
7713
- name = "DepositTooLargeError";
7714
- constructor(cause) {
7715
- super("Deposit amount exceeds maximum permitted", cause);
7716
- }
7717
- };
7718
- /**
7719
- * Attempted to withdraw/redeem less than a single asset.
7720
- * @see Errors.sol:16
7721
- */
7722
- var BelowMinimumRedemptionError = class extends PanopticError {
7723
- name = "BelowMinimumRedemptionError";
7724
- constructor(cause) {
7725
- super("Redemption amount below minimum threshold", cause);
7726
- }
7727
- };
7698
+ //#region src/panoptic/v2/abis/uniswapV3Pool.ts
7728
7699
  /**
7729
- * Attempted to withdraw/redeem more than available.
7730
- * @see Errors.sol:35
7700
+ * Minimal Uniswap V3 Pool ABI for fee growth reads.
7701
+ * Only includes functions needed by streamia history.
7731
7702
  */
7732
- var ExceedsMaximumRedemptionError = class extends PanopticError {
7733
- name = "ExceedsMaximumRedemptionError";
7734
- constructor(cause) {
7735
- super("Redemption exceeds maximum available (liquidity, shares, or open positions)", cause);
7736
- }
7737
- };
7738
- /**
7739
- * Mints/burns of a position returns no collateral requirement.
7740
- * @see Errors.sol:141
7741
- */
7742
- var ZeroCollateralRequirementError = class extends PanopticError {
7743
- name = "ZeroCollateralRequirementError";
7744
- constructor(cause) {
7745
- super("Position mint/burn returned zero collateral requirement", cause);
7703
+ const uniswapV3PoolAbi = [
7704
+ {
7705
+ inputs: [],
7706
+ name: "slot0",
7707
+ outputs: [
7708
+ {
7709
+ internalType: "uint160",
7710
+ name: "sqrtPriceX96",
7711
+ type: "uint160"
7712
+ },
7713
+ {
7714
+ internalType: "int24",
7715
+ name: "tick",
7716
+ type: "int24"
7717
+ },
7718
+ {
7719
+ internalType: "uint16",
7720
+ name: "observationIndex",
7721
+ type: "uint16"
7722
+ },
7723
+ {
7724
+ internalType: "uint16",
7725
+ name: "observationCardinality",
7726
+ type: "uint16"
7727
+ },
7728
+ {
7729
+ internalType: "uint16",
7730
+ name: "observationCardinalityNext",
7731
+ type: "uint16"
7732
+ },
7733
+ {
7734
+ internalType: "uint8",
7735
+ name: "feeProtocol",
7736
+ type: "uint8"
7737
+ },
7738
+ {
7739
+ internalType: "bool",
7740
+ name: "unlocked",
7741
+ type: "bool"
7742
+ }
7743
+ ],
7744
+ stateMutability: "view",
7745
+ type: "function"
7746
+ },
7747
+ {
7748
+ inputs: [],
7749
+ name: "feeGrowthGlobal0X128",
7750
+ outputs: [{
7751
+ internalType: "uint256",
7752
+ name: "",
7753
+ type: "uint256"
7754
+ }],
7755
+ stateMutability: "view",
7756
+ type: "function"
7757
+ },
7758
+ {
7759
+ inputs: [],
7760
+ name: "feeGrowthGlobal1X128",
7761
+ outputs: [{
7762
+ internalType: "uint256",
7763
+ name: "",
7764
+ type: "uint256"
7765
+ }],
7766
+ stateMutability: "view",
7767
+ type: "function"
7768
+ },
7769
+ {
7770
+ inputs: [{
7771
+ internalType: "int24",
7772
+ name: "",
7773
+ type: "int24"
7774
+ }],
7775
+ name: "ticks",
7776
+ outputs: [
7777
+ {
7778
+ internalType: "uint128",
7779
+ name: "liquidityGross",
7780
+ type: "uint128"
7781
+ },
7782
+ {
7783
+ internalType: "int128",
7784
+ name: "liquidityNet",
7785
+ type: "int128"
7786
+ },
7787
+ {
7788
+ internalType: "uint256",
7789
+ name: "feeGrowthOutside0X128",
7790
+ type: "uint256"
7791
+ },
7792
+ {
7793
+ internalType: "uint256",
7794
+ name: "feeGrowthOutside1X128",
7795
+ type: "uint256"
7796
+ },
7797
+ {
7798
+ internalType: "int56",
7799
+ name: "tickCumulativeOutside",
7800
+ type: "int56"
7801
+ },
7802
+ {
7803
+ internalType: "uint160",
7804
+ name: "secondsPerLiquidityOutsideX128",
7805
+ type: "uint160"
7806
+ },
7807
+ {
7808
+ internalType: "uint32",
7809
+ name: "secondsOutside",
7810
+ type: "uint32"
7811
+ },
7812
+ {
7813
+ internalType: "bool",
7814
+ name: "initialized",
7815
+ type: "bool"
7816
+ }
7817
+ ],
7818
+ stateMutability: "view",
7819
+ type: "function"
7820
+ },
7821
+ {
7822
+ inputs: [],
7823
+ name: "liquidity",
7824
+ outputs: [{
7825
+ internalType: "uint128",
7826
+ name: "",
7827
+ type: "uint128"
7828
+ }],
7829
+ stateMutability: "view",
7830
+ type: "function"
7831
+ },
7832
+ {
7833
+ inputs: [],
7834
+ name: "fee",
7835
+ outputs: [{
7836
+ internalType: "uint24",
7837
+ name: "",
7838
+ type: "uint24"
7839
+ }],
7840
+ stateMutability: "view",
7841
+ type: "function"
7842
+ },
7843
+ {
7844
+ inputs: [],
7845
+ name: "token0",
7846
+ outputs: [{
7847
+ internalType: "address",
7848
+ name: "",
7849
+ type: "address"
7850
+ }],
7851
+ stateMutability: "view",
7852
+ type: "function"
7853
+ },
7854
+ {
7855
+ inputs: [],
7856
+ name: "token1",
7857
+ outputs: [{
7858
+ internalType: "address",
7859
+ name: "",
7860
+ type: "address"
7861
+ }],
7862
+ stateMutability: "view",
7863
+ type: "function"
7864
+ },
7865
+ {
7866
+ inputs: [],
7867
+ name: "tickSpacing",
7868
+ outputs: [{
7869
+ internalType: "int24",
7870
+ name: "",
7871
+ type: "int24"
7872
+ }],
7873
+ stateMutability: "view",
7874
+ type: "function"
7746
7875
  }
7747
- };
7876
+ ];
7877
+
7878
+ //#endregion
7879
+ //#region src/panoptic/v2/clients/blockMeta.ts
7748
7880
  /**
7749
- * The TokenId provided is malformed or invalid.
7750
- * @see Errors.sol:54
7881
+ * Get block metadata for a given block.
7882
+ * Used to tag all read results with same-block consistency proof.
7883
+ *
7884
+ * @param params - The parameters
7885
+ * @returns Block metadata
7751
7886
  */
7752
- var InvalidTokenIdParameterError = class extends PanopticError {
7753
- name = "InvalidTokenIdParameterError";
7754
- /**
7755
- * Parameter type meanings:
7756
- * 0=poolId, 1=ratio, 2=tokenType, 3=riskPartner, 4=strike, 5=width, 6=duplicateChunk
7757
- */
7758
- constructor(parameterType, cause) {
7759
- const paramNames = [
7760
- "poolId",
7761
- "ratio",
7762
- "tokenType",
7763
- "riskPartner",
7764
- "strike",
7765
- "width",
7766
- "duplicateChunk"
7767
- ];
7768
- const paramName = paramNames[Number(parameterType)] ?? `unknown(${parameterType})`;
7769
- super(`Invalid TokenId parameter: ${paramName}`, cause);
7770
- this.parameterType = parameterType;
7771
- }
7772
- };
7887
+ async function getBlockMeta(params) {
7888
+ const { client, blockNumber } = params;
7889
+ const block = await client.getBlock({
7890
+ blockNumber,
7891
+ includeTransactions: false
7892
+ });
7893
+ return {
7894
+ blockNumber: block.number,
7895
+ blockHash: block.hash,
7896
+ blockTimestamp: block.timestamp
7897
+ };
7898
+ }
7899
+
7900
+ //#endregion
7901
+ //#region src/panoptic/v2/errors/base.ts
7773
7902
  /**
7774
- * Position is not owned by the user and has positionSize=0.
7775
- * @see Errors.sol:96
7903
+ * Base error class for the Panoptic v2 SDK.
7904
+ * @module v2/errors/base
7776
7905
  */
7777
- var PositionNotOwnedError = class extends PanopticError {
7778
- name = "PositionNotOwnedError";
7779
- constructor(cause) {
7780
- super("Position is not owned by the user", cause);
7781
- }
7782
- };
7783
7906
  /**
7784
- * The maximum token deltas for a position exceed limits.
7785
- * @see Errors.sol:99
7907
+ * Base error class for all Panoptic SDK errors.
7908
+ * All errors thrown by the SDK extend this class.
7909
+ *
7910
+ * @example
7911
+ * ```typescript
7912
+ * try {
7913
+ * await openPosition(config, params)
7914
+ * } catch (error) {
7915
+ * if (error instanceof PanopticError) {
7916
+ * console.log('Panoptic error:', error.name, error.message)
7917
+ * console.log('Original cause:', error.cause)
7918
+ * }
7919
+ * }
7920
+ * ```
7786
7921
  */
7787
- var PositionTooLargeError = class extends PanopticError {
7788
- name = "PositionTooLargeError";
7789
- constructor(cause) {
7790
- super("Position size exceeds maximum allowed token deltas", cause);
7791
- }
7922
+ var PanopticError = class extends Error {
7923
+ name = "PanopticError";
7924
+ /** The Solidity error name (e.g. 'PriceBoundFail', 'InputListFail'). Set by the parser. */
7925
+ errorName;
7926
+ /**
7927
+ * Creates a new PanopticError.
7928
+ *
7929
+ * @param message - Human-readable error message
7930
+ * @param cause - Optional underlying error that caused this error
7931
+ */
7932
+ constructor(message, cause) {
7933
+ super(message);
7934
+ this.cause = cause;
7935
+ if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
7936
+ Object.setPrototypeOf(this, new.target.prototype);
7937
+ }
7938
+ };
7939
+
7940
+ //#endregion
7941
+ //#region src/panoptic/v2/errors/contract.ts
7942
+ /**
7943
+ * The account is not solvent enough to perform the desired action.
7944
+ * @see Errors.sol:9
7945
+ */
7946
+ var AccountInsolventError = class extends PanopticError {
7947
+ name = "AccountInsolventError";
7948
+ constructor(solvent, numberOfTicks, cause) {
7949
+ super(`Account insolvent: solvent=${solvent}, numberOfTicks=${numberOfTicks}`, cause);
7950
+ this.solvent = solvent;
7951
+ this.numberOfTicks = numberOfTicks;
7952
+ }
7953
+ };
7954
+ /**
7955
+ * Position is still solvent and cannot be liquidated.
7956
+ * @see Errors.sol:84
7957
+ */
7958
+ var NotMarginCalledError = class extends PanopticError {
7959
+ name = "NotMarginCalledError";
7960
+ constructor(cause) {
7961
+ super("Position is still solvent and cannot be liquidated", cause);
7962
+ }
7963
+ };
7964
+ /**
7965
+ * The user does not own enough assets to open/close a position.
7966
+ * @see Errors.sol:78
7967
+ */
7968
+ var NotEnoughTokensError = class extends PanopticError {
7969
+ name = "NotEnoughTokensError";
7970
+ get deficit() {
7971
+ return this.assetsRequested > this.assetBalance ? this.assetsRequested - this.assetBalance : 0n;
7972
+ }
7973
+ constructor(tokenAddress, assetsRequested, assetBalance, cause) {
7974
+ super(`Not enough tokens: requested=${assetsRequested}, balance=${assetBalance}, token=${tokenAddress}`, cause);
7975
+ this.tokenAddress = tokenAddress;
7976
+ this.assetsRequested = assetsRequested;
7977
+ this.assetBalance = assetBalance;
7978
+ }
7979
+ };
7980
+ /**
7981
+ * There is not enough available liquidity in the chunk for a long leg.
7982
+ * @see Errors.sol:75
7983
+ */
7984
+ var NotEnoughLiquidityInChunkError = class extends PanopticError {
7985
+ name = "NotEnoughLiquidityInChunkError";
7986
+ constructor(cause) {
7987
+ super("Not enough liquidity in chunk for long leg creation or short leg closure", cause);
7988
+ }
7989
+ };
7990
+ /**
7991
+ * There is not enough available liquidity to fulfill a credit.
7992
+ * @see Errors.sol:47
7993
+ */
7994
+ var InsufficientCreditLiquidityError = class extends PanopticError {
7995
+ name = "InsufficientCreditLiquidityError";
7996
+ constructor(cause) {
7997
+ super("Insufficient credit liquidity available in the PanopticPool", cause);
7998
+ }
7999
+ };
8000
+ /**
8001
+ * The amount deposited is larger than the maximum permitted.
8002
+ * @see Errors.sol:25
8003
+ */
8004
+ var DepositTooLargeError = class extends PanopticError {
8005
+ name = "DepositTooLargeError";
8006
+ constructor(cause) {
8007
+ super("Deposit amount exceeds maximum permitted", cause);
8008
+ }
8009
+ };
8010
+ /**
8011
+ * Attempted to withdraw/redeem less than a single asset.
8012
+ * @see Errors.sol:16
8013
+ */
8014
+ var BelowMinimumRedemptionError = class extends PanopticError {
8015
+ name = "BelowMinimumRedemptionError";
8016
+ constructor(cause) {
8017
+ super("Redemption amount below minimum threshold", cause);
8018
+ }
8019
+ };
8020
+ /**
8021
+ * Attempted to withdraw/redeem more than available.
8022
+ * @see Errors.sol:35
8023
+ */
8024
+ var ExceedsMaximumRedemptionError = class extends PanopticError {
8025
+ name = "ExceedsMaximumRedemptionError";
8026
+ constructor(cause) {
8027
+ super("Redemption exceeds maximum available (liquidity, shares, or open positions)", cause);
8028
+ }
8029
+ };
8030
+ /**
8031
+ * Mints/burns of a position returns no collateral requirement.
8032
+ * @see Errors.sol:141
8033
+ */
8034
+ var ZeroCollateralRequirementError = class extends PanopticError {
8035
+ name = "ZeroCollateralRequirementError";
8036
+ constructor(cause) {
8037
+ super("Position mint/burn returned zero collateral requirement", cause);
8038
+ }
8039
+ };
8040
+ /**
8041
+ * The TokenId provided is malformed or invalid.
8042
+ * @see Errors.sol:54
8043
+ */
8044
+ var InvalidTokenIdParameterError = class extends PanopticError {
8045
+ name = "InvalidTokenIdParameterError";
8046
+ /**
8047
+ * Parameter type meanings:
8048
+ * 0=poolId, 1=ratio, 2=tokenType, 3=riskPartner, 4=strike, 5=width, 6=duplicateChunk
8049
+ */
8050
+ constructor(parameterType, cause) {
8051
+ const paramNames = [
8052
+ "poolId",
8053
+ "ratio",
8054
+ "tokenType",
8055
+ "riskPartner",
8056
+ "strike",
8057
+ "width",
8058
+ "duplicateChunk"
8059
+ ];
8060
+ const paramName = paramNames[Number(parameterType)] ?? `unknown(${parameterType})`;
8061
+ super(`Invalid TokenId parameter: ${paramName}`, cause);
8062
+ this.parameterType = parameterType;
8063
+ }
8064
+ };
8065
+ /**
8066
+ * Position is not owned by the user and has positionSize=0.
8067
+ * @see Errors.sol:96
8068
+ */
8069
+ var PositionNotOwnedError = class extends PanopticError {
8070
+ name = "PositionNotOwnedError";
8071
+ constructor(cause) {
8072
+ super("Position is not owned by the user", cause);
8073
+ }
8074
+ };
8075
+ /**
8076
+ * The maximum token deltas for a position exceed limits.
8077
+ * @see Errors.sol:99
8078
+ */
8079
+ var PositionTooLargeError = class extends PanopticError {
8080
+ name = "PositionTooLargeError";
8081
+ constructor(cause) {
8082
+ super("Position size exceeds maximum allowed token deltas", cause);
8083
+ }
7792
8084
  };
7793
8085
  /**
7794
8086
  * User has open positions, so they cannot transfer collateral shares.
@@ -9276,315 +9568,23 @@ async function submitWriteRequest(params) {
9276
9568
  abi,
9277
9569
  functionName,
9278
9570
  args,
9279
- account: resolvedAccount,
9280
- ...value !== void 0 && { value }
9281
- });
9282
- gasOverrides.gas = estimated * 120n / 100n;
9283
- }
9284
- const hash = await walletClient.writeContract({
9285
- address,
9286
- abi,
9287
- functionName,
9288
- args,
9289
- account: resolvedAccount,
9290
- chain: walletClient.chain,
9291
- ...value !== void 0 && { value },
9292
- ...gasOverrides
9293
- });
9294
- return createTxResult(client, hash);
9295
- }
9296
-
9297
- //#endregion
9298
- //#region src/panoptic/v2/abis/stateView.ts
9299
- /**
9300
- * Minimal Uniswap V4 StateView ABI for fee growth reads.
9301
- * Only includes functions needed by streamia history.
9302
- */
9303
- const stateViewAbi = [
9304
- {
9305
- inputs: [{
9306
- internalType: "PoolId",
9307
- name: "poolId",
9308
- type: "bytes32"
9309
- }],
9310
- name: "getSlot0",
9311
- outputs: [
9312
- {
9313
- internalType: "uint160",
9314
- name: "sqrtPriceX96",
9315
- type: "uint160"
9316
- },
9317
- {
9318
- internalType: "int24",
9319
- name: "tick",
9320
- type: "int24"
9321
- },
9322
- {
9323
- internalType: "uint24",
9324
- name: "protocolFee",
9325
- type: "uint24"
9326
- },
9327
- {
9328
- internalType: "uint24",
9329
- name: "lpFee",
9330
- type: "uint24"
9331
- }
9332
- ],
9333
- stateMutability: "view",
9334
- type: "function"
9335
- },
9336
- {
9337
- inputs: [{
9338
- internalType: "PoolId",
9339
- name: "poolId",
9340
- type: "bytes32"
9341
- }],
9342
- name: "getFeeGrowthGlobals",
9343
- outputs: [{
9344
- internalType: "uint256",
9345
- name: "feeGrowthGlobal0",
9346
- type: "uint256"
9347
- }, {
9348
- internalType: "uint256",
9349
- name: "feeGrowthGlobal1",
9350
- type: "uint256"
9351
- }],
9352
- stateMutability: "view",
9353
- type: "function"
9354
- },
9355
- {
9356
- inputs: [{
9357
- internalType: "PoolId",
9358
- name: "poolId",
9359
- type: "bytes32"
9360
- }, {
9361
- internalType: "int24",
9362
- name: "tick",
9363
- type: "int24"
9364
- }],
9365
- name: "getTickInfo",
9366
- outputs: [
9367
- {
9368
- internalType: "uint128",
9369
- name: "liquidityGross",
9370
- type: "uint128"
9371
- },
9372
- {
9373
- internalType: "int128",
9374
- name: "liquidityNet",
9375
- type: "int128"
9376
- },
9377
- {
9378
- internalType: "uint256",
9379
- name: "feeGrowthOutside0X128",
9380
- type: "uint256"
9381
- },
9382
- {
9383
- internalType: "uint256",
9384
- name: "feeGrowthOutside1X128",
9385
- type: "uint256"
9386
- }
9387
- ],
9388
- stateMutability: "view",
9389
- type: "function"
9390
- },
9391
- {
9392
- inputs: [{
9393
- internalType: "PoolId",
9394
- name: "poolId",
9395
- type: "bytes32"
9396
- }],
9397
- name: "getLiquidity",
9398
- outputs: [{
9399
- internalType: "uint128",
9400
- name: "liquidity",
9401
- type: "uint128"
9402
- }],
9403
- stateMutability: "view",
9404
- type: "function"
9405
- }
9406
- ];
9407
-
9408
- //#endregion
9409
- //#region src/panoptic/v2/abis/uniswapV3Pool.ts
9410
- /**
9411
- * Minimal Uniswap V3 Pool ABI for fee growth reads.
9412
- * Only includes functions needed by streamia history.
9413
- */
9414
- const uniswapV3PoolAbi = [
9415
- {
9416
- inputs: [],
9417
- name: "slot0",
9418
- outputs: [
9419
- {
9420
- internalType: "uint160",
9421
- name: "sqrtPriceX96",
9422
- type: "uint160"
9423
- },
9424
- {
9425
- internalType: "int24",
9426
- name: "tick",
9427
- type: "int24"
9428
- },
9429
- {
9430
- internalType: "uint16",
9431
- name: "observationIndex",
9432
- type: "uint16"
9433
- },
9434
- {
9435
- internalType: "uint16",
9436
- name: "observationCardinality",
9437
- type: "uint16"
9438
- },
9439
- {
9440
- internalType: "uint16",
9441
- name: "observationCardinalityNext",
9442
- type: "uint16"
9443
- },
9444
- {
9445
- internalType: "uint8",
9446
- name: "feeProtocol",
9447
- type: "uint8"
9448
- },
9449
- {
9450
- internalType: "bool",
9451
- name: "unlocked",
9452
- type: "bool"
9453
- }
9454
- ],
9455
- stateMutability: "view",
9456
- type: "function"
9457
- },
9458
- {
9459
- inputs: [],
9460
- name: "feeGrowthGlobal0X128",
9461
- outputs: [{
9462
- internalType: "uint256",
9463
- name: "",
9464
- type: "uint256"
9465
- }],
9466
- stateMutability: "view",
9467
- type: "function"
9468
- },
9469
- {
9470
- inputs: [],
9471
- name: "feeGrowthGlobal1X128",
9472
- outputs: [{
9473
- internalType: "uint256",
9474
- name: "",
9475
- type: "uint256"
9476
- }],
9477
- stateMutability: "view",
9478
- type: "function"
9479
- },
9480
- {
9481
- inputs: [{
9482
- internalType: "int24",
9483
- name: "",
9484
- type: "int24"
9485
- }],
9486
- name: "ticks",
9487
- outputs: [
9488
- {
9489
- internalType: "uint128",
9490
- name: "liquidityGross",
9491
- type: "uint128"
9492
- },
9493
- {
9494
- internalType: "int128",
9495
- name: "liquidityNet",
9496
- type: "int128"
9497
- },
9498
- {
9499
- internalType: "uint256",
9500
- name: "feeGrowthOutside0X128",
9501
- type: "uint256"
9502
- },
9503
- {
9504
- internalType: "uint256",
9505
- name: "feeGrowthOutside1X128",
9506
- type: "uint256"
9507
- },
9508
- {
9509
- internalType: "int56",
9510
- name: "tickCumulativeOutside",
9511
- type: "int56"
9512
- },
9513
- {
9514
- internalType: "uint160",
9515
- name: "secondsPerLiquidityOutsideX128",
9516
- type: "uint160"
9517
- },
9518
- {
9519
- internalType: "uint32",
9520
- name: "secondsOutside",
9521
- type: "uint32"
9522
- },
9523
- {
9524
- internalType: "bool",
9525
- name: "initialized",
9526
- type: "bool"
9527
- }
9528
- ],
9529
- stateMutability: "view",
9530
- type: "function"
9531
- },
9532
- {
9533
- inputs: [],
9534
- name: "liquidity",
9535
- outputs: [{
9536
- internalType: "uint128",
9537
- name: "",
9538
- type: "uint128"
9539
- }],
9540
- stateMutability: "view",
9541
- type: "function"
9542
- },
9543
- {
9544
- inputs: [],
9545
- name: "fee",
9546
- outputs: [{
9547
- internalType: "uint24",
9548
- name: "",
9549
- type: "uint24"
9550
- }],
9551
- stateMutability: "view",
9552
- type: "function"
9553
- },
9554
- {
9555
- inputs: [],
9556
- name: "token0",
9557
- outputs: [{
9558
- internalType: "address",
9559
- name: "",
9560
- type: "address"
9561
- }],
9562
- stateMutability: "view",
9563
- type: "function"
9564
- },
9565
- {
9566
- inputs: [],
9567
- name: "token1",
9568
- outputs: [{
9569
- internalType: "address",
9570
- name: "",
9571
- type: "address"
9572
- }],
9573
- stateMutability: "view",
9574
- type: "function"
9575
- },
9576
- {
9577
- inputs: [],
9578
- name: "tickSpacing",
9579
- outputs: [{
9580
- internalType: "int24",
9581
- name: "",
9582
- type: "int24"
9583
- }],
9584
- stateMutability: "view",
9585
- type: "function"
9571
+ account: resolvedAccount,
9572
+ ...value !== void 0 && { value }
9573
+ });
9574
+ gasOverrides.gas = estimated * 120n / 100n;
9586
9575
  }
9587
- ];
9576
+ const hash = await walletClient.writeContract({
9577
+ address,
9578
+ abi,
9579
+ functionName,
9580
+ args,
9581
+ account: resolvedAccount,
9582
+ chain: walletClient.chain,
9583
+ ...value !== void 0 && { value },
9584
+ ...gasOverrides
9585
+ });
9586
+ return createTxResult(client, hash);
9587
+ }
9588
9588
 
9589
9589
  //#endregion
9590
9590
  //#region src/panoptic/v2/utils/oraclePack.ts
@@ -10682,7 +10682,7 @@ const decodeWidth = (leg) => (leg >> WIDTH_STARTING_BIT) % (1n << WIDTH_SIZE);
10682
10682
  * Extract tickSpacing from a TokenId
10683
10683
  * TickSpacing is stored in bits 48-63 (16 bits) of the poolId
10684
10684
  */
10685
- const decodeTickSpacing = (tokenId) => {
10685
+ const decodeTickSpacing$1 = (tokenId) => {
10686
10686
  return tokenId % (1n << POOL_ID_SIZE) >> TICK_SPACING_STARTING_BIT;
10687
10687
  };
10688
10688
  const decodePosition = (encodedPosition) => {
@@ -10772,7 +10772,7 @@ async function getPosition(params) {
10772
10772
  const balanceRaw = fullData[2][0];
10773
10773
  const { positionSize, poolUtilization0: utilization0AtMint, poolUtilization1: utilization1AtMint, tickAtMint, timestampAtMint, blockAtMint, swapAtMint } = decodePositionBalance(balanceRaw);
10774
10774
  const decoded = decodePosition(tokenId);
10775
- const tickSpacing = decodeTickSpacing(tokenId);
10775
+ const tickSpacing = decodeTickSpacing$1(tokenId);
10776
10776
  const legs = decoded.legs.map((leg) => {
10777
10777
  const width = leg.width;
10778
10778
  const strike = leg.strike;
@@ -10842,7 +10842,7 @@ async function getPositions(params) {
10842
10842
  const { positionSize, poolUtilization0: utilization0AtMint, poolUtilization1: utilization1AtMint, tickAtMint, timestampAtMint, blockAtMint, swapAtMint } = decodePositionBalance(balanceRaw);
10843
10843
  if (positionSize === 0n) continue;
10844
10844
  const decoded = decodePosition(tokenId);
10845
- const tickSpacing = decodeTickSpacing(tokenId);
10845
+ const tickSpacing = decodeTickSpacing$1(tokenId);
10846
10846
  const legs = decoded.legs.map((leg) => {
10847
10847
  const width = leg.width;
10848
10848
  const strike = leg.strike;
@@ -10981,7 +10981,7 @@ async function getPositionGreeks(params) {
10981
10981
  ]);
10982
10982
  const { tickAtMint, positionSize } = decodePositionBalance(fullData[2][0]);
10983
10983
  const decoded = decodePosition(tokenId);
10984
- const tickSpacing = decodeTickSpacing(tokenId);
10984
+ const tickSpacing = decodeTickSpacing$1(tokenId);
10985
10985
  const legs = decoded.legs.map((leg) => {
10986
10986
  const width = leg.width;
10987
10987
  const strike = leg.strike;
@@ -11014,6 +11014,630 @@ async function getPositionGreeks(params) {
11014
11014
  };
11015
11015
  }
11016
11016
 
11017
+ //#endregion
11018
+ //#region src/panoptic/v2/tokenId/encoding.ts
11019
+ /**
11020
+ * Convert a signed strike tick to unsigned representation for encoding.
11021
+ *
11022
+ * @param strike - The signed strike tick
11023
+ * @returns The unsigned representation
11024
+ */
11025
+ function convertStrikeToUnsigned(strike) {
11026
+ if (strike < 0n) return STRIKE_CONVERSION_FACTOR + strike;
11027
+ return strike;
11028
+ }
11029
+ /**
11030
+ * Convert an unsigned encoded strike back to signed representation.
11031
+ *
11032
+ * @param encodedStrike - The unsigned encoded strike
11033
+ * @returns The signed strike tick
11034
+ */
11035
+ function convertStrikeToSigned(encodedStrike) {
11036
+ if (encodedStrike > 2n ** 23n - 1n) return encodedStrike - STRIKE_CONVERSION_FACTOR;
11037
+ return encodedStrike;
11038
+ }
11039
+ /**
11040
+ * Get the bit offset for a leg at the given index.
11041
+ *
11042
+ * @param legIndex - The leg index (0-3)
11043
+ * @returns The bit offset from the start of the legs section
11044
+ */
11045
+ function getLegOffset(legIndex) {
11046
+ return legIndex * TOKEN_ID_BITS.LEG_SIZE;
11047
+ }
11048
+ /**
11049
+ * Encode a pool ID from a Uniswap V3 pool address.
11050
+ *
11051
+ * The encoded PoolId structure: [16-bit tickSpacing][8-bit vegoid][40-bit pool address]
11052
+ *
11053
+ * @param address - The Uniswap V3 pool address
11054
+ * @param tickSpacing - The tick spacing of the pool
11055
+ * @param vegoid - The vegoid value (defaults to 4)
11056
+ * @returns The encoded pool ID
11057
+ */
11058
+ function encodePoolId(address, tickSpacing, vegoid$1 = DEFAULT_VEGOID) {
11059
+ const addressHex = address.slice(2, 12).toLowerCase();
11060
+ const bytes = [];
11061
+ for (let i = 0; i < 10; i += 2) bytes.push(parseInt(addressHex.slice(i, i + 2), 16));
11062
+ bytes.reverse();
11063
+ let poolId = 0n;
11064
+ for (let i = 0; i < bytes.length; i++) poolId |= BigInt(bytes[i]) << BigInt(i * 8);
11065
+ poolId |= (vegoid$1 & 0xffn) << TOKEN_ID_BITS.VEGOID_STARTING_BIT;
11066
+ poolId |= (tickSpacing & 0xffffn) << TOKEN_ID_BITS.TICK_SPACING_STARTING_BIT;
11067
+ return poolId;
11068
+ }
11069
+ /**
11070
+ * Encode a pool ID from a Uniswap V4 pool ID (bytes32).
11071
+ *
11072
+ * @param poolIdHex - The V4 pool ID (bytes32 hex string)
11073
+ * @param tickSpacing - The tick spacing of the pool
11074
+ * @param vegoid - The vegoid value (defaults to 4)
11075
+ * @returns The encoded pool ID
11076
+ */
11077
+ function encodeV4PoolId(poolIdHex, tickSpacing, vegoid$1 = DEFAULT_VEGOID) {
11078
+ const hex = poolIdHex.slice(2);
11079
+ const last5BytesHex = hex.slice(-10).toLowerCase();
11080
+ const bytes = [];
11081
+ for (let i = 0; i < 10; i += 2) bytes.push(parseInt(last5BytesHex.slice(i, i + 2), 16));
11082
+ bytes.reverse();
11083
+ let encodedPoolId = 0n;
11084
+ for (let i = 0; i < bytes.length; i++) encodedPoolId |= BigInt(bytes[i]) << BigInt(i * 8);
11085
+ encodedPoolId |= (vegoid$1 & 0xffn) << TOKEN_ID_BITS.VEGOID_STARTING_BIT;
11086
+ encodedPoolId |= (tickSpacing & 0xffffn) << TOKEN_ID_BITS.TICK_SPACING_STARTING_BIT;
11087
+ return encodedPoolId;
11088
+ }
11089
+ /**
11090
+ * Decode the vegoid from a TokenId.
11091
+ *
11092
+ * @param tokenId - The TokenId to decode
11093
+ * @returns The vegoid value
11094
+ */
11095
+ function decodeVegoid(tokenId) {
11096
+ const poolId = tokenId & (1n << TOKEN_ID_BITS.POOL_ID_SIZE) - 1n;
11097
+ return poolId >> TOKEN_ID_BITS.VEGOID_STARTING_BIT & (1n << TOKEN_ID_BITS.VEGOID_SIZE) - 1n;
11098
+ }
11099
+ /**
11100
+ * Decode the tick spacing from a TokenId.
11101
+ *
11102
+ * @param tokenId - The TokenId to decode
11103
+ * @returns The tick spacing
11104
+ */
11105
+ function decodeTickSpacing(tokenId) {
11106
+ const poolId = tokenId & (1n << TOKEN_ID_BITS.POOL_ID_SIZE) - 1n;
11107
+ return poolId >> TOKEN_ID_BITS.TICK_SPACING_STARTING_BIT;
11108
+ }
11109
+ /**
11110
+ * Decode the pool ID portion from a TokenId.
11111
+ *
11112
+ * @param tokenId - The TokenId to decode
11113
+ * @returns The pool ID as a hex string
11114
+ */
11115
+ function decodePoolId(tokenId) {
11116
+ const poolId = tokenId & (1n << TOKEN_ID_BITS.POOL_ID_SIZE) - 1n;
11117
+ let hex = poolId.toString(16);
11118
+ while (hex.length < 16) hex = "0" + hex;
11119
+ return `0x${hex}`;
11120
+ }
11121
+ /**
11122
+ * Encode a single leg field.
11123
+ *
11124
+ * @param value - The value to encode
11125
+ * @param bitPosition - The bit position within the leg
11126
+ * @param legIndex - The leg index
11127
+ * @returns The encoded value shifted to the correct position
11128
+ */
11129
+ function encodeLegField(value, bitPosition, legIndex) {
11130
+ return value << getLegOffset(legIndex) + bitPosition + TOKEN_ID_BITS.POOL_ID_SIZE;
11131
+ }
11132
+ /**
11133
+ * Encode a single leg into a TokenId.
11134
+ *
11135
+ * @param leg - The leg parameters
11136
+ * @returns The encoded leg value (to be ORed with existing TokenId)
11137
+ */
11138
+ function encodeLeg(leg) {
11139
+ const { index, asset, optionRatio, isLong, tokenType, riskPartner, strike, width } = leg;
11140
+ return encodeLegField(asset & LEG_MASKS.ASSET, LEG_BITS.ASSET_BIT, index) | encodeLegField(optionRatio & LEG_MASKS.RATIO, LEG_BITS.RATIO_BIT, index) | encodeLegField(isLong & LEG_MASKS.IS_LONG, LEG_BITS.IS_LONG_BIT, index) | encodeLegField(tokenType & LEG_MASKS.TOKEN_TYPE, LEG_BITS.TOKEN_TYPE_BIT, index) | encodeLegField(riskPartner & LEG_MASKS.RISK_PARTNER, LEG_BITS.RISK_PARTNER_BIT, index) | encodeLegField(convertStrikeToUnsigned(strike) & LEG_MASKS.STRIKE, LEG_BITS.STRIKE_BIT, index) | encodeLegField(width & LEG_MASKS.WIDTH, LEG_BITS.WIDTH_BIT, index);
11141
+ }
11142
+ /**
11143
+ * Add a leg to an existing TokenId.
11144
+ *
11145
+ * @param tokenId - The existing TokenId (can be just poolId or partial TokenId)
11146
+ * @param leg - The leg parameters to add
11147
+ * @returns The TokenId with the leg added
11148
+ */
11149
+ function addLegToTokenId(tokenId, leg) {
11150
+ return tokenId | encodeLeg(leg);
11151
+ }
11152
+ /**
11153
+ * Decode a single leg from a TokenId.
11154
+ *
11155
+ * @param tokenId - The TokenId to decode
11156
+ * @param legIndex - The leg index (0-3)
11157
+ * @returns The decoded leg data
11158
+ */
11159
+ function decodeLeg(tokenId, legIndex) {
11160
+ const offset = getLegOffset(legIndex) + TOKEN_ID_BITS.POOL_ID_SIZE;
11161
+ const leg = tokenId >> offset & LEG_MASKS.LEG;
11162
+ const asset = leg & LEG_MASKS.ASSET;
11163
+ const optionRatio = leg >> LEG_BITS.RATIO_BIT & LEG_MASKS.RATIO;
11164
+ const isLong = (leg >> LEG_BITS.IS_LONG_BIT & LEG_MASKS.IS_LONG) === 1n;
11165
+ const tokenType = leg >> LEG_BITS.TOKEN_TYPE_BIT & LEG_MASKS.TOKEN_TYPE;
11166
+ const riskPartner = leg >> LEG_BITS.RISK_PARTNER_BIT & LEG_MASKS.RISK_PARTNER;
11167
+ const encodedStrike = leg >> LEG_BITS.STRIKE_BIT & LEG_MASKS.STRIKE;
11168
+ const strike = convertStrikeToSigned(encodedStrike);
11169
+ const width = leg >> LEG_BITS.WIDTH_BIT & LEG_MASKS.WIDTH;
11170
+ return {
11171
+ index: legIndex,
11172
+ asset,
11173
+ optionRatio,
11174
+ isLong,
11175
+ tokenType,
11176
+ riskPartner,
11177
+ strike,
11178
+ width
11179
+ };
11180
+ }
11181
+ /**
11182
+ * Count the number of active legs in a TokenId.
11183
+ * A leg is active if its optionRatio > 0.
11184
+ *
11185
+ * @param tokenId - The TokenId to check
11186
+ * @returns The number of active legs
11187
+ */
11188
+ function countLegs(tokenId) {
11189
+ let count = 0n;
11190
+ for (let i = 0n; i < TOKEN_ID_BITS.MAX_LEGS; i++) {
11191
+ const leg = decodeLeg(tokenId, i);
11192
+ if (leg.optionRatio > 0n) count++;
11193
+ }
11194
+ return count;
11195
+ }
11196
+ /**
11197
+ * Decode all active legs from a TokenId.
11198
+ *
11199
+ * @param tokenId - The TokenId to decode
11200
+ * @returns Array of decoded legs (only active legs with optionRatio > 0)
11201
+ */
11202
+ function decodeAllLegs(tokenId) {
11203
+ const legs = [];
11204
+ for (let i = 0n; i < TOKEN_ID_BITS.MAX_LEGS; i++) {
11205
+ const leg = decodeLeg(tokenId, i);
11206
+ if (leg.optionRatio > 0n) legs.push(leg);
11207
+ }
11208
+ return legs;
11209
+ }
11210
+
11211
+ //#endregion
11212
+ //#region src/panoptic/v2/tokenId/decode.ts
11213
+ /**
11214
+ * Convert a DecodedLeg to TokenIdLeg format.
11215
+ *
11216
+ * @param leg - The decoded leg from encoding utils
11217
+ * @param tickSpacing - The tick spacing for calculating tick bounds
11218
+ * @returns The TokenIdLeg format
11219
+ */
11220
+ function convertToTokenIdLeg(leg, tickSpacing) {
11221
+ const halfWidth = leg.width * tickSpacing / 2n;
11222
+ const tickLower = leg.strike - halfWidth;
11223
+ const tickUpper = leg.strike + halfWidth;
11224
+ return {
11225
+ index: leg.index,
11226
+ asset: leg.asset,
11227
+ optionRatio: leg.optionRatio,
11228
+ isLong: leg.isLong,
11229
+ tokenType: leg.tokenType,
11230
+ riskPartner: leg.riskPartner,
11231
+ strike: leg.strike,
11232
+ width: leg.width,
11233
+ tickLower,
11234
+ tickUpper
11235
+ };
11236
+ }
11237
+ /**
11238
+ * Decode a TokenId into its component parts.
11239
+ *
11240
+ * @param tokenId - The TokenId to decode
11241
+ * @returns The decoded TokenId data
11242
+ *
11243
+ * @example
11244
+ * ```typescript
11245
+ * const decoded = decodeTokenId(tokenId)
11246
+ * console.log(decoded.legs) // Array of legs
11247
+ * console.log(decoded.tickSpacing) // Tick spacing
11248
+ * ```
11249
+ */
11250
+ function decodeTokenId(tokenId) {
11251
+ const poolId = decodePoolId(tokenId);
11252
+ const vegoid$1 = decodeVegoid(tokenId);
11253
+ const tickSpacing = decodeTickSpacing(tokenId);
11254
+ const rawLegs = decodeAllLegs(tokenId);
11255
+ const numLegs = countLegs(tokenId);
11256
+ const legs = rawLegs.map((leg) => convertToTokenIdLeg(leg, tickSpacing));
11257
+ return {
11258
+ tokenId,
11259
+ poolId,
11260
+ vegoid: vegoid$1,
11261
+ tickSpacing,
11262
+ legs,
11263
+ legCount: numLegs
11264
+ };
11265
+ }
11266
+ /**
11267
+ * Validate that a TokenId has the expected pool ID.
11268
+ *
11269
+ * @param tokenId - The TokenId to validate
11270
+ * @param expectedPoolId - The expected pool ID
11271
+ * @returns True if the pool IDs match
11272
+ */
11273
+ function validatePoolId(tokenId, expectedPoolId) {
11274
+ const actualPoolId = tokenId & (1n << 64n) - 1n;
11275
+ return actualPoolId === expectedPoolId;
11276
+ }
11277
+ /**
11278
+ * Check if a TokenId represents a long position (any leg is long).
11279
+ *
11280
+ * @param tokenId - The TokenId to check
11281
+ * @returns True if any leg is long
11282
+ */
11283
+ function hasLongLeg(tokenId) {
11284
+ const legs = decodeAllLegs(tokenId);
11285
+ return legs.some((leg) => leg.isLong);
11286
+ }
11287
+ /**
11288
+ * Check if a TokenId represents a short-only position.
11289
+ *
11290
+ * @param tokenId - The TokenId to check
11291
+ * @returns True if all legs are short
11292
+ */
11293
+ function isShortOnly(tokenId) {
11294
+ const legs = decodeAllLegs(tokenId);
11295
+ return legs.length > 0 && legs.every((leg) => !leg.isLong);
11296
+ }
11297
+ /**
11298
+ * Check if a TokenId represents a spread (legs with different risk partners).
11299
+ *
11300
+ * @param tokenId - The TokenId to check
11301
+ * @returns True if any leg has a different risk partner
11302
+ */
11303
+ function isSpread(tokenId) {
11304
+ const legs = decodeAllLegs(tokenId);
11305
+ return legs.some((leg) => leg.riskPartner !== leg.index);
11306
+ }
11307
+ /**
11308
+ * Get the asset index for a TokenId (from the first leg).
11309
+ *
11310
+ * @param tokenId - The TokenId
11311
+ * @returns The asset index (0 or 1), or undefined if no legs
11312
+ */
11313
+ function getAssetIndex(tokenId) {
11314
+ const legs = decodeAllLegs(tokenId);
11315
+ if (legs.length === 0) return void 0;
11316
+ return legs[0].asset;
11317
+ }
11318
+ /**
11319
+ * Check if a leg is a loan (width=0 and isLong=false).
11320
+ *
11321
+ * Loans borrow liquidity from the pool at a specific strike price.
11322
+ *
11323
+ * @param leg - The decoded leg to check
11324
+ * @returns True if the leg is a loan
11325
+ */
11326
+ function isLoanLeg(leg) {
11327
+ return leg.width === 0n && !leg.isLong;
11328
+ }
11329
+ /**
11330
+ * Check if a leg is a credit (width=0 and isLong=true).
11331
+ *
11332
+ * Credits lend liquidity to the pool at a specific strike price.
11333
+ *
11334
+ * @param leg - The decoded leg to check
11335
+ * @returns True if the leg is a credit
11336
+ */
11337
+ function isCreditLeg(leg) {
11338
+ return leg.width === 0n && leg.isLong;
11339
+ }
11340
+ /**
11341
+ * Check if a TokenId is a pure loan (all legs are loans).
11342
+ *
11343
+ * @param tokenId - The TokenId to check
11344
+ * @returns True if all legs are loans
11345
+ */
11346
+ function isLoan(tokenId) {
11347
+ const legs = decodeAllLegs(tokenId);
11348
+ return legs.length > 0 && legs.every(isLoanLeg);
11349
+ }
11350
+ /**
11351
+ * Index of the borrowed token when a TokenId is a single-leg loan.
11352
+ *
11353
+ * Returns undefined for credits, multi-leg loans, and positions mixing loans
11354
+ * with options: closing those can move both tokens for reasons other than
11355
+ * repaying one borrowed principal.
11356
+ *
11357
+ * @param tokenId - The TokenId to classify
11358
+ * @returns The borrowed token index (the leg's tokenType), or undefined
11359
+ */
11360
+ function getSimpleLoanTokenIndex(tokenId) {
11361
+ const legs = decodeAllLegs(tokenId);
11362
+ if (legs.length !== 1 || !isLoanLeg(legs[0])) return void 0;
11363
+ return legs[0].tokenType === 0n ? 0n : 1n;
11364
+ }
11365
+ /**
11366
+ * Check if a TokenId is a pure credit (all legs are credits).
11367
+ *
11368
+ * @param tokenId - The TokenId to check
11369
+ * @returns True if all legs are credits
11370
+ */
11371
+ function isCredit(tokenId) {
11372
+ const legs = decodeAllLegs(tokenId);
11373
+ return legs.length > 0 && legs.every(isCreditLeg);
11374
+ }
11375
+ /**
11376
+ * Check if a TokenId contains loan or credit legs (width=0).
11377
+ *
11378
+ * @param tokenId - The TokenId to check
11379
+ * @returns True if any leg has width=0 (loan or credit)
11380
+ */
11381
+ function hasLoanOrCredit(tokenId) {
11382
+ const legs = decodeAllLegs(tokenId);
11383
+ return legs.some((leg) => leg.width === 0n);
11384
+ }
11385
+
11386
+ //#endregion
11387
+ //#region src/panoptic/v2/reads/premia.ts
11388
+ /**
11389
+ * Get streamia totals for an account.
11390
+ *
11391
+ * Returns the total short and long streamia across all positions.
11392
+ * Short streamia is owed TO the account (earned from selling options).
11393
+ * Long streamia is owed BY the account (paid for buying options).
11394
+ *
11395
+ * @param params - The parameters
11396
+ * @returns Streamia totals with block metadata
11397
+ *
11398
+ * @example
11399
+ * ```typescript
11400
+ * const streamia = await getAccountPremia({
11401
+ * client,
11402
+ * poolAddress,
11403
+ * account,
11404
+ * tokenIds: [tokenId1, tokenId2],
11405
+ * includePendingPremium: true,
11406
+ * })
11407
+ *
11408
+ * console.log('Short streamia earned:', streamia.shortPremium0, streamia.shortPremium1)
11409
+ * console.log('Long streamia owed:', streamia.longPremium0, streamia.longPremium1)
11410
+ * ```
11411
+ */
11412
+ async function getAccountPremia(params) {
11413
+ const { client, poolAddress, account, tokenIds, includePendingPremium = true, blockNumber } = params;
11414
+ const targetBlockNumber = blockNumber ?? params._meta?.blockNumber ?? await client.getBlockNumber();
11415
+ if (tokenIds.length === 0) {
11416
+ const _meta$1 = params._meta ?? await getBlockMeta({
11417
+ client,
11418
+ blockNumber: targetBlockNumber
11419
+ });
11420
+ return {
11421
+ shortPremium0: 0n,
11422
+ shortPremium1: 0n,
11423
+ longPremium0: 0n,
11424
+ longPremium1: 0n,
11425
+ includePendingPremium,
11426
+ _meta: _meta$1
11427
+ };
11428
+ }
11429
+ const [[shortPremiumPacked, longPremiumPacked], _meta] = await Promise.all([client.readContract({
11430
+ address: poolAddress,
11431
+ abi: panopticPoolV2Abi,
11432
+ functionName: "getFullPositionsData",
11433
+ args: [
11434
+ account,
11435
+ includePendingPremium,
11436
+ tokenIds
11437
+ ],
11438
+ blockNumber: targetBlockNumber
11439
+ }), params._meta ?? getBlockMeta({
11440
+ client,
11441
+ blockNumber: targetBlockNumber
11442
+ })]);
11443
+ const shortPremium = decodeLeftRightUnsigned(shortPremiumPacked);
11444
+ const longPremium = decodeLeftRightUnsigned(longPremiumPacked);
11445
+ return {
11446
+ shortPremium0: shortPremium.right,
11447
+ shortPremium1: shortPremium.left,
11448
+ longPremium0: longPremium.right,
11449
+ longPremium1: longPremium.left,
11450
+ includePendingPremium,
11451
+ _meta
11452
+ };
11453
+ }
11454
+ /**
11455
+ * Get positions with per-position streamia data.
11456
+ *
11457
+ * Uses multicall to batch individual getFullPositionsData calls
11458
+ * for each position, giving us per-position streamia in a single RPC request.
11459
+ *
11460
+ * @param params - The parameters
11461
+ * @returns Positions with streamia and totals with block metadata
11462
+ *
11463
+ * @example
11464
+ * ```typescript
11465
+ * const result = await getPositionsWithPremia({
11466
+ * client,
11467
+ * poolAddress,
11468
+ * account,
11469
+ * tokenIds: [tokenId1, tokenId2],
11470
+ * })
11471
+ *
11472
+ * for (const position of result.positions) {
11473
+ * console.log('Position:', position.tokenId)
11474
+ * console.log('Streamia:', position.premiaOwed0, position.premiaOwed1)
11475
+ * }
11476
+ * console.log('Total short streamia:', result.shortPremium0, result.shortPremium1)
11477
+ * ```
11478
+ */
11479
+ async function getPositionsWithPremia(params) {
11480
+ const { client, poolAddress, account, tokenIds, includePendingPremium = true, blockNumber } = params;
11481
+ const targetBlockNumber = blockNumber ?? params._meta?.blockNumber ?? await client.getBlockNumber();
11482
+ if (tokenIds.length === 0) {
11483
+ const _meta$1 = params._meta ?? await getBlockMeta({
11484
+ client,
11485
+ blockNumber: targetBlockNumber
11486
+ });
11487
+ return {
11488
+ positions: [],
11489
+ shortPremium0: 0n,
11490
+ shortPremium1: 0n,
11491
+ longPremium0: 0n,
11492
+ longPremium1: 0n,
11493
+ includePendingPremium,
11494
+ _meta: _meta$1
11495
+ };
11496
+ }
11497
+ const contracts = tokenIds.map((tokenId) => ({
11498
+ address: poolAddress,
11499
+ abi: panopticPoolV2Abi,
11500
+ functionName: "getFullPositionsData",
11501
+ args: [
11502
+ account,
11503
+ includePendingPremium,
11504
+ [tokenId]
11505
+ ]
11506
+ }));
11507
+ const [multicallResults, _meta] = await Promise.all([client.multicall({
11508
+ contracts,
11509
+ blockNumber: targetBlockNumber,
11510
+ allowFailure: true
11511
+ }), params._meta ?? getBlockMeta({
11512
+ client,
11513
+ blockNumber: targetBlockNumber
11514
+ })]);
11515
+ const positions = [];
11516
+ let totalShortPremium0 = 0n;
11517
+ let totalShortPremium1 = 0n;
11518
+ let totalLongPremium0 = 0n;
11519
+ let totalLongPremium1 = 0n;
11520
+ for (let i = 0; i < tokenIds.length; i++) {
11521
+ const tokenId = tokenIds[i];
11522
+ const result = multicallResults[i];
11523
+ if (result.status !== "success") continue;
11524
+ const [shortPremiumPacked, longPremiumPacked, balances] = result.result;
11525
+ const shortPremium = decodeLeftRightUnsigned(shortPremiumPacked);
11526
+ const longPremium = decodeLeftRightUnsigned(longPremiumPacked);
11527
+ totalShortPremium0 += shortPremium.right;
11528
+ totalShortPremium1 += shortPremium.left;
11529
+ totalLongPremium0 += longPremium.right;
11530
+ totalLongPremium1 += longPremium.left;
11531
+ const balanceData = balances[0];
11532
+ if (balanceData === void 0) continue;
11533
+ const positionSize = balanceData & (1n << 128n) - 1n;
11534
+ if (positionSize === 0n) continue;
11535
+ const poolUtilization0 = balanceData >> 128n & 0xffffn;
11536
+ const poolUtilization1 = balanceData >> 144n & 0xffffn;
11537
+ let tickAtMint = balanceData >> 160n & 0xffffffn;
11538
+ if (tickAtMint > 0x7fffffn) tickAtMint = tickAtMint - 0x1000000n;
11539
+ const timestampAtMint = balanceData >> 184n & 0xffffffffn;
11540
+ const blockAtMint = balanceData >> 216n & (1n << 39n) - 1n;
11541
+ const swapAtMint = balanceData >> 255n === 1n;
11542
+ const decoded = decodePosition(tokenId);
11543
+ const tickSpacing = decodeTickSpacing$1(tokenId);
11544
+ const legs = decoded.legs.map((leg) => {
11545
+ const width = leg.width;
11546
+ const strike = leg.strike;
11547
+ const tickLower = strike - width * tickSpacing / 2n;
11548
+ const tickUpper = strike + width * tickSpacing / 2n;
11549
+ return {
11550
+ index: BigInt(leg.index),
11551
+ asset: leg.asset,
11552
+ optionRatio: leg.optionRatio,
11553
+ isLong: leg.isLong === 1n,
11554
+ tokenType: leg.tokenType,
11555
+ riskPartner: leg.riskPartner,
11556
+ strike,
11557
+ width,
11558
+ tickLower,
11559
+ tickUpper
11560
+ };
11561
+ });
11562
+ const premiaOwed0 = shortPremium.right - longPremium.right;
11563
+ const premiaOwed1 = shortPremium.left - longPremium.left;
11564
+ positions.push({
11565
+ tokenId,
11566
+ positionSize,
11567
+ owner: account,
11568
+ poolAddress,
11569
+ legs,
11570
+ poolUtilization0AtMint: poolUtilization0,
11571
+ poolUtilization1AtMint: poolUtilization1,
11572
+ tickAtMint,
11573
+ timestampAtMint,
11574
+ blockNumberAtMint: blockAtMint,
11575
+ swapAtMint,
11576
+ premiaOwed0,
11577
+ premiaOwed1,
11578
+ assetIndex: legs.length > 0 ? legs[0].asset : 0n,
11579
+ _meta
11580
+ });
11581
+ }
11582
+ return {
11583
+ positions,
11584
+ shortPremium0: totalShortPremium0,
11585
+ shortPremium1: totalShortPremium1,
11586
+ longPremium0: totalLongPremium0,
11587
+ longPremium1: totalLongPremium1,
11588
+ includePendingPremium,
11589
+ _meta
11590
+ };
11591
+ }
11592
+ /**
11593
+ * Get the unsettled short streamia an account would forfeit by closing now.
11594
+ *
11595
+ * Calls `getFullPositionsData` twice in one multicall — once with
11596
+ * `includePendingPremium = true` (everything owed to the short legs) and once
11597
+ * with `false` (only what is available to collect). The difference is the
11598
+ * streamia still owed by buyers that has not been settled; closing before it
11599
+ * settles forfeits it. Settling buyers first (see `settlePremiumFrom`) moves
11600
+ * that streamia into the available bucket.
11601
+ *
11602
+ * @param params - The parameters
11603
+ * @returns Owed, available, and forfeitable streamia with block metadata
11604
+ */
11605
+ async function getForfeitablePremium(params) {
11606
+ const { client, poolAddress, account, tokenIds, blockNumber } = params;
11607
+ const targetBlockNumber = blockNumber ?? await client.getBlockNumber();
11608
+ const contracts = [true, false].map((includePendingPremium) => ({
11609
+ address: poolAddress,
11610
+ abi: panopticPoolV2Abi,
11611
+ functionName: "getFullPositionsData",
11612
+ args: [
11613
+ account,
11614
+ includePendingPremium,
11615
+ tokenIds
11616
+ ]
11617
+ }));
11618
+ const [multicallResults, _meta] = await Promise.all([client.multicall({
11619
+ contracts,
11620
+ blockNumber: targetBlockNumber,
11621
+ allowFailure: false
11622
+ }), getBlockMeta({
11623
+ client,
11624
+ blockNumber: targetBlockNumber
11625
+ })]);
11626
+ const owed = decodeLeftRightUnsigned(multicallResults[0][0]);
11627
+ const available = decodeLeftRightUnsigned(multicallResults[1][0]);
11628
+ const forfeit0 = owed.right > available.right ? owed.right - available.right : 0n;
11629
+ const forfeit1 = owed.left > available.left ? owed.left - available.left : 0n;
11630
+ return {
11631
+ owed0: owed.right,
11632
+ owed1: owed.left,
11633
+ available0: available.right,
11634
+ available1: available.left,
11635
+ forfeit0,
11636
+ forfeit1,
11637
+ _meta
11638
+ };
11639
+ }
11640
+
11017
11641
  //#endregion
11018
11642
  //#region src/panoptic/v2/storage/fileStorage.ts
11019
11643
  /**
@@ -12070,4 +12694,4 @@ function formatPerSecondRateWadAsAprPct(ratePerSecondWad, precision) {
12070
12694
  }
12071
12695
 
12072
12696
  //#endregion
12073
- export { AccountInsolventError, AlreadyInitializedError, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTickLimitsError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MaxRetriesExceededError, MissingPositionIdsError, MulticallNoDataError, MulticallResultFailedError, MulticallResultMissingError, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NoLoanPositionsError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, ReentrancyError, RpcError, RpcResponseError, STANDARD_TICK_WIDTHS, STRIKE_CONVERSION_FACTOR, SafeModeError, StaleDataError, StaleOracleError, StorageDataNotFoundError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, WrongPoolIdError, WrongUniswapPoolError, ZeroAddressError, ZeroCollateralRequirementError, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, availableToBorrow, clearTrackedPositions, collateralTrackerV2Abi, createFileStorage, createMemoryStorage, createTxResult, decodeAllDispatchCalldata, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePosition, decodePositionBalance$1 as decodePositionBalance, decodeSnapshotTransaction, decodeTickSpacing, diagnoseOracleSafeMode, fetchPoolId, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatRateWad, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatWad, formatWadPercent, formatWadSigned, getBlockMeta, getClosedPositionsKey, getOpenPositionIds, getOracleRiskParameters, getOracleState, getPendingPositionsKey, getPool, getPoolCurrentTick, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPosition, getPositionGreeks, getPositionMetaKey, getPositions, getPositionsKey, getRiskParameters, getSchemaVersionKey, getSyncCheckpointKey, getTrackedChunksKey, getTrackedPositionIds, getUtilization, isPanopticErrorType, isPositionTracked, jsonSerializer, mintableAfterBuffer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi, parsePanopticError, parseTokenAmount, parseWad, recoverSnapshot, recoverSnapshotFromTx, riskEngineAbi, riskEngineMulticall, selectDispatchForAccount, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, submitWrite, uniswapV3PoolAbi, validateBuilderCode };
12697
+ export { AccountInsolventError, AlreadyInitializedError, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTickLimitsError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MaxRetriesExceededError, MissingPositionIdsError, MulticallNoDataError, MulticallResultFailedError, MulticallResultMissingError, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NoLoanPositionsError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, ReentrancyError, RpcError, RpcResponseError, STANDARD_TICK_WIDTHS, SafeModeError, StaleDataError, StaleOracleError, StorageDataNotFoundError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, WrongPoolIdError, WrongUniswapPoolError, ZeroAddressError, ZeroCollateralRequirementError, addLegToTokenId, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, availableToBorrow, clearTrackedPositions, collateralTrackerV2Abi, countLegs, createFileStorage, createMemoryStorage, createTxResult, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeLeg, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePoolId, decodePositionBalance$1 as decodePositionBalance, decodeSnapshotTransaction, decodeTickSpacing, decodeTokenId, decodeVegoid, diagnoseOracleSafeMode, encodeLeg, encodePoolId, encodeV4PoolId, fetchPoolId, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatRateWad, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatWad, formatWadPercent, formatWadSigned, getAccountPremia, getAssetIndex, getBlockMeta, getClosedPositionsKey, getForfeitablePremium, getOpenPositionIds, getOracleRiskParameters, getOracleState, getPendingPositionsKey, getPool, getPoolCurrentTick, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPosition, getPositionGreeks, getPositionMetaKey, getPositions, getPositionsKey, getPositionsWithPremia, getRiskParameters, getSchemaVersionKey, getSimpleLoanTokenIndex, getSyncCheckpointKey, getTrackedChunksKey, getTrackedPositionIds, getUtilization, hasLoanOrCredit, hasLongLeg, isCredit, isCreditLeg, isLoan, isLoanLeg, isPanopticErrorType, isPositionTracked, isShortOnly, isSpread, jsonSerializer, mintableAfterBuffer, oracleEpochAt, panopticErrorsAbi, panopticFactoryV3Abi, panopticFactoryV4Abi, panopticGuardianAbi, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi as panopticQueryAbi$1, parsePanopticError, parseTokenAmount, parseWad, recoverSnapshot, recoverSnapshotFromTx, riskEngineAbi, riskEngineMulticall, selectDispatchForAccount, semiFungiblePositionManagerV3Abi, semiFungiblePositionManagerV4Abi, stateViewAbi, submitWrite, uniswapV3PoolAbi, validateBuilderCode, validatePoolId };