Updating Balances

In certain scenarios, you may want to manually refresh all private balances.

Example: Manually refresh balances

import { NETWORK_CONFIG, NetworkName } from '@railgun-community/shared-models';
import { refreshRailgunBalances } from '@railgun-community/wallet';
const {chain} = NETWORK_CONFIG[NetworkName.Ethereum];
// Whether to run a full rescan (which can take several minutes).
// Unnecessary unless resetting application.
const fullRescan = false;
const {error} = await refreshRailgunBalances(chain, railgunWalletID, fullRescan);
if (error) {
// Scan failed to run.
}
// When scan is completed, `onBalanceUpdateCallback` callback will trigger.
// This may take minutes on first sync, and a few seconds on subsequent calls.