Desktop API

The following examples are for desktop only. To get started you will need to download EOS Lynx Desktop here. If you need an API key fill out this form and we will reach out to you to get you set up. Request API key


NOTE: This api is only currently available on the latest EOS Lynx Desktop application.


Getting Started

You must first download and install the EOS Lynx node package module. This package will enable your client/app to directly communicate with EOS Lynx. Keep in mind that this library is meant for use with client-side code and will utilize deep-linking to open up EOS Lynx desktop.

npm install --save eos-lynx
        

This package gives you access to three functions. Each of these functions will return a promise.


Get Account Information and Confirm Wallet Owner

Client-side code

Calling this function will open up EOS Lynx and request users to enter their pin. Once they've successfully unlocked their wallet and verified that they control their wallet, EOS Lynx will send account information back to the dApp.

var eoslynx = require('eos-lynx');
        
eoslynx.getAccountInfo(apikey, wantTokenBal, wantAppVersion, session);
        
//example
eoslynx.getAccountInfo('thisismyapikey123456', true, false, 'session123')
.then(response => {
  console.log(response);
});
Arguments
apikey
string
Unique API key given to you by the EOS Lynx team.
wantTokenBal
boolean
Sending true will return back the list of token balances of the account.
wantAppVersion
boolean
Sending true will return back the version of the EOS Lynx app the user is using.
session
Optional, string
A string identifier that you can send to us and we will send back to you in the response.

Response Object

This is what the response will be when your user confirms the account with EOS Lynx. Account name will always be returned, while token, version, and session fields may be empty if these fields are not requested.


{
  "account": {
    "account_name": "testtesttest",
    "head_block_num": 20247653,
    "head_block_time": "2018-10-19T23:25:02.500",
    "privileged": false,
    "last_code_update": "1970-01-01T00:00:00.000",
    "created": "2018-10-19T23:24:53.500",
    "core_liquid_balance": "0.0100 EOS",
    "ram_quota": 3984,
    "net_weight": 1000,
    "cpu_weight": 1000,
    "net_limit": {
      "used": 0,
      "available": 19155,
      "max": 19155
    },
    "cpu_limit": {
      "used": 0,
      "available": 3644,
      "max": 3644
    },
    "ram_usage": 2996,
    "permissions": [
      {
        "perm_name": "active",
        "parent": "owner",
        "required_auth": {
        "threshold": 1,
        "keys": [
          {
            "key": "EOS7avhAgD47PyurmZPzG4frALAxAJRvqNycdLnsZ6HGY9Qinjk77",
            "weight": 1
          }
        ],
        "accounts": [],
        "waits": []
        }
      },
      {
        "perm_name": "owner",
        "parent": "",
        "required_auth": {
          "threshold": 1,
          "keys": [
            {
              "key": "EOS7avhAgD47PyurmZPzG4frALAxAJRvqNycdLnsZ6HGY9Qinjk77",
              "weight": 1
            }
          ],
          "accounts": [],
          "waits": []
        }
      }
    ],
    "total_resources": {
      "owner": "testtesttest",
      "net_weight": "0.1000 EOS",
      "cpu_weight": "0.1000 EOS",
      "ram_bytes": 2584
    },
    "self_delegated_bandwidth": null,
    "refund_request": null,
    "voter_info": null,
    "tokens": [
      "0.0100 EOS"
    ]
  },
	"tokens": [
		{
			"symbol": "EOS",
			"balance": "2.0436 EOS",
			"contract": "eosio.token",
			"precision": 4
		},
		{
			"symbol": "EETH",
			"balance": "10000.0000 EETH",
			"contract": "ethsidechain",
			"precision": 4
		},
		{
			"symbol": "PUB",
			"balance": "4846.8660 PUB",
			"contract": "publytoken11",
			"precision": 4
		},
		{
			"symbol": "EDNA",
			"balance": "0.0000 EDNA",
			"contract": "ednazztokens",
			"precision": 4
		}
	],
	"version": "0.4.8",
	"session": "Zeyo6L7VVlC2"
}
          

