mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-11-30 11:53:33 +03:00
app_store: combined note logic getting
This commit is contained in:
parent
d635732180
commit
a2333a7c3b
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -970,7 +970,7 @@ dependencies = [
|
|||||||
"alloy-sol-types",
|
"alloy-sol-types",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bincode",
|
"bincode",
|
||||||
"kinode_process_lib 0.8.3 (git+https://github.com/kinode-dao/process_lib?rev=40a7a60)",
|
"kinode_process_lib 0.8.3 (git+https://github.com/kinode-dao/process_lib?rev=c45e40a)",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@ -3558,7 +3558,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "kinode_process_lib"
|
name = "kinode_process_lib"
|
||||||
version = "0.8.3"
|
version = "0.8.3"
|
||||||
source = "git+https://github.com/kinode-dao/process_lib?rev=40a7a60#40a7a60528df14585aab717c6c0f78aff5f74dd2"
|
source = "git+https://github.com/kinode-dao/process_lib?rev=c45e40a#c45e40ac22e37462d135362d6854ac7a3d191776"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloy 0.1.1",
|
"alloy 0.1.1",
|
||||||
"alloy-primitives",
|
"alloy-primitives",
|
||||||
|
@ -11,7 +11,7 @@ alloy-primitives = "0.7.6"
|
|||||||
alloy-sol-types = "0.7.6"
|
alloy-sol-types = "0.7.6"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
bincode = "1.3.3"
|
bincode = "1.3.3"
|
||||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "40a7a60" }
|
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "c45e40a" }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -4,7 +4,7 @@ use alloy_sol_types::{sol, SolEvent};
|
|||||||
use kinode_process_lib::kernel_types::Erc721Metadata;
|
use kinode_process_lib::kernel_types::Erc721Metadata;
|
||||||
use kinode_process_lib::{
|
use kinode_process_lib::{
|
||||||
eth, kernel_types as kt,
|
eth, kernel_types as kt,
|
||||||
net::{self, get_name},
|
net::{self, get_name, namehash},
|
||||||
println, vfs, Address, Message, NodeId, PackageId, Request,
|
println, vfs, Address, Message, NodeId, PackageId, Request,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -392,29 +392,50 @@ impl State {
|
|||||||
let note_str = String::from_utf8_lossy(¬e.note).to_string();
|
let note_str = String::from_utf8_lossy(¬e.note).to_string();
|
||||||
|
|
||||||
println!("got note {note_str} for {name}");
|
println!("got note {note_str} for {name}");
|
||||||
|
// let notehash = note.notehash.to_string();
|
||||||
|
|
||||||
|
// let full_name = format!("{note_str}.{name}");
|
||||||
|
|
||||||
match note_str.as_str() {
|
match note_str.as_str() {
|
||||||
"metadata-uri" => {
|
"~metadata-uri" => {
|
||||||
let _metadata_url = String::from_utf8_lossy(¬e.data).to_string();
|
let metadata_url = String::from_utf8_lossy(¬e.data).to_string();
|
||||||
// generate ~metadata-hash notehash
|
// generate ~metadata-hash notehash
|
||||||
// let package_hash_note = get_notehash("~metadata-hash", nodehash);
|
let meta_note_name = format!("~metadata-hash.{name}");
|
||||||
// let package_hash = kimap::get(&package_hash_note);
|
let package_hash_note = namehash(&meta_note_name);
|
||||||
|
let (_tba, _owner, data) =
|
||||||
|
self.provider.get(&package_hash_note).map_err(|e| {
|
||||||
|
println!("Error getting metadata hash: {:?}", e);
|
||||||
|
AppStoreLogError::DecodeLogError
|
||||||
|
})?;
|
||||||
|
|
||||||
// let metadata =
|
if let Some(hash_note) = data {
|
||||||
// utils::fetch_metadata_from_url(&metadata_url, &metadata_hash, 5)?;
|
let metadata_hash = String::from_utf8_lossy(&hash_note).to_string();
|
||||||
|
println!("got metadata_url, and from that the hash {metadata_url} {metadata_hash}");
|
||||||
|
// let metadata =
|
||||||
|
// utils::fetch_metadata_from_url(&metadata_url, &metadata_hash, 5)?;
|
||||||
|
|
||||||
// if this fails and doesn't check out, do nothing
|
// if this fails and doesn't check out, do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"metadata-hash" => {
|
"~metadata-hash" => {
|
||||||
let _metadata_hash = String::from_utf8_lossy(¬e.data).to_string();
|
let metadata_hash = String::from_utf8_lossy(¬e.data).to_string();
|
||||||
// generate ~metadata-uri notehash
|
// generate ~metadata-uri notehash
|
||||||
// let package_uri_note = get_notehash("~metadata-uri", nodehash);
|
let meta_note_name = format!("~metadata-uri.{name}");
|
||||||
// let package_uri = kimap::get(&package_uri_note);
|
let package_uri_note = namehash(&meta_note_name);
|
||||||
|
let (_tba, _owner, data) =
|
||||||
|
self.provider.get(&package_uri_note).map_err(|e| {
|
||||||
|
println!("Error getting metadata uri: {:?}", e);
|
||||||
|
AppStoreLogError::DecodeLogError
|
||||||
|
})?;
|
||||||
|
|
||||||
// let metadata =
|
if let Some(uri_note) = data {
|
||||||
// utils::fetch_metadata_from_url(&metadata_url, &metadata_hash, 5)?;
|
let metadata_url = String::from_utf8_lossy(&uri_note).to_string();
|
||||||
|
println!("got metadata_hash, and from that the url {metadata_hash} {metadata_url}");
|
||||||
|
// let metadata =
|
||||||
|
// utils::fetch_metadata_from_url(&metadata_url, &metadata_hash, 5)?;
|
||||||
|
|
||||||
// if this fails and doesn't check out, do nothing
|
// if this fails and doesn't check out, do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user