Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
lib_standard_app
swap_entrypoints.h
Go to the documentation of this file.
1
/*******************************************************************************
2
* (c) 2023 Ledger
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
********************************************************************************/
16
#pragma once
17
18
#include <stddef.h>
19
#include <stdbool.h>
20
#include <stdint.h>
21
22
#include "
swap_lib_calls.h
"
23
24
// ################################################################################################
25
26
/*
27
--8<-- [start:coin_api_intro]
28
The handle functions must be defined by each Coin application implementing the SWAP feature.
29
30
Handlers are called by Exchange through the `os_lib_call` API, and their commands must be fulfilled
31
by the Coin application.
32
33
The Exchange application is responsible for handling the flow and sequencing of the SWAP.
34
--8<-- [end:coin_api_intro]
35
*/
36
37
// ################################################################################################
38
39
/*
40
--8<-- [start:swap_entry_point_intro]
41
## C applications
42
For C applications, the lib_standard_app dispatches the command through the `main()` and
43
`library_app_main()` functions to the Coin application defined handler.
44
--8<-- [end:swap_entry_point_intro]
45
*/
46
47
// ################################################################################################
48
49
/*
50
--8<-- [start:swap_handle_check_address_brief]
51
This handle is called when the Exchange application wants to ensure that a
52
given address belongs to the device.
53
54
If the address does belong to the device, result is set to 1. Otherwise it
55
is set to 0.
56
--8<-- [end:swap_handle_check_address_brief]
57
*/
58
59
// ################################################################################################
60
61
// --8<-- [start:swap_handle_check_address]
62
// This callback must be defined in Coin Applications that use the SWAP feature.
63
64
void
swap_handle_check_address
(
check_address_parameters_t
*params);
65
// --8<-- [end:swap_handle_check_address]
66
67
/*
68
--8<-- [start:swap_handle_get_printable_amount_brief]
69
This handle is called when the Exchange application wants to format for
70
display an amount + ticker of a currency known by this application
71
72
If the formatting succeeds, result is set to the formatted string. Otherwise
73
it is set to '\0'.
74
--8<-- [end:swap_handle_get_printable_amount_brief]
75
*/
76
77
// --8<-- [start:swap_handle_get_printable_amount]
78
// This callback must be defined in Coin Applications that use the SWAP feature.
79
void
swap_handle_get_printable_amount
(
get_printable_amount_parameters_t
*params);
80
// --8<-- [end:swap_handle_get_printable_amount]
81
82
// --8<-- [start:swap_copy_transaction_parameters]
83
/* This handle is called when the user has validated on screen the transaction
84
* proposal sent by the partner and started the FROM Coin application to sign
85
* the payment transaction.
86
*
87
* This handler needs to save in the heap the details of what has been validated
88
* in Exchange. These elements will be checked against the received transaction
89
* upon its reception from the Ledger Live.
90
*
91
* return false on error, true otherwise
92
*/
93
bool
swap_copy_transaction_parameters
(
create_transaction_parameters_t
*sign_transaction_params);
94
// --8<-- [end:swap_copy_transaction_parameters]
check_address_parameters_s
Definition
swap_lib_calls.h:36
create_transaction_parameters_s
Definition
swap_lib_calls.h:85
get_printable_amount_parameters_s
Definition
swap_lib_calls.h:63
swap_handle_get_printable_amount
void swap_handle_get_printable_amount(get_printable_amount_parameters_t *params)
swap_handle_check_address
void swap_handle_check_address(check_address_parameters_t *params)
swap_copy_transaction_parameters
bool swap_copy_transaction_parameters(create_transaction_parameters_t *sign_transaction_params)
swap_lib_calls.h
Generated by
1.9.8