Skip to content

Commit 61f8f4f

Browse files
committed
add feature flag sdk fn
1 parent 47887d2 commit 61f8f4f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

sdk/src/math/state.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,11 @@ export function useMedianTriggerPrice(stateAccount: StateAccount): boolean {
3838
(stateAccount.featureBitFlags & FeatureBitFlags.MEDIAN_TRIGGER_PRICE) > 0
3939
);
4040
}
41+
42+
export function builderCodesEnabled(stateAccount: StateAccount): boolean {
43+
return (stateAccount.featureBitFlags & FeatureBitFlags.BUILDER_CODES) > 0;
44+
}
45+
46+
export function builderReferralEnabled(stateAccount: StateAccount): boolean {
47+
return (stateAccount.featureBitFlags & FeatureBitFlags.BUILDER_REFERRAL) > 0;
48+
}

sdk/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export enum ExchangeStatus {
3131
export enum FeatureBitFlags {
3232
MM_ORACLE_UPDATE = 1,
3333
MEDIAN_TRIGGER_PRICE = 2,
34+
BUILDER_CODES = 4,
35+
BUILDER_REFERRAL = 8,
3436
}
3537

3638
export class MarketStatus {

tests/builderCodes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ describe('builder codes', () => {
778778
'should throw error when revoking builder with open orders'
779779
);
780780
} catch (e) {
781-
assert(e.message.includes('0x18b3'));
781+
assert(e.message.includes('0x18b3')); // CannotRevokeBuilderWithOpenOrders
782782
}
783783

784784
userOrders = userClient.getUser().getOpenOrders();

0 commit comments

Comments
 (0)