Skip to content

Commit 230d31b

Browse files
committed
reformatting
1 parent aa48e22 commit 230d31b

File tree

12 files changed

+1480
-1527
lines changed

12 files changed

+1480
-1527
lines changed

src/abi/SeaportAbi.ts

Lines changed: 1443 additions & 1487 deletions
Large diffs are not rendered by default.

src/components/cactiComponents/ActionResponse.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import { useEffect, useMemo, useState } from 'react';
22
import Skeleton from 'react-loading-skeleton';
33
import { CheckCircleIcon, ExclamationTriangleIcon } from '@heroicons/react/24/outline';
44
import { ConnectButton } from '@rainbow-me/rainbowkit';
5-
65
import tw from 'tailwind-styled-components';
76
import { TransactionReceipt, TransactionRequestBase, formatUnits, zeroAddress } from 'viem';
8-
import { useAccount, useNetwork, useSwitchNetwork, UsePrepareContractWriteConfig, } from 'wagmi';
9-
7+
import { UsePrepareContractWriteConfig, useAccount, useNetwork, useSwitchNetwork } from 'wagmi';
108
import useToken from '@/hooks/useToken';
119
import { cleanValue } from '@/utils';
1210
import { ActionStepper } from './ActionStepper';
@@ -143,8 +141,7 @@ export const ActionResponse = ({
143141

144142
// explicitly showing approvalParams === undefined for clarity - as oppposed to !approvalParams
145143
if (_approvalParams === undefined) return setHasEnoughBalance(true);
146-
if (BigInt(sendParams?.value || '0') > BigInt(ethBal || '0'))
147-
return setHasEnoughBalance(false);
144+
if (BigInt(sendParams?.value || '0') > BigInt(ethBal || '0')) return setHasEnoughBalance(false);
148145

149146
// check approval token balance
150147
if (balance && _approvalParams?.approvalAmount)

src/components/cactiComponents/hooks/useApproval.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { useMemo } from 'react';
22
import { useQuery } from 'react-query';
3+
import { zeroAddress } from 'viem';
34
import { erc20ABI, useContractWrite, usePrepareContractWrite, useWaitForTransaction } from 'wagmi';
45
import { prepareWriteContract } from 'wagmi/actions';
56
import useChainId from '@/hooks/useChainId';
67
import useToken from '@/hooks/useToken';
78
import { cleanValue } from '@/utils';
89
import useAllowance from './useAllowance';
9-
import { zeroAddress } from 'viem';
1010

1111
export type ApprovalBasicParams = {
1212
approvalAmount: bigint;
@@ -21,7 +21,7 @@ const validateAddress = (addr: `0x${string}`): `0x${string}` | undefined =>
2121
const useApproval = (params: ApprovalBasicParams) => {
2222
const chainId = useChainId();
2323
const { approvalAmount, tokenAddress: _tokenAddress, spender: _spender } = params;
24-
24+
2525
const tokenAddress = validateAddress(_tokenAddress);
2626
const spender = validateAddress(_spender);
2727

@@ -41,7 +41,7 @@ const useApproval = (params: ApprovalBasicParams) => {
4141
// Prepare the approval transaction - doesn't run if address or spender is undefined
4242
const { data: config, isError: isPrepareError } = useQuery({
4343
queryKey: ['prepareApprove', tokenAddress, spender, chainId],
44-
queryFn: async () => {
44+
queryFn: async () => {
4545
// case: invalid spender
4646
if (!spender) {
4747
console.warn(`Spender not found for approval`);
@@ -53,7 +53,7 @@ const useApproval = (params: ApprovalBasicParams) => {
5353
return;
5454
}
5555

56-
const {request} = await prepareWriteContract({
56+
const { request } = await prepareWriteContract({
5757
address: tokenAddress,
5858
abi: erc20ABI,
5959
functionName: 'approve',

src/components/cactiComponents/hooks/useBalance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { useEffect, useState } from 'react';
22
import { useQuery } from 'react-query';
3+
import { zeroAddress } from 'viem';
34
import { useAccount } from 'wagmi';
45
import { fetchBalance, readContract } from 'wagmi/actions';
56
import erc1155ABI from '@/abi/erc1155ABI';
67
import useChainId from '@/hooks/useChainId';
7-
import { zeroAddress } from 'viem';
88

99
/**
1010
* @description gets the balance of a an account for a token address, or if no address is specified, get's eth balance
@@ -42,7 +42,7 @@ const useBalance = (
4242
chainId,
4343
abi: erc1155ABI,
4444
functionName: 'balanceOf',
45-
args: [account, BigInt(erc1155TokenId) ],
45+
args: [account, BigInt(erc1155TokenId)],
4646
});
4747
return erc1155Bal;
4848
}

src/components/current/widgets/rocketPool/rocketPoolWithdraw.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useMemo } from 'react';
22
import { Address, UsePrepareContractWriteConfig } from 'wagmi';
3+
import rETHAbi from '@/abi/rETH';
34
import {
45
ActionResponse,
56
HeaderResponse,
@@ -9,7 +10,6 @@ import {
910
import { ResponseRow } from '@/components/cactiComponents/helpers/layout';
1011
import useToken from '@/hooks/useToken';
1112
import { cleanValue } from '@/utils';
12-
import rETHAbi from '@/abi/rETH';
1313

1414
interface RethProps {
1515
inputString: string;

src/components/current/widgets/transfer/Transfer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemo } from 'react';
2-
import { parseUnits} from 'viem';
2+
import { parseUnits } from 'viem';
33
import { erc20ABI, useAccount, useEnsAddress } from 'wagmi';
44
import { ActionResponse, HeaderResponse } from '@/components/cactiComponents';
55
import useToken from '@/hooks/useToken';
@@ -47,8 +47,8 @@ const Transfer = ({ tokenSymbol, amtString, receiver }: TransferWidgetProps) =>
4747
/>
4848
<ActionResponse
4949
label={`Transfer ${amtString || ''} ${tokenSymbol}`}
50-
txParams={ isETH ? undefined : tx}
51-
approvalParams={undefined} // approval shouldn't be required?
50+
txParams={isETH ? undefined : tx}
51+
approvalParams={undefined} // approval shouldn't be required?
5252
sendParams={isETH ? { to: receiverAddress, value: amount, from: account! } : undefined}
5353
/>
5454
</ConnectFirst>

src/components/current/widgets/uniswap/Uniswap.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Uniswap = ({
4646
const { data: tokenOutChecked } = useToken(tokenOutIsETH ? 'WETH' : tokenOutSymbol);
4747
const input = useInput(inputAmount, tokenInChecked?.symbol!);
4848

49-
const slippage_ = +slippage || 0.5; // in percentage terms
49+
const slippage_ = +slippage || 0.5; // in percentage terms
5050
const getSlippageAdjustedAmount = (amount: bigint) =>
5151
(amount * BigInt(10000 - slippage_ * 100)) / BigInt(10000);
5252

src/components/experimental_/widgets/arbitrum/ArbitrumDeposit.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { useEffect, useMemo, useState } from 'react';
22
import { Erc20Bridger, getL2Network } from '@arbitrum/sdk';
33
import { BigNumber, UnsignedTransaction } from 'ethers';
44
import { Interface } from 'ethers/lib/utils.js';
5-
import { erc20ABI, useAccount, usePrepareContractWrite} from 'wagmi';
5+
import { erc20ABI, useAccount, usePrepareContractWrite } from 'wagmi';
66
import { ActionResponse, HeaderResponse } from '@/components/cactiComponents';
77
import { ApprovalBasicParams } from '@/components/cactiComponents/hooks/useApproval';
88
import useInput from '@/hooks/useInput';
99
import useToken from '@/hooks/useToken';
10-
import Inbox from './abi/Inbox';
1110
import { unsignedTxToTxRequestBase, useEthersProvider } from '@/utils/ethersAdapter';
11+
import Inbox from './abi/Inbox';
1212

1313
interface ArbitrumDepositETHProps {
1414
tokenSymbol: string;
@@ -112,7 +112,7 @@ const ArbitrumDeposit = ({ tokenSymbol, amtString }: ArbitrumDepositETHProps) =>
112112
label={`Deposit ${amount?.formatted || ''} ${tokenSymbol} to Arbitrum`}
113113
txParams={undefined}
114114
approvalParams={erc20ApprovalParams}
115-
sendParams={ unsignedTxToTxRequestBase(sendParams as UnsignedTransaction, account!) }
115+
sendParams={unsignedTxToTxRequestBase(sendParams as UnsignedTransaction, account!)}
116116
/>
117117
</>
118118
);

src/components/experimental_/widgets/arbitrum/ArbitrumWithdraw.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { ActionResponse, HeaderResponse } from '@/components/cactiComponents';
66
import { ApprovalBasicParams } from '@/components/cactiComponents/hooks/useApproval';
77
import useInput from '@/hooks/useInput';
88
import useToken from '@/hooks/useToken';
9+
import { unsignedTxToTxRequestBase, useEthersProvider } from '@/utils/ethersAdapter';
910
import { L2_CHAIN_ID } from './ArbitrumDeposit';
1011
import ArbSys from './abi/ArbSys';
11-
import { unsignedTxToTxRequestBase, useEthersProvider } from '@/utils/ethersAdapter';
1212

1313
interface ArbitrumWithdrawProps {
1414
tokenSymbol: string;
@@ -80,7 +80,7 @@ const ArbitrumWithdraw = ({ tokenSymbol, amtString }: ArbitrumWithdrawProps) =>
8080
label={`Withdraw ${amount?.formatted} ${tokenSymbol} from Arbitrum`}
8181
txParams={undefined}
8282
approvalParams={undefined}
83-
sendParams={ unsignedTxToTxRequestBase(sendParams as UnsignedTransaction, account!) }
83+
sendParams={unsignedTxToTxRequestBase(sendParams as UnsignedTransaction, account!)}
8484
/>
8585
</>
8686
);

src/contexts/ConnectionWrapper.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@ import {
1111
lightTheme,
1212
} from '@rainbow-me/rainbowkit';
1313
import axios from 'axios';
14-
1514
import { Chain, WagmiConfig, configureChains, createConfig, useEnsAvatar } from 'wagmi';
1615
import { arbitrum, goerli, zkSyncTestnet } from 'wagmi/chains';
16+
import { publicProvider } from 'wagmi/providers/public';
1717
import useCachedState from '@/hooks/useCachedState';
1818
import { getBackendApiUrl } from '@/utils/backend';
1919
import { GetSiweMessageOptions, RainbowKitSiweNextAuthProvider } from '@/utils/rainbowSIWEmod';
2020
import SettingsContext from './SettingsContext';
21-
import { publicProvider } from 'wagmi/providers/public'
2221

2322
const ConnectionWrapper = ({ children, useSiwe = true }: any) => {
24-
2523
/* Use a fork url cached in the browser localStorage, else use the .env value */
2624
const [forkUrl] = useCachedState(
2725
'forkUrl',
@@ -47,17 +45,16 @@ const ConnectionWrapper = ({ children, useSiwe = true }: any) => {
4745
},
4846
} as Chain;
4947

48+
const arbitrumFork = {
49+
...arbitrum,
50+
name: 'Arbitrum One Fork',
51+
rpcUrls: {
52+
public: { http: [arbitrum.rpcUrls.public.http[0]] },
53+
default: { http: [process.env.ARBITRUM_FORK_URL] },
54+
},
55+
} as Chain;
5056

51-
const arbitrumFork = {
52-
...arbitrum,
53-
name: 'Arbitrum One Fork',
54-
rpcUrls: {
55-
public: { http: [arbitrum.rpcUrls.public.http[0]] },
56-
default: { http: [process.env.ARBITRUM_FORK_URL] },
57-
},
58-
} as Chain;
59-
60-
const { chains, publicClient, webSocketPublicClient } = configureChains(
57+
const { chains, publicClient, webSocketPublicClient } = configureChains(
6158
[mainnetFork, goerli, zkSyncTestnet, arbitrumFork],
6259
[publicProvider()]
6360
);

0 commit comments

Comments
 (0)