elph-sdk
v0.0.3
Published
<a href="https://elph.com" target="_blank"> <img src="https://s3.amazonaws.com/elph-static/logo.svg" height="85px"> </a>
Downloads
5
Readme
Elph Network SDK
Elph Network SDK is a javascript library that provides all the functionality to connect to the Elph Network. It allows for transactions to be sent and received as well as allows for access to the running interactions of the Elph Network via plasma chains.
Production Usage
Elph Block Explorer: Live block explorer for Elph Network Testnet, listening to blocks and transactions that are occurring on any Elph Plasma Chain.
Elph Plasma Demo: Demo application showcasing the user experience around using a plasma sidechain. The SDK is used to initiate deposits, micropayments, and withdrawals from the Elph Plasma Chain.
Have a project to add to our list? Create a PR adding a description and we're happy to include it!
Key Features
- Interactions with Elph Network
- Get status of any running plasma chain
- Get Blocks and Transactions that are being created on the Elph Network
- Create and sign transactions on the Elph Network
- Interactions with Ethereum Network
- Send Ethereum
- Deposit funds to Plasma contract on the Ethereum Mainnet
- Withdraw funds form Plasma contract on the Ethereum Mainnet
Installation
To use the Elph Network for your dApp, the SDK must be loaded in one of the following ways:
npm
$ npm install elph-sdk
CDN
You can also include the bundled file hosted on jsdelivr's CDN:
<script src="https://cdn.jsdelivr.net/npm/elph-sdk/index.iife.js"></script>
Import
Elph should be imported into the same part of the code where you initialize web3
CommonJS
var Elph = require('elph').Elph;
Typescript / ES2015 (ES6)
import Elph from "elph-sdk";
CDN
var Elph = window.ElphSDK.Elph;
Usage
Once the Elph SDK has been included, you only need an RPC url of an Elph Plasma Chain to initialize it.
The options passed in can be customized in any ways, shown below are the defaults if a value is not passed in.
var options = {
'url': null, // RPC URL for Elph Plasma Chain
'rootChainContractAddress': null, // Address of Plasma contract on Ethereum
'key': null, // Private Key with which to initialize client
'web3ProviderUrl': DEV_WEB3_PROVIDER_URL // Web3 Provider to use for all transactions
}
var elph = new Elph(options)
Once initialized calls can simply be made directly on the object. All the functions provided return promises.
> elph.getStatus().then(console.log)
Running
> elph.getBlockNumber().then(console.log)
11412000
...
More documentation on API functions are coming soon!
Development
To clone and run this application, you'll need Git and Node.js. We also recommend using Yarn over NPM. From your command line:
# Clone this repository
$ git clone https://github.com/elphnetwork/elph-sdk.git
# Go into the repository
$ cd elph-sdk
# Install dependencies
$ yarn install
Note: If you're using Linux Bash for Windows, see this guide or use node
from the command prompt.
Deployment
To deploy a production optimized version of the block-explorer:
# Build this repository
$ yarn build
# Creates 'dist/' folder with production ready code
Related
block-explorer - Elph Block Explorer that uses this SDK
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Contact
Interested in getting touch with the Elph team? Feel free to join our telegram to ask any questions or share any feedback!