Skip to content

Commit

Permalink
Tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed Oct 29, 2024
1 parent a92470d commit 4f7580a
Show file tree
Hide file tree
Showing 16 changed files with 370 additions and 288 deletions.
5 changes: 0 additions & 5 deletions .huskyrc

This file was deleted.

1 change: 1 addition & 0 deletions crates/coordinator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use hdk::prelude::*;

use hc_zome_profiles_integrity::*;

mod linked_devices;
mod profiles;
mod search;

Expand Down
44 changes: 44 additions & 0 deletions crates/coordinator/src/linked_devices.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
use hc_zome_profiles_integrity::LinkTypes;
use hdk::prelude::*;

#[hdk_extern]
pub fn link_my_agent_to_profile(profile_hash: ActionHash) -> ExternResult<()> {
let my_pub_key = agent_info()?.agent_latest_pubkey;
create_link_relaxed(
my_pub_key.clone(),
profile_hash.clone(),
LinkTypes::AgentToProfile,
(),
)?;
create_link_relaxed(profile_hash, my_pub_key, LinkTypes::ProfileToAgent, ())?;

Ok(())
}

pub fn create_link_relaxed<T, E>(
base_address: impl Into<AnyLinkableHash>,
target_address: impl Into<AnyLinkableHash>,
link_type: T,
tag: impl Into<LinkTag>,
) -> ExternResult<()>
where
ScopedLinkType: TryFrom<T, Error = E>,
WasmError: From<E>,
{
let ScopedLinkType {
zome_index,
zome_type: link_type,
} = link_type.try_into()?;
HDK.with(|h| {
h.borrow().create_link(CreateLinkInput::new(
base_address.into(),
target_address.into(),
zome_index,
link_type,
tag.into(),
ChainTopOrdering::Relaxed,
))
})?;

Ok(())
}
2 changes: 1 addition & 1 deletion crates/integrity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod profile_to_agent;
use agent_to_profile::*;
use path_to_profile::*;
use prefix_path::*;
use profile::*;
pub use profile::*;
use profile_to_agent::*;

#[derive(Serialize, Deserialize)]
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
"private": true,
"scripts": {
"start": "AGENTS=2 pnpm network",
"network": "pnpm build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"pnpm run launch\" \"hc playground\"",
"network": "pnpm build:happ && UI_PORT=8888 concurrently \"pnpm -F @holochain-open-dev/profiles start\" \"pnpm launch\" \"hc playground\"",
"test": "pnpm build:happ && pnpm -F tests test",
"launch": "concurrently-repeat \"RUST_LOG=warn hc pilot workdir/profiles-test.happ --ui-port $UI_PORT\" $AGENTS",
"build:happ": "nix build -L .#profiles_test_happ -o workdir/profiles-test.happ"
},
"devDependencies": {
"@eslint/js": "^8.0.0",
"@eslint/js": "^9.0.0",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"concurrently": "^6.2.1",
"concurrently-repeat": "^0.0.1",
"eslint": "^8.0.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"new-port-cli": "^1.0.0",
"prettier": "^3.2.5",
"typescript": "^5.4.5",
"typescript-eslint": "^7.7.0"
"typescript-eslint": "^8.0.0"
},
"type": "module"
}
Loading

0 comments on commit 4f7580a

Please sign in to comment.