Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
chloezxyy committed Sep 5, 2023
1 parent 6098957 commit 65b4f8e
Show file tree
Hide file tree
Showing 29 changed files with 140 additions and 138 deletions.
3 changes: 2 additions & 1 deletion packages/walletkit-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"build": "tsc -b ./tsconfig.build.json",
"test": "jest --maxWorkers=100%",
"lint": "eslint .",
"clean": "rm -rf dist"
"clean": "rm -rf dist",
"format": "prettier --write ."
},
"jest": {
"preset": "@stickyjs/jest",
Expand Down
8 changes: 4 additions & 4 deletions packages/walletkit-ui/src/contexts/DeFiScanContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ function getNetworkParams(network: EnvironmentNetwork): string {
export function getURLByNetwork(
path: string,
network: EnvironmentNetwork,
id: number | string,
id: number | string
): string {
return `${baseDefiScanUrl}/${path}/${id}${getNetworkParams(network)}`;
}

export function getTxURLByNetwork(
network: EnvironmentNetwork,
txid: string,
rawtx?: string,
rawtx?: string
): string {
let baseUrl = `${baseDefiScanUrl}/transactions/${txid}`;

Expand All @@ -68,7 +68,7 @@ export function getTxURLByNetwork(
}

export function DeFiScanProvider(
props: React.PropsWithChildren<any>,
props: React.PropsWithChildren<any>
): JSX.Element | null {

Check warning on line 72 in packages/walletkit-ui/src/contexts/DeFiScanContext.tsx

View workflow job for this annotation

GitHub Actions / Lint (eslint)

'JSX' is not defined
const { network } = useNetworkContext();
const { children } = props;
Expand All @@ -90,7 +90,7 @@ export function DeFiScanProvider(
getBlocksCountdownUrl: (blockCount: number) =>
getURLByNetwork("blocks/countdown", network, blockCount),
}),
[network],
[network]
);

return (
Expand Down
6 changes: 3 additions & 3 deletions packages/walletkit-ui/src/contexts/DisplayBalanceContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface DisplayBalancesProps {
}

const DisplayBalancesContext = createContext<DisplayBalancesProps>(
undefined as any,
undefined as any
);

/**
Expand All @@ -35,14 +35,14 @@ interface DisplayBalancesProviderProps {
}

export function DisplayBalancesProvider(
props: React.PropsWithChildren<DisplayBalancesProviderProps>,
props: React.PropsWithChildren<DisplayBalancesProviderProps>
): JSX.Element | null {

Check warning on line 39 in packages/walletkit-ui/src/contexts/DisplayBalanceContext.tsx

View workflow job for this annotation

GitHub Actions / Lint (eslint)

'JSX' is not defined
const { logger, DisplayBalancesPersistence, children } = props;
const [isBalancesDisplayed, setIsBalancesDisplayed] = useState<boolean>(true);
const toggleDisplayBalances = async (): Promise<void> => {
setIsBalancesDisplayed(!isBalancesDisplayed);
await DisplayBalancesPersistence.set(!isBalancesDisplayed).catch((err) =>
logger.error(err),
logger.error(err)
);
};

Expand Down
8 changes: 4 additions & 4 deletions packages/walletkit-ui/src/contexts/LanguageProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("useLanguage hook test", () => {
locale: desiredLanguage,
logger,
onChangeLocale,
}),
})
);
await waitForNextUpdate();
expect(result.current.language).toBe(desiredLanguage);
Expand All @@ -44,7 +44,7 @@ describe("useLanguage hook test", () => {
get: async () => desiredLanguage,
};
const { result, waitForNextUpdate } = renderHook(() =>
useLanguage({ api, locale: "en", logger, onChangeLocale }),
useLanguage({ api, locale: "en", logger, onChangeLocale })
);
await waitForNextUpdate();
expect(result.current.language).toBe(desiredLanguage);
Expand All @@ -57,7 +57,7 @@ describe("useLanguage hook test", () => {
get: async () => null,
};
const { result, waitForNextUpdate } = renderHook(() =>
useLanguage({ api, logger, onChangeLocale }),
useLanguage({ api, logger, onChangeLocale })
);
await waitForNextUpdate();
expect(result.current.language).toBe("en");
Expand Down Expand Up @@ -86,7 +86,7 @@ describe("LanguageProvider Context test", () => {
logger={logger}
>
<ThemeProviderComponent />
</LanguageProvider>,
</LanguageProvider>
);
expect(rendered).toMatchSnapshot();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/walletkit-ui/src/contexts/LanguageProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function useLanguageContext(): Language {
}

export function LanguageProvider(
props: LanguageContextI & PropsWithChildren<any>,
props: LanguageContextI & PropsWithChildren<any>
): JSX.Element | null {

Check warning on line 87 in packages/walletkit-ui/src/contexts/LanguageProvider.tsx

View workflow job for this annotation

GitHub Actions / Lint (eslint)

'JSX' is not defined
const { api, children, locale, logger, onChangeLocale } = props;
const { language } = useLanguage({ api, locale, logger, onChangeLocale });
Expand Down
2 changes: 1 addition & 1 deletion packages/walletkit-ui/src/contexts/NetworkContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface NetworkProviderProps extends PropsWithChildren<{}> {
}

export function NetworkProvider(
props: NetworkProviderProps,
props: NetworkProviderProps
): JSX.Element | null {

Check warning on line 38 in packages/walletkit-ui/src/contexts/NetworkContext.tsx

View workflow job for this annotation

GitHub Actions / Lint (eslint)

'JSX' is not defined
const [network, setNetwork] = useState<EnvironmentNetwork>();
const [networkName, setNetworkName] = useState<NetworkName>();
Expand Down
4 changes: 2 additions & 2 deletions packages/walletkit-ui/src/contexts/PlaygroundContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface PlaygroundContextI {
}

const PlaygroundContext = createContext<PlaygroundContextI | undefined>(
undefined,
undefined
);

export function usePlaygroundContext(): PlaygroundContextI {
Expand All @@ -27,7 +27,7 @@ export function usePlaygroundContext(): PlaygroundContextI {
}

export function PlaygroundProvider(
props: React.PropsWithChildren<any>,
props: React.PropsWithChildren<any>
): JSX.Element | null {
const { children } = props;
const { network } = useNetworkContext();
Expand Down
4 changes: 2 additions & 2 deletions packages/walletkit-ui/src/contexts/StatsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function StatsProvider(props: StatsProviderProps): JSX.Element | null {
lastSync: new Date().toString(),
lastSuccessfulSync: new Date().toString(),
tvl: tvl?.dex ?? 0,
}),
})
);
dispatch(block.actions.setConnected(true));
})
Expand All @@ -50,7 +50,7 @@ export function StatsProvider(props: StatsProviderProps): JSX.Element | null {
count: 0,
masternodeCount: 0,
lastSync: new Date().toString(),
}),
})
);
dispatch(block.actions.setConnected(false));
logger.error(err);
Expand Down
2 changes: 1 addition & 1 deletion packages/walletkit-ui/src/contexts/StoreProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface IStoreProvider {
}

export function StoreProvider(
props: PropsWithChildren<IStoreProvider>,
props: PropsWithChildren<IStoreProvider>
): JSX.Element {
const { children, initializeStore } = props;
const { wallets } = useWalletPersistenceContext();
Expand Down
6 changes: 3 additions & 3 deletions packages/walletkit-ui/src/contexts/StoreServiceProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ interface ServiceProviderContextI {
}

const ServiceProviderContext = createContext<ServiceProviderContextI>(
undefined as any,
undefined as any
);

export function useServiceProviderContext(): ServiceProviderContextI {
return useContext(ServiceProviderContext);
}

export function StoreServiceProvider(
props: ServiceProviderContextProps & PropsWithChildren<any>,
props: ServiceProviderContextProps & PropsWithChildren<any>
): JSX.Element | null {
const { api, children, logger } = props;
const { network } = useNetworkContext();
Expand All @@ -90,7 +90,7 @@ export function StoreServiceProvider(

const isCustomUrl = useMemo(
() => currentUrl !== defaultUrl,
[currentUrl, defaultUrl],
[currentUrl, defaultUrl]
);

const setUrl = async (newUrl: string): Promise<void> => {
Expand Down
8 changes: 4 additions & 4 deletions packages/walletkit-ui/src/contexts/ThemeProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("useTheme hook test", () => {
api,
colorScheme: desiredTheme,
logger,
}),
})
);
await waitForNextUpdate();
expect(result.current.theme).toBe(desiredTheme);
Expand All @@ -38,7 +38,7 @@ describe("useTheme hook test", () => {
get: async () => desiredTheme,
};
const { result, waitForNextUpdate } = renderHook(() =>
useTheme({ api, colorScheme: "light", logger }),
useTheme({ api, colorScheme: "light", logger })
);
await waitForNextUpdate();
expect(result.current.theme).toBe(desiredTheme);
Expand All @@ -51,7 +51,7 @@ describe("useTheme hook test", () => {
get: async () => null,
};
const { result, waitForNextUpdate } = renderHook(() =>
useTheme({ api, logger }),
useTheme({ api, logger })
);
await waitForNextUpdate();
expect(result.current.theme).toBe("light");
Expand All @@ -77,7 +77,7 @@ describe("ThemeProvider Context test", () => {
const rendered = render(
<ThemeProvider api={api} colorScheme={jest.fn()}>
<ThemeProviderComponent />
</ThemeProvider>,
</ThemeProvider>
);
expect(rendered).toMatchSnapshot();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/walletkit-ui/src/contexts/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export interface ThemeProviderProps extends PropsWithChildren<{}> {
}

export function ThemeProvider(
props: ThemeContextI & React.PropsWithChildren<any>,
props: ThemeContextI & React.PropsWithChildren<any>
): JSX.Element | null {
const { children, api, colorScheme, logger } = props;
const { theme } = useTheme({ api, colorScheme, logger });
Expand Down
18 changes: 9 additions & 9 deletions packages/walletkit-ui/src/contexts/WalletNodeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@ export interface EncryptedMnemonicWalletI {
initProvider: (
data: WalletPersistenceDataI<EncryptedProviderData>,
network: EnvironmentNetwork,
promptInterface: PromptInterface,
promptInterface: PromptInterface
) => EncryptedHdNodeProvider;
toData: (
mnemonic: string[],
network: EnvironmentNetwork,
passphrase: string,
passphrase: string
) => Promise<WalletPersistenceDataI<EncryptedProviderData>>;
generateWords?: () => string[];
}

export interface UnencryptedMnemonicWalletI {
initProvider: (
data: WalletPersistenceDataI<MnemonicProviderData>,
network: EnvironmentNetwork,
network: EnvironmentNetwork
) => MnemonicHdNodeProvider;
toData: (
mnemonic: string[],
network: EnvironmentNetwork,
network: EnvironmentNetwork
) => WalletPersistenceDataI<MnemonicProviderData>;
generateWords?: () => string[];
}
Expand All @@ -64,14 +64,14 @@ interface WalletNodeContextI {
const WalletNodeContext = createContext<WalletNodeContextI>(undefined as any);

function MnemonicUnprotectedProvider(
props: WalletNodeProviderProps<MnemonicProviderData>,
props: WalletNodeProviderProps<MnemonicProviderData>
): JSX.Element | null {
const { MnemonicUnprotected, children, data } = props;
const { network } = useNetworkContext();

const provider = useMemo(
() => MnemonicUnprotected.initProvider(data, network),
[network, data],
[network, data]
);

return (
Expand All @@ -83,7 +83,7 @@ function MnemonicUnprotectedProvider(
}

function MnemonicEncryptedProvider(
props: WalletNodeProviderProps<EncryptedProviderData>,
props: WalletNodeProviderProps<EncryptedProviderData>
): JSX.Element | null {
const { MnemonicEncrypted, children, data } = props;
const { network } = useNetworkContext();
Expand All @@ -99,7 +99,7 @@ function MnemonicEncryptedProvider(
throw new Error("No UI attached for passphrase prompting");
},
}),
[network, data],
[network, data]
);

return (
Expand Down Expand Up @@ -128,7 +128,7 @@ interface WalletNodeProviderProps<T> extends PropsWithChildren<any> {
* Automatically determine the correct WalletProvider to use based on the wallet type.
*/
export function WalletNodeProvider(
props: WalletNodeProviderProps<any>,
props: WalletNodeProviderProps<any>
): JSX.Element | null {
const { data, children } = props;
if (data.type === WalletType.MNEMONIC_UNPROTECTED) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface WalletPersistenceContextI {
}

const WalletPersistenceContext = createContext<WalletPersistenceContextI>(
undefined as any,
undefined as any
);

/**
Expand All @@ -57,13 +57,13 @@ interface WalletPersistenceProviderI {
}

export function WalletPersistenceProvider(
props: WalletPersistenceProviderI & PropsWithChildren<any>,
props: WalletPersistenceProviderI & PropsWithChildren<any>
): JSX.Element | null {
const { api, logger, children } = props;
const { network } = useNetworkContext();
const [isLoaded, setIsLoaded] = useState(false);
const [dataList, setDataList] = useState<Array<WalletPersistenceDataI<any>>>(
[],
[]
);

useEffect(() => {
Expand Down
Loading

0 comments on commit 65b4f8e

Please sign in to comment.