Skip to content

Commit

Permalink
Read network info from useNetwork hook instead of const (agoric-conte…
Browse files Browse the repository at this point in the history
…xt) (#86)
  • Loading branch information
carlos-kryha authored Nov 8, 2023
1 parent 7e5fe83 commit 1cb23f8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions frontend/src/context/agoric.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { createContext, useContext, useEffect, useReducer, useState } fro
import { AgoricDispatch, AgoricState, AgoricStateActions, TokenInfo } from "../interfaces";
import { AgoricKeplrConnectionErrors as Errors, makeAgoricWalletConnection } from "@agoric/web-components";
import { makeAsyncIterableFromNotifier as iterateNotifier } from "@agoric/notifier";
import { CHARACTER_IDENTIFIER, IST_IDENTIFIER, ITEM_IDENTIFIER, KREAD_IDENTIFIER, NETWORK_CONFIG, NO_SMART_WALLET_ERROR } from "../constants";
import { CHARACTER_IDENTIFIER, IST_IDENTIFIER, ITEM_IDENTIFIER, KREAD_IDENTIFIER, NO_SMART_WALLET_ERROR } from "../constants";
import { fetchChainInfo } from "./util";
import { AgoricChainStoragePathKind as Kind, ChainStorageWatcher, makeAgoricChainStorageWatcher } from "@agoric/rpc";
import { useNetworkConfig } from "../hooks/useNetwork";
Expand Down Expand Up @@ -92,7 +92,6 @@ export const AgoricStateProvider = (props: ProviderProps): React.ReactElement =>
const [state, dispatch] = useReducer(Reducer, initialState);
const [isCancelled, setIsCancelled] = useState<boolean>(false);
const { network } = useNetworkConfig();

useEffect(() => {
if (isCancelled) return;
// TODO: consider implementing terms agreement
Expand Down Expand Up @@ -204,7 +203,7 @@ export const AgoricStateProvider = (props: ProviderProps): React.ReactElement =>

try {

const { rpc, chainName } = await fetchChainInfo(NETWORK_CONFIG);
const { rpc, chainName } = await fetchChainInfo(network);
chainStorageWatcher = makeAgoricChainStorageWatcher(rpc, chainName, backendError);
dispatch({ type: "SET_CHAIN_STORAGE_WATCHER", payload: chainStorageWatcher });
dispatch({ type: "UPDATE_STATUS", payload: { walletProvisioned: true }});
Expand Down

0 comments on commit 1cb23f8

Please sign in to comment.