+
{balance / 1e8} {computer.getChain()}{" "}
+ />
{computer.getNetwork()}
- {computer.getNetwork() === 'regtest' &&
}
+ {computer.getNetwork() === "regtest" && (
+
+ )}
)
}
diff --git a/packages/wallet/src/components/Utils/BalanceContext.tsx b/packages/wallet/src/components/Utils/BalanceContext.tsx
new file mode 100644
index 000000000..b2ebdc811
--- /dev/null
+++ b/packages/wallet/src/components/Utils/BalanceContext.tsx
@@ -0,0 +1,33 @@
+import React, { createContext, useState, useContext, ReactNode } from "react"
+
+interface BalanceContextProps {
+ setBalance: (amount: number) => void
+ balance: number
+}
+
+const balanceContext = createContext
(undefined)
+
+interface BalanceProviderProps {
+ children: ReactNode
+}
+
+export const BalanceProvider: React.FC = ({ children }) => {
+ const [balance, setBalance] = useState(0)
+
+ return (
+ {children}
+ )
+}
+
+export const useBalance = (): BalanceContextProps => {
+ const context = useContext(balanceContext)
+ if (!context) {
+ throw new Error("useBalance must be used within a BalanceProvider")
+ }
+ return context
+}
+
+export const BalanceContext = {
+ BalanceProvider,
+ useBalance
+}