Skip to content

Commit ef8b281

Browse files
committed
Revert "sdk: add new admin client fn"
This reverts commit c7a4f0b.
1 parent c7a4f0b commit ef8b281

File tree

1 file changed

+76
-141
lines changed

1 file changed

+76
-141
lines changed

sdk/src/adminClient.ts

Lines changed: 76 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
ContractTier,
1515
AssetTier,
1616
SpotFulfillmentConfigStatus,
17-
IfRebalanceConfigParams,
1817
} from './types';
1918
import { DEFAULT_MARKET_NAME, encodeName } from './userName';
2019
import { BN } from '@coral-xyz/anchor';
@@ -38,7 +37,6 @@ import {
3837
getProtectedMakerModeConfigPublicKey,
3938
getFuelOverflowAccountPublicKey,
4039
getTokenProgramForSpotMarket,
41-
getIfRebalanceConfigPublicKey,
4240
} from './addresses/pda';
4341
import { squareRootBN } from './math/utils';
4442
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
@@ -3403,86 +3401,6 @@ export class AdminClient extends DriftClient {
34033401
);
34043402
}
34053403

3406-
public async updatePerpMarketTakerSpeedBumpOverride(
3407-
perpMarketIndex: number,
3408-
takerSpeedBumpOverride: number
3409-
): Promise<TransactionSignature> {
3410-
const updatePerpMarketTakerSpeedBumpOverrideIx =
3411-
await this.getUpdatePerpMarketTakerSpeedBumpOverrideIx(
3412-
perpMarketIndex,
3413-
takerSpeedBumpOverride
3414-
);
3415-
3416-
const tx = await this.buildTransaction(
3417-
updatePerpMarketTakerSpeedBumpOverrideIx
3418-
);
3419-
3420-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
3421-
3422-
return txSig;
3423-
}
3424-
3425-
public async getUpdatePerpMarketTakerSpeedBumpOverrideIx(
3426-
perpMarketIndex: number,
3427-
takerSpeedBumpOverride: number
3428-
): Promise<TransactionInstruction> {
3429-
return await this.program.instruction.updatePerpMarketTakerSpeedBumpOverride(
3430-
takerSpeedBumpOverride,
3431-
{
3432-
accounts: {
3433-
admin: this.isSubscribed
3434-
? this.getStateAccount().admin
3435-
: this.wallet.publicKey,
3436-
state: await this.getStatePublicKey(),
3437-
perpMarket: await getPerpMarketPublicKey(
3438-
this.program.programId,
3439-
perpMarketIndex
3440-
),
3441-
},
3442-
}
3443-
);
3444-
}
3445-
3446-
public async updatePerpMarketAmmSpreadAdjustment(
3447-
perpMarketIndex: number,
3448-
ammSpreadAdjustment: number
3449-
): Promise<TransactionSignature> {
3450-
const updatePerpMarketAmmSpreadAdjustmentIx =
3451-
await this.getUpdatePerpMarketAmmSpreadAdjustmentIx(
3452-
perpMarketIndex,
3453-
ammSpreadAdjustment
3454-
);
3455-
3456-
const tx = await this.buildTransaction(
3457-
updatePerpMarketAmmSpreadAdjustmentIx
3458-
);
3459-
3460-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
3461-
3462-
return txSig;
3463-
}
3464-
3465-
public async getUpdatePerpMarketAmmSpreadAdjustmentIx(
3466-
perpMarketIndex: number,
3467-
ammSpreadAdjustment: number
3468-
): Promise<TransactionInstruction> {
3469-
return await this.program.instruction.updatePerpMarketAmmSpreadAdjustment(
3470-
ammSpreadAdjustment,
3471-
{
3472-
accounts: {
3473-
admin: this.useHotWalletAdmin
3474-
? this.wallet.publicKey
3475-
: this.getStateAccount().admin,
3476-
state: await this.getStatePublicKey(),
3477-
perpMarket: await getPerpMarketPublicKey(
3478-
this.program.programId,
3479-
perpMarketIndex
3480-
),
3481-
},
3482-
}
3483-
);
3484-
}
3485-
34863404
public async updateSpotMarketFeeAdjustment(
34873405
perpMarketIndex: number,
34883406
feeAdjustment: number
@@ -3941,39 +3859,34 @@ export class AdminClient extends DriftClient {
39413859
);
39423860
}
39433861

