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
--8<-- [start:swap_entry_point_intro]
26
The handle functions must be defined by each Coin application implementing the SWAP feature.
27
28
Handlers are called by Exchange through the `os_lib_call` API, and dispatched by the `main()`
29
and `library_app_main()` functions of the lib_standard_app.
30
31
The Exchange application is responsible for handling the flow and sequencing of the SWAP.
32
--8<-- [end:swap_entry_point_intro]
33
*/
34
35
// --8<-- [start:swap_handle_check_address]
36
/* This handle is called when the Exchange application wants to ensure that a
37
* given address belongs to the device.
38
*
39
* If the address does belong to the device, result is set to 1. Otherwise it
40
* is set to 0.
41
*/
42
void
swap_handle_check_address
(
check_address_parameters_t
*params);
43
// --8<-- [end:swap_handle_check_address]
44
45
// --8<-- [start:swap_handle_get_printable_amount]
46
/* This handle is called when the Exchange application wants to format for
47
* display an amount + ticker of a currency known by this application
48
*
49
* If the formatting succeeds, result is set to the formatted string. Otherwise
50
* it is set to '\0'.
51
*/
52
void
swap_handle_get_printable_amount
(
get_printable_amount_parameters_t
*params);
53
// --8<-- [end:swap_handle_get_printable_amount]
54
55
// --8<-- [start:swap_copy_transaction_parameters]
56
/* This handle is called when the user has validated on screen the transaction
57
* proposal sent by the partner and started the FROM Coin application to sign
58
* the payment transaction.
59
*
60
* This handler needs to save in the heap the details of what has been validated
61
* in Exchange. These elements will be checked against the received transaction
62
* upon its reception from the Ledger Live.
63
*
64
* return false on error, true otherwise
65
*/
66
bool
swap_copy_transaction_parameters
(
create_transaction_parameters_t
*sign_transaction_params);
67
// --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