Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config/ab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const abFlagsConfig = {
testMultichain: 1,
testSponsoredCall: 1,
testExampleAb: 0,
useOpenInterestInTokensForBalance: 0,
};

export type AbFlag = keyof typeof abFlagsConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useMemo } from "react";

import { getContract } from "config/contracts";
import { getIsFlagEnabled } from "config/ab";

Check warning on line 4 in src/domain/synthetics/markets/useMarketsInfoRequest/useMarketsConstantsRequest.ts

View workflow job for this annotation

GitHub Actions / Run Tests

`config/ab` import should occur before import of `config/contracts`

Check warning on line 4 in src/domain/synthetics/markets/useMarketsInfoRequest/useMarketsConstantsRequest.ts

View workflow job for this annotation

GitHub Actions / Run Tests

`config/ab` import should occur before import of `config/contracts`

Check warning on line 4 in src/domain/synthetics/markets/useMarketsInfoRequest/useMarketsConstantsRequest.ts

View workflow job for this annotation

GitHub Actions / Run Tests

`config/ab` import should occur before import of `config/contracts`

Check warning on line 4 in src/domain/synthetics/markets/useMarketsInfoRequest/useMarketsConstantsRequest.ts

View workflow job for this annotation

GitHub Actions / Run Tests

`config/ab` import should occur before import of `config/contracts`
import { USE_OPEN_INTEREST_IN_TOKENS_FOR_BALANCE } from "config/dataStore";
import { useMulticall } from "lib/multicall";
import { CONFIG_UPDATE_INTERVAL } from "lib/timeConstants";
Expand All @@ -16,6 +17,8 @@
};

export function useMarketsConstantsRequest(chainId: ContractsChainId): MarketsConstantsResult {
const isAbFlagEnabled = getIsFlagEnabled("useOpenInterestInTokensForBalance");

const { data, error } = useMulticall(chainId, "useMarketsConstants", {
key: [],

Expand All @@ -34,17 +37,22 @@
},
},
parseResponse: (res) => {
const onChainValue = res.data.dataStore.useOpenInterestInTokensForBalance.returnValues[0];
return {
useOpenInterestInTokensForBalance: res.data.dataStore.useOpenInterestInTokensForBalance.returnValues[0],
useOpenInterestInTokensForBalance: onChainValue,
};
},
});

return useMemo(
() => ({
data: data || undefined,
data: data
? {
useOpenInterestInTokensForBalance: isAbFlagEnabled ? true : data.useOpenInterestInTokensForBalance,
}
: undefined,
error,
}),
[data, error]
[data, error, isAbFlagEnabled]
);
}
Loading