Skip to content

chore: upgrade from use-contractkit to react-celo #676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,14 @@
},
"license": "GPL-3.0-or-later",
"resolutions": {
"@celo/wallet-walletconnect": "1.2.0",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure why this was here, but i was worried it could cause issues with react-celo (because it's such an old version), so I removed it.

"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3",
"prettier": "^2.3.0"
},
"dependencies": {
"@apollo/client": "^3.6.5",
"@celo-tools/use-contractkit": "^3.1.0",
"@celo/contractkit": "^1.2.0",
"@celo/contractkit": "^3.2.0",
"@celo/react-celo": "^4.3.0",
"@celo/utils": "^1.2.1",
"@craco/craco": "^6.1.2",
"@emotion/react": "^11.10.5",
Expand Down
2 changes: 1 addition & 1 deletion src/components/AccountDetails/Transaction.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import React from 'react'
import { CheckCircle, Triangle } from 'react-feather'
Expand Down
2 changes: 1 addition & 1 deletion src/components/AccountDetails/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit, WalletTypes } from '@celo-tools/use-contractkit'
import { useContractKit, WalletTypes } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import React, { useCallback, useContext } from 'react'
import { ExternalLink as LinkIcon } from 'react-feather'
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddressInputPanel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import React, { useCallback, useContext } from 'react'
import { useTranslation } from 'react-i18next'
Expand Down
2 changes: 1 addition & 1 deletion src/components/CurrencyInputPanel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, useContractKit } from '@celo-tools/use-contractkit'
import { ChainId, useContractKit } from '@celo/react-celo'
import { Pair, Token, TokenAmount } from '@ubeswap/sdk'
import { darken } from 'polished'
import React, { useCallback, useState } from 'react'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/OpticsV1Warning.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { JSBI, Token } from '@ubeswap/sdk'
import { AutoColumn, TopSection } from 'components/Column'
import { CardSection } from 'components/earn/styled'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/Polling.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import React, { useEffect, useState } from 'react'
import styled, { keyframes } from 'styled-components'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/URLWarning.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import React from 'react'
import { isMobile } from 'react-device-detect'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/UbeBalanceContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId as UbeswapChainId, TokenAmount } from '@ubeswap/sdk'
import Loader from 'components/Loader'
import React from 'react'
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'rc-drawer/assets/index.css'

