Skip to content

Commit

Permalink
bump: hdk 3.1 hdi 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dauphin3 committed Jul 29, 2024
1 parent 57b4089 commit 70b40aa
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 8,305 deletions.
8,190 changes: 0 additions & 8,190 deletions Cargo.lock

This file was deleted.

152 changes: 56 additions & 96 deletions flake.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
inputs = {
versions.url = "github:holochain/holochain?dir=versions/0_2";
versions.url = "github:holochain/holochain?dir=versions/0_3";
holonix.url = "github:holochain/holochain";
holonix.inputs.versions.follows = "versions";

Expand Down
4 changes: 2 additions & 2 deletions zomes/trust_atom/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ name = "trust_atom"
crate-type = ["cdylib", "rlib"]

[dependencies]
hdk = "=0.2.8"
hdk = "=0.3.1"
rust_decimal = "1"
serde = "1"
trust_atom_types = { path = "../trust_atom_types" }
trust_atom_integrity = { path = "../trust_atom_integrity" }

[dev-dependencies]
holochain = { version = "=0.2.8", default-features = false, features = [
holochain = { version = "=0.3.1", default-features = false, features = [
"test_utils",
] }
tokio = { version = "1.3", features = ["full"] }
Expand Down
6 changes: 4 additions & 2 deletions zomes/trust_atom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ pub fn delete_trust_atoms(target: AnyLinkableHash) -> ExternResult<DeleteReport>
let agent_pubkey = agent_info()?.agent_initial_pubkey;

// Forward Links
let forward_links = get_links(agent_pubkey.clone(), LinkTypes::TrustAtom, None)?;
let forward_links =
get_links(GetLinksInputBuilder::try_new(agent_pubkey.clone(), LinkTypes::TrustAtom)?.build())?;
for link in forward_links.clone() {
if link.target == target && link.tag.into_inner()[0..5] == build_forward_header() {
delete_link(link.create_link_hash)?;
}
}

// Reverse Links
let reverse_links = get_links(target, LinkTypes::TrustAtom, None)?;
let reverse_links =
get_links(GetLinksInputBuilder::try_new(target, LinkTypes::TrustAtom)?.build())?;
for link in reverse_links.clone() {
if link.target == AnyLinkableHash::from(agent_pubkey.clone())
&& link.tag.into_inner()[0..5] == build_reverse_header()
Expand Down
18 changes: 12 additions & 6 deletions zomes/trust_atom/src/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ pub struct StringLinkTag(pub String);
holochain_serial!(StringLinkTag);

pub fn list_links_for_base(base: AnyLinkableHash) -> ExternResult<Vec<Link>> {
let links = get_links(base, LinkTypes::TrustAtom, None)?;
let links = get_links(GetLinksInputBuilder::try_new(base, LinkTypes::TrustAtom)?.build())?;

Ok(links)
}

pub fn list_links(base: AnyLinkableHash, link_tag_text: Option<String>) -> ExternResult<Vec<Link>> {
let link_tag = match link_tag_text {
Some(link_tag_text) => Some(link_tag(link_tag_text)?),
None => None,
};
if let Some(link_tag_text) = link_tag_text {
let wrapped_link_tag: LinkTag = link_tag(link_tag_text)?;

let links = hdk::link::get_links(base, LinkTypes::TrustAtom, link_tag)?;
let links = get_links(
GetLinksInputBuilder::try_new(base, LinkTypes::TrustAtom)?
.tag_prefix(wrapped_link_tag)
.build(),
)?;

return Ok(links);
}
let links = get_links(GetLinksInputBuilder::try_new(base, LinkTypes::TrustAtom)?.build())?;

Ok(links)
}
Expand Down
Loading

0 comments on commit 70b40aa

Please sign in to comment.