mirror of
https://github.com/Instadapp/vue-web3.git
synced 2024-07-29 21:48:25 +00:00
use shallowRef for connector, provider and library
This commit is contained in:
parent
00ad34076c
commit
37fad40f13
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@instadapp/vue-web3",
|
"name": "@instadapp/vue-web3",
|
||||||
"version": "0.8.3",
|
"version": "0.9.0",
|
||||||
"description": "Vue web3 composition api",
|
"description": "Vue web3 composition api",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
|
|
||||||
15
src/index.ts
15
src/index.ts
|
|
@ -1,7 +1,14 @@
|
||||||
import { AbstractConnector } from '@web3-react/abstract-connector'
|
import { AbstractConnector } from '@web3-react/abstract-connector'
|
||||||
import { normalizeAccount, normalizeChainId } from './normalizers'
|
import { normalizeAccount, normalizeChainId } from './normalizers'
|
||||||
import { ConnectorEvent, ConnectorUpdate } from '@web3-react/types'
|
import { ConnectorEvent, ConnectorUpdate } from '@web3-react/types'
|
||||||
import { computed, onBeforeUnmount, Ref, ref, watch } from 'vue-demi'
|
import {
|
||||||
|
computed,
|
||||||
|
onBeforeUnmount,
|
||||||
|
Ref,
|
||||||
|
ref,
|
||||||
|
shallowRef,
|
||||||
|
watch,
|
||||||
|
} from 'vue-demi'
|
||||||
|
|
||||||
export class UnsupportedChainIdError extends Error {
|
export class UnsupportedChainIdError extends Error {
|
||||||
public constructor(
|
public constructor(
|
||||||
|
|
@ -16,10 +23,10 @@ export class UnsupportedChainIdError extends Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const connector = ref<AbstractConnector>()
|
const connector = shallowRef<AbstractConnector>()
|
||||||
const chainId = ref()
|
const chainId = ref()
|
||||||
const account = ref<null | string>()
|
const account = ref<null | string>()
|
||||||
const provider = ref<any>()
|
const provider = shallowRef<any>()
|
||||||
const error = ref<Error>()
|
const error = ref<Error>()
|
||||||
const active = computed(
|
const active = computed(
|
||||||
() =>
|
() =>
|
||||||
|
|
@ -28,7 +35,7 @@ const active = computed(
|
||||||
account.value !== undefined &&
|
account.value !== undefined &&
|
||||||
!!!error.value,
|
!!!error.value,
|
||||||
)
|
)
|
||||||
const library = ref()
|
const library = shallowRef()
|
||||||
|
|
||||||
let getLibrary: any = (provider?: any, connector?: any) => (): any => null
|
let getLibrary: any = (provider?: any, connector?: any) => (): any => null
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user