Skip to content

Commit

Permalink
feat(cardano): support tx parse and sign
Browse files Browse the repository at this point in the history
  • Loading branch information
soralit committed Oct 25, 2023
1 parent c147d4f commit b445ac7
Show file tree
Hide file tree
Showing 14 changed files with 1,102 additions and 314 deletions.
2 changes: 0 additions & 2 deletions rust/apps/cardano/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions rust/rust_c/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion rust/rust_c/src/interfaces/cardano/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::interfaces::types::{Ptr, PtrBytes, PtrString, PtrT, PtrUR};
use crate::interfaces::ur::{UREncodeResult, FRAGMENT_MAX_LENGTH_DEFAULT};
use crate::interfaces::utils::{convert_c_char, recover_c_char};
use alloc::format;
use alloc::string::ToString;

use alloc::vec::Vec;
use app_cardano::structs::{CardanoCertKey, CardanoUtxo, ParseContext};
Expand Down Expand Up @@ -144,7 +145,7 @@ fn prepare_parse_context(
.to_vec(),
v.get_address(),
convert_key_path(v.get_key_path())?,
v.get_amount(),
v.get_amount().parse::<u64>().map_err(|e|RustCError::InvalidData(e.to_string()))?,
v.get_transaction_hash(),
v.get_index(),
))
Expand Down
4 changes: 2 additions & 2 deletions rust/third_party/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ rsa = { version = "0.8.2", default-features = false }
sha1 = { version = "0.10.5", default-features = false }
cty = "0.2.2"
cstr_core = "0.2.6"
ur-registry = { git = "https://[email protected]/KeystoneHQ/keystone-sdk-rust.git", tag="0.0.18" }
ur-parse-lib = { git = "https://[email protected]/KeystoneHQ/keystone-sdk-rust.git", tag="0.0.18" }
ur-registry = { path = "../../../keystone-sdk-rust/libs/ur-registry" }
ur-parse-lib = { path = "../../../keystone-sdk-rust/libs/ur-parse-lib" }
ed25519-bip32-core = { version = "0.1.1", default-features = false }
cryptoxide = "0.4"
itertools = { version = "0.10.5", default-features = false, features = ["use_alloc"] }
Expand Down
12 changes: 11 additions & 1 deletion src/tasks/qrdecode_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ static SetChainData_t g_chainViewArray[] = {
{REMAPVIEW_SUI, GuiSetSuiUrData},
{REMAPVIEW_SOL, GuiSetSolUrData},
{REMAPVIEW_SOL_MESSAGE, GuiSetSolUrData},
{REMAPVIEW_APT, GuiSetAptosUrData}
{REMAPVIEW_APT, GuiSetAptosUrData},
{REMAPVIEW_ADA, GuiSetupAdaUrData},
};

osThreadId_t g_qrDecodeTaskHandle;
Expand Down Expand Up @@ -166,6 +167,8 @@ void ProcessQr(uint32_t count)
}
} else {
retFromRust = MultiurResult->error_code;
printf("error code: %d\r\n", MultiurResult->error_code);
printf("error message: %s\r\n", MultiurResult->error_message);
}
if (!(MultiurResult->is_complete)) {
free_ur_parse_multi_result(MultiurResult);
Expand Down Expand Up @@ -206,10 +209,17 @@ void handleURResult(void *urResult, UrViewType_t urViewType, bool is_multi)
break;
}

printf("sora %d\r\n", urViewType.viewType);
printf("sora %d\r\n", urViewType.urType);
printf("sora %d\r\n", viewType);


if (urViewType.viewType == WebAuthResult || urViewType.viewType == KeyDerivationRequest || viewType != REMAPVIEW_BUTT) {
printf("sora here\r\n");
StopQrDecode();
UserDelay(500);
GuiApiEmitSignal(SIG_QRCODE_VIEW_SCAN_PASS, &urViewType, sizeof(urViewType));
printf("sora here 2\r\n");
} else {
printf("unhandled viewType=%d\r\n", urViewType.viewType);
}
Expand Down
970 changes: 712 additions & 258 deletions src/ui/gui_analyze/gui_analyze.c

Large diffs are not rendered by default.

Loading

0 comments on commit b445ac7

Please sign in to comment.