Skip to content

Commit

Permalink
use statsig flag instead
Browse files Browse the repository at this point in the history
  • Loading branch information
aforaleka committed Oct 14, 2024
1 parent 2713d3f commit 6bc91b8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@cosmjs/stargate": "^0.32.1",
"@cosmjs/tendermint-rpc": "^0.32.1",
"@datadog/browser-logs": "^5.23.3",
"@dydxprotocol/v4-abacus": "1.12.21",
"@dydxprotocol/v4-abacus": "file:../v4-abacus/build/packages/dydxprotocol-v4-abacus-1.12.22.tgz",
"@dydxprotocol/v4-client-js": "1.10.0",
"@dydxprotocol/v4-localization": "^1.1.216",
"@dydxprotocol/v4-proto": "^7.0.0-dev.0",
Expand Down
20 changes: 11 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/constants/statsig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum StatsigFlags {
ffEnableAffiliates = 'ff_enable_affiliates',
ffLimitOrdersFromChart = 'ff_limit_orders_from_chart',
ffEnableLimitClose = 'ff_enable_limit_close',
ffEnableTimestampNonce = 'ff_enable_timestamp_nonce',
}

export type StatsigDynamicConfigType = Record<StatsigDynamicConfigs, any>;
Expand Down
6 changes: 5 additions & 1 deletion src/hooks/useDydxClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { DEFAULT_TRANSACTION_MEMO } from '@/constants/analytics';
import { RESOLUTION_MAP, type Candle } from '@/constants/candles';
import { LocalStorageKey } from '@/constants/localStorage';
import { isDev } from '@/constants/networks';
import { StatsigFlags } from '@/constants/statsig';

import { getSelectedNetwork } from '@/state/appSelectors';
import { useAppSelector } from '@/state/appTypes';
Expand All @@ -32,6 +33,7 @@ import { log } from '@/lib/telemetry';
import { useEndpointsConfig } from './useEndpointsConfig';
import { useLocalStorage } from './useLocalStorage';
import { useRestrictions } from './useRestrictions';
import { useStatsigGateValue } from './useStatsig';
import { useTokenConfigs } from './useTokenConfigs';

type DydxContextType = ReturnType<typeof useDydxClientContext>;
Expand Down Expand Up @@ -72,6 +74,8 @@ const useDydxClientContext = () => {
return new IndexerClient(config);
}, [indexerEndpoints]);

const enableTimestampNonce = useStatsigGateValue(StatsigFlags.ffEnableTimestampNonce);

useEffect(() => {
(async () => {
if (
Expand Down Expand Up @@ -100,7 +104,7 @@ const useDydxClientContext = () => {
broadcastTimeoutMs: 60_000,
},
DEFAULT_TRANSACTION_MEMO,
true // TODO(@aforaleka): default this to true in v4-clients once verified working
enableTimestampNonce
)
)
);
Expand Down
5 changes: 4 additions & 1 deletion src/lib/abacus/dydxChainTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
USDC_GAS_DENOM,
CHAINTOKEN_DENOM,
CHAINTOKEN_DECIMALS,
enableTimestampNonce,
} = parsedParams;

console.log({ enableTimestampNonce });

const compositeClient = await CompositeClient.connect(
new Network(
chainId,
Expand All @@ -143,7 +146,7 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
broadcastTimeoutMs: 60_000,
},
DEFAULT_TRANSACTION_MEMO,
true // TODO(@aforaleka): default this to true in v4-clients once verified working
enableTimestampNonce
)
)
);
Expand Down

0 comments on commit 6bc91b8

Please sign in to comment.