flash-sdk 9.0.0-alpha.0 → 9.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PerpetualsClient.d.ts +67 -73
- package/dist/PerpetualsClient.js +503 -1062
- package/dist/PoolConfig.d.ts +2 -0
- package/dist/PoolConfig.json +244 -10
- package/dist/idl/perpetuals.d.ts +131 -609
- package/dist/idl/perpetuals.js +128 -606
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/testSize.d.ts +0 -0
- package/dist/testSize.js +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/utils/getReferralAccounts.d.ts +1 -1
- package/dist/utils/getReferralAccounts.js +3 -8
- package/package.json +1 -1
- package/dist/TradingAccount.d.ts +0 -23
- package/dist/TradingAccount.js +0 -17
@@ -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,
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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[] |
|
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
|
-
|
4622
|
-
|
4623
|
-
|
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, finalCollateralUsd: 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,27 +4644,31 @@ 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,
|
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,
|
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,
|
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;
|
4654
|
+
maxWithdrawableAmountUsd: BN;
|
4642
4655
|
diff: BN;
|
4643
4656
|
};
|
4644
|
-
|
4645
|
-
|
4646
|
-
|
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;
|
4660
|
+
};
|
4661
|
+
getMaxWithdrawableAmountSync: (positionAccount: PositionAccount, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, poolConfig: PoolConfig, errorBandwidthPercentageUi?: number) => {
|
4662
|
+
maxWithdrawableAmount: BN;
|
4663
|
+
maxWithdrawableAmountUsd: BN;
|
4647
4664
|
};
|
4648
|
-
getMaxWithdrawableAmountSync: (positionAccount: PositionAccount, targetPrice: OraclePrice, targetEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, poolConfig: PoolConfig, errorBandwidthPercentageUi?: number) => BN;
|
4649
4665
|
getCumulativeLockFeeSync: (custodyAccount: CustodyAccount, currentTimestamp: BN) => BN;
|
4650
4666
|
getBorrowRateSync: (custodyAccount: CustodyAccount, currentUtilization: BN) => BN;
|
4651
4667
|
getLockFeeAndUnsettledUsdForPosition: (position: PositionAccount, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN) => BN;
|
4652
4668
|
getLockedUsd: (sideUsd: BN, side: Side, marketCorrelation: boolean, maxPayOffBps: BN) => BN;
|
4653
|
-
|
4654
|
-
|
4669
|
+
getLiquidationPriceContractHelper: (entryOraclePrice: OraclePrice, lockAndUnsettledFeeUsd: BN, side: Side, targetCustodyAccount: CustodyAccount, positionAccount: PositionAccount) => OraclePrice;
|
4670
|
+
getLiquidationPriceSync: (collateralUsd: BN, sizeAmount: BN, entryOraclePrice: OraclePrice, lockAndUnsettledFeeUsd: BN, side: Side, targetPrice: OraclePrice, targetCustodyAccount: CustodyAccount, positionAccount: PositionAccount) => OraclePrice;
|
4671
|
+
getLiquidationPriceWithOrder: (collateralUsd: BN, sizeAmount: BN, sizeUsd: BN, sizeDecimals: number, limitOraclePrice: OraclePrice, side: Side, targetCustodyAccount: CustodyAccount) => OraclePrice;
|
4655
4672
|
getMaxProfitPriceSync: (entryPrice: OraclePrice, marketCorrelation: boolean, side: Side, positionAccount: PositionAccount) => OraclePrice;
|
4656
4673
|
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) => {
|
4657
4674
|
pnlUsd: BN;
|
@@ -4663,6 +4680,10 @@ export declare class PerpetualsClient {
|
|
4663
4680
|
profitUsd: BN;
|
4664
4681
|
lossUsd: BN;
|
4665
4682
|
};
|
4683
|
+
getPnlContractHelper: (positionAccount: PositionAccount, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, currentTimestamp: BN, delay: BN, poolConfig: PoolConfig) => {
|
4684
|
+
profitUsd: BN;
|
4685
|
+
lossUsd: BN;
|
4686
|
+
};
|
4666
4687
|
getSwapAmountAndFeesSync: (amountIn: BN, amountOut: BN, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, outputTokenPrice: OraclePrice, outputTokenEmaPrice: OraclePrice, outputTokenCustodyAccount: CustodyAccount, poolAumUsdMax: BN, poolConfig: PoolConfig) => {
|
4667
4688
|
minAmountOut: BN;
|
4668
4689
|
minAmountIn: BN;
|
@@ -4673,8 +4694,9 @@ export declare class PerpetualsClient {
|
|
4673
4694
|
poolAmountUsd: BN;
|
4674
4695
|
poolEquityUsd: BN;
|
4675
4696
|
};
|
4676
|
-
|
4677
|
-
|
4697
|
+
getAssetsUnderManagementUsdContractHelper: (poolAccount: PoolAccount, tokenPrices: OraclePrice[], tokenEmaPrices: OraclePrice[], custodies: CustodyAccount[], markets: MarketAccount[], aumCalcMode: "includePnl" | "excludePnl", currentTime: BN, poolConfig: PoolConfig) => {
|
4698
|
+
poolAmountUsd: BN;
|
4699
|
+
poolEquityUsd: BN;
|
4678
4700
|
};
|
4679
4701
|
getFeeDiscount: (perpetualsAccount: PerpetualsAccount, tokenStakeAccount: TokenStake, currentTime: BN) => {
|
4680
4702
|
discountBn: BN;
|
@@ -4704,19 +4726,19 @@ export declare class PerpetualsClient {
|
|
4704
4726
|
getLiquidationStateView: (positionAccount: PublicKey, poolName: string, tokenMint: PublicKey, collateralMint: PublicKey, poolConfig: PoolConfig) => Promise<any>;
|
4705
4727
|
getCompoundingTokenDataView: (poolConfig: PoolConfig) => Promise<any>;
|
4706
4728
|
getLpTokenPriceView: (poolConfig: PoolConfig) => Promise<any>;
|
4707
|
-
openPosition: (targetSymbol: string, collateralSymbol: string, priceWithSlippage: ContractOraclePrice, collateralWithfee: BN, size: BN, side: Side, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey,
|
4729
|
+
openPosition: (targetSymbol: string, collateralSymbol: string, priceWithSlippage: ContractOraclePrice, collateralWithfee: BN, size: BN, side: Side, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any) => Promise<{
|
4708
4730
|
instructions: TransactionInstruction[];
|
4709
4731
|
additionalSigners: Signer[];
|
4710
4732
|
}>;
|
4711
|
-
closePosition: (marketSymbol: string, collateralSymbol: string, priceWithSlippage: ContractOraclePrice, side: Side, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey,
|
4733
|
+
closePosition: (marketSymbol: string, collateralSymbol: string, priceWithSlippage: ContractOraclePrice, side: Side, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey, createUserATA?: boolean, closeUsersWSOLATA?: boolean, ephemeralSignerPubkey?: any) => Promise<{
|
4712
4734
|
instructions: TransactionInstruction[];
|
4713
4735
|
additionalSigners: Signer[];
|
4714
4736
|
}>;
|
4715
|
-
swapAndOpen: (targetTokenSymbol: string, collateralTokenSymbol: string, userInputTokenSymbol: string, amountIn: BN, priceWithSlippage: ContractOraclePrice, sizeAmount: BN, side: Side, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey,
|
4737
|
+
swapAndOpen: (targetTokenSymbol: string, collateralTokenSymbol: string, userInputTokenSymbol: string, amountIn: BN, priceWithSlippage: ContractOraclePrice, sizeAmount: BN, side: Side, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any) => Promise<{
|
4716
4738
|
instructions: TransactionInstruction[];
|
4717
4739
|
additionalSigners: Signer[];
|
4718
4740
|
}>;
|
4719
|
-
closeAndSwap: (targetTokenSymbol: string, userOutputTokenSymbol: string, collateralTokenSymbol: string,
|
4741
|
+
closeAndSwap: (targetTokenSymbol: string, userOutputTokenSymbol: string, collateralTokenSymbol: string, priceWithSlippage: ContractOraclePrice, side: Side, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey, ephemeralSignerPubkey?: any) => Promise<{
|
4720
4742
|
instructions: TransactionInstruction[];
|
4721
4743
|
additionalSigners: Signer[];
|
4722
4744
|
}>;
|
@@ -4736,11 +4758,11 @@ export declare class PerpetualsClient {
|
|
4736
4758
|
instructions: TransactionInstruction[];
|
4737
4759
|
additionalSigners: Signer[];
|
4738
4760
|
}>;
|
4739
|
-
increaseSize: (targetSymbol: string, collateralSymbol: string, positionPubKey: PublicKey, side: Side, poolConfig: PoolConfig, priceWithSlippage: ContractOraclePrice, sizeDelta: BN, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey
|
4761
|
+
increaseSize: (targetSymbol: string, collateralSymbol: string, positionPubKey: PublicKey, side: Side, poolConfig: PoolConfig, priceWithSlippage: ContractOraclePrice, sizeDelta: BN, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey) => Promise<{
|
4740
4762
|
instructions: TransactionInstruction[];
|
4741
4763
|
additionalSigners: Signer[];
|
4742
4764
|
}>;
|
4743
|
-
decreaseSize: (targetSymbol: string, collateralSymbol: string, side: Side, positionPubKey: PublicKey, poolConfig: PoolConfig, priceWithSlippage: ContractOraclePrice, sizeDelta: BN, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey
|
4765
|
+
decreaseSize: (targetSymbol: string, collateralSymbol: string, side: Side, positionPubKey: PublicKey, poolConfig: PoolConfig, priceWithSlippage: ContractOraclePrice, sizeDelta: BN, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey) => Promise<{
|
4744
4766
|
instructions: TransactionInstruction[];
|
4745
4767
|
additionalSigners: Signer[];
|
4746
4768
|
}>;
|
@@ -4760,14 +4782,6 @@ export declare class PerpetualsClient {
|
|
4760
4782
|
instructions: TransactionInstruction[];
|
4761
4783
|
additionalSigners: Signer[];
|
4762
4784
|
}>;
|
4763
|
-
updateNftAccount: (nftMint: PublicKey, updateReferer: boolean, updateBooster: boolean, flpStakeAccounts: PublicKey[]) => Promise<{
|
4764
|
-
instructions: TransactionInstruction[];
|
4765
|
-
additionalSigners: Signer[];
|
4766
|
-
}>;
|
4767
|
-
levelUp: (poolConfig: PoolConfig, nftMint: PublicKey, authorizationRulesAccount: PublicKey) => Promise<{
|
4768
|
-
instructions: TransactionInstruction[];
|
4769
|
-
additionalSigners: Signer[];
|
4770
|
-
}>;
|
4771
4785
|
depositStake: (owner: PublicKey, feePayer: PublicKey, depositAmount: BN, poolConfig: PoolConfig) => Promise<{
|
4772
4786
|
instructions: TransactionInstruction[];
|
4773
4787
|
additionalSigners: Signer[];
|
@@ -4811,14 +4825,6 @@ export declare class PerpetualsClient {
|
|
4811
4825
|
instructions: TransactionInstruction[];
|
4812
4826
|
additionalSigners: Signer[];
|
4813
4827
|
}>;
|
4814
|
-
burnAndClaim: (owner: PublicKey, nftMint: PublicKey, poolConfig: PoolConfig, createAta: boolean) => Promise<{
|
4815
|
-
instructions: TransactionInstruction[];
|
4816
|
-
additionalSigners: Signer[];
|
4817
|
-
}>;
|
4818
|
-
burnAndStake: (owner: PublicKey, feePayer: PublicKey, nftMint: PublicKey, poolConfig: PoolConfig) => Promise<{
|
4819
|
-
instructions: TransactionInstruction[];
|
4820
|
-
additionalSigners: Signer[];
|
4821
|
-
}>;
|
4822
4828
|
depositTokenStake: (owner: PublicKey, feePayer: PublicKey, depositAmount: BN, poolConfig: PoolConfig) => Promise<{
|
4823
4829
|
instructions: TransactionInstruction[];
|
4824
4830
|
additionalSigners: Signer[];
|
@@ -4847,22 +4853,6 @@ export declare class PerpetualsClient {
|
|
4847
4853
|
instructions: TransactionInstruction[];
|
4848
4854
|
additionalSigners: Signer[];
|
4849
4855
|
}>;
|
4850
|
-
initRewardVault: (nftCount: BN, rewardSymbol: string, collectionMint: PublicKey, poolConfig: PoolConfig) => Promise<{
|
4851
|
-
instructions: TransactionInstruction[];
|
4852
|
-
additionalSigners: Signer[];
|
4853
|
-
}>;
|
4854
|
-
distributeReward: (rewardAmount: BN, rewardSymbol: string, poolConfig: PoolConfig) => Promise<{
|
4855
|
-
instructions: TransactionInstruction[];
|
4856
|
-
additionalSigners: Signer[];
|
4857
|
-
}>;
|
4858
|
-
collectNftReward: (rewardSymbol: string, poolConfig: PoolConfig, nftMint: PublicKey, createUserATA?: boolean) => Promise<{
|
4859
|
-
instructions: TransactionInstruction[];
|
4860
|
-
additionalSigners: Signer[];
|
4861
|
-
}>;
|
4862
|
-
collectAndDistributeFee: (rewardSymbol: string, poolConfig: PoolConfig, createUserATA?: boolean, nftTradingAccount?: PublicKey) => Promise<{
|
4863
|
-
instructions: TransactionInstruction[];
|
4864
|
-
additionalSigners: Signer[];
|
4865
|
-
}>;
|
4866
4856
|
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<{
|
4867
4857
|
instructions: TransactionInstruction[];
|
4868
4858
|
additionalSigners: Signer[];
|
@@ -4871,11 +4861,11 @@ export declare class PerpetualsClient {
|
|
4871
4861
|
instructions: TransactionInstruction[];
|
4872
4862
|
additionalSigners: Signer[];
|
4873
4863
|
}>;
|
4874
|
-
executeLimitOrder: (userPubkey: PublicKey, targetSymbol: string, collateralSymbol: string, side: Side, orderId: number, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey
|
4864
|
+
executeLimitOrder: (userPubkey: PublicKey, targetSymbol: string, collateralSymbol: string, side: Side, orderId: number, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey) => Promise<{
|
4875
4865
|
instructions: TransactionInstruction[];
|
4876
4866
|
additionalSigners: Signer[];
|
4877
4867
|
}>;
|
4878
|
-
executeLimitWithSwap: (userPubkey: PublicKey, targetSymbol: string, collateralSymbol: string, reserveSymbol: string, side: Side, orderId: number, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey
|
4868
|
+
executeLimitWithSwap: (userPubkey: PublicKey, targetSymbol: string, collateralSymbol: string, reserveSymbol: string, side: Side, orderId: number, poolConfig: PoolConfig, privilege: Privilege, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey) => Promise<{
|
4879
4869
|
instructions: TransactionInstruction[];
|
4880
4870
|
additionalSigners: Signer[];
|
4881
4871
|
}>;
|
@@ -4895,11 +4885,11 @@ export declare class PerpetualsClient {
|
|
4895
4885
|
instructions: TransactionInstruction[];
|
4896
4886
|
additionalSigners: Signer[];
|
4897
4887
|
}>;
|
4898
|
-
executeTriggerWithSwap: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, receivingSymbol: string, side: Side, orderId: number, isStopLoss: boolean, privilege: Privilege, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey
|
4888
|
+
executeTriggerWithSwap: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, receivingSymbol: string, side: Side, orderId: number, isStopLoss: boolean, privilege: Privilege, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey) => Promise<{
|
4899
4889
|
instructions: TransactionInstruction[];
|
4900
4890
|
additionalSigners: Signer[];
|
4901
4891
|
}>;
|
4902
|
-
executeTriggerOrder: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, side: Side, orderId: number, isStopLoss: boolean, privilege: Privilege, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey
|
4892
|
+
executeTriggerOrder: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, side: Side, orderId: number, isStopLoss: boolean, privilege: Privilege, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any, tokenStakeAccount?: PublicKey, userReferralAccount?: PublicKey) => Promise<{
|
4903
4893
|
instructions: TransactionInstruction[];
|
4904
4894
|
additionalSigners: Signer[];
|
4905
4895
|
}>;
|
@@ -4944,11 +4934,11 @@ export declare class PerpetualsClient {
|
|
4944
4934
|
instructions: TransactionInstruction[];
|
4945
4935
|
additionalSigners: Signer[];
|
4946
4936
|
}>;
|
4947
|
-
setInternalOraclePrice: (tokenMint: PublicKey, price: BN, expo: number, conf: BN, ema: BN, publishTime: BN, poolConfig: PoolConfig) => Promise<{
|
4937
|
+
setInternalOraclePrice: (tokenMint: PublicKey, useCurrentTime: number, price: BN, expo: number, conf: BN, ema: BN, publishTime: BN, poolConfig: PoolConfig) => Promise<{
|
4948
4938
|
instructions: TransactionInstruction[];
|
4949
4939
|
additionalSigners: Signer[];
|
4950
4940
|
}>;
|
4951
|
-
setInternalOraclePriceBatch: (tokenMintList: PublicKey[], tokenInternalPrices: InternalPrice[], POOL_CONFIGS: PoolConfig[]) => Promise<{
|
4941
|
+
setInternalOraclePriceBatch: (useCurrentTime: boolean, tokenMintList: PublicKey[], tokenInternalPrices: InternalPrice[], POOL_CONFIGS: PoolConfig[]) => Promise<{
|
4952
4942
|
instructions: TransactionInstruction[];
|
4953
4943
|
additionalSigners: Signer[];
|
4954
4944
|
}>;
|
@@ -4996,4 +4986,8 @@ export declare class PerpetualsClient {
|
|
4996
4986
|
instructions: TransactionInstruction[];
|
4997
4987
|
additionalSigners: Signer[];
|
4998
4988
|
}>;
|
4989
|
+
resizeInternalOracle: (extOracle: PublicKey, tokenMint: PublicKey, intOracleAccount: PublicKey) => Promise<{
|
4990
|
+
instructions: TransactionInstruction[];
|
4991
|
+
additionalSigners: Signer[];
|
4992
|
+
}>;
|
4999
4993
|
}
|