Skip to content

Commit

Permalink
More lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
corbanbrook committed Jan 16, 2025
1 parent b0f99d2 commit 8dac8b2
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 47 deletions.
2 changes: 0 additions & 2 deletions packages/checkout/src/contexts/TransactionStatusModal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Hex } from 'viem'

import { createGenericContext } from './genericContext'

interface Item {
Expand Down
8 changes: 2 additions & 6 deletions packages/checkout/src/hooks/useERC1155SaleContractCheckout.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/checkout/src/hooks/useSkipOnCloseCallback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef, MutableRefObject } from 'react'
import { useEffect, useRef } from 'react'

interface UseSkipOnCloseCallbackReturn {
skipOnCloseCallback: () => void
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 8 additions & 9 deletions packages/checkout/src/views/PaymentSelection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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] : [],
Expand All @@ -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,
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 0 additions & 2 deletions packages/kit/src/constants/localStorage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Sign } from 'crypto'

const PREFIX = '@kit'
const SETTINGS = 'settings'
const THEME = 'theme'
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/hooks/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ const getSwapPrices = async (
const isNativeToken = compareAddress(currencyAddress, zeroAddress)
if (currencyAddress && !currencyInfoMap.has(currencyAddress)) {
const getNativeTokenInfo = () =>
new Promise<ContractInfo>((resolve, reject) => {
new Promise<ContractInfo>(resolve => {
resolve({
...network?.nativeToken,
logoURI: network?.logoURI || '',
Expand Down
12 changes: 6 additions & 6 deletions packages/kit/src/hooks/useWaasEmailAuth.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -32,10 +32,10 @@ export function useEmailAuth({
}
}

const [email, setEmail] = useState('')
const [_email, setEmail] = useState('')
const [error, setError] = useState<Error | undefined>()
const [loading, setLoading] = useState(false)
const [instance, setInstance] = useState('')
const [instance, _setInstance] = useState('')
const [respondWithCode, setRespondWithCode] = useState<((code: string) => Promise<void>) | null>()

const getSequenceWaas = () => {
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/utils/transactions.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 0 additions & 2 deletions packages/wallet/src/contexts/WalletModal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client'

import React from 'react'

import { createGenericContext } from './genericContext'
import { Navigation } from './Navigation'

Expand Down
2 changes: 1 addition & 1 deletion packages/wallet/src/shared/TransactionConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet/src/views/SendCoin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const SendCoin = ({ chainId, contractAddress }: SendCoinProps) => {
const [isCheckingFeeOptions, setIsCheckingFeeOptions] = useState(false)
const [selectedFeeTokenAddress, setSelectedFeeTokenAddress] = useState<string | null>(null)
const checkFeeOptions = useCheckWaasFeeOptions()
const [pendingFeeOption, confirmFeeOption, rejectFeeOption] = useWaasFeeOptions()
const [pendingFeeOption, confirmFeeOption, _rejectFeeOption] = useWaasFeeOptions()

const { data: balances = [], isPending: isPendingBalances } = useBalancesSummary({
chainIds: [chainId],
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet/src/views/SendCollectible.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const SendCollectible = ({ chainId, contractAddress, tokenId }: SendColle
const [isCheckingFeeOptions, setIsCheckingFeeOptions] = useState(false)
const [selectedFeeTokenAddress, setSelectedFeeTokenAddress] = useState<string | null>(null)
const checkFeeOptions = useCheckWaasFeeOptions()
const [pendingFeeOption, confirmFeeOption, rejectFeeOption] = useWaasFeeOptions()
const [pendingFeeOption, confirmFeeOption, _rejectFeeOption] = useWaasFeeOptions()

const { data: tokenBalance, isPending: isPendingBalances } = useCollectibleBalanceDetails({
filter: {
Expand Down

0 comments on commit 8dac8b2

Please sign in to comment.