Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(app): Added solana send txn support #415

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/solana_app/solana_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ void solana_main(usb_event_t usb_evt, const void *app_config) {
solana_get_pub_keys(&query);
break;
}
case SOLANA_QUERY_SIGN_TXN_TAG: {
solana_sign_transaction(&query);
break;
}

default: {
/* In case we ever encounter invalid query, convey to the host app */
Expand Down
28 changes: 28 additions & 0 deletions apps/solana_app/solana_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@
#include <stdint.h>

#include "solana_context.h"
#include "solana_txn_helpers.h"

/*****************************************************************************
* TYPEDEFS
*****************************************************************************/

typedef struct {
/**
* The structure holds the wallet information of the transaction.
* @note Populated by solana_handle_initiate_query()
*/
solana_sign_txn_initiate_request_t init_info;

/// remembers the allocated buffer for holding complete unsigned transaction
uint8_t *transaction;
/// store for decoded unsigned transaction info
solana_unsigned_txn transaction_info;
} solana_txn_context_t;

/**
* @brief Handler for SOLANA public key derivation.
Expand All @@ -27,4 +45,14 @@
*/
void solana_get_pub_keys(solana_query_t *query);

/**
* @brief Handler for signing a transaction on Solana.
* @details The expected request type is SOLANA_SIGN_TXN_REQUEST_INITIATE_TAG.
* The function controls the complete data exchange with host, user prompts and
* confirmations for signing an Solana based transaction.
*
* @param query Reference to the decoded query struct from the host app
*/
void solana_sign_transaction(solana_query_t *query);

#endif /* SOLANA_PRIV_H */
Loading