@drift-labs/sdk 2.74.0-beta.13 → 2.74.0-beta.14
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 +9 -9
- package/lib/adminClient.js +265 -99
- package/lib/driftClient.js +3 -1
- package/lib/idl/drift.json +6 -0
- package/package.json +1 -1
- package/src/adminClient.ts +266 -110
- package/src/driftClient.ts +3 -1
- package/src/idl/drift.json +6 -0
package/lib/adminClient.js
CHANGED
|
@@ -46,7 +46,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
46
46
|
const [driftStatePublicKey] = await (0, pda_1.getDriftStateAccountPublicKeyAndNonce)(this.program.programId);
|
|
47
47
|
const initializeIx = await this.program.instruction.initialize({
|
|
48
48
|
accounts: {
|
|
49
|
-
admin: this.
|
|
49
|
+
admin: this.isSubscribed
|
|
50
|
+
? this.getStateAccount().admin
|
|
51
|
+
: this.wallet.publicKey,
|
|
50
52
|
state: driftStatePublicKey,
|
|
51
53
|
quoteAssetMint: usdcMint,
|
|
52
54
|
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
@@ -61,7 +63,7 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
61
63
|
}
|
|
62
64
|
async initializeSpotMarket(mint, optimalUtilization, optimalRate, maxRate, oracle, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0, liquidatorFee = 0, ifLiquidationFee = 0, activeStatus = true, assetTier = types_1.AssetTier.COLLATERAL, scaleInitialAssetWeightStart = numericConstants_1.ZERO, withdrawGuardThreshold = numericConstants_1.ZERO, orderTickSize = numericConstants_1.ONE, orderStepSize = numericConstants_1.ONE, ifTotalFactor = 0, name = userName_1.DEFAULT_MARKET_NAME) {
|
|
63
65
|
const spotMarketIndex = this.getStateAccount().numberOfSpotMarkets;
|
|
64
|
-
const initializeIx = await this.getInitializeSpotMarketIx(
|
|
66
|
+
const initializeIx = await this.getInitializeSpotMarketIx(mint, optimalUtilization, optimalRate, maxRate, oracle, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, liquidatorFee, ifLiquidationFee, activeStatus, assetTier, scaleInitialAssetWeightStart, withdrawGuardThreshold, orderTickSize, orderStepSize, ifTotalFactor, name);
|
|
65
67
|
const tx = await this.buildTransaction(initializeIx);
|
|
66
68
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
67
69
|
// const { txSig } = await this.sendTransaction(initializeTx, [], this.opts);
|
|
@@ -73,7 +75,7 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
73
75
|
await this.accountSubscriber.setSpotOracleMap();
|
|
74
76
|
return txSig;
|
|
75
77
|
}
|
|
76
|
-
async getInitializeSpotMarketIx(
|
|
78
|
+
async getInitializeSpotMarketIx(mint, optimalUtilization, optimalRate, maxRate, oracle, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0, liquidatorFee = 0, ifLiquidationFee = 0, activeStatus = true, assetTier = types_1.AssetTier.COLLATERAL, scaleInitialAssetWeightStart = numericConstants_1.ZERO, withdrawGuardThreshold = numericConstants_1.ZERO, orderTickSize = numericConstants_1.ONE, orderStepSize = numericConstants_1.ONE, ifTotalFactor = 0, name = userName_1.DEFAULT_MARKET_NAME) {
|
|
77
79
|
const spotMarketIndex = this.getStateAccount().numberOfSpotMarkets;
|
|
78
80
|
const spotMarket = await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex);
|
|
79
81
|
const spotMarketVault = await (0, pda_1.getSpotMarketVaultPublicKey)(this.program.programId, spotMarketIndex);
|
|
@@ -81,7 +83,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
81
83
|
const nameBuffer = (0, userName_1.encodeName)(name);
|
|
82
84
|
const initializeIx = await this.program.instruction.initializeSpotMarket(optimalUtilization, optimalRate, maxRate, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, liquidatorFee, ifLiquidationFee, activeStatus, assetTier, scaleInitialAssetWeightStart, withdrawGuardThreshold, orderTickSize, orderStepSize, ifTotalFactor, nameBuffer, {
|
|
83
85
|
accounts: {
|
|
84
|
-
admin
|
|
86
|
+
admin: this.isSubscribed
|
|
87
|
+
? this.getStateAccount().admin
|
|
88
|
+
: this.wallet.publicKey,
|
|
85
89
|
state: await this.getStatePublicKey(),
|
|
86
90
|
spotMarket,
|
|
87
91
|
spotMarketVault,
|
|
@@ -97,17 +101,19 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
97
101
|
return initializeIx;
|
|
98
102
|
}
|
|
99
103
|
async initializeSerumFulfillmentConfig(marketIndex, serumMarket, serumProgram) {
|
|
100
|
-
const initializeIx = await this.getInitializeSerumFulfillmentConfigIx(
|
|
104
|
+
const initializeIx = await this.getInitializeSerumFulfillmentConfigIx(marketIndex, serumMarket, serumProgram);
|
|
101
105
|
const tx = await this.buildTransaction(initializeIx);
|
|
102
106
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
103
107
|
return txSig;
|
|
104
108
|
}
|
|
105
|
-
async getInitializeSerumFulfillmentConfigIx(
|
|
109
|
+
async getInitializeSerumFulfillmentConfigIx(marketIndex, serumMarket, serumProgram) {
|
|
106
110
|
const serumOpenOrders = (0, pda_1.getSerumOpenOrdersPublicKey)(this.program.programId, serumMarket);
|
|
107
111
|
const serumFulfillmentConfig = (0, pda_1.getSerumFulfillmentConfigPublicKey)(this.program.programId, serumMarket);
|
|
108
112
|
return await this.program.instruction.initializeSerumFulfillmentConfig(marketIndex, {
|
|
109
113
|
accounts: {
|
|
110
|
-
admin
|
|
114
|
+
admin: this.isSubscribed
|
|
115
|
+
? this.getStateAccount().admin
|
|
116
|
+
: this.wallet.publicKey,
|
|
111
117
|
state: await this.getStatePublicKey(),
|
|
112
118
|
baseSpotMarket: this.getSpotMarketAccount(marketIndex).pubkey,
|
|
113
119
|
quoteSpotMarket: this.getQuoteSpotMarketAccount().pubkey,
|
|
@@ -122,16 +128,18 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
122
128
|
});
|
|
123
129
|
}
|
|
124
130
|
async initializePhoenixFulfillmentConfig(marketIndex, phoenixMarket) {
|
|
125
|
-
const initializeIx = await this.getInitializePhoenixFulfillmentConfigIx(
|
|
131
|
+
const initializeIx = await this.getInitializePhoenixFulfillmentConfigIx(marketIndex, phoenixMarket);
|
|
126
132
|
const tx = await this.buildTransaction(initializeIx);
|
|
127
133
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
128
134
|
return txSig;
|
|
129
135
|
}
|
|
130
|
-
async getInitializePhoenixFulfillmentConfigIx(
|
|
136
|
+
async getInitializePhoenixFulfillmentConfigIx(marketIndex, phoenixMarket) {
|
|
131
137
|
const phoenixFulfillmentConfig = (0, pda_1.getPhoenixFulfillmentConfigPublicKey)(this.program.programId, phoenixMarket);
|
|
132
138
|
return await this.program.instruction.initializePhoenixFulfillmentConfig(marketIndex, {
|
|
133
139
|
accounts: {
|
|
134
|
-
admin
|
|
140
|
+
admin: this.isSubscribed
|
|
141
|
+
? this.getStateAccount().admin
|
|
142
|
+
: this.wallet.publicKey,
|
|
135
143
|
state: await this.getStatePublicKey(),
|
|
136
144
|
baseSpotMarket: this.getSpotMarketAccount(marketIndex).pubkey,
|
|
137
145
|
quoteSpotMarket: this.getQuoteSpotMarketAccount().pubkey,
|
|
@@ -144,9 +152,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
144
152
|
},
|
|
145
153
|
});
|
|
146
154
|
}
|
|
147
|
-
async initializePerpMarket(marketIndex, priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier = numericConstants_1.PEG_PRECISION, oracleSource = types_1.OracleSource.PYTH, marginRatioInitial = 2000, marginRatioMaintenance = 500, liquidatorFee = 0, ifLiquidatorFee = 10000, imfFactor = 0, activeStatus = true, baseSpread = 0, maxSpread = 142500, maxOpenInterest = numericConstants_1.ZERO, maxRevenueWithdrawPerPeriod = numericConstants_1.ZERO, quoteMaxInsurance = numericConstants_1.ZERO, orderStepSize = numericConstants_1.BASE_PRECISION.divn(10000), orderTickSize = numericConstants_1.PRICE_PRECISION.divn(100000), minOrderSize = numericConstants_1.BASE_PRECISION.divn(10000), concentrationCoefScale = numericConstants_1.ONE, curveUpdateIntensity = 0, ammJitIntensity = 0, name = userName_1.DEFAULT_MARKET_NAME) {
|
|
155
|
+
async initializePerpMarket(marketIndex, priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier = numericConstants_1.PEG_PRECISION, oracleSource = types_1.OracleSource.PYTH, contractTier = types_1.ContractTier.SPECULATIVE, marginRatioInitial = 2000, marginRatioMaintenance = 500, liquidatorFee = 0, ifLiquidatorFee = 10000, imfFactor = 0, activeStatus = true, baseSpread = 0, maxSpread = 142500, maxOpenInterest = numericConstants_1.ZERO, maxRevenueWithdrawPerPeriod = numericConstants_1.ZERO, quoteMaxInsurance = numericConstants_1.ZERO, orderStepSize = numericConstants_1.BASE_PRECISION.divn(10000), orderTickSize = numericConstants_1.PRICE_PRECISION.divn(100000), minOrderSize = numericConstants_1.BASE_PRECISION.divn(10000), concentrationCoefScale = numericConstants_1.ONE, curveUpdateIntensity = 0, ammJitIntensity = 0, name = userName_1.DEFAULT_MARKET_NAME) {
|
|
148
156
|
const currentPerpMarketIndex = this.getStateAccount().numberOfMarkets;
|
|
149
|
-
const initializeMarketIx = await this.getInitializePerpMarketIx(
|
|
157
|
+
const initializeMarketIx = await this.getInitializePerpMarketIx(marketIndex, priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier, oracleSource, contractTier, marginRatioInitial, marginRatioMaintenance, liquidatorFee, ifLiquidatorFee, imfFactor, activeStatus, baseSpread, maxSpread, maxOpenInterest, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, orderStepSize, orderTickSize, minOrderSize, concentrationCoefScale, curveUpdateIntensity, ammJitIntensity, name);
|
|
150
158
|
const tx = await this.buildTransaction(initializeMarketIx);
|
|
151
159
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
152
160
|
while (this.getStateAccount().numberOfMarkets <= currentPerpMarketIndex) {
|
|
@@ -160,14 +168,16 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
160
168
|
await this.accountSubscriber.setPerpOracleMap();
|
|
161
169
|
return txSig;
|
|
162
170
|
}
|
|
163
|
-
async getInitializePerpMarketIx(
|
|
171
|
+
async getInitializePerpMarketIx(marketIndex, priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier = numericConstants_1.PEG_PRECISION, oracleSource = types_1.OracleSource.PYTH, contractTier = types_1.ContractTier.SPECULATIVE, marginRatioInitial = 2000, marginRatioMaintenance = 500, liquidatorFee = 0, ifLiquidatorFee = 10000, imfFactor = 0, activeStatus = true, baseSpread = 0, maxSpread = 142500, maxOpenInterest = numericConstants_1.ZERO, maxRevenueWithdrawPerPeriod = numericConstants_1.ZERO, quoteMaxInsurance = numericConstants_1.ZERO, orderStepSize = numericConstants_1.BASE_PRECISION.divn(10000), orderTickSize = numericConstants_1.PRICE_PRECISION.divn(100000), minOrderSize = numericConstants_1.BASE_PRECISION.divn(10000), concentrationCoefScale = numericConstants_1.ONE, curveUpdateIntensity = 0, ammJitIntensity = 0, name = userName_1.DEFAULT_MARKET_NAME) {
|
|
164
172
|
const currentPerpMarketIndex = this.getStateAccount().numberOfMarkets;
|
|
165
173
|
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, currentPerpMarketIndex);
|
|
166
174
|
const nameBuffer = (0, userName_1.encodeName)(name);
|
|
167
|
-
return await this.program.instruction.initializePerpMarket(marketIndex, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier, oracleSource, marginRatioInitial, marginRatioMaintenance, liquidatorFee, ifLiquidatorFee, imfFactor, activeStatus, baseSpread, maxSpread, maxOpenInterest, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, orderStepSize, orderTickSize, minOrderSize, concentrationCoefScale, curveUpdateIntensity, ammJitIntensity, nameBuffer, {
|
|
175
|
+
return await this.program.instruction.initializePerpMarket(marketIndex, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier, oracleSource, contractTier, marginRatioInitial, marginRatioMaintenance, liquidatorFee, ifLiquidatorFee, imfFactor, activeStatus, baseSpread, maxSpread, maxOpenInterest, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, orderStepSize, orderTickSize, minOrderSize, concentrationCoefScale, curveUpdateIntensity, ammJitIntensity, nameBuffer, {
|
|
168
176
|
accounts: {
|
|
169
177
|
state: await this.getStatePublicKey(),
|
|
170
|
-
admin
|
|
178
|
+
admin: this.isSubscribed
|
|
179
|
+
? this.getStateAccount().admin
|
|
180
|
+
: this.wallet.publicKey,
|
|
171
181
|
oracle: priceOracle,
|
|
172
182
|
perpMarket: perpMarketPublicKey,
|
|
173
183
|
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
@@ -180,7 +190,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
180
190
|
const deleteInitializeMarketIx = await this.program.instruction.deleteInitializedPerpMarket(marketIndex, {
|
|
181
191
|
accounts: {
|
|
182
192
|
state: await this.getStatePublicKey(),
|
|
183
|
-
admin: this.
|
|
193
|
+
admin: this.isSubscribed
|
|
194
|
+
? this.getStateAccount().admin
|
|
195
|
+
: this.wallet.publicKey,
|
|
184
196
|
perpMarket: perpMarketPublicKey,
|
|
185
197
|
},
|
|
186
198
|
});
|
|
@@ -196,7 +208,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
196
208
|
const moveAmmPriceIx = await this.program.instruction.moveAmmPrice(baseAssetReserve, quoteAssetReserve, sqrtK, {
|
|
197
209
|
accounts: {
|
|
198
210
|
state: await this.getStatePublicKey(),
|
|
199
|
-
admin: this.
|
|
211
|
+
admin: this.isSubscribed
|
|
212
|
+
? this.getStateAccount().admin
|
|
213
|
+
: this.wallet.publicKey,
|
|
200
214
|
perpMarket: marketPublicKey,
|
|
201
215
|
},
|
|
202
216
|
});
|
|
@@ -208,7 +222,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
208
222
|
const updateKIx = await this.program.instruction.updateK(sqrtK, {
|
|
209
223
|
accounts: {
|
|
210
224
|
state: await this.getStatePublicKey(),
|
|
211
|
-
admin: this.
|
|
225
|
+
admin: this.isSubscribed
|
|
226
|
+
? this.getStateAccount().admin
|
|
227
|
+
: this.wallet.publicKey,
|
|
212
228
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
213
229
|
oracle: this.getPerpMarketAccount(perpMarketIndex).amm.oracle,
|
|
214
230
|
},
|
|
@@ -222,7 +238,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
222
238
|
const recenterPerpMarketAmmIx = await this.program.instruction.recenterPerpMarketAmm(pegMultiplier, sqrtK, {
|
|
223
239
|
accounts: {
|
|
224
240
|
state: await this.getStatePublicKey(),
|
|
225
|
-
admin: this.
|
|
241
|
+
admin: this.isSubscribed
|
|
242
|
+
? this.getStateAccount().admin
|
|
243
|
+
: this.wallet.publicKey,
|
|
226
244
|
perpMarket: marketPublicKey,
|
|
227
245
|
},
|
|
228
246
|
});
|
|
@@ -234,7 +252,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
234
252
|
const updatePerpMarketConcentrationCoefIx = await this.program.instruction.updatePerpMarketConcentrationCoef(concentrationScale, {
|
|
235
253
|
accounts: {
|
|
236
254
|
state: await this.getStatePublicKey(),
|
|
237
|
-
admin: this.
|
|
255
|
+
admin: this.isSubscribed
|
|
256
|
+
? this.getStateAccount().admin
|
|
257
|
+
: this.wallet.publicKey,
|
|
238
258
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
239
259
|
},
|
|
240
260
|
});
|
|
@@ -251,7 +271,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
251
271
|
const moveAmmPriceIx = await this.program.instruction.moveAmmPrice(newBaseAssetAmount, newQuoteAssetAmount, perpMarket.amm.sqrtK, {
|
|
252
272
|
accounts: {
|
|
253
273
|
state: await this.getStatePublicKey(),
|
|
254
|
-
admin: this.
|
|
274
|
+
admin: this.isSubscribed
|
|
275
|
+
? this.getStateAccount().admin
|
|
276
|
+
: this.wallet.publicKey,
|
|
255
277
|
perpMarket: perpMarketPublicKey,
|
|
256
278
|
},
|
|
257
279
|
});
|
|
@@ -265,7 +287,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
265
287
|
const repegAmmCurveIx = await this.program.instruction.repegAmmCurve(newPeg, {
|
|
266
288
|
accounts: {
|
|
267
289
|
state: await this.getStatePublicKey(),
|
|
268
|
-
admin: this.
|
|
290
|
+
admin: this.isSubscribed
|
|
291
|
+
? this.getStateAccount().admin
|
|
292
|
+
: this.wallet.publicKey,
|
|
269
293
|
oracle: ammData.oracle,
|
|
270
294
|
perpMarket: perpMarketPublicKey,
|
|
271
295
|
},
|
|
@@ -280,7 +304,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
280
304
|
const updatePerpMarketAmmOracleTwapIx = await this.program.instruction.updatePerpMarketAmmOracleTwap({
|
|
281
305
|
accounts: {
|
|
282
306
|
state: await this.getStatePublicKey(),
|
|
283
|
-
admin: this.
|
|
307
|
+
admin: this.isSubscribed
|
|
308
|
+
? this.getStateAccount().admin
|
|
309
|
+
: this.wallet.publicKey,
|
|
284
310
|
oracle: ammData.oracle,
|
|
285
311
|
perpMarket: perpMarketPublicKey,
|
|
286
312
|
},
|
|
@@ -295,7 +321,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
295
321
|
const resetPerpMarketAmmOracleTwapIx = await this.program.instruction.resetPerpMarketAmmOracleTwap({
|
|
296
322
|
accounts: {
|
|
297
323
|
state: await this.getStatePublicKey(),
|
|
298
|
-
admin: this.
|
|
324
|
+
admin: this.isSubscribed
|
|
325
|
+
? this.getStateAccount().admin
|
|
326
|
+
: this.wallet.publicKey,
|
|
299
327
|
oracle: ammData.oracle,
|
|
300
328
|
perpMarket: perpMarketPublicKey,
|
|
301
329
|
},
|
|
@@ -308,7 +336,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
308
336
|
const spotMarket = this.getQuoteSpotMarketAccount();
|
|
309
337
|
const depositIntoPerpMarketFeePoolIx = await this.program.instruction.depositIntoPerpMarketFeePool(amount, {
|
|
310
338
|
accounts: {
|
|
311
|
-
admin: this.
|
|
339
|
+
admin: this.isSubscribed
|
|
340
|
+
? this.getStateAccount().admin
|
|
341
|
+
: this.wallet.publicKey,
|
|
312
342
|
state: await this.getStatePublicKey(),
|
|
313
343
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
314
344
|
sourceVault,
|
|
@@ -325,7 +355,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
325
355
|
async updateAdmin(admin) {
|
|
326
356
|
const updateAdminIx = await this.program.instruction.updateAdmin(admin, {
|
|
327
357
|
accounts: {
|
|
328
|
-
admin: this.
|
|
358
|
+
admin: this.isSubscribed
|
|
359
|
+
? this.getStateAccount().admin
|
|
360
|
+
: this.wallet.publicKey,
|
|
329
361
|
state: await this.getStatePublicKey(),
|
|
330
362
|
},
|
|
331
363
|
});
|
|
@@ -338,7 +370,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
338
370
|
// assert(Number.isInteger(curveUpdateIntensity));
|
|
339
371
|
const updatePerpMarketCurveUpdateIntensityIx = await this.program.instruction.updatePerpMarketCurveUpdateIntensity(curveUpdateIntensity, {
|
|
340
372
|
accounts: {
|
|
341
|
-
admin: this.
|
|
373
|
+
admin: this.isSubscribed
|
|
374
|
+
? this.getStateAccount().admin
|
|
375
|
+
: this.wallet.publicKey,
|
|
342
376
|
state: await this.getStatePublicKey(),
|
|
343
377
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
344
378
|
},
|
|
@@ -350,7 +384,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
350
384
|
async updatePerpMarketTargetBaseAssetAmountPerLp(perpMarketIndex, targetBaseAssetAmountPerLP) {
|
|
351
385
|
const updatePerpMarketTargetBaseAssetAmountPerLpIx = await this.program.instruction.updatePerpMarketTargetBaseAssetAmountPerLp(targetBaseAssetAmountPerLP, {
|
|
352
386
|
accounts: {
|
|
353
|
-
admin: this.
|
|
387
|
+
admin: this.isSubscribed
|
|
388
|
+
? this.getStateAccount().admin
|
|
389
|
+
: this.wallet.publicKey,
|
|
354
390
|
state: await this.getStatePublicKey(),
|
|
355
391
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
356
392
|
},
|
|
@@ -362,7 +398,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
362
398
|
async updatePerpMarketMarginRatio(perpMarketIndex, marginRatioInitial, marginRatioMaintenance) {
|
|
363
399
|
const updatePerpMarketMarginRatioIx = await this.program.instruction.updatePerpMarketMarginRatio(marginRatioInitial, marginRatioMaintenance, {
|
|
364
400
|
accounts: {
|
|
365
|
-
admin: this.
|
|
401
|
+
admin: this.isSubscribed
|
|
402
|
+
? this.getStateAccount().admin
|
|
403
|
+
: this.wallet.publicKey,
|
|
366
404
|
state: await this.getStatePublicKey(),
|
|
367
405
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
368
406
|
},
|
|
@@ -374,7 +412,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
374
412
|
async updatePerpMarketImfFactor(perpMarketIndex, imfFactor, unrealizedPnlImfFactor) {
|
|
375
413
|
const updatePerpMarketImfFactorIx = await this.program.instruction.updatePerpMarketImfFactor(imfFactor, unrealizedPnlImfFactor, {
|
|
376
414
|
accounts: {
|
|
377
|
-
admin: this.
|
|
415
|
+
admin: this.isSubscribed
|
|
416
|
+
? this.getStateAccount().admin
|
|
417
|
+
: this.wallet.publicKey,
|
|
378
418
|
state: await this.getStatePublicKey(),
|
|
379
419
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
380
420
|
},
|
|
@@ -386,7 +426,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
386
426
|
async updatePerpMarketBaseSpread(perpMarketIndex, baseSpread) {
|
|
387
427
|
const updatePerpMarketBaseSpreadIx = await this.program.instruction.updatePerpMarketBaseSpread(baseSpread, {
|
|
388
428
|
accounts: {
|
|
389
|
-
admin: this.
|
|
429
|
+
admin: this.isSubscribed
|
|
430
|
+
? this.getStateAccount().admin
|
|
431
|
+
: this.wallet.publicKey,
|
|
390
432
|
state: await this.getStatePublicKey(),
|
|
391
433
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
392
434
|
},
|
|
@@ -398,7 +440,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
398
440
|
async updateAmmJitIntensity(perpMarketIndex, ammJitIntensity) {
|
|
399
441
|
const updateAmmJitIntensityIx = await this.program.instruction.updateAmmJitIntensity(ammJitIntensity, {
|
|
400
442
|
accounts: {
|
|
401
|
-
admin: this.
|
|
443
|
+
admin: this.isSubscribed
|
|
444
|
+
? this.getStateAccount().admin
|
|
445
|
+
: this.wallet.publicKey,
|
|
402
446
|
state: await this.getStatePublicKey(),
|
|
403
447
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
404
448
|
},
|
|
@@ -411,7 +455,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
411
455
|
const nameBuffer = (0, userName_1.encodeName)(name);
|
|
412
456
|
const updatePerpMarketNameIx = await this.program.instruction.updatePerpMarketName(nameBuffer, {
|
|
413
457
|
accounts: {
|
|
414
|
-
admin: this.
|
|
458
|
+
admin: this.isSubscribed
|
|
459
|
+
? this.getStateAccount().admin
|
|
460
|
+
: this.wallet.publicKey,
|
|
415
461
|
state: await this.getStatePublicKey(),
|
|
416
462
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
417
463
|
},
|
|
@@ -424,7 +470,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
424
470
|
const nameBuffer = (0, userName_1.encodeName)(name);
|
|
425
471
|
const updateSpotMarketNameIx = await this.program.instruction.updateSpotMarketName(nameBuffer, {
|
|
426
472
|
accounts: {
|
|
427
|
-
admin: this.
|
|
473
|
+
admin: this.isSubscribed
|
|
474
|
+
? this.getStateAccount().admin
|
|
475
|
+
: this.wallet.publicKey,
|
|
428
476
|
state: await this.getStatePublicKey(),
|
|
429
477
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
430
478
|
},
|
|
@@ -437,7 +485,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
437
485
|
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
438
486
|
const updatePerpMarketPerLpBaseIx = await this.program.instruction.updatePerpMarketPerLpBase(perLpBase, {
|
|
439
487
|
accounts: {
|
|
440
|
-
admin: this.
|
|
488
|
+
admin: this.isSubscribed
|
|
489
|
+
? this.getStateAccount().admin
|
|
490
|
+
: this.wallet.publicKey,
|
|
441
491
|
state: await this.getStatePublicKey(),
|
|
442
492
|
perpMarket: perpMarketPublicKey,
|
|
443
493
|
},
|
|
@@ -450,7 +500,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
450
500
|
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
451
501
|
const updatePerpMarketMaxSpreadIx = await this.program.instruction.updatePerpMarketMaxSpread(maxSpread, {
|
|
452
502
|
accounts: {
|
|
453
|
-
admin: this.
|
|
503
|
+
admin: this.isSubscribed
|
|
504
|
+
? this.getStateAccount().admin
|
|
505
|
+
: this.wallet.publicKey,
|
|
454
506
|
state: await this.getStatePublicKey(),
|
|
455
507
|
perpMarket: perpMarketPublicKey,
|
|
456
508
|
},
|
|
@@ -462,7 +514,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
462
514
|
async updatePerpFeeStructure(feeStructure) {
|
|
463
515
|
const updatePerpFeeStructureIx = this.program.instruction.updatePerpFeeStructure(feeStructure, {
|
|
464
516
|
accounts: {
|
|
465
|
-
admin: this.
|
|
517
|
+
admin: this.isSubscribed
|
|
518
|
+
? this.getStateAccount().admin
|
|
519
|
+
: this.wallet.publicKey,
|
|
466
520
|
state: await this.getStatePublicKey(),
|
|
467
521
|
},
|
|
468
522
|
});
|
|
@@ -473,7 +527,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
473
527
|
async updateSpotFeeStructure(feeStructure) {
|
|
474
528
|
const updateSpotFeeStructureIx = await this.program.instruction.updateSpotFeeStructure(feeStructure, {
|
|
475
529
|
accounts: {
|
|
476
|
-
admin: this.
|
|
530
|
+
admin: this.isSubscribed
|
|
531
|
+
? this.getStateAccount().admin
|
|
532
|
+
: this.wallet.publicKey,
|
|
477
533
|
state: await this.getStatePublicKey(),
|
|
478
534
|
},
|
|
479
535
|
});
|
|
@@ -484,7 +540,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
484
540
|
async updateInitialPctToLiquidate(initialPctToLiquidate) {
|
|
485
541
|
const updateInitialPctToLiquidateIx = await this.program.instruction.updateInitialPctToLiquidate(initialPctToLiquidate, {
|
|
486
542
|
accounts: {
|
|
487
|
-
admin: this.
|
|
543
|
+
admin: this.isSubscribed
|
|
544
|
+
? this.getStateAccount().admin
|
|
545
|
+
: this.wallet.publicKey,
|
|
488
546
|
state: await this.getStatePublicKey(),
|
|
489
547
|
},
|
|
490
548
|
});
|
|
@@ -495,7 +553,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
495
553
|
async updateLiquidationDuration(liquidationDuration) {
|
|
496
554
|
const updateLiquidationDurationIx = await this.program.instruction.updateLiquidationDuration(liquidationDuration, {
|
|
497
555
|
accounts: {
|
|
498
|
-
admin: this.
|
|
556
|
+
admin: this.isSubscribed
|
|
557
|
+
? this.getStateAccount().admin
|
|
558
|
+
: this.wallet.publicKey,
|
|
499
559
|
state: await this.getStatePublicKey(),
|
|
500
560
|
},
|
|
501
561
|
});
|
|
@@ -506,7 +566,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
506
566
|
async updateLiquidationMarginBufferRatio(updateLiquidationMarginBufferRatio) {
|
|
507
567
|
const updateLiquidationMarginBufferRatioIx = await this.program.instruction.updateLiquidationMarginBufferRatio(updateLiquidationMarginBufferRatio, {
|
|
508
568
|
accounts: {
|
|
509
|
-
admin: this.
|
|
569
|
+
admin: this.isSubscribed
|
|
570
|
+
? this.getStateAccount().admin
|
|
571
|
+
: this.wallet.publicKey,
|
|
510
572
|
state: await this.getStatePublicKey(),
|
|
511
573
|
},
|
|
512
574
|
});
|
|
@@ -517,7 +579,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
517
579
|
async updateOracleGuardRails(oracleGuardRails) {
|
|
518
580
|
const updateOracleGuardRailsIx = await this.program.instruction.updateOracleGuardRails(oracleGuardRails, {
|
|
519
581
|
accounts: {
|
|
520
|
-
admin: this.
|
|
582
|
+
admin: this.isSubscribed
|
|
583
|
+
? this.getStateAccount().admin
|
|
584
|
+
: this.wallet.publicKey,
|
|
521
585
|
state: await this.getStatePublicKey(),
|
|
522
586
|
},
|
|
523
587
|
});
|
|
@@ -528,7 +592,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
528
592
|
async updateStateSettlementDuration(settlementDuration) {
|
|
529
593
|
const updateStateSettlementDurationIx = await this.program.instruction.updateStateSettlementDuration(settlementDuration, {
|
|
530
594
|
accounts: {
|
|
531
|
-
admin: this.
|
|
595
|
+
admin: this.isSubscribed
|
|
596
|
+
? this.getStateAccount().admin
|
|
597
|
+
: this.wallet.publicKey,
|
|
532
598
|
state: await this.getStatePublicKey(),
|
|
533
599
|
},
|
|
534
600
|
});
|
|
@@ -539,7 +605,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
539
605
|
async updateStateMaxNumberOfSubAccounts(maxNumberOfSubAccounts) {
|
|
540
606
|
const updateStateMaxNumberOfSubAccountsIx = await this.program.instruction.updateStateMaxNumberOfSubAccounts(maxNumberOfSubAccounts, {
|
|
541
607
|
accounts: {
|
|
542
|
-
admin: this.
|
|
608
|
+
admin: this.isSubscribed
|
|
609
|
+
? this.getStateAccount().admin
|
|
610
|
+
: this.wallet.publicKey,
|
|
543
611
|
state: await this.getStatePublicKey(),
|
|
544
612
|
},
|
|
545
613
|
});
|
|
@@ -550,7 +618,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
550
618
|
async updateStateMaxInitializeUserFee(maxInitializeUserFee) {
|
|
551
619
|
const updateStateMaxInitializeUserFeeIx = await this.program.instruction.updateStateMaxInitializeUserFee(maxInitializeUserFee, {
|
|
552
620
|
accounts: {
|
|
553
|
-
admin: this.
|
|
621
|
+
admin: this.isSubscribed
|
|
622
|
+
? this.getStateAccount().admin
|
|
623
|
+
: this.wallet.publicKey,
|
|
554
624
|
state: await this.getStatePublicKey(),
|
|
555
625
|
},
|
|
556
626
|
});
|
|
@@ -561,7 +631,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
561
631
|
async updateWithdrawGuardThreshold(spotMarketIndex, withdrawGuardThreshold) {
|
|
562
632
|
const updateWithdrawGuardThresholdIx = await this.program.instruction.updateWithdrawGuardThreshold(withdrawGuardThreshold, {
|
|
563
633
|
accounts: {
|
|
564
|
-
admin: this.
|
|
634
|
+
admin: this.isSubscribed
|
|
635
|
+
? this.getStateAccount().admin
|
|
636
|
+
: this.wallet.publicKey,
|
|
565
637
|
state: await this.getStatePublicKey(),
|
|
566
638
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
567
639
|
},
|
|
@@ -573,7 +645,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
573
645
|
async updateSpotMarketIfFactor(spotMarketIndex, userIfFactor, totalIfFactor) {
|
|
574
646
|
const updateSpotMarketIfFactorIx = await this.program.instruction.updateSpotMarketIfFactor(spotMarketIndex, userIfFactor, totalIfFactor, {
|
|
575
647
|
accounts: {
|
|
576
|
-
admin: this.
|
|
648
|
+
admin: this.isSubscribed
|
|
649
|
+
? this.getStateAccount().admin
|
|
650
|
+
: this.wallet.publicKey,
|
|
577
651
|
state: await this.getStatePublicKey(),
|
|
578
652
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
579
653
|
},
|
|
@@ -585,7 +659,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
585
659
|
async updateSpotMarketRevenueSettlePeriod(spotMarketIndex, revenueSettlePeriod) {
|
|
586
660
|
const updateSpotMarketRevenueSettlePeriodIx = await this.program.instruction.updateSpotMarketRevenueSettlePeriod(revenueSettlePeriod, {
|
|
587
661
|
accounts: {
|
|
588
|
-
admin: this.
|
|
662
|
+
admin: this.isSubscribed
|
|
663
|
+
? this.getStateAccount().admin
|
|
664
|
+
: this.wallet.publicKey,
|
|
589
665
|
state: await this.getStatePublicKey(),
|
|
590
666
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
591
667
|
},
|
|
@@ -597,7 +673,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
597
673
|
async updateSpotMarketMaxTokenDeposits(spotMarketIndex, maxTokenDeposits) {
|
|
598
674
|
const updateSpotMarketMaxTokenDepositsIx = this.program.instruction.updateSpotMarketMaxTokenDeposits(maxTokenDeposits, {
|
|
599
675
|
accounts: {
|
|
600
|
-
admin: this.
|
|
676
|
+
admin: this.isSubscribed
|
|
677
|
+
? this.getStateAccount().admin
|
|
678
|
+
: this.wallet.publicKey,
|
|
601
679
|
state: await this.getStatePublicKey(),
|
|
602
680
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
603
681
|
},
|
|
@@ -609,7 +687,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
609
687
|
async updateSpotMarketScaleInitialAssetWeightStart(spotMarketIndex, scaleInitialAssetWeightStart) {
|
|
610
688
|
const updateSpotMarketScaleInitialAssetWeightStartIx = this.program.instruction.updateSpotMarketScaleInitialAssetWeightStart(scaleInitialAssetWeightStart, {
|
|
611
689
|
accounts: {
|
|
612
|
-
admin: this.
|
|
690
|
+
admin: this.isSubscribed
|
|
691
|
+
? this.getStateAccount().admin
|
|
692
|
+
: this.wallet.publicKey,
|
|
613
693
|
state: await this.getStatePublicKey(),
|
|
614
694
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
615
695
|
},
|
|
@@ -621,7 +701,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
621
701
|
async updateInsuranceFundUnstakingPeriod(spotMarketIndex, insuranceWithdrawEscrowPeriod) {
|
|
622
702
|
const updateInsuranceFundUnstakingPeriodIx = await this.program.instruction.updateInsuranceFundUnstakingPeriod(insuranceWithdrawEscrowPeriod, {
|
|
623
703
|
accounts: {
|
|
624
|
-
admin: this.
|
|
704
|
+
admin: this.isSubscribed
|
|
705
|
+
? this.getStateAccount().admin
|
|
706
|
+
: this.wallet.publicKey,
|
|
625
707
|
state: await this.getStatePublicKey(),
|
|
626
708
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
627
709
|
},
|
|
@@ -633,7 +715,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
633
715
|
async updateLpCooldownTime(cooldownTime) {
|
|
634
716
|
const updateLpCooldownTimeIx = await this.program.instruction.updateLpCooldownTime(cooldownTime, {
|
|
635
717
|
accounts: {
|
|
636
|
-
admin: this.
|
|
718
|
+
admin: this.isSubscribed
|
|
719
|
+
? this.getStateAccount().admin
|
|
720
|
+
: this.wallet.publicKey,
|
|
637
721
|
state: await this.getStatePublicKey(),
|
|
638
722
|
},
|
|
639
723
|
});
|
|
@@ -644,7 +728,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
644
728
|
async updatePerpMarketOracle(perpMarketIndex, oracle, oracleSource) {
|
|
645
729
|
const updatePerpMarketOracleIx = await this.program.instruction.updatePerpMarketOracle(oracle, oracleSource, {
|
|
646
730
|
accounts: {
|
|
647
|
-
admin: this.
|
|
731
|
+
admin: this.isSubscribed
|
|
732
|
+
? this.getStateAccount().admin
|
|
733
|
+
: this.wallet.publicKey,
|
|
648
734
|
state: await this.getStatePublicKey(),
|
|
649
735
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
650
736
|
oracle: oracle,
|
|
@@ -657,7 +743,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
657
743
|
async updatePerpMarketStepSizeAndTickSize(perpMarketIndex, stepSize, tickSize) {
|
|
658
744
|
const updatePerpMarketStepSizeAndTickSizeIx = await this.program.instruction.updatePerpMarketStepSizeAndTickSize(stepSize, tickSize, {
|
|
659
745
|
accounts: {
|
|
660
|
-
admin: this.
|
|
746
|
+
admin: this.isSubscribed
|
|
747
|
+
? this.getStateAccount().admin
|
|
748
|
+
: this.wallet.publicKey,
|
|
661
749
|
state: await this.getStatePublicKey(),
|
|
662
750
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
663
751
|
},
|
|
@@ -669,7 +757,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
669
757
|
async updatePerpMarketMinOrderSize(perpMarketIndex, orderSize) {
|
|
670
758
|
const updatePerpMarketMinOrderSizeIx = await this.program.instruction.updatePerpMarketMinOrderSize(orderSize, {
|
|
671
759
|
accounts: {
|
|
672
|
-
admin: this.
|
|
760
|
+
admin: this.isSubscribed
|
|
761
|
+
? this.getStateAccount().admin
|
|
762
|
+
: this.wallet.publicKey,
|
|
673
763
|
state: await this.getStatePublicKey(),
|
|
674
764
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
675
765
|
},
|
|
@@ -681,7 +771,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
681
771
|
async updateSpotMarketStepSizeAndTickSize(spotMarketIndex, stepSize, tickSize) {
|
|
682
772
|
const updateSpotMarketStepSizeAndTickSizeIx = await this.program.instruction.updateSpotMarketStepSizeAndTickSize(stepSize, tickSize, {
|
|
683
773
|
accounts: {
|
|
684
|
-
admin: this.
|
|
774
|
+
admin: this.isSubscribed
|
|
775
|
+
? this.getStateAccount().admin
|
|
776
|
+
: this.wallet.publicKey,
|
|
685
777
|
state: await this.getStatePublicKey(),
|
|
686
778
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
687
779
|
},
|
|
@@ -693,7 +785,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
693
785
|
async updateSpotMarketMinOrderSize(spotMarketIndex, orderSize) {
|
|
694
786
|
const updateSpotMarketMinOrderSizeIx = await this.program.instruction.updateSpotMarketMinOrderSize(orderSize, {
|
|
695
787
|
accounts: {
|
|
696
|
-
admin: this.
|
|
788
|
+
admin: this.isSubscribed
|
|
789
|
+
? this.getStateAccount().admin
|
|
790
|
+
: this.wallet.publicKey,
|
|
697
791
|
state: await this.getStatePublicKey(),
|
|
698
792
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
699
793
|
},
|
|
@@ -705,7 +799,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
705
799
|
async updatePerpMarketExpiry(perpMarketIndex, expiryTs) {
|
|
706
800
|
const updatePerpMarketExpiryIx = await this.program.instruction.updatePerpMarketExpiry(expiryTs, {
|
|
707
801
|
accounts: {
|
|
708
|
-
admin: this.
|
|
802
|
+
admin: this.isSubscribed
|
|
803
|
+
? this.getStateAccount().admin
|
|
804
|
+
: this.wallet.publicKey,
|
|
709
805
|
state: await this.getStatePublicKey(),
|
|
710
806
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
711
807
|
},
|
|
@@ -717,7 +813,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
717
813
|
async updateSpotMarketOracle(spotMarketIndex, oracle, oracleSource) {
|
|
718
814
|
const updateSpotMarketOracleIx = await this.program.instruction.updateSpotMarketOracle(oracle, oracleSource, {
|
|
719
815
|
accounts: {
|
|
720
|
-
admin: this.
|
|
816
|
+
admin: this.isSubscribed
|
|
817
|
+
? this.getStateAccount().admin
|
|
818
|
+
: this.wallet.publicKey,
|
|
721
819
|
state: await this.getStatePublicKey(),
|
|
722
820
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
723
821
|
oracle: oracle,
|
|
@@ -730,7 +828,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
730
828
|
async updateSpotMarketOrdersEnabled(spotMarketIndex, ordersEnabled) {
|
|
731
829
|
const updateSpotMarketOrdersEnabledIx = await this.program.instruction.updateSpotMarketOrdersEnabled(ordersEnabled, {
|
|
732
830
|
accounts: {
|
|
733
|
-
admin: this.
|
|
831
|
+
admin: this.isSubscribed
|
|
832
|
+
? this.getStateAccount().admin
|
|
833
|
+
: this.wallet.publicKey,
|
|
734
834
|
state: await this.getStatePublicKey(),
|
|
735
835
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
736
836
|
},
|
|
@@ -742,7 +842,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
742
842
|
async updateSerumFulfillmentConfigStatus(serumFulfillmentConfig, status) {
|
|
743
843
|
const updateSerumFulfillmentConfigStatusIx = await this.program.instruction.updateSerumFulfillmentConfigStatus(status, {
|
|
744
844
|
accounts: {
|
|
745
|
-
admin: this.
|
|
845
|
+
admin: this.isSubscribed
|
|
846
|
+
? this.getStateAccount().admin
|
|
847
|
+
: this.wallet.publicKey,
|
|
746
848
|
state: await this.getStatePublicKey(),
|
|
747
849
|
serumFulfillmentConfig,
|
|
748
850
|
},
|
|
@@ -754,7 +856,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
754
856
|
async updatePhoenixFulfillmentConfigStatus(phoenixFulfillmentConfig, status) {
|
|
755
857
|
const updatePhoenixFulfillmentConfigStatusIx = await this.program.instruction.phoenixFulfillmentConfigStatus(status, {
|
|
756
858
|
accounts: {
|
|
757
|
-
admin: this.
|
|
859
|
+
admin: this.isSubscribed
|
|
860
|
+
? this.getStateAccount().admin
|
|
861
|
+
: this.wallet.publicKey,
|
|
758
862
|
state: await this.getStatePublicKey(),
|
|
759
863
|
phoenixFulfillmentConfig,
|
|
760
864
|
},
|
|
@@ -766,7 +870,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
766
870
|
async updateSpotMarketExpiry(spotMarketIndex, expiryTs) {
|
|
767
871
|
const updateSpotMarketExpiryIx = await this.program.instruction.updateSpotMarketExpiry(expiryTs, {
|
|
768
872
|
accounts: {
|
|
769
|
-
admin: this.
|
|
873
|
+
admin: this.isSubscribed
|
|
874
|
+
? this.getStateAccount().admin
|
|
875
|
+
: this.wallet.publicKey,
|
|
770
876
|
state: await this.getStatePublicKey(),
|
|
771
877
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
772
878
|
},
|
|
@@ -778,7 +884,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
778
884
|
async updateWhitelistMint(whitelistMint) {
|
|
779
885
|
const updateWhitelistMintIx = await this.program.instruction.updateWhitelistMint(whitelistMint, {
|
|
780
886
|
accounts: {
|
|
781
|
-
admin: this.
|
|
887
|
+
admin: this.isSubscribed
|
|
888
|
+
? this.getStateAccount().admin
|
|
889
|
+
: this.wallet.publicKey,
|
|
782
890
|
state: await this.getStatePublicKey(),
|
|
783
891
|
},
|
|
784
892
|
});
|
|
@@ -789,7 +897,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
789
897
|
async updateDiscountMint(discountMint) {
|
|
790
898
|
const updateDiscountMintIx = await this.program.instruction.updateDiscountMint(discountMint, {
|
|
791
899
|
accounts: {
|
|
792
|
-
admin: this.
|
|
900
|
+
admin: this.isSubscribed
|
|
901
|
+
? this.getStateAccount().admin
|
|
902
|
+
: this.wallet.publicKey,
|
|
793
903
|
state: await this.getStatePublicKey(),
|
|
794
904
|
},
|
|
795
905
|
});
|
|
@@ -800,7 +910,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
800
910
|
async updateSpotMarketMarginWeights(spotMarketIndex, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0) {
|
|
801
911
|
const updateSpotMarketMarginWeightsIx = await this.program.instruction.updateSpotMarketMarginWeights(initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, {
|
|
802
912
|
accounts: {
|
|
803
|
-
admin: this.
|
|
913
|
+
admin: this.isSubscribed
|
|
914
|
+
? this.getStateAccount().admin
|
|
915
|
+
: this.wallet.publicKey,
|
|
804
916
|
state: await this.getStatePublicKey(),
|
|
805
917
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
806
918
|
},
|
|
@@ -812,7 +924,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
812
924
|
async updateSpotMarketBorrowRate(spotMarketIndex, optimalUtilization, optimalBorrowRate, optimalMaxRate) {
|
|
813
925
|
const updateSpotMarketBorrowRateIx = await this.program.instruction.updateSpotMarketBorrowRate(optimalUtilization, optimalBorrowRate, optimalMaxRate, {
|
|
814
926
|
accounts: {
|
|
815
|
-
admin: this.
|
|
927
|
+
admin: this.isSubscribed
|
|
928
|
+
? this.getStateAccount().admin
|
|
929
|
+
: this.wallet.publicKey,
|
|
816
930
|
state: await this.getStatePublicKey(),
|
|
817
931
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
818
932
|
},
|
|
@@ -824,7 +938,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
824
938
|
async updateSpotMarketAssetTier(spotMarketIndex, assetTier) {
|
|
825
939
|
const updateSpotMarketAssetTierIx = await this.program.instruction.updateSpotMarketAssetTier(assetTier, {
|
|
826
940
|
accounts: {
|
|
827
|
-
admin: this.
|
|
941
|
+
admin: this.isSubscribed
|
|
942
|
+
? this.getStateAccount().admin
|
|
943
|
+
: this.wallet.publicKey,
|
|
828
944
|
state: await this.getStatePublicKey(),
|
|
829
945
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
830
946
|
},
|
|
@@ -836,7 +952,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
836
952
|
async updateSpotMarketStatus(spotMarketIndex, marketStatus) {
|
|
837
953
|
const updateSpotMarketStatusIx = await this.program.instruction.updateSpotMarketStatus(marketStatus, {
|
|
838
954
|
accounts: {
|
|
839
|
-
admin: this.
|
|
955
|
+
admin: this.isSubscribed
|
|
956
|
+
? this.getStateAccount().admin
|
|
957
|
+
: this.wallet.publicKey,
|
|
840
958
|
state: await this.getStatePublicKey(),
|
|
841
959
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
842
960
|
},
|
|
@@ -848,7 +966,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
848
966
|
async updateSpotMarketPausedOperations(spotMarketIndex, pausedOperations) {
|
|
849
967
|
const updateSpotMarketPausedOperationsIx = await this.program.instruction.updateSpotMarketPausedOperations(pausedOperations, {
|
|
850
968
|
accounts: {
|
|
851
|
-
admin: this.
|
|
969
|
+
admin: this.isSubscribed
|
|
970
|
+
? this.getStateAccount().admin
|
|
971
|
+
: this.wallet.publicKey,
|
|
852
972
|
state: await this.getStatePublicKey(),
|
|
853
973
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
854
974
|
},
|
|
@@ -860,7 +980,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
860
980
|
async updatePerpMarketStatus(perpMarketIndex, marketStatus) {
|
|
861
981
|
const updatePerpMarketStatusIx = await this.program.instruction.updatePerpMarketStatus(marketStatus, {
|
|
862
982
|
accounts: {
|
|
863
|
-
admin: this.
|
|
983
|
+
admin: this.isSubscribed
|
|
984
|
+
? this.getStateAccount().admin
|
|
985
|
+
: this.wallet.publicKey,
|
|
864
986
|
state: await this.getStatePublicKey(),
|
|
865
987
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
866
988
|
},
|
|
@@ -872,7 +994,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
872
994
|
async updatePerpMarketPausedOperations(perpMarketIndex, pausedOperations) {
|
|
873
995
|
const updatePerpMarketPausedOperationsIx = await this.program.instruction.updatePerpMarketPausedOperations(pausedOperations, {
|
|
874
996
|
accounts: {
|
|
875
|
-
admin: this.
|
|
997
|
+
admin: this.isSubscribed
|
|
998
|
+
? this.getStateAccount().admin
|
|
999
|
+
: this.wallet.publicKey,
|
|
876
1000
|
state: await this.getStatePublicKey(),
|
|
877
1001
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
878
1002
|
},
|
|
@@ -884,7 +1008,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
884
1008
|
async updatePerpMarketContractTier(perpMarketIndex, contractTier) {
|
|
885
1009
|
const updatePerpMarketContractTierIx = await this.program.instruction.updatePerpMarketContractTier(contractTier, {
|
|
886
1010
|
accounts: {
|
|
887
|
-
admin: this.
|
|
1011
|
+
admin: this.isSubscribed
|
|
1012
|
+
? this.getStateAccount().admin
|
|
1013
|
+
: this.wallet.publicKey,
|
|
888
1014
|
state: await this.getStatePublicKey(),
|
|
889
1015
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
890
1016
|
},
|
|
@@ -896,7 +1022,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
896
1022
|
async updateExchangeStatus(exchangeStatus) {
|
|
897
1023
|
const updateExchangeStatusIx = await this.program.instruction.updateExchangeStatus(exchangeStatus, {
|
|
898
1024
|
accounts: {
|
|
899
|
-
admin: this.
|
|
1025
|
+
admin: this.isSubscribed
|
|
1026
|
+
? this.getStateAccount().admin
|
|
1027
|
+
: this.wallet.publicKey,
|
|
900
1028
|
state: await this.getStatePublicKey(),
|
|
901
1029
|
},
|
|
902
1030
|
});
|
|
@@ -907,7 +1035,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
907
1035
|
async updatePerpAuctionDuration(minDuration) {
|
|
908
1036
|
const updatePerpAuctionDurationIx = await this.program.instruction.updatePerpAuctionDuration(typeof minDuration === 'number' ? minDuration : minDuration.toNumber(), {
|
|
909
1037
|
accounts: {
|
|
910
|
-
admin: this.
|
|
1038
|
+
admin: this.isSubscribed
|
|
1039
|
+
? this.getStateAccount().admin
|
|
1040
|
+
: this.wallet.publicKey,
|
|
911
1041
|
state: await this.getStatePublicKey(),
|
|
912
1042
|
},
|
|
913
1043
|
});
|
|
@@ -918,7 +1048,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
918
1048
|
async updateSpotAuctionDuration(defaultAuctionDuration) {
|
|
919
1049
|
const updateSpotAuctionDurationIx = await this.program.instruction.updateSpotAuctionDuration(defaultAuctionDuration, {
|
|
920
1050
|
accounts: {
|
|
921
|
-
admin: this.
|
|
1051
|
+
admin: this.isSubscribed
|
|
1052
|
+
? this.getStateAccount().admin
|
|
1053
|
+
: this.wallet.publicKey,
|
|
922
1054
|
state: await this.getStatePublicKey(),
|
|
923
1055
|
},
|
|
924
1056
|
});
|
|
@@ -929,7 +1061,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
929
1061
|
async updatePerpMarketMaxFillReserveFraction(perpMarketIndex, maxBaseAssetAmountRatio) {
|
|
930
1062
|
const updatePerpMarketMaxFillReserveFractionIx = await this.program.instruction.updatePerpMarketMaxFillReserveFraction(maxBaseAssetAmountRatio, {
|
|
931
1063
|
accounts: {
|
|
932
|
-
admin: this.
|
|
1064
|
+
admin: this.isSubscribed
|
|
1065
|
+
? this.getStateAccount().admin
|
|
1066
|
+
: this.wallet.publicKey,
|
|
933
1067
|
state: await this.getStatePublicKey(),
|
|
934
1068
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
935
1069
|
},
|
|
@@ -941,7 +1075,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
941
1075
|
async updateMaxSlippageRatio(perpMarketIndex, maxSlippageRatio) {
|
|
942
1076
|
const updateMaxSlippageRatioIx = await this.program.instruction.updateMaxSlippageRatio(maxSlippageRatio, {
|
|
943
1077
|
accounts: {
|
|
944
|
-
admin: this.
|
|
1078
|
+
admin: this.isSubscribed
|
|
1079
|
+
? this.getStateAccount().admin
|
|
1080
|
+
: this.wallet.publicKey,
|
|
945
1081
|
state: await this.getStatePublicKey(),
|
|
946
1082
|
perpMarket: this.getPerpMarketAccount(perpMarketIndex).pubkey,
|
|
947
1083
|
},
|
|
@@ -953,7 +1089,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
953
1089
|
async updatePerpMarketUnrealizedAssetWeight(perpMarketIndex, unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight) {
|
|
954
1090
|
const updatePerpMarketUnrealizedAssetWeightIx = await this.program.instruction.updatePerpMarketUnrealizedAssetWeight(unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight, {
|
|
955
1091
|
accounts: {
|
|
956
|
-
admin: this.
|
|
1092
|
+
admin: this.isSubscribed
|
|
1093
|
+
? this.getStateAccount().admin
|
|
1094
|
+
: this.wallet.publicKey,
|
|
957
1095
|
state: await this.getStatePublicKey(),
|
|
958
1096
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
959
1097
|
},
|
|
@@ -965,7 +1103,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
965
1103
|
async updatePerpMarketMaxImbalances(perpMarketIndex, unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance) {
|
|
966
1104
|
const updatePerpMarketMaxImabalancesIx = await this.program.instruction.updatePerpMarketMaxImbalances(unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, {
|
|
967
1105
|
accounts: {
|
|
968
|
-
admin: this.
|
|
1106
|
+
admin: this.isSubscribed
|
|
1107
|
+
? this.getStateAccount().admin
|
|
1108
|
+
: this.wallet.publicKey,
|
|
969
1109
|
state: await this.getStatePublicKey(),
|
|
970
1110
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
971
1111
|
},
|
|
@@ -977,7 +1117,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
977
1117
|
async updatePerpMarketMaxOpenInterest(perpMarketIndex, maxOpenInterest) {
|
|
978
1118
|
const updatePerpMarketMaxOpenInterestIx = await this.program.instruction.updatePerpMarketMaxOpenInterest(maxOpenInterest, {
|
|
979
1119
|
accounts: {
|
|
980
|
-
admin: this.
|
|
1120
|
+
admin: this.isSubscribed
|
|
1121
|
+
? this.getStateAccount().admin
|
|
1122
|
+
: this.wallet.publicKey,
|
|
981
1123
|
state: await this.getStatePublicKey(),
|
|
982
1124
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
983
1125
|
},
|
|
@@ -989,7 +1131,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
989
1131
|
async updatePerpMarketFeeAdjustment(perpMarketIndex, feeAdjustment) {
|
|
990
1132
|
const updatepPerpMarketFeeAdjustmentIx = await this.program.instruction.updatePerpMarketFeeAdjustment(feeAdjustment, {
|
|
991
1133
|
accounts: {
|
|
992
|
-
admin: this.
|
|
1134
|
+
admin: this.isSubscribed
|
|
1135
|
+
? this.getStateAccount().admin
|
|
1136
|
+
: this.wallet.publicKey,
|
|
993
1137
|
state: await this.getStatePublicKey(),
|
|
994
1138
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
995
1139
|
},
|
|
@@ -1001,7 +1145,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1001
1145
|
async updateSerumVault(srmVault) {
|
|
1002
1146
|
const updateSerumVaultIx = await this.program.instruction.updateSerumVault(srmVault, {
|
|
1003
1147
|
accounts: {
|
|
1004
|
-
admin: this.
|
|
1148
|
+
admin: this.isSubscribed
|
|
1149
|
+
? this.getStateAccount().admin
|
|
1150
|
+
: this.wallet.publicKey,
|
|
1005
1151
|
state: await this.getStatePublicKey(),
|
|
1006
1152
|
srmVault: srmVault,
|
|
1007
1153
|
},
|
|
@@ -1013,7 +1159,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1013
1159
|
async updatePerpMarketLiquidationFee(perpMarketIndex, liquidatorFee, ifLiquidationFee) {
|
|
1014
1160
|
const updatePerpMarketLiquidationFeeIx = await this.program.instruction.updatePerpMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
|
|
1015
1161
|
accounts: {
|
|
1016
|
-
admin: this.
|
|
1162
|
+
admin: this.isSubscribed
|
|
1163
|
+
? this.getStateAccount().admin
|
|
1164
|
+
: this.wallet.publicKey,
|
|
1017
1165
|
state: await this.getStatePublicKey(),
|
|
1018
1166
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
1019
1167
|
},
|
|
@@ -1025,7 +1173,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1025
1173
|
async updateSpotMarketLiquidationFee(spotMarketIndex, liquidatorFee, ifLiquidationFee) {
|
|
1026
1174
|
const updateSpotMarketLiquidationFeeIx = await this.program.instruction.updateSpotMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
|
|
1027
1175
|
accounts: {
|
|
1028
|
-
admin: this.
|
|
1176
|
+
admin: this.isSubscribed
|
|
1177
|
+
? this.getStateAccount().admin
|
|
1178
|
+
: this.wallet.publicKey,
|
|
1029
1179
|
state: await this.getStatePublicKey(),
|
|
1030
1180
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
1031
1181
|
},
|
|
@@ -1037,7 +1187,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1037
1187
|
async initializeProtocolIfSharesTransferConfig() {
|
|
1038
1188
|
const initializeProtocolIfSharesTransferConfigIx = await this.program.instruction.initializeProtocolIfSharesTransferConfig({
|
|
1039
1189
|
accounts: {
|
|
1040
|
-
admin: this.
|
|
1190
|
+
admin: this.isSubscribed
|
|
1191
|
+
? this.getStateAccount().admin
|
|
1192
|
+
: this.wallet.publicKey,
|
|
1041
1193
|
state: await this.getStatePublicKey(),
|
|
1042
1194
|
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
1043
1195
|
systemProgram: anchor.web3.SystemProgram.programId,
|
|
@@ -1051,7 +1203,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1051
1203
|
async updateProtocolIfSharesTransferConfig(whitelistedSigners, maxTransferPerEpoch) {
|
|
1052
1204
|
const updateProtocolIfSharesTransferConfigIx = await this.program.instruction.updateProtocolIfSharesTransferConfig(whitelistedSigners || null, maxTransferPerEpoch, {
|
|
1053
1205
|
accounts: {
|
|
1054
|
-
admin: this.
|
|
1206
|
+
admin: this.isSubscribed
|
|
1207
|
+
? this.getStateAccount().admin
|
|
1208
|
+
: this.wallet.publicKey,
|
|
1055
1209
|
state: await this.getStatePublicKey(),
|
|
1056
1210
|
protocolIfSharesTransferConfig: (0, pda_1.getProtocolIfSharesTransferConfigPublicKey)(this.program.programId),
|
|
1057
1211
|
},
|
|
@@ -1061,12 +1215,12 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1061
1215
|
return txSig;
|
|
1062
1216
|
}
|
|
1063
1217
|
async initializePrelaunchOracle(perpMarketIndex, price, maxPrice) {
|
|
1064
|
-
const initializePrelaunchOracleIx = await this.getInitializePrelaunchOracleIx(
|
|
1218
|
+
const initializePrelaunchOracleIx = await this.getInitializePrelaunchOracleIx(perpMarketIndex, price, maxPrice);
|
|
1065
1219
|
const tx = await this.buildTransaction(initializePrelaunchOracleIx);
|
|
1066
1220
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1067
1221
|
return txSig;
|
|
1068
1222
|
}
|
|
1069
|
-
async getInitializePrelaunchOracleIx(
|
|
1223
|
+
async getInitializePrelaunchOracleIx(perpMarketIndex, price, maxPrice) {
|
|
1070
1224
|
const params = {
|
|
1071
1225
|
perpMarketIndex,
|
|
1072
1226
|
price: price || null,
|
|
@@ -1074,7 +1228,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1074
1228
|
};
|
|
1075
1229
|
return await this.program.instruction.initializePrelaunchOracle(params, {
|
|
1076
1230
|
accounts: {
|
|
1077
|
-
admin
|
|
1231
|
+
admin: this.isSubscribed
|
|
1232
|
+
? this.getStateAccount().admin
|
|
1233
|
+
: this.wallet.publicKey,
|
|
1078
1234
|
state: await this.getStatePublicKey(),
|
|
1079
1235
|
prelaunchOracle: await (0, pda_1.getPrelaunchOraclePublicKey)(this.program.programId, perpMarketIndex),
|
|
1080
1236
|
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
@@ -1082,13 +1238,13 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1082
1238
|
},
|
|
1083
1239
|
});
|
|
1084
1240
|
}
|
|
1085
|
-
async updatePrelaunchOracleParams(
|
|
1086
|
-
const updatePrelaunchOracleParamsIx = await this.getUpdatePrelaunchOracleParamsIx(
|
|
1241
|
+
async updatePrelaunchOracleParams(perpMarketIndex, price, maxPrice) {
|
|
1242
|
+
const updatePrelaunchOracleParamsIx = await this.getUpdatePrelaunchOracleParamsIx(perpMarketIndex, price, maxPrice);
|
|
1087
1243
|
const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
|
|
1088
1244
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1089
1245
|
return txSig;
|
|
1090
1246
|
}
|
|
1091
|
-
async getUpdatePrelaunchOracleParamsIx(
|
|
1247
|
+
async getUpdatePrelaunchOracleParamsIx(perpMarketIndex, price, maxPrice) {
|
|
1092
1248
|
const params = {
|
|
1093
1249
|
perpMarketIndex,
|
|
1094
1250
|
price: price || null,
|
|
@@ -1097,7 +1253,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1097
1253
|
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
1098
1254
|
return await this.program.instruction.updatePrelaunchOracleParams(params, {
|
|
1099
1255
|
accounts: {
|
|
1100
|
-
admin
|
|
1256
|
+
admin: this.isSubscribed
|
|
1257
|
+
? this.getStateAccount().admin
|
|
1258
|
+
: this.wallet.publicKey,
|
|
1101
1259
|
state: await this.getStatePublicKey(),
|
|
1102
1260
|
perpMarket: perpMarketPublicKey,
|
|
1103
1261
|
prelaunchOracle: await (0, pda_1.getPrelaunchOraclePublicKey)(this.program.programId, perpMarketIndex),
|
|
@@ -1105,18 +1263,26 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
1105
1263
|
});
|
|
1106
1264
|
}
|
|
1107
1265
|
async deletePrelaunchOracle(perpMarketIndex) {
|
|
1108
|
-
const deletePrelaunchOracleIx = await this.getDeletePrelaunchOracleIx(
|
|
1266
|
+
const deletePrelaunchOracleIx = await this.getDeletePrelaunchOracleIx(perpMarketIndex);
|
|
1109
1267
|
const tx = await this.buildTransaction(deletePrelaunchOracleIx);
|
|
1110
1268
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1111
1269
|
return txSig;
|
|
1112
1270
|
}
|
|
1113
|
-
async getDeletePrelaunchOracleIx(
|
|
1114
|
-
|
|
1271
|
+
async getDeletePrelaunchOracleIx(perpMarketIndex, price, maxPrice) {
|
|
1272
|
+
const params = {
|
|
1273
|
+
perpMarketIndex,
|
|
1274
|
+
price: price || null,
|
|
1275
|
+
maxPrice: maxPrice || null,
|
|
1276
|
+
};
|
|
1277
|
+
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
1278
|
+
return await this.program.instruction.getDeletePrelaunchOracleIx(params, {
|
|
1115
1279
|
accounts: {
|
|
1116
|
-
admin
|
|
1280
|
+
admin: this.isSubscribed
|
|
1281
|
+
? this.getStateAccount().admin
|
|
1282
|
+
: this.wallet.publicKey,
|
|
1117
1283
|
state: await this.getStatePublicKey(),
|
|
1284
|
+
perpMarket: perpMarketPublicKey,
|
|
1118
1285
|
prelaunchOracle: await (0, pda_1.getPrelaunchOraclePublicKey)(this.program.programId, perpMarketIndex),
|
|
1119
|
-
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
1120
1286
|
},
|
|
1121
1287
|
});
|
|
1122
1288
|
}
|