|
cryptnox-pos 1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
|
Turn a node's JSON-RPC refusal into a line an operator can act on. More...
#include <stdbool.h>#include <stddef.h>#include <stdio.h>#include <string.h>Go to the source code of this file.
Functions | |
| static bool | rpc_err_contains (const char *hay, const char *needle) |
| Case-insensitive substring search — node wording varies by client. | |
| static void | rpc_error_text (const char *node_msg, bool native, bool polygon, char *out, size_t n) |
| Render a broadcast refusal for the Declined screen. | |
Turn a node's JSON-RPC refusal into a line an operator can act on.
Every reason a node gives for rejecting a transaction used to arrive on the panel as the same four words, "Broadcast failed", which names the symptom and hides the cause. The cause is the whole value of the message: an empty gas tank, a fee under the network's floor and a duplicate submission need three different responses from whoever is standing at the till, and two of them are not "try again".
Header-only so it can be tested on the host without ESP-IDF or a network — same shape as card_status.h and ota_version.h.
Definition in file rpc_error.h.
|
inlinestatic |
Case-insensitive substring search — node wording varies by client.
Definition at line 35 of file rpc_error.h.
Referenced by rpc_error_text().
|
inlinestatic |
Render a broadcast refusal for the Declined screen.
| [in] | node_msg | The node's error.message, or NULL/"" when the request never got an answer worth quoting. |
| [in] | native | true when the sale is the network's own coin, so the balance has to cover the amount as well as the gas. |
| [in] | polygon | true on Polygon, which names its gas coin POL not ETH. |
| [out] | out | Panel line, always NUL-terminated. |
| [in] | n | Capacity of out (the panel's own buffer is 64). |
Definition at line 64 of file rpc_error.h.
References rpc_err_contains().
Referenced by sign_and_broadcast().