eos-lynx v1.1.3
EOS Lynx Client Library
The EOS Lynx library provides convenient access to the EOS Lynx desktop API from applications written in client-side Javascript.
Keep in mind that this libary is meant for use with client-side code and will utilize deep-linking to open up EOS Lynx desktop.
Documentation
See the Developers page for EOS Lynx.
Installation
Install the package with:
npm install --save eos-lynx
Usage/Methods
This package contains three methods. Each of these methods returns a promise.
Get Account Info and Confirm Wallet Owner
This function will retrieve account information of the current active account on EOS Lynx. If true
is passed in for wantTokenBal
, this will return a list of the current user's token balances. If true
is passed in for wantAppVersion
, this will return the version of EOS Lynx desktop that the user is using.
var eoslynx = require('eos-lynx');
eoslynx.getAccountInfo(apikey, wantTokenBal, wantAppVersion, session);
//examples
eoslynx.getAccountInfo('thisismyapikey123456', true, false, 'session123')
.then(response => {
console.log(response);
});
Transfer
This function will transfer EOS or other tokens to an account. The last argument, memo, is optional.
var eoslynx = require('eos-lynx');
//transfer EOS or other tokens to your account
eoslynx.transfer(apikey, toAccount, amount, symbol, memo);
//examples
eoslynx.transfer('thisismyapikey123456', 'lynxlynxlynx', 0.001, 'EOS', 'memoooo')
.then(response => {
console.log(response);
});
eoslynx.transfer('thisismyapikey123456', 'lynxlynxlynx', 0.100, 'IQ')
.then(response => {
console.log(response);
});
Contract Actions
This function will call actions on a contract. For security purposes, you must let us know what contracts you will be interacting with first.
The session
argument is an optional string identifier that you can send to us and we will send back to you in the response.
var eoslynx = require('eos-lynx');
//call actions on a contract
eoslynx.contractActions(apikey, actionArray, session);
//examples
const actionArray = [
{
contract: 'jennytesters',
action: 'hi',
data: { user: 'thelynxparty', text: 'english' }
},
{
contract: 'jennytesters',
action: 'bonjour',
data: { user: 'thelynxparty', text: 'french' }
},
{
contract: 'eosio.token',
action: 'transfer',
data: { quantity: '0.0010 EOS', memo: 'test contract' }
}
];
eoslynx.contractActions('thisismyapikey123456', actionArray, 'session123')
.then(response => {
console.log(response);
});