Skip to content

Commit

Permalink
update to hdk 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Soushi888 committed Mar 8, 2024
1 parent fc3663f commit 383e9d7
Show file tree
Hide file tree
Showing 13 changed files with 8,551 additions and 11,449 deletions.
1,018 changes: 669 additions & 349 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ opt-level = "z"
members = ["dnas/*/zomes/coordinator/*", "dnas/*/zomes/integrity/*"]

[workspace.dependencies]
hdi = "=0.2.4"
hdk = "=0.1.4"
hdi = "=0.3.6"
hdk = "=0.2.6"
image = "0.24.7"
serde = "=1.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ fn get_my_profile(_: ()) -> ExternResult<Option<Record>> {
let latest_link = get_latest_link(update_links);

match latest_link {
Some(link) => get(ActionHash::from(link.target.clone()), GetOptions::default()),
Some(link) => get(
link.target.into_action_hash().unwrap(),
GetOptions::default(),
),
None => get(
ActionHash::from(profile_link.target.clone()),
profile_link.target.into_action_hash().unwrap(),
GetOptions::default(),
),
}
Expand Down Expand Up @@ -109,7 +112,7 @@ pub fn get_individual_profile(individual_profile_hash: ActionHash) -> ExternResu
let latest_link = get_latest_link(links);

let latest_individual_profile_hash = match latest_link {
Some(link) => ActionHash::from(link.target.clone()),
Some(link) => link.target.clone().into_action_hash().unwrap(),
None => individual_profile_hash.clone(),
};

Expand Down Expand Up @@ -139,7 +142,8 @@ pub fn get_all_individual_profiles(_: ()) -> ExternResult<Vec<Record>> {
)?;

for link in links {
let individual_profile = get_individual_profile(ActionHash::from(link.target.clone()))?;
let individual_profile =
get_individual_profile(link.target.clone().into_action_hash().unwrap())?;
if let Some(individual_profile) = individual_profile {
individual_profiles.push(individual_profile)
}
Expand Down Expand Up @@ -176,7 +180,7 @@ pub fn update_individual_profile(input: UpdateIndividualProfileInput) -> ExternR
let updated_individual_profile = input.updated_individual_profile;

let record = match get(
ActionHash::from(individual_profile_hash.clone()),
individual_profile_hash.clone().into_hash(),
GetOptions::default(),
)? {
Some(record) => record,
Expand All @@ -198,7 +202,7 @@ pub fn update_individual_profile(input: UpdateIndividualProfileInput) -> ExternR
let latest_link = get_latest_link(all_update_links);

let previous_individual_profile_hash = match latest_link {
Some(link) => Some(ActionHash::from(link.target.clone())),
Some(link) => Some(link.target.clone().into_action_hash().unwrap()),
None => None,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn validate_create_link_individual_profile_updates(
target_address: AnyLinkableHash,
_tag: LinkTag,
) -> ExternResult<ValidateCallbackResult> {
let action_hash = ActionHash::from(base_address);
let action_hash = base_address.into_action_hash().unwrap();
let record = must_get_valid_record(action_hash)?;
let _individual_profile: crate::IndividualProfile = record
.entry()
Expand All @@ -104,7 +104,7 @@ pub fn validate_create_link_individual_profile_updates(
"Linked action must reference an entry"
))))?;
// Check the entry type for the given action hash
let action_hash = ActionHash::from(target_address);
let action_hash = target_address.into_action_hash().unwrap();
let record = must_get_valid_record(action_hash)?;
let _individual_profile: crate::IndividualProfile = record
.entry()
Expand Down
Loading

0 comments on commit 383e9d7

Please sign in to comment.