export const WALLET_UPDATED_EVENT = "zirabet:wallet-updated";
export const WALLET_VISUAL_ADJUSTMENT_EVENT = "zirabet:wallet-visual-adjustment";

export function notifyWalletUpdated(options?: { force?: boolean }) {
  window.dispatchEvent(new CustomEvent(WALLET_UPDATED_EVENT, { detail: options ?? {} }));
}

export function notifyWalletVisualAdjustment(delta: string | number, options?: { holdMs?: number }) {
  window.dispatchEvent(
    new CustomEvent(WALLET_VISUAL_ADJUSTMENT_EVENT, {
      detail: {
        delta,
        holdMs: options?.holdMs
      }
    })
  );
}
