1
0
mirror of https://github.com/oceanprotocol/react.git synced 2025-02-14 21:10:38 +01:00

refreshBalance

This commit is contained in:
mihaisc 2020-08-04 14:40:39 +03:00
parent 264bde6c27
commit feb56b33b8

View File

@ -30,6 +30,7 @@ interface OceanProviderValue {
status: ProviderStatus status: ProviderStatus
connect: (opts?: Partial<ICoreOptions>) => Promise<void> connect: (opts?: Partial<ICoreOptions>) => Promise<void>
logout: () => Promise<void> logout: () => Promise<void>
refreshBalance: () => Promise<void>
} }
const OceanContext = createContext(null) const OceanContext = createContext(null)
@ -121,7 +122,10 @@ function OceanProvider({
Logger.error(error) Logger.error(error)
} }
} }
async function refreshBalance() {
const balance = await getBalance(account)
setBalance(balance)
}
async function logout() { async function logout() {
// TODO: #67 check how is the proper way to logout // TODO: #67 check how is the proper way to logout
web3Modal.clearCachedProvider() web3Modal.clearCachedProvider()
@ -181,7 +185,8 @@ function OceanProvider({
status, status,
config, config,
connect, connect,
logout logout,
refreshBalance
} as OceanProviderValue } as OceanProviderValue
} }
> >