@drift-labs/sdk 0.2.0-master.3 → 0.2.0-master.30
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/README.md +13 -13
- package/lib/accounts/bulkUserStatsSubscription.d.ts +7 -0
- package/lib/accounts/bulkUserStatsSubscription.js +21 -0
- package/lib/accounts/bulkUserSubscription.js +0 -1
- package/lib/accounts/fetch.d.ts +2 -1
- package/lib/accounts/fetch.js +9 -1
- package/lib/accounts/pollingClearingHouseAccountSubscriber.d.ts +16 -16
- package/lib/accounts/pollingClearingHouseAccountSubscriber.js +31 -28
- package/lib/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
- package/lib/accounts/pollingUserStatsAccountSubscriber.js +113 -0
- package/lib/accounts/types.d.ts +22 -11
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.d.ts +17 -17
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.js +37 -35
- package/lib/accounts/webSocketUserStatsAccountSubsriber.d.ts +20 -0
- package/lib/accounts/webSocketUserStatsAccountSubsriber.js +47 -0
- package/lib/addresses/marketAddresses.d.ts +1 -3
- package/lib/addresses/pda.d.ts +10 -4
- package/lib/addresses/pda.js +51 -14
- package/lib/admin.d.ts +34 -22
- package/lib/admin.js +182 -73
- package/lib/clearingHouse.d.ts +120 -42
- package/lib/clearingHouse.js +1505 -254
- package/lib/clearingHouseConfig.d.ts +4 -4
- package/lib/clearingHouseUser.d.ts +50 -38
- package/lib/clearingHouseUser.js +410 -190
- package/lib/clearingHouseUserStats.d.ts +18 -0
- package/lib/clearingHouseUserStats.js +49 -0
- package/lib/clearingHouseUserStatsConfig.d.ts +14 -0
- package/lib/clearingHouseUserStatsConfig.js +2 -0
- package/lib/config.d.ts +7 -9
- package/lib/config.js +21 -21
- package/lib/constants/numericConstants.d.ts +18 -12
- package/lib/constants/numericConstants.js +28 -21
- package/lib/constants/perpMarkets.d.ts +18 -0
- package/lib/constants/{markets.js → perpMarkets.js} +7 -7
- package/lib/constants/spotMarkets.d.ts +19 -0
- package/lib/constants/spotMarkets.js +53 -0
- package/lib/dlob/DLOB.d.ts +73 -0
- package/lib/dlob/DLOB.js +553 -0
- package/lib/dlob/DLOBNode.d.ts +52 -0
- package/lib/dlob/DLOBNode.js +82 -0
- package/lib/dlob/NodeList.d.ts +26 -0
- package/lib/dlob/NodeList.js +138 -0
- package/lib/events/eventList.js +3 -0
- package/lib/events/eventSubscriber.d.ts +4 -2
- package/lib/events/eventSubscriber.js +16 -9
- package/lib/events/fetchLogs.d.ts +10 -1
- package/lib/events/fetchLogs.js +27 -7
- package/lib/events/pollingLogProvider.d.ts +2 -1
- package/lib/events/pollingLogProvider.js +6 -2
- package/lib/events/sort.js +8 -11
- package/lib/events/types.d.ts +7 -2
- package/lib/events/types.js +5 -0
- package/lib/examples/makeTradeExample.js +20 -8
- package/lib/factory/bigNum.d.ts +1 -0
- package/lib/factory/bigNum.js +34 -10
- package/lib/idl/clearing_house.json +4313 -1433
- package/lib/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/lib/index.d.ts +21 -6
- package/lib/index.js +25 -6
- package/lib/math/amm.d.ts +8 -5
- package/lib/math/amm.js +68 -46
- package/lib/math/auction.js +4 -1
- package/lib/math/conversion.js +1 -1
- package/lib/math/funding.d.ts +6 -6
- package/lib/math/funding.js +11 -10
- package/lib/math/insurance.d.ts +4 -0
- package/lib/math/insurance.js +27 -0
- package/lib/math/margin.d.ts +11 -0
- package/lib/math/margin.js +77 -0
- package/lib/math/market.d.ts +14 -9
- package/lib/math/market.js +69 -7
- package/lib/math/oracles.d.ts +4 -0
- package/lib/math/oracles.js +36 -8
- package/lib/math/orders.d.ts +6 -2
- package/lib/math/orders.js +78 -3
- package/lib/math/position.d.ts +21 -13
- package/lib/math/position.js +76 -36
- package/lib/math/repeg.js +14 -5
- package/lib/math/spotBalance.d.ts +22 -0
- package/lib/math/spotBalance.js +193 -0
- package/lib/math/spotMarket.d.ts +4 -0
- package/lib/math/spotMarket.js +8 -0
- package/lib/math/spotPosition.d.ts +6 -0
- package/lib/math/spotPosition.js +23 -0
- package/lib/math/trade.d.ts +10 -10
- package/lib/math/trade.js +22 -29
- package/lib/oracles/pythClient.js +1 -1
- package/lib/oracles/quoteAssetOracleClient.js +1 -1
- package/lib/oracles/switchboardClient.js +1 -1
- package/lib/orderParams.d.ts +14 -5
- package/lib/orderParams.js +12 -92
- package/lib/serum/serumSubscriber.d.ts +23 -0
- package/lib/serum/serumSubscriber.js +41 -0
- package/lib/serum/types.d.ts +11 -0
- package/lib/serum/types.js +2 -0
- package/lib/slot/SlotSubscriber.d.ts +7 -0
- package/lib/slot/SlotSubscriber.js +3 -0
- package/lib/{mockUSDCFaucet.d.ts → tokenFaucet.d.ts} +8 -5
- package/lib/{mockUSDCFaucet.js → tokenFaucet.js} +63 -51
- package/lib/tx/retryTxSender.d.ts +1 -1
- package/lib/tx/retryTxSender.js +13 -4
- package/lib/tx/types.d.ts +1 -1
- package/lib/tx/utils.js +1 -1
- package/lib/types.d.ts +474 -123
- package/lib/types.js +99 -5
- package/lib/userMap/userMap.d.ts +25 -0
- package/lib/userMap/userMap.js +73 -0
- package/lib/userMap/userStatsMap.d.ts +19 -0
- package/lib/userMap/userStatsMap.js +68 -0
- package/lib/util/computeUnits.js +1 -1
- package/lib/util/getTokenAddress.d.ts +2 -0
- package/lib/util/getTokenAddress.js +9 -0
- package/package.json +9 -5
- package/src/accounts/bulkUserStatsSubscription.ts +33 -0
- package/src/accounts/bulkUserSubscription.ts +0 -1
- package/src/accounts/fetch.ts +27 -2
- package/src/accounts/pollingClearingHouseAccountSubscriber.ts +46 -42
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +172 -0
- package/src/accounts/types.ts +31 -11
- package/src/accounts/webSocketClearingHouseAccountSubscriber.ts +64 -59
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +80 -0
- package/src/addresses/marketAddresses.ts +1 -2
- package/src/addresses/pda.ts +88 -14
- package/src/admin.ts +333 -128
- package/src/assert/assert.js +9 -0
- package/src/clearingHouse.ts +2464 -458
- package/src/clearingHouseConfig.ts +4 -3
- package/src/clearingHouseUser.ts +747 -291
- package/src/clearingHouseUserStats.ts +75 -0
- package/src/clearingHouseUserStatsConfig.ts +18 -0
- package/src/config.ts +30 -31
- package/src/constants/numericConstants.ts +41 -25
- package/src/constants/{markets.ts → perpMarkets.ts} +10 -10
- package/src/constants/spotMarkets.ts +72 -0
- package/src/dlob/DLOB.ts +868 -0
- package/src/dlob/DLOBNode.ts +162 -0
- package/src/dlob/NodeList.ts +185 -0
- package/src/events/eventList.js +77 -0
- package/src/events/eventList.ts +3 -0
- package/src/events/eventSubscriber.ts +20 -12
- package/src/events/fetchLogs.ts +35 -8
- package/src/events/pollingLogProvider.ts +10 -2
- package/src/events/sort.ts +11 -15
- package/src/events/types.ts +16 -1
- package/src/examples/makeTradeExample.js +157 -0
- package/src/examples/makeTradeExample.ts +32 -14
- package/src/factory/bigNum.ts +42 -13
- package/src/idl/clearing_house.json +4313 -1433
- package/src/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/src/index.ts +21 -6
- package/src/math/amm.ts +136 -66
- package/src/math/auction.ts +5 -1
- package/src/math/conversion.ts +2 -2
- package/src/math/funding.ts +20 -18
- package/src/math/insurance.ts +35 -0
- package/src/math/margin.ts +127 -0
- package/src/math/market.ts +138 -12
- package/src/math/oracles.ts +63 -9
- package/src/math/orders.ts +138 -4
- package/src/math/position.ts +119 -58
- package/src/math/repeg.ts +16 -6
- package/src/math/spotBalance.ts +316 -0
- package/src/math/spotMarket.ts +9 -0
- package/src/math/spotPosition.ts +47 -0
- package/src/math/trade.ts +43 -49
- package/src/oracles/pythClient.ts +2 -2
- package/src/oracles/quoteAssetOracleClient.ts +2 -2
- package/src/oracles/switchboardClient.ts +2 -2
- package/src/orderParams.ts +24 -137
- package/src/serum/serumSubscriber.ts +80 -0
- package/src/serum/types.ts +13 -0
- package/src/slot/SlotSubscriber.ts +11 -1
- package/src/token/index.js +38 -0
- package/src/{mockUSDCFaucet.ts → tokenFaucet.ts} +82 -70
- package/src/tx/retryTxSender.ts +16 -5
- package/src/tx/types.js +2 -0
- package/src/tx/types.ts +2 -1
- package/src/tx/utils.js +17 -0
- package/src/tx/utils.ts +1 -1
- package/src/types.ts +477 -125
- package/src/userMap/userMap.ts +100 -0
- package/src/userMap/userStatsMap.ts +110 -0
- package/src/util/computeUnits.js +21 -11
- package/src/util/computeUnits.ts +1 -1
- package/src/util/getTokenAddress.js +9 -0
- package/src/util/getTokenAddress.ts +18 -0
- package/src/util/promiseTimeout.js +14 -0
- package/src/util/tps.js +27 -0
- package/tests/bn/test.ts +12 -3
- package/tests/dlob/helpers.ts +374 -0
- package/tests/dlob/test.ts +2865 -0
- package/lib/constants/banks.d.ts +0 -16
- package/lib/constants/banks.js +0 -34
- package/lib/constants/markets.d.ts +0 -19
- package/lib/math/bankBalance.d.ts +0 -9
- package/lib/math/bankBalance.js +0 -75
- package/lib/math/state.d.ts +0 -8
- package/lib/math/state.js +0 -15
- package/lib/orders.d.ts +0 -8
- package/lib/orders.js +0 -134
- package/src/constants/banks.ts +0 -43
- package/src/math/bankBalance.ts +0 -112
- package/src/math/state.ts +0 -14
- package/src/math/utils.js +0 -27
- package/src/math/utils.js.map +0 -1
- package/src/orders.ts +0 -244
- package/src/util/computeUnits.js.map +0 -1
package/lib/types.d.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { PublicKey, Transaction } from '@solana/web3.js';
|
|
3
3
|
import { BN } from '.';
|
|
4
|
+
export declare class MarketStatus {
|
|
5
|
+
static readonly INITIALIZED: {
|
|
6
|
+
initialized: {};
|
|
7
|
+
};
|
|
8
|
+
static readonly REDUCEONLY: {
|
|
9
|
+
reduceonly: {};
|
|
10
|
+
};
|
|
11
|
+
static readonly SETTLEMENT: {
|
|
12
|
+
settlement: {};
|
|
13
|
+
};
|
|
14
|
+
static readonly DELISTED: {
|
|
15
|
+
delisted: {};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare class ContractType {
|
|
19
|
+
static readonly PERPETUAL: {
|
|
20
|
+
perpetual: {};
|
|
21
|
+
};
|
|
22
|
+
static readonly FUTURE: {
|
|
23
|
+
future: {};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
4
26
|
export declare class SwapDirection {
|
|
5
27
|
static readonly ADD: {
|
|
6
28
|
add: {};
|
|
@@ -9,7 +31,7 @@ export declare class SwapDirection {
|
|
|
9
31
|
remove: {};
|
|
10
32
|
};
|
|
11
33
|
}
|
|
12
|
-
export declare class
|
|
34
|
+
export declare class SpotBalanceType {
|
|
13
35
|
static readonly DEPOSIT: {
|
|
14
36
|
deposit: {};
|
|
15
37
|
};
|
|
@@ -25,6 +47,14 @@ export declare class PositionDirection {
|
|
|
25
47
|
short: {};
|
|
26
48
|
};
|
|
27
49
|
}
|
|
50
|
+
export declare class DepositDirection {
|
|
51
|
+
static readonly DEPOSIT: {
|
|
52
|
+
deposit: {};
|
|
53
|
+
};
|
|
54
|
+
static readonly WITHDRAW: {
|
|
55
|
+
withdraw: {};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
28
58
|
export declare class OracleSource {
|
|
29
59
|
static readonly PYTH: {
|
|
30
60
|
pyth: {};
|
|
@@ -50,6 +80,15 @@ export declare class OrderType {
|
|
|
50
80
|
market: {};
|
|
51
81
|
};
|
|
52
82
|
}
|
|
83
|
+
export declare type MarketTypeStr = 'perp' | 'spot';
|
|
84
|
+
export declare class MarketType {
|
|
85
|
+
static readonly SPOT: {
|
|
86
|
+
spot: {};
|
|
87
|
+
};
|
|
88
|
+
static readonly PERP: {
|
|
89
|
+
perp: {};
|
|
90
|
+
};
|
|
91
|
+
}
|
|
53
92
|
export declare class OrderStatus {
|
|
54
93
|
static readonly INIT: {
|
|
55
94
|
init: {};
|
|
@@ -92,6 +131,23 @@ export declare class OrderAction {
|
|
|
92
131
|
trigger: {};
|
|
93
132
|
};
|
|
94
133
|
}
|
|
134
|
+
export declare class OrderActionExplanation {
|
|
135
|
+
static readonly NONE: {
|
|
136
|
+
none: {};
|
|
137
|
+
};
|
|
138
|
+
static readonly ORACLE_PRICE_BREACHED_LIMIT_PRICE: {
|
|
139
|
+
oraclePriceBreachedLimitPrice: {};
|
|
140
|
+
};
|
|
141
|
+
static readonly MARKET_ORDER_FILLED_TO_LIMIT_PRICE: {
|
|
142
|
+
marketOrderFilledToLimitPrice: {};
|
|
143
|
+
};
|
|
144
|
+
static readonly CANCELED_FOR_LIQUIDATION: {
|
|
145
|
+
canceledForLiquidation: {};
|
|
146
|
+
};
|
|
147
|
+
static readonly MARKET_ORDER_AUCTION_EXPIRED: {
|
|
148
|
+
marketOrderAuctionExpired: {};
|
|
149
|
+
};
|
|
150
|
+
}
|
|
95
151
|
export declare class OrderTriggerCondition {
|
|
96
152
|
static readonly ABOVE: {
|
|
97
153
|
above: {};
|
|
@@ -100,14 +156,36 @@ export declare class OrderTriggerCondition {
|
|
|
100
156
|
below: {};
|
|
101
157
|
};
|
|
102
158
|
}
|
|
159
|
+
export declare class SpotFulfillmentType {
|
|
160
|
+
static readonly SERUM_v3: {
|
|
161
|
+
serumV3: {};
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export declare class SpotFulfillmentStatus {
|
|
165
|
+
static readonly ENABLED: {
|
|
166
|
+
enabled: {};
|
|
167
|
+
};
|
|
168
|
+
static readonly DISABLED: {
|
|
169
|
+
disabled: {};
|
|
170
|
+
};
|
|
171
|
+
}
|
|
103
172
|
export declare function isVariant(object: unknown, type: string): boolean;
|
|
104
173
|
export declare function isOneOfVariant(object: unknown, types: string[]): boolean;
|
|
174
|
+
export declare function getVariant(object: unknown): string;
|
|
105
175
|
export declare enum TradeSide {
|
|
106
176
|
None = 0,
|
|
107
177
|
Buy = 1,
|
|
108
178
|
Sell = 2
|
|
109
179
|
}
|
|
110
180
|
export declare type CandleResolution = '1' | '5' | '15' | '60' | '240' | 'D' | 'W' | 'M';
|
|
181
|
+
export declare type NewUserRecord = {
|
|
182
|
+
ts: BN;
|
|
183
|
+
userAuthority: PublicKey;
|
|
184
|
+
user: PublicKey;
|
|
185
|
+
userId: number;
|
|
186
|
+
name: number[];
|
|
187
|
+
referrer: PublicKey;
|
|
188
|
+
};
|
|
111
189
|
export declare type DepositRecord = {
|
|
112
190
|
ts: BN;
|
|
113
191
|
userAuthority: PublicKey;
|
|
@@ -116,15 +194,17 @@ export declare type DepositRecord = {
|
|
|
116
194
|
deposit?: any;
|
|
117
195
|
withdraw?: any;
|
|
118
196
|
};
|
|
119
|
-
|
|
197
|
+
marketIndex: number;
|
|
120
198
|
amount: BN;
|
|
199
|
+
oraclePrice: BN;
|
|
200
|
+
referrer: PublicKey;
|
|
121
201
|
from?: PublicKey;
|
|
122
202
|
to?: PublicKey;
|
|
123
203
|
};
|
|
124
204
|
export declare type CurveRecord = {
|
|
125
205
|
ts: BN;
|
|
126
206
|
recordId: BN;
|
|
127
|
-
marketIndex:
|
|
207
|
+
marketIndex: number;
|
|
128
208
|
pegMultiplierBefore: BN;
|
|
129
209
|
baseAssetReserveBefore: BN;
|
|
130
210
|
quoteAssetReserveBefore: BN;
|
|
@@ -140,21 +220,59 @@ export declare type CurveRecord = {
|
|
|
140
220
|
oraclePrice: BN;
|
|
141
221
|
tradeId: BN;
|
|
142
222
|
};
|
|
223
|
+
export declare type InsuranceFundRecord = {
|
|
224
|
+
ts: BN;
|
|
225
|
+
bankIndex: BN;
|
|
226
|
+
marketIndex: number;
|
|
227
|
+
userIfFactor: BN;
|
|
228
|
+
totalIfFactor: BN;
|
|
229
|
+
vaultAmountBefore: BN;
|
|
230
|
+
insuranceVaultAmountBefore: BN;
|
|
231
|
+
amount: BN;
|
|
232
|
+
totalIfSharesBefore: BN;
|
|
233
|
+
totalIfSharesAfter: BN;
|
|
234
|
+
};
|
|
235
|
+
export declare type LPRecord = {
|
|
236
|
+
ts: BN;
|
|
237
|
+
user: PublicKey;
|
|
238
|
+
action: LPAction;
|
|
239
|
+
nShares: BN;
|
|
240
|
+
marketIndex: number;
|
|
241
|
+
deltaBaseAssetAmount: BN;
|
|
242
|
+
deltaQuoteAssetAmount: BN;
|
|
243
|
+
pnl: BN;
|
|
244
|
+
};
|
|
245
|
+
export declare class LPAction {
|
|
246
|
+
static readonly ADD_LIQUIDITY: {
|
|
247
|
+
addLiquidity: {};
|
|
248
|
+
};
|
|
249
|
+
static readonly REMOVE_LIQUIDITY: {
|
|
250
|
+
removeLiquidity: {};
|
|
251
|
+
};
|
|
252
|
+
static readonly SETTLE_LIQUIDITY: {
|
|
253
|
+
settleLiquidity: {};
|
|
254
|
+
};
|
|
255
|
+
}
|
|
143
256
|
export declare type FundingRateRecord = {
|
|
144
257
|
ts: BN;
|
|
145
258
|
recordId: BN;
|
|
146
|
-
marketIndex:
|
|
259
|
+
marketIndex: number;
|
|
147
260
|
fundingRate: BN;
|
|
261
|
+
fundingRateLong: BN;
|
|
262
|
+
fundingRateShort: BN;
|
|
148
263
|
cumulativeFundingRateLong: BN;
|
|
149
264
|
cumulativeFundingRateShort: BN;
|
|
150
265
|
oraclePriceTwap: BN;
|
|
151
266
|
markPriceTwap: BN;
|
|
267
|
+
periodRevenue: BN;
|
|
268
|
+
netBaseAssetAmount: BN;
|
|
269
|
+
netUnsettledLpBaseAssetAmount: BN;
|
|
152
270
|
};
|
|
153
271
|
export declare type FundingPaymentRecord = {
|
|
154
272
|
ts: BN;
|
|
155
273
|
userAuthority: PublicKey;
|
|
156
274
|
user: PublicKey;
|
|
157
|
-
marketIndex:
|
|
275
|
+
marketIndex: number;
|
|
158
276
|
fundingPayment: BN;
|
|
159
277
|
baseAssetAmount: BN;
|
|
160
278
|
userLastCumulativeFunding: BN;
|
|
@@ -164,37 +282,132 @@ export declare type FundingPaymentRecord = {
|
|
|
164
282
|
};
|
|
165
283
|
export declare type LiquidationRecord = {
|
|
166
284
|
ts: BN;
|
|
167
|
-
recordId: BN;
|
|
168
|
-
userAuthority: PublicKey;
|
|
169
285
|
user: PublicKey;
|
|
170
|
-
partial: boolean;
|
|
171
|
-
baseAssetValue: BN;
|
|
172
|
-
baseAssetValueClosed: BN;
|
|
173
|
-
liquidationFee: BN;
|
|
174
|
-
feeToLiquidator: BN;
|
|
175
|
-
feeToInsuranceFund: BN;
|
|
176
286
|
liquidator: PublicKey;
|
|
287
|
+
liquidationType: LiquidationType;
|
|
288
|
+
marginRequirement: BN;
|
|
177
289
|
totalCollateral: BN;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
290
|
+
liquidationId: number;
|
|
291
|
+
canceledOrderIds: BN[];
|
|
292
|
+
liquidatePerp: LiquidatePerpRecord;
|
|
293
|
+
liquidateBorrow: LiquidateBorrowRecord;
|
|
294
|
+
liquidateBorrowForPerpPnl: LiquidateBorrowForPerpPnlRecord;
|
|
295
|
+
liquidatePerpPnlForDeposit: LiquidatePerpPnlForDepositRecord;
|
|
296
|
+
perpBankruptcy: PerpBankruptcyRecord;
|
|
297
|
+
borrowBankruptcy: BorrowBankruptcyRecord;
|
|
298
|
+
};
|
|
299
|
+
export declare class LiquidationType {
|
|
300
|
+
static readonly LIQUIDATE_PERP: {
|
|
301
|
+
liquidatePerp: {};
|
|
302
|
+
};
|
|
303
|
+
static readonly LIQUIDATE_BORROW: {
|
|
304
|
+
liquidateBorrow: {};
|
|
305
|
+
};
|
|
306
|
+
static readonly LIQUIDATE_BORROW_FOR_PERP_PNL: {
|
|
307
|
+
liquidateBorrowForPerpPnl: {};
|
|
308
|
+
};
|
|
309
|
+
static readonly LIQUIDATE_PERP_PNL_FOR_DEPOSIT: {
|
|
310
|
+
liquidatePerpPnlForDeposit: {};
|
|
311
|
+
};
|
|
312
|
+
static readonly PERP_BANKRUPTCY: {
|
|
313
|
+
perpBankruptcy: {};
|
|
314
|
+
};
|
|
315
|
+
static readonly BORROW_BANKRUPTCY: {
|
|
316
|
+
borrowBankruptcy: {};
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
export declare type LiquidatePerpRecord = {
|
|
320
|
+
marketIndex: number;
|
|
321
|
+
oraclePrice: BN;
|
|
322
|
+
baseAssetAmount: BN;
|
|
323
|
+
quoteAssetAmount: BN;
|
|
324
|
+
lpShares: BN;
|
|
325
|
+
userPnl: BN;
|
|
326
|
+
liquidatorPnl: BN;
|
|
327
|
+
userOrderId: BN;
|
|
328
|
+
liquidatorOrderId: BN;
|
|
329
|
+
fillRecordId: BN;
|
|
330
|
+
ifFee: BN;
|
|
331
|
+
};
|
|
332
|
+
export declare type LiquidateBorrowRecord = {
|
|
333
|
+
assetMarketIndex: number;
|
|
334
|
+
assetPrice: BN;
|
|
335
|
+
assetTransfer: BN;
|
|
336
|
+
liabilityMarketIndex: number;
|
|
337
|
+
liabilityPrice: BN;
|
|
338
|
+
liabilityTransfer: BN;
|
|
339
|
+
ifFee: BN;
|
|
340
|
+
};
|
|
341
|
+
export declare type LiquidateBorrowForPerpPnlRecord = {
|
|
342
|
+
perpMarketIndex: number;
|
|
343
|
+
marketOraclePrice: BN;
|
|
344
|
+
pnlTransfer: BN;
|
|
345
|
+
liabilityMarketIndex: number;
|
|
346
|
+
liabilityPrice: BN;
|
|
347
|
+
liabilityTransfer: BN;
|
|
348
|
+
};
|
|
349
|
+
export declare type LiquidatePerpPnlForDepositRecord = {
|
|
350
|
+
perpMarketIndex: number;
|
|
351
|
+
marketOraclePrice: BN;
|
|
352
|
+
pnlTransfer: BN;
|
|
353
|
+
assetMarketIndex: number;
|
|
354
|
+
assetPrice: BN;
|
|
355
|
+
assetTransfer: BN;
|
|
356
|
+
};
|
|
357
|
+
export declare type PerpBankruptcyRecord = {
|
|
358
|
+
marketIndex: number;
|
|
359
|
+
pnl: BN;
|
|
360
|
+
cumulativeFundingRateDelta: BN;
|
|
361
|
+
};
|
|
362
|
+
export declare type BorrowBankruptcyRecord = {
|
|
363
|
+
marketIndex: number;
|
|
364
|
+
borrowAmount: BN;
|
|
365
|
+
cumulativeDepositInterestDelta: BN;
|
|
366
|
+
};
|
|
367
|
+
export declare type SettlePnlRecord = {
|
|
368
|
+
ts: BN;
|
|
369
|
+
user: PublicKey;
|
|
370
|
+
marketIndex: number;
|
|
371
|
+
pnl: BN;
|
|
372
|
+
baseAssetAmount: BN;
|
|
373
|
+
quoteAssetAmountAfter: BN;
|
|
374
|
+
quoteEntryAmount: BN;
|
|
375
|
+
settlePrice: BN;
|
|
181
376
|
};
|
|
182
377
|
export declare type OrderRecord = {
|
|
183
378
|
ts: BN;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
379
|
+
user: PublicKey;
|
|
380
|
+
order: Order;
|
|
381
|
+
};
|
|
382
|
+
export declare type OrderActionRecord = {
|
|
383
|
+
ts: BN;
|
|
188
384
|
action: OrderAction;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
385
|
+
actionExplanation: OrderActionExplanation;
|
|
386
|
+
marketIndex: number;
|
|
387
|
+
marketType: MarketType;
|
|
388
|
+
filler: PublicKey | null;
|
|
389
|
+
fillerReward: BN | null;
|
|
390
|
+
fillRecordId: BN | null;
|
|
391
|
+
baseAssetAmountFilled: BN | null;
|
|
392
|
+
quoteAssetAmountFilled: BN | null;
|
|
393
|
+
takerFee: BN | null;
|
|
394
|
+
makerFee: BN | null;
|
|
395
|
+
referrerReward: number | null;
|
|
396
|
+
quoteAssetAmountSurplus: BN | null;
|
|
397
|
+
taker: PublicKey | null;
|
|
398
|
+
takerOrderId: BN | null;
|
|
399
|
+
takerOrderDirection: PositionDirection | null;
|
|
400
|
+
takerOrderBaseAssetAmount: BN | null;
|
|
401
|
+
takerOrderCumulativeBaseAssetAmountFilled: BN | null;
|
|
402
|
+
takerOrderCumulativeQuoteAssetAmountFilled: BN | null;
|
|
403
|
+
takerOrderFee: BN | null;
|
|
404
|
+
maker: PublicKey | null;
|
|
405
|
+
makerOrderId: BN | null;
|
|
406
|
+
makerOrderDirection: PositionDirection | null;
|
|
407
|
+
makerOrderBaseAssetAmount: BN | null;
|
|
408
|
+
makerOrderCumulativeBaseAssetAmountFilled: BN | null;
|
|
409
|
+
makerOrderCumulativeQuoteAssetAmountFilled: BN | null;
|
|
410
|
+
makerOrderFee: BN | null;
|
|
198
411
|
oraclePrice: BN;
|
|
199
412
|
};
|
|
200
413
|
export declare type StateAccount = {
|
|
@@ -202,34 +415,31 @@ export declare type StateAccount = {
|
|
|
202
415
|
fundingPaused: boolean;
|
|
203
416
|
exchangePaused: boolean;
|
|
204
417
|
adminControlsPrices: boolean;
|
|
205
|
-
insuranceVault: PublicKey;
|
|
206
|
-
insuranceVaultAuthority: PublicKey;
|
|
207
|
-
insuranceVaultNonce: number;
|
|
208
|
-
marginRatioInitial: BN;
|
|
209
|
-
marginRatioMaintenance: BN;
|
|
210
|
-
marginRatioPartial: BN;
|
|
211
|
-
partialLiquidationClosePercentageNumerator: BN;
|
|
212
|
-
partialLiquidationClosePercentageDenominator: BN;
|
|
213
|
-
partialLiquidationPenaltyPercentageNumerator: BN;
|
|
214
|
-
partialLiquidationPenaltyPercentageDenominator: BN;
|
|
215
|
-
fullLiquidationPenaltyPercentageNumerator: BN;
|
|
216
|
-
fullLiquidationPenaltyPercentageDenominator: BN;
|
|
217
|
-
partialLiquidationLiquidatorShareDenominator: BN;
|
|
218
|
-
fullLiquidationLiquidatorShareDenominator: BN;
|
|
219
|
-
feeStructure: FeeStructure;
|
|
220
418
|
totalFee: BN;
|
|
221
419
|
totalFeeWithdrawn: BN;
|
|
222
420
|
whitelistMint: PublicKey;
|
|
223
421
|
discountMint: PublicKey;
|
|
224
422
|
oracleGuardRails: OracleGuardRails;
|
|
225
423
|
maxDeposit: BN;
|
|
226
|
-
numberOfMarkets:
|
|
227
|
-
|
|
424
|
+
numberOfMarkets: number;
|
|
425
|
+
numberOfSpotMarkets: number;
|
|
228
426
|
minOrderQuoteAssetAmount: BN;
|
|
427
|
+
signer: PublicKey;
|
|
428
|
+
signerNonce: number;
|
|
429
|
+
defaultMarketOrderTimeInForce: number;
|
|
430
|
+
minPerpAuctionDuration: number;
|
|
431
|
+
defaultSpotAuctionDuration: number;
|
|
432
|
+
liquidationMarginBufferRatio: number;
|
|
433
|
+
srmVault: PublicKey;
|
|
434
|
+
perpFeeStructure: FeeStructure;
|
|
435
|
+
spotFeeStructure: FeeStructure;
|
|
229
436
|
};
|
|
230
|
-
export declare type
|
|
231
|
-
|
|
232
|
-
|
|
437
|
+
export declare type PerpMarketAccount = {
|
|
438
|
+
status: MarketStatus;
|
|
439
|
+
contractType: ContractType;
|
|
440
|
+
expiryTs: BN;
|
|
441
|
+
settlementPrice: BN;
|
|
442
|
+
marketIndex: number;
|
|
233
443
|
pubkey: PublicKey;
|
|
234
444
|
amm: AMM;
|
|
235
445
|
baseAssetAmount: BN;
|
|
@@ -238,17 +448,53 @@ export declare type MarketAccount = {
|
|
|
238
448
|
openInterest: BN;
|
|
239
449
|
marginRatioInitial: number;
|
|
240
450
|
marginRatioMaintenance: number;
|
|
241
|
-
marginRatioPartial: number;
|
|
242
451
|
nextFillRecordId: BN;
|
|
243
452
|
pnlPool: PoolBalance;
|
|
453
|
+
liquidatorFee: BN;
|
|
454
|
+
ifLiquidationFee: BN;
|
|
455
|
+
imfFactor: BN;
|
|
456
|
+
unrealizedImfFactor: BN;
|
|
457
|
+
unrealizedMaxImbalance: BN;
|
|
458
|
+
unrealizedInitialAssetWeight: number;
|
|
459
|
+
unrealizedMaintenanceAssetWeight: number;
|
|
460
|
+
revenueWithdrawSinceLastSettle: BN;
|
|
461
|
+
maxRevenueWithdrawPerPeriod: BN;
|
|
462
|
+
lastRevenueWithdrawTs: BN;
|
|
463
|
+
quoteSettledInsurance: BN;
|
|
464
|
+
quoteMaxInsurance: BN;
|
|
244
465
|
};
|
|
245
|
-
export declare type
|
|
246
|
-
|
|
466
|
+
export declare type HistoricalOracleData = {
|
|
467
|
+
lastOraclePrice: BN;
|
|
468
|
+
lastOracleDelay: BN;
|
|
469
|
+
lastOracleConf: BN;
|
|
470
|
+
lastOraclePriceTwap: BN;
|
|
471
|
+
lastOraclePriceTwap5min: BN;
|
|
472
|
+
lastOraclePriceTwapTs: BN;
|
|
473
|
+
};
|
|
474
|
+
export declare type HistoricalIndexData = {
|
|
475
|
+
lastIndexBidPrice: BN;
|
|
476
|
+
lastIndexAskPrice: BN;
|
|
477
|
+
lastIndexPriceTwap: BN;
|
|
478
|
+
lastIndexPriceTwap5Min: BN;
|
|
479
|
+
lastIndexPriceTwapTs: BN;
|
|
480
|
+
};
|
|
481
|
+
export declare type SpotMarketAccount = {
|
|
482
|
+
marketIndex: number;
|
|
247
483
|
pubkey: PublicKey;
|
|
248
484
|
mint: PublicKey;
|
|
249
485
|
vault: PublicKey;
|
|
250
|
-
|
|
251
|
-
|
|
486
|
+
oracle: PublicKey;
|
|
487
|
+
oracleSource: OracleSource;
|
|
488
|
+
historicalOracleData: HistoricalOracleData;
|
|
489
|
+
historicalIndexData: HistoricalIndexData;
|
|
490
|
+
insuranceFundVault: PublicKey;
|
|
491
|
+
insuranceWithdrawEscrowPeriod: BN;
|
|
492
|
+
revenuePool: PoolBalance;
|
|
493
|
+
totalIfShares: BN;
|
|
494
|
+
userIfShares: BN;
|
|
495
|
+
userIfFactor: BN;
|
|
496
|
+
totalIfFactor: BN;
|
|
497
|
+
ifLiquidationFee: BN;
|
|
252
498
|
decimals: number;
|
|
253
499
|
optimalUtilization: BN;
|
|
254
500
|
optimalBorrowRate: BN;
|
|
@@ -257,12 +503,24 @@ export declare type BankAccount = {
|
|
|
257
503
|
cumulativeBorrowInterest: BN;
|
|
258
504
|
depositBalance: BN;
|
|
259
505
|
borrowBalance: BN;
|
|
260
|
-
|
|
261
|
-
|
|
506
|
+
lastInterestTs: BN;
|
|
507
|
+
lastTwapTs: BN;
|
|
262
508
|
initialAssetWeight: BN;
|
|
263
509
|
maintenanceAssetWeight: BN;
|
|
264
510
|
initialLiabilityWeight: BN;
|
|
265
511
|
maintenanceLiabilityWeight: BN;
|
|
512
|
+
liquidatorFee: BN;
|
|
513
|
+
imfFactor: BN;
|
|
514
|
+
withdrawGuardThreshold: BN;
|
|
515
|
+
depositTokenTwap: BN;
|
|
516
|
+
borrowTokenTwap: BN;
|
|
517
|
+
utilizationTwap: BN;
|
|
518
|
+
orderStepSize: BN;
|
|
519
|
+
nextFillRecordId: BN;
|
|
520
|
+
spotFeePool: {
|
|
521
|
+
balance: BN;
|
|
522
|
+
};
|
|
523
|
+
totalSpotFee: BN;
|
|
266
524
|
};
|
|
267
525
|
export declare type PoolBalance = {
|
|
268
526
|
balance: BN;
|
|
@@ -274,24 +532,31 @@ export declare type AMM = {
|
|
|
274
532
|
lastFundingRate: BN;
|
|
275
533
|
lastFundingRateTs: BN;
|
|
276
534
|
lastMarkPriceTwap: BN;
|
|
535
|
+
lastMarkPriceTwap5min: BN;
|
|
277
536
|
lastMarkPriceTwapTs: BN;
|
|
278
|
-
lastOraclePriceTwap: BN;
|
|
279
|
-
lastOraclePriceTwapTs: BN;
|
|
280
537
|
oracle: PublicKey;
|
|
281
538
|
oracleSource: OracleSource;
|
|
539
|
+
historicalOracleData: HistoricalOracleData;
|
|
540
|
+
lastOracleMarkSpreadPct: BN;
|
|
541
|
+
lastOracleConfPct: BN;
|
|
282
542
|
fundingPeriod: BN;
|
|
283
543
|
quoteAssetReserve: BN;
|
|
284
544
|
pegMultiplier: BN;
|
|
285
545
|
cumulativeFundingRateLong: BN;
|
|
286
546
|
cumulativeFundingRateShort: BN;
|
|
287
|
-
|
|
288
|
-
cumulativeRepegRebateShort: BN;
|
|
547
|
+
cumulativeFundingRateLp: BN;
|
|
289
548
|
totalFeeMinusDistributions: BN;
|
|
290
549
|
totalFeeWithdrawn: BN;
|
|
291
550
|
totalFee: BN;
|
|
551
|
+
cumulativeFundingPaymentPerLp: BN;
|
|
552
|
+
cumulativeFeePerLp: BN;
|
|
553
|
+
cumulativeNetBaseAssetAmountPerLp: BN;
|
|
554
|
+
userLpShares: BN;
|
|
555
|
+
netUnsettledLpBaseAssetAmount: BN;
|
|
292
556
|
minimumQuoteAssetTradeSize: BN;
|
|
293
557
|
baseAssetAmountStepSize: BN;
|
|
294
|
-
|
|
558
|
+
maxBaseAssetAmountRatio: number;
|
|
559
|
+
maxSlippageRatio: number;
|
|
295
560
|
baseSpread: number;
|
|
296
561
|
curveUpdateIntensity: number;
|
|
297
562
|
netBaseAssetAmount: BN;
|
|
@@ -303,53 +568,87 @@ export declare type AMM = {
|
|
|
303
568
|
totalMmFee: BN;
|
|
304
569
|
netRevenueSinceLastFunding: BN;
|
|
305
570
|
lastUpdateSlot: BN;
|
|
571
|
+
lastOracleValid: boolean;
|
|
306
572
|
lastBidPriceTwap: BN;
|
|
307
573
|
lastAskPriceTwap: BN;
|
|
308
574
|
longSpread: BN;
|
|
309
575
|
shortSpread: BN;
|
|
310
576
|
maxSpread: number;
|
|
577
|
+
marketPosition: PerpPosition;
|
|
578
|
+
marketPositionPerLp: PerpPosition;
|
|
579
|
+
ammJitIntensity: number;
|
|
580
|
+
maxBaseAssetReserve: BN;
|
|
581
|
+
minBaseAssetReserve: BN;
|
|
582
|
+
cumulativeSocialLoss: BN;
|
|
311
583
|
};
|
|
312
|
-
export declare type
|
|
584
|
+
export declare type PerpPosition = {
|
|
313
585
|
baseAssetAmount: BN;
|
|
586
|
+
remainderBaseAssetAmount: BN;
|
|
314
587
|
lastCumulativeFundingRate: BN;
|
|
315
|
-
marketIndex:
|
|
588
|
+
marketIndex: number;
|
|
316
589
|
quoteAssetAmount: BN;
|
|
317
590
|
quoteEntryAmount: BN;
|
|
318
|
-
openOrders:
|
|
319
|
-
unsettledPnl: BN;
|
|
591
|
+
openOrders: number;
|
|
320
592
|
openBids: BN;
|
|
321
593
|
openAsks: BN;
|
|
594
|
+
settledPnl: BN;
|
|
595
|
+
lpShares: BN;
|
|
596
|
+
lastFeePerLp: BN;
|
|
597
|
+
lastNetBaseAssetAmountPerLp: BN;
|
|
598
|
+
lastNetQuoteAssetAmountPerLp: BN;
|
|
322
599
|
};
|
|
323
|
-
export declare type
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
600
|
+
export declare type UserStatsAccount = {
|
|
601
|
+
numberOfUsers: number;
|
|
602
|
+
makerVolume30D: BN;
|
|
603
|
+
takerVolume30D: BN;
|
|
604
|
+
fillerVolume30D: BN;
|
|
605
|
+
lastMakerVolume30DTs: BN;
|
|
606
|
+
lastTakerVolume30DTs: BN;
|
|
607
|
+
lastFillerVolume30DTs: BN;
|
|
330
608
|
fees: {
|
|
331
609
|
totalFeePaid: BN;
|
|
332
610
|
totalFeeRebate: BN;
|
|
333
611
|
totalTokenDiscount: BN;
|
|
334
|
-
totalReferralReward: BN;
|
|
335
612
|
totalRefereeDiscount: BN;
|
|
336
613
|
};
|
|
337
|
-
|
|
614
|
+
referrer: PublicKey;
|
|
615
|
+
isReferrer: boolean;
|
|
616
|
+
totalReferrerReward: BN;
|
|
617
|
+
authority: PublicKey;
|
|
618
|
+
stakedQuoteAssetAmount: BN;
|
|
619
|
+
};
|
|
620
|
+
export declare type UserAccount = {
|
|
621
|
+
authority: PublicKey;
|
|
622
|
+
delegate: PublicKey;
|
|
623
|
+
name: number[];
|
|
624
|
+
userId: number;
|
|
625
|
+
spotPositions: SpotPosition[];
|
|
626
|
+
perpPositions: PerpPosition[];
|
|
338
627
|
orders: Order[];
|
|
628
|
+
beingLiquidated: boolean;
|
|
629
|
+
bankrupt: boolean;
|
|
630
|
+
nextLiquidationId: number;
|
|
631
|
+
nextOrderId: BN;
|
|
632
|
+
customMarginRatio: number;
|
|
339
633
|
};
|
|
340
|
-
export declare type
|
|
341
|
-
|
|
342
|
-
balanceType:
|
|
634
|
+
export declare type SpotPosition = {
|
|
635
|
+
marketIndex: number;
|
|
636
|
+
balanceType: SpotBalanceType;
|
|
343
637
|
balance: BN;
|
|
638
|
+
openOrders: number;
|
|
639
|
+
openBids: BN;
|
|
640
|
+
openAsks: BN;
|
|
641
|
+
cumulativeDeposits: BN;
|
|
344
642
|
};
|
|
345
643
|
export declare type Order = {
|
|
346
644
|
status: OrderStatus;
|
|
347
645
|
orderType: OrderType;
|
|
646
|
+
marketType: MarketType;
|
|
348
647
|
ts: BN;
|
|
349
648
|
slot: BN;
|
|
350
649
|
orderId: BN;
|
|
351
650
|
userOrderId: number;
|
|
352
|
-
marketIndex:
|
|
651
|
+
marketIndex: number;
|
|
353
652
|
price: BN;
|
|
354
653
|
baseAssetAmount: BN;
|
|
355
654
|
baseAssetAmountFilled: BN;
|
|
@@ -361,24 +660,23 @@ export declare type Order = {
|
|
|
361
660
|
triggerPrice: BN;
|
|
362
661
|
triggerCondition: OrderTriggerCondition;
|
|
363
662
|
triggered: boolean;
|
|
364
|
-
discountTier: OrderDiscountTier;
|
|
365
663
|
existingPositionDirection: PositionDirection;
|
|
366
|
-
referrer: PublicKey;
|
|
367
664
|
postOnly: boolean;
|
|
368
665
|
immediateOrCancel: boolean;
|
|
369
666
|
oraclePriceOffset: BN;
|
|
370
667
|
auctionDuration: number;
|
|
371
668
|
auctionStartPrice: BN;
|
|
372
669
|
auctionEndPrice: BN;
|
|
670
|
+
timeInForce: number;
|
|
373
671
|
};
|
|
374
672
|
export declare type OrderParams = {
|
|
375
673
|
orderType: OrderType;
|
|
674
|
+
marketType: MarketType;
|
|
376
675
|
userOrderId: number;
|
|
377
676
|
direction: PositionDirection;
|
|
378
|
-
quoteAssetAmount: BN;
|
|
379
677
|
baseAssetAmount: BN;
|
|
380
678
|
price: BN;
|
|
381
|
-
marketIndex:
|
|
679
|
+
marketIndex: number;
|
|
382
680
|
reduceOnly: boolean;
|
|
383
681
|
postOnly: boolean;
|
|
384
682
|
immediateOrCancel: boolean;
|
|
@@ -386,56 +684,88 @@ export declare type OrderParams = {
|
|
|
386
684
|
triggerCondition: OrderTriggerCondition;
|
|
387
685
|
positionLimit: BN;
|
|
388
686
|
oraclePriceOffset: BN;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
687
|
+
auctionDuration: number | null;
|
|
688
|
+
timeInForce: number | null;
|
|
689
|
+
auctionStartPrice: BN | null;
|
|
690
|
+
};
|
|
691
|
+
export declare type NecessaryOrderParams = {
|
|
692
|
+
orderType: OrderType;
|
|
693
|
+
marketIndex: number;
|
|
694
|
+
baseAssetAmount: BN;
|
|
695
|
+
direction: PositionDirection;
|
|
696
|
+
};
|
|
697
|
+
export declare type OptionalOrderParams = {
|
|
698
|
+
[Property in keyof OrderParams]?: OrderParams[Property];
|
|
699
|
+
} & NecessaryOrderParams;
|
|
700
|
+
export declare const DefaultOrderParams: {
|
|
701
|
+
orderType: {
|
|
702
|
+
market: {};
|
|
703
|
+
};
|
|
704
|
+
marketType: {
|
|
705
|
+
perp: {};
|
|
706
|
+
};
|
|
707
|
+
userOrderId: number;
|
|
708
|
+
direction: {
|
|
709
|
+
long: {};
|
|
394
710
|
};
|
|
711
|
+
baseAssetAmount: BN;
|
|
712
|
+
price: BN;
|
|
713
|
+
marketIndex: number;
|
|
714
|
+
reduceOnly: boolean;
|
|
715
|
+
postOnly: boolean;
|
|
716
|
+
immediateOrCancel: boolean;
|
|
717
|
+
triggerPrice: BN;
|
|
718
|
+
triggerCondition: {
|
|
719
|
+
above: {};
|
|
720
|
+
};
|
|
721
|
+
positionLimit: BN;
|
|
722
|
+
oraclePriceOffset: BN;
|
|
723
|
+
auctionDuration: any;
|
|
724
|
+
timeInForce: any;
|
|
725
|
+
auctionStartPrice: any;
|
|
395
726
|
};
|
|
396
727
|
export declare type MakerInfo = {
|
|
397
728
|
maker: PublicKey;
|
|
729
|
+
makerStats: PublicKey;
|
|
398
730
|
order: Order;
|
|
399
731
|
};
|
|
732
|
+
export declare type TakerInfo = {
|
|
733
|
+
taker: PublicKey;
|
|
734
|
+
takerStats: PublicKey;
|
|
735
|
+
takerUserAccount: UserAccount;
|
|
736
|
+
order: Order;
|
|
737
|
+
};
|
|
738
|
+
export declare type ReferrerInfo = {
|
|
739
|
+
referrer: PublicKey;
|
|
740
|
+
referrerStats: PublicKey;
|
|
741
|
+
};
|
|
400
742
|
export interface IWallet {
|
|
401
743
|
signTransaction(tx: Transaction): Promise<Transaction>;
|
|
402
744
|
signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;
|
|
403
745
|
publicKey: PublicKey;
|
|
404
746
|
}
|
|
405
747
|
export declare type FeeStructure = {
|
|
406
|
-
|
|
407
|
-
feeDenominator: BN;
|
|
408
|
-
discountTokenTiers: {
|
|
409
|
-
firstTier: {
|
|
410
|
-
minimumBalance: BN;
|
|
411
|
-
discountNumerator: BN;
|
|
412
|
-
discountDenominator: BN;
|
|
413
|
-
};
|
|
414
|
-
secondTier: {
|
|
415
|
-
minimumBalance: BN;
|
|
416
|
-
discountNumerator: BN;
|
|
417
|
-
discountDenominator: BN;
|
|
418
|
-
};
|
|
419
|
-
thirdTier: {
|
|
420
|
-
minimumBalance: BN;
|
|
421
|
-
discountNumerator: BN;
|
|
422
|
-
discountDenominator: BN;
|
|
423
|
-
};
|
|
424
|
-
fourthTier: {
|
|
425
|
-
minimumBalance: BN;
|
|
426
|
-
discountNumerator: BN;
|
|
427
|
-
discountDenominator: BN;
|
|
428
|
-
};
|
|
429
|
-
};
|
|
430
|
-
referralDiscount: {
|
|
431
|
-
referrerRewardNumerator: BN;
|
|
432
|
-
referrerRewardDenominator: BN;
|
|
433
|
-
refereeDiscountNumerator: BN;
|
|
434
|
-
refereeDiscountDenominator: BN;
|
|
435
|
-
};
|
|
748
|
+
feeTiers: FeeTier[];
|
|
436
749
|
makerRebateNumerator: BN;
|
|
437
750
|
makerRebateDenominator: BN;
|
|
438
751
|
fillerRewardStructure: OrderFillerRewardStructure;
|
|
752
|
+
flatFillerFee: BN;
|
|
753
|
+
referrerRewardEpochUpperBound: BN;
|
|
754
|
+
};
|
|
755
|
+
export declare type FeeTier = {
|
|
756
|
+
feeNumerator: number;
|
|
757
|
+
feeDenominator: number;
|
|
758
|
+
makerRebateNumerator: number;
|
|
759
|
+
makerRebateDenominator: number;
|
|
760
|
+
referrerRewardNumerator: number;
|
|
761
|
+
referrerRewardDenominator: number;
|
|
762
|
+
refereeFeeNumerator: number;
|
|
763
|
+
refereeFeeDenominator: number;
|
|
764
|
+
};
|
|
765
|
+
export declare type OrderFillerRewardStructure = {
|
|
766
|
+
rewardNumerator: BN;
|
|
767
|
+
rewardDenominator: BN;
|
|
768
|
+
timeBasedRewardLowerBound: BN;
|
|
439
769
|
};
|
|
440
770
|
export declare type OracleGuardRails = {
|
|
441
771
|
priceDivergence: {
|
|
@@ -443,15 +773,36 @@ export declare type OracleGuardRails = {
|
|
|
443
773
|
markOracleDivergenceDenominator: BN;
|
|
444
774
|
};
|
|
445
775
|
validity: {
|
|
446
|
-
|
|
776
|
+
slotsBeforeStaleForAmm: BN;
|
|
777
|
+
slotsBeforeStaleForMargin: BN;
|
|
447
778
|
confidenceIntervalMaxSize: BN;
|
|
448
779
|
tooVolatileRatio: BN;
|
|
449
780
|
};
|
|
450
781
|
useForLiquidations: boolean;
|
|
451
782
|
};
|
|
452
|
-
export declare type
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
783
|
+
export declare type MarginCategory = 'Initial' | 'Maintenance';
|
|
784
|
+
export declare type InsuranceFundStake = {
|
|
785
|
+
marketIndex: number;
|
|
786
|
+
authority: PublicKey;
|
|
787
|
+
ifShares: BN;
|
|
788
|
+
ifBase: BN;
|
|
789
|
+
lastWithdrawRequestShares: BN;
|
|
790
|
+
lastWithdrawRequestValue: BN;
|
|
791
|
+
lastWithdrawRequestTs: BN;
|
|
792
|
+
};
|
|
793
|
+
export declare type SerumV3FulfillmentConfigAccount = {
|
|
794
|
+
fulfillmentType: SpotFulfillmentType;
|
|
795
|
+
status: SpotFulfillmentStatus;
|
|
796
|
+
pubkey: PublicKey;
|
|
797
|
+
marketIndex: number;
|
|
798
|
+
serumProgramId: PublicKey;
|
|
799
|
+
serumMarket: PublicKey;
|
|
800
|
+
serumRequestQueue: PublicKey;
|
|
801
|
+
serumEventQueue: PublicKey;
|
|
802
|
+
serumBids: PublicKey;
|
|
803
|
+
serumAsks: PublicKey;
|
|
804
|
+
serumBaseVault: PublicKey;
|
|
805
|
+
serumQuoteVault: PublicKey;
|
|
806
|
+
serumOpenOrders: PublicKey;
|
|
807
|
+
serumSignerNonce: BN;
|
|
456
808
|
};
|
|
457
|
-
export declare type MarginCategory = 'Initial' | 'Partial' | 'Maintenance';
|