diff --git a/app/js/actions/web3.ts b/app/js/actions/web3.ts index ae6701b..c3a00f4 100644 --- a/app/js/actions/web3.ts +++ b/app/js/actions/web3.ts @@ -84,7 +84,7 @@ export const initializeWeb3 = () => { } dispatch(web3NetworkIDLoaded(id)) - dispatch(loadAddress()); + dispatch(loadAddress()); }); }) .catch((err: string) => { @@ -96,7 +96,7 @@ export const initializeWeb3 = () => { dispatch(web3Initialized(t)); config.web3!.eth.net.getId().then((id: number) => { dispatch(web3NetworkIDLoaded(id)) - dispatch(loadAddress()); + dispatch(loadAddress()); }) .catch((err: string) => { //FIXME: handle error @@ -110,7 +110,7 @@ export const initializeWeb3 = () => { const loadAddress = () => { return (dispatch: Dispatch, getState: () => RootState) => { - web3.eth.getAccounts().then((accounts: string[]) => { + config.web3!.eth.getAccounts().then((accounts: string[]) => { dispatch(accountLoaded(accounts[0])); }); }; diff --git a/app/js/config.ts b/app/js/config.ts index 60ebf0c..c53d0e2 100644 --- a/app/js/config.ts +++ b/app/js/config.ts @@ -1,7 +1,11 @@ import Web3 from "web3"; -export const config = { +export interface Config { web3: Web3 | undefined +} + +export const config: Config = { + web3: undefined }; export const redeemPath = "/redeem/:bucketAddress/:recipientAddress";