Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit e78a289

Browse files
committed
chore: docs & version packages
1 parent dca534f commit e78a289

11 files changed

Lines changed: 3731 additions & 7854 deletions

File tree

.eslintrc

Lines changed: 0 additions & 95 deletions
This file was deleted.

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,28 @@ Based on [wagmi](https://wagmi.sh)
2727
Install use-wagmi and its ethers peer dependency.
2828

2929
```bash
30-
npm install use-wagmi ethers
30+
npm install use-wagmi viem
3131
```
3232

3333
## Quick Start
3434

3535
Connect a wallet in under 60 seconds.
3636

3737
```ts
38-
import { createWagmi } from 'use-wagmi';
39-
import { getDefaultProvider } from 'ethers';
40-
import App from './App.vue';
38+
import { UseWagmiPlugin, WagmiConfig, createConfig, mainnet } from 'use-wagmi'
39+
import { createPublicClient, http } from 'viem'
40+
import App from './App.vue'
4141

42-
const wagmi = createWagmi({
42+
const config = createConfig({
4343
autoConnect: true,
44-
provider: getDefaultProvider(),
45-
});
44+
publicClient: createPublicClient({
45+
chain: mainnet,
46+
transport: http(),
47+
}),
48+
})
4649

4750
const app = createApp(App);
48-
app.use(wagmi);
51+
app.use(UseWagmiPlugin, config);
4952
app.mount('#app');
5053
```
5154

examples/vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"devDependencies": {
2020
"@vitejs/plugin-vue": "^4.1.0",
21-
"typescript": "^4.9.3",
21+
"typescript": "^5.0.4",
2222
"vite": "^3.2.5",
2323
"vue-tsc": "^1.2.0"
2424
}

package.json

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,30 @@
2424
"@manypkg/get-packages": "^1.1.3",
2525
"@testing-library/vue": "^7.0.0",
2626
"@types/dedent": "^0.7.0",
27-
"@types/eslint": "^8.37.0",
27+
"@types/eslint": "^8.40.0",
2828
"@types/fs-extra": "^11.0.1",
29-
"@types/node": "^18.14.0",
30-
"@typescript-eslint/eslint-plugin": "^5.57.1",
31-
"@typescript-eslint/parser": "^5.57.1",
32-
"@vitejs/plugin-vue": "^4.1.0",
29+
"@types/node": "^18.16.16",
30+
"@vitejs/plugin-vue": "^4.2.3",
3331
"@vitest/coverage-c8": "^0.29.8",
3432
"@vitest/ui": "^0.29.8",
35-
"abitype": "^0.8.1",
33+
"abitype": "0.8.1",
3634
"dedent": "^0.7.0",
3735
"esbuild": "0.15.13",
3836
"esbuild-register": "^3.4.2",
39-
"eslint": "^8.37.0",
40-
"eslint-config-prettier": "^8.8.0",
41-
"eslint-import-resolver-typescript": "^3.5.4",
42-
"eslint-plugin-eslint-comments": "^3.2.0",
43-
"eslint-plugin-import": "^2.27.5",
44-
"eslint-plugin-mdx": "^2.0.5",
45-
"eslint-plugin-prettier": "^4.2.1",
4637
"execa": "^7.1.1",
47-
"fs-extra": "^11.1.0",
48-
"jsdom": "^21.1.1",
49-
"prettier": "^2.8.7",
50-
"tsup": "^6.5.0",
38+
"fs-extra": "^11.1.1",
39+
"jsdom": "^21.1.2",
40+
"prettier": "^2.8.8",
41+
"tsup": "^6.7.0",
5142
"typescript": "^5.0.4",
52-
"viem": "~0.3.35",
43+
"viem": "~0.3.49",
5344
"vitest": "^0.29.8",
54-
"vue": "^3.2.47"
45+
"vue": "^3.3.4"
5546
},
56-
"packageManager": "pnpm@7.5.0",
47+
"packageManager": "pnpm@8.3.1",
5748
"pnpm": {
5849
"overrides": {
59-
"abitype": "0.8.1",
50+
"abitype": "0.8.7",
6051
"esbuild": "0.15.13"
6152
}
6253
}

