Skip to content

Commit

Permalink
Merge pull request #68 from KeystoneHQ/update-parse-path-result
Browse files Browse the repository at this point in the history
Update parse hd path result
  • Loading branch information
LiYanLance authored Aug 22, 2023
2 parents c220012 + 6a5ca78 commit 00549c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions URRegistryFFI.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "URRegistryFFI"
spec.version = "0.2.0"
spec.version = "0.2.2"
spec.summary = "An BC-UR registry implementation with rust-lang"
spec.homepage = "https://github.com/KeystoneHQ/keystone-sdk-rust"
spec.license = { :type => 'Copyright', :text => 'Copyright 2023 Keystone' }
Expand All @@ -9,6 +9,6 @@ Pod::Spec.new do |spec|
spec.swift_version = "5.6"
spec.platform = :ios, '13.0'
spec.static_framework = true
spec.source = { :http => "https://github.com/KeystoneHQ/keystone-sdk-rust/releases/download/sdk-0.1.1/URRegistryFFI.xcframework.zip", :type => "zip" }
spec.source = { :http => "https://github.com/KeystoneHQ/keystone-sdk-rust/releases/download/sdk-0.1.3/URRegistryFFI.xcframework.zip", :type => "zip" }
spec.ios.vendored_frameworks = 'URRegistryFFI.xcframework'
end
8 changes: 4 additions & 4 deletions libs/ur-registry-ffi/src/utils/hd_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export! {
Ok(path) => path,
Err(_) => HDPath::empty()
};
json!({"result": result}).to_string()
json!(result).to_string()
}
}

Expand All @@ -89,23 +89,23 @@ mod tests {
#[test]
fn test_parse_hd_path() {
let hd_path = "m/44'/60'/0'/0/0";
let expect_result = r#"{"result":{"account":{"hardened":true,"index":0},"address_index":{"hardened":false,"index":0},"change":{"hardened":false,"index":0},"coin_type":{"hardened":true,"index":60},"purpose":{"hardened":true,"index":44}}}"#;
let expect_result = r#"{"account":{"hardened":true,"index":0},"address_index":{"hardened":false,"index":0},"change":{"hardened":false,"index":0},"coin_type":{"hardened":true,"index":60},"purpose":{"hardened":true,"index":44}}"#;

assert_eq!(expect_result, parse_hd_path(hd_path))
}

#[test]
fn test_parse_hd_path_given_eth_xpub_path() {
let hd_path = "M/44\'/60\'/0\'";
let expect_result = r#"{"result":{"account":{"hardened":true,"index":0},"address_index":null,"change":null,"coin_type":{"hardened":true,"index":60},"purpose":{"hardened":true,"index":44}}}"#;
let expect_result = r#"{"account":{"hardened":true,"index":0},"address_index":null,"change":null,"coin_type":{"hardened":true,"index":60},"purpose":{"hardened":true,"index":44}}"#;

assert_eq!(expect_result, parse_hd_path(hd_path))
}

#[test]
fn test_parse_hd_path_given_empty_path() {
let hd_path = "";
let expect_result = r#"{"result":{"account":null,"address_index":null,"change":null,"coin_type":null,"purpose":null}}"#;
let expect_result = r#"{"account":null,"address_index":null,"change":null,"coin_type":null,"purpose":null}"#;

assert_eq!(expect_result, parse_hd_path(hd_path))
}
Expand Down

0 comments on commit 00549c3

Please sign in to comment.