All Projects → OpenZeppelin → openzeppelin-network.js

OpenZeppelin / openzeppelin-network.js

Licence: MIT license
An easy to use and reliable library that provides one line access to Web3 API.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to openzeppelin-network.js

starter-kit-gsn
An OpenZeppelin starter kit focused on GSN.
Stars: ✭ 39 (-13.33%)
Mutual labels:  dapp, web3, metamask, infura
NFT-Dapp-Boilerplate
A highly scalable NFT and DEFI boilerplate with pre added web3 and different wallets with a focus on performance and best practices
Stars: ✭ 51 (+13.33%)
Mutual labels:  dapp, web3, metamask, react-hooks
eth-commerce
Javascript library to accept ethereum payments on any website
Stars: ✭ 24 (-46.67%)
Mutual labels:  dapp, web3, metamask
ar-nft
👾 A React Native app to visualize your NFTs in AR
Stars: ✭ 71 (+57.78%)
Mutual labels:  dapp, web3, metamask
cyberevents
The protocol for EVENTs and TICKETs
Stars: ✭ 16 (-64.44%)
Mutual labels:  dapp, web3, web3js
Web3 Vs Ethers
A basic cheatsheet of Web3.js vs Ethers (along w/ example apps!)
Stars: ✭ 103 (+128.89%)
Mutual labels:  dapp, web3, web3js
solidity-cli
Compile solidity-code faster, easier and more reliable
Stars: ✭ 49 (+8.89%)
Mutual labels:  dapp, web3, web3js
Eth Crypto
Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
Stars: ✭ 420 (+833.33%)
Mutual labels:  dapp, web3, web3js
Starter Kit
An OpenZeppelin starter kit containing React, OpenZeppelin SDK & OpenZeppelin Contracts.
Stars: ✭ 101 (+124.44%)
Mutual labels:  dapp, web3, web3js
Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions.
Stars: ✭ 237 (+426.67%)
Mutual labels:  dapp, web3, web3js
create-react-native-dapp
Your next Ethereum application starts here. ⚛️ 💪 🦄
Stars: ✭ 410 (+811.11%)
Mutual labels:  dapp, web3
zksync-dapp-checkout
zkCheckout — trustable permissionless DeFi payment gateway. Brand new zkSync dApp w/t all L2 perks: fast&cheap transfers / simple&quick withdrawal
Stars: ✭ 37 (-17.78%)
Mutual labels:  dapp, web3
SkyGallery
Create galleries by uploading images and videos. Powered by Sia Skynet.
Stars: ✭ 23 (-48.89%)
Mutual labels:  dapp, web3
nextjs-dapp-starter-ts
A fullstack monorepo template to develop ethereum dapps
Stars: ✭ 228 (+406.67%)
Mutual labels:  dapp, web3
dtube
Decentralized video sharing & social media platform on Ethereum blockchain.
Stars: ✭ 70 (+55.56%)
Mutual labels:  dapp, web3
connect-metamask-react-dapp
Build a simple React / Web3 Dapp that replicates a small portion of the Uniswap v2 interface
Stars: ✭ 204 (+353.33%)
Mutual labels:  web3, metamask
LunDAO
LunDAO 是一個鼓勵撰寫與 Ethereum 社群相關的中深度的中文文章,透過一個短期的實驗專案嘗試 DAO 可以如何進行社群治理以及回饋社群貢獻。
Stars: ✭ 50 (+11.11%)
Mutual labels:  dapp, web3
svelte-box
A truffle box for svelte
Stars: ✭ 60 (+33.33%)
Mutual labels:  dapp, metamask
colonyDapp
Colony dApp client
Stars: ✭ 52 (+15.56%)
Mutual labels:  dapp, web3
vue-web3
🐙 Web3 blockchain bindings for Vue.js (inspired by Vuefire and Drizzle)
Stars: ✭ 63 (+40%)
Mutual labels:  dapp, web3

⚠️ This project is deprecated. We are no longer actively developing new features nor addressing issues. Read here for more info, and reach out if you are interested in taking over maintenance. We suggest looking into web3-react for a popular alternative to this project.

openzeppelin-network.js

CircleCI npm (scoped)

One line access to Web3 in your dApp.

  • Hides various Web3 providers behind common API.
  • One line access to the Web3 providers (Metamask, Infura, Geth, Portis and etc).
  • Supports multiple Web3 providers within the same app.
  • First class support of meta-txs.
  • React integration using hooks.
  • Network, accounts, and connection changed events for all web3 providers.
  • Will fire events even for HTTP and forcefully terminated providers.

Overview

Installation

npm install @openzeppelin/network

Usage

With React Hooks

Import the library:

import { useWeb3Injected, useWeb3Network, useEphemeralKey } from '@openzeppelin/network/react';

Get Web3Context with React Hooks inside functional component:

const injected = useWeb3Injected();
const local = useWeb3Network('http://127.0.0.1:8545');

Use Web3Context to get fresh data:

const { accounts, networkId, networkName, providerName, lib, connected } = web3Context;

Network.js will re-render component when network, accounts or connetion state change.

To use GSN with any hook specify GSN as an option, providing a signing key:

const local = useWeb3Network('http://127.0.0.1:8545', {
  gsn: { signKey: useEphemeralKey() }
});

With Vanilla Javascript

Import the library:

import { fromInjected, fromConnection } from '@openzeppelin/network';

Get Web3Context:

const injected = await fromInjected();
const local = await fromConnection('http://127.0.0.1:8545');

To use GSN include a gsn option, including a signing key:

const local = await fromConnection('http://127.0.0.1:8545', {
  gsn: { signKey: ephemeral() }
});

Use Web3Context to get fresh data immediately:

const { accounts, networkId, networkName, providerName, lib, connected } = web3Context;

Subscribe to events to get notified:

function updateNetwork(networkId, networkName) {}
function updateAccounts(accounts) {}
function updateConnection(connected) {}

web3Context.on(Web3Context.NetworkIdChangedEventName, updateNetwork);
web3Context.on(Web3Context.AccountsChangedEventName, updateAccounts);
web3Context.on(Web3Context.ConnectionChangedEventName, updateConnection);

Unsubscribe from events once you don't need them:

web3Context.off(Web3Context.NetworkIdChangedEventName, updateNetwork);
web3Context.off(Web3Context.AccountsChangedEventName, updateAccounts);
web3Context.off(Web3Context.ConnectionChangedEventName, updateConnection);

Learn More

  • Try it out on the GSN Starter Kit: run npx @openzeppelin/cli unpack gsn in a new directory and follow the instructions.
  • For detailed usage information, take a look at the API Reference.

License

Released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].