EOS Lynx Mobile DApp Integration API Documentation

The following examples are for mobile web app integration inside of iOS or Android EOS Lynx applications. If you would like to start developing for mobile web integration into Lynx Mobile iOS and Android please fill out this form: Sign Up!


NOTE: Some api functions are only available on the latest iOS EOS Lynx application. Android will be ready in the near future. These are noted above each function description.

Basic Usage

Setup

After you've filled out that form and we have setup your app to work in our mobile integrated browser, you'll be able to start testing. We will give you Dynamic Link which will allow your mobile web application to open up inside of the EOS Lynx Mobile Integrated Browser. This dynamic link will need to be placed on your page so you can navigate to Mobile Safari on iOS or Mobile Chrome on Android. You can then click on the Dynamic Link it provided its setup on our end, it should open your web app inside of Lynx.


NOTE: For easier testing currently on iOS you can go to the "Explore" tab, tap on the top navigation bar 10 times and youll be provided an input to put in a testing url. This allows you to bypass the need for dynamic link, etc. :) On Anroid you can enter arbitrary url right from the top menu.

// Lynx Mobile Integrated Browser 
// will inject the lynxMobile SDK object 
// into the page.
// Your app will have access to the global lynxMobile 
// Add an event listner on window like below to be notified
// once the lynxMobile object has been added to window.
window.addEventListener("lynxMobileLoaded", function() {
    // lynx is on the window and ready!
});

Request Set Account Name

iOS, Android
// Use await to return a promise
(async () => {

    let result;

    try {
        result = await window.lynxMobile.requestSetAccountName();
    } catch (err) {
        console.log(err);
    }

    console.log(result); // "funstuffgogo" 12 character account name returned here

})();

Request Set Account

iOS, Android
// Use await to return a promise
(async () => {

    let result;

    try {
        result = await window.lynxMobile.requestSetAccount("sessionId123");
    } catch (err) {
        console.log(err);
    }

    console.log(result);

})();

// result
/* 
{
"account": Object,
"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": "1.4.4",
"session": "Zeyo6L7VVlC2"
}
*/

Basic EOS Transfer

iOS, Android
// Use await to return a promise
(async () => {

    let result;

    try {
        result = await window.lynxMobile.eosTransfer({ 
            toAccount: "funstuffgogo", amount: "0.0001", memo: "Hello there"
        });
    } catch (err) {
        console.log(err);
    }

    console.log(result); // {transaction_id: "3a50d9a4bda0a8e2a4c23526da15369345bd61c72d37d844365f4bfee5c18fcb", processed: Object}

})();

Transfer

iOS, Android
// Use await to return a promise
(async () => {

    let result;

    try {
        result = await window.lynxMobile.transfer({ 
            contract: "therealkarma", symbol: "KARMA", 
            toAccount: "funstuffgogo", amount: "0.0001", memo: "Hello there"
        });
    } catch (err) {
        console.log(err);
    }

    console.log(result); // {transaction_id: "3a50d9a4bda0a8e2a4c23526da15369345bd61c72d37d844365f4bfee5c18fcb", processed: Object}

})();

Transact

iOS, Android
// Use await to return a promise
let transaction = {
    actions: [{
        account: "eosio",
        name: "delegatebw",
        data: {
            from: "funstuffgogo",
            receiver: "funstuffgogo",
            transfer: false,
            stake_cpu_quantity: "0.0005 EOS",
            stake_net_quantity: "0.0000 EOS"
        },
        authorization: [
            {
                actor: "funstuffgogo",
                permission: "active"
            }
        ]
    },
    {
        account: "eosio",
        name: "undelegatebw",
        data: {
            from: "funstuffgogo",
            receiver: "funstuffgogo",
            unstake_cpu_quantity: "0.0000 EOS",
            unstake_net_quantity: "0.0003 EOS"
        },
        authorization: [
            {
                actor: "funstuffgogo",
                permission: "active"
            }
        ]
    }]
}

(async () => {

    let result;

    try {
        result = await window.lynxMobile.transact(transaction);
    } catch (err) {
        console.log(err);
    }

    console.log(result); // {transaction_id: "3a50d9a4bda0a8e2a4c23526da15369345bd61c72d37d844365f4bfee5c18fcb", processed: Object}

})();

Request Arbitrary Signature for Current Account

iOS
// Use await to return a promise
(async () => {

    let result;

    try {
        result = await window.lynxMobile.requestArbitrarySignature({
            data: "the string you wish to sign",
            whatFor: "The reason you want the signature. This will displayed to the user."
        });
    } catch (err) {
        console.log(err);
    }

    console.log(result); // "SIG_K1_JvbGYMSe7auMt8TvLUkoi1A1ywdqoNMmZ4vSeMfaFFtLL58eRGBtzk8HqbmyyrGWTUvhmFAQFHoMeF4icHrtwJQAqynqcD"

})();