flash-sdk 9.0.0-alpha.5 → 9.0.0-alpha.7

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.
@@ -2,7 +2,7 @@ import { Program, AnchorProvider, BN } from "@coral-xyz/anchor";
2
2
  import { PublicKey, TransactionInstruction, Commitment, Signer, AddressLookupTableAccount, VersionedTransaction } from "@solana/web3.js";
3
3
  import { PoolAccount } from "./PoolAccount";
4
4
  import { PositionAccount } from "./PositionAccount";
5
- import { AddLiquidityAmountAndFee, InternalPrice, BorrowRateParams, ExitPriceAndFee, Fees, OracleParams, Permissions, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, TokenRatios, MinAndMaxPrice, FeesAction, ContractOraclePrice, Privilege, PerpetualsAccount, Trading, EntryPriceAndFeeV2, EntryPriceAndFee, TokenPermissions, TokenStake, InternalEmaPrice } from "./types";
5
+ import { AddLiquidityAmountAndFee, InternalPrice, BorrowRateParams, ExitPriceAndFee, Fees, OracleParams, Permissions, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, TokenRatios, MinAndMaxPrice, FeesAction, ContractOraclePrice, Privilege, PerpetualsAccount, EntryPriceAndFeeV2, TokenPermissions, TokenStake, InternalEmaPrice } from "./types";
6
6
  import { OraclePrice } from "./OraclePrice";
7
7
  import { CustodyAccount } from "./CustodyAccount";
8
8
  import { Perpetuals } from "./idl/perpetuals";