3944-
public async updatePerpMarketProtectedMakerParams(
3862+
public async updatePerpMarketTakerSpeedBumpOverride(
39453863
perpMarketIndex: number,
3946-
protectedMakerLimitPriceDivisor?: number,
3947-
protectedMakerDynamicDivisor?: number
3864+
takerSpeedBumpOverride: number
39483865
): Promise<TransactionSignature> {
3949-
const updatePerpMarketProtectedMakerParamsIx =
3950-
await this.getUpdatePerpMarketProtectedMakerParamsIx(
3866+
const updatePerpMarketTakerSpeedBumpOverrideIx =
3867+
await this.getUpdatePerpMarketTakerSpeedBumpOverrideIx(
39513868
perpMarketIndex,
3952-
protectedMakerLimitPriceDivisor || null,
3953-
protectedMakerDynamicDivisor || null
3869+
takerSpeedBumpOverride
39543870
);
3955-
39563871
const tx = await this.buildTransaction(
3957-
updatePerpMarketProtectedMakerParamsIx
3872+
updatePerpMarketTakerSpeedBumpOverrideIx
39583873
);
39593874
const { txSig } = await this.sendTransaction(tx, [], this.opts);
39603875

39613876
return txSig;
39623877
}
39633878

3964-
public async getUpdatePerpMarketProtectedMakerParamsIx(
3879+
public async getUpdatePerpMarketTakerSpeedBumpOverrideIx(
39653880
perpMarketIndex: number,
3966-
protectedMakerLimitPriceDivisor?: number,
3967-
protectedMakerDynamicDivisor?: number
3881+
takerSpeedBumpOverride: number
39683882
): Promise<TransactionInstruction> {
39693883
const perpMarketPublicKey = await getPerpMarketPublicKey(
39703884
this.program.programId,
39713885
perpMarketIndex
39723886
);
39733887

3974-
return await this.program.instruction.updatePerpMarketProtectedMakerParams(
3975-
protectedMakerLimitPriceDivisor || null,
3976-
protectedMakerDynamicDivisor || null,
3888+
return await this.program.instruction.updatePerpMarketTakerSpeedBumpOverride(
3889+
takerSpeedBumpOverride,
39773890
{
39783891
accounts: {
39793892
admin: this.isSubscribed
@@ -3986,67 +3899,89 @@ export class AdminClient extends DriftClient {
39863899
);
39873900
}
39883901

3989-
public async initializeIfRebalanceConfig(
3990-
params: IfRebalanceConfigParams
3902+
public async updatePerpMarketAmmSpreadAdjustment(
3903+
perpMarketIndex: number,
3904+
ammSpreadAdjustment: number
39913905
): Promise<TransactionSignature> {
3992-
const initializeIfRebalanceConfigIx =
3993-
await this.getInitializeIfRebalanceConfigIx(params);
3994-
3995-
const tx = await this.buildTransaction(initializeIfRebalanceConfigIx);
3906+
const updatePerpMarketAmmSpreadAdjustmentIx =
3907+
await this.getUpdatePerpMarketAmmSpreadAdjustmentIx(
3908+
perpMarketIndex,
3909+
ammSpreadAdjustment
3910+
);
3911+
const tx = await this.buildTransaction(
3912+
updatePerpMarketAmmSpreadAdjustmentIx
3913+
);
39963914
const { txSig } = await this.sendTransaction(tx, [], this.opts);
39973915

39983916
return txSig;
39993917
}
40003918

4001-
public async getInitializeIfRebalanceConfigIx(
4002-
params: IfRebalanceConfigParams
3919+
public async getUpdatePerpMarketAmmSpreadAdjustmentIx(
3920+
perpMarketIndex: number,
3921+
ammSpreadAdjustment: number
40033922
): Promise<TransactionInstruction> {
4004-
return await this.program.instruction.initializeIfRebalanceConfig(params, {
4005-
accounts: {
4006-
admin: this.isSubscribed
4007-
? this.getStateAccount().admin
4008-
: this.wallet.publicKey,
4009-
state: await this.getStatePublicKey(),
4010-
ifRebalanceConfig: await getIfRebalanceConfigPublicKey(
4011-
this.program.programId,
4012-
params.inMarketIndex,
4013-
params.outMarketIndex
4014-
),
4015-
rent: SYSVAR_RENT_PUBKEY,
4016-
systemProgram: anchor.web3.SystemProgram.programId,
4017-
},
4018-
});
3923+
const perpMarketPublicKey = await getPerpMarketPublicKey(
3924+
this.program.programId,
3925+
perpMarketIndex
3926+
);
3927+
3928+
return await this.program.instruction.updatePerpMarketAmmSpreadAdjustment(
3929+
ammSpreadAdjustment,
3930+
{
3931+
accounts: {
3932+
admin: this.isSubscribed
3933+
? this.getStateAccount().admin
3934+
: this.wallet.publicKey,
3935+
state: await this.getStatePublicKey(),
3936+
perpMarket: perpMarketPublicKey,
3937+
},
3938+
}
3939+
);
40193940
}
40203941

4021-
public async updateIfRebalanceConfig(
4022-
params: IfRebalanceConfigParams
3942+
public async updatePerpMarketProtectedMakerParams(
3943+
perpMarketIndex: number,
3944+
protectedMakerLimitPriceDivisor?: number,
3945+
protectedMakerDynamicDivisor?: number
40233946
): Promise<TransactionSignature> {
4024-
const updateIfRebalanceConfigIx = await this.getUpdateIfRebalanceConfigIx(
4025-
params
4026-
);
3947+
const updatePerpMarketProtectedMakerParamsIx =
3948+
await this.getUpdatePerpMarketProtectedMakerParamsIx(
3949+
perpMarketIndex,
3950+
protectedMakerLimitPriceDivisor || null,
3951+
protectedMakerDynamicDivisor || null
3952+
);
40273953

4028-
const tx = await this.buildTransaction(updateIfRebalanceConfigIx);
3954+
const tx = await this.buildTransaction(
3955+
updatePerpMarketProtectedMakerParamsIx
3956+
);
40293957
const { txSig } = await this.sendTransaction(tx, [], this.opts);
40303958

40313959
return txSig;
40323960
}
40333961

4034-
public async getUpdateIfRebalanceConfigIx(
4035-
params: IfRebalanceConfigParams
3962+
public async getUpdatePerpMarketProtectedMakerParamsIx(
3963+
perpMarketIndex: number,
3964+
protectedMakerLimitPriceDivisor?: number,
3965+
protectedMakerDynamicDivisor?: number
40363966
): Promise<TransactionInstruction> {
4037-
return await this.program.instruction.updateIfRebalanceConfig(params, {
4038-
accounts: {
4039-
admin: this.isSubscribed
4040-
? this.getStateAccount().admin
4041-
: this.wallet.publicKey,
4042-
state: await this.getStatePublicKey(),
4043-
ifRebalanceConfig: await getIfRebalanceConfigPublicKey(
4044-
this.program.programId,
4045-
params.inMarketIndex,
4046-
params.outMarketIndex
4047-
),
4048-
},
4049-
});
3967+
const perpMarketPublicKey = await getPerpMarketPublicKey(
3968+
this.program.programId,
3969+
perpMarketIndex
3970+
);
3971+
3972+
return await this.program.instruction.updatePerpMarketProtectedMakerParams(
3973+
protectedMakerLimitPriceDivisor || null,
3974+
protectedMakerDynamicDivisor || null,
3975+
{
3976+
accounts: {
3977+
admin: this.isSubscribed
3978+
? this.getStateAccount().admin
3979+
: this.wallet.publicKey,
3980+
state: await this.getStatePublicKey(),
3981+
perpMarket: perpMarketPublicKey,
3982+
},
3983+
}
3984+
);
40503985
}
40513986

40523987
public async initUserFuel(

0 commit comments

Comments
 (0)