Desktop API

The following examples are for desktop only. To get started you will need to download the EOS Lynx Desktop. Download here. If you need an API key fill out this form and watch your email. Request API key


Get Account Information and Confirm Wallet Owner

Open EOS Lynx Desktop With Deeplink

Using deep linking, pass EOS Lynx your api key. This will open up EOS Lynx and request users to enter their pin. Once they've successfully unlocked their wallet, EOS Lynx will send back the account name to the dApp. Optional query params could be added to return other information, such as token balance and app version number.

window.location.assign('eoslynx://confirm? 
    apikey=hello&tokenbal=true&appversion=true&session=Zeyo6L7VVlC2'
);
Query Params
apikey
Unique API key given to you by the EOS Lynx team.
tokenbal
Optional, boolean
Adding "tokenbal=true" will return back the list of token balances of the account.
appversion
Optional, boolean
Adding "appversion=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.

Returned Object

This is what we will return to you 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": "accountname",
	"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.5",
	"session": "Zeyo6L7VVlC2"
}
          

Contract

Open EOS Lynx Desktop With Deeplink

Using deep linking, pass EOS Lynx your api key, contract action, and any associated data.

const serializedActionArray = 
    encodeURIComponent(JSON.stringify([
        { "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.1000 EOS", "memo": "test contract" } } 
]))

window.location.assign(`eoslynx://contract?
    apikey=hello
    &actions=${serializedActionArray}
    &session=session123`
);

Transaction returned

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
    }
  }
]

Transfer

Open EOS Lynx Desktop With Deeplink

Using deep linking, pass eos-lynx your api key and transaction amount

window.location.assign('eoslynx://transfer?
    apikey=hello
    &amount=0.0010
    &symbol=EOS
    &memo=memo-text'
);

Transaction POST

When the transaction succeeds or fails, we will put the json of the tx in the body of a post request to the webhook endpoint you provide. This is the code EOS Lynx uses to post to you.

private httpOptions = {
    headers: new HttpHeaders({
        'Content-Type': 'application/json'
    })
};

this.http.post(webHookUrl, transactionInfo, this.httpOptions);

Websocket

Your site should be listening for the post request. Here's an example using Socket.IO.

var app = express();
var server = http.createServer(app);

var io = require('socket.io')(server);
io.on('connection', (socket) => {
    console.log('user connected');

    socket.on('disconnect', () => {
        console.log('user disconnected');
        });
});

app.post('/webhook', (req, res) => {
    let jsonData = req.body;
    io.emit('transaction', jsonData);
    res.status(200).send(jsonData);
});

Transaction returned!

This is what we will return to you when your user pays using EOS Lynx. We will return successes and fails. If you don't see anything, try the Pay with EOSLynx button above and send a transaction. You should see a response appear here when the transaction finishes.

{
  "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
  }
}