Skip to content

Commit

Permalink
#199 - fix typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianscatularo committed Sep 11, 2023
1 parent 2bd6108 commit 3787479
Show file tree
Hide file tree
Showing 26 changed files with 54 additions and 54 deletions.
6 changes: 3 additions & 3 deletions src/components/ConnectWalletButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import { useSelector } from "react-redux";
import { RootState } from "../store";

const ConnectWalletButton = ({ chainId }: { chainId: ChainId }) => {
const wallet = useWallet(chainId);
const wallet = useWallet(chainId as any);
const changeWallet = useChangeWallet();
const unsetWalletFromChain = useUnsetWalletFromChain();
const [isDialogOpen, setIsDialogOpen] = useState(false);
const [error, setError] = useState<Error | undefined>();
const { wallets: availableWallets, isDetectingWallets } =
useWalletsForChainWithStatus(chainId);
useWalletsForChainWithStatus(chainId as any);
const sourceChain = useSelector(
(state: RootState) => state.transfer.sourceChain
);
Expand Down Expand Up @@ -62,7 +62,7 @@ const ConnectWalletButton = ({ chainId }: { chainId: ChainId }) => {
try {
if (!wallet) return;
await wallet.disconnect();
unsetWalletFromChain(chainId);
unsetWalletFromChain(chainId as any);
setError(undefined);
} catch (err: any) {
console.error(err);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Migration/EvmQuickMigrate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function EvmMigrationLineItem({
}) {
const classes = useStyles();
const { enqueueSnackbar } = useSnackbar();
const { signer, signerAddress } = useEthereumProvider(chainId);
const { signer, signerAddress } = useEthereumProvider(chainId as any);
const poolInfo = useEthereumMigratorInformation(
migratorAddress,
signer,
Expand Down Expand Up @@ -272,7 +272,7 @@ const getAddressBalances = async (

export default function EvmQuickMigrate({ chainId }: { chainId: ChainId }) {
const classes = useStyles();
const { signer, signerAddress } = useEthereumProvider(chainId);
const { signer, signerAddress } = useEthereumProvider(chainId as any);
const { isReady } = useIsWalletReady(chainId);
const migrationMap = useMemo(() => getMigrationAssetMap(chainId), [chainId]);
const eligibleTokens = useMemo(
Expand Down
2 changes: 1 addition & 1 deletion src/components/Migration/EvmWorkflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function EvmWorkflow({
}) {
const classes = useStyles();
const { enqueueSnackbar } = useSnackbar();
const { signer, signerAddress } = useEthereumProvider(chainId);
const { signer, signerAddress } = useEthereumProvider(chainId as any);
const { isReady } = useIsWalletReady(chainId);
const [toggleRefresh, setToggleRefresh] = useState(false);
const forceRefresh = useCallback(
Expand Down
2 changes: 1 addition & 1 deletion src/components/NFTOriginVerifier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function NFTOriginVerifier() {
const classes = useStyles();
const isBeta = useBetaContext();
const [lookupChain, setLookupChain] = useState<ChainId>(CHAIN_ID_ETH);
const { provider, signerAddress } = useEthereumProvider(lookupChain);
const { provider, signerAddress } = useEthereumProvider(lookupChain as any);
const { isReady, statusMessage } = useIsWalletReady(lookupChain);
const [lookupAsset, setLookupAsset] = useState("");
const [lookupTokenId, setLookupTokenId] = useState("");
Expand Down
4 changes: 2 additions & 2 deletions src/components/Recovery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ export default function Recovery() {
const dispatch = useDispatch();
const [recoverySourceChain, setRecoverySourceChain] =
useState<ChainId>(CHAIN_ID_SOLANA);
const { provider } = useEthereumProvider(recoverySourceChain);
const { provider } = useEthereumProvider(recoverySourceChain as any);
const [type, setType] = useState<"Token" | "NFT">("Token");
const isNFT = useMemo(() => type === "NFT", [type]);
const [recoverySourceTx, setRecoverySourceTx] = useState("");
Expand Down Expand Up @@ -645,7 +645,7 @@ export default function Recovery() {
const tokenBridgeAddress =
getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE);
const tokenId = await queryExternalIdInjective(
client,
client as any,
tokenBridgeAddress,
parsedPayload.originAddress
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/TokenSelectors/EvmTokenPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function EvmTokenPicker(
chainId,
nft,
} = props;
const { provider, signerAddress } = useEthereumProvider(chainId);
const { provider, signerAddress } = useEthereumProvider(chainId as any);
const { isReady } = useIsWalletReady(chainId);
const selectedTokenAccount: NFTParsedTokenAccount | undefined = useSelector(
nft
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransactionProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function TransactionProgress({
isSendComplete: boolean;
}) {
const classes = useStyles();
const { provider } = useEthereumProvider(chainId);
const { provider } = useEthereumProvider(chainId as any);
const [currentBlock, setCurrentBlock] = useState(0);
useEffect(() => {
if (isSendComplete || !tx) return;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Transfer/AddToMetamask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function AddToMetamask() {
const tbtcAsset = THRESHOLD_TBTC_CONTRACTS[targetChain];

const { provider, signerAddress, evmChainId, wallet } =
useEthereumProvider(targetChain);
useEthereumProvider(targetChain as any);
const hasCorrectEvmNetwork = evmChainId === getEvmChainId(targetChain);
const handleClick = useCallback(() => {
if (provider && targetAsset && signerAddress && hasCorrectEvmNetwork) {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useAllowance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function useAllowance(
const isTBTC = useSelector(selectTransferIsTBTC);
const sourceChain = useSelector(selectTransferSourceChain);
const isApproveProcessing = useSelector(selectTransferIsApproving);
const { signer } = useEthereumProvider(chainId);
const { signer } = useEthereumProvider(chainId as any);
const sufficientAllowance =
!isEVMChain(chainId) ||
sourceIsNative ||
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useCheckIfWormholeWrapped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function useCheckIfWormholeWrapped(nft?: boolean) {
const setSourceWormholeWrappedInfo = nft
? setNFTSourceWormholeWrappedInfo
: setTransferSourceWormholeWrappedInfo;
const { provider } = useEthereumProvider(sourceChain);
const { provider } = useEthereumProvider(sourceChain as any);
const { accountId: nearAccountId } = useNearContext();
const isRecovery = useSelector(
nft ? selectNFTIsRecovery : selectTransferIsRecovery
Expand Down Expand Up @@ -271,7 +271,7 @@ function useCheckIfWormholeWrapped(nft?: boolean) {
);
const wrappedInfo = makeStateSafe(
await getOriginalAssetAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
BigInt(sourceAsset)
)
Expand Down Expand Up @@ -304,7 +304,7 @@ function useCheckIfWormholeWrapped(nft?: boolean) {
try {
const client = getInjectiveWasmClient();
const wrappedInfo = makeStateSafe(
await getOriginalAssetInjective(sourceAsset, client)
await getOriginalAssetInjective(sourceAsset, client as any)
);
if (!cancelled) {
dispatch(setSourceWormholeWrappedInfo(wrappedInfo));
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useEvmMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function useEvmMetadata(
chainId: ChainId
): DataWrapper<Map<string, EvmMetadata>> {
const { isReady } = useIsWalletReady(chainId, false);
const { provider } = useEthereumProvider(chainId);
const { provider } = useEthereumProvider(chainId as any);

const [isFetching, setIsFetching] = useState(false);
const [error, setError] = useState("");
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useFetchForeignAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function useFetchForeignAsset(
originAsset: string,
foreignChain: ChainId
): DataWrapper<ForeignAssetInfo> {
const { provider, evmChainId } = useEthereumProvider(originChain);
const { provider, evmChainId } = useEthereumProvider(originChain as any);
const { isReady } = useIsWalletReady(foreignChain, false);
const correctEvmNetwork = getEvmChainId(foreignChain);
const hasCorrectEvmNetwork = evmChainId === correctEvmNetwork;
Expand Down Expand Up @@ -208,7 +208,7 @@ function useFetchForeignAsset(
ALGORAND_HOST.algodPort
);
return getForeignAssetAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
originChain,
originAssetHex
Expand All @@ -232,7 +232,7 @@ function useFetchForeignAsset(
const client = getInjectiveWasmClient();
return getForeignAssetInjective(
getTokenBridgeAddressForChain(foreignChain),
client,
client as any,
originChain,
hexToUint8Array(originAssetHex)
);
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useFetchTargetAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function useFetchTargetAsset(nft?: boolean) {
const isTBTC = useSelector(selectTransferIsTBTC);
const activeStep = useSelector(selectTransferActiveStep);
const setTargetAsset = nft ? setNFTTargetAsset : setTransferTargetAsset;
const { provider, evmChainId } = useEthereumProvider(targetChain);
const { provider, evmChainId } = useEthereumProvider(targetChain as any);
const correctEvmNetwork = getEvmChainId(targetChain);
const hasCorrectEvmNetwork = evmChainId === correctEvmNetwork;
const { accountId: nearAccountId } = useNearContext();
Expand Down Expand Up @@ -288,7 +288,7 @@ function useFetchTargetAsset(nft?: boolean) {
const tokenBridgeAddress =
getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE);
const tokenId = await queryExternalIdInjective(
client,
client as any,
tokenBridgeAddress,
originAsset || ""
);
Expand Down Expand Up @@ -580,7 +580,7 @@ function useFetchTargetAsset(nft?: boolean) {
ALGORAND_HOST.algodPort
);
const asset = await getForeignAssetAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
originChain,
originAsset
Expand Down Expand Up @@ -654,7 +654,7 @@ function useFetchTargetAsset(nft?: boolean) {
const client = getInjectiveWasmClient();
const asset = await getForeignAssetInjective(
getTokenBridgeAddressForChain(targetChain),
client,
client as any,
originChain,
hexToUint8Array(originAsset)
);
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useGetIsTransferCompleted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function useGetIsTransferCompleted(
const targetChain = useSelector(selectTransferTargetChain);

const { isReady } = useIsWalletReady(targetChain, false);
const { provider, evmChainId } = useEthereumProvider(targetChain);
const { provider, evmChainId } = useEthereumProvider(targetChain as any);
const { accountId: nearAccountId } = useNearContext();
const signedVAA = useTransferSignedVAA();

Expand Down Expand Up @@ -215,7 +215,7 @@ export default function useGetIsTransferCompleted(
ALGORAND_HOST.algodPort
);
transferCompleted = await getIsTransferCompletedAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
signedVAA
);
Expand Down Expand Up @@ -253,7 +253,7 @@ export default function useGetIsTransferCompleted(
transferCompleted = await getIsTransferCompletedInjective(
getTokenBridgeAddressForChain(targetChain),
signedVAA,
client
client as any
);
} catch (error) {
console.error(error);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useGetSourceParsedTokenAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ function useGetAvailableTokens(nft: boolean = false) {
nft ? selectNFTSourceChain : selectTransferSourceChain
);
const { publicKey: solPK, wallet: solanaWallet } = useSolanaWallet();
const { provider, signerAddress } = useEthereumProvider(lookupChain);
const { provider, signerAddress } = useEthereumProvider(lookupChain as any);
const { address: algoAccount } = useAlgorandWallet();
const { accountId: nearAccountId } = useNearContext();
const { account: aptosAddress } = useAptosContext();
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useGetTargetParsedTokenAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ function useGetTargetParsedTokenAccounts() {
const decimals =
(targetAsset && metadata.data?.get(targetAsset)?.decimals) || undefined;
const { publicKey: solPK, wallet: solanaWallet } = useSolanaWallet();
const terraWallet = useTerraWallet(targetChain);
const terraWallet = useTerraWallet(targetChain as any);
const { provider, signerAddress, evmChainId } =
useEthereumProvider(targetChain);
useEthereumProvider(targetChain as any);
const hasCorrectEvmNetwork = evmChainId === getEvmChainId(targetChain);
const xplaWallet = useXplaWallet();
const { address: algoAccount } = useAlgorandWallet();
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useHandleAttest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async function algo(
ALGORAND_HOST.algodPort
);
const txs = await attestFromAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
ALGORAND_BRIDGE_ID,
wallet.getAddress()!,
Expand Down Expand Up @@ -669,10 +669,10 @@ export function useHandleAttest() {
const isTargetComplete = useSelector(selectAttestIsTargetComplete);
const isSending = useSelector(selectAttestIsSending);
const isSendComplete = useSelector(selectAttestIsSendComplete);
const { signer } = useEthereumProvider(sourceChain);
const { signer } = useEthereumProvider(sourceChain as any);
const { publicKey: solPK, wallet: solanaWallet } = useSolanaWallet();
const { walletAddress: terraAddress, wallet: terraWallet } =
useTerraWallet(sourceChain);
useTerraWallet(sourceChain as any);
const terraFeeDenom = useSelector(selectTerraFeeDenom);
const xplaWallet = useXplaWallet();
const { address: algoAccount, wallet: algoWallet } = useAlgorandWallet();
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useHandleCreateWrapped.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ async function algo(
ALGORAND_HOST.algodPort
);
const txs = await createWrappedOnAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
ALGORAND_BRIDGE_ID,
wallet.getAddress()!,
Expand Down Expand Up @@ -677,8 +677,8 @@ export function useHandleCreateWrapped(
const { publicKey: solPK, wallet: solanaWallet } = useSolanaWallet();
const signedVAA = useAttestSignedVAA();
const isCreating = useSelector(selectAttestIsCreating);
const { signer } = useEthereumProvider(targetChain);
const terraWallet = useTerraWallet(targetChain);
const { signer } = useEthereumProvider(targetChain as any);
const terraWallet = useTerraWallet(targetChain as any);
const terraFeeDenom = useSelector(selectTerraFeeDenom);
const xplaWallet = useXplaWallet();
const { address: algoAccount, wallet: algoWallet } = useAlgorandWallet();
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useHandleNFTRedeem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export function useHandleNFTRedeem() {
const { enqueueSnackbar } = useSnackbar();
const targetChain = useSelector(selectNFTTargetChain);
const { publicKey: solPK, wallet: solanaWallet } = useSolanaWallet();
const { signer } = useEthereumProvider(targetChain);
const { signer } = useEthereumProvider(targetChain as any);
const { account: aptosAccount, wallet: aptosWallet } = useAptosContext();
const signedVAA = useNFTSignedVAA();
const isRedeeming = useSelector(selectNFTIsRedeeming);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useHandleNFTTransfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export function useHandleNFTTransfer() {
const isTargetComplete = useSelector(selectNFTIsTargetComplete);
const isSending = useSelector(selectNFTIsSending);
const isSendComplete = useSelector(selectNFTIsSendComplete);
const { signer } = useEthereumProvider(sourceChain);
const { signer } = useEthereumProvider(sourceChain as any);
const { publicKey: solPK, wallet: solanaWallet } = useSolanaWallet();
const { account: aptosAccount, wallet: aptosWallet } = useAptosContext();
const sourceParsedTokenAccount = useSelector(
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useHandleRedeem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async function algo(
ALGORAND_HOST.algodPort
);
const txs = await redeemOnAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
ALGORAND_BRIDGE_ID,
signedVAA,
Expand Down Expand Up @@ -559,8 +559,8 @@ export function useHandleRedeem() {
const targetChain = useSelector(selectTransferTargetChain);
const isTBTC = useSelector(selectTransferIsTBTC);
const { publicKey: solPK, wallet: solanaWallet } = useSolanaWallet();
const { signer } = useEthereumProvider(targetChain);
const { wallet: terraWallet } = useTerraWallet(targetChain);
const { signer } = useEthereumProvider(targetChain as any);
const { wallet: terraWallet } = useTerraWallet(targetChain as any);
const terraFeeDenom = useSelector(selectTerraFeeDenom);
const xplaWallet = useXplaWallet();
const { address: algoAccount, wallet: algoWallet } = useAlgorandWallet();
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useHandleTransfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ async function algo(
ALGORAND_HOST.algodPort
);
const txs = await transferFromAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
ALGORAND_BRIDGE_ID,
wallet.getAddress()!,
Expand Down Expand Up @@ -1026,9 +1026,9 @@ export function useHandleTransfer() {
const isSending = useSelector(selectTransferIsSending);
const isSendComplete = useSelector(selectTransferIsSendComplete);
const isTBTC = useSelector(selectTransferIsTBTC);
const { signer } = useEthereumProvider(sourceChain);
const { signer } = useEthereumProvider(sourceChain as any);
const { wallet: solanaWallet, publicKey: solPK } = useSolanaWallet();
const { wallet: terraWallet } = useTerraWallet(sourceChain);
const { wallet: terraWallet } = useTerraWallet(sourceChain as any);
const terraFeeDenom = useSelector(selectTerraFeeDenom);
const xplaWallet = useXplaWallet();
const { address: algoAccount, wallet: algoWallet } = useAlgorandWallet();
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useIsWalletReady.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ function useIsWalletReady(
walletAddress?: string;
} {
const { publicKey: solPK } = useSolanaWallet();
const terraWallet = useTerraWallet(chainId);
const terraWallet = useTerraWallet(chainId as any);
const hasTerraWallet = !!terraWallet.wallet;
const {
provider,
signerAddress,
evmChainId,
wallet: evmWallet,
} = useEthereumProvider(chainId);
} = useEthereumProvider(chainId as any);
const hasEthInfo = !!provider && !!signerAddress;
const correctEvmNetwork = getEvmChainId(chainId);
const hasCorrectEvmNetwork = evmChainId === correctEvmNetwork;
Expand Down
Loading

0 comments on commit 3787479

Please sign in to comment.