0.2.11 • Published 5 years ago

argent-connect-react v0.2.11

Weekly downloads
2
License
LGPL-3.0
Repository
github
Last release
5 years ago

argent-connect-react

Installation

Node.js

npm install argent-connect-react

Usage

Create a storage object for the dapp key:

const dappStorage = new ArgentConnect.StorageLocalEncrypted(); // or const dappStorage = new ArgentConnect.StorageLocal();

Define the contracts and methods your dapp will call:

const dappAuthorizations: [
    {
      contract: '<my contract 1 address>',
      methodName: '<method 1>',
      methodSig: ['0x5b372532']
    },
    {
      contract: '<my contract 1 address>',
      methodName: '<method 2>',
      methodSig: ['0xd5b50610']
    },
    {
      contract: '<my contract 2 address>',
      methodName: '<method 1>',
      methodSig: ['0xce0d947a']
    }
  ];

Create your Argent configuration:

const argentConfig = {
  dappName: "My Dapp",
  authorizations: dappAuthorizations,
  storage: dappStorage,
  rpcUrl: "https://ropsten.infura.io/v3/<my Infura Key>"
}

React

Include the Argent Connect button in your render method:

<ArgentConnectReactButton config={argentConfig} onConnected={this.onConnectedWithArgent} />

The button has a onConnected property that returns a Provider object when the User has successfully connected with Argent. Make sure to use this Provider to instantiate Web3:

onConnectedWithArgent = async (provider) => { this.web3 = new Web3(provider); }

Contribute

The initial project was crafted by the team at Argent. However, we encourage anyone to help implement new features and to keep this library up-to-date. For features and fixes, simply submit a pull request to the develop branch. Please follow the contributing guidelines.

For bug reports and feature requests, please open an issue.

License

Released under LGPL-3.0

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago