Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo committed Oct 21, 2024
1 parent 66417d4 commit d188b87
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/markets/add-markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ async function main(): Promise<void> {
// Get which env and how many markets to add.
const args = process.argv.slice(2);
const env = args[0] as Env;
const numMarkets = parseInt(args[1]!, 10);
const numMarkets = args[1] != null ? parseInt(args[1], 10) : 0;
const binary = args[2];

// Validate inputs.
Expand Down
2 changes: 1 addition & 1 deletion scripts/markets/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export async function createAndSendMarketMapProposal(
name: config.exchangeName,
normalize_by_pair,
off_chain_ticker: config.ticker,
invert: config.invert || false,
invert: !!config.invert,
metadata_JSON: config.metadata_JSON ?? '',
};
});
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/tradingView/useChartMarketAndResolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const useChartMarketAndResolution = ({
// Different resolutions have different timeframes to display data efficiently.
const defaultRange: number | undefined = isViewingUnlaunchedMarket
? LAUNCHABLE_MARKET_RESOLUTION_CONFIGS[resolution]?.defaultRange
: RESOLUTION_CHART_CONFIGS[resolution]!.defaultRange;
: RESOLUTION_CHART_CONFIGS[resolution]?.defaultRange;

if (defaultRange) {
const to = Date.now() / 1000;
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/transfers/skipClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const useSkipClientContext = () => {
return compositeClient?.network.validatorConfig.restEndpoint ?? validators[0]!;
if (chainId === getSolanaChainId()) return solanaRpcUrl;
const evmRpcUrls = RPCUrlsByChainId[chainId];
if (evmRpcUrls) return evmRpcUrls[0]!;
if (evmRpcUrls?.length) return evmRpcUrls[0]!;
throw new Error(`Error: no rpc endpoint found for chainId: ${chainId}`);
},
},
Expand Down
4 changes: 3 additions & 1 deletion src/lib/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ import { SingleSessionAbacusNotificationTypes } from '@/constants/notifications'

export const isAbacusNotificationSingleSession = (notificationId: string) => {
const notificationType = notificationId.split(':')[0];
return SingleSessionAbacusNotificationTypes.includes(notificationType!);
return (
notificationType != null && SingleSessionAbacusNotificationTypes.includes(notificationType!)
);
};
1 change: 0 additions & 1 deletion src/lib/orderModification.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Abacus, { Nullable } from '@dydxprotocol/v4-abacus';
import { OrderExecution } from '@dydxprotocol/v4-client-js';
// ts-ignore
import { generateRandomClientId } from '@dydxprotocol/v4-client-js/build/src/lib/utils';
import { ERRORS_STRING_KEYS } from '@dydxprotocol/v4-localization';

Expand Down
4 changes: 3 additions & 1 deletion src/lib/skip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export const fetchSkipStatus = async ({ transactionHash, chainId, baseUrl }: Ski
};

const getTransferFromStatusResponse = (skipStatusResponse: TxStatusResponseJSON) => {
// todo - are we sure this is always present?
if (!skipStatusResponse.transfers.length) {
throw new Error('Skip status response was empty.');
}
return skipStatusResponse.transfers[0]!;
};

Expand Down

0 comments on commit d188b87

Please sign in to comment.