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