1
0
mirror of https://github.com/oceanprotocol/react.git synced 2024-12-23 17:54:03 +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
connect: (opts?: Partial<ICoreOptions>) => Promise<void>
logout: () => Promise<void>
refreshBalance: () => Promise<void>
}
const OceanContext = createContext(null)
@ -121,7 +122,10 @@ function OceanProvider({
Logger.error(error)
}
}
async function refreshBalance() {
const balance = await getBalance(account)
setBalance(balance)
}
async function logout() {
// TODO: #67 check how is the proper way to logout
web3Modal.clearCachedProvider()
@ -181,7 +185,8 @@ function OceanProvider({
status,
config,
connect,
logout
logout,
refreshBalance
} as OceanProviderValue
}
>