live-eosjs

1.0.1 • Public • Published

NPM

live-eosjs

Javascript SDK for EOS LIVE Dapp

Usage

  • Npm
import live from 'live-eosjs/browser';
console.log(live.isConnected());
  • Html script tag.
<html>
<head>
    <meta charset="utf-8">
    <script src="./node_modules/live-eosjs/dist/browser.umd.js"></script>
    <script>
        var live = window.WebViewInvoke;
        console.log(live.isConnected());
    </script>
</head>
</html>

Start to use

Firstly, bind some functions which exposed from EOS LIVE.

const Transfer = live.bind('transfer');
const PushEosAction = live.bind('pushEosAction');

Now, we can use them.

let result = await Transfer(params);
// 'return result'

In addition, you can use them without definition too.

let result = await live.fn.transfer();
// 'return result'

API

live.transfer

live.transfer(params);
Parameters

params - Object:

  • from: String
  • to: String
  • amount: String | Number
  • symbol: String
  • precision: Number | String
  • contract: String
  • memo: String - (optional)
Returns

Object:

  • status: Number
  • data: Object
    • transactionId: Stirng
  • message: String
Example
let result = await live.transfer({
    from: 'superoneioaa',
    to: 'superoneiobb',
    amount: '0.0100',
    symbol: 'EOS',
    precision: 4,
    contract: 'eosio.token',
    memo: 'test'
});

> {
    status: 200,
    data: { transactionId: '' },
    message: 'success'
}

live.getCurrentWallet

live.getCurrentWallet()
Returns

Object:

  • status: Number
  • data: Object
    • name: String
  • message: String
Example
let result = await live.getCurrentWallet();

> {
    status: 200,,
    data: {
        name: 'superoneioaa',
    },
    message: 'success'
}

live.getEosBalance

live.getEosBalance(params);
Parameters

params - Object:

  • account: String
  • contract: String
  • symbol: String
Returns

Object:

  • status: Number
  • data: Object
    • symbol: String
    • balance: String
    • contract: String
    • account: String
  • message: String
Example
let result = await live.getEosBalance({
    account: 'superoneioaa',
    contract: 'eosio.token',
    symbol: 'EOS'
});

> {
    status: 200,
    data: { "symbol": "EOS", "balance": "["100 EOS"]", "contract": "eosio.token", "account": "superoneioaa" },
    message: 'success'
}

live.getVersion

live.getVersion();
Returns

Object:

  • status: Number
  • data: Object
    • version: String
  • message: String
Example
let result = await live.getVersion();

> {
    status: 200,
    data: { "version": "1.2.1" },
    message: 'success'
}

Readme

Keywords

Package Sidebar

Install

npm i live-eosjs

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

23.2 kB

Total Files

12

Last publish

Collaborators

  • huangyongbiao