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!: rename sui to iota #8

Merged
merged 10 commits into from
Jun 13, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 8 additions & 8 deletions .github/workflows/functional_tests.yml
Original file line number Diff line number Diff line change
@@ -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"
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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,21 +71,24 @@ 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.

### Obtaining a release tarball

#### 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](TODO) 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
10 changes: 5 additions & 5 deletions default.nix
Original file line number Diff line number Diff line change
@@ -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
27 changes: 12 additions & 15 deletions guide.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
# How to use Sui app on your Ledger device
# How to use Iota app on your Ledger device

Thoralf-M marked this conversation as resolved.
Show resolved Hide resolved
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

- You've [initialized](https://support.ledgerwallet.com/hc/en-us/articles/360000613793) your Ledger device.
- 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/
38 changes: 19 additions & 19 deletions rust-app/Cargo.lock

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

25 changes: 15 additions & 10 deletions rust-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Thoralf-M marked this conversation as resolved.
Show resolved Hide resolved
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"
2 changes: 1 addition & 1 deletion rust-app/bin-src/main.rs
Original file line number Diff line number Diff line change
@@ -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);

28 changes: 15 additions & 13 deletions rust-app/src/implementation.rs
Original file line number Diff line number Diff line change
@@ -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<SuiPubKeyAddress, ledger_device_sdk::ecc::ECPublicKey<65, 'E'>> for SuiPubKeyAddress {
impl Address<IotaPubKeyAddress, ledger_device_sdk::ecc::ECPublicKey<65, 'E'>>
for IotaPubKeyAddress
{
fn get_address(
key: &ledger_device_sdk::ecc::ECPublicKey<65, 'E'>,
) -> Result<Self, SyscallError> {
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();
let hash: [u8; IOTA_ADDRESS_LENGTH] = hasher.finalize();
Ok(SuiPubKeyAddress(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::<u8, 220>::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<BS: Clone + Readable, const PROMPT: bool> AsyncParser<ProgrammableTransacti

let (quotient, remainder_str) = get_amount_in_decimals(total_amount);
scroller_paginated("Amount", |w| {
Ok(write!(w, "SUI {quotient}.{}", remainder_str.as_str())?)
Ok(write!(w, "IOTA {quotient}.{}", remainder_str.as_str())?)
})?;
},
)
@@ -544,7 +546,7 @@ fn get_amount_in_decimals(amount: u64) -> (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<BS: Clone + Readable, const PROMPT: bool>(
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::<u8, 220>::new();
let _ = rv.try_push(env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap());
let _ = rv.try_push(env!("CARGO_PKG_VERSION_MINOR").parse().unwrap());
14 changes: 7 additions & 7 deletions rust-app/src/interface.rs
Original file line number Diff line number Diff line change
@@ -10,14 +10,14 @@ pub type Bip32Key = DArray<Byte, U32<{ Endianness::Little }>, 10>;

pub type SignParameters = (IntentMessage<true>, Bip32Key);

// Sui Types
// Iota Types
pub type IntentMessage<const PROMPT: bool> = (Intent, TransactionData<PROMPT>);

pub struct TransactionData<const PROMPT: bool>;

pub type TransactionDataV1<const PROMPT: bool> = (
TransactionKind<PROMPT>,
SuiAddress, // sender
IotaAddress, // sender
GasData<PROMPT>, // gas_data
TransactionExpiration, // expiration
);
@@ -32,7 +32,7 @@ pub struct CallArgSchema;

pub type GasData<const PROMPT: bool> = (
Vec<ObjectRef, { usize::MAX }>, // 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<Byte, SUI_ADDRESS_LENGTH>;
pub const IOTA_ADDRESS_LENGTH: usize = 32;
pub type IotaAddress = Array<Byte, IOTA_ADDRESS_LENGTH>;

pub type Coins = Vec<ObjectRef, { usize::MAX }>;

pub type Recipient = SuiAddress;
pub type Recipient = IotaAddress;

pub type Amount = U64LE;

2 changes: 1 addition & 1 deletion rust-app/src/main_nanos.rs
Original file line number Diff line number Diff line change
@@ -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::<io::Comm>(),
4 changes: 2 additions & 2 deletions rust-app/src/menu.rs
Original file line number Diff line number Diff line change
@@ -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,
},
),
2 changes: 1 addition & 1 deletion rust-app/tests/ts-tests.rs
Original file line number Diff line number Diff line change
@@ -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() {
3,531 changes: 3,531 additions & 0 deletions sui-nanos/app.hex
Thoralf-M marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions sui-nanos/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
rec {
alamgu = import (import ./dep/alamgu/thunk.nix) {};
ledgerctl = alamgu.ledgerctl;
this = ./.;
load-app = alamgu.pkgs.writeScriptBin "load-app" ''
#!/usr/bin/env bash
cd ${this}
${ledgerctl}/bin/ledgerctl install -f ${this}/app.json
'';
}
2 changes: 2 additions & 0 deletions sui-nanos/dep/alamgu/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DO NOT HAND-EDIT THIS FILE
import (import ./thunk.nix)
8 changes: 8 additions & 0 deletions sui-nanos/dep/alamgu/github.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"owner": "alamgu",
"repo": "alamgu",
"branch": "develop",
"private": false,
"rev": "f41eb60cb2b5145b4948c51898062911c342db6b",
"sha256": "16n2b0irpkgjzp5mrl6vxza0bw7p5c6bmgbfmynbzbcyij5arhnh"
}
9 changes: 9 additions & 0 deletions sui-nanos/dep/alamgu/thunk.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# DO NOT HAND-EDIT THIS FILE
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
if !fetchSubmodules && !private then builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
} else (import <nixpkgs> {}).fetchFromGitHub {
inherit owner repo rev sha256 fetchSubmodules private;
};
json = builtins.fromJSON (builtins.readFile ./github.json);
in fetch json
1 change: 1 addition & 0 deletions sui-nanos/device
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nanos
7 changes: 7 additions & 0 deletions sui-nanos/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let
tarballNix = import ./.;
in
tarballNix.alamgu.pkgs.mkShell {
nativeBuildInputs = [ tarballNix.load-app ];
strictDeps = true;
}
Binary file added sui-nanos/sui-small.gif
Thoralf-M marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sui-nanos/sui.gif

Unable to render rich display

10 changes: 5 additions & 5 deletions ts-tests/Sui.ts
Original file line number Diff line number Diff line change
@@ -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;
}

8 changes: 4 additions & 4 deletions ts-tests/common.ts
Original file line number Diff line number Diff line change
@@ -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) {
2 changes: 1 addition & 1 deletion ts-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sui-ledger-tests",
"name": "iota-ledger-tests",
"version": "0.0.1",
"src": ".",
"scripts": {
6 changes: 3 additions & 3 deletions ts-tests/public-key-tests.ts
Original file line number Diff line number Diff line change
@@ -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");
16 changes: 8 additions & 8 deletions ts-tests/signing-tests.ts
Original file line number Diff line number Diff line change
@@ -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);
});
});