Skip to content

Commit

Permalink
Merge pull request #145 from KeystoneHQ/cardano
Browse files Browse the repository at this point in the history
Support Cardano Address generation
  • Loading branch information
NanYeZhuYu authored Oct 17, 2023
2 parents 77a8c1d + dc83ff3 commit f5563c3
Show file tree
Hide file tree
Showing 37 changed files with 1,248 additions and 71 deletions.
6 changes: 3 additions & 3 deletions rust/rust_c/src/interfaces/cardano/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use app_cardano::address::AddressType;
use cty::c_char;

#[no_mangle]
pub extern "C" fn ada_get_base_address(
pub extern "C" fn cardano_get_base_address(
xpub: PtrString,
index: u32,
network_id: u8,
Expand All @@ -19,7 +19,7 @@ pub extern "C" fn ada_get_base_address(
}

#[no_mangle]
pub extern "C" fn ada_get_enterprise_address(
pub extern "C" fn cardano_get_enterprise_address(
xpub: PtrString,
index: u32,
network_id: u8,
Expand All @@ -39,7 +39,7 @@ pub extern "C" fn ada_get_enterprise_address(
}

#[no_mangle]
pub extern "C" fn ada_get_stake_address(
pub extern "C" fn cardano_get_stake_address(
xpub: PtrString,
index: u32,
network_id: u8,
Expand Down
2 changes: 2 additions & 0 deletions src/crypto/account_public_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "stdint.h"
#include "stdbool.h"
#include "gui_home_widgets.h"
typedef struct {
int32_t addressType;
int32_t addressIndex;
Expand Down Expand Up @@ -111,6 +112,7 @@ uint8_t SpecifiedXPubExist(const char *xPub);
void AccountPublicInfoTest(int argc, char *argv[]);
bool GetFirstReceive(const char* chainName);
void SetFirstReceive(const char* chainName, bool isFirst);
void AccountPublicHomeCoinGet(WalletState_t *walletList, uint8_t count);

#endif

2 changes: 1 addition & 1 deletion src/managers/account_manager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _ACCOUNT_MANAGER_H_
#define _AACOUNT_MANAGER_H_
#define _ACCOUNT_MANAGER_H_

#include "stdint.h"
#include "stdbool.h"
Expand Down
1 change: 1 addition & 0 deletions src/ui/gui_chain/gui_chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ typedef enum {
CHAIN_ETH,
CHAIN_SOL,
CHAIN_SUI,
CHAIN_ADA,
CHAIN_ATOM,
CHAIN_OSMO,
CHAIN_SCRT,
Expand Down
1 change: 1 addition & 0 deletions src/ui/gui_components/gui_animating_qrcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define SCREEN_HEIGHT 800

#include "rust.h"
#include "lvgl.h"

typedef UREncodeResult *(*GenerateUR)(void);

Expand Down
1 change: 1 addition & 0 deletions src/ui/gui_components/gui_mnemonic_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "gui_forget_pass_widgets.h"
#include "gui_setting_widgets.h"
#include "keystore.h"
#include "account_manager.h"

#ifndef COMPILE_MAC_SIMULATOR
#include "sha256.h"
Expand Down
1 change: 1 addition & 0 deletions src/ui/gui_components/gui_status_bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "keystore.h"
#include "usb_task.h"
#include "user_memory.h"
#include "account_manager.h"

#ifndef COMPILE_SIMULATOR
#include "user_fatfs.h"
Expand Down
1 change: 1 addition & 0 deletions src/ui/gui_frame/gui_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ typedef int32_t(*GuiEventProcessFunc)(void *self, uint16_t usEvent, void *param,
add(SCREEN_DISPLAY) \
add(SCREEN_TUTORIAL) \
add(SCREEN_CONNECTION) \
add(SCREEN_MULTI_ACCOUNTS_RECEIVE) \
add(SCREEN_DEVICE_PUB_KEY)

typedef enum {
Expand Down
1 change: 1 addition & 0 deletions src/ui/gui_views/gui_lock_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "gui_animating_qrcode.h"
#include "gui_status_bar.h"
#include "account_manager.h"
#include "gui_lock_device_widgets.h"

static int32_t GuiLockViewInit(void *param)
{
Expand Down
51 changes: 51 additions & 0 deletions src/ui/gui_views/gui_multi_account_receive_view.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "gui.h"
#include "gui_obj.h"
#include "gui_views.h"
#include "gui_multi_accounts_receive_widgets.h"

static int32_t GuiMultiAccountsReceiveViewInit(uint8_t chain)
{
GuiMultiAccountsReceiveInit(chain);
return SUCCESS_CODE;
}

static int32_t GuiMultiAccountsReceiveViewDeInit(void)
{
GuiMultiAccountsReceiveDeInit();
return SUCCESS_CODE;
}

int32_t GuiMultiAccountsReceiveViewEventProcess(void *self, uint16_t usEvent, void *param, uint16_t usLen)
{
uint8_t chain = 0;
switch (usEvent) {
case GUI_EVENT_OBJ_INIT:
if (param != NULL) {
chain = *(uint8_t *)param;
} else {
return ERR_GUI_ERROR;
}
return GuiMultiAccountsReceiveViewInit(chain);
case GUI_EVENT_OBJ_DEINIT:
return GuiMultiAccountsReceiveViewDeInit();
case GUI_EVENT_DISACTIVE:
break;
case GUI_EVENT_REFRESH:
GuiMultiAccountsReceiveRefresh();
break;
case SIG_SETUP_VIEW_TILE_PREV:
GuiMultiAccountsReceivePrevTile();
break;
default:
return ERR_GUI_UNHANDLED;
}
return SUCCESS_CODE;
}

GUI_VIEW g_multiAccountsReceiveView = {
.id = SCREEN_MULTI_ACCOUNTS_RECEIVE,
.previous = NULL,
.isActive = false,
.optimization = false,
.pEvtHandler = GuiMultiAccountsReceiveViewEventProcess,
};
1 change: 1 addition & 0 deletions src/ui/gui_views/gui_views.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ extern GUI_VIEW g_displayView;
extern GUI_VIEW g_tutorialView;
extern GUI_VIEW g_connectionView;
extern GUI_VIEW g_DevicePublicKeyView;
extern GUI_VIEW g_multiAccountsReceiveView;

void OpenImportWalletHandler(lv_event_t *e);
void OpenCreateWalletHandler(lv_event_t *e);
Expand Down
1 change: 1 addition & 0 deletions src/ui/gui_widgets/gui_connect_wallet_widgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "gui_animating_qrcode.h"
#include "gui_page.h"
#include "keystore.h"
#include "account_manager.h"
#include "gui_global_resources.h"

#define DERIVATION_PATH_EG_LEN 2
Expand Down
1 change: 1 addition & 0 deletions src/ui/gui_widgets/gui_device_public_key_widgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "user_utils.h"
#include "gui_page.h"
#include "account_manager.h"
#include "se_manager.h"

static lv_obj_t *g_cont;
static PageWidget_t *g_pageWidget;
Expand Down
Loading

0 comments on commit f5563c3

Please sign in to comment.