argent-connect-core

Argent-Connect core library

Usage no npm install needed!

<script type="module">
  import argentConnectCore from 'https://cdn.skypack.dev/argent-connect-core';
</script>

README

argent-connect-core

Installation

Node.js

npm install argent-connect-core

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