nuxt-web3.js
v0.1.5
Published
[![Version](https://img.shields.io/npm/v/nuxt-web3.js?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/nuxt-web3.js)
Downloads
24
Readme
nuxt-web3.js
Nuxt 3 module for Web3.js.
Installation
npm install nuxt-web3.js
Usage
export default defineNuxtConfig({
modules: ['nuxt-web3.js'],
})
<script setup lang="ts">
const Web3 = useWeb3()
// Default provider for server
const provider = new Web3.providers.HttpProvider('<PROVIDER_HOST>')
// Use window.ethereum or default provider
const web3 = new Web3(Web3.givenProvider || provider)
const balance = await web3.eth.getBalance(walletAddress)
</script>
For Nuxt 2 version, use https://github.com/fzn0x/nuxt-web3.
License
MIT