@drift-labs/sdk 2.86.0-beta.0 → 2.86.0-beta.10
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/accounts/pollingDriftClientAccountSubscriber.js +24 -16
- package/lib/accounts/webSocketDriftClientAccountSubscriber.js +25 -32
- package/lib/adminClient.d.ts +4 -0
- package/lib/adminClient.js +36 -0
- package/lib/constants/numericConstants.d.ts +2 -0
- package/lib/constants/numericConstants.js +3 -1
- package/lib/constants/perpMarkets.js +32 -0
- package/lib/constants/spotMarkets.js +12 -1
- package/lib/idl/drift.json +246 -4
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/math/fuel.d.ts +5 -0
- package/lib/math/fuel.js +45 -0
- package/lib/types.d.ts +14 -0
- package/lib/user.d.ts +7 -0
- package/lib/user.js +48 -0
- package/package.json +4 -1
- package/src/accounts/pollingDriftClientAccountSubscriber.ts +38 -23
- package/src/accounts/webSocketDriftClientAccountSubscriber.ts +55 -38
- package/src/adminClient.ts +96 -0
- package/src/constants/numericConstants.ts +3 -0
- package/src/constants/perpMarkets.ts +34 -0
- package/src/constants/spotMarkets.ts +14 -1
- package/src/idl/drift.json +246 -4
- package/src/index.ts +1 -0
- package/src/math/fuel.ts +56 -0
- package/src/types.ts +19 -0
- package/src/user.ts +120 -0
|
@@ -115,19 +115,18 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
115
115
|
this.eventEmitter.emit('update');
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
await Promise.all([
|
|
119
|
+
// subscribe to market accounts
|
|
120
|
+
this.subscribeToPerpMarketAccounts(),
|
|
121
|
+
// subscribe to spot market accounts
|
|
122
|
+
this.subscribeToSpotMarketAccounts(),
|
|
123
|
+
// subscribe to oracles
|
|
124
|
+
this.subscribeToOracles(),
|
|
125
|
+
]);
|
|
126
126
|
|
|
127
127
|
this.eventEmitter.emit('update');
|
|
128
128
|
|
|
129
|
-
await this.setPerpOracleMap();
|
|
130
|
-
await this.setSpotOracleMap();
|
|
129
|
+
await Promise.all([this.setPerpOracleMap(), this.setSpotOracleMap()]);
|
|
131
130
|
|
|
132
131
|
this.isSubscribing = false;
|
|
133
132
|
this.isSubscribed = true;
|
|
@@ -137,9 +136,11 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
async subscribeToPerpMarketAccounts(): Promise<boolean> {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
await Promise.all(
|
|
140
|
+
this.perpMarketIndexes.map((marketIndex) =>
|
|
141
|
+
this.subscribeToPerpMarketAccount(marketIndex)
|
|
142
|
+
)
|
|
143
|
+
);
|
|
143
144
|
return true;
|
|
144
145
|
}
|
|
145
146
|
|
|
@@ -165,9 +166,11 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
165
166
|
}
|
|
166
167
|
|
|
167
168
|
async subscribeToSpotMarketAccounts(): Promise<boolean> {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
await Promise.all(
|
|
170
|
+
this.spotMarketIndexes.map((marketIndex) =>
|
|
171
|
+
this.subscribeToSpotMarketAccount(marketIndex)
|
|
172
|
+
)
|
|
173
|
+
);
|
|
171
174
|
return true;
|
|
172
175
|
}
|
|
173
176
|
|
|
@@ -193,11 +196,11 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
193
196
|
}
|
|
194
197
|
|
|
195
198
|
async subscribeToOracles(): Promise<boolean> {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
await Promise.all(
|
|
200
|
+
this.oracleInfos
|
|
201
|
+
.filter((oracleInfo) => !oracleInfo.publicKey.equals(PublicKey.default))
|
|
202
|
+
.map((oracleInfo) => this.subscribeToOracle(oracleInfo))
|
|
203
|
+
);
|
|
201
204
|
|
|
202
205
|
return true;
|
|
203
206
|
}
|
|
@@ -232,21 +235,27 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
232
235
|
}
|
|
233
236
|
|
|
234
237
|
async unsubscribeFromMarketAccounts(): Promise<void> {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
+
await Promise.all(
|
|
239
|
+
Array.from(this.perpMarketAccountSubscribers.values()).map(
|
|
240
|
+
(accountSubscriber) => accountSubscriber.unsubscribe()
|
|
241
|
+
)
|
|
242
|
+
);
|
|
238
243
|
}
|
|
239
244
|
|
|
240
245
|
async unsubscribeFromSpotMarketAccounts(): Promise<void> {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
246
|
+
await Promise.all(
|
|
247
|
+
Array.from(this.spotMarketAccountSubscribers.values()).map(
|
|
248
|
+
(accountSubscriber) => accountSubscriber.unsubscribe()
|
|
249
|
+
)
|
|
250
|
+
);
|
|
244
251
|
}
|
|
245
252
|
|
|
246
253
|
async unsubscribeFromOracles(): Promise<void> {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
254
|
+
await Promise.all(
|
|
255
|
+
Array.from(this.oracleSubscribers.values()).map((accountSubscriber) =>
|
|
256
|
+
accountSubscriber.unsubscribe()
|
|
257
|
+
)
|
|
258
|
+
);
|
|
250
259
|
}
|
|
251
260
|
|
|
252
261
|
public async fetch(): Promise<void> {
|
|
@@ -315,6 +324,7 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
315
324
|
|
|
316
325
|
async setPerpOracleMap() {
|
|
317
326
|
const perpMarkets = this.getMarketAccountsAndSlots();
|
|
327
|
+
const addOraclePromises = [];
|
|
318
328
|
for (const perpMarket of perpMarkets) {
|
|
319
329
|
if (!perpMarket) {
|
|
320
330
|
continue;
|
|
@@ -323,17 +333,21 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
323
333
|
const perpMarketIndex = perpMarketAccount.marketIndex;
|
|
324
334
|
const oracle = perpMarketAccount.amm.oracle;
|
|
325
335
|
if (!this.oracleSubscribers.has(oracle.toBase58())) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
336
|
+
addOraclePromises.push(
|
|
337
|
+
this.addOracle({
|
|
338
|
+
publicKey: oracle,
|
|
339
|
+
source: perpMarket.data.amm.oracleSource,
|
|
340
|
+
})
|
|
341
|
+
);
|
|
330
342
|
}
|
|
331
343
|
this.perpOracleMap.set(perpMarketIndex, oracle);
|
|
332
344
|
}
|
|
345
|
+
await Promise.all(addOraclePromises);
|
|
333
346
|
}
|
|
334
347
|
|
|
335
348
|
async setSpotOracleMap() {
|
|
336
349
|
const spotMarkets = this.getSpotMarketAccountsAndSlots();
|
|
350
|
+
const addOraclePromises = [];
|
|
337
351
|
for (const spotMarket of spotMarkets) {
|
|
338
352
|
if (!spotMarket) {
|
|
339
353
|
continue;
|
|
@@ -342,13 +356,16 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
342
356
|
const spotMarketIndex = spotMarketAccount.marketIndex;
|
|
343
357
|
const oracle = spotMarketAccount.oracle;
|
|
344
358
|
if (!this.oracleSubscribers.has(oracle.toBase58())) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
359
|
+
addOraclePromises.push(
|
|
360
|
+
this.addOracle({
|
|
361
|
+
publicKey: oracle,
|
|
362
|
+
source: spotMarketAccount.oracleSource,
|
|
363
|
+
})
|
|
364
|
+
);
|
|
349
365
|
}
|
|
350
366
|
this.spotOracleMap.set(spotMarketIndex, oracle);
|
|
351
367
|
}
|
|
368
|
+
await Promise.all(addOraclePromises);
|
|
352
369
|
}
|
|
353
370
|
|
|
354
371
|
assertIsSubscribed(): void {
|
package/src/adminClient.ts
CHANGED
|
@@ -3533,6 +3533,102 @@ export class AdminClient extends DriftClient {
|
|
|
3533
3533
|
});
|
|
3534
3534
|
}
|
|
3535
3535
|
|
|
3536
|
+
public async updateSpotMarketFuel(
|
|
3537
|
+
spotMarketIndex: number,
|
|
3538
|
+
fuelBoostDeposits?: number,
|
|
3539
|
+
fuelBoostBorrows?: number,
|
|
3540
|
+
fuelBoostTaker?: number,
|
|
3541
|
+
fuelBoostMaker?: number
|
|
3542
|
+
): Promise<TransactionSignature> {
|
|
3543
|
+
const updateSpotMarketFuelIx = await this.getUpdateSpotMarketFuelIx(
|
|
3544
|
+
spotMarketIndex,
|
|
3545
|
+
fuelBoostDeposits || null,
|
|
3546
|
+
fuelBoostBorrows || null,
|
|
3547
|
+
fuelBoostTaker || null,
|
|
3548
|
+
fuelBoostMaker || null
|
|
3549
|
+
);
|
|
3550
|
+
|
|
3551
|
+
const tx = await this.buildTransaction(updateSpotMarketFuelIx);
|
|
3552
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
3553
|
+
|
|
3554
|
+
return txSig;
|
|
3555
|
+
}
|
|
3556
|
+
|
|
3557
|
+
public async getUpdateSpotMarketFuelIx(
|
|
3558
|
+
spotMarketIndex: number,
|
|
3559
|
+
fuelBoostDeposits?: number,
|
|
3560
|
+
fuelBoostBorrows?: number,
|
|
3561
|
+
fuelBoostTaker?: number,
|
|
3562
|
+
fuelBoostMaker?: number
|
|
3563
|
+
): Promise<TransactionInstruction> {
|
|
3564
|
+
const spotMarketPublicKey = await getSpotMarketPublicKey(
|
|
3565
|
+
this.program.programId,
|
|
3566
|
+
spotMarketIndex
|
|
3567
|
+
);
|
|
3568
|
+
|
|
3569
|
+
return await this.program.instruction.updateSpotMarketFuel(
|
|
3570
|
+
fuelBoostDeposits || null,
|
|
3571
|
+
fuelBoostBorrows || null,
|
|
3572
|
+
fuelBoostTaker || null,
|
|
3573
|
+
fuelBoostMaker || null,
|
|
3574
|
+
{
|
|
3575
|
+
accounts: {
|
|
3576
|
+
admin: this.isSubscribed
|
|
3577
|
+
? this.getStateAccount().admin
|
|
3578
|
+
: this.wallet.publicKey,
|
|
3579
|
+
state: await this.getStatePublicKey(),
|
|
3580
|
+
spotMarket: spotMarketPublicKey,
|
|
3581
|
+
},
|
|
3582
|
+
}
|
|
3583
|
+
);
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3586
|
+
public async updatePerpMarketFuel(
|
|
3587
|
+
perpMarketIndex: number,
|
|
3588
|
+
fuelBoostTaker?: number,
|
|
3589
|
+
fuelBoostMaker?: number,
|
|
3590
|
+
fuelBoostPosition?: number
|
|
3591
|
+
): Promise<TransactionSignature> {
|
|
3592
|
+
const updatePerpMarketFuelIx = await this.getUpdatePerpMarketFuelIx(
|
|
3593
|
+
perpMarketIndex,
|
|
3594
|
+
fuelBoostTaker || null,
|
|
3595
|
+
fuelBoostMaker || null,
|
|
3596
|
+
fuelBoostPosition || null
|
|
3597
|
+
);
|
|
3598
|
+
|
|
3599
|
+
const tx = await this.buildTransaction(updatePerpMarketFuelIx);
|
|
3600
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
3601
|
+
|
|
3602
|
+
return txSig;
|
|
3603
|
+
}
|
|
3604
|
+
|
|
3605
|
+
public async getUpdatePerpMarketFuelIx(
|
|
3606
|
+
perpMarketIndex: number,
|
|
3607
|
+
fuelBoostTaker?: number,
|
|
3608
|
+
fuelBoostMaker?: number,
|
|
3609
|
+
fuelBoostPosition?: number
|
|
3610
|
+
): Promise<TransactionInstruction> {
|
|
3611
|
+
const perpMarketPublicKey = await getPerpMarketPublicKey(
|
|
3612
|
+
this.program.programId,
|
|
3613
|
+
perpMarketIndex
|
|
3614
|
+
);
|
|
3615
|
+
|
|
3616
|
+
return await this.program.instruction.updatePerpMarketFuel(
|
|
3617
|
+
fuelBoostTaker || null,
|
|
3618
|
+
fuelBoostMaker || null,
|
|
3619
|
+
fuelBoostPosition || null,
|
|
3620
|
+
{
|
|
3621
|
+
accounts: {
|
|
3622
|
+
admin: this.isSubscribed
|
|
3623
|
+
? this.getStateAccount().admin
|
|
3624
|
+
: this.wallet.publicKey,
|
|
3625
|
+
state: await this.getStatePublicKey(),
|
|
3626
|
+
perpMarket: perpMarketPublicKey,
|
|
3627
|
+
},
|
|
3628
|
+
}
|
|
3629
|
+
);
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3536
3632
|
public async initializePythPullOracle(
|
|
3537
3633
|
feedId: string
|
|
3538
3634
|
): Promise<TransactionSignature> {
|
|
@@ -105,3 +105,6 @@ export const IDLE_TIME_SLOTS = 9000;
|
|
|
105
105
|
export const SLOT_TIME_ESTIMATE_MS = 400;
|
|
106
106
|
|
|
107
107
|
export const DUST_POSITION_SIZE = QUOTE_PRECISION.divn(100); // Dust position is any position smaller than 1c
|
|
108
|
+
|
|
109
|
+
export const FUEL_WINDOW = new BN(60 * 60 * 24 * 28); // 28 days
|
|
110
|
+
export const FUEL_START_TS = new BN(1715745600); // unix timestamp
|
|
@@ -315,6 +315,18 @@ export const DevnetPerpMarkets: PerpMarketConfig[] = [
|
|
|
315
315
|
pythFeedId:
|
|
316
316
|
'0xb17e5bc5de742a8a378b54c9c75442b7d51e30ada63f28d9bd28d3c0e26511a0',
|
|
317
317
|
},
|
|
318
|
+
{
|
|
319
|
+
fullName: 'Wen',
|
|
320
|
+
category: ['Solana', 'Meme'],
|
|
321
|
+
symbol: 'WEN-PERP',
|
|
322
|
+
baseAssetSymbol: 'WEN',
|
|
323
|
+
marketIndex: 25,
|
|
324
|
+
oracle: new PublicKey('F47c7aJgYkfKXQ9gzrJaEpsNwUKHprysregTWXrtYLFp'),
|
|
325
|
+
launchTs: 1720572064000,
|
|
326
|
+
oracleSource: OracleSource.PYTH_1K_PULL,
|
|
327
|
+
pythFeedId:
|
|
328
|
+
'0x5169491cd7e2a44c98353b779d5eb612e4ac32e073f5cc534303d86307c2f1bc',
|
|
329
|
+
},
|
|
318
330
|
];
|
|
319
331
|
|
|
320
332
|
export const MainnetPerpMarkets: PerpMarketConfig[] = [
|
|
@@ -722,6 +734,28 @@ export const MainnetPerpMarkets: PerpMarketConfig[] = [
|
|
|
722
734
|
launchTs: 1719415157000,
|
|
723
735
|
oracleSource: OracleSource.SWITCHBOARD,
|
|
724
736
|
},
|
|
737
|
+
{
|
|
738
|
+
fullName: 'POPCAT',
|
|
739
|
+
category: ['Meme', 'Solana'],
|
|
740
|
+
symbol: 'POPCAT-PERP',
|
|
741
|
+
baseAssetSymbol: 'POPCAT',
|
|
742
|
+
marketIndex: 34,
|
|
743
|
+
oracle: new PublicKey('3GjpjC8TWsPqjyFSiR7saGxgzD8zqYJNsBnWpenZPEBy'),
|
|
744
|
+
launchTs: 1720013054000,
|
|
745
|
+
oracleSource: OracleSource.SWITCHBOARD,
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
fullName: 'Wen',
|
|
749
|
+
category: ['Solana', 'Meme'],
|
|
750
|
+
symbol: 'WEN-PERP',
|
|
751
|
+
baseAssetSymbol: 'WEN',
|
|
752
|
+
marketIndex: 35,
|
|
753
|
+
oracle: new PublicKey('F47c7aJgYkfKXQ9gzrJaEpsNwUKHprysregTWXrtYLFp'),
|
|
754
|
+
launchTs: 1720633344000,
|
|
755
|
+
oracleSource: OracleSource.PYTH_1K_PULL,
|
|
756
|
+
pythFeedId:
|
|
757
|
+
'0x5169491cd7e2a44c98353b779d5eb612e4ac32e073f5cc534303d86307c2f1bc',
|
|
758
|
+
},
|
|
725
759
|
];
|
|
726
760
|
|
|
727
761
|
export const PerpMarkets: { [key in DriftEnv]: PerpMarketConfig[] } = {
|
|
@@ -295,7 +295,7 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
295
295
|
{
|
|
296
296
|
symbol: 'INF',
|
|
297
297
|
marketIndex: 16,
|
|
298
|
-
oracle: new PublicKey('
|
|
298
|
+
oracle: new PublicKey('81SuhCcCQri9w4yPyv56ErtpXuncVyFCDT3fYehceG1M'),
|
|
299
299
|
oracleSource: OracleSource.SWITCHBOARD,
|
|
300
300
|
mint: new PublicKey('5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm'),
|
|
301
301
|
precision: new BN(10).pow(NINE),
|
|
@@ -334,6 +334,19 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
334
334
|
precisionExp: SIX,
|
|
335
335
|
launchTs: 1719415157000,
|
|
336
336
|
},
|
|
337
|
+
{
|
|
338
|
+
symbol: 'POPCAT',
|
|
339
|
+
marketIndex: 20,
|
|
340
|
+
oracle: new PublicKey('3GjpjC8TWsPqjyFSiR7saGxgzD8zqYJNsBnWpenZPEBy'),
|
|
341
|
+
oracleSource: OracleSource.SWITCHBOARD,
|
|
342
|
+
mint: new PublicKey('7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr'),
|
|
343
|
+
precision: new BN(10).pow(NINE),
|
|
344
|
+
precisionExp: NINE,
|
|
345
|
+
launchTs: 1720013054000,
|
|
346
|
+
phoenixMarket: new PublicKey(
|
|
347
|
+
'31XgvAQ1HgFQEk31KdszbPkVXKaQqB1bgYZPoDrFpSR2'
|
|
348
|
+
),
|
|
349
|
+
},
|
|
337
350
|
];
|
|
338
351
|
|
|
339
352
|
export const SpotMarkets: { [key in DriftEnv]: SpotMarketConfig[] } = {
|
package/src/idl/drift.json
CHANGED
|
@@ -2244,6 +2244,42 @@
|
|
|
2244
2244
|
],
|
|
2245
2245
|
"args": []
|
|
2246
2246
|
},
|
|
2247
|
+
{
|
|
2248
|
+
"name": "updateUserGovTokenInsuranceStake",
|
|
2249
|
+
"accounts": [
|
|
2250
|
+
{
|
|
2251
|
+
"name": "state",
|
|
2252
|
+
"isMut": false,
|
|
2253
|
+
"isSigner": false
|
|
2254
|
+
},
|
|
2255
|
+
{
|
|
2256
|
+
"name": "spotMarket",
|
|
2257
|
+
"isMut": false,
|
|
2258
|
+
"isSigner": false
|
|
2259
|
+
},
|
|
2260
|
+
{
|
|
2261
|
+
"name": "insuranceFundStake",
|
|
2262
|
+
"isMut": true,
|
|
2263
|
+
"isSigner": false
|
|
2264
|
+
},
|
|
2265
|
+
{
|
|
2266
|
+
"name": "userStats",
|
|
2267
|
+
"isMut": true,
|
|
2268
|
+
"isSigner": false
|
|
2269
|
+
},
|
|
2270
|
+
{
|
|
2271
|
+
"name": "authority",
|
|
2272
|
+
"isMut": false,
|
|
2273
|
+
"isSigner": true
|
|
2274
|
+
},
|
|
2275
|
+
{
|
|
2276
|
+
"name": "insuranceFundVault",
|
|
2277
|
+
"isMut": true,
|
|
2278
|
+
"isSigner": false
|
|
2279
|
+
}
|
|
2280
|
+
],
|
|
2281
|
+
"args": []
|
|
2282
|
+
},
|
|
2247
2283
|
{
|
|
2248
2284
|
"name": "initializeInsuranceFundStake",
|
|
2249
2285
|
"accounts": [
|
|
@@ -5079,6 +5115,92 @@
|
|
|
5079
5115
|
}
|
|
5080
5116
|
]
|
|
5081
5117
|
},
|
|
5118
|
+
{
|
|
5119
|
+
"name": "updatePerpMarketFuel",
|
|
5120
|
+
"accounts": [
|
|
5121
|
+
{
|
|
5122
|
+
"name": "admin",
|
|
5123
|
+
"isMut": false,
|
|
5124
|
+
"isSigner": true
|
|
5125
|
+
},
|
|
5126
|
+
{
|
|
5127
|
+
"name": "state",
|
|
5128
|
+
"isMut": false,
|
|
5129
|
+
"isSigner": false
|
|
5130
|
+
},
|
|
5131
|
+
{
|
|
5132
|
+
"name": "perpMarket",
|
|
5133
|
+
"isMut": true,
|
|
5134
|
+
"isSigner": false
|
|
5135
|
+
}
|
|
5136
|
+
],
|
|
5137
|
+
"args": [
|
|
5138
|
+
{
|
|
5139
|
+
"name": "fuelBoostTaker",
|
|
5140
|
+
"type": {
|
|
5141
|
+
"option": "u8"
|
|
5142
|
+
}
|
|
5143
|
+
},
|
|
5144
|
+
{
|
|
5145
|
+
"name": "fuelBoostMaker",
|
|
5146
|
+
"type": {
|
|
5147
|
+
"option": "u8"
|
|
5148
|
+
}
|
|
5149
|
+
},
|
|
5150
|
+
{
|
|
5151
|
+
"name": "fuelBoostPosition",
|
|
5152
|
+
"type": {
|
|
5153
|
+
"option": "u8"
|
|
5154
|
+
}
|
|
5155
|
+
}
|
|
5156
|
+
]
|
|
5157
|
+
},
|
|
5158
|
+
{
|
|
5159
|
+
"name": "updateSpotMarketFuel",
|
|
5160
|
+
"accounts": [
|
|
5161
|
+
{
|
|
5162
|
+
"name": "admin",
|
|
5163
|
+
"isMut": false,
|
|
5164
|
+
"isSigner": true
|
|
5165
|
+
},
|
|
5166
|
+
{
|
|
5167
|
+
"name": "state",
|
|
5168
|
+
"isMut": false,
|
|
5169
|
+
"isSigner": false
|
|
5170
|
+
},
|
|
5171
|
+
{
|
|
5172
|
+
"name": "spotMarket",
|
|
5173
|
+
"isMut": true,
|
|
5174
|
+
"isSigner": false
|
|
5175
|
+
}
|
|
5176
|
+
],
|
|
5177
|
+
"args": [
|
|
5178
|
+
{
|
|
5179
|
+
"name": "fuelBoostDeposits",
|
|
5180
|
+
"type": {
|
|
5181
|
+
"option": "u8"
|
|
5182
|
+
}
|
|
5183
|
+
},
|
|
5184
|
+
{
|
|
5185
|
+
"name": "fuelBoostBorrows",
|
|
5186
|
+
"type": {
|
|
5187
|
+
"option": "u8"
|
|
5188
|
+
}
|
|
5189
|
+
},
|
|
5190
|
+
{
|
|
5191
|
+
"name": "fuelBoostTaker",
|
|
5192
|
+
"type": {
|
|
5193
|
+
"option": "u8"
|
|
5194
|
+
}
|
|
5195
|
+
},
|
|
5196
|
+
{
|
|
5197
|
+
"name": "fuelBoostMaker",
|
|
5198
|
+
"type": {
|
|
5199
|
+
"option": "u8"
|
|
5200
|
+
}
|
|
5201
|
+
}
|
|
5202
|
+
]
|
|
5203
|
+
},
|
|
5082
5204
|
{
|
|
5083
5205
|
"name": "updateAdmin",
|
|
5084
5206
|
"accounts": [
|
|
@@ -5918,12 +6040,36 @@
|
|
|
5918
6040
|
],
|
|
5919
6041
|
"type": "i16"
|
|
5920
6042
|
},
|
|
6043
|
+
{
|
|
6044
|
+
"name": "fuelBoostPosition",
|
|
6045
|
+
"docs": [
|
|
6046
|
+
"fuel multiplier for perp funding",
|
|
6047
|
+
"precision: 10"
|
|
6048
|
+
],
|
|
6049
|
+
"type": "u8"
|
|
6050
|
+
},
|
|
6051
|
+
{
|
|
6052
|
+
"name": "fuelBoostTaker",
|
|
6053
|
+
"docs": [
|
|
6054
|
+
"fuel multiplier for perp taker",
|
|
6055
|
+
"precision: 10"
|
|
6056
|
+
],
|
|
6057
|
+
"type": "u8"
|
|
6058
|
+
},
|
|
6059
|
+
{
|
|
6060
|
+
"name": "fuelBoostMaker",
|
|
6061
|
+
"docs": [
|
|
6062
|
+
"fuel multiplier for perp maker",
|
|
6063
|
+
"precision: 10"
|
|
6064
|
+
],
|
|
6065
|
+
"type": "u8"
|
|
6066
|
+
},
|
|
5921
6067
|
{
|
|
5922
6068
|
"name": "padding",
|
|
5923
6069
|
"type": {
|
|
5924
6070
|
"array": [
|
|
5925
6071
|
"u8",
|
|
5926
|
-
|
|
6072
|
+
43
|
|
5927
6073
|
]
|
|
5928
6074
|
}
|
|
5929
6075
|
}
|
|
@@ -6376,12 +6522,44 @@
|
|
|
6376
6522
|
],
|
|
6377
6523
|
"type": "u8"
|
|
6378
6524
|
},
|
|
6525
|
+
{
|
|
6526
|
+
"name": "fuelBoostDeposits",
|
|
6527
|
+
"docs": [
|
|
6528
|
+
"fuel multiplier for spot deposits",
|
|
6529
|
+
"precision: 10"
|
|
6530
|
+
],
|
|
6531
|
+
"type": "u8"
|
|
6532
|
+
},
|
|
6533
|
+
{
|
|
6534
|
+
"name": "fuelBoostBorrows",
|
|
6535
|
+
"docs": [
|
|
6536
|
+
"fuel multiplier for spot borrows",
|
|
6537
|
+
"precision: 10"
|
|
6538
|
+
],
|
|
6539
|
+
"type": "u8"
|
|
6540
|
+
},
|
|
6541
|
+
{
|
|
6542
|
+
"name": "fuelBoostTaker",
|
|
6543
|
+
"docs": [
|
|
6544
|
+
"fuel multiplier for spot taker",
|
|
6545
|
+
"precision: 10"
|
|
6546
|
+
],
|
|
6547
|
+
"type": "u8"
|
|
6548
|
+
},
|
|
6549
|
+
{
|
|
6550
|
+
"name": "fuelBoostMaker",
|
|
6551
|
+
"docs": [
|
|
6552
|
+
"fuel multiplier for spot maker",
|
|
6553
|
+
"precision: 10"
|
|
6554
|
+
],
|
|
6555
|
+
"type": "u8"
|
|
6556
|
+
},
|
|
6379
6557
|
{
|
|
6380
6558
|
"name": "padding",
|
|
6381
6559
|
"type": {
|
|
6382
6560
|
"array": [
|
|
6383
6561
|
"u8",
|
|
6384
|
-
|
|
6562
|
+
43
|
|
6385
6563
|
]
|
|
6386
6564
|
}
|
|
6387
6565
|
}
|
|
@@ -6729,12 +6907,25 @@
|
|
|
6729
6907
|
],
|
|
6730
6908
|
"type": "bool"
|
|
6731
6909
|
},
|
|
6910
|
+
{
|
|
6911
|
+
"name": "padding1",
|
|
6912
|
+
"type": {
|
|
6913
|
+
"array": [
|
|
6914
|
+
"u8",
|
|
6915
|
+
5
|
|
6916
|
+
]
|
|
6917
|
+
}
|
|
6918
|
+
},
|
|
6919
|
+
{
|
|
6920
|
+
"name": "lastFuelBonusUpdateTs",
|
|
6921
|
+
"type": "i64"
|
|
6922
|
+
},
|
|
6732
6923
|
{
|
|
6733
6924
|
"name": "padding",
|
|
6734
6925
|
"type": {
|
|
6735
6926
|
"array": [
|
|
6736
6927
|
"u8",
|
|
6737
|
-
|
|
6928
|
+
8
|
|
6738
6929
|
]
|
|
6739
6930
|
}
|
|
6740
6931
|
}
|
|
@@ -6855,12 +7046,63 @@
|
|
|
6855
7046
|
"name": "disableUpdatePerpBidAskTwap",
|
|
6856
7047
|
"type": "bool"
|
|
6857
7048
|
},
|
|
7049
|
+
{
|
|
7050
|
+
"name": "padding1",
|
|
7051
|
+
"type": {
|
|
7052
|
+
"array": [
|
|
7053
|
+
"u8",
|
|
7054
|
+
6
|
|
7055
|
+
]
|
|
7056
|
+
}
|
|
7057
|
+
},
|
|
7058
|
+
{
|
|
7059
|
+
"name": "fuelDeposits",
|
|
7060
|
+
"docs": [
|
|
7061
|
+
"sub account id for spot deposit, borrow fuel tracking"
|
|
7062
|
+
],
|
|
7063
|
+
"type": "u32"
|
|
7064
|
+
},
|
|
7065
|
+
{
|
|
7066
|
+
"name": "fuelBorrows",
|
|
7067
|
+
"docs": [
|
|
7068
|
+
"accumulate fuel bonus for epoch"
|
|
7069
|
+
],
|
|
7070
|
+
"type": "u32"
|
|
7071
|
+
},
|
|
7072
|
+
{
|
|
7073
|
+
"name": "fuelPositions",
|
|
7074
|
+
"docs": [
|
|
7075
|
+
"accumulated fuel for perp open interest"
|
|
7076
|
+
],
|
|
7077
|
+
"type": "u32"
|
|
7078
|
+
},
|
|
7079
|
+
{
|
|
7080
|
+
"name": "fuelTaker",
|
|
7081
|
+
"docs": [
|
|
7082
|
+
"accumulate fuel bonus for epoch"
|
|
7083
|
+
],
|
|
7084
|
+
"type": "u32"
|
|
7085
|
+
},
|
|
7086
|
+
{
|
|
7087
|
+
"name": "fuelMaker",
|
|
7088
|
+
"docs": [
|
|
7089
|
+
"accumulate fuel bonus for epoch"
|
|
7090
|
+
],
|
|
7091
|
+
"type": "u32"
|
|
7092
|
+
},
|
|
7093
|
+
{
|
|
7094
|
+
"name": "ifStakedGovTokenAmount",
|
|
7095
|
+
"docs": [
|
|
7096
|
+
"The amount of tokens staked in the governance spot markets if"
|
|
7097
|
+
],
|
|
7098
|
+
"type": "u64"
|
|
7099
|
+
},
|
|
6858
7100
|
{
|
|
6859
7101
|
"name": "padding",
|
|
6860
7102
|
"type": {
|
|
6861
7103
|
"array": [
|
|
6862
7104
|
"u8",
|
|
6863
|
-
|
|
7105
|
+
16
|
|
6864
7106
|
]
|
|
6865
7107
|
}
|
|
6866
7108
|
}
|
package/src/index.ts
CHANGED
|
@@ -65,6 +65,7 @@ export * from './slot/SlotSubscriber';
|
|
|
65
65
|
export * from './wallet';
|
|
66
66
|
export * from './types';
|
|
67
67
|
export * from './math/utils';
|
|
68
|
+
export * from './math/fuel';
|
|
68
69
|
export * from './config';
|
|
69
70
|
export * from './constants/numericConstants';
|
|
70
71
|
export * from './serum/serumSubscriber';
|