Skip to content

Commit

Permalink
Merge pull request #179 from vu3th/fix/computed-provider-target
Browse files Browse the repository at this point in the history
fix(app): export computed providerTarget
  • Loading branch information
johnson86tw authored May 2, 2024
2 parents 989069d + b2d088c commit 8709f70
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/content/en/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ if(isConnected.value) {
console.log(wallet.error)
console.log(wallet.connectorName)
console.log(wallet.provider)
console.log(wallet.providerInfo) // see EIP-6963
console.log(wallet.connector)
console.log(wallet.address)
console.log(wallet.chainId)
console.log(wallet.providerInfo) // EIP6963ProviderInfo | null
console.log(wallet.providerTarget) // 'window.ethereum' | 'rdns' | null
}
```

The wallet comprises 8 properties, each of which can be obtained from the `useVueDapp` as a [computed](https://vuejs.org/api/reactivity-core.html#computed){:target="_blank"}.
The wallet comprises 9 properties, each of which can be obtained from the `useVueDapp` as a [computed](https://vuejs.org/api/reactivity-core.html#computed){:target="_blank"}.

```ts
const { error, chainId } = useVueDapp()
Expand Down
5 changes: 3 additions & 2 deletions app/content/zh-TW/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ if(isConnected.value) {
console.log(wallet.error)
console.log(wallet.connectorName)
console.log(wallet.provider)
console.log(wallet.providerInfo) // see EIP-6963
console.log(wallet.connector)
console.log(wallet.address)
console.log(wallet.chainId)
console.log(wallet.providerInfo) // EIP6963ProviderInfo | null
console.log(wallet.providerTarget) // 'window.ethereum' | 'rdns' | null
}
```

The wallet comprises 8 properties, each of which can be obtained from the `useVueDapp` as a [computed](https://vuejs.org/api/reactivity-core.html#computed){:target="_blank"}.
The wallet comprises 9 properties, each of which can be obtained from the `useVueDapp` as a [computed](https://vuejs.org/api/reactivity-core.html#computed){:target="_blank"}.

```ts
const { error, chainId } = useVueDapp()
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/services/connect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed, readonly } from 'vue'
import { computed, provide, readonly } from 'vue'
import { useStore } from '../store'
import { ConnectOptions, ConnectorName, ProviderTarget } from '../types'
import { AutoConnectError, ConnectError, ConnectorNotFoundError } from '../errors'
Expand Down Expand Up @@ -158,10 +158,11 @@ export function useConnect(pinia?: any) {
error: computed(() => walletStore.wallet.error),
connectorName: computed(() => walletStore.wallet.connectorName),
provider: computed(() => walletStore.wallet.provider),
providerInfo: computed(() => walletStore.wallet.providerInfo),
connector: computed(() => walletStore.wallet.connector),
address: computed(() => walletStore.wallet.address),
chainId: computed(() => walletStore.wallet.chainId),
providerInfo: computed(() => walletStore.wallet.providerInfo),
providerTarget: computed(() => walletStore.wallet.providerTarget),

isConnected: computed(() => walletStore.wallet.status === 'connected'),

Expand Down

0 comments on commit 8709f70

Please sign in to comment.