Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
nick1udwig committed Dec 17, 2024
1 parent 3614b4c commit c2e3bae
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions kinode/packages/kns-indexer/state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,18 @@ wit_bindgen::generate!({
additional_derives: [serde::Deserialize, serde::Serialize, process_macros::SerdeJsonInto],
});

///// From main kns-indexer process
//#[derive(Clone, Debug, Serialize, Deserialize)]
//struct State {
// chain_id: u64,
// // what contract this state pertains to
// contract_address: eth::Address,
// // namehash to human readable name
// names: HashMap<String, String>,
// // human readable name to most recent on-chain routing information as json
// // TODO: optional params knsUpdate? also include tba.
// nodes: HashMap<String, net::KnsUpdate>,
// // last block we have an update from
// last_block: u64,
//}

script!(init);
fn init(_our: Address, _args: String) -> String {
// we don't take any args

let Ok(Message::Response { body, .. }) =
Request::to(("our", "kns-indexer", "kns-indexer", "sys"))
.body(IndexerRequest::GetState(GetStateRequest { block: 0 }))
// serde_json::json!({
// "GetState": {
// "block": 0
// }
// })
// .to_string()
// .as_bytes()
// .to_vec(),
//)
.send_and_await_response(10)
.unwrap()
else {
return "failed to get state from kns-indexer".to_string();
};
//let Ok(state) = serde_json::from_slice::<State>(&body) else {
let Ok(IndexerResponse::GetState(state)) = body.try_into() else {
return "failed to deserialize state".to_string();
};
Expand Down

0 comments on commit c2e3bae

Please sign in to comment.