import { ChainId, useContractKit } from '@celo-tools/use-contractkit'
import { ChainId, useContractKit } from '@celo/react-celo'
import { CELO, ChainId as UbeswapChainId, TokenAmount } from '@ubeswap/sdk'
import { CardNoise } from 'components/earn/styled'
import Modal from 'components/Modal'
Expand Down Expand Up @@ -358,7 +358,7 @@ const NETWORK_LABELS: { [chainId in ChainId]?: string } = {

export default function Header() {
const { address: account, network } = useContractKit()
const chainId = network.chainId
const chainId = network.chainId as UbeswapChainId
const { t } = useTranslation()

const userCELOBalance = useTokenBalance(account ?? undefined, CELO[chainId as unknown as UbeswapChainId])
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/useCirculatingSupply.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId as UbeswapChainId, JSBI, TokenAmount } from '@ubeswap/sdk'
import { UBE } from 'constants/tokens'
import { BigNumber } from 'ethers'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Identicon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import Jazzicon from 'jazzicon'
import React, { useEffect, useRef } from 'react'
import styled from 'styled-components'
Expand Down
2 changes: 1 addition & 1 deletion src/components/LimitOrderHistory/LimitOrderHistoryItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId as UbeswapChainId, JSBI, Token, TokenAmount } from '@ubeswap/sdk'
import { BigNumber } from 'ethers'
import { useToken } from 'hooks/Tokens'
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModalViews/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import React, { useContext } from 'react'
import { ArrowUpCircle } from 'react-feather'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popups/TransactionPopup.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import React, { useContext } from 'react'
import { AlertCircle, CheckCircle } from 'react-feather'
Expand Down
2 changes: 1 addition & 1 deletion src/components/PositionCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { JSBI, Pair, Percent, TokenAmount } from '@ubeswap/sdk'
import { darken, transparentize } from 'polished'
import React, { useState } from 'react'
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchModal/ChainSearchModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Network } from '@celo-tools/use-contractkit'
import { Network } from '@celo/react-celo'
import CurrencyLogo from 'components/CurrencyLogo'
import React, { useCallback } from 'react'
import { WrappedTokenInfo } from 'state/lists/hooks'
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchModal/CurrencyList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { currencyEquals, Token, TokenAmount } from '@ubeswap/sdk'
import React, { CSSProperties, MutableRefObject, useCallback } from 'react'
import { FixedSizeList } from 'react-window'
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchModal/CurrencySearch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from '@celo-tools/use-contractkit'
import { ChainId } from '@celo/react-celo'
import { ChainId as UbeswapChainId, cUSD, Token } from '@ubeswap/sdk'
import { ButtonLight } from 'components/Button'
import { useOnClickOutside } from 'hooks/useOnClickOutside'
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchModal/CurrencySearchModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from '@celo-tools/use-contractkit'
import { ChainId } from '@celo/react-celo'
import { Token } from '@ubeswap/sdk'
import { TokenList } from '@uniswap/token-lists'
import usePrevious from 'hooks/usePrevious'
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchModal/ImportRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { Token } from '@ubeswap/sdk'
import { ButtonPrimary } from 'components/Button'
import { AutoColumn } from 'components/Column'
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchModal/ImportToken.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId, Token } from '@ubeswap/sdk'
import { ButtonPrimary } from 'components/Button'
import Card from 'components/Card'
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchModal/ManageTokens.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId, Token } from '@ubeswap/sdk'
import Card from 'components/Card'
import Column from 'components/Column'
Expand Down
5 changes: 3 additions & 2 deletions src/components/Stake/ChangeDelegateModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import { ButtonError } from 'components/Button'
import { SearchInput } from 'components/SearchModal/styleds'
import { useDoTransaction } from 'components/swap/routing'
Expand Down Expand Up @@ -36,7 +37,7 @@ export default function ChangeDelegateModal({ isOpen, onDismiss }: ChangeDelegat
const [delegateAddress, setDelegateAddress] = useState<string>('')
const [error, setError] = useState<string | undefined>('ChangeDelegate')

const romulusAddress = ubeGovernanceAddresses[network.chainId]
const romulusAddress = ubeGovernanceAddresses[network.chainId as ChainId]
const { tokenAddress } = useRomulusInfo(romulusAddress)
const c = usePoofTokenContract(tokenAddress)
const doTransaction = useDoTransaction()
Expand Down
12 changes: 6 additions & 6 deletions src/components/Stake/Proposals/ProposalCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useContractKit, useProvider } from '@celo-tools/use-contractkit'
import { useContractKit, useProvider } from '@celo/react-celo'
import { ExternalProvider, JsonRpcSigner, Web3Provider } from '@ethersproject/providers'
import { JSBI, TokenAmount } from '@ubeswap/sdk'
import { ChainId, JSBI, TokenAmount } from '@ubeswap/sdk'
import { StyledControlButton } from 'components/LimitOrderHistory/LimitOrderHistoryItem'
import { BigNumber } from 'ethers'
import { getAddress } from 'ethers/lib/utils'
Expand Down Expand Up @@ -114,13 +114,13 @@ export const useGetConnectedSigner = (): (() => Promise<JsonRpcSigner>) => {
const library = useProvider()
const signer = getProviderOrSigner(library, address || undefined)
return useCallback(async () => {
if (kit.defaultAccount) {
if (kit.connection.web3.defaultAccount) {
return signer as JsonRpcSigner
}
const connector = await connect()
const nextKit = await connector.initialise()
const nextProvider = nextKit.kit.web3.currentProvider as unknown as ExternalProvider
return new Web3Provider(nextProvider).getSigner(nextKit.kit.defaultAccount)
const nextProvider = nextKit.kit.connection.web3.currentProvider as unknown as ExternalProvider
return new Web3Provider(nextProvider).getSigner(nextKit.kit.connection.web3.defaultAccount!)
}, [signer, kit, connect])
}

Expand Down Expand Up @@ -175,7 +175,7 @@ export const ProposalCard: React.FC<IProps> = ({ proposalEvent, clickable, showI
timeText: undefined,
})
const getConnectedSigner = useGetConnectedSigner()
const romulusAddress = ubeGovernanceAddresses[network.chainId]
const romulusAddress = ubeGovernanceAddresses[network.chainId as ChainId]
const [latestBlockNumber] = useLatestBlockNumber()
const { proposal, proposalState } = useProposal((romulusAddress as string) || '', proposalEvent.args.id)
const { votingPower, releaseVotingPower } = useVotingTokens(proposalEvent.args.startBlock)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Stake/StakeInputField.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, useContractKit } from '@celo-tools/use-contractkit'
import { ChainId, useContractKit } from '@celo/react-celo'
import { Token, TokenAmount } from '@ubeswap/sdk'
import { darken } from 'polished'
import React from 'react'
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransactionConfirmationModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import React, { useContext } from 'react'
import { AlertTriangle, ArrowUpCircle } from 'react-feather'
Expand Down
2 changes: 1 addition & 1 deletion src/components/WalletModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import React, { useEffect, useState } from 'react'
import { isMobile } from 'react-device-detect'
import { useTranslation } from 'react-i18next'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Web3Status/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit, WalletTypes } from '@celo-tools/use-contractkit'
import { useContractKit, WalletTypes } from '@celo/react-celo'
import * as Sentry from '@sentry/react'
import useAccountSummary from 'hooks/useAccountSummary'
import { darken, lighten } from 'polished'
Expand Down
2 changes: 1 addition & 1 deletion src/components/earn/ClaimRewardModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { TokenAmount } from '@ubeswap/sdk'
import { useDoTransaction } from 'components/swap/routing'
import zip from 'lodash/zip'
Expand Down
2 changes: 1 addition & 1 deletion src/components/earn/PoolCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { formatEther } from '@ethersproject/units'
import { JSBI, TokenAmount } from '@ubeswap/sdk'
import CurrencyLogo from 'components/CurrencyLogo'
Expand Down
2 changes: 1 addition & 1 deletion src/components/earn/StakingModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useProvider } from '@celo-tools/use-contractkit'
import { useProvider } from '@celo/react-celo'
import { Pair, TokenAmount } from '@ubeswap/sdk'
import Loader from 'components/Loader'
import { useDoTransaction } from 'components/swap/routing'
Expand Down
2 changes: 1 addition & 1 deletion src/components/earn/UnstakingModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { useDoTransaction } from 'components/swap/routing'
import { CustomStakingInfo } from 'pages/Earn/useCustomStakingInfo'
import React, { useState } from 'react'
Expand Down
2 changes: 1 addition & 1 deletion src/components/swap/UnsupportedCurrencyFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId, Token } from '@ubeswap/sdk'
import { ButtonEmpty } from 'components/Button'
import Card, { OutlineCard } from 'components/Card'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { CELO, ChainId as UbeswapChainId, cUSD, Fraction, TokenAmount, TradeType } from '@ubeswap/sdk'
import { ErrorText } from 'components/swap/styleds'
import { usePair } from 'data/Reserves'
Expand Down
2 changes: 1 addition & 1 deletion src/components/swap/routing/hooks/directTrades.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { Pair, Token, TokenAmount, Trade } from '@ubeswap/sdk'
import flatMap from 'lodash.flatmap'
import { useMemo } from 'react'
Expand Down
6 changes: 3 additions & 3 deletions src/components/swap/routing/hooks/useTrade.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, useContractKit, useProvider } from '@celo-tools/use-contractkit'
import { ChainId, useContractKit, useProvider } from '@celo/react-celo'
import { currencyEquals, JSBI, Pair, Percent, Price, Token, TokenAmount, Trade, TradeType } from '@ubeswap/sdk'
import { ERC20_ABI } from 'constants/abis/erc20'
import {
Expand Down Expand Up @@ -325,7 +325,7 @@ export function useMinimaTrade(tokenAmountIn?: TokenAmount, tokenOut?: Token): M
const [fetchUpdatedData, setFetchUpdatedData] = React.useState<boolean>(true)
const [fetchTimeout, setFetchTimeout] = React.useState<NodeJS.Timeout | undefined>(undefined)
const { address: account, network } = useContractKit()
const { chainId } = network
const chainId = network.chainId as ChainId
const library = useProvider()
const provider = getProviderOrSigner(library, account || undefined)
const tokens = useAllTokens()
Expand All @@ -337,7 +337,7 @@ export function useMinimaTrade(tokenAmountIn?: TokenAmount, tokenOut?: Token): M
}
const curDeps = {
chainId,
account,
account: account || null,
allowedSlippage,
singleHopOnly,
inputAddr: tokenAmountIn.currency.address,
Expand Down
2 changes: 1 addition & 1 deletion src/components/swap/routing/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit, useGetConnectedSigner } from '@celo-tools/use-contractkit'
import { useContractKit, useGetConnectedSigner } from '@celo/react-celo'
import { JsonRpcSigner, TransactionRequest } from '@ethersproject/providers'
import { ChainId, Trade } from '@ubeswap/sdk'
import { BigNumber, BigNumberish, CallOverrides, Contract, ContractTransaction, PayableOverrides } from 'ethers'
Expand Down
2 changes: 1 addition & 1 deletion src/components/swap/routing/limit/queueLimitOrderTrade.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useGetConnectedSigner } from '@celo-tools/use-contractkit'
import { useGetConnectedSigner } from '@celo/react-celo'
import { ChainId, TokenAmount } from '@ubeswap/sdk'
import { LimitOrderProtocol__factory } from 'generated/factories/LimitOrderProtocol__factory'
import { OrderBook__factory } from 'generated/factories/OrderBook__factory'
Expand Down
2 changes: 1 addition & 1 deletion src/components/swap/routing/moola/useMoola.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CeloContract } from '@celo/contractkit'
import { useContractKit, useProvider } from '@celo-tools/use-contractkit'
import { useContractKit, useProvider } from '@celo/react-celo'
import { CELO, ChainId, cREAL, currencyEquals, cUSD, Token } from '@ubeswap/sdk'
import { CEUR, MCELO, MCEUR, MCREAL, MCUSD } from 'constants/index'
import { useMemo } from 'react'
Expand Down
2 changes: 1 addition & 1 deletion src/components/swap/routing/moola/useMoolaDirectRoute.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit, useProvider } from '@celo-tools/use-contractkit'
import { useContractKit, useProvider } from '@celo/react-celo'
import { ChainId, currencyEquals, JSBI, Pair, Route, Token, TokenAmount } from '@ubeswap/sdk'
import { useMemo } from 'react'
import { useUserAllowMoolaWithdrawal } from 'state/user/hooks'
Expand Down
2 changes: 1 addition & 1 deletion src/components/swap/routing/useTradeCallback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit, useProvider } from '@celo-tools/use-contractkit'
import { useContractKit, useProvider } from '@celo/react-celo'
import { ChainId, Trade } from '@ubeswap/sdk'
import useENS from 'hooks/useENS'
import { SwapCallbackState, useSwapCallback } from 'hooks/useSwapCallback'
Expand Down
2 changes: 1 addition & 1 deletion src/constants/multicall/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from '@celo-tools/use-contractkit'
import { ChainId } from '@celo/react-celo'

