@drift-labs/sdk 0.2.0-master.24 → 0.2.0-master.25
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/lib/addresses/pda.d.ts +1 -0
- package/lib/addresses/pda.js +5 -1
- package/lib/admin.js +7 -12
- package/lib/clearingHouse.d.ts +2 -0
- package/lib/clearingHouse.js +12 -5
- package/lib/clearingHouseUser.d.ts +3 -1
- package/lib/clearingHouseUser.js +6 -4
- package/lib/config.js +1 -1
- 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/types.d.ts +3 -2
- package/lib/events/types.js +1 -0
- package/lib/examples/makeTradeExample.js +13 -1
- package/lib/idl/clearing_house.json +97 -45
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/math/amm.d.ts +3 -1
- package/lib/math/amm.js +41 -3
- package/lib/types.d.ts +25 -6
- package/lib/types.js +7 -1
- package/package.json +1 -1
- package/src/addresses/pda.ts +9 -0
- package/src/admin.ts +11 -30
- package/src/clearingHouse.ts +17 -5
- package/src/clearingHouseUser.ts +6 -5
- package/src/config.ts +1 -1
- package/src/events/eventSubscriber.ts +20 -12
- package/src/events/fetchLogs.ts +35 -8
- package/src/events/pollingLogProvider.ts +10 -2
- package/src/events/types.ts +4 -1
- package/src/examples/makeTradeExample.ts +20 -1
- package/src/idl/clearing_house.json +97 -45
- package/src/index.ts +1 -0
- package/src/math/amm.ts +67 -2
- package/src/types.ts +21 -6
package/src/types.ts
CHANGED
|
@@ -148,6 +148,23 @@ export type CurveRecord = {
|
|
|
148
148
|
tradeId: BN;
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
+
export type LPRecord = {
|
|
152
|
+
ts: BN;
|
|
153
|
+
user: PublicKey;
|
|
154
|
+
action: LPAction;
|
|
155
|
+
nShares: BN;
|
|
156
|
+
marketIndex: BN;
|
|
157
|
+
deltaBaseAssetAmount: BN;
|
|
158
|
+
deltaQuoteAssetAmount: BN;
|
|
159
|
+
pnl: BN;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export class LPAction {
|
|
163
|
+
static readonly ADD_LIQUIDITY = { addLiquidity: {} };
|
|
164
|
+
static readonly REMOVE_LIQUIDITY = { removeLiquidity: {} };
|
|
165
|
+
static readonly SETTLE_LIQUIDITY = { settleLiquidity: {} };
|
|
166
|
+
}
|
|
167
|
+
|
|
151
168
|
export type FundingRateRecord = {
|
|
152
169
|
ts: BN;
|
|
153
170
|
recordId: BN;
|
|
@@ -216,6 +233,7 @@ export type LiquidatePerpRecord = {
|
|
|
216
233
|
oraclePrice: BN;
|
|
217
234
|
baseAssetAmount: BN;
|
|
218
235
|
quoteAssetAmount: BN;
|
|
236
|
+
lpShares: BN;
|
|
219
237
|
userPnl: BN;
|
|
220
238
|
liquidatorPnl: BN;
|
|
221
239
|
canceledOrdersFee: BN;
|
|
@@ -319,8 +337,6 @@ export type StateAccount = {
|
|
|
319
337
|
exchangePaused: boolean;
|
|
320
338
|
adminControlsPrices: boolean;
|
|
321
339
|
insuranceVault: PublicKey;
|
|
322
|
-
insuranceVaultAuthority: PublicKey;
|
|
323
|
-
insuranceVaultNonce: number;
|
|
324
340
|
marginRatioInitial: BN;
|
|
325
341
|
marginRatioMaintenance: BN;
|
|
326
342
|
marginRatioPartial: BN;
|
|
@@ -342,6 +358,8 @@ export type StateAccount = {
|
|
|
342
358
|
numberOfMarkets: BN;
|
|
343
359
|
numberOfBanks: BN;
|
|
344
360
|
minOrderQuoteAssetAmount: BN;
|
|
361
|
+
signer: PublicKey;
|
|
362
|
+
signerNonce: number;
|
|
345
363
|
maxAuctionDuration: number;
|
|
346
364
|
minAuctionDuration: number;
|
|
347
365
|
};
|
|
@@ -371,12 +389,8 @@ export type BankAccount = {
|
|
|
371
389
|
pubkey: PublicKey;
|
|
372
390
|
mint: PublicKey;
|
|
373
391
|
vault: PublicKey;
|
|
374
|
-
vaultAuthority: PublicKey;
|
|
375
|
-
vaultAuthorityNonce: number;
|
|
376
392
|
|
|
377
393
|
insuranceFundVault: PublicKey;
|
|
378
|
-
insuranceFundVaultAuthority: PublicKey;
|
|
379
|
-
insuranceFundVaultAuthorityNonce: number;
|
|
380
394
|
insuranceWithdrawEscrowPeriod: BN;
|
|
381
395
|
revenuePool: PoolBalance;
|
|
382
396
|
|
|
@@ -446,6 +460,7 @@ export type AMM = {
|
|
|
446
460
|
cumulativeFeePerLp: BN;
|
|
447
461
|
cumulativeNetBaseAssetAmountPerLp: BN;
|
|
448
462
|
userLpShares: BN;
|
|
463
|
+
netUnsettledLpBaseAssetAmount: BN;
|
|
449
464
|
minimumQuoteAssetTradeSize: BN;
|
|
450
465
|
baseAssetAmountStepSize: BN;
|
|
451
466
|
maxBaseAssetAmountRatio: number;
|