diff --git a/.cargo/config b/.cargo/config index f945828..c7bfec8 100644 --- a/.cargo/config +++ b/.cargo/config @@ -29,4 +29,4 @@ runner = "./speculos-wrapper -m nanox " [alias] tt = "test --features extra_debug" br = "build --release" -stackcheck = "stack-sizes --release --bin sui --target=thumbv6m-none-eabi" +stackcheck = "stack-sizes --release --bin iota --target=thumbv6m-none-eabi" diff --git a/.github/workflows/functional_tests.yml b/.github/workflows/functional_tests.yml index 2bd88d5..c15a94b 100644 --- a/.github/workflows/functional_tests.yml +++ b/.github/workflows/functional_tests.yml @@ -5,17 +5,17 @@ on: workflow_call: inputs: app_repository: - description: 'The GIT repository to test (defaults to `github.repository`)' + description: "The GIT repository to test (defaults to `github.repository`)" required: false default: ${{ github.repository }} type: string app_branch_name: - description: 'The GIT branch to test (defaults to `github.ref`)' + description: "The GIT branch to test (defaults to `github.ref`)" required: false default: ${{ github.ref }} type: string download_app_binaries_artifact: - description: 'The name of the artifact containing the application binary file(s) to be tested. Required' + description: "The name of the artifact containing the application binary file(s) to be tested. Required" required: true type: string run_for_devices: @@ -26,15 +26,15 @@ on: 'ledger_app.toml' manifest. If the manifest is missing, defaults to ALL (["nanos", "nanox", "nanosp", "stax"]). required: false - default: 'None' + default: "None" type: string upload_snapshots_on_failure: - description: 'Enable or disable upload of tests snapshots if the job fails (defaults to true).' + description: "Enable or disable upload of tests snapshots if the job fails (defaults to true)." required: false default: true type: boolean test_filter: - description: 'Specify an expression which implements a substring match on the test names' + description: "Specify an expression which implements a substring match on the test names" required: false default: '""' type: string @@ -83,7 +83,7 @@ jobs: uses: borales/actions-yarn@v4 with: cmd: help # No-op, do yarn install later - dir: 'ts-tests' + dir: "ts-tests" - name: Install tests dependencies run: | @@ -94,7 +94,7 @@ jobs: - name: Run test run: | BIN_DIR_NAME="$(echo ${{ matrix.device }} | sed 's/nanosp/nanosplus/')" - speculos --api-port 5005 ${{ needs.call_get_app_metadata.outputs.build_directory }}/build/${BIN_DIR_NAME}/release/sui --display headless & + speculos --api-port 5005 ${{ needs.call_get_app_metadata.outputs.build_directory }}/build/${BIN_DIR_NAME}/release/iota --display headless & sleep 5 cd ts-tests echo "Doing yarn install" diff --git a/README.md b/README.md index 14a9d27..b32a8fa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Sui Blockchain app for Ledger +# IOTA DLT app for Ledger -[Ledger](https://www.ledger.com/) application for the [Sui Blockchain](https://sui.io/). +[Ledger](https://www.ledger.com/) application for the [IOTA DLT](https://www.iota.org/). Written using [Alamgu](https://github.com/alamgu/). @@ -9,6 +9,7 @@ Written using [Alamgu](https://github.com/alamgu/). ## Device Compatability This application is compatible with + - Ledger Nano S, running firmware 2.1.0 and above - Ledger Nano S+, running firmware 1.1.0 - Ledger Nano X @@ -28,7 +29,7 @@ No steps need to be taken in advance. On NixOS, one can easily do this with by adding the following to configuration.nix: -``` nix +```nix { # ... hardware.ledger.enable = true; @@ -70,13 +71,16 @@ First, follow our [general instructions](./NIX.md) for getting started with [Nix Second, please ensure that your device is plugged, unlocked, and on the device home screen. Finally, run the following command to load the app on your device: + ```bash nix --extra-experimental-features nix-command run -f . $DEVICE.loadApp ``` + where `DEVICE` is one of - - `nanos`, for Nano S - - `nanox`, for Nano X - - `nanosplus`, for Nano S+ + +- `nanos`, for Nano S +- `nanox`, for Nano X +- `nanosplus`, for Nano S+ The app will be downloaded (if you have our Nix cache enabled) and/or freshly built as needed. @@ -84,7 +88,7 @@ The app will be downloaded (if you have our Nix cache enabled) and/or freshly bu #### Download an official build -Check the [releases page](https://github.com/obsidiansystems/ledger-app-sui/releases) of this app to see if an official build has been uploaded for this release. +Check the [releases page](https://github.com/iotaledger/ledger-app-iota/releases) of this app to see if an official build has been uploaded for this release. There is a separate tarball for each device. #### Build one yourself, with Nix @@ -93,13 +97,16 @@ First, follow our [general instructions](./NIX.md) for getting started with [Nix There is a separate tarball for each device. To build one, run: + ```bash nix-build -A $DEVICE.tarball ``` + where `DEVICE` is one of - - `nanos`, for Nano S - - `nanox`, for Nano X - - `nanosplus`, for Nano S+ + +- `nanos`, for Nano S +- `nanox`, for Nano X +- `nanosplus`, for Nano S+ The last line printed out will be the path of the tarball. @@ -113,7 +120,7 @@ By using Nix, this can be done simply by using the `load-app` command, without m ```bash tar xzf /path/to/release.tar.gz -cd sui-$DEVICE +cd iota-$DEVICE nix-shell load-app ``` @@ -128,7 +135,7 @@ For more information on how to install and use that tool see the [instructions f ```bash tar xzf release.tar.gz -cd sui-$DEVICE +cd iota-$DEVICE ledgerctl install -f app.json ``` @@ -137,23 +144,28 @@ ledgerctl install -f app.json The bundled [`generic-cli`](https://github.com/alamgu/alamgu-generic-cli) tool can be used to obtaining the public key and do signing. To use this tool using Nix, from the root level of this repo, run this command to enter a shell with all the tools you'll need: + ```bash nix-shell -A $DEVICE.appShell ``` + where `DEVICE` is one of - - `nanos`, for Nano S - - `nanox`, for Nano X - - `nanosplus`, for Nano S+ + +- `nanos`, for Nano S +- `nanox`, for Nano X +- `nanosplus`, for Nano S+ Then, one can use `generic-cli` like this: - Get a public key for a BIP-32 derivation without prompting the user: + ```shell-session $ generic-cli getAddress --use-block "44'/4218'/0'/0'/0'" a42e71c004770d1a48956090248a8d7d86ee02726b5aab2a5cd15ca9f57cbd71 ``` - Show the address on device for a BIP-32 derivation and obtain the public key: + ```shell-session $ generic-cli getAddress --use-block --verify "44'/4218'/0'/0'/0'" a42e71c004770d1a48956090248a8d7d86ee02726b5aab2a5cd15ca9f57cbd71 diff --git a/default.nix b/default.nix index 5418c9c..ce11f57 100644 --- a/default.nix +++ b/default.nix @@ -6,7 +6,7 @@ rec { inherit (alamgu) lib pkgs crate2nix alamguLib; - appName = "sui"; + appName = "iota"; app-nix = alamgu.crate2nix-tools.generatedCargoNix { name = "${appName}-nix"; @@ -149,8 +149,8 @@ rec { cp app.hex $dest cp ${./tarball-default.nix} $dest/default.nix cp ${./tarball-shell.nix} $dest/shell.nix - cp ${./rust-app/sui.gif} $dest/sui.gif - cp ${./rust-app/sui-small.gif} $dest/sui-small.gif + cp ${./rust-app/iota.gif} $dest/iota.gif + cp ${./rust-app/iota-small.gif} $dest/iota-small.gif ''); inherit @@ -317,7 +317,7 @@ rec { inherit localSystem; }; - sui-node-shell = nixpkgs-unstable.mkShell { + iota-node-shell = nixpkgs-unstable.mkShell { strictDeps = true; nativeBuildInputs = with nixpkgs-unstable.buildPackages; [ rustc @@ -330,7 +330,7 @@ rec { ]; }; - sui-wallet-shell = nixpkgs-unstable.mkShell { + iota-wallet-shell = nixpkgs-unstable.mkShell { strictDeps = true; nativeBuildInputs = with nixpkgs-unstable.buildPackages; lib.optional stdenv.isLinux [ # TODO make avaiable everywhere or skip whole thing on macOS diff --git a/guide.md b/guide.md index 998f06e..4cda3ff 100644 --- a/guide.md +++ b/guide.md @@ -1,6 +1,6 @@ -# How to use Sui app on your Ledger device +# How to use IOTA app on your Ledger device -Install the Sui app on your Ledger device to manage SUI Tokens with the [Sui Wallet](https://docs.sui.io/explore/wallet-browser). +Install the IOTA app on your Ledger device to manage IOTA Tokens with the [IOTA Wallet](TODO). ### 1. Before you start @@ -8,44 +8,43 @@ Install the Sui app on your Ledger device to manage SUI Tokens with the [Sui Wal - The latest firmware is [installed](https://support.ledgerwallet.com/hc/en-us/articles/360002731113). - Ledger Live is [ready to use](https://support.ledgerwallet.com/hc/en-us/articles/360006395233). -### 2. Install the Sui app +### 2. Install the IOTA app 1. Open the Manager in Ledger Live. 2. Connect and unlock your Ledger device. 3. If asked, allow the manager on your device by pressing both buttons. -4. Find **Sui** in the app catalog. +4. Find **IOTA** in the app catalog. 5. Press the **Install** button of the app. - An installation window appears. - Your device will display **Processing…** - The app installation is confirmed. - ### **3. Obtain Ledger Account Number** -- Open the Sui app on your Ledger device, the screen will display "Sui 0.1.0". +- Open the IOTA app on your Ledger device, the screen will display "IOTA 0.1.0". -- Open the Sui wallet and select "Connect to Ledger device". +- Open the IOTA wallet and select "Connect to Ledger device". - Enter the derivation path (default `m/44'/4218'/0'/0/0`). -- You can use this account to receive Sui tokens. +- You can use this account to receive IOTA tokens. ### **4. Send Tokens from Ledger Account** -- Open the Sui wallet and click "Send" from the "Coins" tab. +- Open the IOTA wallet and click "Send" from the "Coins" tab. - Enter the amount and receiver's address, then click "Send Coins Now". - Verify the details on your device display. - - Transfer Sui + - Transfer IOTA - Sender's address - Receiver's address - Amount - + - Gas fees - Press both buttons when asked to 'Confirm' to sign the transaction. @@ -54,7 +53,5 @@ Install the Sui app on your Ledger device to manage SUI Tokens with the [Sui Wal ### **5. Contact info** -- Name: Ryan Servatius -- Email: ryan@mystenlabs.com -- Legal Entity: Mysten Labs -- URL: https://sui.io/ +- Email: info@iota.org +- URL: https://www.iota.org/ diff --git a/rust-app/Cargo.lock b/rust-app/Cargo.lock index cfa8216..b187c0a 100644 --- a/rust-app/Cargo.lock +++ b/rust-app/Cargo.lock @@ -211,6 +211,25 @@ dependencies = [ "syn 1.0.107", ] +[[package]] +name = "iota" +version = "0.2.1" +dependencies = [ + "alamgu-async-block", + "arrayvec", + "include_gif", + "ledger-crypto-helpers", + "ledger-log", + "ledger-parser-combinators", + "ledger-prompts-ui", + "ledger_device_sdk", + "ledger_secure_sdk_sys", + "num_enum", + "pin-cell", + "pin-project", + "zeroize", +] + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -565,25 +584,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "sui" -version = "0.2.1" -dependencies = [ - "alamgu-async-block", - "arrayvec", - "include_gif", - "ledger-crypto-helpers", - "ledger-log", - "ledger-parser-combinators", - "ledger-prompts-ui", - "ledger_device_sdk", - "ledger_secure_sdk_sys", - "num_enum", - "pin-cell", - "pin-project", - "zeroize", -] - [[package]] name = "syn" version = "1.0.107" diff --git a/rust-app/Cargo.toml b/rust-app/Cargo.toml index 114fa77..2706f80 100644 --- a/rust-app/Cargo.toml +++ b/rust-app/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "sui" +name = "iota" version = "0.2.1" authors = ["Ericson2314", "dfordivam", "dbzguy56"] edition = "2018" @@ -10,7 +10,7 @@ resolver = "2" arrayvec = { version = "0.7.2", default-features = false } ledger-crypto-helpers = { git = "https://github.com/alamgu/ledger-crypto-helpers" } ledger-log = { git = "https://github.com/alamgu/ledger-log" } -ledger-parser-combinators = { git = "https://github.com/alamgu/ledger-parser-combinators", branch="async-split-take-2" } +ledger-parser-combinators = { git = "https://github.com/alamgu/ledger-parser-combinators", branch = "async-split-take-2" } alamgu-async-block = { git = "https://github.com/alamgu/alamgu-async-block" } zeroize = { version = "1.5.2", default-features = false } num_enum = { version = "0.5", default-features = false } @@ -21,9 +21,14 @@ include_gif = "1.0.1" # Pass --features speculos,ledger-log/log_info (or log_trace, etc) to enable # speculos logging and change log level. [features] -default = [ ] +default = [] # Pass --features speculos,ledger-log/log_info (or log_trace, etc) to enable speculos logging and change log level. -speculos = [ "ledger_device_sdk/speculos", "ledger-log/speculos", "ledger-log/log_error", "ledger-parser-combinators/logging" ] +speculos = [ + "ledger_device_sdk/speculos", + "ledger-log/speculos", + "ledger-log/log_error", + "ledger-parser-combinators/logging", +] extra_debug = ["ledger-log/log_trace"] [target.'cfg(target_family = "bolos")'.dependencies] @@ -33,10 +38,10 @@ ledger-prompts-ui = { git = "https://github.com/alamgu/ledger-prompts-ui" } [target.'cfg(target_family = "bolos")'.dev-dependencies.ledger_device_sdk] version = "1.7.1" -features = [ "speculos" ] +features = ["speculos"] [[bin]] -name = "sui" +name = "iota" test = false path = "bin-src/main.rs" @@ -51,16 +56,16 @@ opt-level = 3 overflow-checks = false [package.metadata.ledger] -name = "Sui" +name = "IOTA" path = ["44'/4218'"] curve = ["ed25519"] flags = "0" [package.metadata.ledger.nanos] -icon = "sui.gif" +icon = "iota.gif" [package.metadata.ledger.nanox] -icon = "sui-small.gif" +icon = "iota-small.gif" [package.metadata.ledger.nanosplus] -icon = "sui-small.gif" +icon = "iota-small.gif" diff --git a/rust-app/bin-src/main.rs b/rust-app/bin-src/main.rs index d687bc8..ca0eb05 100644 --- a/rust-app/bin-src/main.rs +++ b/rust-app/bin-src/main.rs @@ -4,7 +4,7 @@ #[cfg(not(target_family = "bolos"))] fn main() {} -use sui::main_nanos::*; +use iota::main_nanos::*; ledger_device_sdk::set_panic!(ledger_device_sdk::exiting_panic); diff --git a/rust-app/iota-small.gif b/rust-app/iota-small.gif new file mode 100644 index 0000000..6ded7d7 Binary files /dev/null and b/rust-app/iota-small.gif differ diff --git a/rust-app/iota.gif b/rust-app/iota.gif new file mode 100644 index 0000000..cd7e78d Binary files /dev/null and b/rust-app/iota.gif differ diff --git a/rust-app/src/implementation.rs b/rust-app/src/implementation.rs index 1ce8210..4ba3d10 100644 --- a/rust-app/src/implementation.rs +++ b/rust-app/src/implementation.rs @@ -18,26 +18,28 @@ use ledger_prompts_ui::{final_accept_prompt, ScrollerError}; use core::convert::TryFrom; use core::future::Future; -type SuiAddressRaw = [u8; SUI_ADDRESS_LENGTH]; +type IotaAddressRaw = [u8; IOTA_ADDRESS_LENGTH]; -pub struct SuiPubKeyAddress(ledger_device_sdk::ecc::ECPublicKey<65, 'E'>, SuiAddressRaw); +pub struct IotaPubKeyAddress(ledger_device_sdk::ecc::ECPublicKey<65, 'E'>, IotaAddressRaw); -impl Address> for SuiPubKeyAddress { +impl Address> + for IotaPubKeyAddress +{ fn get_address( key: &ledger_device_sdk::ecc::ECPublicKey<65, 'E'>, ) -> Result { let key_bytes = ed25519_public_key_bytes(key); let mut hasher: Blake2b = Hasher::new(); hasher.update(&key_bytes); - let hash: [u8; SUI_ADDRESS_LENGTH] = hasher.finalize(); - Ok(SuiPubKeyAddress(key.clone(), hash)) + let hash: [u8; IOTA_ADDRESS_LENGTH] = hasher.finalize(); + Ok(IotaPubKeyAddress(key.clone(), hash)) } fn get_binary_address(&self) -> &[u8] { &self.1 } } -impl core::fmt::Display for SuiPubKeyAddress { +impl core::fmt::Display for IotaPubKeyAddress { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "0x{}", HexSlice(&self.1)) } @@ -65,7 +67,7 @@ pub async fn get_address_apdu(io: HostIO, prompt: bool) { let mut rv = ArrayVec::::new(); - if with_public_keys(&path, true, |key, address: &SuiPubKeyAddress| { + if with_public_keys(&path, true, |key, address: &IotaPubKeyAddress| { try_option(|| -> Option<()> { if prompt { scroller("Provide Public Key", |_w| Ok(()))?; @@ -94,7 +96,7 @@ pub async fn get_address_apdu(io: HostIO, prompt: bool) { } pub enum CallArg { - RecipientAddress(SuiAddressRaw), + RecipientAddress(IotaAddressRaw), Amount(u64), OtherPure, ObjectArg, @@ -490,7 +492,7 @@ impl AsyncParser (u64, ArrayString<12>) { let mut remainder_str: ArrayString<12> = ArrayString::new(); { // Make a string for the remainder, containing at lease one zero - // So 1 SUI will be displayed as "1.0" + // So 1 IOTA will be displayed as "1.0" let mut rem = remainder; for i in 0..factor_pow { let f = u64::pow(10, factor_pow - i - 1); @@ -608,7 +610,7 @@ const fn gas_data_parser( if PROMPT { let (quotient, remainder_str) = get_amount_in_decimals(gas_budget); scroller("Max Gas", |w| { - Ok(write!(w, "SUI {}.{}", quotient, remainder_str.as_str())?) + Ok(write!(w, "IOTA {}.{}", quotient, remainder_str.as_str())?) })? } Some(()) @@ -699,7 +701,7 @@ pub async fn sign_apdu(io: HostIO, settings: Settings) { }; if known_txn { - if scroller("Transfer", |w| Ok(write!(w, "SUI")?)).is_none() { + if scroller("Transfer", |w| Ok(write!(w, "IOTA")?)).is_none() { reject::<()>(StatusWords::UserCancelled as u16).await; }; { @@ -709,7 +711,7 @@ pub async fn sign_apdu(io: HostIO, settings: Settings) { if !path.starts_with(&BIP32_PREFIX[0..2]) { reject::<()>(SyscallError::InvalidParameter as u16).await; } - if with_public_keys(&path, true, |_, address: &SuiPubKeyAddress| { + if with_public_keys(&path, true, |_, address: &IotaPubKeyAddress| { try_option(|| -> Option<()> { scroller_paginated("From", |w| Ok(write!(w, "{address}")?))?; Some(()) @@ -795,7 +797,7 @@ pub fn handle_apdu_async(io: HostIO, ins: Ins, settings: Settings) -> APDUsFutur trace!("Dispatching"); match ins { Ins::GetVersion => { - const APP_NAME: &str = "sui"; + const APP_NAME: &str = "iota"; let mut rv = ArrayVec::::new(); let _ = rv.try_push(env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap()); let _ = rv.try_push(env!("CARGO_PKG_VERSION_MINOR").parse().unwrap()); diff --git a/rust-app/src/interface.rs b/rust-app/src/interface.rs index 1d0df55..97ada2d 100644 --- a/rust-app/src/interface.rs +++ b/rust-app/src/interface.rs @@ -10,14 +10,14 @@ pub type Bip32Key = DArray, 10>; pub type SignParameters = (IntentMessage, Bip32Key); -// Sui Types +// Iota Types pub type IntentMessage = (Intent, TransactionData); pub struct TransactionData; pub type TransactionDataV1 = ( TransactionKind, - SuiAddress, // sender + IotaAddress, // sender GasData, // gas_data TransactionExpiration, // expiration ); @@ -32,7 +32,7 @@ pub struct CallArgSchema; pub type GasData = ( Vec, // payment - SuiAddress, // owner + IotaAddress, // owner Amount, // price Amount, // budget ); @@ -48,17 +48,17 @@ pub type SharedObject = ( bool, // mutable ); -pub type AccountAddress = SuiAddress; +pub type AccountAddress = IotaAddress; pub type ObjectID = AccountAddress; pub type SequenceNumber = U64LE; pub type ObjectDigest = SHA3_256_HASH; -pub const SUI_ADDRESS_LENGTH: usize = 32; -pub type SuiAddress = Array; +pub const IOTA_ADDRESS_LENGTH: usize = 32; +pub type IotaAddress = Array; pub type Coins = Vec; -pub type Recipient = SuiAddress; +pub type Recipient = IotaAddress; pub type Amount = U64LE; diff --git a/rust-app/src/main_nanos.rs b/rust-app/src/main_nanos.rs index b343309..f90455f 100644 --- a/rust-app/src/main_nanos.rs +++ b/rust-app/src/main_nanos.rs @@ -37,7 +37,7 @@ pub fn app_main() { }; let mut busy_menu = BusyMenu::Working; - info!("Sui {}", env!("CARGO_PKG_VERSION")); + info!("IOTA {}", env!("CARGO_PKG_VERSION")); info!( "State sizes\ncomm: {}\nstates: {}", core::mem::size_of::(), diff --git a/rust-app/src/menu.rs b/rust-app/src/menu.rs index 0b6c2e5..19ac5fa 100644 --- a/rust-app/src/menu.rs +++ b/rust-app/src/menu.rs @@ -4,7 +4,7 @@ use ledger_device_sdk::ui::bagls::*; use ledger_device_sdk::ui::bitmaps::Glyph; use ledger_prompts_ui::*; -pub const APP_ICON_GLYPH: Glyph = Glyph::from_include(include_gif!("sui-small.gif")); +pub const APP_ICON_GLYPH: Glyph = Glyph::from_include(include_gif!("iota-small.gif")); pub const APP_ICON: Icon = Icon::from(&APP_ICON_GLYPH) .set_x(MENU_ICON_X) @@ -113,7 +113,7 @@ impl Menu for IdleMenuWithSettings { AppMain => ( MenuLabelTop::Icon(&APP_ICON), MenuLabelBottom { - text: "Sui", + text: "IOTA", bold: true, }, ), diff --git a/rust-app/sui-small.gif b/rust-app/sui-small.gif deleted file mode 100644 index a4c0378..0000000 Binary files a/rust-app/sui-small.gif and /dev/null differ diff --git a/rust-app/sui.gif b/rust-app/sui.gif deleted file mode 100644 index 1ec35af..0000000 Binary files a/rust-app/sui.gif and /dev/null differ diff --git a/rust-app/tests/ts-tests.rs b/rust-app/tests/ts-tests.rs index 81287ee..4700433 100644 --- a/rust-app/tests/ts-tests.rs +++ b/rust-app/tests/ts-tests.rs @@ -5,7 +5,7 @@ use ledger_device_sdk::exit_app; -use sui::main_nanos::*; +use iota::main_nanos::*; #[no_mangle] extern "C" fn sample_main() { diff --git a/ts-tests/Sui.ts b/ts-tests/Iota.ts similarity index 91% rename from ts-tests/Sui.ts rename to ts-tests/Iota.ts index 1068521..6c17218 100644 --- a/ts-tests/Sui.ts +++ b/ts-tests/Iota.ts @@ -26,17 +26,17 @@ export type GetPublicKeyResult = { }; /** - * Sui API + * Iota API * * @example - * import Sui from "hw-app-sui"; - * const sui = new Sui(transport) + * import Iota from "hw-app-iota"; + * const iota = new Iota(transport) */ -export default class Sui extends Common { +export default class Iota extends Common { constructor(transport: Transport) { - super(transport, "SUI"); + super(transport, "IOTA"); this.sendChunks = this.sendWithBlocks; } diff --git a/ts-tests/common.ts b/ts-tests/common.ts index d02d49b..ca34f4f 100644 --- a/ts-tests/common.ts +++ b/ts-tests/common.ts @@ -1,7 +1,7 @@ import SpeculosTransport from '@ledgerhq/hw-transport-node-speculos'; import Axios from 'axios'; import Transport from "./http-transport"; -import Sui from "./Sui"; +import Iota from "./Iota"; import { expect } from 'chai'; export const VERSION = { @@ -13,7 +13,7 @@ export const VERSION = { const ignoredScreens = [ "Cancel", "Working...", "Quit", "Version" /* App name and version */ - , "Sui", "ui", `${VERSION.major}.${VERSION.minor}.${VERSION.patch}` + , "IOTA", "ui", `${VERSION.major}.${VERSION.minor}.${VERSION.patch}` , "Settings", "Blind Signing", "Enabled", "Disabled", "Back" /* The next ones are specifically for S+ in which OCR is broken */ @@ -152,7 +152,7 @@ const sendCommandAndAccept = async function(command : any, prompts : any[]) { await Axios.delete(BASE_URL + "/events"); const transport = await Transport.open(BASE_URL + "/apdu"); - const client = new Sui(transport); + const client = new Iota(transport); let err = null; try { await command(client); } catch(e) { @@ -178,7 +178,7 @@ const sendCommandExpectFail = async function(command : any) { await Axios.delete(BASE_URL + "/events"); const transport = await Transport.open(BASE_URL + "/apdu"); - const client = new Sui(transport); + const client = new Iota(transport); // client.sendChunks = client.sendWithBlocks; // Use Block protocol try { await command(client); } catch(e) { diff --git a/ts-tests/package.json b/ts-tests/package.json index 9407c96..8fa6020 100644 --- a/ts-tests/package.json +++ b/ts-tests/package.json @@ -1,5 +1,5 @@ { - "name": "sui-ledger-tests", + "name": "iota-ledger-tests", "version": "0.0.1", "src": ".", "scripts": { diff --git a/ts-tests/public-key-tests.ts b/ts-tests/public-key-tests.ts index cb3ce27..3cbbaeb 100644 --- a/ts-tests/public-key-tests.ts +++ b/ts-tests/public-key-tests.ts @@ -2,7 +2,7 @@ import { sendCommandAndAccept, BASE_URL, sendCommandExpectFail, toggleBlindSigni import { expect } from 'chai'; import { describe, it } from 'mocha'; import Axios from 'axios'; -import type Sui from "./Sui"; +import type Iota from "./Iota"; describe('public key tests', () => { @@ -13,7 +13,7 @@ describe('public key tests', () => { it('provides a public key', async () => { - await sendCommandAndAccept(async (client: Sui) => { + await sendCommandAndAccept(async (client: Iota) => { const rv = await client.getPublicKey("44'/4218'/0'"); expect(new Buffer(rv.publicKey).toString('hex')).to.equal("6fc6f39448ad7af0953b78b16d0f840e6fe718ba4a89384239ff20ed088da2fa"); expect(new Buffer(rv.address).toString('hex')).to.equal("56b19e720f3bfa8caaef806afdd5dfaffd0d6ec9476323a14d1638ad734b2ba5"); @@ -23,7 +23,7 @@ describe('public key tests', () => { it('does address verification', async () => { - await sendCommandAndAccept(async (client: Sui) => { + await sendCommandAndAccept(async (client: Iota) => { const rv = await client.verifyAddress("44'/4218'/0'"); expect(new Buffer(rv.publicKey).toString('hex')).to.equal("6fc6f39448ad7af0953b78b16d0f840e6fe718ba4a89384239ff20ed088da2fa"); expect(new Buffer(rv.address).toString('hex')).to.equal("56b19e720f3bfa8caaef806afdd5dfaffd0d6ec9476323a14d1638ad734b2ba5"); diff --git a/ts-tests/signing-tests.ts b/ts-tests/signing-tests.ts index b3ea881..9a51fb9 100644 --- a/ts-tests/signing-tests.ts +++ b/ts-tests/signing-tests.ts @@ -2,7 +2,7 @@ import { VERSION, sendCommandAndAccept, BASE_URL, sendCommandExpectFail, toggleB import { expect } from 'chai'; import { describe, it } from 'mocha'; import Axios from 'axios'; -import type Sui from "./Sui"; +import type Iota from "./Iota"; import * as blake2b from "blake2b"; import { instantiate, Nacl } from "js-nacl"; @@ -12,7 +12,7 @@ instantiate(n => { nacl = n; }); function testTransaction(path: string, txn: Buffer, prompts: any[]) { return async () => { - await sendCommandAndAccept(async (client: Sui) => { + await sendCommandAndAccept(async (client: Iota) => { const { publicKey } = await client.getPublicKey(path); @@ -43,7 +43,7 @@ describe("Signing tests", function () { [ { "header": "Transfer", - "prompt": "SUI" + "prompt": "IOTA" }, { "header": "From", @@ -57,11 +57,11 @@ describe("Signing tests", function () { }, { "header": "Amount", - "prompt": "SUI 0.001" + "prompt": "IOTA 0.001" }, { "header": "Max Gas", - "prompt": "SUI 0.000001036" + "prompt": "IOTA 0.000001036" }, { "text": "Sign Transaction?", @@ -109,11 +109,11 @@ describe("Signing tests", function () { await toggleBlindSigningSettings(); }); - it("should reject signing a non-SUI coin transaction, if blind signing is not enabled", async function () { + it("should reject signing a non-IOTA coin transaction, if blind signing is not enabled", async function () { const path = "44'/4218'/0'"; const txn = Buffer.from("AAAAAAADAQAe2uv1Mds+xCVK5Jv/Dv5cgEl/9DthDcpbjWcsmFpzbs6BNQAAAAAAIKPD8GQqgBpJZRV+nFDRE7rqR0Za8x0pyfLusVdpPPVRAAgADl+jHAAAAAAg5y3MHATlk+Ik5cPIdEz5iPANs1jcXZHVGjh4Mb16lwkCAgEAAAEBAQABAQIAAAECAF/sd27xyQe/W+gY4WRtPlQro1siWQu79s0pxbbCSRafAfnjaU5yJSFFDJznsAaBqbkiR9CB8DJqWki8fn8AUZeQz4E1AAAAAAAgTRU/MsawTJirpVwjDF8gyiEbaT0+7J0V8ifUEGGBkcVf7Hdu8ckHv1voGOFkbT5UK6NbIlkLu/bNKcW2wkkWn+gDAAAAAAAA8NdGAAAAAAAA", "base64"); - await sendCommandExpectFail(async (client: Sui) => { + await sendCommandExpectFail(async (client: Iota) => { await client.signTransaction(path, txn); }); }); @@ -122,7 +122,7 @@ describe("Signing tests", function () { const path = "44'/4218'/0'"; const txn = Buffer.from("00000000050205546e7f126d2f40331a543b9608439b582fd0d103000000000000002080fdabcc90498e7eb8413b140c4334871eeafa5a86203fd9cfdb032f604f49e1284af431cf032b5d85324135bf9a3073e920d7f5020000000000000020a06f410c175e828c24cee84cb3bd95cff25c33fbbdcb62c6596e8e423784ffe702d08074075c7097f361e8b443e2075a852a2292e8a08074075c7097f361e8b443e2075a852a2292e80180969800000000001643fb2578ff7191c643079a62c1cca8ec2752bc05546e7f126d2f40331a543b9608439b582fd0d103000000000000002080fdabcc90498e7eb8413b140c4334871eeafa5a86203fd9cfdb032f604f49e101000000000000002c01000000000000", "hex"); - await sendCommandExpectFail(async (client: Sui) => { + await sendCommandExpectFail(async (client: Iota) => { await client.signTransaction(path, txn); }); });