Skip to content

Commit

Permalink
Merge branch 'refactor/core-framework' into source-clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-cyph authored Dec 15, 2023
2 parents 00d4686 + 22b2d7d commit 1c5a95c
Show file tree
Hide file tree
Showing 19 changed files with 1,079 additions and 357 deletions.
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

0 comments on commit 1c5a95c

Please sign in to comment.