Provide Token

If the Ethereum App finds information on the requested tokens, it will be in msg->item1 and msg->item2.

In our plugin, we need to account for when the Ethereum App does NOT find the token.

Here is the code for our plugin, with comments:

    if (msg->item1) {
        // The Ethereum App found the information for the requested token!
        // Store its decimals.
        context->decimals = msg->item1->decimals;
        // Store its ticker.
        strlcpy(context->ticker,
                (char *) msg->item1->ticker,
                sizeof(context->ticker));
 
        // Keep track of the token found.
        context->token_found = true;
    } else {
        // The Ethereum App did not manage to find 
        // the info for the requested token.
        context->token_found = false;
        
        // If we wanted to add a screen, say a warning screen for example,
        // then we tell the Ethereum app to add an additional screen
        // by setting `msg->additionalScreens` here, just like so:
        // msg->additionalScreens = 1;
    }

The code is straightforward. Note that msg->additionalScreens tells the Ethereum App it needs X additional screens.

The next step is about how to word your first screen (query_contract_id).

Ledger
Copyright © Ledger SAS. All rights reserved. Ledger, Ledger Nano S, Ledger Vault, Bolos are registered trademarks of Ledger SAS