Skip to content

Commit

Permalink
chore: replace slip10 0.4.3 with slipped10 0.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dj8yf0μl committed Jun 21, 2024
1 parent 9876f0e commit c657d84
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "near-ledger"
version = "0.6.1"
version = "0.7.0"
edition = "2018"
authors = ["Bohdan Khorolets <b@khorolets.com>"]
description = "Transport library to integrate with NEAR Ledger app"
Expand Down Expand Up @@ -92,7 +92,7 @@ ed25519-dalek = { version = "1" }
ledger-transport = "0.11.0"
ledger-transport-hid = "0.11.0"
ledger-apdu = "0.11.0"
slip10 = "0.4.3"
slipped10 = "0.4.4"
log = "0.4.20"
hex = "0.4.3"
near-primitives-core = ">0.22,<0.24"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Provides a set of commands that can be executed to communicate with NEAR App ins

```rust
use near_ledger::get_public_key;
use slip10::BIP32Path;
use slipped10::BIP32Path;
use std::str::FromStr;

let hd_path = BIP32Path::from_str("44'/397'/0'/0'/1'").unwrap();
Expand Down Expand Up @@ -50,7 +50,7 @@ let public_key = near_crypto::PublicKey::ED25519(
```rust
use near_ledger::{sign_transaction, SignTarget};
use near_primitives::borsh::BorshSerialize;
use slip10::BIP32Path;
use slipped10::BIP32Path;
use std::str::FromStr;

let hd_path = BIP32Path::from_str("44'/397'/0'/0'/1'").unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/common/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ed25519_dalek::Signature;
use ed25519_dalek::Verifier;
use near_ledger::NEARLedgerError;
use near_primitives_core::{borsh, borsh::BorshSerialize, hash::CryptoHash, types::AccountId};
use slip10::BIP32Path;
use slipped10::BIP32Path;

use near_crypto::SecretKey;
use near_primitives::transaction::{DeployContractAction, FunctionCallAction};
Expand Down
2 changes: 1 addition & 1 deletion examples/get_public_key/display.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::str::FromStr;

use near_ledger::{get_public_key_with_display_flag, NEARLedgerError};
use slip10::BIP32Path;
use slipped10::BIP32Path;

#[path = "../common/lib.rs"]
mod common;
Expand Down
2 changes: 1 addition & 1 deletion examples/get_public_key/silent.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::str::FromStr;

use near_ledger::{get_public_key_with_display_flag, NEARLedgerError};
use slip10::BIP32Path;
use slipped10::BIP32Path;

#[path = "../common/lib.rs"]
mod common;
Expand Down
2 changes: 1 addition & 1 deletion examples/get_wallet_id.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::str::FromStr;

use near_ledger::{get_wallet_id, NEARLedgerError};
use slip10::BIP32Path;
use slipped10::BIP32Path;

#[path = "./common/lib.rs"]
mod common;
Expand Down
2 changes: 1 addition & 1 deletion examples/sign_nep_366_delegate_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use near_account_id::AccountId;
use near_crypto::Signature;
use near_ledger::NEARLedgerError;
use near_primitives::action::delegate::{DelegateAction, SignedDelegateAction};
use slip10::BIP32Path;
use slipped10::BIP32Path;

use crate::common::display_pub_key;

Expand Down
2 changes: 1 addition & 1 deletion examples/sign_nep_413_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ed25519_dalek::Verifier;
use near_ledger::{NEARLedgerError, NEP413Payload};
use near_primitives::signable_message::{MessageDiscriminant, SignableMessage};
use near_primitives_core::{borsh, hash::CryptoHash};
use slip10::BIP32Path;
use slipped10::BIP32Path;

use crate::common::display_pub_key;

Expand Down
22 changes: 11 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub enum NEARLedgerError {
}

