From 7e3804557d3fd6591b47ed9df81d847c5f0533a9 Mon Sep 17 00:00:00 2001 From: Johnson Chen Date: Sat, 28 Aug 2021 16:43:00 +0800 Subject: [PATCH] v0.3.0 --- CHANGELOG.md | 5 +++++ README.md | 39 ++++++++++++++++++++++++++++++++------- package.json | 2 +- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59a404b..578cbf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========= +vue-dapp/v0.3.0 (2021-08-28) +-------------------------------- + - component library available + - useMetamask add provider event + vue-dapp/v0.2.0 (2021-08-24) -------------------------------- - simple metamask available \ No newline at end of file diff --git a/README.md b/README.md index 2b641d6..6fc7d0d 100644 --- a/README.md +++ b/README.md @@ -11,24 +11,49 @@ Vue3 composable and component library for building Dapps. - Demo ready to be written using [Vite](https://vitejs.dev/) ## Quick Start + +Add dependencies to your main.js: ```javascript -import { defineComponent } from 'vue' -import { useWallet, Wallet } from 'vue-dapp' +import { createApp } from 'vue' +import VueDapp from 'vue-dapp' + +const app = createApp({...}) +app.use(VueDapp) +``` + +Add the global component to your App.vue: + +```vue + +``` + +Use wallet or board from your .vue files: + +```javascript +import { defineComponent, watch } from 'vue' +import { useWallet, useBoard } from 'vue-dapp' export default defineComponent({ name: 'App', setup() { - const { connect, address, fixedBalance, isConnected, disconnect } = useWallet() + const { address, fixedBalance, isConnected, disconnect, error, network } = + useWallet() - const connectMetamask = async () => { - await connect(Wallet.metamask) - } + // open or close the board + const { open, close } = useBoard() + + watch(error, (error) => { + if (error) close() + }) return { + network, + error, address, isConnected, fixedBalance, - connectMetamask, + disconnect, + open, } }, }) diff --git a/package.json b/package.json index 6e605a0..14bdf38 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-dapp", - "version": "0.2.1", + "version": "0.3.0", "description": "Vue3 composable and component library for building Dapps.", "repository": "https://github.com/chnejohnson/vue-dapp", "bugs": {