@drift-labs/sdk 2.97.0-beta.1 → 2.97.0-beta.11
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/README.md +11 -4
- package/VERSION +1 -1
- package/lib/addresses/pda.d.ts +1 -0
- package/lib/addresses/pda.js +5 -1
- package/lib/adminClient.d.ts +6 -0
- package/lib/adminClient.js +53 -0
- package/lib/config.d.ts +1 -1
- package/lib/config.js +5 -3
- package/lib/constants/perpMarkets.js +20 -0
- package/lib/driftClient.d.ts +8 -1
- package/lib/driftClient.js +55 -4
- package/lib/idl/drift.json +248 -3
- package/lib/idl/switchboard_on_demand_30.json +195 -37
- package/lib/math/margin.d.ts +2 -2
- package/lib/math/margin.js +4 -4
- package/lib/math/market.d.ts +1 -1
- package/lib/math/market.js +15 -3
- package/lib/types.d.ts +11 -0
- package/lib/types.js +6 -1
- package/lib/user.d.ts +1 -0
- package/lib/user.js +12 -8
- package/package.json +1 -1
- package/src/addresses/pda.ts +9 -0
- package/src/adminClient.ts +114 -0
- package/src/config.ts +12 -3
- package/src/constants/perpMarkets.ts +20 -0
- package/src/driftClient.ts +132 -11
- package/src/idl/drift.json +248 -3
- package/src/idl/switchboard_on_demand_30.json +195 -37
- package/src/math/margin.ts +8 -4
- package/src/math/market.ts +19 -3
- package/src/types.ts +9 -0
- package/src/user.ts +21 -8
package/src/adminClient.ts
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
getOpenbookV2FulfillmentConfigPublicKey,
|
|
33
33
|
getPythPullOraclePublicKey,
|
|
34
34
|
getUserStatsAccountPublicKey,
|
|
35
|
+
getHighLeverageModeConfigPublicKey,
|
|
35
36
|
} from './addresses/pda';
|
|
36
37
|
import { squareRootBN } from './math/utils';
|
|
37
38
|
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
@@ -1268,6 +1269,50 @@ export class AdminClient extends DriftClient {
|
|
|
1268
1269
|
);
|
|
1269
1270
|
}
|
|
1270
1271
|
|
|
1272
|
+
public async updatePerpMarketHighLeverageMarginRatio(
|
|
1273
|
+
perpMarketIndex: number,
|
|
1274
|
+
marginRatioInitial: number,
|
|
1275
|
+
marginRatioMaintenance: number
|
|
1276
|
+
): Promise<TransactionSignature> {
|
|
1277
|
+
const updatePerpMarketHighLeverageMarginRatioIx =
|
|
1278
|
+
await this.getUpdatePerpMarketHighLeverageMarginRatioIx(
|
|
1279
|
+
perpMarketIndex,
|
|
1280
|
+
marginRatioInitial,
|
|
1281
|
+
marginRatioMaintenance
|
|
1282
|
+
);
|
|
1283
|
+
|
|
1284
|
+
const tx = await this.buildTransaction(
|
|
1285
|
+
updatePerpMarketHighLeverageMarginRatioIx
|
|
1286
|
+
);
|
|
1287
|
+
|
|
1288
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1289
|
+
|
|
1290
|
+
return txSig;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
public async getUpdatePerpMarketHighLeverageMarginRatioIx(
|
|
1294
|
+
perpMarketIndex: number,
|
|
1295
|
+
marginRatioInitial: number,
|
|
1296
|
+
marginRatioMaintenance: number
|
|
1297
|
+
): Promise<TransactionInstruction> {
|
|
1298
|
+
return await this.program.instruction.updatePerpMarketHighLeverageMarginRatio(
|
|
1299
|
+
marginRatioInitial,
|
|
1300
|
+
marginRatioMaintenance,
|
|
1301
|
+
{
|
|
1302
|
+
accounts: {
|
|
1303
|
+
admin: this.isSubscribed
|
|
1304
|
+
? this.getStateAccount().admin
|
|
1305
|
+
: this.wallet.publicKey,
|
|
1306
|
+
state: await this.getStatePublicKey(),
|
|
1307
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
1308
|
+
this.program.programId,
|
|
1309
|
+
perpMarketIndex
|
|
1310
|
+
),
|
|
1311
|
+
},
|
|
1312
|
+
}
|
|
1313
|
+
);
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1271
1316
|
public async updatePerpMarketImfFactor(
|
|
1272
1317
|
perpMarketIndex: number,
|
|
1273
1318
|
imfFactor: number,
|
|
@@ -3847,4 +3892,73 @@ export class AdminClient extends DriftClient {
|
|
|
3847
3892
|
}
|
|
3848
3893
|
);
|
|
3849
3894
|
}
|
|
3895
|
+
|
|
3896
|
+
public async initializeHighLeverageModeConfig(
|
|
3897
|
+
maxUsers: number
|
|
3898
|
+
): Promise<TransactionSignature> {
|
|
3899
|
+
const initializeHighLeverageModeConfigIx =
|
|
3900
|
+
await this.getInitializeHighLeverageModeConfigIx(maxUsers);
|
|
3901
|
+
|
|
3902
|
+
const tx = await this.buildTransaction(initializeHighLeverageModeConfigIx);
|
|
3903
|
+
|
|
3904
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
3905
|
+
|
|
3906
|
+
return txSig;
|
|
3907
|
+
}
|
|
3908
|
+
|
|
3909
|
+
public async getInitializeHighLeverageModeConfigIx(
|
|
3910
|
+
maxUsers: number
|
|
3911
|
+
): Promise<TransactionInstruction> {
|
|
3912
|
+
return await this.program.instruction.initializeHighLeverageModeConfig(
|
|
3913
|
+
maxUsers,
|
|
3914
|
+
{
|
|
3915
|
+
accounts: {
|
|
3916
|
+
admin: this.isSubscribed
|
|
3917
|
+
? this.getStateAccount().admin
|
|
3918
|
+
: this.wallet.publicKey,
|
|
3919
|
+
state: await this.getStatePublicKey(),
|
|
3920
|
+
rent: SYSVAR_RENT_PUBKEY,
|
|
3921
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
3922
|
+
highLeverageModeConfig: getHighLeverageModeConfigPublicKey(
|
|
3923
|
+
this.program.programId
|
|
3924
|
+
),
|
|
3925
|
+
},
|
|
3926
|
+
}
|
|
3927
|
+
);
|
|
3928
|
+
}
|
|
3929
|
+
|
|
3930
|
+
public async updateUpdateHighLeverageModeConfig(
|
|
3931
|
+
maxUsers: number,
|
|
3932
|
+
reduceOnly: boolean
|
|
3933
|
+
): Promise<TransactionSignature> {
|
|
3934
|
+
const updateHighLeverageModeConfigIx =
|
|
3935
|
+
await this.getUpdateHighLeverageModeConfigIx(maxUsers, reduceOnly);
|
|
3936
|
+
|
|
3937
|
+
const tx = await this.buildTransaction(updateHighLeverageModeConfigIx);
|
|
3938
|
+
|
|
3939
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
3940
|
+
|
|
3941
|
+
return txSig;
|
|
3942
|
+
}
|
|
3943
|
+
|
|
3944
|
+
public async getUpdateHighLeverageModeConfigIx(
|
|
3945
|
+
maxUsers: number,
|
|
3946
|
+
reduceOnly: boolean
|
|
3947
|
+
): Promise<TransactionInstruction> {
|
|
3948
|
+
return await this.program.instruction.updateHighLeverageModeConfig(
|
|
3949
|
+
maxUsers,
|
|
3950
|
+
reduceOnly,
|
|
3951
|
+
{
|
|
3952
|
+
accounts: {
|
|
3953
|
+
admin: this.isSubscribed
|
|
3954
|
+
? this.getStateAccount().admin
|
|
3955
|
+
: this.wallet.publicKey,
|
|
3956
|
+
state: await this.getStatePublicKey(),
|
|
3957
|
+
highLeverageModeConfig: getHighLeverageModeConfigPublicKey(
|
|
3958
|
+
this.program.programId
|
|
3959
|
+
),
|
|
3960
|
+
},
|
|
3961
|
+
}
|
|
3962
|
+
);
|
|
3963
|
+
}
|
|
3850
3964
|
}
|
package/src/config.ts
CHANGED
|
@@ -114,16 +114,25 @@ export const initialize = (props: {
|
|
|
114
114
|
return currentConfig;
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
export function getMarketsAndOraclesForSubscription(
|
|
117
|
+
export function getMarketsAndOraclesForSubscription(
|
|
118
|
+
env: DriftEnv,
|
|
119
|
+
perpMarkets?: PerpMarketConfig[],
|
|
120
|
+
spotMarkets?: SpotMarketConfig[]
|
|
121
|
+
): {
|
|
118
122
|
perpMarketIndexes: number[];
|
|
119
123
|
spotMarketIndexes: number[];
|
|
120
124
|
oracleInfos: OracleInfo[];
|
|
121
125
|
} {
|
|
126
|
+
const perpMarketsToUse =
|
|
127
|
+
perpMarkets?.length > 0 ? perpMarkets : PerpMarkets[env];
|
|
128
|
+
const spotMarketsToUse =
|
|
129
|
+
spotMarkets?.length > 0 ? spotMarkets : SpotMarkets[env];
|
|
130
|
+
|
|
122
131
|
const perpMarketIndexes = [];
|
|
123
132
|
const spotMarketIndexes = [];
|
|
124
133
|
const oracleInfos = new Map<string, OracleInfo>();
|
|
125
134
|
|
|
126
|
-
for (const market of
|
|
135
|
+
for (const market of perpMarketsToUse) {
|
|
127
136
|
perpMarketIndexes.push(market.marketIndex);
|
|
128
137
|
oracleInfos.set(market.oracle.toString(), {
|
|
129
138
|
publicKey: market.oracle,
|
|
@@ -131,7 +140,7 @@ export function getMarketsAndOraclesForSubscription(env: DriftEnv): {
|
|
|
131
140
|
});
|
|
132
141
|
}
|
|
133
142
|
|
|
134
|
-
for (const spotMarket of
|
|
143
|
+
for (const spotMarket of spotMarketsToUse) {
|
|
135
144
|
spotMarketIndexes.push(spotMarket.marketIndex);
|
|
136
145
|
oracleInfos.set(spotMarket.oracle.toString(), {
|
|
137
146
|
publicKey: spotMarket.oracle,
|
|
@@ -896,6 +896,26 @@ export const MainnetPerpMarkets: PerpMarketConfig[] = [
|
|
|
896
896
|
launchTs: 1727965864000,
|
|
897
897
|
oracleSource: OracleSource.Prelaunch,
|
|
898
898
|
},
|
|
899
|
+
{
|
|
900
|
+
fullName: 'DeBridge',
|
|
901
|
+
category: ['Bridge'],
|
|
902
|
+
symbol: 'DBR-PERP',
|
|
903
|
+
baseAssetSymbol: 'DBR',
|
|
904
|
+
marketIndex: 47,
|
|
905
|
+
oracle: new PublicKey('AQzxePg2vY52Cw4di1j5xF7BqetNPxogqYPgDBL7HXWn'),
|
|
906
|
+
launchTs: 1728574493000,
|
|
907
|
+
oracleSource: OracleSource.Prelaunch,
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
fullName: 'WLF-5B-1W',
|
|
911
|
+
category: ['Prediction'],
|
|
912
|
+
symbol: 'WLF-5B-1W-BET',
|
|
913
|
+
baseAssetSymbol: 'WLF-5B-1W',
|
|
914
|
+
marketIndex: 48,
|
|
915
|
+
oracle: new PublicKey('7LpRfPaWR7cQqN7CMkCmZjEQpWyqso5LGuKCvDXH5ZAr'),
|
|
916
|
+
launchTs: 1728574493000,
|
|
917
|
+
oracleSource: OracleSource.Prelaunch,
|
|
918
|
+
},
|
|
899
919
|
];
|
|
900
920
|
|
|
901
921
|
export const PerpMarkets: { [key in DriftEnv]: PerpMarketConfig[] } = {
|
package/src/driftClient.ts
CHANGED
|
@@ -82,6 +82,7 @@ import StrictEventEmitter from 'strict-event-emitter-types';
|
|
|
82
82
|
import {
|
|
83
83
|
getDriftSignerPublicKey,
|
|
84
84
|
getDriftStateAccountPublicKey,
|
|
85
|
+
getHighLeverageModeConfigPublicKey,
|
|
85
86
|
getInsuranceFundStakeAccountPublicKey,
|
|
86
87
|
getOpenbookV2FulfillmentConfigPublicKey,
|
|
87
88
|
getPerpMarketPublicKey,
|
|
@@ -3333,9 +3334,23 @@ export class DriftClient {
|
|
|
3333
3334
|
}
|
|
3334
3335
|
|
|
3335
3336
|
public async settleExpiredMarketPoolsToRevenuePool(
|
|
3336
|
-
|
|
3337
|
+
marketIndex: number,
|
|
3337
3338
|
txParams?: TxParams
|
|
3338
3339
|
): Promise<TransactionSignature> {
|
|
3340
|
+
const { txSig } = await this.sendTransaction(
|
|
3341
|
+
await this.buildTransaction(
|
|
3342
|
+
await this.getSettleExpiredMarketPoolsToRevenuePoolIx(marketIndex),
|
|
3343
|
+
txParams
|
|
3344
|
+
),
|
|
3345
|
+
[],
|
|
3346
|
+
this.opts
|
|
3347
|
+
);
|
|
3348
|
+
return txSig;
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
public async getSettleExpiredMarketPoolsToRevenuePoolIx(
|
|
3352
|
+
perpMarketIndex: number
|
|
3353
|
+
): Promise<TransactionInstruction> {
|
|
3339
3354
|
const perpMarketPublicKey = await getPerpMarketPublicKey(
|
|
3340
3355
|
this.program.programId,
|
|
3341
3356
|
perpMarketIndex
|
|
@@ -3346,8 +3361,8 @@ export class DriftClient {
|
|
|
3346
3361
|
QUOTE_SPOT_MARKET_INDEX
|
|
3347
3362
|
);
|
|
3348
3363
|
|
|
3349
|
-
|
|
3350
|
-
|
|
3364
|
+
return await this.program.instruction.settleExpiredMarketPoolsToRevenuePool(
|
|
3365
|
+
{
|
|
3351
3366
|
accounts: {
|
|
3352
3367
|
state: await this.getStatePublicKey(),
|
|
3353
3368
|
admin: this.isSubscribed
|
|
@@ -3356,15 +3371,8 @@ export class DriftClient {
|
|
|
3356
3371
|
spotMarket: spotMarketPublicKey,
|
|
3357
3372
|
perpMarket: perpMarketPublicKey,
|
|
3358
3373
|
},
|
|
3359
|
-
}
|
|
3360
|
-
|
|
3361
|
-
const { txSig } = await this.sendTransaction(
|
|
3362
|
-
await this.buildTransaction(ix, txParams),
|
|
3363
|
-
[],
|
|
3364
|
-
this.opts
|
|
3374
|
+
}
|
|
3365
3375
|
);
|
|
3366
|
-
|
|
3367
|
-
return txSig;
|
|
3368
3376
|
}
|
|
3369
3377
|
|
|
3370
3378
|
public async cancelOrder(
|
|
@@ -4929,6 +4937,52 @@ export class DriftClient {
|
|
|
4929
4937
|
});
|
|
4930
4938
|
}
|
|
4931
4939
|
|
|
4940
|
+
public async updateUserFuelBonus(
|
|
4941
|
+
userAccountPublicKey: PublicKey,
|
|
4942
|
+
user: UserAccount,
|
|
4943
|
+
userAuthority: PublicKey,
|
|
4944
|
+
txParams?: TxParams
|
|
4945
|
+
): Promise<TransactionSignature> {
|
|
4946
|
+
const { txSig } = await this.sendTransaction(
|
|
4947
|
+
await this.buildTransaction(
|
|
4948
|
+
await this.getUpdateUserFuelBonusIx(
|
|
4949
|
+
userAccountPublicKey,
|
|
4950
|
+
user,
|
|
4951
|
+
userAuthority
|
|
4952
|
+
),
|
|
4953
|
+
txParams
|
|
4954
|
+
),
|
|
4955
|
+
[],
|
|
4956
|
+
this.opts
|
|
4957
|
+
);
|
|
4958
|
+
return txSig;
|
|
4959
|
+
}
|
|
4960
|
+
|
|
4961
|
+
public async getUpdateUserFuelBonusIx(
|
|
4962
|
+
userAccountPublicKey: PublicKey,
|
|
4963
|
+
userAccount: UserAccount,
|
|
4964
|
+
userAuthority: PublicKey
|
|
4965
|
+
): Promise<TransactionInstruction> {
|
|
4966
|
+
const userStatsAccountPublicKey = getUserStatsAccountPublicKey(
|
|
4967
|
+
this.program.programId,
|
|
4968
|
+
userAuthority
|
|
4969
|
+
);
|
|
4970
|
+
|
|
4971
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
4972
|
+
userAccounts: [userAccount],
|
|
4973
|
+
});
|
|
4974
|
+
|
|
4975
|
+
return await this.program.instruction.updateUserFuelBonus({
|
|
4976
|
+
accounts: {
|
|
4977
|
+
state: await this.getStatePublicKey(),
|
|
4978
|
+
user: userAccountPublicKey,
|
|
4979
|
+
userStats: userStatsAccountPublicKey,
|
|
4980
|
+
authority: this.wallet.publicKey,
|
|
4981
|
+
},
|
|
4982
|
+
remainingAccounts,
|
|
4983
|
+
});
|
|
4984
|
+
}
|
|
4985
|
+
|
|
4932
4986
|
public async updateUserOpenOrdersCount(
|
|
4933
4987
|
userAccountPublicKey: PublicKey,
|
|
4934
4988
|
user: UserAccount,
|
|
@@ -8049,6 +8103,73 @@ export class DriftClient {
|
|
|
8049
8103
|
return [postIxs, encodedVaaKeypair];
|
|
8050
8104
|
}
|
|
8051
8105
|
|
|
8106
|
+
public async enableUserHighLeverageMode(
|
|
8107
|
+
subAccountId: number,
|
|
8108
|
+
txParams?: TxParams
|
|
8109
|
+
): Promise<TransactionSignature> {
|
|
8110
|
+
const { txSig } = await this.sendTransaction(
|
|
8111
|
+
await this.buildTransaction(
|
|
8112
|
+
await this.getEnableHighLeverageModeIx(subAccountId),
|
|
8113
|
+
txParams
|
|
8114
|
+
),
|
|
8115
|
+
[],
|
|
8116
|
+
this.opts
|
|
8117
|
+
);
|
|
8118
|
+
return txSig;
|
|
8119
|
+
}
|
|
8120
|
+
|
|
8121
|
+
public async getEnableHighLeverageModeIx(subAccountId: number) {
|
|
8122
|
+
const ix = await this.program.instruction.enableUserHighLeverageMode(
|
|
8123
|
+
subAccountId,
|
|
8124
|
+
{
|
|
8125
|
+
accounts: {
|
|
8126
|
+
state: await this.getStatePublicKey(),
|
|
8127
|
+
user: getUserAccountPublicKeySync(
|
|
8128
|
+
this.program.programId,
|
|
8129
|
+
this.wallet.publicKey,
|
|
8130
|
+
subAccountId
|
|
8131
|
+
),
|
|
8132
|
+
authority: this.wallet.publicKey,
|
|
8133
|
+
highLeverageModeConfig: getHighLeverageModeConfigPublicKey(
|
|
8134
|
+
this.program.programId
|
|
8135
|
+
),
|
|
8136
|
+
},
|
|
8137
|
+
}
|
|
8138
|
+
);
|
|
8139
|
+
|
|
8140
|
+
return ix;
|
|
8141
|
+
}
|
|
8142
|
+
|
|
8143
|
+
public async disableUserHighLeverageMode(
|
|
8144
|
+
user: PublicKey,
|
|
8145
|
+
txParams?: TxParams
|
|
8146
|
+
): Promise<TransactionSignature> {
|
|
8147
|
+
const { txSig } = await this.sendTransaction(
|
|
8148
|
+
await this.buildTransaction(
|
|
8149
|
+
await this.getDisableHighLeverageModeIx(user),
|
|
8150
|
+
txParams
|
|
8151
|
+
),
|
|
8152
|
+
[],
|
|
8153
|
+
this.opts
|
|
8154
|
+
);
|
|
8155
|
+
return txSig;
|
|
8156
|
+
}
|
|
8157
|
+
|
|
8158
|
+
public async getDisableHighLeverageModeIx(user: PublicKey) {
|
|
8159
|
+
const ix = await this.program.instruction.disableUserHighLeverageMode({
|
|
8160
|
+
accounts: {
|
|
8161
|
+
state: await this.getStatePublicKey(),
|
|
8162
|
+
user,
|
|
8163
|
+
authority: this.wallet.publicKey,
|
|
8164
|
+
highLeverageModeConfig: getHighLeverageModeConfigPublicKey(
|
|
8165
|
+
this.program.programId
|
|
8166
|
+
),
|
|
8167
|
+
},
|
|
8168
|
+
});
|
|
8169
|
+
|
|
8170
|
+
return ix;
|
|
8171
|
+
}
|
|
8172
|
+
|
|
8052
8173
|
private handleSignedTransaction(signedTxs: SignedTxData[]) {
|
|
8053
8174
|
if (this.enableMetricsEvents && this.metricsEventEmitter) {
|
|
8054
8175
|
this.metricsEventEmitter.emit('txSigned', signedTxs);
|
package/src/idl/drift.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.96.0",
|
|
3
3
|
"name": "drift",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
@@ -1283,6 +1283,37 @@
|
|
|
1283
1283
|
],
|
|
1284
1284
|
"args": []
|
|
1285
1285
|
},
|
|
1286
|
+
{
|
|
1287
|
+
"name": "enableUserHighLeverageMode",
|
|
1288
|
+
"accounts": [
|
|
1289
|
+
{
|
|
1290
|
+
"name": "state",
|
|
1291
|
+
"isMut": false,
|
|
1292
|
+
"isSigner": false
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
"name": "user",
|
|
1296
|
+
"isMut": true,
|
|
1297
|
+
"isSigner": false
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
"name": "authority",
|
|
1301
|
+
"isMut": false,
|
|
1302
|
+
"isSigner": true
|
|
1303
|
+
},
|
|
1304
|
+
{
|
|
1305
|
+
"name": "highLeverageModeConfig",
|
|
1306
|
+
"isMut": true,
|
|
1307
|
+
"isSigner": false
|
|
1308
|
+
}
|
|
1309
|
+
],
|
|
1310
|
+
"args": [
|
|
1311
|
+
{
|
|
1312
|
+
"name": "subAccountId",
|
|
1313
|
+
"type": "u16"
|
|
1314
|
+
}
|
|
1315
|
+
]
|
|
1316
|
+
},
|
|
1286
1317
|
{
|
|
1287
1318
|
"name": "fillPerpOrder",
|
|
1288
1319
|
"accounts": [
|
|
@@ -1498,6 +1529,58 @@
|
|
|
1498
1529
|
],
|
|
1499
1530
|
"args": []
|
|
1500
1531
|
},
|
|
1532
|
+
{
|
|
1533
|
+
"name": "disableUserHighLeverageMode",
|
|
1534
|
+
"accounts": [
|
|
1535
|
+
{
|
|
1536
|
+
"name": "state",
|
|
1537
|
+
"isMut": false,
|
|
1538
|
+
"isSigner": false
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
"name": "authority",
|
|
1542
|
+
"isMut": false,
|
|
1543
|
+
"isSigner": true
|
|
1544
|
+
},
|
|
1545
|
+
{
|
|
1546
|
+
"name": "user",
|
|
1547
|
+
"isMut": true,
|
|
1548
|
+
"isSigner": false
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
"name": "highLeverageModeConfig",
|
|
1552
|
+
"isMut": true,
|
|
1553
|
+
"isSigner": false
|
|
1554
|
+
}
|
|
1555
|
+
],
|
|
1556
|
+
"args": []
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
"name": "updateUserFuelBonus",
|
|
1560
|
+
"accounts": [
|
|
1561
|
+
{
|
|
1562
|
+
"name": "state",
|
|
1563
|
+
"isMut": false,
|
|
1564
|
+
"isSigner": false
|
|
1565
|
+
},
|
|
1566
|
+
{
|
|
1567
|
+
"name": "authority",
|
|
1568
|
+
"isMut": false,
|
|
1569
|
+
"isSigner": true
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
"name": "user",
|
|
1573
|
+
"isMut": true,
|
|
1574
|
+
"isSigner": false
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
"name": "userStats",
|
|
1578
|
+
"isMut": true,
|
|
1579
|
+
"isSigner": false
|
|
1580
|
+
}
|
|
1581
|
+
],
|
|
1582
|
+
"args": []
|
|
1583
|
+
},
|
|
1501
1584
|
{
|
|
1502
1585
|
"name": "updateUserOpenOrdersCount",
|
|
1503
1586
|
"accounts": [
|
|
@@ -3961,6 +4044,36 @@
|
|
|
3961
4044
|
}
|
|
3962
4045
|
]
|
|
3963
4046
|
},
|
|
4047
|
+
{
|
|
4048
|
+
"name": "updatePerpMarketHighLeverageMarginRatio",
|
|
4049
|
+
"accounts": [
|
|
4050
|
+
{
|
|
4051
|
+
"name": "admin",
|
|
4052
|
+
"isMut": false,
|
|
4053
|
+
"isSigner": true
|
|
4054
|
+
},
|
|
4055
|
+
{
|
|
4056
|
+
"name": "state",
|
|
4057
|
+
"isMut": false,
|
|
4058
|
+
"isSigner": false
|
|
4059
|
+
},
|
|
4060
|
+
{
|
|
4061
|
+
"name": "perpMarket",
|
|
4062
|
+
"isMut": true,
|
|
4063
|
+
"isSigner": false
|
|
4064
|
+
}
|
|
4065
|
+
],
|
|
4066
|
+
"args": [
|
|
4067
|
+
{
|
|
4068
|
+
"name": "marginRatioInitial",
|
|
4069
|
+
"type": "u16"
|
|
4070
|
+
},
|
|
4071
|
+
{
|
|
4072
|
+
"name": "marginRatioMaintenance",
|
|
4073
|
+
"type": "u16"
|
|
4074
|
+
}
|
|
4075
|
+
]
|
|
4076
|
+
},
|
|
3964
4077
|
{
|
|
3965
4078
|
"name": "updatePerpMarketFundingPeriod",
|
|
3966
4079
|
"accounts": [
|
|
@@ -5926,6 +6039,72 @@
|
|
|
5926
6039
|
}
|
|
5927
6040
|
}
|
|
5928
6041
|
]
|
|
6042
|
+
},
|
|
6043
|
+
{
|
|
6044
|
+
"name": "initializeHighLeverageModeConfig",
|
|
6045
|
+
"accounts": [
|
|
6046
|
+
{
|
|
6047
|
+
"name": "admin",
|
|
6048
|
+
"isMut": true,
|
|
6049
|
+
"isSigner": true
|
|
6050
|
+
},
|
|
6051
|
+
{
|
|
6052
|
+
"name": "highLeverageModeConfig",
|
|
6053
|
+
"isMut": true,
|
|
6054
|
+
"isSigner": false
|
|
6055
|
+
},
|
|
6056
|
+
{
|
|
6057
|
+
"name": "state",
|
|
6058
|
+
"isMut": false,
|
|
6059
|
+
"isSigner": false
|
|
6060
|
+
},
|
|
6061
|
+
{
|
|
6062
|
+
"name": "rent",
|
|
6063
|
+
"isMut": false,
|
|
6064
|
+
"isSigner": false
|
|
6065
|
+
},
|
|
6066
|
+
{
|
|
6067
|
+
"name": "systemProgram",
|
|
6068
|
+
"isMut": false,
|
|
6069
|
+
"isSigner": false
|
|
6070
|
+
}
|
|
6071
|
+
],
|
|
6072
|
+
"args": [
|
|
6073
|
+
{
|
|
6074
|
+
"name": "maxUsers",
|
|
6075
|
+
"type": "u32"
|
|
6076
|
+
}
|
|
6077
|
+
]
|
|
6078
|
+
},
|
|
6079
|
+
{
|
|
6080
|
+
"name": "updateHighLeverageModeConfig",
|
|
6081
|
+
"accounts": [
|
|
6082
|
+
{
|
|
6083
|
+
"name": "admin",
|
|
6084
|
+
"isMut": true,
|
|
6085
|
+
"isSigner": true
|
|
6086
|
+
},
|
|
6087
|
+
{
|
|
6088
|
+
"name": "highLeverageModeConfig",
|
|
6089
|
+
"isMut": true,
|
|
6090
|
+
"isSigner": false
|
|
6091
|
+
},
|
|
6092
|
+
{
|
|
6093
|
+
"name": "state",
|
|
6094
|
+
"isMut": false,
|
|
6095
|
+
"isSigner": false
|
|
6096
|
+
}
|
|
6097
|
+
],
|
|
6098
|
+
"args": [
|
|
6099
|
+
{
|
|
6100
|
+
"name": "maxUsers",
|
|
6101
|
+
"type": "u32"
|
|
6102
|
+
},
|
|
6103
|
+
{
|
|
6104
|
+
"name": "reduceOnly",
|
|
6105
|
+
"type": "bool"
|
|
6106
|
+
}
|
|
6107
|
+
]
|
|
5929
6108
|
}
|
|
5930
6109
|
],
|
|
5931
6110
|
"accounts": [
|
|
@@ -6132,6 +6311,35 @@
|
|
|
6132
6311
|
]
|
|
6133
6312
|
}
|
|
6134
6313
|
},
|
|
6314
|
+
{
|
|
6315
|
+
"name": "HighLeverageModeConfig",
|
|
6316
|
+
"type": {
|
|
6317
|
+
"kind": "struct",
|
|
6318
|
+
"fields": [
|
|
6319
|
+
{
|
|
6320
|
+
"name": "maxUsers",
|
|
6321
|
+
"type": "u32"
|
|
6322
|
+
},
|
|
6323
|
+
{
|
|
6324
|
+
"name": "currentUsers",
|
|
6325
|
+
"type": "u32"
|
|
6326
|
+
},
|
|
6327
|
+
{
|
|
6328
|
+
"name": "reduceOnly",
|
|
6329
|
+
"type": "u8"
|
|
6330
|
+
},
|
|
6331
|
+
{
|
|
6332
|
+
"name": "padding",
|
|
6333
|
+
"type": {
|
|
6334
|
+
"array": [
|
|
6335
|
+
"u8",
|
|
6336
|
+
31
|
|
6337
|
+
]
|
|
6338
|
+
}
|
|
6339
|
+
}
|
|
6340
|
+
]
|
|
6341
|
+
}
|
|
6342
|
+
},
|
|
6135
6343
|
{
|
|
6136
6344
|
"name": "InsuranceFundStake",
|
|
6137
6345
|
"type": {
|
|
@@ -6520,12 +6728,24 @@
|
|
|
6520
6728
|
],
|
|
6521
6729
|
"type": "u8"
|
|
6522
6730
|
},
|
|
6731
|
+
{
|
|
6732
|
+
"name": "padding1",
|
|
6733
|
+
"type": "u8"
|
|
6734
|
+
},
|
|
6735
|
+
{
|
|
6736
|
+
"name": "highLeverageMarginRatioInitial",
|
|
6737
|
+
"type": "u16"
|
|
6738
|
+
},
|
|
6739
|
+
{
|
|
6740
|
+
"name": "highLeverageMarginRatioMaintenance",
|
|
6741
|
+
"type": "u16"
|
|
6742
|
+
},
|
|
6523
6743
|
{
|
|
6524
6744
|
"name": "padding",
|
|
6525
6745
|
"type": {
|
|
6526
6746
|
"array": [
|
|
6527
6747
|
"u8",
|
|
6528
|
-
|
|
6748
|
+
38
|
|
6529
6749
|
]
|
|
6530
6750
|
}
|
|
6531
6751
|
}
|
|
@@ -7375,12 +7595,18 @@
|
|
|
7375
7595
|
],
|
|
7376
7596
|
"type": "bool"
|
|
7377
7597
|
},
|
|
7598
|
+
{
|
|
7599
|
+
"name": "marginMode",
|
|
7600
|
+
"type": {
|
|
7601
|
+
"defined": "MarginMode"
|
|
7602
|
+
}
|
|
7603
|
+
},
|
|
7378
7604
|
{
|
|
7379
7605
|
"name": "padding1",
|
|
7380
7606
|
"type": {
|
|
7381
7607
|
"array": [
|
|
7382
7608
|
"u8",
|
|
7383
|
-
|
|
7609
|
+
4
|
|
7384
7610
|
]
|
|
7385
7611
|
}
|
|
7386
7612
|
},
|
|
@@ -10633,6 +10859,20 @@
|
|
|
10633
10859
|
}
|
|
10634
10860
|
]
|
|
10635
10861
|
}
|
|
10862
|
+
},
|
|
10863
|
+
{
|
|
10864
|
+
"name": "MarginMode",
|
|
10865
|
+
"type": {
|
|
10866
|
+
"kind": "enum",
|
|
10867
|
+
"variants": [
|
|
10868
|
+
{
|
|
10869
|
+
"name": "Default"
|
|
10870
|
+
},
|
|
10871
|
+
{
|
|
10872
|
+
"name": "HighLeverage"
|
|
10873
|
+
}
|
|
10874
|
+
]
|
|
10875
|
+
}
|
|
10636
10876
|
}
|
|
10637
10877
|
],
|
|
10638
10878
|
"events": [
|
|
@@ -13126,6 +13366,11 @@
|
|
|
13126
13366
|
"code": 6289,
|
|
13127
13367
|
"name": "PlaceAndTakeOrderSuccessConditionFailed",
|
|
13128
13368
|
"msg": "Place and take order success condition failed"
|
|
13369
|
+
},
|
|
13370
|
+
{
|
|
13371
|
+
"code": 6290,
|
|
13372
|
+
"name": "InvalidHighLeverageModeConfig",
|
|
13373
|
+
"msg": "Invalid High Leverage Mode Config"
|
|
13129
13374
|
}
|
|
13130
13375
|
],
|
|
13131
13376
|
"metadata": {
|