Miss any of our Open RFC calls?Watch the recordings here! »

shipl

2.1.17 • Public • Published

Shipl JS SDK

Browser and NodeJS web3 provider for the Shipl API

Integrate Shipl in your Dapp

The Shipl SDK provides convenient access to the Shipl API into your javascript dApp. Shipl enable developers to create ethereum dApp without the usual UX complexity by abstracting the gas and making feesless transactions for the end user.

Documentation

See the API documentation

Installation

You can install the library via npm:

npm i shipl

Usage

The package need to be configured with an ethereum private key or a web3 wallet instance (eg. Metamask)

import Shipl from 'shipl';
 
const shipl = new Shipl({
    appId: 'YOUR_SHIPL_APP_ID' // This is the appID created in your Shipl Account at console.shipl.co
})

Then login into shipl. You have to pass an input callback to make the shipl SDK capable to ask for the phone number and then for the code verifcation send by SMS. For example on node you can use readline-sync.

const { identity, deviceKey } = await shipl.login(readline.question)

Then pass you can pass the shipl sdk into any web3 compatible library. Don't forget to execute the start function to launch the web3 provider.

const web3 = new Web3(shipl.getWeb3Provider());

Then you can call a contract in the regular web3 way

const targetContract = new web3.eth.Contract(abi, contractAddress);
 
targetContract.methods
  .register('0x' + config.address, 1)
  .send({ from: '0x' + config.address })
  .on('transactionHash', transactionHash => {
    console.log('This the transactionHash', transactionHash);
  });

Browser Window Quick Start

For use directly in the browser you can reference the shipl distribution files from a number of places. They can be found in our npm package in the 'dist' folder or you can build them locally from this repo.

For a quick setup you may also request a remote copy from unpkg CDN as follows:

<!-- The most recent minified version  -->
<script src="https://unpkg.com/shipl/dist/shipl.js"></script>
<!-- You can also fetch specific versions by specifying the version, files names may differ for past versions -->
<script src="https://unpkg.com/shipl@<version>/dist/shipl.js"></script> 

To see all available dist files on unpkg, vist unpkg.com/shipl/dist

Then to instantiate the shipl object from the browser window object:

const Shipl = window.shipl
const shipl = new Shipl({ appId: 'YOUR_SHIPL_APP_ID' })

Examples

For a more in depth guide, check out our documentation site or clone this poke shipl repository.

Install

npm i shipl

DownloadsWeekly Downloads

41

Version

2.1.17

License

AGPL-3.0

Unpacked Size

43.3 kB

Total Files

3

Last publish

Collaborators

  • avatar