This package has been deprecated

Author message:

This project is deprecated. We are no longer actively developing new features nor addressing issues. Head to the readme for more information.

@openzeppelin/gsn-helpers

0.2.4 • Public • Published

⚠️ This project is deprecated. All development on the GSN has been moved to the OpenGSN organization. Please refer to the OpenGSN localgsn implementation. We won't be developing new features nor addressing issues. Read here for more info.

OpenZeppelin GSN Helpers

NPM Package

Helper functions and scripts for using the Gas Station Network. Develop and test your GSN application with minimal setup.

Provides methods for:

  • Deploying a RelayHub instance
  • Funding a recipient
  • Query a recipient's or relayer owner's GSN balance
  • Running and registering a relayer
  • Withdrawing a relayer's revenue

Overview

Installation

$ npm install @openzeppelin/gsn-helpers

Usage

The GSN Helpers come in two flavors: a command-line interface and a JavaScript library, providing high flexibility.

The following samples show how to use each to deploy the RelayHub contract, fund a recipient and then start a relayer server.

Using the CLI

$ npx oz-gsn deploy-relay-hub --ethereumNodeURL http://localhost:8545
Deploying singleton RelayHub instance
RelayHub deployed at 0xd216153c06e857cd7f72665e0af1d7d82172f494

$ npx oz-gsn fund-recipient --recipient <address> --amount 50000000
Recipient <address> balance is now 50000000 wei

$ npx oz-gsn run-relayer --ethereumNodeURL http://localhost:8545 --quiet
Starting relayer
~/.cache/gsn-nodejs/gsn-relay-v0.2.1
 -EthereumNodeUrl http://localhost:8545
 -RelayHubAddress 0xd216153c06e857cd7f72665e0af1d7d82172f494
 -Port 8090
 -Url http://localhost:8090
Relay is funded and ready!

Using the JavaScript library

const {
  deployRelayHub,
  runRelayer,
  fundRecipient,
} = require('@openzeppelin/gsn-helpers');

const web3 = new Web3('http://localhost:8545');

await deployRelayHub(web3);

await runRelayer(web3, { quiet: true });

await fundRecipient(web3, { recipient: <address>, amount: 50000000 });

NOTE: All of these actions require a local blockchain to be running in the background on port 8545.

Learn More

License

The MIT License.

Dependents (3)

Package Sidebar

Install

npm i @openzeppelin/gsn-helpers

Weekly Downloads

29

Version

0.2.4

License

MIT

Unpacked Size

124 kB

Total Files

30

Last publish

Collaborators

  • ernestognw
  • ericglau
  • frangio
  • amxx
  • mcarlomagno
  • collins-oz
  • dylkil
  • zeljkox
  • namis
  • tirumerla