Skip to content

Commit

Permalink
upgrades packages
Browse files Browse the repository at this point in the history
need to support 1337 chain id for ganache
  • Loading branch information
elmariachi111 committed Aug 10, 2020
1 parent fb52f81 commit 2961856
Show file tree
Hide file tree
Showing 6 changed files with 954 additions and 3,159 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
"@openzeppelin/contracts-ethereum-package": "^3.0.0",
"@web3-react/core": "^6.0.9",
"@web3-react/injected-connector": "^6.0.7",
"ethers": "^4",
"ethers": "^4.0.47",
"react": "^16.8",
"react-dom": "^16.8",
"web3": "^1.2.7",
"web3-react": "^5.0.5"
"web3": "^1.2.7"
},
"scripts": {
"start": "parcel index.html",
Expand Down
4 changes: 3 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { Web3ReactProvider } from '@web3-react/core'
import Main from "./Main";
import Web3 from "web3";

const getLibrary = (provider: any): Web3 => new Web3(provider);
const getLibrary = (provider: any): Web3 => {
return new Web3(provider)
};

const App: React.FC = () => (
<Web3ReactProvider getLibrary={getLibrary}>
Expand Down
2 changes: 1 addition & 1 deletion src/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Layout: React.FC = ({ children }) => {
const { activate } = context;

useEffect(() => {
activate(injected);
activate(injected, console.error);
}, []);

return !context.active && !context.error ? (
Expand Down
17 changes: 10 additions & 7 deletions src/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ const Main: React.FC = () => {

useEffect(() => {
(async () => {
const _ethBalance = await web3.eth.getBalance(account);
const readableEthBalance = Web3.utils.fromWei(_ethBalance);
setEthBalance(readableEthBalance);

const _adiBalance = await queryADIBalance();
const readableAdiBalance = Web3.utils.fromWei(_adiBalance);
setADIBalance(readableAdiBalance);
if (!!web3) {
const _ethBalance = await web3.eth.getBalance(account);
const readableEthBalance = Web3.utils.fromWei(_ethBalance);
setEthBalance(readableEthBalance);

const _adiBalance = await queryADIBalance();
const readableAdiBalance = Web3.utils.fromWei(_adiBalance);
setADIBalance(readableAdiBalance);
}

})();
}, [web3]);

Expand Down
2 changes: 1 addition & 1 deletion src/connectors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InjectedConnector } from '@web3-react/injected-connector'

export const injected = new InjectedConnector({
supportedChainIds: [1, 3, 4, 5, 17, 42, 5778]
supportedChainIds: [1, 3, 4, 5, 17, 42, 1337, 5778]
})
Loading

0 comments on commit 2961856

Please sign in to comment.