This commit is contained in:
Georges KABBOUCHI 2021-08-29 14:18:56 +03:00
parent fab523ac65
commit 67ccc3ad8f
3 changed files with 15 additions and 2 deletions

View File

@ -55,3 +55,16 @@ defineComponent({
}, },
}) })
``` ```
Typescript:
```js
import Web3 from 'web3'
const { library } = useWeb3<Web3>()
```
```js
import { Web3Provider } from "@ethersproject/providers";
const { library } = useWeb3<Web3Provider>()
```

View File

@ -1,6 +1,6 @@
{ {
"name": "@kabbouchi/vue-web3", "name": "@kabbouchi/vue-web3",
"version": "0.2.15", "version": "0.2.16",
"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

@ -36,7 +36,7 @@ export const setWeb3LibraryCallback = (
getLibrary = cb getLibrary = cb
} }
export const useWeb3 = <TLibrary>() => { export const useWeb3 = <TLibrary = any>() => {
const onErrorCb = ref<(error: Error) => void>() const onErrorCb = ref<(error: Error) => void>()
const activate = async ( const activate = async (