nuxt-web3
v0.0.8
Published
🖖 Web3.js module integration for Nuxt
Downloads
50
Readme
Web3.js module integration for Nuxt
Setup
- Add
nuxt-web3
dependency to your project
yarn add nuxt-web3 # or npm i nuxt-web3
- Add
nuxt-web3
to themodules
section ofnuxt.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;