From 42dd3bfde0930211aeaeadcdfc82dd7a817a272a Mon Sep 17 00:00:00 2001 From: peetzweg/ Date: Wed, 20 Sep 2023 14:05:30 +0200 Subject: [PATCH] applies lint fixes from recent biome defaults and our config --- .../useink/src/core/types/api-contract.ts | 4 +- packages/useink/src/notifications/context.ts | 2 +- .../notifications/hooks/useNotifications.ts | 2 +- .../notifications/hooks/useTxNotifications.ts | 2 +- .../useink/src/notifications/provider.tsx | 2 +- .../useink/src/react/hooks/config/useChain.ts | 2 +- .../src/react/hooks/config/useConfig.ts | 2 +- .../react/hooks/config/useDefaultCaller.ts | 2 +- .../useink/src/react/hooks/contracts/types.ts | 2 +- .../react/hooks/contracts/useAbiMessage.ts | 2 +- .../src/react/hooks/contracts/useCall.ts | 2 +- .../hooks/contracts/useCallSubscription.ts | 2 +- .../src/react/hooks/contracts/useCodeHash.ts | 2 +- .../src/react/hooks/contracts/useContract.ts | 2 +- .../contracts/useDeployer/useDeployer.ts | 2 +- .../src/react/hooks/contracts/useDryRun.ts | 4 +- .../hooks/contracts/useEventSubscription.ts | 4 +- .../src/react/hooks/contracts/useEvents.ts | 2 +- .../react/hooks/contracts/useMessageSigner.ts | 2 +- .../src/react/hooks/contracts/useMetadata.ts | 2 +- .../src/react/hooks/contracts/useSalter.ts | 2 +- .../hooks/contracts/useSignatureVerifier.ts | 2 +- .../useink/src/react/hooks/contracts/useTx.ts | 2 +- .../src/react/hooks/contracts/useTxEvents.ts | 2 +- .../react/hooks/contracts/useTxPaymentInfo.ts | 2 +- .../react/hooks/helpers/useUnixMilliToDate.ts | 2 +- .../hooks/substrate/balance/useBalance.ts | 2 +- .../substrate/timestamp/useTimestampNow.ts | 2 +- .../substrate/timestamp/useTimestampQuery.ts | 2 +- .../src/react/hooks/substrate/useApi.ts | 2 +- .../react/hooks/substrate/useBlockHeader.ts | 2 +- .../src/react/hooks/substrate/useTransfer.ts | 2 +- .../src/react/hooks/wallets/useAllWallets.ts | 2 +- .../hooks/wallets/useInstalledWallets.ts | 2 +- .../hooks/wallets/useUninstalledWallets.ts | 2 +- .../src/react/hooks/wallets/useWallet.ts | 2 +- .../src/react/providers/UseInkProvider.tsx | 2 +- .../useink/src/react/providers/api/context.ts | 2 +- .../src/react/providers/api/provider.tsx | 2 +- .../react/providers/blockHeader/context.ts | 2 +- .../react/providers/blockHeader/provider.tsx | 2 +- .../src/react/providers/config/context.ts | 2 +- .../src/react/providers/config/provider.tsx | 2 +- .../src/react/providers/events/context.ts | 2 +- .../src/react/providers/events/provider.tsx | 2 +- .../src/react/providers/wallet/context.ts | 2 +- .../src/react/providers/wallet/provider.tsx | 2 +- .../utils/helpers/parseUnits/parseUnits.ts | 2 +- .../ConnectWallet/ConnectWallet.tsx | 14 +- .../components/FileDropper/FileDropper.tsx | 6 +- .../Notifications/Notifications.tsx | 6 +- .../src/components/Snackbar/Snackbar.tsx | 18 +- .../components/ToggleSwitch/ToggleSwitch.tsx | 2 +- .../pg-deploy/AbiParamInput/AbiParamInput.tsx | 28 +-- .../src/components/pg-deploy/DeployPage.tsx | 144 +++++------ .../src/components/pg-home/HomePage.tsx | 232 +++++++++--------- playground/src/pages/_app.tsx | 2 +- playground/src/pages/_document.tsx | 4 +- playground/src/pages/deploy.tsx | 10 +- playground/src/pages/index.tsx | 8 +- 60 files changed, 288 insertions(+), 288 deletions(-) diff --git a/packages/useink/src/core/types/api-contract.ts b/packages/useink/src/core/types/api-contract.ts index 38ed37d..f9dcb6d 100644 --- a/packages/useink/src/core/types/api-contract.ts +++ b/packages/useink/src/core/types/api-contract.ts @@ -1,5 +1,5 @@ -import { ISubmittableResult } from './substrate.ts'; import { SubmittableResult } from '@polkadot/api'; +import { ISubmittableResult } from './substrate.ts'; export { BlueprintPromise, @@ -28,7 +28,7 @@ export type { } from '@polkadot/api-contract/types'; export { Abi, ContractPromise } from '@polkadot/api-contract'; -// rome-ignore lint/correctness/noUnusedVariables: The Release flow breaks when exporting from '@polkadot/api-contract/base/contract'; +// biome-ignore lint/correctness/noUnusedVariables: The Release flow breaks when exporting from '@polkadot/api-contract/base/contract'; export declare class ContractSubmittableResult extends SubmittableResult { readonly contractEvents?: DecodedEvent[] | undefined; constructor(result: ISubmittableResult, contractEvents?: DecodedEvent[]); diff --git a/packages/useink/src/notifications/context.ts b/packages/useink/src/notifications/context.ts index d7b35bd..06c337c 100644 --- a/packages/useink/src/notifications/context.ts +++ b/packages/useink/src/notifications/context.ts @@ -1,10 +1,10 @@ +import { createContext } from 'react'; import { AddNotificationPayload, Config, DEFAULT_NOTIFICATIONS, Notifications, } from './model.ts'; -import { createContext } from 'react'; export const NotificationsContext = createContext<{ config?: Config; diff --git a/packages/useink/src/notifications/hooks/useNotifications.ts b/packages/useink/src/notifications/hooks/useNotifications.ts index d3afc58..65b0a93 100644 --- a/packages/useink/src/notifications/hooks/useNotifications.ts +++ b/packages/useink/src/notifications/hooks/useNotifications.ts @@ -1,3 +1,4 @@ +import { useContext, useMemo } from 'react'; import { HALF_A_SECOND } from '../../react/constants.ts'; import { useInterval } from '../../react/hooks/internal/useInterval.ts'; import { getExpiredItem } from '../../utils/index'; @@ -7,7 +8,6 @@ import { Notification, Notifications, } from '../model.ts'; -import { useContext, useMemo } from 'react'; export interface UseNotifications { notifications: Notifications; diff --git a/packages/useink/src/notifications/hooks/useTxNotifications.ts b/packages/useink/src/notifications/hooks/useTxNotifications.ts index 603dce6..8131141 100644 --- a/packages/useink/src/notifications/hooks/useTxNotifications.ts +++ b/packages/useink/src/notifications/hooks/useTxNotifications.ts @@ -1,7 +1,7 @@ +import { useEffect } from 'react'; import { ChainId } from '../../chains/types.ts'; import { Tx } from '../../index'; import { useNotifications } from './useNotifications.ts'; -import { useEffect } from 'react'; type TxInfo = Pick, 'status'> & Pick, 'result'>; diff --git a/packages/useink/src/notifications/provider.tsx b/packages/useink/src/notifications/provider.tsx index 8f1f05e..863444b 100644 --- a/packages/useink/src/notifications/provider.tsx +++ b/packages/useink/src/notifications/provider.tsx @@ -1,3 +1,4 @@ +import React, { useCallback, useReducer } from 'react'; import { useIsMounted } from '../react/hooks/internal/useIsMounted.ts'; import { pseudoRandomId } from '../utils/index'; import { NotificationsContext } from './context.ts'; @@ -7,7 +8,6 @@ import { DEFAULT_NOTIFICATIONS, } from './model.ts'; import { notificationReducer } from './reducer.ts'; -import React, { useCallback, useReducer } from 'react'; export const NotificationsProvider: React.FC< React.PropsWithChildren<{ diff --git a/packages/useink/src/react/hooks/config/useChain.ts b/packages/useink/src/react/hooks/config/useChain.ts index 918be99..96bcfbe 100644 --- a/packages/useink/src/react/hooks/config/useChain.ts +++ b/packages/useink/src/react/hooks/config/useChain.ts @@ -1,6 +1,6 @@ +import { useMemo } from 'react'; import { Chain, ChainId } from '../../../chains/index'; import { useConfig } from './useConfig.ts'; -import { useMemo } from 'react'; export const useChain = (chainId?: ChainId): Chain | undefined => { const { chains } = useConfig(); diff --git a/packages/useink/src/react/hooks/config/useConfig.ts b/packages/useink/src/react/hooks/config/useConfig.ts index 33ce2c6..0db427b 100644 --- a/packages/useink/src/react/hooks/config/useConfig.ts +++ b/packages/useink/src/react/hooks/config/useConfig.ts @@ -1,5 +1,5 @@ +import { useContext } from 'react'; import { ConfigContext } from '../../providers/config/context.ts'; import { Config } from '../../providers/config/model.ts'; -import { useContext } from 'react'; export const useConfig = (): Config => useContext(ConfigContext); diff --git a/packages/useink/src/react/hooks/config/useDefaultCaller.ts b/packages/useink/src/react/hooks/config/useDefaultCaller.ts index 68320c7..6ce5657 100644 --- a/packages/useink/src/react/hooks/config/useDefaultCaller.ts +++ b/packages/useink/src/react/hooks/config/useDefaultCaller.ts @@ -1,7 +1,7 @@ +import { useMemo } from 'react'; import { ChainId } from '../../../chains/index'; import { useChain } from './useChain.ts'; import { useConfig } from './useConfig.ts'; -import { useMemo } from 'react'; export const useDefaultCaller = (chainId?: ChainId): string | undefined => { const { caller } = useConfig(); diff --git a/packages/useink/src/react/hooks/contracts/types.ts b/packages/useink/src/react/hooks/contracts/types.ts index a288ae1..74d5efb 100644 --- a/packages/useink/src/react/hooks/contracts/types.ts +++ b/packages/useink/src/react/hooks/contracts/types.ts @@ -1,6 +1,6 @@ +import { BN } from '@polkadot/util'; import { ChainId } from '../../../chains/types.ts'; import { Abi, ContractOptions, ContractPromise } from '../../../core/index'; -import { BN } from '@polkadot/util'; export type CallOptions = Omit & { defaultCaller?: boolean; diff --git a/packages/useink/src/react/hooks/contracts/useAbiMessage.ts b/packages/useink/src/react/hooks/contracts/useAbiMessage.ts index eb6c088..d99f16b 100644 --- a/packages/useink/src/react/hooks/contracts/useAbiMessage.ts +++ b/packages/useink/src/react/hooks/contracts/useAbiMessage.ts @@ -1,9 +1,9 @@ +import { useMemo } from 'react'; import { AbiMessage, ContractPromise, toContractAbiMessage, } from '../../../core/index'; -import { useMemo } from 'react'; export function useAbiMessage( contract: ContractPromise | undefined, diff --git a/packages/useink/src/react/hooks/contracts/useCall.ts b/packages/useink/src/react/hooks/contracts/useCall.ts index b5ef110..4008350 100644 --- a/packages/useink/src/react/hooks/contracts/useCall.ts +++ b/packages/useink/src/react/hooks/contracts/useCall.ts @@ -1,3 +1,4 @@ +import { useCallback, useState } from 'react'; import { DecodedContractResult, LazyCallOptions, @@ -6,7 +7,6 @@ import { import { ChainContract, useDefaultCaller } from '../index'; import { useWallet } from '../wallets/useWallet.ts'; import { useAbiMessage } from './useAbiMessage.ts'; -import { useCallback, useState } from 'react'; export type CallSend = ( args?: unknown[], diff --git a/packages/useink/src/react/hooks/contracts/useCallSubscription.ts b/packages/useink/src/react/hooks/contracts/useCallSubscription.ts index 338c14f..946f67f 100644 --- a/packages/useink/src/react/hooks/contracts/useCallSubscription.ts +++ b/packages/useink/src/react/hooks/contracts/useCallSubscription.ts @@ -1,8 +1,8 @@ +import { useEffect } from 'react'; import { LazyCallOptions } from '../../../core/index.ts'; import { useBlockHeader } from '../substrate/useBlockHeader.ts'; import { ChainContract } from './types.ts'; import { Call, useCall } from './useCall.ts'; -import { useEffect } from 'react'; export function useCallSubscription( chainContract: ChainContract | undefined, diff --git a/packages/useink/src/react/hooks/contracts/useCodeHash.ts b/packages/useink/src/react/hooks/contracts/useCodeHash.ts index 79fbab6..ea24644 100644 --- a/packages/useink/src/react/hooks/contracts/useCodeHash.ts +++ b/packages/useink/src/react/hooks/contracts/useCodeHash.ts @@ -1,5 +1,5 @@ -import { isValidHash } from '../../../utils'; import { useCallback, useEffect, useState } from 'react'; +import { isValidHash } from '../../../utils'; export enum CodeHashError { InvalidHash = 'Invalid code hash value.', diff --git a/packages/useink/src/react/hooks/contracts/useContract.ts b/packages/useink/src/react/hooks/contracts/useContract.ts index 0f6f281..a0d91ad 100644 --- a/packages/useink/src/react/hooks/contracts/useContract.ts +++ b/packages/useink/src/react/hooks/contracts/useContract.ts @@ -1,9 +1,9 @@ +import { useEffect, useMemo, useState } from 'react'; import { ChainId } from '../../../chains/index'; import { Abi, ContractPromise } from '../../../core/index'; import { useChain } from '../config/useChain.ts'; import { useApi } from '../substrate/useApi.ts'; import { ChainContract } from './types.ts'; -import { useEffect, useMemo, useState } from 'react'; export function useContract( address: string, diff --git a/packages/useink/src/react/hooks/contracts/useDeployer/useDeployer.ts b/packages/useink/src/react/hooks/contracts/useDeployer/useDeployer.ts index 8dd69e8..b489442 100644 --- a/packages/useink/src/react/hooks/contracts/useDeployer/useDeployer.ts +++ b/packages/useink/src/react/hooks/contracts/useDeployer/useDeployer.ts @@ -1,3 +1,4 @@ +import { useCallback, useEffect, useMemo, useState } from 'react'; import { ChainId } from '../../../../chains/index.ts'; import { BlueprintPromise, @@ -26,7 +27,6 @@ import { useApi } from '../../substrate/useApi.ts'; import { useWallet } from '../../wallets/useWallet.ts'; import { useTxEvents } from '../useTxEvents.ts'; import { Deploy, DeploySignAndSend, DeployTx, DeployerError } from './types.ts'; -import { useCallback, useEffect, useMemo, useState } from 'react'; export function useDeployer(chainId?: ChainId): Deploy { const { account } = useWallet(); diff --git a/packages/useink/src/react/hooks/contracts/useDryRun.ts b/packages/useink/src/react/hooks/contracts/useDryRun.ts index ee4634b..1ec42cf 100644 --- a/packages/useink/src/react/hooks/contracts/useDryRun.ts +++ b/packages/useink/src/react/hooks/contracts/useDryRun.ts @@ -1,3 +1,4 @@ +import { useMemo, useState } from 'react'; import { DecodedTxResult, LazyCallOptions, @@ -8,7 +9,6 @@ import { useDefaultCaller } from '../config/index'; import { useWallet } from '../wallets/useWallet.ts'; import { ChainContract } from './types.ts'; import { useAbiMessage } from './useAbiMessage.ts'; -import { useMemo, useState } from 'react'; export type DryRunResult = DecodedTxResult; @@ -21,7 +21,7 @@ export interface DryRun { send: Send; isSubmitting: boolean; result?: DryRunResult; - resolved: Boolean; + resolved: boolean; resetState: () => void; } diff --git a/packages/useink/src/react/hooks/contracts/useEventSubscription.ts b/packages/useink/src/react/hooks/contracts/useEventSubscription.ts index 6241af3..8ab113f 100644 --- a/packages/useink/src/react/hooks/contracts/useEventSubscription.ts +++ b/packages/useink/src/react/hooks/contracts/useEventSubscription.ts @@ -1,3 +1,5 @@ +import { IEventLike } from '@polkadot/types/types/events'; +import { useContext, useEffect } from 'react'; import { Bytes } from '../../../core/index'; import { getExpiredItem } from '../../../utils/index'; import { FIVE_SECONDS, HALF_A_SECOND } from '../../constants.ts'; @@ -6,8 +8,6 @@ import { useConfig } from '../config/useConfig.ts'; import { useInterval } from '../internal/useInterval.ts'; import { useBlockHeader } from '../substrate/useBlockHeader.ts'; import { ChainContract } from './types.ts'; -import { IEventLike } from '@polkadot/types/types/events'; -import { useContext, useEffect } from 'react'; export const useEventSubscription = ( chainContract: ChainContract | undefined, diff --git a/packages/useink/src/react/hooks/contracts/useEvents.ts b/packages/useink/src/react/hooks/contracts/useEvents.ts index 6dc09a8..3dffb9f 100644 --- a/packages/useink/src/react/hooks/contracts/useEvents.ts +++ b/packages/useink/src/react/hooks/contracts/useEvents.ts @@ -1,7 +1,7 @@ +import { useContext, useMemo } from 'react'; import { AccountId } from '../../../core/index'; import { Event, EventsContext } from '../../providers/events/index'; import { RemoveEventPayload } from '../../providers/events/model.ts'; -import { useContext, useMemo } from 'react'; export interface Events { events: Event[]; diff --git a/packages/useink/src/react/hooks/contracts/useMessageSigner.ts b/packages/useink/src/react/hooks/contracts/useMessageSigner.ts index 7118b29..438543c 100644 --- a/packages/useink/src/react/hooks/contracts/useMessageSigner.ts +++ b/packages/useink/src/react/hooks/contracts/useMessageSigner.ts @@ -1,6 +1,6 @@ +import { useCallback, useState } from 'react'; import { SignatureResult } from '../../../core/index.ts'; import { useWallet } from '../wallets/useWallet.ts'; -import { useCallback, useState } from 'react'; export type Sign = (data?: string) => void; diff --git a/packages/useink/src/react/hooks/contracts/useMetadata.ts b/packages/useink/src/react/hooks/contracts/useMetadata.ts index 05d953f..f08c133 100644 --- a/packages/useink/src/react/hooks/contracts/useMetadata.ts +++ b/packages/useink/src/react/hooks/contracts/useMetadata.ts @@ -1,3 +1,4 @@ +import { useEffect, useState } from 'react'; import { ChainId } from '../../../chains'; import { DEFAULT, @@ -7,7 +8,6 @@ import { } from '../../../core'; import { MetadataError, toBasicMetadata } from '../../../utils'; import { useApi } from '../substrate/useApi'; -import { useEffect, useState } from 'react'; export interface BasicMetadataFile { data: Uint8Array; diff --git a/packages/useink/src/react/hooks/contracts/useSalter.ts b/packages/useink/src/react/hooks/contracts/useSalter.ts index 05455d9..dc482ec 100644 --- a/packages/useink/src/react/hooks/contracts/useSalter.ts +++ b/packages/useink/src/react/hooks/contracts/useSalter.ts @@ -1,5 +1,5 @@ -import { isValidHash, pseudoRandomHex } from '../../../utils'; import { useCallback, useState } from 'react'; +import { isValidHash, pseudoRandomHex } from '../../../utils'; export enum SalterError { InvalidHash = 'Invalid salt hash value.', diff --git a/packages/useink/src/react/hooks/contracts/useSignatureVerifier.ts b/packages/useink/src/react/hooks/contracts/useSignatureVerifier.ts index 411e67a..e230e97 100644 --- a/packages/useink/src/react/hooks/contracts/useSignatureVerifier.ts +++ b/packages/useink/src/react/hooks/contracts/useSignatureVerifier.ts @@ -1,5 +1,5 @@ -import { signatureVerify } from '../../../utils'; import { useCallback, useState } from 'react'; +import { signatureVerify } from '../../../utils'; type VerificationParams = Parameters; diff --git a/packages/useink/src/react/hooks/contracts/useTx.ts b/packages/useink/src/react/hooks/contracts/useTx.ts index 235b3ea..5a8e1d0 100644 --- a/packages/useink/src/react/hooks/contracts/useTx.ts +++ b/packages/useink/src/react/hooks/contracts/useTx.ts @@ -1,3 +1,4 @@ +import { useMemo, useState } from 'react'; import { ApiBase, ContractSubmittableResult, @@ -10,7 +11,6 @@ import { useWallet } from '../wallets/useWallet.ts'; import { ChainContract } from './types.ts'; import { useDryRun } from './useDryRun.ts'; import { useTxEvents } from './useTxEvents.ts'; -import { useMemo, useState } from 'react'; export type ContractSubmittableResultCallback = ( result?: ContractSubmittableResult, diff --git a/packages/useink/src/react/hooks/contracts/useTxEvents.ts b/packages/useink/src/react/hooks/contracts/useTxEvents.ts index 1941bef..30fa10e 100644 --- a/packages/useink/src/react/hooks/contracts/useTxEvents.ts +++ b/packages/useink/src/react/hooks/contracts/useTxEvents.ts @@ -1,7 +1,7 @@ +import { useCallback, useEffect, useState } from 'react'; import { EventRecord } from '../../../core'; import { isInBlock } from '../../../utils'; import { Tx } from './useTx'; -import { useCallback, useEffect, useState } from 'react'; type Eventable = Pick, 'status'> & Pick, 'result'>; diff --git a/packages/useink/src/react/hooks/contracts/useTxPaymentInfo.ts b/packages/useink/src/react/hooks/contracts/useTxPaymentInfo.ts index a94eddb..a9e6350 100644 --- a/packages/useink/src/react/hooks/contracts/useTxPaymentInfo.ts +++ b/packages/useink/src/react/hooks/contracts/useTxPaymentInfo.ts @@ -1,3 +1,4 @@ +import { useCallback, useState } from 'react'; import { ChainContract, useDefaultCaller } from '..'; import { LazyCallOptions, @@ -6,7 +7,6 @@ import { txPaymentInfo, } from '../../../core'; import { useWallet } from '../wallets/useWallet.ts'; -import { useCallback, useState } from 'react'; type Send = ( params?: unknown[], diff --git a/packages/useink/src/react/hooks/helpers/useUnixMilliToDate.ts b/packages/useink/src/react/hooks/helpers/useUnixMilliToDate.ts index f78fec7..278d618 100644 --- a/packages/useink/src/react/hooks/helpers/useUnixMilliToDate.ts +++ b/packages/useink/src/react/hooks/helpers/useUnixMilliToDate.ts @@ -1,5 +1,5 @@ -import { unixMilliToDate } from '../../../utils/helpers/unixMilliToDate'; import { useMemo } from 'react'; +import { unixMilliToDate } from '../../../utils/helpers/unixMilliToDate'; export const useUnixMilliToDate = ( unixInMilliSeconds: number | undefined, diff --git a/packages/useink/src/react/hooks/substrate/balance/useBalance.ts b/packages/useink/src/react/hooks/substrate/balance/useBalance.ts index c1c3427..b715841 100644 --- a/packages/useink/src/react/hooks/substrate/balance/useBalance.ts +++ b/packages/useink/src/react/hooks/substrate/balance/useBalance.ts @@ -1,10 +1,10 @@ +import { useEffect, useState } from 'react'; import { ChainId } from '../../../../chains/index'; import { DeriveBalancesAccount, WithAddress } from '../../../../core/index'; import { getBalance } from '../../../../core/index'; import { useChain } from '../../index'; import { useApi } from '../useApi.ts'; import { useBlockHeader } from '../useBlockHeader.ts'; -import { useEffect, useState } from 'react'; export const useBalance = ( account: WithAddress | undefined, diff --git a/packages/useink/src/react/hooks/substrate/timestamp/useTimestampNow.ts b/packages/useink/src/react/hooks/substrate/timestamp/useTimestampNow.ts index 9b8a9f7..80f51b4 100644 --- a/packages/useink/src/react/hooks/substrate/timestamp/useTimestampNow.ts +++ b/packages/useink/src/react/hooks/substrate/timestamp/useTimestampNow.ts @@ -1,8 +1,8 @@ +import { useEffect, useState } from 'react'; import { ChainId } from '../../../../chains'; import { getTimestampUnix } from '../../../../core'; import { useApi } from '../useApi'; import { useBlockHeader } from '../useBlockHeader'; -import { useEffect, useState } from 'react'; // Get the current timestamp in milliseconds export const useTimestampNow = (chainId?: ChainId): number | undefined => { diff --git a/packages/useink/src/react/hooks/substrate/timestamp/useTimestampQuery.ts b/packages/useink/src/react/hooks/substrate/timestamp/useTimestampQuery.ts index d0121ea..28c5efd 100644 --- a/packages/useink/src/react/hooks/substrate/timestamp/useTimestampQuery.ts +++ b/packages/useink/src/react/hooks/substrate/timestamp/useTimestampQuery.ts @@ -1,7 +1,7 @@ +import { useEffect, useState } from 'react'; import { ChainId } from '../../../../chains'; import { QueryableModuleCalls, getTimestampQuery } from '../../../../core'; import { useApi } from '../useApi'; -import { useEffect, useState } from 'react'; // Get a queryable function that can then be used to call a chain: `await timestampQuery.now()` export const useTimestampQuery = ( diff --git a/packages/useink/src/react/hooks/substrate/useApi.ts b/packages/useink/src/react/hooks/substrate/useApi.ts index d9b4aa4..a704104 100644 --- a/packages/useink/src/react/hooks/substrate/useApi.ts +++ b/packages/useink/src/react/hooks/substrate/useApi.ts @@ -1,7 +1,7 @@ +import { useContext } from 'react'; import { ChainId } from '../../../chains/index'; import { IApiProvider, useChain } from '../../index'; import { API, APIContext } from '../../providers/api/index'; -import { useContext } from 'react'; export const useApis = (): API => useContext(APIContext); diff --git a/packages/useink/src/react/hooks/substrate/useBlockHeader.ts b/packages/useink/src/react/hooks/substrate/useBlockHeader.ts index ac3cbb8..c3eddc9 100644 --- a/packages/useink/src/react/hooks/substrate/useBlockHeader.ts +++ b/packages/useink/src/react/hooks/substrate/useBlockHeader.ts @@ -1,3 +1,4 @@ +import { useContext } from 'react'; import { ChainId } from '../../../chains/index'; import { BlockHeaderContext, @@ -5,7 +6,6 @@ import { } from '../../providers/blockHeader/index'; import { useChain } from '../config/useChain.ts'; import { BlockHeader } from './index'; -import { useContext } from 'react'; export type { BlockHeader } from '../../providers/blockHeader/index'; diff --git a/packages/useink/src/react/hooks/substrate/useTransfer.ts b/packages/useink/src/react/hooks/substrate/useTransfer.ts index 8c957cc..fa3d4c0 100644 --- a/packages/useink/src/react/hooks/substrate/useTransfer.ts +++ b/packages/useink/src/react/hooks/substrate/useTransfer.ts @@ -1,8 +1,8 @@ +import { useCallback, useMemo, useState } from 'react'; import { useChain, useWallet } from '../'; import { ChainId } from '../../../chains'; import { Hash, SignerOptions, transfer } from '../../../core'; import { useApi } from './useApi.ts'; -import { useCallback, useMemo, useState } from 'react'; export type SignAndSendTransfer = ( to: string, diff --git a/packages/useink/src/react/hooks/wallets/useAllWallets.ts b/packages/useink/src/react/hooks/wallets/useAllWallets.ts index b22d2e3..a0736ea 100644 --- a/packages/useink/src/react/hooks/wallets/useAllWallets.ts +++ b/packages/useink/src/react/hooks/wallets/useAllWallets.ts @@ -1,6 +1,6 @@ +import { useMemo } from 'react'; import { Wallet } from '../../providers/wallet/index'; import { useWallet } from '../index'; -import { useMemo } from 'react'; export const useAllWallets = (): Wallet[] => { const { getWallets } = useWallet(); diff --git a/packages/useink/src/react/hooks/wallets/useInstalledWallets.ts b/packages/useink/src/react/hooks/wallets/useInstalledWallets.ts index 45d1963..957dacf 100644 --- a/packages/useink/src/react/hooks/wallets/useInstalledWallets.ts +++ b/packages/useink/src/react/hooks/wallets/useInstalledWallets.ts @@ -1,6 +1,6 @@ +import { useMemo } from 'react'; import { Wallet } from '../../providers/wallet/index'; import { useWallet } from '../index'; -import { useMemo } from 'react'; export const useInstalledWallets = (): Wallet[] => { const { getWallets } = useWallet(); diff --git a/packages/useink/src/react/hooks/wallets/useUninstalledWallets.ts b/packages/useink/src/react/hooks/wallets/useUninstalledWallets.ts index e539aa8..5f17dcc 100644 --- a/packages/useink/src/react/hooks/wallets/useUninstalledWallets.ts +++ b/packages/useink/src/react/hooks/wallets/useUninstalledWallets.ts @@ -1,6 +1,6 @@ +import { useMemo } from 'react'; import { Wallet } from '../../providers/wallet/index'; import { useWallet } from './useWallet.ts'; -import { useMemo } from 'react'; export const useUninstalledWallets = (): Wallet[] => { const { getWallets } = useWallet(); diff --git a/packages/useink/src/react/hooks/wallets/useWallet.ts b/packages/useink/src/react/hooks/wallets/useWallet.ts index 6088f63..cec3c26 100644 --- a/packages/useink/src/react/hooks/wallets/useWallet.ts +++ b/packages/useink/src/react/hooks/wallets/useWallet.ts @@ -1,5 +1,5 @@ -import { WalletContext, WalletState } from '../../providers/wallet/index'; import { useContext } from 'react'; +import { WalletContext, WalletState } from '../../providers/wallet/index'; export type { WalletState } from '../../providers/wallet/index'; diff --git a/packages/useink/src/react/providers/UseInkProvider.tsx b/packages/useink/src/react/providers/UseInkProvider.tsx index ff04ed8..f7dceaa 100644 --- a/packages/useink/src/react/providers/UseInkProvider.tsx +++ b/packages/useink/src/react/providers/UseInkProvider.tsx @@ -1,9 +1,9 @@ +import React from 'react'; import { APIProvider } from './api/provider.tsx'; import { BlockHeaderProvider } from './blockHeader/index'; import { ConfigProps, ConfigProvider } from './config/index'; import { EventsProvider } from './events/index'; import { WalletProvider } from './wallet/index'; -import React from 'react'; export type InkConfig = { config: ConfigProps; diff --git a/packages/useink/src/react/providers/api/context.ts b/packages/useink/src/react/providers/api/context.ts index 9bce7b1..80d3bb2 100644 --- a/packages/useink/src/react/providers/api/context.ts +++ b/packages/useink/src/react/providers/api/context.ts @@ -1,5 +1,5 @@ -import { API } from './model.ts'; import { createContext } from 'react'; +import { API } from './model.ts'; export const APIContext = createContext({ apis: {}, diff --git a/packages/useink/src/react/providers/api/provider.tsx b/packages/useink/src/react/providers/api/provider.tsx index 1a8910a..2715895 100644 --- a/packages/useink/src/react/providers/api/provider.tsx +++ b/packages/useink/src/react/providers/api/provider.tsx @@ -1,9 +1,9 @@ +import React, { useEffect, useReducer } from 'react'; import { ApiPromise, WsProvider } from '../../../core/index'; import { useChains } from '../../hooks/index'; import { useConfig } from '../../index'; import { APIContext } from './context.ts'; import { apiProvidersReducer } from './reducer.ts'; -import React, { useEffect, useReducer } from 'react'; export const APIProvider: React.FC = ({ children, diff --git a/packages/useink/src/react/providers/blockHeader/context.ts b/packages/useink/src/react/providers/blockHeader/context.ts index 048b5df..7e8bb0f 100644 --- a/packages/useink/src/react/providers/blockHeader/context.ts +++ b/packages/useink/src/react/providers/blockHeader/context.ts @@ -1,5 +1,5 @@ -import { BLOCK_HEADER_DEFAULTS, ChainBlockHeaders } from './model.ts'; import { createContext } from 'react'; +import { BLOCK_HEADER_DEFAULTS, ChainBlockHeaders } from './model.ts'; export const BlockHeaderContext = createContext({ ...BLOCK_HEADER_DEFAULTS, diff --git a/packages/useink/src/react/providers/blockHeader/provider.tsx b/packages/useink/src/react/providers/blockHeader/provider.tsx index 4635762..9103af9 100644 --- a/packages/useink/src/react/providers/blockHeader/provider.tsx +++ b/packages/useink/src/react/providers/blockHeader/provider.tsx @@ -1,9 +1,9 @@ +import React, { useEffect, useMemo, useReducer } from 'react'; import { ChainId } from '../../../chains/index'; import { useApis } from '../../index'; import { BlockHeaderContext } from './context.ts'; import { ChainBlockHeaders } from './model.ts'; import { chainBlockHeaderReducer } from './reducer.ts'; -import React, { useEffect, useMemo, useReducer } from 'react'; const toBlockNumber = (valWithComma: string | undefined): number => parseInt(`${valWithComma?.split(',').join('')}`); diff --git a/packages/useink/src/react/providers/config/context.ts b/packages/useink/src/react/providers/config/context.ts index 2e07605..389ddbb 100644 --- a/packages/useink/src/react/providers/config/context.ts +++ b/packages/useink/src/react/providers/config/context.ts @@ -1,5 +1,5 @@ -import { ChainConfig, ConfigProps, DEFAULT_CONFIG } from './model.ts'; import React from 'react'; +import { ChainConfig, ConfigProps, DEFAULT_CONFIG } from './model.ts'; export const ConfigContext = React.createContext( DEFAULT_CONFIG, diff --git a/packages/useink/src/react/providers/config/provider.tsx b/packages/useink/src/react/providers/config/provider.tsx index e6f7765..3fc041c 100644 --- a/packages/useink/src/react/providers/config/provider.tsx +++ b/packages/useink/src/react/providers/config/provider.tsx @@ -1,7 +1,7 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { Chain, ChainId } from '../../../chains/index'; import { ConfigContext } from './context.ts'; import { ChainRPCs, ConfigProps, DEFAULT_CONFIG } from './model.ts'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; export interface Props { config: ConfigProps; diff --git a/packages/useink/src/react/providers/events/context.ts b/packages/useink/src/react/providers/events/context.ts index 913bc39..73aec39 100644 --- a/packages/useink/src/react/providers/events/context.ts +++ b/packages/useink/src/react/providers/events/context.ts @@ -1,10 +1,10 @@ +import { createContext } from 'react'; import { AddEventPayload, DEFAULT_EVENTS, Events, RemoveEventPayload, } from './model.ts'; -import { createContext } from 'react'; export const EventsContext = createContext<{ events: Events; diff --git a/packages/useink/src/react/providers/events/provider.tsx b/packages/useink/src/react/providers/events/provider.tsx index fe0d519..12a04f2 100644 --- a/packages/useink/src/react/providers/events/provider.tsx +++ b/packages/useink/src/react/providers/events/provider.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { pseudoRandomId } from '../../../utils/index'; import { EventsContext } from './context.ts'; import { @@ -6,7 +7,6 @@ import { RemoveEventPayload, } from './model.ts'; import { eventsReducer } from './reducer.ts'; -import React from 'react'; import { useIsMounted } from '../../hooks/internal/useIsMounted.ts'; diff --git a/packages/useink/src/react/providers/wallet/context.ts b/packages/useink/src/react/providers/wallet/context.ts index dc1ba6c..23e827e 100644 --- a/packages/useink/src/react/providers/wallet/context.ts +++ b/packages/useink/src/react/providers/wallet/context.ts @@ -1,5 +1,5 @@ -import { WALLET_DEFAULTS, WalletState } from './model.ts'; import { createContext } from 'react'; +import { WALLET_DEFAULTS, WalletState } from './model.ts'; export const WalletContext = createContext({ ...WALLET_DEFAULTS, diff --git a/packages/useink/src/react/providers/wallet/provider.tsx b/packages/useink/src/react/providers/wallet/provider.tsx index e021559..d7e4790 100644 --- a/packages/useink/src/react/providers/wallet/provider.tsx +++ b/packages/useink/src/react/providers/wallet/provider.tsx @@ -1,3 +1,4 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { Unsub, WalletAccount, @@ -7,7 +8,6 @@ import { import { useConfig } from '../../hooks'; import { WalletContext } from './context.ts'; import { AutoConnect, WalletError, WalletName } from './model.ts'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; function getAutoConnectWalletInfo(key: string): AutoConnect | null { const item = localStorage.getItem(key); diff --git a/packages/useink/src/utils/helpers/parseUnits/parseUnits.ts b/packages/useink/src/utils/helpers/parseUnits/parseUnits.ts index 502acf4..a5e3ffe 100644 --- a/packages/useink/src/utils/helpers/parseUnits/parseUnits.ts +++ b/packages/useink/src/utils/helpers/parseUnits/parseUnits.ts @@ -64,7 +64,7 @@ export const planckToDecimalFormatted = ( export const decimalToPlanck = ( amount: number, options: DecimalOptions | undefined, -): BigInt | undefined => { +): bigint | undefined => { const decimals = options?.decimals || options?.api?.registry.chainDecimals[0]; if (!decimals) return; diff --git a/playground/src/components/ConnectWallet/ConnectWallet.tsx b/playground/src/components/ConnectWallet/ConnectWallet.tsx index e3173d3..d89511b 100644 --- a/playground/src/components/ConnectWallet/ConnectWallet.tsx +++ b/playground/src/components/ConnectWallet/ConnectWallet.tsx @@ -8,7 +8,7 @@ export const ConnectWallet = () => { if (installedWallets.length === 0) { return ( -

+

You don't have any wallets installed...

); @@ -16,17 +16,17 @@ export const ConnectWallet = () => { return ( <> -

Connect a Wallet

-

Installed Wallets

-