JSPM

  • Created
  • Published
  • Downloads 172
  • Score
    100M100P100Q77430F
  • License MIT

Squarelink's Web3 library

Package Exports

  • squarelink

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (squarelink) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Squarelink

Squarelink Web3 SDK

license

This is the Squarelink Web3 SDK which enables Squarelink enhancements to standard Web3 JSON RPC requests.

Check out the Squarelink Documentation for more information, quick-start guides, etc.

Installation

Node

$ npm install squarelink

CDN

<script src="https://squarelink.com/js/squarelink.min.js"></script>

Usage

First, register your application at dev.squarelink.com to obtain your CLIENT ID

import Web3 from 'web3'
import Squarelink from 'squarelink'

const sqlk = new Squarelink('<CLIENT ID>')
const web3 = new Web3(sqlk.getProvider())

// List Ethereum accounts owned by a Squarelink user
web3.eth.getAccounts().then(console.log)

Configuration

const sqlk = new Squarelink(clientId [, network, opts])

Squarelink-Object - Initializes a Squarelink Web3 Provider for you

  • clientId-String - The Client ID provided to you when you register your DApp in the Squarelink Developer Console

  • network-String|Object - Configures the RPC node you're connecting to. Read the docs for more info. Defaults to 'mainnet'.

  • opts - Object - Pass additional options to the Squarelink SDK.

Examples

// connect to the Ropsten network
new Squarelink('<CLIENT ID>', 'ropsten')
// connect to a custom private network
new Squarelink('<CLIENT ID>', {
  url: 'https://localhost:8545',
  chainId: 420
})

Options (opts)

  • scope - Array - Request additional scopes to use custom Squarelink functions.

Available Scopes:

  • user - Equivalent to all scopes below
  • user:name - Access to read user's name
  • user:email - Access to user's email address
  • user:security - Access to read user's security settings

Additional Functions

  • Squarelink.getName() - requires the user or user:name scope

  • Squarelink.getEmail() - requires the user or user:email scope

  • Squarelink.getSecuritySettings() - requires the user or user:security scope

Documentation

https://docs.squarelink.com

License

MIT