@drift-labs/sdk 0.1.36-master.5 → 0.2.0-master.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/lib/accounts/bulkAccountLoader.d.ts +7 -6
- package/lib/accounts/bulkAccountLoader.js +83 -93
- package/lib/accounts/bulkUserSubscription.js +13 -57
- package/lib/accounts/fetch.d.ts +4 -0
- package/lib/accounts/fetch.js +18 -0
- package/lib/accounts/pollingClearingHouseAccountSubscriber.d.ts +34 -38
- package/lib/accounts/pollingClearingHouseAccountSubscriber.js +224 -224
- package/lib/accounts/pollingOracleSubscriber.d.ts +3 -3
- package/lib/accounts/pollingOracleSubscriber.js +37 -49
- package/lib/accounts/pollingTokenAccountSubscriber.d.ts +3 -3
- package/lib/accounts/pollingTokenAccountSubscriber.js +35 -50
- package/lib/accounts/pollingUserAccountSubscriber.d.ts +7 -13
- package/lib/accounts/pollingUserAccountSubscriber.js +71 -134
- package/lib/accounts/types.d.ts +34 -41
- package/lib/accounts/webSocketAccountSubscriber.d.ts +6 -4
- package/lib/accounts/webSocketAccountSubscriber.js +39 -35
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.d.ts +33 -28
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.js +153 -185
- package/lib/accounts/webSocketUserAccountSubscriber.d.ts +5 -11
- package/lib/accounts/webSocketUserAccountSubscriber.js +22 -67
- package/lib/addresses/marketAddresses.d.ts +4 -0
- package/lib/addresses/marketAddresses.js +15 -0
- package/lib/addresses/pda.d.ts +12 -0
- package/lib/addresses/pda.js +83 -0
- package/lib/admin.d.ts +8 -12
- package/lib/admin.js +366 -490
- package/lib/clearingHouse.d.ts +84 -103
- package/lib/clearingHouse.js +779 -810
- package/lib/clearingHouseConfig.d.ts +34 -0
- package/lib/clearingHouseConfig.js +2 -0
- package/lib/clearingHouseUser.d.ts +19 -18
- package/lib/clearingHouseUser.js +157 -115
- package/lib/clearingHouseUserConfig.d.ts +14 -0
- package/lib/clearingHouseUserConfig.js +2 -0
- package/lib/config.d.ts +12 -0
- package/lib/config.js +35 -4
- package/lib/constants/banks.d.ts +16 -0
- package/lib/constants/banks.js +34 -0
- package/lib/constants/markets.d.ts +8 -3
- package/lib/constants/markets.js +13 -206
- package/lib/constants/numericConstants.d.ts +16 -0
- package/lib/constants/numericConstants.js +22 -6
- package/lib/events/eventList.d.ts +22 -0
- package/lib/events/eventList.js +77 -0
- package/lib/events/eventSubscriber.d.ts +34 -0
- package/lib/events/eventSubscriber.js +126 -0
- package/lib/events/fetchLogs.d.ts +13 -0
- package/lib/events/fetchLogs.js +39 -0
- package/lib/events/pollingLogProvider.d.ts +15 -0
- package/lib/events/pollingLogProvider.js +53 -0
- package/lib/events/sort.d.ts +2 -0
- package/lib/events/sort.js +44 -0
- package/lib/events/txEventCache.d.ts +24 -0
- package/lib/events/txEventCache.js +71 -0
- package/lib/events/types.d.ts +49 -0
- package/lib/events/types.js +20 -0
- package/lib/events/webSocketLogProvider.d.ts +12 -0
- package/lib/events/webSocketLogProvider.js +30 -0
- package/lib/examples/makeTradeExample.js +26 -27
- package/lib/factory/bigNum.d.ts +112 -0
- package/lib/factory/bigNum.js +356 -0
- package/lib/factory/oracleClient.d.ts +1 -2
- package/lib/factory/oracleClient.js +6 -2
- package/lib/idl/clearing_house.json +1739 -2287
- package/lib/index.d.ts +13 -4
- package/lib/index.js +13 -4
- package/lib/math/amm.d.ts +19 -29
- package/lib/math/amm.js +129 -179
- package/lib/math/auction.d.ts +5 -0
- package/lib/math/auction.js +39 -0
- package/lib/math/bankBalance.d.ts +9 -0
- package/lib/math/bankBalance.js +75 -0
- package/lib/math/conversion.d.ts +0 -1
- package/lib/math/conversion.js +1 -5
- package/lib/math/funding.d.ts +6 -6
- package/lib/math/funding.js +158 -175
- package/lib/math/market.d.ts +6 -6
- package/lib/math/market.js +10 -9
- package/lib/math/oracles.d.ts +3 -0
- package/lib/math/oracles.js +26 -0
- package/lib/math/orders.d.ts +5 -0
- package/lib/math/orders.js +31 -1
- package/lib/math/position.d.ts +7 -4
- package/lib/math/position.js +27 -9
- package/lib/math/repeg.d.ts +22 -0
- package/lib/math/repeg.js +128 -0
- package/lib/math/trade.d.ts +13 -8
- package/lib/math/trade.js +85 -22
- package/lib/mockUSDCFaucet.js +87 -116
- package/lib/oracles/oracleClientCache.d.ts +8 -0
- package/lib/oracles/oracleClientCache.js +19 -0
- package/lib/oracles/pythClient.d.ts +3 -5
- package/lib/oracles/pythClient.js +12 -30
- package/lib/oracles/quoteAssetOracleClient.d.ts +9 -0
- package/lib/oracles/quoteAssetOracleClient.js +21 -0
- package/lib/oracles/switchboardClient.d.ts +3 -5
- package/lib/oracles/switchboardClient.js +29 -47
- package/lib/oracles/types.d.ts +7 -1
- package/lib/orders.d.ts +6 -6
- package/lib/orders.js +10 -9
- package/lib/slot/SlotSubscriber.d.ts +12 -0
- package/lib/slot/SlotSubscriber.js +23 -0
- package/lib/tx/retryTxSender.d.ts +2 -2
- package/lib/tx/retryTxSender.js +108 -123
- package/lib/tx/types.d.ts +5 -1
- package/lib/tx/utils.d.ts +1 -1
- package/lib/tx/utils.js +11 -2
- package/lib/types.d.ts +105 -98
- package/lib/types.js +13 -1
- package/lib/userName.d.ts +4 -0
- package/lib/userName.js +20 -0
- package/lib/util/computeUnits.js +10 -21
- package/lib/util/tps.js +11 -22
- package/lib/wallet.js +7 -20
- package/package.json +10 -3
- package/src/accounts/bulkAccountLoader.ts +26 -15
- package/src/accounts/bulkUserSubscription.ts +1 -45
- package/src/accounts/fetch.ts +33 -0
- package/src/accounts/pollingClearingHouseAccountSubscriber.ts +249 -214
- package/src/accounts/pollingOracleSubscriber.ts +16 -8
- package/src/accounts/pollingTokenAccountSubscriber.ts +11 -8
- package/src/accounts/pollingUserAccountSubscriber.ts +21 -86
- package/src/accounts/types.ts +41 -70
- package/src/accounts/webSocketAccountSubscriber.ts +33 -16
- package/src/accounts/webSocketClearingHouseAccountSubscriber.ts +190 -240
- package/src/accounts/webSocketUserAccountSubscriber.ts +11 -71
- package/src/addresses/marketAddresses.ts +18 -0
- package/src/addresses/pda.ts +118 -0
- package/src/admin.ts +209 -267
- package/src/clearingHouse.ts +921 -829
- package/src/clearingHouseConfig.ts +37 -0
- package/src/clearingHouseUser.ts +280 -127
- package/src/clearingHouseUserConfig.ts +18 -0
- package/src/config.ts +54 -1
- package/src/constants/banks.ts +43 -0
- package/src/constants/markets.ts +16 -207
- package/src/constants/numericConstants.ts +33 -5
- package/src/events/eventList.ts +94 -0
- package/src/events/eventSubscriber.ts +194 -0
- package/src/events/fetchLogs.ts +80 -0
- package/src/events/pollingLogProvider.ts +79 -0
- package/src/events/sort.ts +65 -0
- package/src/events/txEventCache.ts +74 -0
- package/src/events/types.ts +98 -0
- package/src/events/webSocketLogProvider.ts +38 -0
- package/src/examples/makeTradeExample.ts +20 -11
- package/src/factory/bigNum.ts +507 -0
- package/src/factory/oracleClient.ts +7 -4
- package/src/idl/clearing_house.json +1739 -2287
- package/src/index.ts +13 -4
- package/src/math/amm.ts +229 -245
- package/src/math/auction.ts +39 -0
- package/src/math/bankBalance.ts +112 -0
- package/src/math/conversion.ts +1 -11
- package/src/math/funding.ts +12 -9
- package/src/math/market.ts +37 -30
- package/src/math/oracles.ts +36 -0
- package/src/math/orders.ts +38 -0
- package/src/math/position.ts +48 -13
- package/src/math/repeg.ts +175 -0
- package/src/math/trade.ts +114 -36
- package/src/math/utils.js +27 -0
- package/src/math/utils.js.map +1 -0
- package/src/oracles/oracleClientCache.ts +20 -0
- package/src/oracles/pythClient.ts +5 -11
- package/src/oracles/quoteAssetOracleClient.ts +25 -0
- package/src/oracles/switchboardClient.ts +16 -24
- package/src/oracles/types.ts +8 -1
- package/src/orders.ts +35 -20
- package/src/slot/SlotSubscriber.ts +32 -0
- package/src/tx/retryTxSender.ts +6 -4
- package/src/tx/types.ts +6 -1
- package/src/tx/utils.ts +22 -3
- package/src/types.ts +108 -110
- package/src/userName.ts +20 -0
- package/src/util/computeUnits.js +17 -0
- package/src/util/computeUnits.js.map +1 -0
- package/tests/bn/test.ts +255 -0
- package/tsconfig.json +12 -12
- package/lib/addresses.d.ts +0 -9
- package/lib/addresses.js +0 -87
- package/lib/constants/accounts.d.ts +0 -15
- package/lib/constants/accounts.js +0 -18
- package/lib/factory/clearingHouse.d.ts +0 -35
- package/lib/factory/clearingHouse.js +0 -81
- package/lib/factory/clearingHouseUser.d.ts +0 -19
- package/lib/factory/clearingHouseUser.js +0 -34
- package/lib/math/insuranceFund.d.ts +0 -15
- package/lib/math/insuranceFund.js +0 -33
- package/lib/tx/defaultTxSender.d.ts +0 -8
- package/lib/tx/defaultTxSender.js +0 -12
- package/src/addresses.ts +0 -71
- package/src/constants/accounts.ts +0 -26
- package/src/factory/clearingHouse.ts +0 -173
- package/src/factory/clearingHouseUser.ts +0 -73
- package/src/math/insuranceFund.ts +0 -29
- package/src/tx/defaultTxSender.ts +0 -24
package/lib/admin.js
CHANGED
|
@@ -22,508 +22,384 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
26
|
exports.Admin = void 0;
|
|
36
27
|
const web3_js_1 = require("@solana/web3.js");
|
|
37
28
|
const types_1 = require("./types");
|
|
38
29
|
const anchor_1 = require("@project-serum/anchor");
|
|
39
30
|
const anchor = __importStar(require("@project-serum/anchor"));
|
|
40
|
-
const
|
|
31
|
+
const pda_1 = require("./addresses/pda");
|
|
41
32
|
const spl_token_1 = require("@solana/spl-token");
|
|
42
33
|
const clearingHouse_1 = require("./clearingHouse");
|
|
43
34
|
const numericConstants_1 = require("./constants/numericConstants");
|
|
44
35
|
const trade_1 = require("./math/trade");
|
|
45
36
|
const amm_1 = require("./math/amm");
|
|
46
|
-
const clearingHouse_2 = require("./factory/clearingHouse");
|
|
47
37
|
class Admin extends clearingHouse_1.ClearingHouse {
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
return
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
updateFee(fees) {
|
|
414
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
415
|
-
return yield this.program.rpc.updateFee(fees, {
|
|
416
|
-
accounts: {
|
|
417
|
-
admin: this.wallet.publicKey,
|
|
418
|
-
state: yield this.getStatePublicKey(),
|
|
419
|
-
},
|
|
420
|
-
});
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
updateOracleGuardRails(oracleGuardRails) {
|
|
424
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
425
|
-
return yield this.program.rpc.updateOracleGuardRails(oracleGuardRails, {
|
|
426
|
-
accounts: {
|
|
427
|
-
admin: this.wallet.publicKey,
|
|
428
|
-
state: yield this.getStatePublicKey(),
|
|
429
|
-
},
|
|
430
|
-
});
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
updateMarketOracle(marketIndex, oracle, oracleSource) {
|
|
434
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
435
|
-
const state = this.getStateAccount();
|
|
436
|
-
return yield this.program.rpc.updateMarketOracle(marketIndex, oracle, oracleSource, {
|
|
437
|
-
accounts: {
|
|
438
|
-
admin: this.wallet.publicKey,
|
|
439
|
-
state: yield this.getStatePublicKey(),
|
|
440
|
-
markets: state.markets,
|
|
441
|
-
},
|
|
442
|
-
});
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
updateMarketMinimumQuoteAssetTradeSize(marketIndex, minimumTradeSize) {
|
|
446
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
447
|
-
const state = this.getStateAccount();
|
|
448
|
-
return yield this.program.rpc.updateMarketMinimumQuoteAssetTradeSize(marketIndex, minimumTradeSize, {
|
|
449
|
-
accounts: {
|
|
450
|
-
admin: this.wallet.publicKey,
|
|
451
|
-
state: yield this.getStatePublicKey(),
|
|
452
|
-
markets: state.markets,
|
|
453
|
-
},
|
|
454
|
-
});
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
updateMarketMinimumBaseAssetTradeSize(marketIndex, minimumTradeSize) {
|
|
458
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
459
|
-
const state = this.getStateAccount();
|
|
460
|
-
return yield this.program.rpc.updateMarketMinimumBaseAssetTradeSize(marketIndex, minimumTradeSize, {
|
|
461
|
-
accounts: {
|
|
462
|
-
admin: this.wallet.publicKey,
|
|
463
|
-
state: yield this.getStatePublicKey(),
|
|
464
|
-
markets: state.markets,
|
|
465
|
-
},
|
|
466
|
-
});
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
updateWhitelistMint(whitelistMint) {
|
|
470
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
471
|
-
return yield this.program.rpc.updateWhitelistMint(whitelistMint, {
|
|
472
|
-
accounts: {
|
|
473
|
-
admin: this.wallet.publicKey,
|
|
474
|
-
state: yield this.getStatePublicKey(),
|
|
475
|
-
},
|
|
476
|
-
});
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
updateDiscountMint(discountMint) {
|
|
480
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
481
|
-
return yield this.program.rpc.updateDiscountMint(discountMint, {
|
|
482
|
-
accounts: {
|
|
483
|
-
admin: this.wallet.publicKey,
|
|
484
|
-
state: yield this.getStatePublicKey(),
|
|
485
|
-
},
|
|
486
|
-
});
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
updateMaxDeposit(maxDeposit) {
|
|
490
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
491
|
-
return yield this.program.rpc.updateMaxDeposit(maxDeposit, {
|
|
492
|
-
accounts: {
|
|
493
|
-
admin: this.wallet.publicKey,
|
|
494
|
-
state: yield this.getStatePublicKey(),
|
|
495
|
-
},
|
|
496
|
-
});
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
updateFundingPaused(fundingPaused) {
|
|
500
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
501
|
-
return yield this.program.rpc.updateFundingPaused(fundingPaused, {
|
|
502
|
-
accounts: {
|
|
503
|
-
admin: this.wallet.publicKey,
|
|
504
|
-
state: yield this.getStatePublicKey(),
|
|
505
|
-
},
|
|
506
|
-
});
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
updateExchangePaused(exchangePaused) {
|
|
510
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
511
|
-
return yield this.program.rpc.updateExchangePaused(exchangePaused, {
|
|
512
|
-
accounts: {
|
|
513
|
-
admin: this.wallet.publicKey,
|
|
514
|
-
state: yield this.getStatePublicKey(),
|
|
515
|
-
},
|
|
516
|
-
});
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
disableAdminControlsPrices() {
|
|
520
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
521
|
-
return yield this.program.rpc.disableAdminControlsPrices({
|
|
522
|
-
accounts: {
|
|
523
|
-
admin: this.wallet.publicKey,
|
|
524
|
-
state: yield this.getStatePublicKey(),
|
|
525
|
-
},
|
|
526
|
-
});
|
|
38
|
+
async initialize(usdcMint, adminControlsPrices) {
|
|
39
|
+
const stateAccountRPCResponse = await this.connection.getParsedAccountInfo(await this.getStatePublicKey());
|
|
40
|
+
if (stateAccountRPCResponse.value !== null) {
|
|
41
|
+
throw new Error('Clearing house already initialized');
|
|
42
|
+
}
|
|
43
|
+
const [insuranceVaultPublicKey] = await web3_js_1.PublicKey.findProgramAddress([Buffer.from(anchor.utils.bytes.utf8.encode('insurance_vault'))], this.program.programId);
|
|
44
|
+
const [insuranceVaultAuthority] = await web3_js_1.PublicKey.findProgramAddress([insuranceVaultPublicKey.toBuffer()], this.program.programId);
|
|
45
|
+
const [clearingHouseStatePublicKey] = await (0, pda_1.getClearingHouseStateAccountPublicKeyAndNonce)(this.program.programId);
|
|
46
|
+
const initializeTx = await this.program.transaction.initialize(adminControlsPrices, {
|
|
47
|
+
accounts: {
|
|
48
|
+
admin: this.wallet.publicKey,
|
|
49
|
+
state: clearingHouseStatePublicKey,
|
|
50
|
+
quoteAssetMint: usdcMint,
|
|
51
|
+
insuranceVault: insuranceVaultPublicKey,
|
|
52
|
+
insuranceVaultAuthority: insuranceVaultAuthority,
|
|
53
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
54
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
55
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const { txSig: initializeTxSig } = await this.txSender.send(initializeTx, [], this.opts);
|
|
59
|
+
return [initializeTxSig];
|
|
60
|
+
}
|
|
61
|
+
async initializeBank(mint, optimalUtilization, optimalRate, maxRate, oracle, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight) {
|
|
62
|
+
const bankIndex = this.getStateAccount().numberOfBanks;
|
|
63
|
+
const bank = await (0, pda_1.getBankPublicKey)(this.program.programId, bankIndex);
|
|
64
|
+
const bankVault = await (0, pda_1.getBankVaultPublicKey)(this.program.programId, bankIndex);
|
|
65
|
+
const bankVaultAuthority = await (0, pda_1.getBankVaultAuthorityPublicKey)(this.program.programId, bankIndex);
|
|
66
|
+
const initializeTx = await this.program.transaction.initializeBank(optimalUtilization, optimalRate, maxRate, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, {
|
|
67
|
+
accounts: {
|
|
68
|
+
admin: this.wallet.publicKey,
|
|
69
|
+
state: await this.getStatePublicKey(),
|
|
70
|
+
bank,
|
|
71
|
+
bankVault,
|
|
72
|
+
bankVaultAuthority,
|
|
73
|
+
bankMint: mint,
|
|
74
|
+
oracle,
|
|
75
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
76
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
77
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
const { txSig } = await this.txSender.send(initializeTx, [], this.opts);
|
|
81
|
+
await this.accountSubscriber.addBank(bankIndex);
|
|
82
|
+
await this.accountSubscriber.addOracle({
|
|
83
|
+
source: oracleSource,
|
|
84
|
+
publicKey: oracle,
|
|
85
|
+
});
|
|
86
|
+
return txSig;
|
|
87
|
+
}
|
|
88
|
+
async initializeMarket(priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier = numericConstants_1.PEG_PRECISION, oracleSource = types_1.OracleSource.PYTH, marginRatioInitial = 2000, marginRatioPartial = 625, marginRatioMaintenance = 500) {
|
|
89
|
+
const marketPublicKey = await (0, pda_1.getMarketPublicKey)(this.program.programId, this.getStateAccount().numberOfMarkets);
|
|
90
|
+
const initializeMarketTx = await this.program.transaction.initializeMarket(baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier, oracleSource, marginRatioInitial, marginRatioPartial, marginRatioMaintenance, {
|
|
91
|
+
accounts: {
|
|
92
|
+
state: await this.getStatePublicKey(),
|
|
93
|
+
admin: this.wallet.publicKey,
|
|
94
|
+
oracle: priceOracle,
|
|
95
|
+
market: marketPublicKey,
|
|
96
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
97
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
const { txSig } = await this.txSender.send(initializeMarketTx, [], this.opts);
|
|
101
|
+
await this.accountSubscriber.addMarket(this.getStateAccount().numberOfMarkets);
|
|
102
|
+
await this.accountSubscriber.addOracle({
|
|
103
|
+
source: oracleSource,
|
|
104
|
+
publicKey: priceOracle,
|
|
105
|
+
});
|
|
106
|
+
return txSig;
|
|
107
|
+
}
|
|
108
|
+
async moveAmmPrice(baseAssetReserve, quoteAssetReserve, marketIndex) {
|
|
109
|
+
const marketPublicKey = await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex);
|
|
110
|
+
return await this.program.rpc.moveAmmPrice(baseAssetReserve, quoteAssetReserve, {
|
|
111
|
+
accounts: {
|
|
112
|
+
state: await this.getStatePublicKey(),
|
|
113
|
+
admin: this.wallet.publicKey,
|
|
114
|
+
market: marketPublicKey,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
async updateK(sqrtK, marketIndex) {
|
|
119
|
+
return await this.program.rpc.updateK(sqrtK, {
|
|
120
|
+
accounts: {
|
|
121
|
+
state: await this.getStatePublicKey(),
|
|
122
|
+
admin: this.wallet.publicKey,
|
|
123
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex),
|
|
124
|
+
oracle: this.getMarketAccount(marketIndex).amm.oracle,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async moveAmmToPrice(marketIndex, targetPrice) {
|
|
129
|
+
const market = this.getMarketAccount(marketIndex);
|
|
130
|
+
const [direction, tradeSize, _] = (0, trade_1.calculateTargetPriceTrade)(market, targetPrice, new anchor_1.BN(1000), 'quote', undefined //todo
|
|
131
|
+
);
|
|
132
|
+
const [newQuoteAssetAmount, newBaseAssetAmount] = (0, amm_1.calculateAmmReservesAfterSwap)(market.amm, 'quote', tradeSize, (0, amm_1.getSwapDirection)('quote', direction));
|
|
133
|
+
const marketPublicKey = await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex);
|
|
134
|
+
return await this.program.rpc.moveAmmPrice(newBaseAssetAmount, newQuoteAssetAmount, {
|
|
135
|
+
accounts: {
|
|
136
|
+
state: await this.getStatePublicKey(),
|
|
137
|
+
admin: this.wallet.publicKey,
|
|
138
|
+
market: marketPublicKey,
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async repegAmmCurve(newPeg, marketIndex) {
|
|
143
|
+
const marketPublicKey = await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex);
|
|
144
|
+
const ammData = this.getMarketAccount(marketIndex).amm;
|
|
145
|
+
return await this.program.rpc.repegAmmCurve(newPeg, {
|
|
146
|
+
accounts: {
|
|
147
|
+
state: await this.getStatePublicKey(),
|
|
148
|
+
admin: this.wallet.publicKey,
|
|
149
|
+
oracle: ammData.oracle,
|
|
150
|
+
market: marketPublicKey,
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async updateAmmOracleTwap(marketIndex) {
|
|
155
|
+
const ammData = this.getMarketAccount(marketIndex).amm;
|
|
156
|
+
const marketPublicKey = await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex);
|
|
157
|
+
return await this.program.rpc.updateAmmOracleTwap({
|
|
158
|
+
accounts: {
|
|
159
|
+
state: await this.getStatePublicKey(),
|
|
160
|
+
admin: this.wallet.publicKey,
|
|
161
|
+
oracle: ammData.oracle,
|
|
162
|
+
market: marketPublicKey,
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
async resetAmmOracleTwap(marketIndex) {
|
|
167
|
+
const ammData = this.getMarketAccount(marketIndex).amm;
|
|
168
|
+
const marketPublicKey = await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex);
|
|
169
|
+
return await this.program.rpc.resetAmmOracleTwap({
|
|
170
|
+
accounts: {
|
|
171
|
+
state: await this.getStatePublicKey(),
|
|
172
|
+
admin: this.wallet.publicKey,
|
|
173
|
+
oracle: ammData.oracle,
|
|
174
|
+
market: marketPublicKey,
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
async withdrawFromInsuranceVault(amount, recipient) {
|
|
179
|
+
const state = await this.getStateAccount();
|
|
180
|
+
return await this.program.rpc.withdrawFromInsuranceVault(amount, {
|
|
181
|
+
accounts: {
|
|
182
|
+
admin: this.wallet.publicKey,
|
|
183
|
+
state: await this.getStatePublicKey(),
|
|
184
|
+
insuranceVault: state.insuranceVault,
|
|
185
|
+
insuranceVaultAuthority: state.insuranceVaultAuthority,
|
|
186
|
+
recipient: recipient,
|
|
187
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
async withdrawFees(marketIndex, amount, recipient) {
|
|
192
|
+
const marketPublicKey = await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex);
|
|
193
|
+
const bank = this.getQuoteAssetBankAccount();
|
|
194
|
+
return await this.program.rpc.withdrawFees(amount, {
|
|
195
|
+
accounts: {
|
|
196
|
+
admin: this.wallet.publicKey,
|
|
197
|
+
state: await this.getStatePublicKey(),
|
|
198
|
+
market: marketPublicKey,
|
|
199
|
+
bank: bank.pubkey,
|
|
200
|
+
bankVault: bank.vault,
|
|
201
|
+
bankVaultAuthority: bank.vaultAuthority,
|
|
202
|
+
recipient: recipient,
|
|
203
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
async withdrawFromInsuranceVaultToMarket(marketIndex, amount) {
|
|
208
|
+
const state = await this.getStateAccount();
|
|
209
|
+
return await this.program.rpc.withdrawFromInsuranceVaultToMarket(amount, {
|
|
210
|
+
accounts: {
|
|
211
|
+
admin: this.wallet.publicKey,
|
|
212
|
+
state: await this.getStatePublicKey(),
|
|
213
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex),
|
|
214
|
+
insuranceVault: state.insuranceVault,
|
|
215
|
+
insuranceVaultAuthority: state.insuranceVaultAuthority,
|
|
216
|
+
bankVault: this.getQuoteAssetBankAccount().vault,
|
|
217
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
async updateAdmin(admin) {
|
|
222
|
+
return await this.program.rpc.updateAdmin(admin, {
|
|
223
|
+
accounts: {
|
|
224
|
+
admin: this.wallet.publicKey,
|
|
225
|
+
state: await this.getStatePublicKey(),
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
async updateCurveUpdateIntensity(marketIndex, curveUpdateIntensity) {
|
|
230
|
+
// assert(curveUpdateIntensity >= 0 && curveUpdateIntensity <= 100);
|
|
231
|
+
// assert(Number.isInteger(curveUpdateIntensity));
|
|
232
|
+
return await this.program.rpc.updateCurveUpdateIntensity(curveUpdateIntensity, {
|
|
233
|
+
accounts: {
|
|
234
|
+
admin: this.wallet.publicKey,
|
|
235
|
+
state: await this.getStatePublicKey(),
|
|
236
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex),
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
async updateMarginRatio(marketIndex, marginRatioInitial, marginRatioPartial, marginRatioMaintenance) {
|
|
241
|
+
return await this.program.rpc.updateMarginRatio(marginRatioInitial, marginRatioPartial, marginRatioMaintenance, {
|
|
242
|
+
accounts: {
|
|
243
|
+
admin: this.wallet.publicKey,
|
|
244
|
+
state: await this.getStatePublicKey(),
|
|
245
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex),
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
async updateMarketBaseSpread(marketIndex, baseSpread) {
|
|
250
|
+
return await this.program.rpc.updateMarketBaseSpread(baseSpread, {
|
|
251
|
+
accounts: {
|
|
252
|
+
admin: this.wallet.publicKey,
|
|
253
|
+
state: await this.getStatePublicKey(),
|
|
254
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex),
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
async updatePartialLiquidationClosePercentage(numerator, denominator) {
|
|
259
|
+
return await this.program.rpc.updatePartialLiquidationClosePercentage(numerator, denominator, {
|
|
260
|
+
accounts: {
|
|
261
|
+
admin: this.wallet.publicKey,
|
|
262
|
+
state: await this.getStatePublicKey(),
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
async updatePartialLiquidationPenaltyPercentage(numerator, denominator) {
|
|
267
|
+
return await this.program.rpc.updatePartialLiquidationPenaltyPercentage(numerator, denominator, {
|
|
268
|
+
accounts: {
|
|
269
|
+
admin: this.wallet.publicKey,
|
|
270
|
+
state: await this.getStatePublicKey(),
|
|
271
|
+
},
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
async updateFullLiquidationPenaltyPercentage(numerator, denominator) {
|
|
275
|
+
return await this.program.rpc.updateFullLiquidationPenaltyPercentage(numerator, denominator, {
|
|
276
|
+
accounts: {
|
|
277
|
+
admin: this.wallet.publicKey,
|
|
278
|
+
state: await this.getStatePublicKey(),
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
async updatePartialLiquidationShareDenominator(denominator) {
|
|
283
|
+
return await this.program.rpc.updatePartialLiquidationLiquidatorShareDenominator(denominator, {
|
|
284
|
+
accounts: {
|
|
285
|
+
admin: this.wallet.publicKey,
|
|
286
|
+
state: await this.getStatePublicKey(),
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
async updateFullLiquidationShareDenominator(denominator) {
|
|
291
|
+
return await this.program.rpc.updateFullLiquidationLiquidatorShareDenominator(denominator, {
|
|
292
|
+
accounts: {
|
|
293
|
+
admin: this.wallet.publicKey,
|
|
294
|
+
state: await this.getStatePublicKey(),
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
async updateOrderFillerRewardStructure(orderFillerRewardStructure) {
|
|
299
|
+
return await this.program.rpc.updateOrderFillerRewardStructure(orderFillerRewardStructure, {
|
|
300
|
+
accounts: {
|
|
301
|
+
admin: this.wallet.publicKey,
|
|
302
|
+
state: await this.getStatePublicKey(),
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
async updateFee(fees) {
|
|
307
|
+
return await this.program.rpc.updateFee(fees, {
|
|
308
|
+
accounts: {
|
|
309
|
+
admin: this.wallet.publicKey,
|
|
310
|
+
state: await this.getStatePublicKey(),
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
async updateOracleGuardRails(oracleGuardRails) {
|
|
315
|
+
return await this.program.rpc.updateOracleGuardRails(oracleGuardRails, {
|
|
316
|
+
accounts: {
|
|
317
|
+
admin: this.wallet.publicKey,
|
|
318
|
+
state: await this.getStatePublicKey(),
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
async updateMarketOracle(marketIndex, oracle, oracleSource) {
|
|
323
|
+
return await this.program.rpc.updateMarketOracle(oracle, oracleSource, {
|
|
324
|
+
accounts: {
|
|
325
|
+
admin: this.wallet.publicKey,
|
|
326
|
+
state: await this.getStatePublicKey(),
|
|
327
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex),
|
|
328
|
+
},
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
async updateMarketMinimumQuoteAssetTradeSize(marketIndex, minimumTradeSize) {
|
|
332
|
+
return await this.program.rpc.updateMarketMinimumQuoteAssetTradeSize(minimumTradeSize, {
|
|
333
|
+
accounts: {
|
|
334
|
+
admin: this.wallet.publicKey,
|
|
335
|
+
state: await this.getStatePublicKey(),
|
|
336
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex),
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
async updateMarketBaseAssetAmountStepSize(marketIndex, stepSize) {
|
|
341
|
+
return await this.program.rpc.updateMarketBaseAssetAmountStepSize(stepSize, {
|
|
342
|
+
accounts: {
|
|
343
|
+
admin: this.wallet.publicKey,
|
|
344
|
+
state: await this.getStatePublicKey(),
|
|
345
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, marketIndex),
|
|
346
|
+
},
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
async updateWhitelistMint(whitelistMint) {
|
|
350
|
+
return await this.program.rpc.updateWhitelistMint(whitelistMint, {
|
|
351
|
+
accounts: {
|
|
352
|
+
admin: this.wallet.publicKey,
|
|
353
|
+
state: await this.getStatePublicKey(),
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
async updateDiscountMint(discountMint) {
|
|
358
|
+
return await this.program.rpc.updateDiscountMint(discountMint, {
|
|
359
|
+
accounts: {
|
|
360
|
+
admin: this.wallet.publicKey,
|
|
361
|
+
state: await this.getStatePublicKey(),
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
async updateMaxDeposit(maxDeposit) {
|
|
366
|
+
return await this.program.rpc.updateMaxDeposit(maxDeposit, {
|
|
367
|
+
accounts: {
|
|
368
|
+
admin: this.wallet.publicKey,
|
|
369
|
+
state: await this.getStatePublicKey(),
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
async updateFundingPaused(fundingPaused) {
|
|
374
|
+
return await this.program.rpc.updateFundingPaused(fundingPaused, {
|
|
375
|
+
accounts: {
|
|
376
|
+
admin: this.wallet.publicKey,
|
|
377
|
+
state: await this.getStatePublicKey(),
|
|
378
|
+
},
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
async updateExchangePaused(exchangePaused) {
|
|
382
|
+
return await this.program.rpc.updateExchangePaused(exchangePaused, {
|
|
383
|
+
accounts: {
|
|
384
|
+
admin: this.wallet.publicKey,
|
|
385
|
+
state: await this.getStatePublicKey(),
|
|
386
|
+
},
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
async disableAdminControlsPrices() {
|
|
390
|
+
return await this.program.rpc.disableAdminControlsPrices({
|
|
391
|
+
accounts: {
|
|
392
|
+
admin: this.wallet.publicKey,
|
|
393
|
+
state: await this.getStatePublicKey(),
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
async updateOrderAuctionTime(time) {
|
|
398
|
+
return await this.program.rpc.updateOrderAuctionTime(typeof time === 'number' ? time : time.toNumber, {
|
|
399
|
+
accounts: {
|
|
400
|
+
admin: this.wallet.publicKey,
|
|
401
|
+
state: await this.getStatePublicKey(),
|
|
402
|
+
},
|
|
527
403
|
});
|
|
528
404
|
}
|
|
529
405
|
}
|