Hi all.
Not sure if I’m going mad but I’m trying to make a call into a DHT and now getting a weird return object:
Object(
{
"instance_stats": Object(
{
"test-instance": Object(
{
"number_delayed_validations": Number(
0,
),
"number_held_aspects": Number(
0,
),
"number_held_entries": Number(
0,
),
"number_pending_validations": Number(
0,
),
"number_running_zome_calls": Number(
1,
),
"offline": Bool(
false,
),
},
),
},
),
"type": String(
"InstanceStats",
),
},
)
What I expect and was seeing previously with this call is the following chain data:
"{\"jsonrpc\":\"2.0\",\"result\":\"{\\\"Ok\\\":[{\\\"signal\\\":\\\"Norm\\\",\\\"author_id\\\":\\\"HcSCJjCxUn8Jv4fv7x4BYcqY5TmWvvg3ytrb35FYKMtyc6qwBXsae4w84qhkyjz\\\"},{\\\"signal\\\":\\\"Norm\\\",\\\"author_id\\\":\\\"HcSCJjCxUn8Jv4fv7x4BYcqY5TmWvvg3ytrb35FYKMtyc6qwBXsae4w84qhkyjz\\\"},{\\\"signal\\\":\\\"Norm\\\",\\\"author_id....
I’m able to communicate with Holochain and it’s only when I add links into my code that this error happens.
I’m also getting this same return when I do the Micro Blogging Tutorial so wondering if this is something changed in the backend.
Here’s my function call to the dht which worked previously:
pub fn get(_agent: String) {
let json = serde_json::json!(
{"id": "device",
"jsonrpc": "2.0",
"method": "call",
"params": {"instance_id": "test-instance",
"zome": "txrx",
"function": "get_signal",
"args": {"agent_address": _agent,
}
}});
connect("ws://localhost:3402", |out| {
out.send(json.to_string()).unwrap();
move |msg| {
println!("Chain Data: {:#?}", msg);
out.close(CloseCode::Normal)
}
}).unwrap(); //change to expect
}
my call looks like this:
get("<address of agent that committed the entry>".to_string());
Is this some known error/or change to the HDK?
My zome config looks like this:
#[derive(Serialize, Deserialize, Debug, DefaultJson,Clone)]
pub struct Signal {
signal: String,
author_id: Address,
}
#[zome]
mod txrx {
#[init]
fn init() {
Ok(())
}
#[validate_agent]
pub fn validate_agent(validation_data: EntryValidationData<AgentId>) {
Ok(())
}
#[entry_def]
fn signal_entry_def() -> ValidatingEntryType {
entry!(
name: "signal",
description: "this is a single signal value into the dht",
sharing: Sharing::Public,
validation_package: || {
hdk::ValidationPackageDefinition::Entry
},
validation: | _validation_data: hdk::EntryValidationData<Signal>| {
Ok(())
},
links: [
from!(
"%agent_id",
link_type: "author",
validation_package: || {
hdk::ValidationPackageDefinition::Entry
},
validation: |_validation_data: hdk::LinkValidationData| {
Ok(())
}
)
]
)
}
#[zome_fn("hc_public")]
pub fn set_signal(signal: String) -> ZomeApiResult<Address> {
let signal = Signal {signal, author_id: hdk::AGENT_ADDRESS.clone(),};
let agent_address = hdk::AGENT_ADDRESS.clone().into();
let entry = Entry::App("signal".into(), signal.into());
let address = hdk::commit_entry(&entry)?;
hdk::link_entries(&agent_address, &address, "author", "")?;
Ok(address)
}
#[zome_fn("hc_public")]
fn get_signal(agent_address: Address) -> ZomeApiResult<Vec<Signal>> {
hdk::utils::get_links_and_load_type(
&agent_address,
LinkMatch::Exactly("author"),
LinkMatch::Any,
)
}
My conductor is pointing to Sim2h:
sim2h_url = 'wss://sim2h.holochain.org:9000'
and have also tried changing that value to:
sim2h_url = 'wss://sim2h.holochain.org:9000'