An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# vue-metamask
![vueMetaMask](./assets/vueMetaMask.jpg)

















Testing Metamask's status with Vue



NPM version

## Demo
![vueMetaMask](./assets/operates.gif)

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 link

NPM Install
```
npm i vue-metamask -S
```

And then import it:
```vue

import { 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.