Improvements
This commit is contained in:
+3
-1
@@ -13,6 +13,7 @@ import { ThemePicker } from './ThemePicker.tsx';
|
||||
import { TradeDesk } from './TradeDesk.tsx';
|
||||
import { Marketplace } from './Marketplace.tsx';
|
||||
import { IS_MAINNET, NETWORK_LABEL } from '../shared/network.ts';
|
||||
import { StateClient } from '../shared/rpc-client.ts';
|
||||
import './App.css';
|
||||
import './testnet.css';
|
||||
|
||||
@@ -59,12 +60,13 @@ export default function App() {
|
||||
const transferInFlight = useRef(false);
|
||||
const refreshVersion = useRef(0);
|
||||
const minerPanel = useRef<HTMLElement>(null);
|
||||
const stateClient = useRef(new StateClient());
|
||||
useModalFocus(Boolean(dialog || selected));
|
||||
|
||||
const refresh = async () => {
|
||||
const version = ++refreshVersion.current;
|
||||
try {
|
||||
const data = await request<TestnetSnapshot>('state');
|
||||
const data = await stateClient.current.load();
|
||||
if (data.network !== NETWORK || data.algorithm !== 'RandomX' || typeof data.chainId !== 'string' ||
|
||||
!Array.isArray(data.blocks) || !Array.isArray(data.transfers) || !Array.isArray(data.pendingTransfers))
|
||||
throw new Error('Incompatible node. This interface requires the Wikideck RandomX testnet API.');
|
||||
|
||||
Reference in New Issue
Block a user