diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..f84e472 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,25 @@ +name: GitHub Pages + +on: + push: + branches: + - master + pull_request: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2.3.1 + + - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. + run: | + yarn + yarn build + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@4.1.5 + with: + branch: gh-pages # The branch the action should deploy to. + folder: build # The folder the action should deploy. diff --git a/package.json b/package.json index 100c041..b71ae01 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "scripts": { "typechain": "typechain --target=web3-v1 ./src/abis/**/*.json --out-dir src/generated", "start": "react-scripts start", - "build": "react-scripts build", + "build": "react-scripts --max_old_space_size=4096 build", "test": "react-scripts test", "eject": "react-scripts eject", "format": "prettier --write .", @@ -51,20 +51,22 @@ }, "license": "UNLICENSED", "dependencies": { - "@celo-tools/use-contractkit": "npm:@poofcash/use-contractkit@^1.0.1", + "@celo-tools/use-contractkit": "npm:@poofcash/use-contractkit@=1.0.11", "@emotion/react": "^11.4.0", "@emotion/styled": "^11.3.0", "@nomspace/nomspace": "^1.0.5", "@reduxjs/toolkit": "^1.6.0", "@sentry/react": "^6.7.2", "@sentry/tracing": "^6.7.2", + "@types/qrcode.react": "^1.0.2", + "@types/react-modal": "^3.13.1", "@web3-react/injected-connector": "^6.0.7", "ethers": "^5.4.1", "phosphor-react": "^1.3.1", "qrcode.react": "^1.0.1", "react": "17.0.2", "react-dom": "17.0.2", - "react-modal": "^3.14.3", + "react-modal": "^3.14.4", "react-redux": "^7.2.4", "react-router-dom": "^5.2.0", "react-scripts": "^4.0.3", @@ -78,7 +80,7 @@ "*.{html,md,graphql,json,yaml,yml}": "prettier --write" }, "resolutions": { - "@celo/utils": "1.2.1" + "@celo/wallet-walletconnect": "1.2.0" }, "eslintConfig": { "extends": [ diff --git a/src/config.ts b/src/config.ts index d897807..2ce6c4e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,8 +1,8 @@ import { ChainId } from "@celo-tools/use-contractkit"; import { toWei } from "web3-utils"; -export const NOM = { - [ChainId.Mainnet]: "0xABf8faBbC071F320F222A526A2e1fBE26429344d", +export const NOM: Record = { + [ChainId.Celo]: "0xABf8faBbC071F320F222A526A2e1fBE26429344d", [ChainId.Alfajores]: "0x36C976Da6A6499Cad683064F849afa69CD4dec2e", [ChainId.Baklava]: "", }; diff --git a/src/hooks/useCUSD.ts b/src/hooks/useCUSD.ts index 1135c5a..908ff19 100644 --- a/src/hooks/useCUSD.ts +++ b/src/hooks/useCUSD.ts @@ -11,7 +11,9 @@ export const useCUSD = () => { if (!address) { return null; } - const cUSD = await kit._web3Contracts.getStableToken(StableToken.cUSD); + const cUSD = await kit._web3Contracts.getStableToken( + StableToken.cUSD as any + ); const allowance = toBN( await cUSD.methods.allowance(address, FEE_MODULE_V1).call() ); diff --git a/src/hooks/useUserNoms.ts b/src/hooks/useUserNoms.ts index aea95a0..54f9f89 100644 --- a/src/hooks/useUserNoms.ts +++ b/src/hooks/useUserNoms.ts @@ -11,7 +11,7 @@ export const useUserNoms = () => { if (!address) { return null; } - const nomKit = new NomKit(kit as any, NOM[network.chainId]); + const nomKit = new NomKit(kit as any, NOM[network.chainId]!); return await nomKit.userNoms(address); }, [kit, network.chainId, address]); diff --git a/src/index.tsx b/src/index.tsx index 0edbdca..8f2799d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,7 +3,11 @@ import "@celo-tools/use-contractkit/lib/styles.css"; import "react-toastify/dist/ReactToastify.min.css"; import "src/index.css"; -import { ContractKitProvider } from "@celo-tools/use-contractkit"; +import { + Alfajores, + Celo, + ContractKitProvider, +} from "@celo-tools/use-contractkit"; import * as Sentry from "@sentry/react"; import { Integrations } from "@sentry/tracing"; import React from "react"; @@ -12,7 +16,7 @@ import { Provider } from "react-redux"; import store from "src/state"; import theme from "src/theme"; import { ThemeProvider } from "theme-ui"; -import { BrowserRouter as Router } from "react-router-dom"; +import { HashRouter as Router } from "react-router-dom"; import App from "./App"; import * as serviceWorker from "./serviceWorker"; @@ -46,6 +50,7 @@ ReactDOM.render( description: "Protocol for name registration", url: "https://app.nom.space", icon: "https://www.nom.space/favicon-32x32.png", + supportedNetworks: [Celo, Alfajores], }} > diff --git a/src/pages/Extend/index.tsx b/src/pages/Extend/index.tsx index 5ef2df4..f3ba59b 100644 --- a/src/pages/Extend/index.tsx +++ b/src/pages/Extend/index.tsx @@ -55,7 +55,7 @@ export const Extend: React.FC = () => { try { setApproveLoading(true); const cUSD = await kit._web3Contracts.getStableToken( - StableToken.cUSD + StableToken.cUSD as any ); const tx = await cUSD.methods .approve(FEE_MODULE_V1, MaxUint256.toString()) @@ -65,7 +65,7 @@ export const Extend: React.FC = () => { }); toastTx(tx.transactionHash); refetchCUSD(); - } catch (e) { + } catch (e: any) { toast(e.message); } finally { setApproveLoading(false); @@ -99,7 +99,7 @@ export const Extend: React.FC = () => { }); toastTx(tx.transactionHash); refetchNom(); - } catch (e) { + } catch (e: any) { toast(e.message); } finally { setExtendLoading(false); diff --git a/src/pages/Request/index.tsx b/src/pages/Request/index.tsx index dc9f7be..a7abde3 100644 --- a/src/pages/Request/index.tsx +++ b/src/pages/Request/index.tsx @@ -42,7 +42,7 @@ export const Request: React.FC = () => { if (!kit || !nom) { return; } - const cUSD = await kit.contracts.getStableToken(StableToken.cUSD); + const cUSD = await kit.contracts.getStableToken(StableToken.cUSD as any); const tx = await cUSD .transfer(nom.resolution, toWei(amount)) .send({ from: kit.defaultAccount, gasPrice: toWei("0.5", "gwei") }); diff --git a/src/pages/Reserve/index.tsx b/src/pages/Reserve/index.tsx index 430aa9b..7a5aa8a 100644 --- a/src/pages/Reserve/index.tsx +++ b/src/pages/Reserve/index.tsx @@ -55,7 +55,7 @@ export const Reserve: React.FC = () => { try { setApproveLoading(true); const cUSD = await kit._web3Contracts.getStableToken( - StableToken.cUSD + StableToken.cUSD as any ); const tx = await cUSD.methods .approve(FEE_MODULE_V1, MaxUint256.toString()) @@ -65,7 +65,7 @@ export const Reserve: React.FC = () => { }); toastTx(tx.transactionHash); refetchCUSD(); - } catch (e) { + } catch (e: any) { toast(e.message); } finally { setApproveLoading(false); @@ -99,7 +99,7 @@ export const Reserve: React.FC = () => { }); toastTx(tx.transactionHash); refetchNom(); - } catch (e) { + } catch (e: any) { toast(e.message); } finally { setReserveLoading(false); diff --git a/src/pages/SearchDetail/index.tsx b/src/pages/SearchDetail/index.tsx index 9ad5412..ffaa0cb 100644 --- a/src/pages/SearchDetail/index.tsx +++ b/src/pages/SearchDetail/index.tsx @@ -163,7 +163,7 @@ export const SearchDetail: React.FC = () => { }); toastTx(tx.transactionHash); refetchNom(); - } catch (e) { + } catch (e: any) { toast(e.message); } finally { setChangeOwnerLoading(false); @@ -191,7 +191,7 @@ export const SearchDetail: React.FC = () => {