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

feat: Added flex support #5

Merged
merged 4 commits into from
Aug 22, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Cargo.lock

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

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "near"
version = "2.1.0"
version = "2.2.0"
authors = ["dj8yf0μl", "polyprogrammist"]
edition = "2021"

[dependencies]
ledger_device_sdk = "1.9.2"
include_gif = "1.1.0"
ledger_device_sdk = "=1.12.0"
include_gif = "=1.1.0"
hex = { version = "0.4.3", default-features = false, features = ["serde"] }
bs58 = { version = "0.5.0", default-features = false }
borsh = { version = "0.1.0", path = "./borsh" }
Expand Down Expand Up @@ -38,6 +38,9 @@ icon = "icons/app_near_14px.gif"
[package.metadata.ledger.stax]
icon = "icons/app_near_32px.gif"

[package.metadata.ledger.flex]
icon = "icons/app_near_40px.gif"

[features]
default = []
speculos = ["ledger_device_sdk/speculos"]
Binary file added icons/app_near_40px.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ledger_app.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[app]
build_directory = "./"
sdk = "Rust"
devices = ["nanos", "nanox", "nanos+", "stax"]
devices = ["nanos", "nanox", "nanos+", "stax", "flex"]

[tests]
pytest_directory = "./tests/"
27 changes: 23 additions & 4 deletions local_test_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ function build_all() {
cargo ledger build nanosplus
cargo ledger build nanox
cargo ledger build stax
cargo ledger build flex
exit
EOF
}

function test() {
if [[ -n "$GOLDEN" ]] ;
then
then
golden_suffix="--golden_run"
else
golden_suffix=""
fi

if [[ -n "$2" ]] ;
then
then
filter="-k $2"
else
filter=""
Expand All @@ -33,6 +34,25 @@ function test() {
EOF
}

function test_all_nano() {
echo $1

if [[ -n "$1" ]] ;
then
filter="-k $1"
else
filter=""
fi
echo "$filter"
# docker commands to test with Ragger (for ALL)

docker run --rm -i --privileged -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --name app-near-container ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest /bin/bash -s <<EOF
set -e
[ -f ./tests/requirements.txt ] && pip install -r ./tests/requirements.txt
pytest ./tests --log-cli-level=$PYTEST_LOG_LEVEL --tb=short $filter -v --device all_nano
EOF
}

function test_all() {
echo $1

Expand All @@ -48,10 +68,9 @@ function test_all() {
docker run --rm -i --privileged -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --name app-near-container ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest /bin/bash -s <<EOF
set -e
[ -f ./tests/requirements.txt ] && pip install -r ./tests/requirements.txt
pytest ./tests --log-cli-level=$PYTEST_LOG_LEVEL --tb=short $filter -v --device all_nano
pytest ./tests --log-cli-level=$PYTEST_LOG_LEVEL --tb=short $filter -v --device all
EOF
}

while getopts ":c:t:f:g" opt; do
case $opt in
c) command="$OPTARG"
Expand Down
10 changes: 3 additions & 7 deletions src/app_ui/sign/common/action/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,14 @@ pub fn ui_display_delegate_error(#[allow(unused)] comm: &mut Comm) {
let info_button = InfoButton::new(
"Delegate action is not supported",
Some(&NEAR_LOGO),
"Reject Transaction",
"Reject",
TuneIndex::Success,
);

let mut review: NbglGenericReview =
NbglGenericReview::new().add_content(NbglPageContent::InfoButton(info_button));

review.show(
"Reject\nTransaction",
"Transaction Rejected",
"Transaction rejected",
);
review.show("Reject", "Transaction Rejected", "Transaction Rejected");
}
}

Expand Down Expand Up @@ -307,7 +303,7 @@ pub fn ui_display_common<const N: usize>(
last_screen = "Action confirmed";
}

review.show("Reject\nTransaction", last_screen, "Transaction rejected")
review.show("Reject", last_screen, "Transaction rejected")
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/app_ui/sign/nep366_delegate_action/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ pub fn ui_display(prefix: &mut parsing::types::nep366_delegate_action::prefix::P
.add_content(NbglPageContent::TagValueList(tag_values_list))
.add_content(NbglPageContent::InfoButton(info_button));

review.show(
"Reject\nTransaction",
"NEP366 prefix confirmed",
"Transaction rejected",
)
review.show("Reject", "NEP366 prefix confirmed", "Transaction rejected")
}
}
6 changes: 1 addition & 5 deletions src/app_ui/sign/transaction/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ pub fn ui_display(prefix: &mut parsing::types::transaction::prefix::Prefix) -> b
.add_content(NbglPageContent::TagValueList(tag_values_list))
.add_content(NbglPageContent::InfoButton(info_button));

review.show(
"Reject\nTransaction",
"Header confirmed",
"Transaction rejected",
)
review.show("Reject", "Header confirmed", "Transaction rejected")
}
}
2 changes: 1 addition & 1 deletion src/handlers/common/validate_public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ fn ui_display(info: &KeyMismatchInfo) -> Result<bool, AppSW> {
.add_content(NbglPageContent::TagValueList(tag_values_list))
.add_content(NbglPageContent::InfoButton(info_button));

Ok(review.show("Reject\nTransaction", "Confirmed", "Transaction rejected"))
Ok(review.show("Reject", "Confirmed", "Transaction rejected"))
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading