npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-web3

v2.1.0

Published

Web3 bindings for Vue.js

Readme

VueWeb3 Build Status npm package

Vue.js bindings for Web3 1.0

Installation

In module environments, e.g CommonJS:

npm install vue web3@beta vue-web3
var Vue = require('vue')
var Web3 = require('web3')
var VueWeb3 = require('vue-web3')

// explicit installation required in module environments
Vue.use(VueWeb3, { web3: new Web3(web3.currentProvider) })

Usage

let myContract = new web3.eth.Contract(MyContract, '0xbA911C4A817e69998Ffd3626d3c5366038e8480F')

var vm = new Vue({
  el: '#demo',
  web3: {
    // can bind to calls
    lastUpdated: {
      contract: myContract,
      method: 'getLastUpdated',
      arguments: []
    },
    // can also bind to events
    transfers: {
      contract: myContract,
      event: 'OwnershipTransferred',
      options: {
        fromBlock: 2
      }
    }
  }
})

If you need to access properties from the Vue instance, use the function syntax:

var vm = new Vue({
  el: '#demo',
  web3: function () {
    return {
      lastUpdated: {
        contract: myContract,
        method: 'getLastUpdated',
        arguments: [this.$store.state.user.uid]
      }
    }
  }
})

⚠️: This function will get executed only once. If you want to have automatic rebind (pretty much like a computed property) use a $watch and call $unbind and then $bindCall or $bindEvents

<div id="demo">
  <pre>{{ lastUpdated }}</pre>
  <ul>
    <li v-for="transfer in transfers">From {{ transfer.previousOwner }} to {{ transfer.newOwner }}</li>
  </ul>
</div>

The above will bind the Vue instance's lastUpdated and transfers to the respective Web3 data sources.

Alternatively, you can also manually bind to Web3 with the $bindCall or $bindEvents instance methods:

let myContract = new web3.eth.Contract(MyContract, '0xbA911C4A817e69998Ffd3626d3c5366038e8480F')
vm.$bindCall('user', { contract: myContract, method: 'getUser' })
vm.$bindEvents('transfers', { contract: myContract, event: 'OwnershipTransferred' })

// References are unbound when the component is destroyed but you can manually unbind a reference
// if needed
vm.$unbind('items')

Error: The current provider doesn't support subscriptions: MetamaskInpageProvider

In order to get updates from the blockchain, this library requires a provider that supports subscriptions. MetaMask does not currently inject a provider with this support, this is being tracked via metamask-extension/2350.

Thankfully, we can create our own provider:

var provider = new Web3.providers.WebsocketProvider('wss://ropsten.infura.io/ws')

Until MetaMask's provider supports subscriptions, you can have a write web3 instance with MetaMask's provider and a read web3 instance which uses the WebsocketProvider.

Contributing

Clone the repo, then:

$ npm install    # install dependencies
$ npm test       # run test suite with coverage report
$ npm run dev    # watch and build dist/vue-web3.js
$ npm run build  # build dist/vue-web3.js and vue-web3.min.js

License

MIT