From 8dac8b262e0dd787cb0d4d3d291d9ebce9f9189f Mon Sep 17 00:00:00 2001 From: Corban Riley Date: Thu, 16 Jan 2025 14:27:34 -0500 Subject: [PATCH] More lint fixes --- .../src/contexts/TransactionStatusModal.ts | 2 -- .../src/hooks/useERC1155SaleContractCheckout.ts | 8 ++------ .../src/hooks/useSkipOnCloseCallback.ts | 2 +- .../PayWithCreditCard/index.tsx | 12 +----------- .../PaymentSelection/PayWithCrypto/index.tsx | 4 ++-- .../src/views/PaymentSelection/index.tsx | 17 ++++++++--------- .../src/views/PendingCreditCardTransaction.tsx | 2 +- packages/kit/src/constants/localStorage.ts | 2 -- packages/kit/src/hooks/data.ts | 2 +- packages/kit/src/hooks/useWaasEmailAuth.ts | 12 ++++++------ packages/kit/src/utils/transactions.ts | 2 +- packages/wallet/src/contexts/WalletModal.ts | 2 -- .../src/shared/TransactionConfirmation.tsx | 2 +- packages/wallet/src/views/SendCoin.tsx | 2 +- packages/wallet/src/views/SendCollectible.tsx | 2 +- 15 files changed, 26 insertions(+), 47 deletions(-) diff --git a/packages/checkout/src/contexts/TransactionStatusModal.ts b/packages/checkout/src/contexts/TransactionStatusModal.ts index 1ecafa67..bb934b39 100644 --- a/packages/checkout/src/contexts/TransactionStatusModal.ts +++ b/packages/checkout/src/contexts/TransactionStatusModal.ts @@ -1,5 +1,3 @@ -import { Hex } from 'viem' - import { createGenericContext } from './genericContext' interface Item { diff --git a/packages/checkout/src/hooks/useERC1155SaleContractCheckout.ts b/packages/checkout/src/hooks/useERC1155SaleContractCheckout.ts index bcf2c2ed..970b4026 100644 --- a/packages/checkout/src/hooks/useERC1155SaleContractCheckout.ts +++ b/packages/checkout/src/hooks/useERC1155SaleContractCheckout.ts @@ -1,10 +1,6 @@ -import { - CheckoutOptionsSalesContractArgs, - TransactionSwapProvider, - TransactionNFTCheckoutProvider -} from '@0xsequence/marketplace' +import { CheckoutOptionsSalesContractArgs, TransactionSwapProvider } from '@0xsequence/marketplace' import { findSupportedNetwork } from '@0xsequence/network' -import { Abi, Hex, padBytes } from 'viem' +import { Abi, Hex } from 'viem' import { useReadContract, useReadContracts } from 'wagmi' import { ERC_1155_SALE_CONTRACT } from '../constants/abi' diff --git a/packages/checkout/src/hooks/useSkipOnCloseCallback.ts b/packages/checkout/src/hooks/useSkipOnCloseCallback.ts index 793a985f..230aef17 100644 --- a/packages/checkout/src/hooks/useSkipOnCloseCallback.ts +++ b/packages/checkout/src/hooks/useSkipOnCloseCallback.ts @@ -1,4 +1,4 @@ -import { useEffect, useRef, MutableRefObject } from 'react' +import { useEffect, useRef } from 'react' interface UseSkipOnCloseCallbackReturn { skipOnCloseCallback: () => void diff --git a/packages/checkout/src/views/PaymentSelection/PayWithCreditCard/index.tsx b/packages/checkout/src/views/PaymentSelection/PayWithCreditCard/index.tsx index 23a87275..69fea4b1 100644 --- a/packages/checkout/src/views/PaymentSelection/PayWithCreditCard/index.tsx +++ b/packages/checkout/src/views/PaymentSelection/PayWithCreditCard/index.tsx @@ -1,14 +1,4 @@ -import { - ArrowRightIcon, - Box, - Card, - PaymentsIcon, - SendIcon, - Spinner, - Text, - Scroll, - useMediaQuery -} from '@0xsequence/design-system' +import { ArrowRightIcon, Box, Card, PaymentsIcon, Spinner, Text } from '@0xsequence/design-system' import { useContractInfo } from '@0xsequence/kit' import { findSupportedNetwork } from '@0xsequence/network' import { useEffect, useState } from 'react' diff --git a/packages/checkout/src/views/PaymentSelection/PayWithCrypto/index.tsx b/packages/checkout/src/views/PaymentSelection/PayWithCrypto/index.tsx index 9b29a489..941ccc6f 100644 --- a/packages/checkout/src/views/PaymentSelection/PayWithCrypto/index.tsx +++ b/packages/checkout/src/views/PaymentSelection/PayWithCrypto/index.tsx @@ -92,8 +92,8 @@ export const PayWithCrypto = ({ const balanceInfo = currencyBalanceData?.find(balanceData => compareAddress(currencyAddress, balanceData.contractAddress)) const balance: bigint = BigInt(balanceInfo?.balance || '0') - let balanceFormatted = Number(formatUnits(balance, currencyInfoData?.decimals || 0)) - balanceFormatted = Math.trunc(Number(balanceFormatted) * 10000) / 10000 + // let balanceFormatted = Number(formatUnits(balance, currencyInfoData?.decimals || 0)) + // balanceFormatted = Math.trunc(Number(balanceFormatted) * 10000) / 10000 const isNotEnoughFunds: boolean = BigInt(price) > balance diff --git a/packages/checkout/src/views/PaymentSelection/index.tsx b/packages/checkout/src/views/PaymentSelection/index.tsx index 58c5c4ff..ef986f31 100644 --- a/packages/checkout/src/views/PaymentSelection/index.tsx +++ b/packages/checkout/src/views/PaymentSelection/index.tsx @@ -12,7 +12,7 @@ import { } from '@0xsequence/kit' import { findSupportedNetwork } from '@0xsequence/network' import { useState, useEffect } from 'react' -import { encodeFunctionData, formatUnits, Hex, zeroAddress } from 'viem' +import { encodeFunctionData, Hex, zeroAddress } from 'viem' import { usePublicClient, useWalletClient, useReadContract, useAccount } from 'wagmi' import { HEADER_HEIGHT } from '../../constants' @@ -92,7 +92,7 @@ export const PaymentSelectionContent = () => { } }) - const { data: currencyBalanceData, isLoading: currencyBalanceIsLoading } = useBalancesSummary({ + const { data: _currencyBalanceData, isLoading: currencyBalanceIsLoading } = useBalancesSummary({ chainIds: [chainId], filter: { accountAddresses: userAddress ? [userAddress] : [], @@ -104,12 +104,12 @@ export const PaymentSelectionContent = () => { omitMetadata: true }) - const { data: currencyInfoData, isLoading: isLoadingCurrencyInfo } = useContractInfo(chainId, currencyAddress) + const { data: _currencyInfoData, isLoading: isLoadingCurrencyInfo } = useContractInfo(chainId, currencyAddress) const buyCurrencyAddress = currencyAddress const sellCurrencyAddress = selectedCurrency || '' - const { data: swapPrices = [], isLoading: swapPricesIsLoading } = useSwapPrices( + const { data: swapPrices = [], isLoading: _swapPricesIsLoading } = useSwapPrices( { userAddress: userAddress ?? '', buyCurrencyAddress, @@ -140,11 +140,10 @@ export const PaymentSelectionContent = () => { const isApproved: boolean = (allowanceData as bigint) >= BigInt(price) || isNativeToken - const balanceInfo = currencyBalanceData?.find(balanceData => compareAddress(currencyAddress, balanceData.contractAddress)) - - const balance: bigint = BigInt(balanceInfo?.balance || '0') - let balanceFormatted = Number(formatUnits(balance, currencyInfoData?.decimals || 0)) - balanceFormatted = Math.trunc(Number(balanceFormatted) * 10000) / 10000 + // const balanceInfo = currencyBalanceData?.find(balanceData => compareAddress(currencyAddress, balanceData.contractAddress)) + // const balance: bigint = BigInt(balanceInfo?.balance || '0') + // let balanceFormatted = Number(formatUnits(balance, currencyInfoData?.decimals || 0)) + // balanceFormatted = Math.trunc(Number(balanceFormatted) * 10000) / 10000 useEffect(() => { clearCachedBalances() diff --git a/packages/checkout/src/views/PendingCreditCardTransaction.tsx b/packages/checkout/src/views/PendingCreditCardTransaction.tsx index f683360d..b954ed04 100644 --- a/packages/checkout/src/views/PendingCreditCardTransaction.tsx +++ b/packages/checkout/src/views/PendingCreditCardTransaction.tsx @@ -228,7 +228,7 @@ export const PendingCreditCardTransactionTransak = ({ skipOnCloseCallback }: Pen export const PendingCreditCardTransactionSardine = ({ skipOnCloseCallback }: PendingCreditTransactionProps) => { const { openTransactionStatusModal } = useTransactionStatusModal() const nav = useNavigation() - const { settings, closeCheckout } = useCheckoutModal() + const { closeCheckout } = useCheckoutModal() const { params: { creditCardCheckout } diff --git a/packages/kit/src/constants/localStorage.ts b/packages/kit/src/constants/localStorage.ts index 3423b2fa..9650b5e5 100644 --- a/packages/kit/src/constants/localStorage.ts +++ b/packages/kit/src/constants/localStorage.ts @@ -1,5 +1,3 @@ -import { Sign } from 'crypto' - const PREFIX = '@kit' const SETTINGS = 'settings' const THEME = 'theme' diff --git a/packages/kit/src/hooks/data.ts b/packages/kit/src/hooks/data.ts index 6d08ea3c..9e2def6d 100644 --- a/packages/kit/src/hooks/data.ts +++ b/packages/kit/src/hooks/data.ts @@ -547,7 +547,7 @@ const getSwapPrices = async ( const isNativeToken = compareAddress(currencyAddress, zeroAddress) if (currencyAddress && !currencyInfoMap.has(currencyAddress)) { const getNativeTokenInfo = () => - new Promise((resolve, reject) => { + new Promise(resolve => { resolve({ ...network?.nativeToken, logoURI: network?.logoURI || '', diff --git a/packages/kit/src/hooks/useWaasEmailAuth.ts b/packages/kit/src/hooks/useWaasEmailAuth.ts index cd76db90..fa1b184d 100644 --- a/packages/kit/src/hooks/useWaasEmailAuth.ts +++ b/packages/kit/src/hooks/useWaasEmailAuth.ts @@ -1,7 +1,7 @@ import { SequenceWaaS, SignInResponse } from '@0xsequence/waas' import { useState } from 'react' -import { EmailWaasOptions } from '../connectors/email/emailWaas' +// import { EmailWaasOptions } from '../connectors/email/emailWaas' import { randomName } from '../connectors/wagmiConnectors' import { ExtendedConnector } from '../types' @@ -32,10 +32,10 @@ export function useEmailAuth({ } } - const [email, setEmail] = useState('') + const [_email, setEmail] = useState('') const [error, setError] = useState() const [loading, setLoading] = useState(false) - const [instance, setInstance] = useState('') + const [instance, _setInstance] = useState('') const [respondWithCode, setRespondWithCode] = useState<((code: string) => Promise) | null>() const getSequenceWaas = () => { @@ -53,7 +53,7 @@ export function useEmailAuth({ } const initiateAuth = async (email: string) => { - const params = (connector as any).params as EmailWaasOptions + // const params = (connector as any).params as EmailWaasOptions const waas = getSequenceWaas() setLoading(true) @@ -80,8 +80,8 @@ export function useEmailAuth({ } const sendChallengeAnswer = async (answer: string) => { - const params = (connector as any).params as EmailWaasOptions - const waas = getSequenceWaas() + // const params = (connector as any).params as EmailWaasOptions + // const waas = getSequenceWaas() setLoading(true) setError(undefined) diff --git a/packages/kit/src/utils/transactions.ts b/packages/kit/src/utils/transactions.ts index 08014e40..923af1bc 100644 --- a/packages/kit/src/utils/transactions.ts +++ b/packages/kit/src/utils/transactions.ts @@ -1,7 +1,7 @@ import { sequence } from '0xsequence' import { SequenceWaaS } from '@0xsequence/waas' import { PublicClient, WalletClient, Hex } from 'viem' -import { Connector, Config } from 'wagmi' +import { Connector } from 'wagmi' import { TRANSACTION_CONFIRMATIONS_DEFAULT } from '../constants' import { ExtendedConnector } from '../types' diff --git a/packages/wallet/src/contexts/WalletModal.ts b/packages/wallet/src/contexts/WalletModal.ts index 8ed1b193..e65db969 100644 --- a/packages/wallet/src/contexts/WalletModal.ts +++ b/packages/wallet/src/contexts/WalletModal.ts @@ -1,7 +1,5 @@ 'use client' -import React from 'react' - import { createGenericContext } from './genericContext' import { Navigation } from './Navigation' diff --git a/packages/wallet/src/shared/TransactionConfirmation.tsx b/packages/wallet/src/shared/TransactionConfirmation.tsx index 9aeea5df..511b46e1 100644 --- a/packages/wallet/src/shared/TransactionConfirmation.tsx +++ b/packages/wallet/src/shared/TransactionConfirmation.tsx @@ -6,7 +6,7 @@ import { useAccount } from 'wagmi' import { truncateAtMiddle } from '../utils' -import { FeeOption, FeeOptionSelector, type FeeOptionBalance } from './FeeOptionSelector' +import { FeeOption, FeeOptionSelector } from './FeeOptionSelector' import { SendItemInfo } from './SendItemInfo' interface TransactionConfirmationProps { diff --git a/packages/wallet/src/views/SendCoin.tsx b/packages/wallet/src/views/SendCoin.tsx index 7fda3f23..ce8e28eb 100644 --- a/packages/wallet/src/views/SendCoin.tsx +++ b/packages/wallet/src/views/SendCoin.tsx @@ -67,7 +67,7 @@ export const SendCoin = ({ chainId, contractAddress }: SendCoinProps) => { const [isCheckingFeeOptions, setIsCheckingFeeOptions] = useState(false) const [selectedFeeTokenAddress, setSelectedFeeTokenAddress] = useState(null) const checkFeeOptions = useCheckWaasFeeOptions() - const [pendingFeeOption, confirmFeeOption, rejectFeeOption] = useWaasFeeOptions() + const [pendingFeeOption, confirmFeeOption, _rejectFeeOption] = useWaasFeeOptions() const { data: balances = [], isPending: isPendingBalances } = useBalancesSummary({ chainIds: [chainId], diff --git a/packages/wallet/src/views/SendCollectible.tsx b/packages/wallet/src/views/SendCollectible.tsx index e5f14a52..f9450544 100644 --- a/packages/wallet/src/views/SendCollectible.tsx +++ b/packages/wallet/src/views/SendCollectible.tsx @@ -68,7 +68,7 @@ export const SendCollectible = ({ chainId, contractAddress, tokenId }: SendColle const [isCheckingFeeOptions, setIsCheckingFeeOptions] = useState(false) const [selectedFeeTokenAddress, setSelectedFeeTokenAddress] = useState(null) const checkFeeOptions = useCheckWaasFeeOptions() - const [pendingFeeOption, confirmFeeOption, rejectFeeOption] = useWaasFeeOptions() + const [pendingFeeOption, confirmFeeOption, _rejectFeeOption] = useWaasFeeOptions() const { data: tokenBalance, isPending: isPendingBalances } = useCollectibleBalanceDetails({ filter: {