import MULTICALL_ABI from './abi.json'

Expand Down
2 changes: 1 addition & 1 deletion src/constants/poolManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from '@celo-tools/use-contractkit'
import { ChainId } from '@celo/react-celo'

//todo: replace Mainnet and Baklava PoolManager Addresses
export const POOL_MANAGER: Record<number, string> = {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/Tokens.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, useContractKit } from '@celo-tools/use-contractkit'
import { ChainId, useContractKit } from '@celo/react-celo'
import { parseBytes32String } from '@ethersproject/strings'
import { currencyEquals, Token } from '@ubeswap/sdk'
import { arrayify } from 'ethers/lib/utils'
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/romulus/useProposals.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId } from '@ubeswap/sdk'
import { BigNumber } from 'ethers'
import { TypedEvent } from 'generated/common'
import { useRomulusDelegateContract } from 'hooks/useContract'
Expand All @@ -20,7 +21,7 @@ type Proposal = [BigNumber, string, string[], BigNumber[], string[], string[], B

export const useProposals = (): Array<TypedEvent<Proposal>> | undefined => {
const { network } = useContractKit()
const romulusAddress = ubeGovernanceAddresses[network.chainId]
const romulusAddress = ubeGovernanceAddresses[network.chainId as ChainId]
const romulusContract = useRomulusDelegateContract(romulusAddress)
const [proposals, setProposals] = useState<Array<TypedEvent<Proposal>> | undefined>(undefined)
const mountRef = useRef(true)
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/romulus/useRomulus.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address } from '@celo/contractkit'
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId as UbeswapChainId, JSBI, TokenAmount } from '@ubeswap/sdk'
import { usePoofTokenContract } from 'hooks/useContract'
import { useMemo } from 'react'
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/romulus/useVoteCasts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address } from '@celo/contractkit'
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { BigNumber } from 'ethers'
import { TypedEvent } from 'generated/common'
import { useRomulusDelegateContract } from 'hooks/useContract'
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/romulus/useVotingTokens.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContractKit } from '@celo-tools/use-contractkit'
import { useContractKit } from '@celo/react-celo'
import { ChainId as UbeswapChainId, JSBI, TokenAmount } from '@ubeswap/sdk'
import { BigNumber } from 'ethers'
import { usePoofTokenContract } from 'hooks/useContract'
Expand All @@ -24,7 +24,7 @@ type VotingInfo = {

export const useVotingTokens = (blockNumber: BigNumber | number): VotingInfo => {
const { address, network } = useContractKit()
const chainId = network.chainId
const chainId = network.chainId as UbeswapChainId
const romulusAddress = chainId ? ubeGovernanceAddresses[chainId] : undefined
const ube = chainId ? UBE[chainId as unknown as UbeswapChainId] : undefined
const { tokenAddress, releaseTokenAddress } = useRomulusInfo(romulusAddress)
Expand Down
Loading