1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

add return value on connect

This commit is contained in:
marcoelissa 2022-12-09 21:15:43 +07:00
parent 0993fda8c7
commit ec2502b93e

View File

@ -43,7 +43,7 @@ interface Web3ProviderValue {
web3Loading: boolean
isSupportedOceanNetwork: boolean
approvedBaseTokens: TokenInfo[]
connect: () => Promise<void>
connect: () => Promise<string>
logout: () => Promise<void>
}
@ -136,8 +136,10 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
const accountId = (await web3.eth.getAccounts())[0]
setAccountId(accountId)
LoggerInstance.log('[web3] account id', accountId)
return accountId
} catch (error) {
LoggerInstance.error('[web3] Error: ', error.message)
return null
} finally {
setWeb3Loading(false)
}