https://github.com/mikecheng1208/vue-metamask
Testing Metamask's status with Vue
https://github.com/mikecheng1208/vue-metamask
ethereum metamask network vue web3
Last synced: 6 months ago
JSON representation
Testing Metamask's status with Vue
- Host: GitHub
- URL: https://github.com/mikecheng1208/vue-metamask
- Owner: MikeCheng1208
- License: mit
- Created: 2018-08-01T09:45:51.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-04-04T15:35:36.000Z (6 months ago)
- Last Synced: 2025-04-09T11:09:22.684Z (6 months ago)
- Topics: ethereum, metamask, network, vue, web3
- Language: Vue
- Homepage:
- Size: 35.6 MB
- Stars: 81
- Watchers: 6
- Forks: 25
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-metamask
Testing Metamask's status with Vue
## Demo
MetaMask will introduce an optional “Privacy Mode”, which requires that dapps ask permission to view users’ accounts. Dapps should update their code to support this feature, which will be enabled by default in the future.
Reference linkNPM Install
```
npm i vue-metamask -S
```And then import it:
```vueimport { ref } from "vue";
import VueMetamask from "vue-metamask";
const msg = ref("This is demo net work");const complete = (data) => {
console.log("GET INFO =>", data);
};```
Use
```html
```
---## How to use init connect option
```vue
import { ref } from "vue";
import VueMetamask from "vue-metamask";
const metamask = ref(null);const connect = () => {
// Get ref target use init methods
metamask.value.init();
};
// close init connect
// click button call Init
connect
```
---
## Methods|data | type | value | Functionality |
|-----------|-----------|-----------|---------------|
|initConnect | Boolean |true (default)| Whether to connect initially |
|userMessage ( Optional ) | String |Message| return setting status message|
|complete | Event | Callback | return current data|
## OnComplete return data
| key | type | value | Description |
|-----------|-----------|-----------|---------------|
| web3 | Object | function | web3 |
| metaMaskAddress | String | 0x09F38A7F... | Metamask address |
| message | String | "message" | User-defined message |
| type | String | "MAINNET" | MAINNET
NO_INSTALL_METAMASK
NO_LOGIN
NETWORK_ERROR
USER_DENIED_ACCOUNT_AUTHORIZATION |
| netID | String | 1n | User's current network id |
# License
MIT.