@drift-labs/sdk 2.74.0-beta.9 → 2.75.0-beta.1
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 +14 -3
- package/lib/adminClient.js +309 -119
- package/lib/constants/perpMarkets.js +10 -0
- package/lib/driftClient.js +3 -1
- package/lib/idl/drift.json +89 -1
- package/package.json +1 -1
- package/src/adminClient.ts +590 -209
- package/src/constants/perpMarkets.ts +10 -0
- package/src/driftClient.ts +3 -1
- package/src/idl/drift.json +89 -1
package/src/adminClient.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PublicKey,
|
|
3
3
|
SYSVAR_RENT_PUBKEY,
|
|
4
|
+
TransactionInstruction,
|
|
4
5
|
TransactionSignature,
|
|
5
6
|
} from '@solana/web3.js';
|
|
6
7
|
import {
|
|
@@ -31,7 +32,13 @@ import {
|
|
|
31
32
|
import { squareRootBN } from './math/utils';
|
|
32
33
|
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
33
34
|
import { DriftClient } from './driftClient';
|
|
34
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
PEG_PRECISION,
|
|
37
|
+
ZERO,
|
|
38
|
+
ONE,
|
|
39
|
+
BASE_PRECISION,
|
|
40
|
+
PRICE_PRECISION,
|
|
41
|
+
} from './constants/numericConstants';
|
|
35
42
|
import { calculateTargetPriceTrade } from './math/trade';
|
|
36
43
|
import { calculateAmmReservesAfterSwap, getSwapDirection } from './math/amm';
|
|
37
44
|
import { PROGRAM_ID as PHOENIX_PROGRAM_ID } from '@ellipsis-labs/phoenix-sdk';
|
|
@@ -54,7 +61,9 @@ export class AdminClient extends DriftClient {
|
|
|
54
61
|
|
|
55
62
|
const initializeIx = await this.program.instruction.initialize({
|
|
56
63
|
accounts: {
|
|
57
|
-
admin: this.
|
|
64
|
+
admin: this.isSubscribed
|
|
65
|
+
? this.getStateAccount().admin
|
|
66
|
+
: this.wallet.publicKey,
|
|
58
67
|
state: driftStatePublicKey,
|
|
59
68
|
quoteAssetMint: usdcMint,
|
|
60
69
|
rent: SYSVAR_RENT_PUBKEY,
|
|
@@ -84,10 +93,82 @@ export class AdminClient extends DriftClient {
|
|
|
84
93
|
maintenanceLiabilityWeight: number,
|
|
85
94
|
imfFactor = 0,
|
|
86
95
|
liquidatorFee = 0,
|
|
96
|
+
ifLiquidationFee = 0,
|
|
87
97
|
activeStatus = true,
|
|
98
|
+
assetTier = AssetTier.COLLATERAL,
|
|
99
|
+
scaleInitialAssetWeightStart = ZERO,
|
|
100
|
+
withdrawGuardThreshold = ZERO,
|
|
101
|
+
orderTickSize = ONE,
|
|
102
|
+
orderStepSize = ONE,
|
|
103
|
+
ifTotalFactor = 0,
|
|
88
104
|
name = DEFAULT_MARKET_NAME
|
|
89
105
|
): Promise<TransactionSignature> {
|
|
90
106
|
const spotMarketIndex = this.getStateAccount().numberOfSpotMarkets;
|
|
107
|
+
|
|
108
|
+
const initializeIx = await this.getInitializeSpotMarketIx(
|
|
109
|
+
mint,
|
|
110
|
+
optimalUtilization,
|
|
111
|
+
optimalRate,
|
|
112
|
+
maxRate,
|
|
113
|
+
oracle,
|
|
114
|
+
oracleSource,
|
|
115
|
+
initialAssetWeight,
|
|
116
|
+
maintenanceAssetWeight,
|
|
117
|
+
initialLiabilityWeight,
|
|
118
|
+
maintenanceLiabilityWeight,
|
|
119
|
+
imfFactor,
|
|
120
|
+
liquidatorFee,
|
|
121
|
+
ifLiquidationFee,
|
|
122
|
+
activeStatus,
|
|
123
|
+
assetTier,
|
|
124
|
+
scaleInitialAssetWeightStart,
|
|
125
|
+
withdrawGuardThreshold,
|
|
126
|
+
orderTickSize,
|
|
127
|
+
orderStepSize,
|
|
128
|
+
ifTotalFactor,
|
|
129
|
+
name
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const tx = await this.buildTransaction(initializeIx);
|
|
133
|
+
|
|
134
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
135
|
+
|
|
136
|
+
// const { txSig } = await this.sendTransaction(initializeTx, [], this.opts);
|
|
137
|
+
|
|
138
|
+
await this.accountSubscriber.addSpotMarket(spotMarketIndex);
|
|
139
|
+
await this.accountSubscriber.addOracle({
|
|
140
|
+
source: oracleSource,
|
|
141
|
+
publicKey: oracle,
|
|
142
|
+
});
|
|
143
|
+
await this.accountSubscriber.setSpotOracleMap();
|
|
144
|
+
|
|
145
|
+
return txSig;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public async getInitializeSpotMarketIx(
|
|
149
|
+
mint: PublicKey,
|
|
150
|
+
optimalUtilization: number,
|
|
151
|
+
optimalRate: number,
|
|
152
|
+
maxRate: number,
|
|
153
|
+
oracle: PublicKey,
|
|
154
|
+
oracleSource: OracleSource,
|
|
155
|
+
initialAssetWeight: number,
|
|
156
|
+
maintenanceAssetWeight: number,
|
|
157
|
+
initialLiabilityWeight: number,
|
|
158
|
+
maintenanceLiabilityWeight: number,
|
|
159
|
+
imfFactor = 0,
|
|
160
|
+
liquidatorFee = 0,
|
|
161
|
+
ifLiquidationFee = 0,
|
|
162
|
+
activeStatus = true,
|
|
163
|
+
assetTier = AssetTier.COLLATERAL,
|
|
164
|
+
scaleInitialAssetWeightStart = ZERO,
|
|
165
|
+
withdrawGuardThreshold = ZERO,
|
|
166
|
+
orderTickSize = ONE,
|
|
167
|
+
orderStepSize = ONE,
|
|
168
|
+
ifTotalFactor = 0,
|
|
169
|
+
name = DEFAULT_MARKET_NAME
|
|
170
|
+
): Promise<TransactionInstruction> {
|
|
171
|
+
const spotMarketIndex = this.getStateAccount().numberOfSpotMarkets;
|
|
91
172
|
const spotMarket = await getSpotMarketPublicKey(
|
|
92
173
|
this.program.programId,
|
|
93
174
|
spotMarketIndex
|
|
@@ -115,11 +196,20 @@ export class AdminClient extends DriftClient {
|
|
|
115
196
|
maintenanceLiabilityWeight,
|
|
116
197
|
imfFactor,
|
|
117
198
|
liquidatorFee,
|
|
199
|
+
ifLiquidationFee,
|
|
118
200
|
activeStatus,
|
|
201
|
+
assetTier,
|
|
202
|
+
scaleInitialAssetWeightStart,
|
|
203
|
+
withdrawGuardThreshold,
|
|
204
|
+
orderTickSize,
|
|
205
|
+
orderStepSize,
|
|
206
|
+
ifTotalFactor,
|
|
119
207
|
nameBuffer,
|
|
120
208
|
{
|
|
121
209
|
accounts: {
|
|
122
|
-
admin: this.
|
|
210
|
+
admin: this.isSubscribed
|
|
211
|
+
? this.getStateAccount().admin
|
|
212
|
+
: this.wallet.publicKey,
|
|
123
213
|
state: await this.getStatePublicKey(),
|
|
124
214
|
spotMarket,
|
|
125
215
|
spotMarketVault,
|
|
@@ -134,27 +224,32 @@ export class AdminClient extends DriftClient {
|
|
|
134
224
|
}
|
|
135
225
|
);
|
|
136
226
|
|
|
137
|
-
|
|
227
|
+
return initializeIx;
|
|
228
|
+
}
|
|
138
229
|
|
|
139
|
-
|
|
230
|
+
public async initializeSerumFulfillmentConfig(
|
|
231
|
+
marketIndex: number,
|
|
232
|
+
serumMarket: PublicKey,
|
|
233
|
+
serumProgram: PublicKey
|
|
234
|
+
): Promise<TransactionSignature> {
|
|
235
|
+
const initializeIx = await this.getInitializeSerumFulfillmentConfigIx(
|
|
236
|
+
marketIndex,
|
|
237
|
+
serumMarket,
|
|
238
|
+
serumProgram
|
|
239
|
+
);
|
|
140
240
|
|
|
141
|
-
|
|
241
|
+
const tx = await this.buildTransaction(initializeIx);
|
|
142
242
|
|
|
143
|
-
await this.
|
|
144
|
-
await this.accountSubscriber.addOracle({
|
|
145
|
-
source: oracleSource,
|
|
146
|
-
publicKey: oracle,
|
|
147
|
-
});
|
|
148
|
-
await this.accountSubscriber.setSpotOracleMap();
|
|
243
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
149
244
|
|
|
150
245
|
return txSig;
|
|
151
246
|
}
|
|
152
247
|
|
|
153
|
-
public async
|
|
248
|
+
public async getInitializeSerumFulfillmentConfigIx(
|
|
154
249
|
marketIndex: number,
|
|
155
250
|
serumMarket: PublicKey,
|
|
156
251
|
serumProgram: PublicKey
|
|
157
|
-
): Promise<
|
|
252
|
+
): Promise<TransactionInstruction> {
|
|
158
253
|
const serumOpenOrders = getSerumOpenOrdersPublicKey(
|
|
159
254
|
this.program.programId,
|
|
160
255
|
serumMarket
|
|
@@ -165,25 +260,36 @@ export class AdminClient extends DriftClient {
|
|
|
165
260
|
serumMarket
|
|
166
261
|
);
|
|
167
262
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
263
|
+
return await this.program.instruction.initializeSerumFulfillmentConfig(
|
|
264
|
+
marketIndex,
|
|
265
|
+
{
|
|
266
|
+
accounts: {
|
|
267
|
+
admin: this.isSubscribed
|
|
268
|
+
? this.getStateAccount().admin
|
|
269
|
+
: this.wallet.publicKey,
|
|
270
|
+
state: await this.getStatePublicKey(),
|
|
271
|
+
baseSpotMarket: this.getSpotMarketAccount(marketIndex).pubkey,
|
|
272
|
+
quoteSpotMarket: this.getQuoteSpotMarketAccount().pubkey,
|
|
273
|
+
driftSigner: this.getSignerPublicKey(),
|
|
274
|
+
serumProgram,
|
|
275
|
+
serumMarket,
|
|
276
|
+
serumOpenOrders,
|
|
277
|
+
rent: SYSVAR_RENT_PUBKEY,
|
|
278
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
279
|
+
serumFulfillmentConfig,
|
|
280
|
+
},
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
public async initializePhoenixFulfillmentConfig(
|
|
286
|
+
marketIndex: number,
|
|
287
|
+
phoenixMarket: PublicKey
|
|
288
|
+
): Promise<TransactionSignature> {
|
|
289
|
+
const initializeIx = await this.getInitializePhoenixFulfillmentConfigIx(
|
|
290
|
+
marketIndex,
|
|
291
|
+
phoenixMarket
|
|
292
|
+
);
|
|
187
293
|
|
|
188
294
|
const tx = await this.buildTransaction(initializeIx);
|
|
189
295
|
|
|
@@ -192,39 +298,34 @@ export class AdminClient extends DriftClient {
|
|
|
192
298
|
return txSig;
|
|
193
299
|
}
|
|
194
300
|
|
|
195
|
-
public async
|
|
301
|
+
public async getInitializePhoenixFulfillmentConfigIx(
|
|
196
302
|
marketIndex: number,
|
|
197
303
|
phoenixMarket: PublicKey
|
|
198
|
-
): Promise<
|
|
304
|
+
): Promise<TransactionInstruction> {
|
|
199
305
|
const phoenixFulfillmentConfig = getPhoenixFulfillmentConfigPublicKey(
|
|
200
306
|
this.program.programId,
|
|
201
307
|
phoenixMarket
|
|
202
308
|
);
|
|
203
309
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const tx = await this.buildTransaction(initializeIx);
|
|
224
|
-
|
|
225
|
-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
226
|
-
|
|
227
|
-
return txSig;
|
|
310
|
+
return await this.program.instruction.initializePhoenixFulfillmentConfig(
|
|
311
|
+
marketIndex,
|
|
312
|
+
{
|
|
313
|
+
accounts: {
|
|
314
|
+
admin: this.isSubscribed
|
|
315
|
+
? this.getStateAccount().admin
|
|
316
|
+
: this.wallet.publicKey,
|
|
317
|
+
state: await this.getStatePublicKey(),
|
|
318
|
+
baseSpotMarket: this.getSpotMarketAccount(marketIndex).pubkey,
|
|
319
|
+
quoteSpotMarket: this.getQuoteSpotMarketAccount().pubkey,
|
|
320
|
+
driftSigner: this.getSignerPublicKey(),
|
|
321
|
+
phoenixMarket: phoenixMarket,
|
|
322
|
+
phoenixProgram: PHOENIX_PROGRAM_ID,
|
|
323
|
+
rent: SYSVAR_RENT_PUBKEY,
|
|
324
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
325
|
+
phoenixFulfillmentConfig,
|
|
326
|
+
},
|
|
327
|
+
}
|
|
328
|
+
);
|
|
228
329
|
}
|
|
229
330
|
|
|
230
331
|
public async initializePerpMarket(
|
|
@@ -235,43 +336,56 @@ export class AdminClient extends DriftClient {
|
|
|
235
336
|
periodicity: BN,
|
|
236
337
|
pegMultiplier: BN = PEG_PRECISION,
|
|
237
338
|
oracleSource: OracleSource = OracleSource.PYTH,
|
|
339
|
+
contractTier: ContractTier = ContractTier.SPECULATIVE,
|
|
238
340
|
marginRatioInitial = 2000,
|
|
239
341
|
marginRatioMaintenance = 500,
|
|
240
342
|
liquidatorFee = 0,
|
|
343
|
+
ifLiquidatorFee = 10000,
|
|
344
|
+
imfFactor = 0,
|
|
241
345
|
activeStatus = true,
|
|
346
|
+
baseSpread = 0,
|
|
347
|
+
maxSpread = 142500,
|
|
348
|
+
maxOpenInterest = ZERO,
|
|
349
|
+
maxRevenueWithdrawPerPeriod = ZERO,
|
|
350
|
+
quoteMaxInsurance = ZERO,
|
|
351
|
+
orderStepSize = BASE_PRECISION.divn(10000),
|
|
352
|
+
orderTickSize = PRICE_PRECISION.divn(100000),
|
|
353
|
+
minOrderSize = BASE_PRECISION.divn(10000),
|
|
354
|
+
concentrationCoefScale = ONE,
|
|
355
|
+
curveUpdateIntensity = 0,
|
|
356
|
+
ammJitIntensity = 0,
|
|
242
357
|
name = DEFAULT_MARKET_NAME
|
|
243
358
|
): Promise<TransactionSignature> {
|
|
244
359
|
const currentPerpMarketIndex = this.getStateAccount().numberOfMarkets;
|
|
245
|
-
const perpMarketPublicKey = await getPerpMarketPublicKey(
|
|
246
|
-
this.program.programId,
|
|
247
|
-
currentPerpMarketIndex
|
|
248
|
-
);
|
|
249
360
|
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
361
|
+
const initializeMarketIx = await this.getInitializePerpMarketIx(
|
|
362
|
+
marketIndex,
|
|
363
|
+
priceOracle,
|
|
364
|
+
baseAssetReserve,
|
|
365
|
+
quoteAssetReserve,
|
|
366
|
+
periodicity,
|
|
367
|
+
pegMultiplier,
|
|
368
|
+
oracleSource,
|
|
369
|
+
contractTier,
|
|
370
|
+
marginRatioInitial,
|
|
371
|
+
marginRatioMaintenance,
|
|
372
|
+
liquidatorFee,
|
|
373
|
+
ifLiquidatorFee,
|
|
374
|
+
imfFactor,
|
|
375
|
+
activeStatus,
|
|
376
|
+
baseSpread,
|
|
377
|
+
maxSpread,
|
|
378
|
+
maxOpenInterest,
|
|
379
|
+
maxRevenueWithdrawPerPeriod,
|
|
380
|
+
quoteMaxInsurance,
|
|
381
|
+
orderStepSize,
|
|
382
|
+
orderTickSize,
|
|
383
|
+
minOrderSize,
|
|
384
|
+
concentrationCoefScale,
|
|
385
|
+
curveUpdateIntensity,
|
|
386
|
+
ammJitIntensity,
|
|
387
|
+
name
|
|
388
|
+
);
|
|
275
389
|
const tx = await this.buildTransaction(initializeMarketIx);
|
|
276
390
|
|
|
277
391
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
@@ -290,6 +404,82 @@ export class AdminClient extends DriftClient {
|
|
|
290
404
|
return txSig;
|
|
291
405
|
}
|
|
292
406
|
|
|
407
|
+
public async getInitializePerpMarketIx(
|
|
408
|
+
marketIndex: number,
|
|
409
|
+
priceOracle: PublicKey,
|
|
410
|
+
baseAssetReserve: BN,
|
|
411
|
+
quoteAssetReserve: BN,
|
|
412
|
+
periodicity: BN,
|
|
413
|
+
pegMultiplier: BN = PEG_PRECISION,
|
|
414
|
+
oracleSource: OracleSource = OracleSource.PYTH,
|
|
415
|
+
contractTier: ContractTier = ContractTier.SPECULATIVE,
|
|
416
|
+
marginRatioInitial = 2000,
|
|
417
|
+
marginRatioMaintenance = 500,
|
|
418
|
+
liquidatorFee = 0,
|
|
419
|
+
ifLiquidatorFee = 10000,
|
|
420
|
+
imfFactor = 0,
|
|
421
|
+
activeStatus = true,
|
|
422
|
+
baseSpread = 0,
|
|
423
|
+
maxSpread = 142500,
|
|
424
|
+
maxOpenInterest = ZERO,
|
|
425
|
+
maxRevenueWithdrawPerPeriod = ZERO,
|
|
426
|
+
quoteMaxInsurance = ZERO,
|
|
427
|
+
orderStepSize = BASE_PRECISION.divn(10000),
|
|
428
|
+
orderTickSize = PRICE_PRECISION.divn(100000),
|
|
429
|
+
minOrderSize = BASE_PRECISION.divn(10000),
|
|
430
|
+
concentrationCoefScale = ONE,
|
|
431
|
+
curveUpdateIntensity = 0,
|
|
432
|
+
ammJitIntensity = 0,
|
|
433
|
+
name = DEFAULT_MARKET_NAME
|
|
434
|
+
): Promise<TransactionInstruction> {
|
|
435
|
+
const currentPerpMarketIndex = this.getStateAccount().numberOfMarkets;
|
|
436
|
+
const perpMarketPublicKey = await getPerpMarketPublicKey(
|
|
437
|
+
this.program.programId,
|
|
438
|
+
currentPerpMarketIndex
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
const nameBuffer = encodeName(name);
|
|
442
|
+
return await this.program.instruction.initializePerpMarket(
|
|
443
|
+
marketIndex,
|
|
444
|
+
baseAssetReserve,
|
|
445
|
+
quoteAssetReserve,
|
|
446
|
+
periodicity,
|
|
447
|
+
pegMultiplier,
|
|
448
|
+
oracleSource,
|
|
449
|
+
contractTier,
|
|
450
|
+
marginRatioInitial,
|
|
451
|
+
marginRatioMaintenance,
|
|
452
|
+
liquidatorFee,
|
|
453
|
+
ifLiquidatorFee,
|
|
454
|
+
imfFactor,
|
|
455
|
+
activeStatus,
|
|
456
|
+
baseSpread,
|
|
457
|
+
maxSpread,
|
|
458
|
+
maxOpenInterest,
|
|
459
|
+
maxRevenueWithdrawPerPeriod,
|
|
460
|
+
quoteMaxInsurance,
|
|
461
|
+
orderStepSize,
|
|
462
|
+
orderTickSize,
|
|
463
|
+
minOrderSize,
|
|
464
|
+
concentrationCoefScale,
|
|
465
|
+
curveUpdateIntensity,
|
|
466
|
+
ammJitIntensity,
|
|
467
|
+
nameBuffer,
|
|
468
|
+
{
|
|
469
|
+
accounts: {
|
|
470
|
+
state: await this.getStatePublicKey(),
|
|
471
|
+
admin: this.isSubscribed
|
|
472
|
+
? this.getStateAccount().admin
|
|
473
|
+
: this.wallet.publicKey,
|
|
474
|
+
oracle: priceOracle,
|
|
475
|
+
perpMarket: perpMarketPublicKey,
|
|
476
|
+
rent: SYSVAR_RENT_PUBKEY,
|
|
477
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
478
|
+
},
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
|
|
293
483
|
public async deleteInitializedPerpMarket(
|
|
294
484
|
marketIndex: number
|
|
295
485
|
): Promise<TransactionSignature> {
|
|
@@ -302,7 +492,9 @@ export class AdminClient extends DriftClient {
|
|
|
302
492
|
await this.program.instruction.deleteInitializedPerpMarket(marketIndex, {
|
|
303
493
|
accounts: {
|
|
304
494
|
state: await this.getStatePublicKey(),
|
|
305
|
-
admin: this.
|
|
495
|
+
admin: this.isSubscribed
|
|
496
|
+
? this.getStateAccount().admin
|
|
497
|
+
: this.wallet.publicKey,
|
|
306
498
|
perpMarket: perpMarketPublicKey,
|
|
307
499
|
},
|
|
308
500
|
});
|
|
@@ -336,7 +528,9 @@ export class AdminClient extends DriftClient {
|
|
|
336
528
|
{
|
|
337
529
|
accounts: {
|
|
338
530
|
state: await this.getStatePublicKey(),
|
|
339
|
-
admin: this.
|
|
531
|
+
admin: this.isSubscribed
|
|
532
|
+
? this.getStateAccount().admin
|
|
533
|
+
: this.wallet.publicKey,
|
|
340
534
|
perpMarket: marketPublicKey,
|
|
341
535
|
},
|
|
342
536
|
}
|
|
@@ -356,7 +550,9 @@ export class AdminClient extends DriftClient {
|
|
|
356
550
|
const updateKIx = await this.program.instruction.updateK(sqrtK, {
|
|
357
551
|
accounts: {
|
|
358
552
|
state: await this.getStatePublicKey(),
|
|
359
|
-
admin: this.
|
|
553
|
+
admin: this.isSubscribed
|
|
554
|
+
? this.getStateAccount().admin
|
|
555
|
+
: this.wallet.publicKey,
|
|
360
556
|
perpMarket: await getPerpMarketPublicKey(
|
|
361
557
|
this.program.programId,
|
|
362
558
|
perpMarketIndex
|
|
@@ -389,7 +585,9 @@ export class AdminClient extends DriftClient {
|
|
|
389
585
|
{
|
|
390
586
|
accounts: {
|
|
391
587
|
state: await this.getStatePublicKey(),
|
|
392
|
-
admin: this.
|
|
588
|
+
admin: this.isSubscribed
|
|
589
|
+
? this.getStateAccount().admin
|
|
590
|
+
: this.wallet.publicKey,
|
|
393
591
|
perpMarket: marketPublicKey,
|
|
394
592
|
},
|
|
395
593
|
}
|
|
@@ -412,7 +610,9 @@ export class AdminClient extends DriftClient {
|
|
|
412
610
|
{
|
|
413
611
|
accounts: {
|
|
414
612
|
state: await this.getStatePublicKey(),
|
|
415
|
-
admin: this.
|
|
613
|
+
admin: this.isSubscribed
|
|
614
|
+
? this.getStateAccount().admin
|
|
615
|
+
: this.wallet.publicKey,
|
|
416
616
|
perpMarket: await getPerpMarketPublicKey(
|
|
417
617
|
this.program.programId,
|
|
418
618
|
perpMarketIndex
|
|
@@ -462,7 +662,9 @@ export class AdminClient extends DriftClient {
|
|
|
462
662
|
{
|
|
463
663
|
accounts: {
|
|
464
664
|
state: await this.getStatePublicKey(),
|
|
465
|
-
admin: this.
|
|
665
|
+
admin: this.isSubscribed
|
|
666
|
+
? this.getStateAccount().admin
|
|
667
|
+
: this.wallet.publicKey,
|
|
466
668
|
perpMarket: perpMarketPublicKey,
|
|
467
669
|
},
|
|
468
670
|
}
|
|
@@ -490,7 +692,9 @@ export class AdminClient extends DriftClient {
|
|
|
490
692
|
{
|
|
491
693
|
accounts: {
|
|
492
694
|
state: await this.getStatePublicKey(),
|
|
493
|
-
admin: this.
|
|
695
|
+
admin: this.isSubscribed
|
|
696
|
+
? this.getStateAccount().admin
|
|
697
|
+
: this.wallet.publicKey,
|
|
494
698
|
oracle: ammData.oracle,
|
|
495
699
|
perpMarket: perpMarketPublicKey,
|
|
496
700
|
},
|
|
@@ -517,7 +721,9 @@ export class AdminClient extends DriftClient {
|
|
|
517
721
|
await this.program.instruction.updatePerpMarketAmmOracleTwap({
|
|
518
722
|
accounts: {
|
|
519
723
|
state: await this.getStatePublicKey(),
|
|
520
|
-
admin: this.
|
|
724
|
+
admin: this.isSubscribed
|
|
725
|
+
? this.getStateAccount().admin
|
|
726
|
+
: this.wallet.publicKey,
|
|
521
727
|
oracle: ammData.oracle,
|
|
522
728
|
perpMarket: perpMarketPublicKey,
|
|
523
729
|
},
|
|
@@ -543,7 +749,9 @@ export class AdminClient extends DriftClient {
|
|
|
543
749
|
await this.program.instruction.resetPerpMarketAmmOracleTwap({
|
|
544
750
|
accounts: {
|
|
545
751
|
state: await this.getStatePublicKey(),
|
|
546
|
-
admin: this.
|
|
752
|
+
admin: this.isSubscribed
|
|
753
|
+
? this.getStateAccount().admin
|
|
754
|
+
: this.wallet.publicKey,
|
|
547
755
|
oracle: ammData.oracle,
|
|
548
756
|
perpMarket: perpMarketPublicKey,
|
|
549
757
|
},
|
|
@@ -566,7 +774,9 @@ export class AdminClient extends DriftClient {
|
|
|
566
774
|
const depositIntoPerpMarketFeePoolIx =
|
|
567
775
|
await this.program.instruction.depositIntoPerpMarketFeePool(amount, {
|
|
568
776
|
accounts: {
|
|
569
|
-
admin: this.
|
|
777
|
+
admin: this.isSubscribed
|
|
778
|
+
? this.getStateAccount().admin
|
|
779
|
+
: this.wallet.publicKey,
|
|
570
780
|
state: await this.getStatePublicKey(),
|
|
571
781
|
perpMarket: await getPerpMarketPublicKey(
|
|
572
782
|
this.program.programId,
|
|
@@ -590,7 +800,9 @@ export class AdminClient extends DriftClient {
|
|
|
590
800
|
public async updateAdmin(admin: PublicKey): Promise<TransactionSignature> {
|
|
591
801
|
const updateAdminIx = await this.program.instruction.updateAdmin(admin, {
|
|
592
802
|
accounts: {
|
|
593
|
-
admin: this.
|
|
803
|
+
admin: this.isSubscribed
|
|
804
|
+
? this.getStateAccount().admin
|
|
805
|
+
: this.wallet.publicKey,
|
|
594
806
|
state: await this.getStatePublicKey(),
|
|
595
807
|
},
|
|
596
808
|
});
|
|
@@ -614,7 +826,9 @@ export class AdminClient extends DriftClient {
|
|
|
614
826
|
curveUpdateIntensity,
|
|
615
827
|
{
|
|
616
828
|
accounts: {
|
|
617
|
-
admin: this.
|
|
829
|
+
admin: this.isSubscribed
|
|
830
|
+
? this.getStateAccount().admin
|
|
831
|
+
: this.wallet.publicKey,
|
|
618
832
|
state: await this.getStatePublicKey(),
|
|
619
833
|
perpMarket: await getPerpMarketPublicKey(
|
|
620
834
|
this.program.programId,
|
|
@@ -642,7 +856,9 @@ export class AdminClient extends DriftClient {
|
|
|
642
856
|
targetBaseAssetAmountPerLP,
|
|
643
857
|
{
|
|
644
858
|
accounts: {
|
|
645
|
-
admin: this.
|
|
859
|
+
admin: this.isSubscribed
|
|
860
|
+
? this.getStateAccount().admin
|
|
861
|
+
: this.wallet.publicKey,
|
|
646
862
|
state: await this.getStatePublicKey(),
|
|
647
863
|
perpMarket: await getPerpMarketPublicKey(
|
|
648
864
|
this.program.programId,
|
|
@@ -672,7 +888,9 @@ export class AdminClient extends DriftClient {
|
|
|
672
888
|
marginRatioMaintenance,
|
|
673
889
|
{
|
|
674
890
|
accounts: {
|
|
675
|
-
admin: this.
|
|
891
|
+
admin: this.isSubscribed
|
|
892
|
+
? this.getStateAccount().admin
|
|
893
|
+
: this.wallet.publicKey,
|
|
676
894
|
state: await this.getStatePublicKey(),
|
|
677
895
|
perpMarket: await getPerpMarketPublicKey(
|
|
678
896
|
this.program.programId,
|
|
@@ -700,7 +918,9 @@ export class AdminClient extends DriftClient {
|
|
|
700
918
|
unrealizedPnlImfFactor,
|
|
701
919
|
{
|
|
702
920
|
accounts: {
|
|
703
|
-
admin: this.
|
|
921
|
+
admin: this.isSubscribed
|
|
922
|
+
? this.getStateAccount().admin
|
|
923
|
+
: this.wallet.publicKey,
|
|
704
924
|
state: await this.getStatePublicKey(),
|
|
705
925
|
perpMarket: await getPerpMarketPublicKey(
|
|
706
926
|
this.program.programId,
|
|
@@ -724,7 +944,9 @@ export class AdminClient extends DriftClient {
|
|
|
724
944
|
const updatePerpMarketBaseSpreadIx =
|
|
725
945
|
await this.program.instruction.updatePerpMarketBaseSpread(baseSpread, {
|
|
726
946
|
accounts: {
|
|
727
|
-
admin: this.
|
|
947
|
+
admin: this.isSubscribed
|
|
948
|
+
? this.getStateAccount().admin
|
|
949
|
+
: this.wallet.publicKey,
|
|
728
950
|
state: await this.getStatePublicKey(),
|
|
729
951
|
perpMarket: await getPerpMarketPublicKey(
|
|
730
952
|
this.program.programId,
|
|
@@ -747,7 +969,9 @@ export class AdminClient extends DriftClient {
|
|
|
747
969
|
const updateAmmJitIntensityIx =
|
|
748
970
|
await this.program.instruction.updateAmmJitIntensity(ammJitIntensity, {
|
|
749
971
|
accounts: {
|
|
750
|
-
admin: this.
|
|
972
|
+
admin: this.isSubscribed
|
|
973
|
+
? this.getStateAccount().admin
|
|
974
|
+
: this.wallet.publicKey,
|
|
751
975
|
state: await this.getStatePublicKey(),
|
|
752
976
|
perpMarket: await getPerpMarketPublicKey(
|
|
753
977
|
this.program.programId,
|
|
@@ -772,7 +996,9 @@ export class AdminClient extends DriftClient {
|
|
|
772
996
|
const updatePerpMarketNameIx =
|
|
773
997
|
await this.program.instruction.updatePerpMarketName(nameBuffer, {
|
|
774
998
|
accounts: {
|
|
775
|
-
admin: this.
|
|
999
|
+
admin: this.isSubscribed
|
|
1000
|
+
? this.getStateAccount().admin
|
|
1001
|
+
: this.wallet.publicKey,
|
|
776
1002
|
state: await this.getStatePublicKey(),
|
|
777
1003
|
perpMarket: await getPerpMarketPublicKey(
|
|
778
1004
|
this.program.programId,
|
|
@@ -797,7 +1023,9 @@ export class AdminClient extends DriftClient {
|
|
|
797
1023
|
const updateSpotMarketNameIx =
|
|
798
1024
|
await this.program.instruction.updateSpotMarketName(nameBuffer, {
|
|
799
1025
|
accounts: {
|
|
800
|
-
admin: this.
|
|
1026
|
+
admin: this.isSubscribed
|
|
1027
|
+
? this.getStateAccount().admin
|
|
1028
|
+
: this.wallet.publicKey,
|
|
801
1029
|
state: await this.getStatePublicKey(),
|
|
802
1030
|
spotMarket: await getSpotMarketPublicKey(
|
|
803
1031
|
this.program.programId,
|
|
@@ -825,7 +1053,9 @@ export class AdminClient extends DriftClient {
|
|
|
825
1053
|
const updatePerpMarketPerLpBaseIx =
|
|
826
1054
|
await this.program.instruction.updatePerpMarketPerLpBase(perLpBase, {
|
|
827
1055
|
accounts: {
|
|
828
|
-
admin: this.
|
|
1056
|
+
admin: this.isSubscribed
|
|
1057
|
+
? this.getStateAccount().admin
|
|
1058
|
+
: this.wallet.publicKey,
|
|
829
1059
|
state: await this.getStatePublicKey(),
|
|
830
1060
|
perpMarket: perpMarketPublicKey,
|
|
831
1061
|
},
|
|
@@ -850,7 +1080,9 @@ export class AdminClient extends DriftClient {
|
|
|
850
1080
|
const updatePerpMarketMaxSpreadIx =
|
|
851
1081
|
await this.program.instruction.updatePerpMarketMaxSpread(maxSpread, {
|
|
852
1082
|
accounts: {
|
|
853
|
-
admin: this.
|
|
1083
|
+
admin: this.isSubscribed
|
|
1084
|
+
? this.getStateAccount().admin
|
|
1085
|
+
: this.wallet.publicKey,
|
|
854
1086
|
state: await this.getStatePublicKey(),
|
|
855
1087
|
perpMarket: perpMarketPublicKey,
|
|
856
1088
|
},
|
|
@@ -869,7 +1101,9 @@ export class AdminClient extends DriftClient {
|
|
|
869
1101
|
const updatePerpFeeStructureIx =
|
|
870
1102
|
this.program.instruction.updatePerpFeeStructure(feeStructure, {
|
|
871
1103
|
accounts: {
|
|
872
|
-
admin: this.
|
|
1104
|
+
admin: this.isSubscribed
|
|
1105
|
+
? this.getStateAccount().admin
|
|
1106
|
+
: this.wallet.publicKey,
|
|
873
1107
|
state: await this.getStatePublicKey(),
|
|
874
1108
|
},
|
|
875
1109
|
});
|
|
@@ -887,7 +1121,9 @@ export class AdminClient extends DriftClient {
|
|
|
887
1121
|
const updateSpotFeeStructureIx =
|
|
888
1122
|
await this.program.instruction.updateSpotFeeStructure(feeStructure, {
|
|
889
1123
|
accounts: {
|
|
890
|
-
admin: this.
|
|
1124
|
+
admin: this.isSubscribed
|
|
1125
|
+
? this.getStateAccount().admin
|
|
1126
|
+
: this.wallet.publicKey,
|
|
891
1127
|
state: await this.getStatePublicKey(),
|
|
892
1128
|
},
|
|
893
1129
|
});
|
|
@@ -907,7 +1143,9 @@ export class AdminClient extends DriftClient {
|
|
|
907
1143
|
initialPctToLiquidate,
|
|
908
1144
|
{
|
|
909
1145
|
accounts: {
|
|
910
|
-
admin: this.
|
|
1146
|
+
admin: this.isSubscribed
|
|
1147
|
+
? this.getStateAccount().admin
|
|
1148
|
+
: this.wallet.publicKey,
|
|
911
1149
|
state: await this.getStatePublicKey(),
|
|
912
1150
|
},
|
|
913
1151
|
}
|
|
@@ -928,7 +1166,9 @@ export class AdminClient extends DriftClient {
|
|
|
928
1166
|
liquidationDuration,
|
|
929
1167
|
{
|
|
930
1168
|
accounts: {
|
|
931
|
-
admin: this.
|
|
1169
|
+
admin: this.isSubscribed
|
|
1170
|
+
? this.getStateAccount().admin
|
|
1171
|
+
: this.wallet.publicKey,
|
|
932
1172
|
state: await this.getStatePublicKey(),
|
|
933
1173
|
},
|
|
934
1174
|
}
|
|
@@ -949,7 +1189,9 @@ export class AdminClient extends DriftClient {
|
|
|
949
1189
|
updateLiquidationMarginBufferRatio,
|
|
950
1190
|
{
|
|
951
1191
|
accounts: {
|
|
952
|
-
admin: this.
|
|
1192
|
+
admin: this.isSubscribed
|
|
1193
|
+
? this.getStateAccount().admin
|
|
1194
|
+
: this.wallet.publicKey,
|
|
953
1195
|
state: await this.getStatePublicKey(),
|
|
954
1196
|
},
|
|
955
1197
|
}
|
|
@@ -970,7 +1212,9 @@ export class AdminClient extends DriftClient {
|
|
|
970
1212
|
const updateOracleGuardRailsIx =
|
|
971
1213
|
await this.program.instruction.updateOracleGuardRails(oracleGuardRails, {
|
|
972
1214
|
accounts: {
|
|
973
|
-
admin: this.
|
|
1215
|
+
admin: this.isSubscribed
|
|
1216
|
+
? this.getStateAccount().admin
|
|
1217
|
+
: this.wallet.publicKey,
|
|
974
1218
|
state: await this.getStatePublicKey(),
|
|
975
1219
|
},
|
|
976
1220
|
});
|
|
@@ -990,7 +1234,9 @@ export class AdminClient extends DriftClient {
|
|
|
990
1234
|
settlementDuration,
|
|
991
1235
|
{
|
|
992
1236
|
accounts: {
|
|
993
|
-
admin: this.
|
|
1237
|
+
admin: this.isSubscribed
|
|
1238
|
+
? this.getStateAccount().admin
|
|
1239
|
+
: this.wallet.publicKey,
|
|
994
1240
|
state: await this.getStatePublicKey(),
|
|
995
1241
|
},
|
|
996
1242
|
}
|
|
@@ -1011,7 +1257,9 @@ export class AdminClient extends DriftClient {
|
|
|
1011
1257
|
maxNumberOfSubAccounts,
|
|
1012
1258
|
{
|
|
1013
1259
|
accounts: {
|
|
1014
|
-
admin: this.
|
|
1260
|
+
admin: this.isSubscribed
|
|
1261
|
+
? this.getStateAccount().admin
|
|
1262
|
+
: this.wallet.publicKey,
|
|
1015
1263
|
state: await this.getStatePublicKey(),
|
|
1016
1264
|
},
|
|
1017
1265
|
}
|
|
@@ -1032,7 +1280,9 @@ export class AdminClient extends DriftClient {
|
|
|
1032
1280
|
maxInitializeUserFee,
|
|
1033
1281
|
{
|
|
1034
1282
|
accounts: {
|
|
1035
|
-
admin: this.
|
|
1283
|
+
admin: this.isSubscribed
|
|
1284
|
+
? this.getStateAccount().admin
|
|
1285
|
+
: this.wallet.publicKey,
|
|
1036
1286
|
state: await this.getStatePublicKey(),
|
|
1037
1287
|
},
|
|
1038
1288
|
}
|
|
@@ -1054,7 +1304,9 @@ export class AdminClient extends DriftClient {
|
|
|
1054
1304
|
withdrawGuardThreshold,
|
|
1055
1305
|
{
|
|
1056
1306
|
accounts: {
|
|
1057
|
-
admin: this.
|
|
1307
|
+
admin: this.isSubscribed
|
|
1308
|
+
? this.getStateAccount().admin
|
|
1309
|
+
: this.wallet.publicKey,
|
|
1058
1310
|
state: await this.getStatePublicKey(),
|
|
1059
1311
|
spotMarket: await getSpotMarketPublicKey(
|
|
1060
1312
|
this.program.programId,
|
|
@@ -1083,7 +1335,9 @@ export class AdminClient extends DriftClient {
|
|
|
1083
1335
|
totalIfFactor,
|
|
1084
1336
|
{
|
|
1085
1337
|
accounts: {
|
|
1086
|
-
admin: this.
|
|
1338
|
+
admin: this.isSubscribed
|
|
1339
|
+
? this.getStateAccount().admin
|
|
1340
|
+
: this.wallet.publicKey,
|
|
1087
1341
|
state: await this.getStatePublicKey(),
|
|
1088
1342
|
spotMarket: await getSpotMarketPublicKey(
|
|
1089
1343
|
this.program.programId,
|
|
@@ -1109,7 +1363,9 @@ export class AdminClient extends DriftClient {
|
|
|
1109
1363
|
revenueSettlePeriod,
|
|
1110
1364
|
{
|
|
1111
1365
|
accounts: {
|
|
1112
|
-
admin: this.
|
|
1366
|
+
admin: this.isSubscribed
|
|
1367
|
+
? this.getStateAccount().admin
|
|
1368
|
+
: this.wallet.publicKey,
|
|
1113
1369
|
state: await this.getStatePublicKey(),
|
|
1114
1370
|
spotMarket: await getSpotMarketPublicKey(
|
|
1115
1371
|
this.program.programId,
|
|
@@ -1137,7 +1393,9 @@ export class AdminClient extends DriftClient {
|
|
|
1137
1393
|
maxTokenDeposits,
|
|
1138
1394
|
{
|
|
1139
1395
|
accounts: {
|
|
1140
|
-
admin: this.
|
|
1396
|
+
admin: this.isSubscribed
|
|
1397
|
+
? this.getStateAccount().admin
|
|
1398
|
+
: this.wallet.publicKey,
|
|
1141
1399
|
state: await this.getStatePublicKey(),
|
|
1142
1400
|
spotMarket: await getSpotMarketPublicKey(
|
|
1143
1401
|
this.program.programId,
|
|
@@ -1163,7 +1421,9 @@ export class AdminClient extends DriftClient {
|
|
|
1163
1421
|
scaleInitialAssetWeightStart,
|
|
1164
1422
|
{
|
|
1165
1423
|
accounts: {
|
|
1166
|
-
admin: this.
|
|
1424
|
+
admin: this.isSubscribed
|
|
1425
|
+
? this.getStateAccount().admin
|
|
1426
|
+
: this.wallet.publicKey,
|
|
1167
1427
|
state: await this.getStatePublicKey(),
|
|
1168
1428
|
spotMarket: await getSpotMarketPublicKey(
|
|
1169
1429
|
this.program.programId,
|
|
@@ -1191,7 +1451,9 @@ export class AdminClient extends DriftClient {
|
|
|
1191
1451
|
insuranceWithdrawEscrowPeriod,
|
|
1192
1452
|
{
|
|
1193
1453
|
accounts: {
|
|
1194
|
-
admin: this.
|
|
1454
|
+
admin: this.isSubscribed
|
|
1455
|
+
? this.getStateAccount().admin
|
|
1456
|
+
: this.wallet.publicKey,
|
|
1195
1457
|
state: await this.getStatePublicKey(),
|
|
1196
1458
|
spotMarket: await getSpotMarketPublicKey(
|
|
1197
1459
|
this.program.programId,
|
|
@@ -1216,7 +1478,9 @@ export class AdminClient extends DriftClient {
|
|
|
1216
1478
|
const updateLpCooldownTimeIx =
|
|
1217
1479
|
await this.program.instruction.updateLpCooldownTime(cooldownTime, {
|
|
1218
1480
|
accounts: {
|
|
1219
|
-
admin: this.
|
|
1481
|
+
admin: this.isSubscribed
|
|
1482
|
+
? this.getStateAccount().admin
|
|
1483
|
+
: this.wallet.publicKey,
|
|
1220
1484
|
state: await this.getStatePublicKey(),
|
|
1221
1485
|
},
|
|
1222
1486
|
});
|
|
@@ -1239,7 +1503,9 @@ export class AdminClient extends DriftClient {
|
|
|
1239
1503
|
oracleSource,
|
|
1240
1504
|
{
|
|
1241
1505
|
accounts: {
|
|
1242
|
-
admin: this.
|
|
1506
|
+
admin: this.isSubscribed
|
|
1507
|
+
? this.getStateAccount().admin
|
|
1508
|
+
: this.wallet.publicKey,
|
|
1243
1509
|
state: await this.getStatePublicKey(),
|
|
1244
1510
|
perpMarket: await getPerpMarketPublicKey(
|
|
1245
1511
|
this.program.programId,
|
|
@@ -1268,7 +1534,9 @@ export class AdminClient extends DriftClient {
|
|
|
1268
1534
|
tickSize,
|
|
1269
1535
|
{
|
|
1270
1536
|
accounts: {
|
|
1271
|
-
admin: this.
|
|
1537
|
+
admin: this.isSubscribed
|
|
1538
|
+
? this.getStateAccount().admin
|
|
1539
|
+
: this.wallet.publicKey,
|
|
1272
1540
|
state: await this.getStatePublicKey(),
|
|
1273
1541
|
perpMarket: await getPerpMarketPublicKey(
|
|
1274
1542
|
this.program.programId,
|
|
@@ -1294,7 +1562,9 @@ export class AdminClient extends DriftClient {
|
|
|
1294
1562
|
const updatePerpMarketMinOrderSizeIx =
|
|
1295
1563
|
await this.program.instruction.updatePerpMarketMinOrderSize(orderSize, {
|
|
1296
1564
|
accounts: {
|
|
1297
|
-
admin: this.
|
|
1565
|
+
admin: this.isSubscribed
|
|
1566
|
+
? this.getStateAccount().admin
|
|
1567
|
+
: this.wallet.publicKey,
|
|
1298
1568
|
state: await this.getStatePublicKey(),
|
|
1299
1569
|
perpMarket: await getPerpMarketPublicKey(
|
|
1300
1570
|
this.program.programId,
|
|
@@ -1321,7 +1591,9 @@ export class AdminClient extends DriftClient {
|
|
|
1321
1591
|
tickSize,
|
|
1322
1592
|
{
|
|
1323
1593
|
accounts: {
|
|
1324
|
-
admin: this.
|
|
1594
|
+
admin: this.isSubscribed
|
|
1595
|
+
? this.getStateAccount().admin
|
|
1596
|
+
: this.wallet.publicKey,
|
|
1325
1597
|
state: await this.getStatePublicKey(),
|
|
1326
1598
|
spotMarket: await getSpotMarketPublicKey(
|
|
1327
1599
|
this.program.programId,
|
|
@@ -1347,7 +1619,9 @@ export class AdminClient extends DriftClient {
|
|
|
1347
1619
|
const updateSpotMarketMinOrderSizeIx =
|
|
1348
1620
|
await this.program.instruction.updateSpotMarketMinOrderSize(orderSize, {
|
|
1349
1621
|
accounts: {
|
|
1350
|
-
admin: this.
|
|
1622
|
+
admin: this.isSubscribed
|
|
1623
|
+
? this.getStateAccount().admin
|
|
1624
|
+
: this.wallet.publicKey,
|
|
1351
1625
|
state: await this.getStatePublicKey(),
|
|
1352
1626
|
spotMarket: await getSpotMarketPublicKey(
|
|
1353
1627
|
this.program.programId,
|
|
@@ -1370,7 +1644,9 @@ export class AdminClient extends DriftClient {
|
|
|
1370
1644
|
const updatePerpMarketExpiryIx =
|
|
1371
1645
|
await this.program.instruction.updatePerpMarketExpiry(expiryTs, {
|
|
1372
1646
|
accounts: {
|
|
1373
|
-
admin: this.
|
|
1647
|
+
admin: this.isSubscribed
|
|
1648
|
+
? this.getStateAccount().admin
|
|
1649
|
+
: this.wallet.publicKey,
|
|
1374
1650
|
state: await this.getStatePublicKey(),
|
|
1375
1651
|
perpMarket: await getPerpMarketPublicKey(
|
|
1376
1652
|
this.program.programId,
|
|
@@ -1396,7 +1672,9 @@ export class AdminClient extends DriftClient {
|
|
|
1396
1672
|
oracleSource,
|
|
1397
1673
|
{
|
|
1398
1674
|
accounts: {
|
|
1399
|
-
admin: this.
|
|
1675
|
+
admin: this.isSubscribed
|
|
1676
|
+
? this.getStateAccount().admin
|
|
1677
|
+
: this.wallet.publicKey,
|
|
1400
1678
|
state: await this.getStatePublicKey(),
|
|
1401
1679
|
spotMarket: await getSpotMarketPublicKey(
|
|
1402
1680
|
this.program.programId,
|
|
@@ -1423,7 +1701,9 @@ export class AdminClient extends DriftClient {
|
|
|
1423
1701
|
ordersEnabled,
|
|
1424
1702
|
{
|
|
1425
1703
|
accounts: {
|
|
1426
|
-
admin: this.
|
|
1704
|
+
admin: this.isSubscribed
|
|
1705
|
+
? this.getStateAccount().admin
|
|
1706
|
+
: this.wallet.publicKey,
|
|
1427
1707
|
state: await this.getStatePublicKey(),
|
|
1428
1708
|
spotMarket: await getSpotMarketPublicKey(
|
|
1429
1709
|
this.program.programId,
|
|
@@ -1449,7 +1729,9 @@ export class AdminClient extends DriftClient {
|
|
|
1449
1729
|
status,
|
|
1450
1730
|
{
|
|
1451
1731
|
accounts: {
|
|
1452
|
-
admin: this.
|
|
1732
|
+
admin: this.isSubscribed
|
|
1733
|
+
? this.getStateAccount().admin
|
|
1734
|
+
: this.wallet.publicKey,
|
|
1453
1735
|
state: await this.getStatePublicKey(),
|
|
1454
1736
|
serumFulfillmentConfig,
|
|
1455
1737
|
},
|
|
@@ -1472,7 +1754,9 @@ export class AdminClient extends DriftClient {
|
|
|
1472
1754
|
const updatePhoenixFulfillmentConfigStatusIx =
|
|
1473
1755
|
await this.program.instruction.phoenixFulfillmentConfigStatus(status, {
|
|
1474
1756
|
accounts: {
|
|
1475
|
-
admin: this.
|
|
1757
|
+
admin: this.isSubscribed
|
|
1758
|
+
? this.getStateAccount().admin
|
|
1759
|
+
: this.wallet.publicKey,
|
|
1476
1760
|
state: await this.getStatePublicKey(),
|
|
1477
1761
|
phoenixFulfillmentConfig,
|
|
1478
1762
|
},
|
|
@@ -1494,7 +1778,9 @@ export class AdminClient extends DriftClient {
|
|
|
1494
1778
|
const updateSpotMarketExpiryIx =
|
|
1495
1779
|
await this.program.instruction.updateSpotMarketExpiry(expiryTs, {
|
|
1496
1780
|
accounts: {
|
|
1497
|
-
admin: this.
|
|
1781
|
+
admin: this.isSubscribed
|
|
1782
|
+
? this.getStateAccount().admin
|
|
1783
|
+
: this.wallet.publicKey,
|
|
1498
1784
|
state: await this.getStatePublicKey(),
|
|
1499
1785
|
spotMarket: await getSpotMarketPublicKey(
|
|
1500
1786
|
this.program.programId,
|
|
@@ -1516,7 +1802,9 @@ export class AdminClient extends DriftClient {
|
|
|
1516
1802
|
const updateWhitelistMintIx =
|
|
1517
1803
|
await this.program.instruction.updateWhitelistMint(whitelistMint, {
|
|
1518
1804
|
accounts: {
|
|
1519
|
-
admin: this.
|
|
1805
|
+
admin: this.isSubscribed
|
|
1806
|
+
? this.getStateAccount().admin
|
|
1807
|
+
: this.wallet.publicKey,
|
|
1520
1808
|
state: await this.getStatePublicKey(),
|
|
1521
1809
|
},
|
|
1522
1810
|
});
|
|
@@ -1534,7 +1822,9 @@ export class AdminClient extends DriftClient {
|
|
|
1534
1822
|
const updateDiscountMintIx =
|
|
1535
1823
|
await this.program.instruction.updateDiscountMint(discountMint, {
|
|
1536
1824
|
accounts: {
|
|
1537
|
-
admin: this.
|
|
1825
|
+
admin: this.isSubscribed
|
|
1826
|
+
? this.getStateAccount().admin
|
|
1827
|
+
: this.wallet.publicKey,
|
|
1538
1828
|
state: await this.getStatePublicKey(),
|
|
1539
1829
|
},
|
|
1540
1830
|
});
|
|
@@ -1563,7 +1853,9 @@ export class AdminClient extends DriftClient {
|
|
|
1563
1853
|
imfFactor,
|
|
1564
1854
|
{
|
|
1565
1855
|
accounts: {
|
|
1566
|
-
admin: this.
|
|
1856
|
+
admin: this.isSubscribed
|
|
1857
|
+
? this.getStateAccount().admin
|
|
1858
|
+
: this.wallet.publicKey,
|
|
1567
1859
|
state: await this.getStatePublicKey(),
|
|
1568
1860
|
spotMarket: await getSpotMarketPublicKey(
|
|
1569
1861
|
this.program.programId,
|
|
@@ -1593,7 +1885,9 @@ export class AdminClient extends DriftClient {
|
|
|
1593
1885
|
optimalMaxRate,
|
|
1594
1886
|
{
|
|
1595
1887
|
accounts: {
|
|
1596
|
-
admin: this.
|
|
1888
|
+
admin: this.isSubscribed
|
|
1889
|
+
? this.getStateAccount().admin
|
|
1890
|
+
: this.wallet.publicKey,
|
|
1597
1891
|
state: await this.getStatePublicKey(),
|
|
1598
1892
|
spotMarket: await getSpotMarketPublicKey(
|
|
1599
1893
|
this.program.programId,
|
|
@@ -1617,7 +1911,9 @@ export class AdminClient extends DriftClient {
|
|
|
1617
1911
|
const updateSpotMarketAssetTierIx =
|
|
1618
1912
|
await this.program.instruction.updateSpotMarketAssetTier(assetTier, {
|
|
1619
1913
|
accounts: {
|
|
1620
|
-
admin: this.
|
|
1914
|
+
admin: this.isSubscribed
|
|
1915
|
+
? this.getStateAccount().admin
|
|
1916
|
+
: this.wallet.publicKey,
|
|
1621
1917
|
state: await this.getStatePublicKey(),
|
|
1622
1918
|
spotMarket: await getSpotMarketPublicKey(
|
|
1623
1919
|
this.program.programId,
|
|
@@ -1640,7 +1936,9 @@ export class AdminClient extends DriftClient {
|
|
|
1640
1936
|
const updateSpotMarketStatusIx =
|
|
1641
1937
|
await this.program.instruction.updateSpotMarketStatus(marketStatus, {
|
|
1642
1938
|
accounts: {
|
|
1643
|
-
admin: this.
|
|
1939
|
+
admin: this.isSubscribed
|
|
1940
|
+
? this.getStateAccount().admin
|
|
1941
|
+
: this.wallet.publicKey,
|
|
1644
1942
|
state: await this.getStatePublicKey(),
|
|
1645
1943
|
spotMarket: await getSpotMarketPublicKey(
|
|
1646
1944
|
this.program.programId,
|
|
@@ -1665,7 +1963,9 @@ export class AdminClient extends DriftClient {
|
|
|
1665
1963
|
pausedOperations,
|
|
1666
1964
|
{
|
|
1667
1965
|
accounts: {
|
|
1668
|
-
admin: this.
|
|
1966
|
+
admin: this.isSubscribed
|
|
1967
|
+
? this.getStateAccount().admin
|
|
1968
|
+
: this.wallet.publicKey,
|
|
1669
1969
|
state: await this.getStatePublicKey(),
|
|
1670
1970
|
spotMarket: await getSpotMarketPublicKey(
|
|
1671
1971
|
this.program.programId,
|
|
@@ -1689,7 +1989,9 @@ export class AdminClient extends DriftClient {
|
|
|
1689
1989
|
const updatePerpMarketStatusIx =
|
|
1690
1990
|
await this.program.instruction.updatePerpMarketStatus(marketStatus, {
|
|
1691
1991
|
accounts: {
|
|
1692
|
-
admin: this.
|
|
1992
|
+
admin: this.isSubscribed
|
|
1993
|
+
? this.getStateAccount().admin
|
|
1994
|
+
: this.wallet.publicKey,
|
|
1693
1995
|
state: await this.getStatePublicKey(),
|
|
1694
1996
|
perpMarket: await getPerpMarketPublicKey(
|
|
1695
1997
|
this.program.programId,
|
|
@@ -1714,7 +2016,9 @@ export class AdminClient extends DriftClient {
|
|
|
1714
2016
|
pausedOperations,
|
|
1715
2017
|
{
|
|
1716
2018
|
accounts: {
|
|
1717
|
-
admin: this.
|
|
2019
|
+
admin: this.isSubscribed
|
|
2020
|
+
? this.getStateAccount().admin
|
|
2021
|
+
: this.wallet.publicKey,
|
|
1718
2022
|
state: await this.getStatePublicKey(),
|
|
1719
2023
|
perpMarket: await getPerpMarketPublicKey(
|
|
1720
2024
|
this.program.programId,
|
|
@@ -1740,7 +2044,9 @@ export class AdminClient extends DriftClient {
|
|
|
1740
2044
|
contractTier,
|
|
1741
2045
|
{
|
|
1742
2046
|
accounts: {
|
|
1743
|
-
admin: this.
|
|
2047
|
+
admin: this.isSubscribed
|
|
2048
|
+
? this.getStateAccount().admin
|
|
2049
|
+
: this.wallet.publicKey,
|
|
1744
2050
|
state: await this.getStatePublicKey(),
|
|
1745
2051
|
perpMarket: await getPerpMarketPublicKey(
|
|
1746
2052
|
this.program.programId,
|
|
@@ -1763,7 +2069,9 @@ export class AdminClient extends DriftClient {
|
|
|
1763
2069
|
const updateExchangeStatusIx =
|
|
1764
2070
|
await this.program.instruction.updateExchangeStatus(exchangeStatus, {
|
|
1765
2071
|
accounts: {
|
|
1766
|
-
admin: this.
|
|
2072
|
+
admin: this.isSubscribed
|
|
2073
|
+
? this.getStateAccount().admin
|
|
2074
|
+
: this.wallet.publicKey,
|
|
1767
2075
|
state: await this.getStatePublicKey(),
|
|
1768
2076
|
},
|
|
1769
2077
|
});
|
|
@@ -1783,7 +2091,9 @@ export class AdminClient extends DriftClient {
|
|
|
1783
2091
|
typeof minDuration === 'number' ? minDuration : minDuration.toNumber(),
|
|
1784
2092
|
{
|
|
1785
2093
|
accounts: {
|
|
1786
|
-
admin: this.
|
|
2094
|
+
admin: this.isSubscribed
|
|
2095
|
+
? this.getStateAccount().admin
|
|
2096
|
+
: this.wallet.publicKey,
|
|
1787
2097
|
state: await this.getStatePublicKey(),
|
|
1788
2098
|
},
|
|
1789
2099
|
}
|
|
@@ -1804,7 +2114,9 @@ export class AdminClient extends DriftClient {
|
|
|
1804
2114
|
defaultAuctionDuration,
|
|
1805
2115
|
{
|
|
1806
2116
|
accounts: {
|
|
1807
|
-
admin: this.
|
|
2117
|
+
admin: this.isSubscribed
|
|
2118
|
+
? this.getStateAccount().admin
|
|
2119
|
+
: this.wallet.publicKey,
|
|
1808
2120
|
state: await this.getStatePublicKey(),
|
|
1809
2121
|
},
|
|
1810
2122
|
}
|
|
@@ -1826,7 +2138,9 @@ export class AdminClient extends DriftClient {
|
|
|
1826
2138
|
maxBaseAssetAmountRatio,
|
|
1827
2139
|
{
|
|
1828
2140
|
accounts: {
|
|
1829
|
-
admin: this.
|
|
2141
|
+
admin: this.isSubscribed
|
|
2142
|
+
? this.getStateAccount().admin
|
|
2143
|
+
: this.wallet.publicKey,
|
|
1830
2144
|
state: await this.getStatePublicKey(),
|
|
1831
2145
|
perpMarket: await getPerpMarketPublicKey(
|
|
1832
2146
|
this.program.programId,
|
|
@@ -1852,7 +2166,9 @@ export class AdminClient extends DriftClient {
|
|
|
1852
2166
|
const updateMaxSlippageRatioIx =
|
|
1853
2167
|
await this.program.instruction.updateMaxSlippageRatio(maxSlippageRatio, {
|
|
1854
2168
|
accounts: {
|
|
1855
|
-
admin: this.
|
|
2169
|
+
admin: this.isSubscribed
|
|
2170
|
+
? this.getStateAccount().admin
|
|
2171
|
+
: this.wallet.publicKey,
|
|
1856
2172
|
state: await this.getStatePublicKey(),
|
|
1857
2173
|
perpMarket: this.getPerpMarketAccount(perpMarketIndex).pubkey,
|
|
1858
2174
|
},
|
|
@@ -1876,7 +2192,9 @@ export class AdminClient extends DriftClient {
|
|
|
1876
2192
|
unrealizedMaintenanceAssetWeight,
|
|
1877
2193
|
{
|
|
1878
2194
|
accounts: {
|
|
1879
|
-
admin: this.
|
|
2195
|
+
admin: this.isSubscribed
|
|
2196
|
+
? this.getStateAccount().admin
|
|
2197
|
+
: this.wallet.publicKey,
|
|
1880
2198
|
state: await this.getStatePublicKey(),
|
|
1881
2199
|
perpMarket: await getPerpMarketPublicKey(
|
|
1882
2200
|
this.program.programId,
|
|
@@ -1908,7 +2226,9 @@ export class AdminClient extends DriftClient {
|
|
|
1908
2226
|
quoteMaxInsurance,
|
|
1909
2227
|
{
|
|
1910
2228
|
accounts: {
|
|
1911
|
-
admin: this.
|
|
2229
|
+
admin: this.isSubscribed
|
|
2230
|
+
? this.getStateAccount().admin
|
|
2231
|
+
: this.wallet.publicKey,
|
|
1912
2232
|
state: await this.getStatePublicKey(),
|
|
1913
2233
|
perpMarket: await getPerpMarketPublicKey(
|
|
1914
2234
|
this.program.programId,
|
|
@@ -1934,7 +2254,9 @@ export class AdminClient extends DriftClient {
|
|
|
1934
2254
|
maxOpenInterest,
|
|
1935
2255
|
{
|
|
1936
2256
|
accounts: {
|
|
1937
|
-
admin: this.
|
|
2257
|
+
admin: this.isSubscribed
|
|
2258
|
+
? this.getStateAccount().admin
|
|
2259
|
+
: this.wallet.publicKey,
|
|
1938
2260
|
state: await this.getStatePublicKey(),
|
|
1939
2261
|
perpMarket: await getPerpMarketPublicKey(
|
|
1940
2262
|
this.program.programId,
|
|
@@ -1960,7 +2282,9 @@ export class AdminClient extends DriftClient {
|
|
|
1960
2282
|
feeAdjustment,
|
|
1961
2283
|
{
|
|
1962
2284
|
accounts: {
|
|
1963
|
-
admin: this.
|
|
2285
|
+
admin: this.isSubscribed
|
|
2286
|
+
? this.getStateAccount().admin
|
|
2287
|
+
: this.wallet.publicKey,
|
|
1964
2288
|
state: await this.getStatePublicKey(),
|
|
1965
2289
|
perpMarket: await getPerpMarketPublicKey(
|
|
1966
2290
|
this.program.programId,
|
|
@@ -1984,7 +2308,9 @@ export class AdminClient extends DriftClient {
|
|
|
1984
2308
|
srmVault,
|
|
1985
2309
|
{
|
|
1986
2310
|
accounts: {
|
|
1987
|
-
admin: this.
|
|
2311
|
+
admin: this.isSubscribed
|
|
2312
|
+
? this.getStateAccount().admin
|
|
2313
|
+
: this.wallet.publicKey,
|
|
1988
2314
|
state: await this.getStatePublicKey(),
|
|
1989
2315
|
srmVault: srmVault,
|
|
1990
2316
|
},
|
|
@@ -2009,7 +2335,9 @@ export class AdminClient extends DriftClient {
|
|
|
2009
2335
|
ifLiquidationFee,
|
|
2010
2336
|
{
|
|
2011
2337
|
accounts: {
|
|
2012
|
-
admin: this.
|
|
2338
|
+
admin: this.isSubscribed
|
|
2339
|
+
? this.getStateAccount().admin
|
|
2340
|
+
: this.wallet.publicKey,
|
|
2013
2341
|
state: await this.getStatePublicKey(),
|
|
2014
2342
|
perpMarket: await getPerpMarketPublicKey(
|
|
2015
2343
|
this.program.programId,
|
|
@@ -2037,7 +2365,9 @@ export class AdminClient extends DriftClient {
|
|
|
2037
2365
|
ifLiquidationFee,
|
|
2038
2366
|
{
|
|
2039
2367
|
accounts: {
|
|
2040
|
-
admin: this.
|
|
2368
|
+
admin: this.isSubscribed
|
|
2369
|
+
? this.getStateAccount().admin
|
|
2370
|
+
: this.wallet.publicKey,
|
|
2041
2371
|
state: await this.getStatePublicKey(),
|
|
2042
2372
|
spotMarket: await getSpotMarketPublicKey(
|
|
2043
2373
|
this.program.programId,
|
|
@@ -2058,7 +2388,9 @@ export class AdminClient extends DriftClient {
|
|
|
2058
2388
|
const initializeProtocolIfSharesTransferConfigIx =
|
|
2059
2389
|
await this.program.instruction.initializeProtocolIfSharesTransferConfig({
|
|
2060
2390
|
accounts: {
|
|
2061
|
-
admin: this.
|
|
2391
|
+
admin: this.isSubscribed
|
|
2392
|
+
? this.getStateAccount().admin
|
|
2393
|
+
: this.wallet.publicKey,
|
|
2062
2394
|
state: await this.getStatePublicKey(),
|
|
2063
2395
|
rent: SYSVAR_RENT_PUBKEY,
|
|
2064
2396
|
systemProgram: anchor.web3.SystemProgram.programId,
|
|
@@ -2086,7 +2418,9 @@ export class AdminClient extends DriftClient {
|
|
|
2086
2418
|
maxTransferPerEpoch,
|
|
2087
2419
|
{
|
|
2088
2420
|
accounts: {
|
|
2089
|
-
admin: this.
|
|
2421
|
+
admin: this.isSubscribed
|
|
2422
|
+
? this.getStateAccount().admin
|
|
2423
|
+
: this.wallet.publicKey,
|
|
2090
2424
|
state: await this.getStatePublicKey(),
|
|
2091
2425
|
protocolIfSharesTransferConfig:
|
|
2092
2426
|
getProtocolIfSharesTransferConfigPublicKey(
|
|
@@ -2110,38 +2444,71 @@ export class AdminClient extends DriftClient {
|
|
|
2110
2444
|
price?: BN,
|
|
2111
2445
|
maxPrice?: BN
|
|
2112
2446
|
): Promise<TransactionSignature> {
|
|
2447
|
+
const initializePrelaunchOracleIx =
|
|
2448
|
+
await this.getInitializePrelaunchOracleIx(
|
|
2449
|
+
perpMarketIndex,
|
|
2450
|
+
price,
|
|
2451
|
+
maxPrice
|
|
2452
|
+
);
|
|
2453
|
+
|
|
2454
|
+
const tx = await this.buildTransaction(initializePrelaunchOracleIx);
|
|
2455
|
+
|
|
2456
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
2457
|
+
|
|
2458
|
+
return txSig;
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
public async getInitializePrelaunchOracleIx(
|
|
2462
|
+
perpMarketIndex: number,
|
|
2463
|
+
price?: BN,
|
|
2464
|
+
maxPrice?: BN
|
|
2465
|
+
): Promise<TransactionInstruction> {
|
|
2113
2466
|
const params = {
|
|
2114
2467
|
perpMarketIndex,
|
|
2115
2468
|
price: price || null,
|
|
2116
2469
|
maxPrice: maxPrice || null,
|
|
2117
2470
|
};
|
|
2118
2471
|
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
}
|
|
2472
|
+
return await this.program.instruction.initializePrelaunchOracle(params, {
|
|
2473
|
+
accounts: {
|
|
2474
|
+
admin: this.isSubscribed
|
|
2475
|
+
? this.getStateAccount().admin
|
|
2476
|
+
: this.wallet.publicKey,
|
|
2477
|
+
state: await this.getStatePublicKey(),
|
|
2478
|
+
prelaunchOracle: await getPrelaunchOraclePublicKey(
|
|
2479
|
+
this.program.programId,
|
|
2480
|
+
perpMarketIndex
|
|
2481
|
+
),
|
|
2482
|
+
rent: SYSVAR_RENT_PUBKEY,
|
|
2483
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
2484
|
+
},
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2132
2487
|
|
|
2133
|
-
|
|
2488
|
+
public async updatePrelaunchOracleParams(
|
|
2489
|
+
perpMarketIndex: number,
|
|
2490
|
+
price?: BN,
|
|
2491
|
+
maxPrice?: BN
|
|
2492
|
+
): Promise<TransactionSignature> {
|
|
2493
|
+
const updatePrelaunchOracleParamsIx =
|
|
2494
|
+
await this.getUpdatePrelaunchOracleParamsIx(
|
|
2495
|
+
perpMarketIndex,
|
|
2496
|
+
price,
|
|
2497
|
+
maxPrice
|
|
2498
|
+
);
|
|
2499
|
+
|
|
2500
|
+
const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
|
|
2134
2501
|
|
|
2135
2502
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
2136
2503
|
|
|
2137
2504
|
return txSig;
|
|
2138
2505
|
}
|
|
2139
2506
|
|
|
2140
|
-
public async
|
|
2507
|
+
public async getUpdatePrelaunchOracleParamsIx(
|
|
2141
2508
|
perpMarketIndex: number,
|
|
2142
2509
|
price?: BN,
|
|
2143
2510
|
maxPrice?: BN
|
|
2144
|
-
): Promise<
|
|
2511
|
+
): Promise<TransactionInstruction> {
|
|
2145
2512
|
const params = {
|
|
2146
2513
|
perpMarketIndex,
|
|
2147
2514
|
price: price || null,
|
|
@@ -2153,44 +2520,27 @@ export class AdminClient extends DriftClient {
|
|
|
2153
2520
|
perpMarketIndex
|
|
2154
2521
|
);
|
|
2155
2522
|
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
|
-
const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
|
|
2170
|
-
|
|
2171
|
-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
2172
|
-
|
|
2173
|
-
return txSig;
|
|
2523
|
+
return await this.program.instruction.updatePrelaunchOracleParams(params, {
|
|
2524
|
+
accounts: {
|
|
2525
|
+
admin: this.isSubscribed
|
|
2526
|
+
? this.getStateAccount().admin
|
|
2527
|
+
: this.wallet.publicKey,
|
|
2528
|
+
state: await this.getStatePublicKey(),
|
|
2529
|
+
perpMarket: perpMarketPublicKey,
|
|
2530
|
+
prelaunchOracle: await getPrelaunchOraclePublicKey(
|
|
2531
|
+
this.program.programId,
|
|
2532
|
+
perpMarketIndex
|
|
2533
|
+
),
|
|
2534
|
+
},
|
|
2535
|
+
});
|
|
2174
2536
|
}
|
|
2175
2537
|
|
|
2176
2538
|
public async deletePrelaunchOracle(
|
|
2177
2539
|
perpMarketIndex: number
|
|
2178
2540
|
): Promise<TransactionSignature> {
|
|
2179
|
-
const deletePrelaunchOracleIx =
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
admin: this.wallet.publicKey,
|
|
2183
|
-
state: await this.getStatePublicKey(),
|
|
2184
|
-
prelaunchOracle: await getPrelaunchOraclePublicKey(
|
|
2185
|
-
this.program.programId,
|
|
2186
|
-
perpMarketIndex
|
|
2187
|
-
),
|
|
2188
|
-
perpMarket: await getPerpMarketPublicKey(
|
|
2189
|
-
this.program.programId,
|
|
2190
|
-
perpMarketIndex
|
|
2191
|
-
),
|
|
2192
|
-
},
|
|
2193
|
-
});
|
|
2541
|
+
const deletePrelaunchOracleIx = await this.getDeletePrelaunchOracleIx(
|
|
2542
|
+
perpMarketIndex
|
|
2543
|
+
);
|
|
2194
2544
|
|
|
2195
2545
|
const tx = await this.buildTransaction(deletePrelaunchOracleIx);
|
|
2196
2546
|
|
|
@@ -2198,4 +2548,35 @@ export class AdminClient extends DriftClient {
|
|
|
2198
2548
|
|
|
2199
2549
|
return txSig;
|
|
2200
2550
|
}
|
|
2551
|
+
|
|
2552
|
+
public async getDeletePrelaunchOracleIx(
|
|
2553
|
+
perpMarketIndex: number,
|
|
2554
|
+
price?: BN,
|
|
2555
|
+
maxPrice?: BN
|
|
2556
|
+
): Promise<TransactionInstruction> {
|
|
2557
|
+
const params = {
|
|
2558
|
+
perpMarketIndex,
|
|
2559
|
+
price: price || null,
|
|
2560
|
+
maxPrice: maxPrice || null,
|
|
2561
|
+
};
|
|
2562
|
+
|
|
2563
|
+
const perpMarketPublicKey = await getPerpMarketPublicKey(
|
|
2564
|
+
this.program.programId,
|
|
2565
|
+
perpMarketIndex
|
|
2566
|
+
);
|
|
2567
|
+
|
|
2568
|
+
return await this.program.instruction.getDeletePrelaunchOracleIx(params, {
|
|
2569
|
+
accounts: {
|
|
2570
|
+
admin: this.isSubscribed
|
|
2571
|
+
? this.getStateAccount().admin
|
|
2572
|
+
: this.wallet.publicKey,
|
|
2573
|
+
state: await this.getStatePublicKey(),
|
|
2574
|
+
perpMarket: perpMarketPublicKey,
|
|
2575
|
+
prelaunchOracle: await getPrelaunchOraclePublicKey(
|
|
2576
|
+
this.program.programId,
|
|
2577
|
+
perpMarketIndex
|
|
2578
|
+
),
|
|
2579
|
+
},
|
|
2580
|
+
});
|
|
2581
|
+
}
|
|
2201
2582
|
}
|