1.0.3 • Published 2 years ago

@squirrelverse/web3 v1.0.3

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

Using web3 functions made easy by SquirrelVerse.

Install package

npm install @squirrelverse/web3

Functions available

There are two functions available for you to use:

import {
	getMetaMaskProvider,
	getMetaMaskSigner,
	getAccountInfo,
} from "@squirrelverse/web3"
  1. Use getMetaMaskProvider() to get your metamask provider.

  2. Use getMetaMaskSigner() to get your metamask signer.

  3. Use getAccountInfo() to get your metamask wallet address.

Here's an example code:

import { getAccountInfo } from "@squirrelverse/web3"
import { useState } from "react"

export default function App() {
	const [info, setInfo] = useState("")
	const handleClick = async () => {
		const account = await getAccountInfo()
		setInfo(account)
	}

	return (
		<div className='App'>
			<h1>Hi there</h1>
			<button onClick={handleClick}>
				{info === "" ? "connect wallet" : info.substring(0, 10)}
			</button>
			<h2>
				{info === "" ? "Connect you account" : `your account address: ${info}`}
			</h2>
		</div>
	)
}

Visit this sandbox for demo

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago