@drift-labs/sdk 2.37.1-beta.1 → 2.37.1-beta.11
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/VERSION +1 -1
- package/lib/adminClient.d.ts +1 -0
- package/lib/adminClient.js +10 -0
- package/lib/constants/perpMarkets.js +20 -0
- package/lib/idl/drift.json +73 -8
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/math/auction.js +1 -1
- package/lib/orderSubscriber/OrderSubscriber.d.ts +5 -1
- package/lib/orderSubscriber/OrderSubscriber.js +10 -0
- package/lib/orderSubscriber/types.d.ts +5 -0
- package/lib/tx/baseTxSender.d.ts +30 -0
- package/lib/tx/baseTxSender.js +176 -0
- package/lib/tx/fastSingleTxSender.d.ts +27 -0
- package/lib/tx/fastSingleTxSender.js +83 -0
- package/lib/tx/retryTxSender.d.ts +5 -14
- package/lib/tx/retryTxSender.js +7 -158
- package/lib/types.d.ts +18 -0
- package/lib/types.js +1 -0
- package/lib/user.d.ts +12 -3
- package/lib/user.js +261 -73
- package/package.json +2 -2
- package/src/adminClient.ts +18 -0
- package/src/constants/perpMarkets.ts +20 -0
- package/src/idl/drift.json +73 -8
- package/src/index.ts +1 -0
- package/src/marinade/types.ts +70 -70
- package/src/math/auction.ts +1 -1
- package/src/orderSubscriber/OrderSubscriber.ts +19 -2
- package/src/orderSubscriber/types.ts +11 -0
- package/src/tx/baseTxSender.ts +276 -0
- package/src/tx/fastSingleTxSender.ts +142 -0
- package/src/tx/retryTxSender.ts +9 -235
- package/src/types.ts +19 -0
- package/src/user.ts +455 -119
- package/tests/amm/test.ts +83 -39
- package/tests/dlob/helpers.ts +2 -0
- package/tests/dlob/test.ts +19 -17
package/src/types.ts
CHANGED
|
@@ -31,6 +31,7 @@ export class UserStatus {
|
|
|
31
31
|
static readonly ACTIVE = { active: {} };
|
|
32
32
|
static readonly BEING_LIQUIDATED = { beingLiquidated: {} };
|
|
33
33
|
static readonly BANKRUPT = { bankrupt: {} };
|
|
34
|
+
static readonly REDUCE_ONLY = { reduceOnly: {} };
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export class ContractType {
|
|
@@ -766,6 +767,8 @@ export type AMM = {
|
|
|
766
767
|
bidQuoteAssetReserve: BN;
|
|
767
768
|
askBaseAssetReserve: BN;
|
|
768
769
|
askQuoteAssetReserve: BN;
|
|
770
|
+
|
|
771
|
+
perLpBase: number; // i8
|
|
769
772
|
};
|
|
770
773
|
|
|
771
774
|
// # User Account Types
|
|
@@ -784,6 +787,7 @@ export type PerpPosition = {
|
|
|
784
787
|
remainderBaseAssetAmount: number;
|
|
785
788
|
lastBaseAssetAmountPerLp: BN;
|
|
786
789
|
lastQuoteAssetAmountPerLp: BN;
|
|
790
|
+
perLpBase: number;
|
|
787
791
|
};
|
|
788
792
|
|
|
789
793
|
export type UserStatsAccount = {
|
|
@@ -1099,3 +1103,18 @@ export type PerpMarketExtendedInfo = {
|
|
|
1099
1103
|
pnlPoolValue: BN;
|
|
1100
1104
|
contractTier: ContractTier;
|
|
1101
1105
|
};
|
|
1106
|
+
|
|
1107
|
+
export type HealthComponents = {
|
|
1108
|
+
deposits: HealthComponent[];
|
|
1109
|
+
borrows: HealthComponent[];
|
|
1110
|
+
perpPositions: HealthComponent[];
|
|
1111
|
+
perpPnl: HealthComponent[];
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
export type HealthComponent = {
|
|
1115
|
+
marketIndex: number;
|
|
1116
|
+
size: BN;
|
|
1117
|
+
value: BN;
|
|
1118
|
+
weight: BN;
|
|
1119
|
+
weightedValue: BN;
|
|
1120
|
+
};
|