Skip to content
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

feat: add multi-chain support #506

Merged
merged 37 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
30bf627
feat: add multi-chain support
superical Dec 8, 2021
658072a
chore: temporary oa-verify for trial run and testing; to be removed
superical Dec 22, 2021
0cd713c
fix: test env for headless test
superical Dec 22, 2021
e5cdbc7
refactor: make mainnet the default network when in production
superical Dec 23, 2021
a6db94b
docs: add comment for getSupportedChainInfo
superical Dec 23, 2021
6602d44
refactor: clean up index import in network-config.ts
superical Dec 23, 2021
b02d11b
refactor: clean up build commands for deployment
superical Dec 23, 2021
84c4306
refactor: clean up chain config files
superical Dec 23, 2021
e967a11
refactor: multiple ternaries in verify/index.tsx
superical Dec 30, 2021
a5bd4e2
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Dec 30, 2021
c1e9f2d
chore: resolve conflicts with changes from master
superical Dec 30, 2021
7c950bb
chore: fix ts conflict with changes from master in config file
superical Dec 30, 2021
693fd24
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Dec 31, 2021
3a8ffea
refactor: review feedback to change iife to normal function
superical Dec 31, 2021
7ed8ac9
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Dec 31, 2021
4a155bc
fix: merge conflict issues from new changes in master
superical Jan 3, 2022
0ef71b3
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Jan 5, 2022
508820b
chore: update oa-verify to v7.8.0
superical Jan 5, 2022
e9d0b4e
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Jan 7, 2022
4954f56
refactor: remove slash in oa-verify import in provider.tsx
superical Jan 17, 2022
c4bd296
refactor: change findIndex to some in provider.tsx
superical Jan 17, 2022
14e486a
refactor: remove catch block
superical Jan 17, 2022
a330606
refactor: move constants from webpack to config file
superical Jan 17, 2022
5a84206
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Jan 17, 2022
e7d904f
refactor: catch block in AssetManagementApplication
superical Jan 18, 2022
c93da8d
refactor: review feedback to add console log for chain error
superical Jan 18, 2022
02dfed8
refactor: update dropdown to use latest version of ui components package
superical Jan 25, 2022
5d8a02b
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Jan 25, 2022
f93b8d1
feat: migrate to tailwindcss from styled
osslgtm Feb 3, 2022
2cebcdb
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Feb 16, 2022
22f4f44
Merge branch 'feat/multi-chain' into feat/tailwindcss-migration
osslgtm Feb 17, 2022
9d9da2e
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Feb 21, 2022
1b88775
fix: merge conflict in package lock file
superical Feb 21, 2022
8420946
Revert "feat: migrate to tailwindcss from styled"
superical Feb 21, 2022
183ff6c
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Feb 23, 2022
be3ce0d
feat: Tailwind CSS Migration from @emotion/styled (#542, #525)
osslgtm Feb 23, 2022
9ed1fb6
Merge remote-tracking branch 'origin/master' into feat/multi-chain
superical Feb 24, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Test
run: npm run test
- name: Build
run: npm run build
run: npm run build:test
- name: Integration - testcafe
run: npm run integration:headless
- name: Integration - dappeteer
Expand Down
150 changes: 137 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
"blockchain": "ganache-cli --mnemonic \"indicate swing place chair flight used hammer soon photo region volume shuffle\"",
"blockchain:contracts": "node --experimental-modules ./integration/local/setup-contracts.mjs",
"build": "run-s check-types build:css build:app",
"build:css": "cross-env NODE_ENV=production postcss src/tailwind.css -o src/index.css",
"build:app": "cross-env NODE_ENV=production webpack --progress --mode production",
"build:dev": "cross-env NODE_ENV=development npm run build",
"build:test": "cross-env NODE_ENV=test npm run build",
"build:prod": "cross-env NODE_ENV=production NET=mainnet npm run build",
simboonlong marked this conversation as resolved.
Show resolved Hide resolved
"build:css": "postcss src/tailwind.css -o src/index.css",
"build:app": "webpack --progress --mode production",
"check-types": "tsc --sourceMap false --noEmit",
"dev": "run-p dev:*",
"dev:css": "postcss src/tailwind.css -o src/index.css --watch",
Expand Down Expand Up @@ -43,7 +46,7 @@
"@govtechsg/decentralized-renderer-react-components": "^3.6.2",
"@govtechsg/ethers-contract-hook": "^2.2.0",
"@govtechsg/oa-encryption": "^1.3.3",
"@govtechsg/oa-verify": "^7.7.0",
"@govtechsg/oa-verify": "git+https://github.com/Open-Attestation/oa-verify.git#feat/add-networks",
"@govtechsg/open-attestation": "^6.2.0",
simboonlong marked this conversation as resolved.
Show resolved Hide resolved
"@govtechsg/open-attestation-cli": "^1.40.4",
"@govtechsg/token-registry": "2.5.1",
Expand Down
58 changes: 58 additions & 0 deletions public/static/demo/goerli.tt

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions public/static/demo/maticmum.tt

Large diffs are not rendered by default.

Binary file added public/static/images/networks/ethereum.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static/images/networks/polygon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions src/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import React, { useEffect, useState } from "react";
import { useLocation } from "react-router-dom";
import { Footer } from "./components/Layout/Footer";
import { NavigationBar, leftNavItems, rightNavItems } from "./components/Layout/NavigationBar";
import { NETWORK } from "./config";
import { Routes, routes } from "./routes";
import styled from "@emotion/styled";
import { useProviderContext } from "./common/contexts/provider";
import { getChainInfo } from "./common/utils/chain-utils";

const Main = styled.main`
background-image: url("/static/images/common/wave-lines.png");
Expand All @@ -15,16 +16,19 @@ const Main = styled.main`
const AppContainer = (): React.ReactElement => {
const location = useLocation();
const [toggleNavBar, setToggleNavBar] = useState(false);
const { currentChainId } = useProviderContext();

useEffect(() => {
setToggleNavBar(false);
window.scrollTo(0, 0);
}, [location]);

const networkName = currentChainId ? getChainInfo(currentChainId).label : "Unsupported";

return (
<div className="flex flex-col min-h-full" data-location={location.pathname}>
<NetworkBar network={NETWORK}>
You are currently on <span className="capitalize">{NETWORK}</span> network.
<NetworkBar network={networkName}>
You are currently on <span className="capitalize">{networkName}</span> network.
</NetworkBar>
<NavigationBar
toggleNavBar={toggleNavBar}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ export const TokenInformationContextProvider: FunctionComponent<TokenInformation
}) => {
const [tokenId, setTokenId] = useState<string>();
const [tokenRegistryAddress, setTokenRegistryAddress] = useState<string>();
const { provider } = useProviderContext();
const { tokenRegistry } = useTokenRegistryContract(tokenRegistryAddress, provider);
const { titleEscrow, updateTitleEscrow, documentOwner } = useTitleEscrowContract(provider, tokenRegistry, tokenId);
const { getTransactor } = useProviderContext();
const transactor = getTransactor();
const { tokenRegistry } = useTokenRegistryContract(tokenRegistryAddress, transactor);
const { titleEscrow, updateTitleEscrow, documentOwner } = useTitleEscrowContract(transactor, tokenRegistry, tokenId);
const isSurrendered = documentOwner === tokenRegistryAddress;
const isTokenBurnt = documentOwner === "0x000000000000000000000000000000000000dEaD"; // check if the token belongs to burn address.

Expand All @@ -98,7 +99,7 @@ export const TokenInformationContextProvider: FunctionComponent<TokenInformation
reset: resetDestroyingTokenState,
} = useContractFunctionHook(tokenRegistry, "destroyToken");

const { restoreToken, state: restoreTokenState } = useRestoreToken(provider, tokenRegistry, tokenId);
const { restoreToken, state: restoreTokenState } = useRestoreToken(transactor, tokenRegistry, tokenId);

// Contract Write Functions (available only after provider has been upgraded)
const {
Expand Down Expand Up @@ -194,7 +195,7 @@ export const TokenInformationContextProvider: FunctionComponent<TokenInformation
}, [transferToNewEscrowState, updateTitleEscrow]);

// Reset states for all write functions when provider changes to allow methods to be called again without refreshing
useEffect(resetProviders, [resetProviders, provider]);
useEffect(resetProviders, [resetProviders, transactor]);

return (
<TokenInformationContext.Provider
Expand Down
Loading