Transfer

Client-side code

This function will transfer EOS or other tokens to the account passed in to the function.


var eoslynx = require('eos-lynx');

//transfer EOS or other tokens to an account
eoslynx.transfer(apikey, toAccount, amount, symbol, memo);

//examples
eoslynx.transfer('thisismyapikey123456', 'lynxlynxlynx', 0.0010, 'EOS', 'this is a memo')
.then(response => {
  console.log(response);
});

eoslynx.transfer('thisismyapikey123456', 'lynxlynxlynx', 0.1000, 'IQ')
.then(response => {
  console.log(response);
});
        
Arguments
apikey
string
Unique API key given to you by the EOS Lynx team.
toAccount
string
The account you'd like to transfer funds to.
amount
number
The amount you'd like to transfer, in the correct decimals of precision.
symbol
string
The symbol of the currency you are sending.
memo
Optional, string
A note you'd like to send along with the transaction.

Response Object

We will send back the transaction object that the blockchain sends us.


{
  "broadcast": true,
  "transaction": {
    "compression": "none",
    "transaction": {
      "expiration": "2018-09-26T22:21:31",
      "ref_block_num": 32669,
      "ref_block_prefix": 3943246932,
      "max_net_usage_words": 0,
      "max_cpu_usage_ms": 0,
      "delay_sec": 0,
      "context_free_actions": [],
      "actions": [
        {
          "account": "eosio.token",
          "name": "transfer",
          "authorization": [
            {
              "actor": "workcoinirah",
              "permission": "active"
            }
          ],
          "data": "d0cc75d351042fe5d0a78f7dfad8a78f0a0000000000000004454f5300000000096d656d6f2d74657874"
        }
      ],
      "transaction_extensions": []
    },
    "signatures": [
      "SIG_K1_JwUVWDUTizP4xMZHE3nTx1waf7ohnhZAfZ7uUKTFqTnwibpCqRhaMDkKDCj9W6ab5JB3A7Q1PkxqyWzDcZoRRSBV9k7cbx"
    ]
  },
  "transaction_id": "aa5c41e92494d654f59ef6a7776ee0d5a7bb88e1dff06a83128755f34afc74a9",
  "processed": {
    "id": "aa5c41e92494d654f59ef6a7776ee0d5a7bb88e1dff06a83128755f34afc74a9",
    "block_num": 18514153,
    "block_time": "2018-09-26T22:20:33.500",
    "producer_block_id": null,
    "receipt": {
      "status": "executed",
      "cpu_usage_us": 287,
      "net_usage_words": 17
    },
    "elapsed": 287,
    "net_usage": 136,
    "scheduled": false,
    "action_traces": [
      {
        "receipt": {
          "receiver": "eosio.token",
          "act_digest": "457523dd3ec3fe96f81f13c4f49cc33c317b26bdf1967853d795be8d8e2e0a46",
          "global_sequence": 476063020,
          "recv_sequence": 21127959,
          "auth_sequence": [
            [
              "workcoinirah",
              94
            ]
          ],
          "code_sequence": 2,
          "abi_sequence": 2
        },
        "act": {
          "account": "eosio.token",
          "name": "transfer",
          "authorization": [
            {
              "actor": "workcoinirah",
              "permission": "active"
            }
          ],
          "data": {
            "from": "workcoinirah",
            "to": "lynxlynxlynx",
            "quantity": "0.0010 EOS",
            "memo": "memo-text"
          },
          "hex_data": "d0cc75d351042fe5d0a78f7dfad8a78f0a0000000000000004454f5300000000096d656d6f2d74657874"
        },
        "context_free": false,
        "elapsed": 109,
        "cpu_usage": 0,
        "console": "",
        "total_cpu_usage": 0,
        "trx_id": "aa5c41e92494d654f59ef6a7776ee0d5a7bb88e1dff06a83128755f34afc74a9",
        "block_num": 18514153,
        "block_time": "2018-09-26T22:20:33.500",
        "producer_block_id": null,
        "account_ram_deltas": [],
        "inline_traces": [
          {
            "receipt": {
              "receiver": "workcoinirah",
              "act_digest": "457523dd3ec3fe96f81f13c4f49cc33c317b26bdf1967853d795be8d8e2e0a46",
              "global_sequence": 476063021,
              "recv_sequence": 60,
              "auth_sequence": [
                [
                  "workcoinirah",
                  95
                ]
              ],
              "code_sequence": 2,
              "abi_sequence": 2
            },
            "act": {
              "account": "eosio.token",
              "name": "transfer",
              "authorization": [
                {
                  "actor": "workcoinirah",
                  "permission": "active"
                }
              ],
              "data": {
                "from": "workcoinirah",
                "to": "lynxlynxlynx",
                "quantity": "0.0010 EOS",
                "memo": "memo-text"
              },
              "hex_data": "d0cc75d351042fe5d0a78f7dfad8a78f0a0000000000000004454f5300000000096d656d6f2d74657874"
            },
            "context_free": false,
            "elapsed": 4,
            "cpu_usage": 0,
            "console": "",
            "total_cpu_usage": 0,
            "trx_id": "aa5c41e92494d654f59ef6a7776ee0d5a7bb88e1dff06a83128755f34afc74a9",
            "block_num": 18514153,
            "block_time": "2018-09-26T22:20:33.500",
            "producer_block_id": null,
            "account_ram_deltas": [],
            "inline_traces": []
          },
          {
            "receipt": {
              "receiver": "lynxlynxlynx",
              "act_digest": "457523dd3ec3fe96f81f13c4f49cc33c317b26bdf1967853d795be8d8e2e0a46",
              "global_sequence": 476063022,
              "recv_sequence": 30878,
              "auth_sequence": [
                [
                  "workcoinirah",
                  96
                ]
              ],
              "code_sequence": 2,
              "abi_sequence": 2
            },
            "act": {
              "account": "eosio.token",
              "name": "transfer",
              "authorization": [
                {
                  "actor": "workcoinirah",
                  "permission": "active"
                }
              ],
              "data": {
                "from": "workcoinirah",
                "to": "lynxlynxlynx",
                "quantity": "0.0010 EOS",
                "memo": "memo-text"
              },
              "hex_data": "d0cc75d351042fe5d0a78f7dfad8a78f0a0000000000000004454f5300000000096d656d6f2d74657874"
            },
            "context_free": false,
            "elapsed": 5,
            "cpu_usage": 0,
            "console": "",
            "total_cpu_usage": 0,
            "trx_id": "aa5c41e92494d654f59ef6a7776ee0d5a7bb88e1dff06a83128755f34afc74a9",
            "block_num": 18514153,
            "block_time": "2018-09-26T22:20:33.500",
            "producer_block_id": null,
            "account_ram_deltas": [],
            "inline_traces": []
          }
        ]
      }
    ],
    "except": null
  }
}

