This commit is contained in:
Georges KABBOUCHI 2021-08-29 02:44:41 +03:00
parent 4df5a4f942
commit 1f689f6f19
2 changed files with 18 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@kabbouchi/vue-web3", "name": "@kabbouchi/vue-web3",
"version": "0.2.12", "version": "0.2.13",
"description": "Vue web3 composition api", "description": "Vue web3 composition api",
"license": "MIT", "license": "MIT",
"main": "dist/cjs/index.js", "main": "dist/cjs/index.js",

View File

@ -85,19 +85,32 @@ export const useWeb3 = () => {
return return
} }
if (update.provider) {
provider.value = update.provider
}
const cId = const cId =
update.chainId === undefined update.chainId === undefined
? undefined ? undefined
: normalizeChainId(update.chainId) : normalizeChainId(update.chainId)
if (
cId !== undefined &&
!!connector.value.supportedChainIds &&
!connector.value.supportedChainIds.includes(cId)
) {
const e = new UnsupportedChainIdError(
cId,
connector.value.supportedChainIds,
)
onErrorCb.value ? onErrorCb.value(e) : handleError(e)
return
}
if (cId) { if (cId) {
chainId.value = cId chainId.value = cId
} }
if (update.provider) {
provider.value = update.provider
}
const acc = const acc =
typeof update.account === 'string' typeof update.account === 'string'
? normalizeAccount(update.account) ? normalizeAccount(update.account)