Skip to content

Commit

Permalink
Upstream type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed Jan 6, 2025
1 parent c1f447d commit 8f18a7a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
10 changes: 4 additions & 6 deletions app/scripts/controllers/swaps/swaps.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ export type SwapsControllerState = {
swapsStxGetTransactionsRefreshTime: number;
swapsStxMaxFeeMultiplier: number;
swapsFeatureFlags:
| ({
smartTransactions?: Partial<FeatureFlags>;
} & {
[networkName: string]: { smartTransactions?: Partial<FeatureFlags> };
})
| Record<string, boolean>;
| Partial<FeatureFlags>
| {
[networkName: string]: Partial<FeatureFlags>;
};
};
};

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/lib/ppom/ppom-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function createPPOMMiddleware<

const { chainId } =
getProviderConfig({
metamask: networkController.state,
metamask: { NetworkController: networkController.state },
}) ?? {};
if (!chainId) {
return;
Expand Down
4 changes: 2 additions & 2 deletions shared/constants/multichain/assets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CaipAssetType } from '@metamask/keyring-api';
import { MultichainNetworks } from './networks';
import { MultichainNetworkIds, MultichainNetworks } from './networks';

export const MULTICHAIN_NATIVE_CURRENCY_TO_CAIP19 = {
BTC: `${MultichainNetworks.BITCOIN}/slip44:0`,
Expand All @@ -20,7 +20,7 @@ export enum MultichainNativeAssets {
* Each network is mapped to an array containing its native asset for consistency.
*/
export const MULTICHAIN_NETWORK_TO_ASSET_TYPES: Record<
MultichainNetworks,
MultichainNetworkIds,
CaipAssetType[]
> = {
[MultichainNetworks.SOLANA]: [MultichainNativeAssets.SOLANA],
Expand Down
4 changes: 1 addition & 3 deletions shared/modules/selectors/smart-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const getSmartTransactionsOptInStatusInternal = createSelector(
* @returns true if the user has explicitly opted in, false if they have opted out,
* or null if they have not explicitly opted in or out.
*/
// @ts-expect-error TODO: Fix types for `getSmartTransactionsOptInStatusInternal` once `getPreferences is converted to TypeScript
export const getSmartTransactionsOptInStatusForMetrics = createSelector(
getSmartTransactionsOptInStatusInternal,
(optInStatus: boolean): boolean => optInStatus,
Expand All @@ -60,7 +59,6 @@ export const getSmartTransactionsOptInStatusForMetrics = createSelector(
* @param state
* @returns
*/
// @ts-expect-error TODO: Fix types for `getSmartTransactionsOptInStatusInternal` once `getPreferences is converted to TypeScript
export const getSmartTransactionsPreferenceEnabled = createSelector(
getSmartTransactionsOptInStatusInternal,
(optInStatus: boolean): boolean => {
Expand Down Expand Up @@ -100,7 +98,7 @@ export const getSmartTransactionsEnabled = (
// TODO: Create a new proxy service only for MM feature flags.
const smartTransactionsFeatureFlagEnabled =
state.metamask.SwapsController.swapsState?.swapsFeatureFlags
?.smartTransactions?.extensionActive;
?.extensionActive;
const smartTransactionsLiveness =
state.metamask.SmartTransactionsController.smartTransactionsState?.liveness;
return Boolean(
Expand Down
6 changes: 6 additions & 0 deletions ui/helpers/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ export function shortenAddress(address = '') {
});
}

/**
*
* @param {(import('@metamask/keyring-internal-api').InternalAccount | import('../../selectors/selectors.types').InternalAccountWithBalance)[]} accounts - The internal accounts list.
* @param {string} targetAddress
* @returns {import('@metamask/keyring-internal-api').InternalAccount | import('../../selectors/selectors.types').InternalAccountWithBalance | undefined}
*/
export function getAccountByAddress(accounts = [], targetAddress) {
return accounts.find(({ address }) => address === targetAddress);
}
Expand Down
4 changes: 2 additions & 2 deletions ui/pages/bridge/utils/quote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const calcTotalGasFee = ({
bridgeQuote: QuoteResponse & L1GasFees;
feePerGasInDecGwei: string;
priorityFeePerGasInDecGwei: string;
nativeExchangeRate?: number;
nativeExchangeRate?: number | null;
}) => {
const { approval, trade, l1GasFeesInHexWei } = bridgeQuote;

Expand Down Expand Up @@ -139,7 +139,7 @@ export const calcEstimatedAndMaxTotalGasFee = ({
estimatedBaseFeeInDecGwei: string;
maxFeePerGasInDecGwei: string;
maxPriorityFeePerGasInDecGwei: string;
nativeExchangeRate?: number;
nativeExchangeRate?: number | null;
}) => {
const { amount, valueInCurrency } = calcTotalGasFee({
bridgeQuote,
Expand Down

0 comments on commit 8f18a7a

Please sign in to comment.