Embedded SDK
Embedded SDK
swap_lib_calls.h
Go to the documentation of this file.
1 #pragma once
2 
3 /* This file is the shared API between Exchange and the apps started in Library mode for Exchange
4  *
5  * DO NOT MODIFY THIS FILE IN APPLICATIONS OTHER THAN EXCHANGE
6  * On modification in Exchange, forward the changes to all applications supporting Exchange
7  */
8 
9 #include "stdbool.h"
10 #include "stdint.h"
11 
12 #define RUN_APPLICATION 1
13 
14 #define SIGN_TRANSACTION 2
15 
16 #define CHECK_ADDRESS 3
17 
18 #define GET_PRINTABLE_AMOUNT 4
19 
20 /*
21  * Amounts are stored as bytes, with a max size of 16 (see protobuf
22  * specifications). Max 16B integer is 340282366920938463463374607431768211455
23  * in decimal, which is a 32-long char string.
24  * The printable amount also contains spaces, the ticker symbol (with variable
25  * size, up to 12 in Ethereum for instance) and a terminating null byte, so 50
26  * bytes total should be a fair maximum.
27  */
28 #define MAX_PRINTABLE_AMOUNT_SIZE 50
29 
30 // structure that should be send to specific coin application to get address
32  // IN
35  // serialized path, segwit, version prefix, hash used, dictionary etc.
36  // fields and serialization format depends on specific coin app
41  // OUT
42  int result;
44 
45 // structure that should be send to specific coin application to get printable amount
47  // IN
52  bool is_fee;
53  // OUT
56 
58  // IN
67  // OUT
70 
71 typedef struct libargs_s {
72  unsigned int id;
73  unsigned int command;
74  unsigned int unused;
75  union {
79  };
char printable_amount[MAX_PRINTABLE_AMOUNT_SIZE]
unsigned int command
get_printable_amount_parameters_t * get_printable_amount
unsigned int unused
create_transaction_parameters_t * create_transaction
check_address_parameters_t * check_address
unsigned int id
struct libargs_s libargs_t
struct get_printable_amount_parameters_s get_printable_amount_parameters_t
#define MAX_PRINTABLE_AMOUNT_SIZE
struct check_address_parameters_s check_address_parameters_t
struct create_transaction_parameters_s create_transaction_parameters_t
unsigned char uint8_t
Definition: usbd_conf.h:53