@@ -202,7 +202,7 @@ export declare class PerpetualsClient {
202
202
  reservedAmount: BN;
203
203
  minReserveUsd: BN;
204
204
  limitPriceBufferBps: BN;
205
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
205
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
206
206
  owner: PublicKey;
207
207
  stakeStats: {
208
208
  pendingActivation: BN;
@@ -259,6 +259,7 @@ export declare class PerpetualsClient {
259
259
  conf: BN;
260
260
  ema: BN;
261
261
  publishTime: BN;
262
+ extOracleAccount: PublicKey;
262
263
  market: PublicKey;
263
264
  limitOrders: unknown;
264
265
  takeProfitOrders: unknown;
@@ -547,7 +548,7 @@ export declare class PerpetualsClient {
547
548
  reservedAmount: BN;
548
549
  minReserveUsd: BN;
549
550
  limitPriceBufferBps: BN;
550
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
551
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
551
552
  owner: PublicKey;
552
553
  stakeStats: {
553
554
  pendingActivation: BN;
@@ -604,6 +605,7 @@ export declare class PerpetualsClient {
604
605
  conf: BN;
605
606
  ema: BN;
606
607
  publishTime: BN;
608
+ extOracleAccount: PublicKey;
607
609
  market: PublicKey;
608
610
  limitOrders: unknown;
609
611
  takeProfitOrders: unknown;
@@ -891,7 +893,7 @@ export declare class PerpetualsClient {
891
893
  reservedAmount: BN;
892
894
  minReserveUsd: BN;
893
895
  limitPriceBufferBps: BN;
894
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
896
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
895
897
  owner: PublicKey;
896
898
  stakeStats: {
897
899
  pendingActivation: BN;
@@ -948,6 +950,7 @@ export declare class PerpetualsClient {
948
950
  conf: BN;
949
951
  ema: BN;
950
952
  publishTime: BN;
953
+ extOracleAccount: PublicKey;
951
954
  market: PublicKey;
952
955
  limitOrders: unknown;
953
956
  takeProfitOrders: unknown;
@@ -1239,7 +1242,7 @@ export declare class PerpetualsClient {
1239
1242
  reservedAmount: BN;
1240
1243
  minReserveUsd: BN;
1241
1244
  limitPriceBufferBps: BN;
1242
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
1245
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
1243
1246
  owner: PublicKey;
1244
1247
  stakeStats: {
1245
1248
  pendingActivation: BN;
@@ -1296,6 +1299,7 @@ export declare class PerpetualsClient {
1296
1299
  conf: BN;
1297
1300
  ema: BN;
1298
1301
  publishTime: BN;
1302
+ extOracleAccount: PublicKey;
1299
1303
  market: PublicKey;
1300
1304
  limitOrders: unknown;
1301
1305
  takeProfitOrders: unknown;
@@ -1586,7 +1590,7 @@ export declare class PerpetualsClient {
1586
1590
  reservedAmount: BN;
1587
1591
  minReserveUsd: BN;
1588
1592
  limitPriceBufferBps: BN;
1589
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
1593
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
1590
1594
  owner: PublicKey;
1591
1595
  stakeStats: {
1592
1596
  pendingActivation: BN;
@@ -1643,6 +1647,7 @@ export declare class PerpetualsClient {
1643
1647
  conf: BN;
1644
1648
  ema: BN;
1645
1649
  publishTime: BN;
1650
+ extOracleAccount: PublicKey;
1646
1651
  market: PublicKey;
1647
1652
  limitOrders: unknown;
1648
1653
  takeProfitOrders: unknown;
@@ -1931,7 +1936,7 @@ export declare class PerpetualsClient {
1931
1936
  reservedAmount: BN;
1932
1937
  minReserveUsd: BN;
1933
1938
  limitPriceBufferBps: BN;
1934
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
1939
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
1935
1940
  owner: PublicKey;
1936
1941
  stakeStats: {
1937
1942
  pendingActivation: BN;
@@ -1988,6 +1993,7 @@ export declare class PerpetualsClient {
1988
1993
  conf: BN;
1989
1994
  ema: BN;
1990
1995
  publishTime: BN;
1996
+ extOracleAccount: PublicKey;
1991
1997
  market: PublicKey;
1992
1998
  limitOrders: unknown;
1993
1999
  takeProfitOrders: unknown;
@@ -2275,7 +2281,7 @@ export declare class PerpetualsClient {
2275
2281
  reservedAmount: BN;
2276
2282
  minReserveUsd: BN;
2277
2283
  limitPriceBufferBps: BN;
2278
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
2284
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
2279
2285
  owner: PublicKey;
2280
2286
  stakeStats: {
2281
2287
  pendingActivation: BN;
@@ -2332,6 +2338,7 @@ export declare class PerpetualsClient {
2332
2338
  conf: BN;
2333
2339
  ema: BN;
2334
2340
  publishTime: BN;
2341
+ extOracleAccount: PublicKey;
2335
2342
  market: PublicKey;
2336
2343
  limitOrders: unknown;
2337
2344
  takeProfitOrders: unknown;
@@ -2619,7 +2626,7 @@ export declare class PerpetualsClient {
2619
2626
  reservedAmount: BN;
2620
2627
  minReserveUsd: BN;
2621
2628
  limitPriceBufferBps: BN;
2622
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
2629
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
2623
2630
  owner: PublicKey;
2624
2631
  stakeStats: {
2625
2632
  pendingActivation: BN;
@@ -2676,6 +2683,7 @@ export declare class PerpetualsClient {
2676
2683
  conf: BN;
2677
2684
  ema: BN;
2678
2685
  publishTime: BN;
2686
+ extOracleAccount: PublicKey;
2679
2687
  market: PublicKey;
2680
2688
  limitOrders: unknown;
2681
2689
  takeProfitOrders: unknown;
@@ -3010,7 +3018,7 @@ export declare class PerpetualsClient {
3010
3018
  reservedAmount: BN;
3011
3019
  minReserveUsd: BN;
3012
3020
  limitPriceBufferBps: BN;
3013
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
3021
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
3014
3022
  owner: PublicKey;
3015
3023
  stakeStats: {
3016
3024
  pendingActivation: BN;
@@ -3067,6 +3075,7 @@ export declare class PerpetualsClient {
3067
3075
  conf: BN;
3068
3076
  ema: BN;
3069
3077
  publishTime: BN;
3078
+ extOracleAccount: PublicKey;
3070
3079
  market: PublicKey;
3071
3080
  limitOrders: unknown;
3072
3081
  takeProfitOrders: unknown;
@@ -3354,7 +3363,7 @@ export declare class PerpetualsClient {
3354
3363
  reservedAmount: BN;
3355
3364
  minReserveUsd: BN;
3356
3365
  limitPriceBufferBps: BN;
3357
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
3366
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
3358
3367
  owner: PublicKey;
3359
3368
  stakeStats: {
3360
3369
  pendingActivation: BN;
@@ -3411,6 +3420,7 @@ export declare class PerpetualsClient {
3411
3420
  conf: BN;
3412
3421
  ema: BN;
3413
3422
  publishTime: BN;
3423
+ extOracleAccount: PublicKey;
3414
3424
  market: PublicKey;
3415
3425
  limitOrders: unknown;
3416
3426
  takeProfitOrders: unknown;
@@ -3698,7 +3708,7 @@ export declare class PerpetualsClient {
3698
3708
  reservedAmount: BN;
3699
3709
  minReserveUsd: BN;
3700
3710
  limitPriceBufferBps: BN;
3701
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
3711
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
3702
3712
  owner: PublicKey;
3703
3713
  stakeStats: {
3704
3714
  pendingActivation: BN;
@@ -3755,6 +3765,7 @@ export declare class PerpetualsClient {
3755
3765
  conf: BN;
3756
3766
  ema: BN;
3757
3767
  publishTime: BN;
3768
+ extOracleAccount: PublicKey;
3758
3769
  market: PublicKey;
3759
3770
  limitOrders: unknown;
3760
3771
  takeProfitOrders: unknown;
@@ -4042,7 +4053,7 @@ export declare class PerpetualsClient {
4042
4053
  reservedAmount: BN;
4043
4054
  minReserveUsd: BN;
4044
4055
  limitPriceBufferBps: BN;
4045
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
4056
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
4046
4057
  owner: PublicKey;
4047
4058
  stakeStats: {
4048
4059
  pendingActivation: BN;
@@ -4099,6 +4110,7 @@ export declare class PerpetualsClient {
4099
4110
  conf: BN;
4100
4111
  ema: BN;
4101
4112
  publishTime: BN;
4113
+ extOracleAccount: PublicKey;
4102
4114
  market: PublicKey;
4103
4115
  limitOrders: unknown;
4104
4116
  takeProfitOrders: unknown;
@@ -4386,7 +4398,7 @@ export declare class PerpetualsClient {
4386
4398
  reservedAmount: BN;
4387
4399
  minReserveUsd: BN;
4388
4400
  limitPriceBufferBps: BN;
4389
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | number[] | BN[] | BN[];
4401
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | number[];
4390
4402
  owner: PublicKey;
4391
4403
  stakeStats: {
4392
4404
  pendingActivation: BN;
@@ -4443,6 +4455,7 @@ export declare class PerpetualsClient {
4443
4455
  conf: BN;
4444
4456
  ema: BN;
4445
4457
  publishTime: BN;
4458
+ extOracleAccount: PublicKey;
4446
4459
  market: PublicKey;
4447
4460
  limitOrders: unknown;
4448
4461
  takeProfitOrders: unknown;
@@ -4618,9 +4631,9 @@ export declare class PerpetualsClient {
4618
4631
  getMinAndMaxPriceSync: (price: OraclePrice, emaPrice: OraclePrice, custodyAccount: CustodyAccount) => MinAndMaxPrice;
4619
4632
  checkIfPriceStaleOrCustom: (price: OraclePrice, emaPrice: OraclePrice, custodyAccount: CustodyAccount, timestampInSeconds: BN) => boolean;
4620
4633
  getAveragePriceSync: (price1: BN, size1: BN, price2: BN, size2: BN) => BN;
4621
- getLeverageSync: (sizeUsd: BN, collateralAmount: BN, collateralMinOraclePrice: OraclePrice, collateralTokenDecimals: number, pnlUsd: BN) => BN;
4622
- getLeverageAtAmountEntryWithSwapSync: (positionAccount: PositionAccount | null, inputDeltaAmount: BN, sizeDeltaAmount: BN, side: Side, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, swapOutTokenPrice: OraclePrice, swapOutTokenEmaPrice: OraclePrice, swapOutTokenCustodyAccount: CustodyAccount, collateralTokenPrice: OraclePrice, collateralTokenEmaPrice: OraclePrice, collateralTokenCustodyAccount: CustodyAccount, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetTokenCustodyAccount: CustodyAccount, swapPoolAumUsdMax: BN, poolConfigPosition: PoolConfig, poolConfigSwap: PoolConfig, pnlUsd: BN) => BN;
4623
- getEntryPriceAndFeeSync: (positionAccount: PositionAccount | null, marketCorrelation: boolean, collateralDeltaAmount: BN, sizeDeltaAmount: BN, side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, discountBps?: BN) => EntryPriceAndFee;
4634
+ getLeverageContractHelper: (positionAccount: PositionAccount, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, isInitial: boolean, poolConfig: PoolConfig) => BN;
4635
+ getLeverageSync: (positionAccount: PositionAccount, finalCollateralAmount: BN, finalSizeUsd: BN, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, isInitial: boolean, poolConfig: PoolConfig) => BN;
4636
+ getLeverageAtAmountEntryWithSwapSync: (positionAccount: PositionAccount | null, inputDeltaAmount: BN, sizeDeltaAmount: BN, side: Side, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, swapOutTokenPrice: OraclePrice, swapOutTokenEmaPrice: OraclePrice, swapOutTokenCustodyAccount: CustodyAccount, collateralTokenPrice: OraclePrice, collateralTokenEmaPrice: OraclePrice, collateralTokenCustodyAccount: CustodyAccount, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetTokenCustodyAccount: CustodyAccount, swapPoolAumUsdMax: BN, poolConfig: PoolConfig, pnlUsd: BN) => BN;
4624
4637
  getEntryPriceAndFeeSyncV2: (positionAccount: PositionAccount | null, marketCorrelation: boolean, collateralDeltaAmount: BN, sizeDeltaAmount: BN, side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, discountBps?: BN, enableLogs?: boolean) => EntryPriceAndFeeV2;
4625
4638
  getEntryPriceUsdSync: (side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, sizeUsd: BN) => OraclePrice;
4626
4639
  getPriceAfterSlippage(isEntry: boolean, slippageBps: BN, targetPrice: OraclePrice, side: Side): ContractOraclePrice;
@@ -4631,20 +4644,19 @@ export declare class PerpetualsClient {
4631
4644
  getExitPriceAndFeeSync: (positionAccount: PositionAccount, marketCorrelation: boolean, collateralDeltaAmount: BN, sizeDeltaAmount: BN, side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, discountBps?: BN) => ExitPriceAndFee;
4632
4645
  getTradeSpread: (targetCustodyAccount: CustodyAccount, sizeUsd: BN) => BN;
4633
4646
  getExitOraclePriceSync: (side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, sizeUsd: BN) => OraclePrice;
4634
- getExitOraclePriceWithoutSpreadSync: (side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount) => OraclePrice;
4635
4647
  getSizeAmountFromLeverageAndCollateral: (collateralAmtWithFee: BN, leverage: string, marketToken: Token, collateralToken: Token, side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, discountBps?: BN) => BN;
4636
- getSizeAmountWithSwapSync: (amountIn: BN, leverage: string, side: Side, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, collateralTokenPrice: OraclePrice, collateralTokenEmaPrice: OraclePrice, collateralTokenCustodyAccount: CustodyAccount, swapOutTokenPrice: OraclePrice, swapOutTokenEmaPrice: OraclePrice, swapOutTokenCustodyAccount: CustodyAccount, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetTokenCustodyAccount: CustodyAccount, swapPoolAumUsdMax: BN, poolConfigSwap: PoolConfig, discountBps?: BN) => BN;
4648
+ getSizeAmountWithSwapSync: (amountIn: BN, leverage: string, side: Side, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, collateralTokenPrice: OraclePrice, collateralTokenEmaPrice: OraclePrice, collateralTokenCustodyAccount: CustodyAccount, swapOutTokenPrice: OraclePrice, swapOutTokenEmaPrice: OraclePrice, swapOutTokenCustodyAccount: CustodyAccount, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetTokenCustodyAccount: CustodyAccount, swapPoolAumUsdMax: BN, poolConfig: PoolConfig, discountBps?: BN) => BN;
4637
4649
  getCollateralAmountWithFeeFromLeverageAndSize: (sizeAmount: BN, leverage: string, marketToken: Token, collateralToken: Token, side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, discountBps?: BN) => BN;
4638
- getCollateralAmountWithSwapSync: (sizeAmount: BN, leverage: string, side: Side, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, swapOutTokenPrice: OraclePrice, swapOutTokenEmaPrice: OraclePrice, swapOutTokenCustodyAccount: CustodyAccount, collateralTokenPrice: OraclePrice, collateralTokenEmaPrice: OraclePrice, collateralTokenCustodyAccount: CustodyAccount, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetTokenCustodyAccount: CustodyAccount, swapPoolAumUsdMax: BN, poolConfigPosition: PoolConfig, poolConfigSwap: PoolConfig) => BN;
4650
+ getCollateralAmountWithSwapSync: (sizeAmount: BN, leverage: string, side: Side, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, swapOutTokenPrice: OraclePrice, swapOutTokenEmaPrice: OraclePrice, swapOutTokenCustodyAccount: CustodyAccount, collateralTokenPrice: OraclePrice, collateralTokenEmaPrice: OraclePrice, collateralTokenCustodyAccount: CustodyAccount, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetTokenCustodyAccount: CustodyAccount, swapPoolAumUsdMax: BN, poolConfig: PoolConfig) => BN;
4639
4651
  getDecreaseSizeCollateralAndFeeSync: (positionAccount: PositionAccount, marketCorrelation: boolean, sizeDeltaUsd: BN, keepLevSame: boolean, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, marketConfig: MarketConfig, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, side: Side, poolConfig: PoolConfig, discountBps?: BN, debugLogs?: boolean) => RemoveCollateralData;
4640
- getMaxWithdrawableAmountSyncInternal: (positionAccount: PositionAccount, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, poolConfig: PoolConfig, closeAmount?: BN, errorBandwidthPercentageUi?: number) => {
4652
+ getMaxWithdrawableAmountSyncInternal: (positionAccount: PositionAccount, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, poolConfig: PoolConfig, closeAmountUsd?: BN, errorBandwidthPercentageUi?: number) => {
4641
4653
  maxWithdrawableAmount: BN;
4642
4654
  maxWithdrawableAmountUsd: BN;
4643
4655
  diff: BN;
4644
4656
  };
4645
- getFinalCloseAmountSync: (positionAccount: PositionAccount, marketCorrelation: boolean, side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, poolConfig: PoolConfig) => {
4646
- closeAmount: BN;
4647
- feesAmount: BN;
4657
+ getFinalCloseAmountUsdSync: (positionAccount: PositionAccount, marketCorrelation: boolean, side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, poolConfig: PoolConfig) => {
4658
+ closeAmountUsd: BN;
4659
+ feesAmountUsd: BN;
4648
4660
  };
4649
4661
  getMaxWithdrawableAmountSync: (positionAccount: PositionAccount, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, poolConfig: PoolConfig, errorBandwidthPercentageUi?: number) => {
4650
4662
  maxWithdrawableAmount: BN;
@@ -4654,8 +4666,8 @@ export declare class PerpetualsClient {
4654
4666
  getBorrowRateSync: (custodyAccount: CustodyAccount, currentUtilization: BN) => BN;
4655
4667
  getLockFeeAndUnsettledUsdForPosition: (position: PositionAccount, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN) => BN;
4656
4668
  getLockedUsd: (sideUsd: BN, side: Side, marketCorrelation: boolean, maxPayOffBps: BN) => BN;
4657
- getLiquidationPriceSync: (collateralAmount: BN, sizeAmount: BN, entryOraclePrice: OraclePrice, lockAndUnsettledFeeUsd: BN, marketCorrelation: boolean, side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, positionAccount: PositionAccount) => OraclePrice;
4658
- getLiquidationPriceWithOrder: (collateralAmount: BN, collateralUsd: BN, sizeAmount: BN, sizeUsd: BN, sizeDecimals: number, limitOraclePrice: OraclePrice, marketCorrelation: boolean, side: Side, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount) => OraclePrice;
4669
+ getLiquidationPriceSync: (entryOraclePrice: OraclePrice, lockAndUnsettledFeeUsd: BN, side: Side, targetCustodyAccount: CustodyAccount, positionAccount: PositionAccount) => OraclePrice;
4670
+ getLiquidationPriceWithOrder: (collateralUsd: BN, sizeAmount: BN, sizeUsd: BN, sizeDecimals: number, limitOraclePrice: OraclePrice, side: Side, targetCustodyAccount: CustodyAccount) => OraclePrice;
4659
4671
  getMaxProfitPriceSync: (entryPrice: OraclePrice, marketCorrelation: boolean, side: Side, positionAccount: PositionAccount) => OraclePrice;
4660
4672
  getEstimateProfitLossforTpSlEntry: (positionAccount: PositionAccount | null, isTakeProfit: boolean, userEntrytpSlOraclePrice: OraclePrice, collateralDeltaAmount: BN, sizeDeltaAmount: BN, side: Side, marketAccountPk: PublicKey, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, poolConfig: PoolConfig) => {
4661
4673
  pnlUsd: BN;
@@ -4667,6 +4679,10 @@ export declare class PerpetualsClient {
4667
4679
  profitUsd: BN;
4668
4680
  lossUsd: BN;
4669
4681
  };
4682
+ getPnlContractHelper: (positionAccount: PositionAccount, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, delay: BN, poolConfig: PoolConfig) => {
4683
+ profitUsd: BN;
4684
+ lossUsd: BN;
4685
+ };
4670
4686
  getSwapAmountAndFeesSync: (amountIn: BN, amountOut: BN, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, outputTokenPrice: OraclePrice, outputTokenEmaPrice: OraclePrice, outputTokenCustodyAccount: CustodyAccount, poolAumUsdMax: BN, poolConfig: PoolConfig) => {
4671
4687
  minAmountOut: BN;
4672
4688
  minAmountIn: BN;
@@ -4677,8 +4693,9 @@ export declare class PerpetualsClient {
4677
4693
  poolAmountUsd: BN;
4678
4694
  poolEquityUsd: BN;
4679
4695
  };
4680
- getNftFinalDiscount: (perpetualsAccount: PerpetualsAccount, nftTradingAccount: Trading, currentTime: BN) => {
4681
- discountBn: BN;
4696
+ getAssetsUnderManagementUsdContractHelper: (poolAccount: PoolAccount, tokenPrices: OraclePrice[], tokenEmaPrices: OraclePrice[], custodies: CustodyAccount[], markets: MarketAccount[], aumCalcMode: "includePnl" | "excludePnl", currentTime: BN, poolConfig: PoolConfig) => {
4697
+ poolAmountUsd: BN;
4698
+ poolEquityUsd: BN;
4682
4699
  };
4683
4700
  getFeeDiscount: (perpetualsAccount: PerpetualsAccount, tokenStakeAccount: TokenStake, currentTime: BN) => {
4684
4701
  discountBn: BN;
@@ -4720,7 +4737,7 @@ export declare class PerpetualsClient {
4720
4737
  instructions: TransactionInstruction[];
4721
4738
  additionalSigners: Signer[];
4722
4739
  }>;
4723
- closeAndSwap: (targetTokenSymbol: string, userOutputTokenSymbol: string, collateralTokenSymbol: string, minSwapAmountOut: BN, priceWithSlippage: ContractOraclePrice, side: Side, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey, ephemeralSignerPubkey?: any) => Promise<{
4740
+ closeAndSwap: (targetTokenSymbol: string, userOutputTokenSymbol: string, collateralTokenSymbol: string, priceWithSlippage: ContractOraclePrice, side: Side, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey, ephemeralSignerPubkey?: any) => Promise<{
4724
4741
  instructions: TransactionInstruction[];
4725
4742
  additionalSigners: Signer[];
4726
4743
  }>;
@@ -4764,14 +4781,6 @@ export declare class PerpetualsClient {
4764
4781
  instructions: TransactionInstruction[];
4765
4782
  additionalSigners: Signer[];
4766
4783
  }>;
4767
- updateNftAccount: (nftMint: PublicKey, updateReferer: boolean, updateBooster: boolean, flpStakeAccounts: PublicKey[]) => Promise<{
4768
- instructions: TransactionInstruction[];
4769
- additionalSigners: Signer[];
4770
- }>;
4771
- levelUp: (poolConfig: PoolConfig, nftMint: PublicKey, authorizationRulesAccount: PublicKey) => Promise<{
4772
- instructions: TransactionInstruction[];
4773
- additionalSigners: Signer[];
4774
- }>;
4775
4784
  depositStake: (owner: PublicKey, feePayer: PublicKey, depositAmount: BN, poolConfig: PoolConfig) => Promise<{
4776
4785
  instructions: TransactionInstruction[];
4777
4786
  additionalSigners: Signer[];
@@ -4815,14 +4824,6 @@ export declare class PerpetualsClient {
4815
4824
  instructions: TransactionInstruction[];
4816
4825
  additionalSigners: Signer[];
4817
4826
  }>;
4818
- burnAndClaim: (owner: PublicKey, nftMint: PublicKey, poolConfig: PoolConfig, createAta: boolean) => Promise<{
4819
- instructions: TransactionInstruction[];
4820
- additionalSigners: Signer[];
4821
- }>;
4822
- burnAndStake: (owner: PublicKey, feePayer: PublicKey, nftMint: PublicKey, poolConfig: PoolConfig) => Promise<{
4823
- instructions: TransactionInstruction[];
4824
- additionalSigners: Signer[];
4825
- }>;
4826
4827
  depositTokenStake: (owner: PublicKey, feePayer: PublicKey, depositAmount: BN, poolConfig: PoolConfig) => Promise<{
4827
4828
  instructions: TransactionInstruction[];
4828
4829
  additionalSigners: Signer[];
@@ -4851,22 +4852,6 @@ export declare class PerpetualsClient {
4851
4852
  instructions: TransactionInstruction[];
4852
4853
  additionalSigners: Signer[];
4853
4854
  }>;
4854
- initRewardVault: (nftCount: BN, rewardSymbol: string, collectionMint: PublicKey, poolConfig: PoolConfig) => Promise<{
4855
- instructions: TransactionInstruction[];
4856
- additionalSigners: Signer[];
4857
- }>;
4858
- distributeReward: (rewardAmount: BN, rewardSymbol: string, poolConfig: PoolConfig) => Promise<{
4859
- instructions: TransactionInstruction[];
4860
- additionalSigners: Signer[];
4861
- }>;
4862
- collectNftReward: (rewardSymbol: string, poolConfig: PoolConfig, nftMint: PublicKey, createUserATA?: boolean) => Promise<{
4863
- instructions: TransactionInstruction[];
4864
- additionalSigners: Signer[];
4865
- }>;
4866
- collectAndDistributeFee: (rewardSymbol: string, poolConfig: PoolConfig, createUserATA?: boolean, nftTradingAccount?: PublicKey) => Promise<{
4867
- instructions: TransactionInstruction[];
4868
- additionalSigners: Signer[];
4869
- }>;
4870
4855
  placeLimitOrder: (targetSymbol: string, collateralSymbol: string, reserveSymbol: string, receiveSymbol: string, side: Side, limitPrice: ContractOraclePrice, reserveAmount: BN, sizeAmount: BN, stopLossPrice: ContractOraclePrice, takeProfitPrice: ContractOraclePrice, poolConfig: PoolConfig, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any) => Promise<{
4871
4856
  instructions: TransactionInstruction[];
4872
4857
  additionalSigners: Signer[];
@@ -4948,11 +4933,11 @@ export declare class PerpetualsClient {
4948
4933
  instructions: TransactionInstruction[];
4949
4934
  additionalSigners: Signer[];
4950
4935
  }>;
4951
- setInternalOraclePrice: (tokenMint: PublicKey, price: BN, expo: number, conf: BN, ema: BN, publishTime: BN, poolConfig: PoolConfig) => Promise<{
4936
+ setInternalOraclePrice: (tokenMint: PublicKey, useCurrentTime: number, price: BN, expo: number, conf: BN, ema: BN, publishTime: BN, poolConfig: PoolConfig) => Promise<{
4952
4937
  instructions: TransactionInstruction[];
4953
4938
  additionalSigners: Signer[];
4954
4939
  }>;
4955
- setInternalOraclePriceBatch: (tokenMintList: PublicKey[], tokenInternalPrices: InternalPrice[], POOL_CONFIGS: PoolConfig[]) => Promise<{
4940
+ setInternalOraclePriceBatch: (useCurrentTime: boolean, tokenMintList: PublicKey[], tokenInternalPrices: InternalPrice[], POOL_CONFIGS: PoolConfig[]) => Promise<{
4956
4941
  instructions: TransactionInstruction[];
4957
4942
  additionalSigners: Signer[];
4958
4943
  }>;
@@ -5000,4 +4985,8 @@ export declare class PerpetualsClient {
5000
4985
  instructions: TransactionInstruction[];
5001
4986
  additionalSigners: Signer[];
5002
4987
  }>;
4988
+ resizeInternalOracle: (extOracle: PublicKey, tokenMint: PublicKey, intOracleAccount: PublicKey) => Promise<{
4989
+ instructions: TransactionInstruction[];
4990
+ additionalSigners: Signer[];
4991
+ }>;
5003
4992
  }