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

Read network info from useNetwork hook instead of const (agoric-context) #86

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Changes from all commits
Commits
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
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
Loading