This repository has been archived by the owner on Aug 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
51 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# OpenZeppelin GSN Provider | ||
|
||
[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/gsn-provider.svg)](https://www.npmjs.org/package/@openzeppelin/gsn-provider) | ||
[![Build Status](https://circleci.com/gh/OpenZeppelin/openzeppelin-gsn-provider.svg?style=shield)](https://circleci.com/gh/OpenZeppelin/openzeppelin-gsn-provider) | ||
|
||
# GSN Provider | ||
|
||
**A web3.js compatible provider for sending transactions via the Gas Station Network (GSN)**. This package wraps a modified version of the [`RelayClient`](https://github.com/tabookey/tabookey-gasless/blob/master/src/js/relayclient/RelayClient.js) from `tabookey-gasless` with a custom web3 Provider. | ||
|
||
## Overview | ||
|
||
### Installation | ||
|
||
```console | ||
$ npm install @openzeppelin/gsn-provider | ||
``` | ||
|
||
### Usage | ||
|
||
Create a `GSNProvider` and use it as the provider for your web3 instance: | ||
|
||
```javascript | ||
const Web3 = require("web3"); | ||
const { GSNProvider } = require("@openzeppelin/gsn-provider"); | ||
|
||
const web3 = new Web3(new GSNProvider("http://localhost:8545")); | ||
``` | ||
|
||
Transactions sent to contracts will then be automatically routed through the GSN: | ||
|
||
```javascript | ||
const myContract = new web3.eth.Contract(abi, address); | ||
|
||
// Sends the transaction via the GSN | ||
await myContract.methods.myFunction().send({ from }); | ||
|
||
// Disable GSN for a specific transaction | ||
await myContract.methods.myFunction().send({ from, useGSN: false }); | ||
``` | ||
|
||
## Learn More | ||
|
||
* Check out [Getting Started](docs/modules/ROOT/pages/getting-started.adoc) to use GSN Provider in a new project. | ||
* The [Testing GSN Applications](docs/modules/ROOT/pages/testing-gsn-applications.adoc) will teach you how to test your project locally. | ||
* For detailed usage information, take a look at the [API Reference](docs/modules/ROOT/pages/api.adoc). | ||
|
||
|
||
## License | ||
|
||
Released under the MIT License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
=== Installation | ||
|
||
```bash | ||
```console | ||
$ npm install @openzeppelin/gsn-provider | ||
``` | ||
|
||
|