Skip to content

handle_provide_parameter()

Handle explanation

The Ethereum application will call the plugin repeatidly using this handle to feed it the entire smart contract data parameter by parameter.

The plugin needs to perform the following actions:

  • Read all parameters and keep track of the smart contract parsing progression
  • Check that the values received are valid/possible when applicable
  • Store in the context the data that will need to be displayed on screen.
  • Report an error to the ethereum application if the smart contract has an issue.

An example of smart contract parsing is already done in the boilerplate plugin. Adapt and expand it for your use case.

Fields descriptions

typedef struct ethPluginProvideParameter_s {
    // DEPRECATED, will be removed soon. Do not use.
    ethPluginSharedRW_t *pluginSharedRW;

    // INPUT. Transaction data available to the plugin. READ-ONLY.
    ethPluginSharedRO_t *pluginSharedRO;

    // RW INPUT. Contains the semi-persistent RAM space that can be used by the
    // plugin in each handle call.
    uint8_t *pluginContext;

    // INPUT. Pointer to the 32 bytes parameter being parsed in the smart
    // contract data.
    const uint8_t *parameter;

    // INPUT. Offset to this parameter from the beginning of the data field
    // (starts at 4, following the selector).
    uint32_t parameterOffset;

    // OUTPUT. Used by the plugin to inform the Ethereum application of the
    // result of this handle The following return codes are expected, any other
    // will abort the signing process:
    // - ETH_PLUGIN_RESULT_OK
    // - ETH_PLUGIN_RESULT_FALLBACK : if the signing logic should fallback to
    // the generic one
    eth_plugin_result_t result;

} ethPluginProvideParameter_t;