joeelia / nuxt-web3

Web3.js module integration for Nuxt.js - Easy and simple!

Home Page:https://web3js.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nuxt-web3

npm version npm downloads License

Web3js module integration for Nuxt.js - Easy and simple!

đź“– Release Notes

Setup

  1. Add nuxt-web3 dependency to your project
yarn add nuxt-web3 # or npm install nuxt-web3
  1. Add nuxt-web3 to the modules section of nuxt.config.js
{
  modules: [
    // Simple usage
    "nuxt-web3",

    // With options
    [
      "nuxt-web3",
      {
        /* module options */
      }
    ]
  ];
}

nuxt-web3 Configuration

// 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

If you want to use default ethereum support by browser :

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

If you want to use configuration from nuxt.config.js.

window.web3 = new this.$web3;

More example usage click here

Development

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Start development server using npm run dev

License

MIT License

Copyright (c) fauzan121002

About

Web3.js module integration for Nuxt.js - Easy and simple!

https://web3js.readthedocs.io/

License:MIT License


Languages

Language:JavaScript 54.2%Language:Vue 45.8%