Contract

Client-side code

You can pass in an array of actions that you would like to be called on any number of smart contracts.


  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);
  });
        
Arguments
apikey
string
Unique API key given to you by the EOS Lynx team.
actionArray
array
An array of the actions that you'd like to call. See above example for structure of array.
session
Optional, string
A string identifier that you can send to us and we will send back to you in the response.

Response Object

This is what we will return to you when your user confirms the contract actions. The response will be an array of transactions successes/fails.

[
  {
    "broadcast": true,
    "transaction": {
      "compression": "none",
      "transaction": {
        "expiration": "2018-09-26T22:15:19",
        "ref_block_num": 31925,
        "ref_block_prefix": 1835350012,
        "max_net_usage_words": 0,
        "max_cpu_usage_ms": 0,
        "delay_sec": 0,
        "context_free_actions": [],
        "actions": [
          {
            "account": "jennytesters",
            "name": "hi",
            "authorization": [
              {
                "actor": "workcoinirah",
                "permission": "active"
              }
            ],
            "data": "e0f335b54f1f55cb07656e676c697368"
          }
        ],
        "transaction_extensions": []
      },
      "signatures": [
        "SIG_K1_K4hDcees2MwXm9or97qcADtJQbvnYYW9vMnivoDdUM5toMAbfzN4LnMmWxBk92jT9icpEPjLkfuQE7J7EHoXwVK7MH5jdG"
      ]
    },
    "transaction_id": "03c61c2b6cb108324d79068119f4b4ef1ae1f93f2b77c9a446d756dec49d02b1",
    "processed": {
      "id": "03c61c2b6cb108324d79068119f4b4ef1ae1f93f2b77c9a446d756dec49d02b1",
      "block_num": 18513411,
      "block_time": "2018-09-26T22:14:22.500",
      "producer_block_id": null,
      "receipt": {
        "status": "executed",
        "cpu_usage_us": 189,
        "net_usage_words": 14
      },
      "elapsed": 189,
      "net_usage": 112,
      "scheduled": false,
      "action_traces": [
        {
          "receipt": {
            "receiver": "jennytesters",
            "act_digest": "1cef0335807f493c8d6d19fac6d3dff493dcbbef1328ba14774835cdd2a12034",
            "global_sequence": 476055017,
            "recv_sequence": 66,
            "auth_sequence": [
              [
                "workcoinirah",
                91
              ]
            ],
            "code_sequence": 1,
            "abi_sequence": 1
          },
          "act": {
            "account": "jennytesters",
            "name": "hi",
            "authorization": [
              {
                "actor": "workcoinirah",
                "permission": "active"
              }
            ],
            "data": "e0f335b54f1f55cb07656e676c697368"
          },
          "context_free": false,
          "elapsed": 30,
          "cpu_usage": 0,
          "console": "",
          "total_cpu_usage": 0,
          "trx_id": "03c61c2b6cb108324d79068119f4b4ef1ae1f93f2b77c9a446d756dec49d02b1",
          "block_num": 18513411,
          "block_time": "2018-09-26T22:14:22.500",
          "producer_block_id": null,
          "account_ram_deltas": [],
          "inline_traces": []
        }
      ],
      "except": null
    }
  },
  {
    "broadcast": true,
    "transaction": {
      "compression": "none",
      "transaction": {
        "expiration": "2018-09-26T22:15:19",
        "ref_block_num": 31925,
        "ref_block_prefix": 1835350012,
        "max_net_usage_words": 0,
        "max_cpu_usage_ms": 0,
        "delay_sec": 0,
        "context_free_actions": [],
        "actions": [
          {
            "account": "jennytesters",
            "name": "bonjour",
            "authorization": [
              {
                "actor": "workcoinirah",
                "permission": "active"
              }
            ],
            "data": "e0f335b54f1f55cb066672656e6368"
          }
        ],
        "transaction_extensions": []
      },
      "signatures": [
        "SIG_K1_Kkv7FZfRCcT9xC6XBvVn4aQ8GgxWtgogH8w6fRwSm4Kiuh5cmLFA6EVwz2DvWSTWjEDbieNVgJMg8XPwgGT8ub7TQZ8XD5"
      ]
    },
    "transaction_id": "609d7dd7587349ddd454390a88b7eb3c3d9407e4b44749145f912b63ea0afba4",
    "processed": {
      "id": "609d7dd7587349ddd454390a88b7eb3c3d9407e4b44749145f912b63ea0afba4",
      "block_num": 18513411,
      "block_time": "2018-09-26T22:14:22.500",
      "producer_block_id": null,
      "receipt": {
        "status": "executed",
        "cpu_usage_us": 180,
        "net_usage_words": 14
      },
      "elapsed": 180,
      "net_usage": 112,
      "scheduled": false,
      "action_traces": [
        {
          "receipt": {
            "receiver": "jennytesters",
            "act_digest": "1b0724a064c135e44ecdc64bc6cca2e3efc2f0742e632577445c3936e542cfb3",
            "global_sequence": 476055021,
            "recv_sequence": 67,
            "auth_sequence": [
              [
                "workcoinirah",
                92
              ]
            ],
            "code_sequence": 1,
            "abi_sequence": 1
          },
          "act": {
            "account": "jennytesters",
            "name": "bonjour",
            "authorization": [
              {
                "actor": "workcoinirah",
                "permission": "active"
              }
            ],
            "data": "e0f335b54f1f55cb066672656e6368"
          },
          "context_free": false,
          "elapsed": 26,
          "cpu_usage": 0,
          "console": "",
          "total_cpu_usage": 0,
          "trx_id": "609d7dd7587349ddd454390a88b7eb3c3d9407e4b44749145f912b63ea0afba4",
          "block_num": 18513411,
          "block_time": "2018-09-26T22:14:22.500",
          "producer_block_id": null,
          "account_ram_deltas": [],
          "inline_traces": []
        }
      ],
      "except": null
    }
  },
  {
    "broadcast": true,
    "transaction": {
      "compression": "none",
      "transaction": {
        "expiration": "2018-09-26T22:15:19",
        "ref_block_num": 31925,
        "ref_block_prefix": 1835350012,
        "max_net_usage_words": 0,
        "max_cpu_usage_ms": 0,
        "delay_sec": 0,
        "context_free_actions": [],
        "actions": [
          {
            "account": "jennytesters",
            "name": "hola",
            "authorization": [
              {
                "actor": "workcoinirah",
                "permission": "active"
              }
            ],
            "data": "e0f335b54f1f55cb077370616e697368"
          }
        ],
        "transaction_extensions": []
      },
      "signatures": [
        "SIG_K1_K8MeckZDWMrauxn3netokW9SR3H9W1sZwtSNWMTrrBeEGj3Bn3pPnE4hesbTnxLczN3dSK6tBmJjFe3JNm8AJMzoJbwknu"
      ]
    },
    "transaction_id": "8b9260e0970ad5d654f02b9a24b0a8d9bf14227667fa8660fe1efffad690cd71",
    "processed": {
      "id": "8b9260e0970ad5d654f02b9a24b0a8d9bf14227667fa8660fe1efffad690cd71",
      "block_num": 18513411,
      "block_time": "2018-09-26T22:14:22.500",
      "producer_block_id": null,
      "receipt": {
        "status": "executed",
        "cpu_usage_us": 177,
        "net_usage_words": 14
      },
      "elapsed": 177,
      "net_usage": 112,
      "scheduled": false,
      "action_traces": [
        {
          "receipt": {
            "receiver": "jennytesters",
            "act_digest": "fccadb89f53a1ceb6d3c577d62954a9209e38b779f5719796c3b2fd10b51129e",
            "global_sequence": 476055027,
            "recv_sequence": 68,
            "auth_sequence": [
              [
                "workcoinirah",
                93
              ]
            ],
            "code_sequence": 1,
            "abi_sequence": 1
          },
          "act": {
            "account": "jennytesters",
            "name": "hola",
            "authorization": [
              {
                "actor": "workcoinirah",
                "permission": "active"
              }
            ],
            "data": "e0f335b54f1f55cb077370616e697368"
          },
          "context_free": false,
          "elapsed": 29,
          "cpu_usage": 0,
          "console": "",
          "total_cpu_usage": 0,
          "trx_id": "8b9260e0970ad5d654f02b9a24b0a8d9bf14227667fa8660fe1efffad690cd71",
          "block_num": 18513411,
          "block_time": "2018-09-26T22:14:22.500",
          "producer_block_id": null,
          "account_ram_deltas": [],
          "inline_traces": []
        }
      ],
      "except": null
    }
  }
]