Skip to content
Javascript SDK for the Lightstreams Gateway API
JavaScript Other
Branch: master
Clone or download
Latest commit 6f14712 Aug 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Fixed wrong issue github template May 31, 2019
example Fix JS vulnerabilities Aug 5, 2019
lib Update libs Aug 5, 2019
src Fix JS vulnerabilities Aug 5, 2019
.babelrc Providing Browser compatible version of library May 15, 2019
.browserslistrc Fixing browser compatibility of sdk May 15, 2019
.gitignore First commit Feb 4, 2019
LICENSE Created LICENSE Mar 8, 2019
README.md Fix JS vulnerabilities Aug 5, 2019
package-lock.json
package.json Fixed error not json response | Upgrade lib version May 23, 2019

README.md

Lightstreams JS SDK

This repository is a Javascript SDK to facilitate the usage of functionalities implemented in the Lightstreams node (also known as the Lightstreams Gateway node, or simply Gateway), http api.

Requirements

How to use

Install node module

Install lightstreams-js-sdk as part of your project dependencies:

npm install git+ssh://git@github.com:lightstreams-network/lightstreams-js-sdk#master --save

Sample usage

const Gateway = require('lightstreams-js-sdk')
const gateway = Gateway('https://gateway.sirius.lightstreams.io')

Once LightstreamsSDK is initialized you interact with it as follow:

// Get user balance
const account = "0xa981f8ca77d069d79b609ca0069b052db79e7e30"
const { balance } = await gateway.wallet.balance(account)

Available Methods

Gateway SDK interface is made to match, one to one, every available smart vault endpoints.

  • /user/signup -> gateway.user.signUp(password)

  • /user/signin -> gateway.user.signIn(account, password)

  • /wallet/balance -> gateway.wallet.balance(account)

  • /wallet/transfer -> gateway.wallet.transfer(from, password, to, amountWei)

  • /storage/add -> gateway.storage.add(owner, password, file)

  • /storage/fetch -> gateway.storage.fetch(meta, token, stream)

  • /acl/grant -> gateway.acl.grant(acl, owner, password, to, permission)

  • /acl/revoke -> gateway.acl.revoke(acl, owner, password, to)

  • /acl/grant-public -> gateway.acl.grantPublic(acl, owner, password)

  • /acl/revoke-public -> gateway.acl.revokePublic(acl, owner, password)

  • /shop/create -> gateway.shop.create(from, password)

  • /shop/shell -> gateway.shop.sell(shop, from, password, acl, priceWei)

  • /shop/buy -> gateway.shop.buy(shop, from, password, acl)

  • /erc20/balance -> gateway.erc20.balance(erc20_address, account)

  • /erc20/transfer -> gateway.erc20.transfer(erc20_address, from, password, to, amount)

  • /erc20/purchase -> gateway.erc20.purchase(erc20_address, account, password, amount_wei)

Smart Vault

See available gateway APIs endpoints

Sirius

Lightstreams provides one public gateway endpoint running over Lightstreams test network, Sirius:

https://gateway.sirius.lightstreams.io

Local

You also can run your own local node of lightstreams smart vault. Follow the instructions here

Development

Install

npm i

Recompile lib from src

npm run build

Sample project

Bugs, Issues, Questions

If you find any bugs or simply have a question, please write an issue and we'll try and help as best we can.

You can’t perform that action at this time.