/// Converts BIP32Path into bytes (`Vec<u8>`)
fn hd_path_to_bytes(hd_path: &slip10::BIP32Path) -> Vec<u8> {
fn hd_path_to_bytes(hd_path: &slipped10::BIP32Path) -> Vec<u8> {
(0..hd_path.depth())
.flat_map(|index| {
let value = *hd_path.index(index).unwrap();
Expand Down Expand Up @@ -117,7 +117,7 @@ pub fn get_version() -> Result<NEARLedgerAppVersion, NEARLedgerError> {
/// Gets PublicKey from the Ledger on the given `hd_path`
///
/// # Inputs
/// * `hd_path` - seed phrase hd path `slip10::BIP32Path` for which PublicKey to look
/// * `hd_path` - seed phrase hd path `slipped10::BIP32Path` for which PublicKey to look
///
/// # Returns
///
Expand All @@ -129,7 +129,7 @@ pub fn get_version() -> Result<NEARLedgerAppVersion, NEARLedgerError> {
///
/// ```no_run
/// use near_ledger::get_public_key;
/// use slip10::BIP32Path;
/// use slipped10::BIP32Path;
/// use std::str::FromStr;
///
/// # fn main() {
Expand All @@ -153,13 +153,13 @@ pub fn get_version() -> Result<NEARLedgerAppVersion, NEARLedgerError> {
/// );
/// ```
pub fn get_public_key(
hd_path: slip10::BIP32Path,
hd_path: slipped10::BIP32Path,
) -> Result<ed25519_dalek::PublicKey, NEARLedgerError> {
get_public_key_with_display_flag(hd_path, true)
}

pub fn get_public_key_with_display_flag(
hd_path: slip10::BIP32Path,
hd_path: slipped10::BIP32Path,
display_and_confirm: bool,
) -> Result<ed25519_dalek::PublicKey, NEARLedgerError> {
// instantiate the connection to Ledger
Expand Down Expand Up @@ -208,7 +208,7 @@ pub fn get_public_key_with_display_flag(
}

pub fn get_wallet_id(
hd_path: slip10::BIP32Path,
hd_path: slipped10::BIP32Path,
) -> Result<ed25519_dalek::PublicKey, NEARLedgerError> {
// instantiate the connection to Ledger
// will return an error if Ledger is not connected
Expand Down Expand Up @@ -261,7 +261,7 @@ fn get_transport() -> Result<TransportNativeHID, NEARLedgerError> {
/// # Inputs
/// * `unsigned_transaction_borsh_serializer` - unsigned transaction `near_primitives::transaction::Transaction`
/// which is serialized with `BorshSerializer` and basically is just `Vec<u8>`
/// * `seed_phrase_hd_path` - seed phrase hd path `slip10::BIP32Path` with which to sign
/// * `seed_phrase_hd_path` - seed phrase hd path `slipped10::BIP32Path` with which to sign
///
/// # Returns
///
Expand All @@ -273,7 +273,7 @@ fn get_transport() -> Result<TransportNativeHID, NEARLedgerError> {
/// ```no_run
/// use near_ledger::sign_transaction;
/// use near_primitives::{borsh, borsh::BorshSerialize};
/// use slip10::BIP32Path;
/// use slipped10::BIP32Path;
/// use std::str::FromStr;
///
/// # fn main() {
Expand All @@ -296,7 +296,7 @@ fn get_transport() -> Result<TransportNativeHID, NEARLedgerError> {
/// ```
pub fn sign_transaction(
unsigned_tx: BorshSerializedUnsignedTransaction,
seed_phrase_hd_path: slip10::BIP32Path,
seed_phrase_hd_path: slipped10::BIP32Path,
) -> Result<SignatureBytes, NEARLedgerError> {
let transport = get_transport()?;
// seed_phrase_hd_path must be converted into bytes to be sent as `data` to the Ledger
Expand Down Expand Up @@ -363,7 +363,7 @@ pub struct NEP413Payload {

pub fn sign_message_nep413(
payload: &NEP413Payload,
seed_phrase_hd_path: slip10::BIP32Path,
seed_phrase_hd_path: slipped10::BIP32Path,
) -> Result<SignatureBytes, NEARLedgerError> {
let transport = get_transport()?;
// seed_phrase_hd_path must be converted into bytes to be sent as `data` to the Ledger
Expand Down Expand Up @@ -421,7 +421,7 @@ pub fn sign_message_nep413(

pub fn sign_message_nep366_delegate_action(
payload: &DelegateAction,
seed_phrase_hd_path: slip10::BIP32Path,
seed_phrase_hd_path: slipped10::BIP32Path,
) -> Result<SignatureBytes, NEARLedgerError> {
let transport = get_transport()?;
// seed_phrase_hd_path must be converted into bytes to be sent as `data` to the Ledger
Expand Down

0 comments on commit c657d84

Please sign in to comment.