SDK

Authereum SDK

Using Authereum as a Web3 provider is recommended, but you can also use the Authereum SDK directly.

Example of initializing Authereum SDK:

import Authereum from 'authereum
const authereum = new Authereum('kovan')

Options:

  • Networks

    • mainnet

    • kovan

    • rinkeby

    • ropsten

    • goerli

  • Configuration object and overrides

    • config

      • networkName - default: mainnet

      • rpcUri - default: https://mainnet.rpc.authereum.org

      • webUri - default: https://accounts.authereum.org

      • xsUri - default: https://x.authereum.org

      • disableNotifications - default: false

    • Example:

      const authereum = new Authereum({
      networkName: 'kovan',
      disableNotifications: true
      })

Events

  • ready

    • Emitted when SDK is ready to be used

  • iframeReady

    • Emitted when iframe connection is ready

    • openPopup

      Emitted when popup has opened, typically from a login request.

  • closePopup

    • Emitted when popup has closed, typically from logging in.

  • login

    • Emitted when user successfully logged in.

  • logout

    • Emitted when user logs out.

  • error

    • Emitted when ever there's an error.

Examples

Logging in:

import Authereum from 'authereum
const authereum = new Authereum('kovan')
await authereum.login()

Getting account address:

import Authereum from 'authereum
const authereum = new Authereum('kovan')
const address = await authereum.getAccountAddress()

Events:

import Authereum from 'authereum
const authereum = new Authereum('kovan')
authereum
.on('ready', () => {
console.log('ready')
})
.on('error', err => {
console.error(err)
})