0.0.8 • Published 2 years ago

nuxt-web3 v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm version npm downloads License

Web3.js module integration for Nuxt

Setup

  1. Add nuxt-web3 dependency to your project
yarn add nuxt-web3 # or npm i nuxt-web3
  1. Add nuxt-web3 to the modules section of nuxt.config.js
{
  modules: [
    "nuxt-web3",
  ];
}

Or

modules: [
  "nuxt-web3",
  // Or
  [
    "nuxt-web3",
    {
      /* module options */
    }
  ]
];

Module Options

// nuxt.config.js
export default {
  modules: ["nuxt-web3"],
  //....
  web3: {
    provider: "" // Used as fallback if no runtime config is provided
  },

  publicRuntimeConfig: {
    web3: {
      provider: process.env.WEB3_PROVIDER_URL
    }
  },

  privateRuntimeConfig: {
    web3: {
      provider: process.env.PROVIDER_URL
    }
  }
};

Usage

Using default ethereum window supported by the browsers :

window.web3 = new this.$Web3(ethereum);
//or
window.web3 = new this.$Web3(window.ethereum);

Using configuration or custom provider from nuxt.config.js.

window.web3 = new this.$web3;

Example Usage

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago