flash-sdk 15.4.2 → 15.4.3-alpha.0
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 +60 -3
- package/dist/PerpetualsClient.js +649 -343
- 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,17 @@ export declare class PerpetualsClient {
|
|
|
190
190
|
bump: number;
|
|
191
191
|
padding: number[];
|
|
192
192
|
}>;
|
|
193
|
-
getPositionData: (position: PositionAccount, poolConfig: PoolConfig) => Promise<
|
|
193
|
+
getPositionData: (position: PositionAccount, poolConfig: PoolConfig, userPublicKey?: PublicKey | undefined) => Promise<PositionData>;
|
|
194
|
+
getOpenPositionQuote: (amountIn: BN, leverage: BN, marketConfig: MarketConfig, poolConfig: PoolConfig, privilege?: Privilege, receivingCustodyConfig?: CustodyConfig, existingPositionPk?: PublicKey, discountIndex?: number | null, limitPrice?: {
|
|
195
|
+
price: BN;
|
|
196
|
+
exponent: number;
|
|
197
|
+
} | null, userPublicKey?: PublicKey | undefined) => Promise<OpenPositionQuoteData>;
|
|
198
|
+
getClosePositionQuote: (positionPk: PublicKey, positionAccount: PositionAccount, poolConfig: PoolConfig, sizeDeltaUsd?: BN, privilege?: Privilege, dispensingCustodyConfig?: CustodyConfig, discountIndex?: number | null, triggerPrice?: {
|
|
199
|
+
price: BN;
|
|
200
|
+
exponent: number;
|
|
201
|
+
} | null, userPublicKey?: PublicKey | undefined) => Promise<ClosePositionQuoteData>;
|
|
202
|
+
getAddCollateralQuote: (amountIn: BN, positionPk: PublicKey, positionAccount: PositionAccount, poolConfig: PoolConfig, receivingCustodyConfig?: CustodyConfig, userPublicKey?: PublicKey | undefined) => Promise<AddCollateralQuoteData>;
|
|
203
|
+
getRemoveCollateralQuote: (collateralDeltaUsd: BN, positionPk: PublicKey, positionAccount: PositionAccount, poolConfig: PoolConfig, dispensingCustodyConfig?: CustodyConfig, userPublicKey?: PublicKey | undefined) => Promise<RemoveCollateralQuoteData>;
|
|
194
204
|
getOrderAccount: (orderAccountKey: PublicKey) => Promise<{
|
|
195
205
|
owner: PublicKey;
|
|
196
206
|
market: PublicKey;
|
|
@@ -291,6 +301,34 @@ export declare class PerpetualsClient {
|
|
|
291
301
|
padding: number[];
|
|
292
302
|
pubkey: PublicKey;
|
|
293
303
|
}[]>;
|
|
304
|
+
getUserPositionsMultiPool: (wallet: PublicKey, poolConfigs: PoolConfig[]) => Promise<{
|
|
305
|
+
owner: PublicKey;
|
|
306
|
+
market: PublicKey;
|
|
307
|
+
delegate: PublicKey;
|
|
308
|
+
openTime: BN;
|
|
309
|
+
updateTime: BN;
|
|
310
|
+
entryPrice: ContractOraclePrice;
|
|
311
|
+
sizeAmount: BN;
|
|
312
|
+
sizeUsd: BN;
|
|
313
|
+
lockedAmount: BN;
|
|
314
|
+
lockedUsd: BN;
|
|
315
|
+
priceImpactUsd: BN;
|
|
316
|
+
collateralUsd: BN;
|
|
317
|
+
unsettledValueUsd: BN;
|
|
318
|
+
unsettledFeesUsd: BN;
|
|
319
|
+
cumulativeLockFeeSnapshot: BN;
|
|
320
|
+
degenSizeUsd: BN;
|
|
321
|
+
referencePrice: ContractOraclePrice;
|
|
322
|
+
isActive: boolean;
|
|
323
|
+
buffer: number[];
|
|
324
|
+
priceImpactSet: number;
|
|
325
|
+
sizeDecimals: number;
|
|
326
|
+
lockedDecimals: number;
|
|
327
|
+
collateralDecimals: number;
|
|
328
|
+
bump: number;
|
|
329
|
+
padding: number[];
|
|
330
|
+
pubkey: PublicKey;
|
|
331
|
+
}[]>;
|
|
294
332
|
getUserOrderAccounts: (wallet: PublicKey, poolConfig: PoolConfig) => Promise<{
|
|
295
333
|
owner: PublicKey;
|
|
296
334
|
market: PublicKey;
|
|
@@ -310,6 +348,25 @@ export declare class PerpetualsClient {
|
|
|
310
348
|
padding: BN[];
|
|
311
349
|
pubkey: PublicKey;
|
|
312
350
|
}[]>;
|
|
351
|
+
getUserOrderAccountsMultiPool: (wallet: PublicKey, poolConfigs: PoolConfig[]) => Promise<{
|
|
352
|
+
owner: PublicKey;
|
|
353
|
+
market: PublicKey;
|
|
354
|
+
limitOrders: import("./types").LimitOrder[];
|
|
355
|
+
takeProfitOrders: import("./types").TriggerOrder[];
|
|
356
|
+
stopLossOrders: import("./types").TriggerOrder[];
|
|
357
|
+
isInitialised: boolean;
|
|
358
|
+
isActive: boolean;
|
|
359
|
+
openSl: number;
|
|
360
|
+
openTp: number;
|
|
361
|
+
inactiveSl: number;
|
|
362
|
+
inactiveTp: number;
|
|
363
|
+
activeOrders: number;
|
|
364
|
+
bump: number;
|
|
365
|
+
referenceTimestamp: BN;
|
|
366
|
+
executionCount: BN;
|
|
367
|
+
padding: BN[];
|
|
368
|
+
pubkey: PublicKey;
|
|
369
|
+
}[]>;
|
|
313
370
|
getAllPositions: () => Promise<import("@coral-xyz/anchor").ProgramAccount<{
|
|
314
371
|
owner: PublicKey;
|
|
315
372
|
market: PublicKey;
|