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!: sign_message_nep413, sign_message_nep366_delegate_action features, examples #6

Merged
merged 27 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6de6123
chore: increase `CHUNK_SIZE`
Jan 18, 2024
f6492ed
chore: move `sign_transaction` example to `sign_transfer`
Jan 18, 2024
6c20d3b
chore: add `sign_multiple_transfers` example (3x)
Jan 18, 2024
1d9fbc9
chore: add `get_public_key_display` and `get_public_key_silent` examples
Jan 18, 2024
4e768f5
chore: add `get_wallet_id` example
Jan 18, 2024
f261d8b
chore: silent `get_public_key` by default in sign examples
Jan 18, 2024
756eed6
chore: add `sign_create_account` example
Jan 19, 2024
84ab665
chore: add `sign_delete_account` `short/long` examples
Jan 19, 2024
619ac75
chore: add `delete_key_ed25519` example
Jan 22, 2024
ffc181d
chore: add `sign_delete_key_secp256k1` example
Jan 25, 2024
350ed9d
chore: compile fix and fmt
Jan 25, 2024
9696dbb
chore: add `sign_stake` example
Jan 25, 2024
e78fb01
chore: add `add_key_fullaccess` example
Jan 26, 2024
96d5eb2
chore: add `sign_add_key_functioncall` example
Jan 26, 2024
2fb2028
chore: add `sign_deploy_contract` example
Jan 29, 2024
ac238f0
chore: add `sign_functioncall_str` example
Jan 30, 2024
9b55cd9
chore: add `sign_functioncall_bin` example
Jan 31, 2024
36e9452
chore: add `sign_delegate` example
Jan 31, 2024
69cf1e4
feat: impl `sign_message_nep413`
Jan 31, 2024
3e0e44e
chore: correct `sign_delegate` example
Feb 1, 2024
16c8b62
feat: impl `sign_message_nep366_delegate_action`
Feb 1, 2024
2a1a3c4
chore: reorg examples
Feb 6, 2024
065c44a
chore: add `sign_functioncall_str_parse_err` example
Feb 6, 2024
4cd0e56
chore: add `sign_transaction/batch_all_actions.rs` example
Feb 6, 2024
72fde37
chore: expand `sign_nep_366_delegate_action` to include all types of …
Feb 6, 2024
a77f2da
chore: improve `log::info` of apdu-s
Feb 12, 2024
38ff28d
chore!: remove `blind_sign_transaction` public fn
Feb 27, 2024
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
77 changes: 73 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "near-ledger"
version = "0.4.0"
version = "0.5.0"
edition = "2018"
authors = ["Bohdan Khorolets <b@khorolets.com>"]
description = "Transport library to integrate with NEAR Ledger app"
Expand All @@ -12,13 +12,80 @@ keywords = ["ledger", "nearprotocol"]
name = "get_version"

[[example]]
name = "get_public_key"
name = "get_public_key_display"
path = "examples/get_public_key/display.rs"

[[example]]
name = "sign_transaction"
name = "get_public_key_silent"
path = "examples/get_public_key/silent.rs"

[[example]]
name = "blind_sign_transaction"
name = "get_wallet_id"
path = "examples/get_wallet_id.rs"

[[example]]
name = "sign_transfer"
path = "examples/sign_transaction/transfer.rs"

[[example]]
name = "sign_create_account"
path = "examples/sign_transaction/create_account.rs"

[[example]]
name = "sign_delete_account_short"
path = "examples/sign_transaction/delete_account_short.rs"

[[example]]
name = "sign_delete_account_long"
path = "examples/sign_transaction/delete_account_long.rs"

[[example]]
name = "sign_delete_key_ed25519"
path = "examples/sign_transaction/delete_key_ed25519.rs"

[[example]]
name = "sign_delete_key_secp256k1"
path = "examples/sign_transaction/delete_key_secp256k1.rs"

[[example]]
name = "sign_stake"
path = "examples/sign_transaction/stake.rs"

[[example]]
name = "sign_add_key_fullaccess"
path = "examples/sign_transaction/add_key_fullaccess.rs"

[[example]]
name = "sign_add_key_functioncall"
path = "examples/sign_transaction/add_key_functioncall.rs"

[[example]]
name = "sign_deploy_contract"
path = "examples/sign_transaction/deploy_contract.rs"

[[example]]
name = "sign_functioncall_str"
path = "examples/sign_transaction/functioncall_str.rs"

[[example]]
name = "sign_functioncall_bin"
path = "examples/sign_transaction/functioncall_bin.rs"

[[example]]
name = "sign_functioncall_str_parse_err"
path = "examples/sign_transaction/functioncall_str_parse_err.rs"

[[example]]
name = "sign_batch_all_actions"
path = "examples/sign_transaction/batch_all_actions.rs"

[[example]]
name = "sign_nep_413_message"
path = "examples/sign_nep_413_message.rs"

[[example]]
name = "sign_nep_366_delegate_action"
path = "examples/sign_nep_366_delegate_action.rs"

[dependencies]
ed25519-dalek = { version = "1" }
Expand All @@ -29,8 +96,10 @@ slip10 = "0.4.3"
log = "0.4.20"
hex = "0.4.3"
near-primitives-core = "0.20.0"
near-primitives = "0.20.0"

[dev-dependencies]
env_logger = "0.10.0"
near-crypto = "0.20.0"
near-primitives = "0.20.0"
near-account-id = { version = "1.0.0", features = ["internal_unstable"]}
49 changes: 44 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,62 @@ let signature = near_crypto::Signature::from_parts(near_crypto::KeyType::ED25519
### Get version

```bash
RUST_LOG=get_version,near_ledger=info cargo run --example get_version
RUST_LOG=info cargo run --example get_version
```

### Get PublicKey from Ledger

#### Display

```bash
RUST_LOG=info cargo run --example get_public_key_display
```
#### Silent

```bash
RUST_LOG=get_public_key,near_ledger=info cargo run --example get_public_key
RUST_LOG=info cargo run --example get_public_key_silent
```

### Get WalletID from Ledger

```bash
RUST_LOG=info cargo run --example get_wallet_id
```
### Sign a transaction

#### Transfer

```bash
RUST_LOG=info cargo run --example sign_transfer
```

#### Other

```bash
export RUST_LOG=info
cargo run --example sign_create_account
cargo run --example sign_delete_account_short
cargo run --example sign_delete_account_long
cargo run --example sign_delete_key_ed25519
cargo run --example sign_delete_key_secp256k1
cargo run --example sign_stake
cargo run --example sign_add_key_fullaccess
cargo run --example sign_add_key_functioncall
cargo run --example sign_deploy_contract
cargo run --example sign_functioncall_str
cargo run --example sign_functioncall_bin
cargo run --example sign_functioncall_str_parse_err
cargo run --example sign_batch_all_actions
```

### Sign a NEP-413 message

```bash
RUST_LOG=sign_transaction,near_ledger=info cargo run --example sign_transaction
RUST_LOG=info cargo run --example sign_nep_413_message
```

### Blind sign a transaction
### Sign a NEP-366 delegate action

```bash
RUST_LOG=blind_sign_transaction,near_ledger=info cargo run --example blind_sign_transaction
RUST_LOG=info cargo run --example sign_nep_366_delegate_action
```
53 changes: 0 additions & 53 deletions examples/blind_sign_transaction.rs

This file was deleted.

Loading
Loading