Skip to content

Commit 9d7e7a0

Browse files
committed
delete unused errors
1 parent f3bd586 commit 9d7e7a0

File tree

5 files changed

+96
-98
lines changed

5 files changed

+96
-98
lines changed

programs/drift/src/error.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,6 @@ pub enum ErrorCode {
658658
InvalidConstituent,
659659
#[msg("Invalid Amm Constituent Mapping argument")]
660660
InvalidAmmConstituentMappingArgument,
661-
#[msg("Invalid update constituent update target weights argument")]
662-
InvalidUpdateConstituentTargetBaseArgument,
663661
#[msg("Constituent not found")]
664662
ConstituentNotFound,
665663
#[msg("Constituent could not load")]
@@ -668,8 +666,6 @@ pub enum ErrorCode {
668666
ConstituentWrongMutability,
669667
#[msg("Wrong number of constituents passed to instruction")]
670668
WrongNumberOfConstituents,
671-
#[msg("Oracle too stale for LP AUM update")]
672-
OracleTooStaleForLPAUMUpdate,
673669
#[msg("Insufficient constituent token balance")]
674670
InsufficientConstituentTokenBalance,
675671
#[msg("Amm Cache data too stale")]
@@ -682,8 +678,6 @@ pub enum ErrorCode {
682678
LpInvariantFailed,
683679
#[msg("Invalid constituent derivative weights")]
684680
InvalidConstituentDerivativeWeights,
685-
#[msg("Unauthorized dlp authority")]
686-
UnauthorizedDlpAuthority,
687681
#[msg("Max DLP AUM Breached")]
688682
MaxDlpAumBreached,
689683
#[msg("Settle Lp Pool Disabled")]

sdk/src/driftClient.ts

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ export class DriftClient {
362362
this.authoritySubAccountMap = config.authoritySubAccountMap
363363
? config.authoritySubAccountMap
364364
: config.subAccountIds
365-
? new Map([[this.authority.toString(), config.subAccountIds]])
366-
: new Map<string, number[]>();
365+
? new Map([[this.authority.toString(), config.subAccountIds]])
366+
: new Map<string, number[]>();
367367

368368
this.includeDelegates = config.includeDelegates ?? false;
369369
if (config.accountSubscription?.type === 'polling') {
@@ -848,8 +848,8 @@ export class DriftClient {
848848
this.authoritySubAccountMap = authoritySubaccountMap
849849
? authoritySubaccountMap
850850
: subAccountIds
851-
? new Map([[this.authority.toString(), subAccountIds]])
852-
: new Map<string, number[]>();
851+
? new Map([[this.authority.toString(), subAccountIds]])
852+
: new Map<string, number[]>();
853853

854854
/* Reset user stats account */
855855
if (this.userStats?.isSubscribed) {
@@ -1001,7 +1001,7 @@ export class DriftClient {
10011001
[...this.authoritySubAccountMap.values()][0][0] ?? 0,
10021002
new PublicKey(
10031003
[...this.authoritySubAccountMap.keys()][0] ??
1004-
this.authority.toString()
1004+
this.authority.toString()
10051005
)
10061006
);
10071007
}
@@ -3311,19 +3311,19 @@ export class DriftClient {
33113311

33123312
const depositCollateralIx = isFromSubaccount
33133313
? await this.getTransferDepositIx(
3314-
amount,
3315-
marketIndex,
3316-
fromSubAccountId,
3317-
subAccountId
3318-
)
3314+
amount,
3315+
marketIndex,
3316+
fromSubAccountId,
3317+
subAccountId
3318+
)
33193319
: await this.getDepositInstruction(
3320-
amount,
3321-
marketIndex,
3322-
userTokenAccount,
3323-
subAccountId,
3324-
false,
3325-
false
3326-
);
3320+
amount,
3321+
marketIndex,
3322+
userTokenAccount,
3323+
subAccountId,
3324+
false,
3325+
false
3326+
);
33273327

33283328
if (subAccountId === 0) {
33293329
if (
@@ -4363,14 +4363,14 @@ export class DriftClient {
43634363

43644364
const marketOrderTxIxs = positionMaxLev
43654365
? this.getPlaceOrdersAndSetPositionMaxLevIx(
4366-
[orderParams, ...bracketOrdersParams],
4367-
positionMaxLev,
4368-
userAccount.subAccountId
4369-
)
4366+
[orderParams, ...bracketOrdersParams],
4367+
positionMaxLev,
4368+
userAccount.subAccountId
4369+
)
43704370
: this.getPlaceOrdersIx(
4371-
[orderParams, ...bracketOrdersParams],
4372-
userAccount.subAccountId
4373-
);
4371+
[orderParams, ...bracketOrdersParams],
4372+
userAccount.subAccountId
4373+
);
43744374

43754375
ixPromisesForTxs.marketOrderTx = marketOrderTxIxs;
43764376

@@ -4518,10 +4518,10 @@ export class DriftClient {
45184518

45194519
const user = isDepositToTradeTx
45204520
? getUserAccountPublicKeySync(
4521-
this.program.programId,
4522-
this.authority,
4523-
subAccountId
4524-
)
4521+
this.program.programId,
4522+
this.authority,
4523+
subAccountId
4524+
)
45254525
: await this.getUserAccountPublicKey(subAccountId);
45264526

45274527
const remainingAccounts = this.getRemainingAccounts({
@@ -5158,14 +5158,14 @@ export class DriftClient {
51585158
const marketIndex = order
51595159
? order.marketIndex
51605160
: userAccount.orders.find(
5161-
(order) => order.orderId === userAccount.nextOrderId - 1
5162-
).marketIndex;
5161+
(order) => order.orderId === userAccount.nextOrderId - 1
5162+
).marketIndex;
51635163

51645164
makerInfo = Array.isArray(makerInfo)
51655165
? makerInfo
51665166
: makerInfo
5167-
? [makerInfo]
5168-
: [];
5167+
? [makerInfo]
5168+
: [];
51695169

51705170
const userAccounts = [userAccount];
51715171
for (const maker of makerInfo) {
@@ -5381,14 +5381,14 @@ export class DriftClient {
53815381
const marketIndex = order
53825382
? order.marketIndex
53835383
: userAccount.orders.find(
5384-
(order) => order.orderId === userAccount.nextOrderId - 1
5385-
).marketIndex;
5384+
(order) => order.orderId === userAccount.nextOrderId - 1
5385+
).marketIndex;
53865386

53875387
makerInfo = Array.isArray(makerInfo)
53885388
? makerInfo
53895389
: makerInfo
5390-
? [makerInfo]
5391-
: [];
5390+
? [makerInfo]
5391+
: [];
53925392

53935393
const userAccounts = [userAccount];
53945394
for (const maker of makerInfo) {
@@ -6727,8 +6727,8 @@ export class DriftClient {
67276727
makerInfo = Array.isArray(makerInfo)
67286728
? makerInfo
67296729
: makerInfo
6730-
? [makerInfo]
6731-
: [];
6730+
? [makerInfo]
6731+
: [];
67326732

67336733
const userAccounts = [this.getUserAccount(subAccountId)];
67346734
for (const maker of makerInfo) {
@@ -6974,13 +6974,13 @@ export class DriftClient {
69746974
prefix,
69756975
delegateSigner
69766976
? this.program.coder.types.encode(
6977-
'SignedMsgOrderParamsDelegateMessage',
6978-
withBuilderDefaults as SignedMsgOrderParamsDelegateMessage
6979-
)
6977+
'SignedMsgOrderParamsDelegateMessage',
6978+
withBuilderDefaults as SignedMsgOrderParamsDelegateMessage
6979+
)
69806980
: this.program.coder.types.encode(
6981-
'SignedMsgOrderParamsMessage',
6982-
withBuilderDefaults as SignedMsgOrderParamsMessage
6983-
),
6981+
'SignedMsgOrderParamsMessage',
6982+
withBuilderDefaults as SignedMsgOrderParamsMessage
6983+
),
69846984
]);
69856985
return buf;
69866986
}
@@ -10699,8 +10699,8 @@ export class DriftClient {
1069910699
): Promise<TransactionInstruction> {
1070010700
const remainingAccounts = userAccount
1070110701
? this.getRemainingAccounts({
10702-
userAccounts: [userAccount],
10703-
})
10702+
userAccounts: [userAccount],
10703+
})
1070410704
: undefined;
1070510705

1070610706
const ix = await this.program.instruction.disableUserHighLeverageMode(

sdk/src/driftClientConfig.ts

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -58,45 +58,45 @@ export type DriftClientConfig = {
5858

5959
export type DriftClientSubscriptionConfig =
6060
| {
61-
type: 'grpc';
62-
grpcConfigs: GrpcConfigs;
63-
resubTimeoutMs?: number;
64-
logResubMessages?: boolean;
65-
driftClientAccountSubscriber?: new (
66-
grpcConfigs: GrpcConfigs,
67-
program: Program,
68-
perpMarketIndexes: number[],
69-
spotMarketIndexes: number[],
70-
oracleInfos: OracleInfo[],
71-
shouldFindAllMarketsAndOracles: boolean,
72-
delistedMarketSetting: DelistedMarketSetting
73-
) =>
74-
| grpcDriftClientAccountSubscriberV2
75-
| grpcDriftClientAccountSubscriber;
76-
}
61+
type: 'grpc';
62+
grpcConfigs: GrpcConfigs;
63+
resubTimeoutMs?: number;
64+
logResubMessages?: boolean;
65+
driftClientAccountSubscriber?: new (
66+
grpcConfigs: GrpcConfigs,
67+
program: Program,
68+
perpMarketIndexes: number[],
69+
spotMarketIndexes: number[],
70+
oracleInfos: OracleInfo[],
71+
shouldFindAllMarketsAndOracles: boolean,
72+
delistedMarketSetting: DelistedMarketSetting
73+
) =>
74+
| grpcDriftClientAccountSubscriberV2
75+
| grpcDriftClientAccountSubscriber;
76+
}
7777
| {
78-
type: 'websocket';
79-
resubTimeoutMs?: number;
80-
logResubMessages?: boolean;
81-
commitment?: Commitment;
82-
perpMarketAccountSubscriber?: new (
83-
accountName: string,
84-
program: Program,
85-
accountPublicKey: PublicKey,
86-
decodeBuffer?: (buffer: Buffer) => any,
87-
resubOpts?: ResubOpts,
88-
commitment?: Commitment
89-
) => WebSocketAccountSubscriberV2<any> | WebSocketAccountSubscriber<any>;
90-
oracleAccountSubscriber?: new (
91-
accountName: string,
92-
program: Program,
93-
accountPublicKey: PublicKey,
94-
decodeBuffer?: (buffer: Buffer) => any,
95-
resubOpts?: ResubOpts,
96-
commitment?: Commitment
97-
) => WebSocketAccountSubscriberV2<any> | WebSocketAccountSubscriber<any>;
98-
}
78+
type: 'websocket';
79+
resubTimeoutMs?: number;
80+
logResubMessages?: boolean;
81+
commitment?: Commitment;
82+
perpMarketAccountSubscriber?: new (
83+
accountName: string,
84+
program: Program,
85+
accountPublicKey: PublicKey,
86+
decodeBuffer?: (buffer: Buffer) => any,
87+
resubOpts?: ResubOpts,
88+
commitment?: Commitment
89+
) => WebSocketAccountSubscriberV2<any> | WebSocketAccountSubscriber<any>;
90+
oracleAccountSubscriber?: new (
91+
accountName: string,
92+
program: Program,
93+
accountPublicKey: PublicKey,
94+
decodeBuffer?: (buffer: Buffer) => any,
95+
resubOpts?: ResubOpts,
96+
commitment?: Commitment
97+
) => WebSocketAccountSubscriberV2<any> | WebSocketAccountSubscriber<any>;
98+
}
9999
| {
100-
type: 'polling';
101-
accountLoader: BulkAccountLoader;
102-
};
100+
type: 'polling';
101+
accountLoader: BulkAccountLoader;
102+
};

tests/lpPool.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,8 @@ describe('LP Pool', () => {
614614
});
615615
expect.fail('should have failed');
616616
} catch (e) {
617-
assert(e.message.includes('0x18bf')); // LpPoolAumDelayed
617+
console.log(e.message);
618+
assert(e.message.includes('0x18bd')); // LpPoolAumDelayed
618619
}
619620
});
620621

@@ -640,7 +641,7 @@ describe('LP Pool', () => {
640641
await adminClient.sendTransaction(tx);
641642
} catch (e) {
642643
console.log(e.message);
643-
assert(e.message.includes('0x18c8')); // InvalidConstituentOperation
644+
assert(e.message.includes('0x18c5')); // InvalidConstituentOperation
644645
}
645646
await adminClient.updateConstituentPausedOperations(
646647
getConstituentPublicKey(program.programId, lpPoolKey, 0),
@@ -699,7 +700,8 @@ describe('LP Pool', () => {
699700
await adminClient.updateLpPoolAum(lpPool, [0]);
700701
expect.fail('should have failed');
701702
} catch (e) {
702-
assert(e.message.includes('0x18bb')); // WrongNumberOfConstituents
703+
console.log(e.message);
704+
assert(e.message.includes('0x18ba')); // WrongNumberOfConstituents
703705
}
704706
});
705707

@@ -1584,7 +1586,7 @@ describe('LP Pool', () => {
15841586
);
15851587
} catch (e) {
15861588
console.log(e);
1587-
assert(e.toString().includes('0x18c1')); // invariant failed
1589+
assert(e.toString().includes('0x18bf')); // invariant failed
15881590
}
15891591
});
15901592

@@ -1595,7 +1597,8 @@ describe('LP Pool', () => {
15951597
await adminClient.settlePerpToLpPool(encodeName(lpPoolName), [0, 1, 2]);
15961598
assert(false, 'Should have thrown');
15971599
} catch (e) {
1598-
assert(e.message.includes('0x18c5')); // SettleLpPoolDisabled
1600+
console.log(e.message);
1601+
assert(e.message.includes('0x18c2')); // SettleLpPoolDisabled
15991602
}
16001603

16011604
await adminClient.updateFeatureBitFlagsSettleLpPool(true);

tests/lpPoolSwap.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,8 @@ describe('LP Pool', () => {
589589
try {
590590
await adminClient.sendTransaction(tx);
591591
} catch (e) {
592-
assert(e.message.includes('0x18c8')); // InvalidConstituentOperation
592+
console.log(e.message);
593+
assert(e.message.includes('0x18c5')); // InvalidConstituentOperation
593594
}
594595
await adminClient.updateConstituentStatus(
595596
c0.pubkey,

0 commit comments

Comments
 (0)