flash-sdk 15.8.2 → 15.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PerpetualsClient.d.ts +67 -4
- package/dist/PerpetualsClient.js +708 -398
- package/dist/ViewHelper.js +9 -15
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -4,12 +4,12 @@ import { Program, AnchorProvider, BN } from "@coral-xyz/anchor";
|
|
|
4
4
|
import { PublicKey, TransactionInstruction, Commitment, Signer, AddressLookupTableAccount, VersionedTransaction } from "@solana/web3.js";
|
|
5
5
|
import { PoolAccount } from "./PoolAccount";
|
|
6
6
|
import { PositionAccount } from "./PositionAccount";
|
|
7
|
-
import { AddLiquidityAmountAndFee, InternalPrice, BorrowRateParams, ExitPriceAndFee, Fees, OracleParams, Permissions, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, TokenRatios, MinAndMaxPrice, FeesAction, ContractOraclePrice, Privilege, PerpetualsAccount, EntryPriceAndFeeV2, TokenPermissions, TokenStake, InternalEmaPrice, Whitelist, VoltageMultiplier, MarketPermissions } from "./types";
|
|
7
|
+
import { AddLiquidityAmountAndFee, InternalPrice, BorrowRateParams, ExitPriceAndFee, Fees, OracleParams, Permissions, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, TokenRatios, MinAndMaxPrice, FeesAction, ContractOraclePrice, Privilege, PerpetualsAccount, EntryPriceAndFeeV2, TokenPermissions, TokenStake, InternalEmaPrice, Whitelist, VoltageMultiplier, MarketPermissions, PositionData, OpenPositionQuoteData, ClosePositionQuoteData, AddCollateralQuoteData, RemoveCollateralQuoteData } from "./types";
|
|
8
8
|
import { OraclePrice } from "./OraclePrice";
|
|
9
9
|
import { CustodyAccount } from "./CustodyAccount";
|
|
10
10
|
import type { Perpetuals } from './idl/perpetuals';
|
|
11
11
|
import { SendTransactionOpts } from "./utils/rpc";
|
|
12
|
-
import { MarketConfig, PoolConfig, Token } from "./PoolConfig";
|
|
12
|
+
import { CustodyConfig, MarketConfig, PoolConfig, Token } from "./PoolConfig";
|
|
13
13
|
import { MarketAccount } from "./MarketAccount";
|
|
14
14
|
import { TokenStakeAccount } from "./TokenStakeAccount";
|
|
15
15
|
export type PerpClientOptions = {
|
|
@@ -190,7 +190,6 @@ export declare class PerpetualsClient {
|
|
|
190
190
|
bump: number;
|
|
191
191
|
padding: number[];
|
|
192
192
|
}>;
|
|
193
|
-
getPositionData: (position: PositionAccount, poolConfig: PoolConfig) => Promise<any>;
|
|
194
193
|
getOrderAccount: (orderAccountKey: PublicKey) => Promise<{
|
|
195
194
|
owner: PublicKey;
|
|
196
195
|
market: PublicKey;
|
|
@@ -291,6 +290,34 @@ export declare class PerpetualsClient {
|
|
|
291
290
|
padding: number[];
|
|
292
291
|
pubkey: PublicKey;
|
|
293
292
|
}[]>;
|
|
293
|
+
getUserPositionsMultiPool: (wallet: PublicKey, poolConfigs: PoolConfig[]) => Promise<{
|
|
294
|
+
owner: PublicKey;
|
|
295
|
+
market: PublicKey;
|
|
296
|
+
delegate: PublicKey;
|
|
297
|
+
openTime: BN;
|
|
298
|
+
updateTime: BN;
|
|
299
|
+
entryPrice: ContractOraclePrice;
|
|
300
|
+
sizeAmount: BN;
|
|
301
|
+
sizeUsd: BN;
|
|
302
|
+
lockedAmount: BN;
|
|
303
|
+
lockedUsd: BN;
|
|
304
|
+
priceImpactUsd: BN;
|
|
305
|
+
collateralUsd: BN;
|
|
306
|
+
unsettledValueUsd: BN;
|
|
307
|
+
unsettledFeesUsd: BN;
|
|
308
|
+
cumulativeLockFeeSnapshot: BN;
|
|
309
|
+
degenSizeUsd: BN;
|
|
310
|
+
referencePrice: ContractOraclePrice;
|
|
311
|
+
isActive: boolean;
|
|
312
|
+
buffer: number[];
|
|
313
|
+
priceImpactSet: number;
|
|
314
|
+
sizeDecimals: number;
|
|
315
|
+
lockedDecimals: number;
|
|
316
|
+
collateralDecimals: number;
|
|
317
|
+
bump: number;
|
|
318
|
+
padding: number[];
|
|
319
|
+
pubkey: PublicKey;
|
|
320
|
+
}[]>;
|
|
294
321
|
getUserOrderAccounts: (wallet: PublicKey, poolConfig: PoolConfig) => Promise<{
|
|
295
322
|
owner: PublicKey;
|
|
296
323
|
market: PublicKey;
|
|
@@ -310,6 +337,25 @@ export declare class PerpetualsClient {
|
|
|
310
337
|
padding: BN[];
|
|
311
338
|
pubkey: PublicKey;
|
|
312
339
|
}[]>;
|
|
340
|
+
getUserOrderAccountsMultiPool: (wallet: PublicKey, poolConfigs: PoolConfig[]) => Promise<{
|
|
341
|
+
owner: PublicKey;
|
|
342
|
+
market: PublicKey;
|
|
343
|
+
limitOrders: import("./types").LimitOrder[];
|
|
344
|
+
takeProfitOrders: import("./types").TriggerOrder[];
|
|
345
|
+
stopLossOrders: import("./types").TriggerOrder[];
|
|
346
|
+
isInitialised: boolean;
|
|
347
|
+
isActive: boolean;
|
|
348
|
+
openSl: number;
|
|
349
|
+
openTp: number;
|
|
350
|
+
inactiveSl: number;
|
|
351
|
+
inactiveTp: number;
|
|
352
|
+
activeOrders: number;
|
|
353
|
+
bump: number;
|
|
354
|
+
referenceTimestamp: BN;
|
|
355
|
+
executionCount: BN;
|
|
356
|
+
padding: BN[];
|
|
357
|
+
pubkey: PublicKey;
|
|
358
|
+
}[]>;
|
|
313
359
|
getAllPositions: () => Promise<import("@coral-xyz/anchor").ProgramAccount<{
|
|
314
360
|
owner: PublicKey;
|
|
315
361
|
market: PublicKey;
|
|
@@ -439,7 +485,6 @@ export declare class PerpetualsClient {
|
|
|
439
485
|
getAccountDiscriminator: (name: string) => Buffer;
|
|
440
486
|
log: (...message: string[]) => void;
|
|
441
487
|
prettyPrint: (object: object) => void;
|
|
442
|
-
liquidate: (positionAccount: PublicKey, poolConfig: PoolConfig, tokenMint: PublicKey, collateralMint: PublicKey, marketPk: PublicKey) => Promise<TransactionInstruction>;
|
|
443
488
|
getApyPercentageUi: (rewardCustodyAccount: CustodyAccount, previousSnapShotRewardPerLpStaked: BN, lpTokenUsdPrice: BN) => string;
|
|
444
489
|
getAddLiquidityAmountAndFeeSync: (amountIn: BN, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, lpTokenSupplyAmount: BN, poolAumUsdMax: BN, poolConfig: PoolConfig) => AddLiquidityAmountAndFee;
|
|
445
490
|
getRemoveLiquidityAmountAndFeeSync: (lpAmountIn: BN, poolAccount: PoolAccount, outputTokenPrice: OraclePrice, outputTokenEmaPrice: OraclePrice, outputTokenCustodyAccount: CustodyAccount, lpTokenSupply: BN, poolAumUsdMax: BN, poolConfig: PoolConfig) => RemoveLiquidityAmountAndFee;
|
|
@@ -557,6 +602,23 @@ export declare class PerpetualsClient {
|
|
|
557
602
|
totalAmount: BN;
|
|
558
603
|
}[];
|
|
559
604
|
} | null>;
|
|
605
|
+
getPositionData: (position: PositionAccount, poolConfig: PoolConfig, userPublicKey?: PublicKey | undefined) => Promise<PositionData>;
|
|
606
|
+
getOpenPositionQuote: (amountIn: BN, leverage: BN, marketConfig: MarketConfig, poolConfig: PoolConfig, privilege?: Privilege, receivingCustodyConfig?: CustodyConfig, existingPositionPk?: PublicKey, discountIndex?: number | null, limitPrice?: {
|
|
607
|
+
price: BN;
|
|
608
|
+
exponent: number;
|
|
609
|
+
} | null, userPublicKey?: PublicKey | undefined, takeProfitPrice?: {
|
|
610
|
+
price: BN;
|
|
611
|
+
exponent: number;
|
|
612
|
+
} | null, stopLossPrice?: {
|
|
613
|
+
price: BN;
|
|
614
|
+
exponent: number;
|
|
615
|
+
} | null) => Promise<OpenPositionQuoteData>;
|
|
616
|
+
getClosePositionQuote: (positionPk: PublicKey, positionAccount: PositionAccount, poolConfig: PoolConfig, sizeDeltaUsd?: BN, privilege?: Privilege, dispensingCustodyConfig?: CustodyConfig, discountIndex?: number | null, triggerPrice?: {
|
|
617
|
+
price: BN;
|
|
618
|
+
exponent: number;
|
|
619
|
+
} | null, userPublicKey?: PublicKey | undefined) => Promise<ClosePositionQuoteData>;
|
|
620
|
+
getAddCollateralQuote: (amountIn: BN, positionPk: PublicKey, positionAccount: PositionAccount, poolConfig: PoolConfig, receivingCustodyConfig?: CustodyConfig, userPublicKey?: PublicKey | undefined) => Promise<AddCollateralQuoteData>;
|
|
621
|
+
getRemoveCollateralQuote: (collateralDeltaUsd: BN, positionPk: PublicKey, positionAccount: PositionAccount, poolConfig: PoolConfig, dispensingCustodyConfig?: CustodyConfig, userPublicKey?: PublicKey | undefined) => Promise<RemoveCollateralQuoteData>;
|
|
560
622
|
getLpTokenPriceView: (poolConfig: PoolConfig, includeRemainingAccounts?: boolean) => Promise<any>;
|
|
561
623
|
getStakedLpTokenPrice: (poolKey: PublicKey, POOL_CONFIG: PoolConfig, includeRemainingAccounts?: boolean) => Promise<string>;
|
|
562
624
|
getCompoundingLPTokenPrice: (poolKey: PublicKey, POOL_CONFIG: PoolConfig, includeRemainingAccounts?: boolean) => Promise<string>;
|
|
@@ -622,6 +684,7 @@ export declare class PerpetualsClient {
|
|
|
622
684
|
instructions: TransactionInstruction[];
|
|
623
685
|
additionalSigners: Signer[];
|
|
624
686
|
}>;
|
|
687
|
+
liquidate: (positionAccount: PublicKey, poolConfig: PoolConfig, tokenMint: PublicKey, collateralMint: PublicKey, marketPk: PublicKey) => Promise<TransactionInstruction>;
|
|
625
688
|
addLiquidity: (payTokenSymbol: string, tokenAmountIn: BN, minLpAmountOut: BN, poolConfig: PoolConfig, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any, isWhitelistedUser?: boolean, includeRemainingAccounts?: boolean) => Promise<{
|
|
626
689
|
instructions: TransactionInstruction[];
|
|
627
690
|
additionalSigners: Signer[];
|