packages/vue/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
[![npm (tag)](https://img.shields.io/npm/v/use-wagmi?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/use-wagmi) ![NPM](https://img.shields.io/npm/l/use-wagmi?style=flat&colorA=000000&colorB=000000)
2+
3+
# use-wagmi
4+
5+
Vue Composition for Ethereum
6+
7+
Support for Vue 2.x via [vue-demi](https://github.com/vueuse/vue-demi)
8+
9+
Based on [wagmi](https://wagmi.sh)
10+
11+
## Features
12+
13+
- 🚀 Composables for working with wallets, ENS, contracts, transactions, signing, etc.
14+
- 💼 Built-in wallet connectors for MetaMask, WalletConnect, Coinbase Wallet, and Injected
15+
- 👟 Caching, request deduplication, multicall, batching, and persistence
16+
- 🌀 Auto-refresh data on wallet, block, and network changes
17+
- 🦄 TypeScript ready
18+
19+
...and a lot more.
20+
21+
## Documentation
22+
23+
`use-wagmi docs` visit [wagmi docs](https://wagmi.sh) as most of the concepts and APIs are the same.
24+
25+
## Installation
26+
27+
Install use-wagmi and its ethers peer dependency.
28+
29+
```bash
30+
npm install use-wagmi viem
31+
```
32+
33+
## Quick Start
34+
35+
Connect a wallet in under 60 seconds.
36+
37+
```ts
38+
import { UseWagmiPlugin, WagmiConfig, createConfig, mainnet } from 'use-wagmi'
39+
import { createPublicClient, http } from 'viem'
40+
import App from './App.vue'
41+
42+
const config = createConfig({
43+
autoConnect: true,
44+
publicClient: createPublicClient({
45+
chain: mainnet,
46+
transport: http(),
47+
}),
48+
})
49+
50+
const app = createApp(App);
51+
app.use(UseWagmiPlugin, config);
52+
app.mount('#app');
53+
```
54+
55+
```html
56+
<script setup>
57+
import { useAccount, useConnect, useDisconnect } from 'use-wagmi'
58+
import { InjectedConnector } from 'use-wagmi/connectors'
59+
60+
const { address, isConnected } = useAccount()
61+
const { connect } = useConnect({
62+
connector: new InjectedConnector(),
63+
})
64+
const { disconnect } = useDisconnect()
65+
</script>
66+
67+
<template>
68+
<div v-if="isConnected">
69+
Connected to {{ address }}
70+
<button @click="disconnect">Disconnect</button>
71+
</div>
72+
<button v-else @click="connect">
73+
Connect Wallet
74+
</button>
75+
</template>
76+
```
77+
78+
In this example, we create a use-wagmi `wagmi` and pass it to the Vue plugin. The client is set up to use the ethers Default Provider and automatically connect to previously connected wallets.
79+
80+
Next, we use the `useConnect` composable to connect an injected wallet (e.g. MetaMask) to the app. Finally, we show the connected account's address with `useAccount` and allow them to disconnect with `useDisconnect`.
81+
82+
We've only scratched the surface for what you can do with use-wagmi!
83+
84+
## Credits
85+
86+
- [wagmi.sh](https://wagmi.sh/)
87+
- [VueUse](https://vueuse.org/)
88+
- [Vue Query](https://vue-query.vercel.app/)
89+
90+
## License
91+
92+
MIT

packages/vue/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "use-wagmi",
33
"description": "Vue Composition for Ethereum",
44
"license": "MIT",
5-
"version": "0.0.2-alpha.5",
5+
"version": "0.1.0",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/unicape/use-wagmi.git",
@@ -107,7 +107,7 @@
107107
],
108108
"peerDependencies": {
109109
"@vue/composition-api": "^1.0.0-rc.1",
110-
"typescript": ">=4.9.4",
110+
"typescript": ">=5.0.4",
111111
"viem": "~0.3.35",
112112
"vue": "^2.0.0 || >=3.0.0"
113113
},
@@ -120,11 +120,14 @@
120120
}
121121
},
122122
"dependencies": {
123-
"@tanstack/query-persist-client-core": "^4.29.5",
124-
"@tanstack/query-sync-storage-persister": "^4.29.5",
125-
"@tanstack/vue-query": "^4.29.7",
123+
"@tanstack/query-persist-client-core": "^4.29.11",
124+
"@tanstack/query-sync-storage-persister": "^4.29.11",
125+
"@tanstack/vue-query": "^4.29.11",
126126
"@wagmi/core": "^1.1.0",
127-
"abitype": "^0.8.1",
127+
"@wagmi/chains": "latest",
128+
"@wagmi/connectors": "latest",
129+
"eventemitter3": "^4.0.7",
130+
"abitype": "0.8.7",
128131
"vue-demi": "latest"
129132
},
130133
"devDependencies": {

packages/vue/src/chains.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export {
1919
crossbell,
2020
dfk,
2121
dogechain,
22+
edgeware,
23+
edgewareTestnet,
2224
evmos,
2325
evmosTestnet,
2426
fantom,
@@ -90,6 +92,7 @@ export {
9092
zhejiang,
9193
zkSync,
9294
zkSyncTestnet,
95+
zoraTestnet,
9396
} from '@wagmi/core/chains'
9497

9598
export type { Chain } from '@wagmi/core/chains'

packages/vue/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from 'tsup'
22

3-
import { dependencies, peerDependencies } from './package.json'
43
import { getConfig } from '../../scripts/tsup'
4+
import { dependencies, peerDependencies } from './package.json'
55

66
export default defineConfig(
77
getConfig({

0 commit comments

Comments
 (0)