From acd102db79533893c3bf0575c1d1f9c30cb254c4 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 12 Feb 2024 16:44:48 -0500 Subject: [PATCH 1/6] ERC721Metadata added to kernel_types --- src/kernel_types.rs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/kernel_types.rs b/src/kernel_types.rs index 1d73be8..b3a6212 100644 --- a/src/kernel_types.rs +++ b/src/kernel_types.rs @@ -1,7 +1,7 @@ use crate::kinode::process::standard as wit; use crate::{Address, ProcessId}; use serde::{Deserialize, Serialize}; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; // // process-facing kernel types, used for process @@ -201,14 +201,24 @@ impl StateError { pub type PackageVersion = (u32, u32, u32); /// the type that gets deserialized from `metadata.json` in a package -#[derive(Debug, Serialize, Deserialize)] -pub struct PackageMetadata { - pub package: String, +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Erc721Metadata { + pub name: Option, + pub description: Option, + pub image: Option, + pub external_url: Option, + pub animation_url: Option, + pub properties: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Erc721Properties { + pub package_name: String, pub publisher: String, - pub version: PackageVersion, + pub current_version: String, + pub mirrors: Vec, + pub code_hashes: HashMap, pub wit_version: Option<(u32, u32, u32)>, - pub description: Option, - pub website: Option, } /// the type that gets deserialized from each entry in the array in `manifest.json` From 7f0c999f2645191ba7f83d164ba0103f12d4cf57 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Tue, 13 Feb 2024 14:56:26 -0500 Subject: [PATCH 2/6] Properties not optional --- src/kernel_types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel_types.rs b/src/kernel_types.rs index b3a6212..75aea58 100644 --- a/src/kernel_types.rs +++ b/src/kernel_types.rs @@ -208,7 +208,7 @@ pub struct Erc721Metadata { pub image: Option, pub external_url: Option, pub animation_url: Option, - pub properties: Option, + pub properties: Erc721Properties, } #[derive(Clone, Debug, Serialize, Deserialize)] From f6478996182d734fb320d35fa43357917aa4ee5e Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Tue, 13 Feb 2024 15:39:25 -0500 Subject: [PATCH 3/6] properties udpated --- src/kernel_types.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/kernel_types.rs b/src/kernel_types.rs index 75aea58..be2928e 100644 --- a/src/kernel_types.rs +++ b/src/kernel_types.rs @@ -218,6 +218,8 @@ pub struct Erc721Properties { pub current_version: String, pub mirrors: Vec, pub code_hashes: HashMap, + pub license: Option, + pub screenshots: Option>, pub wit_version: Option<(u32, u32, u32)>, } From 60514386f9a19fb3609948440fa65fae82a74c3a Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Tue, 13 Feb 2024 16:28:31 -0500 Subject: [PATCH 4/6] 0.6.1 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 56253cd..eac4aab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1010,7 +1010,7 @@ dependencies = [ [[package]] name = "kinode_process_lib" -version = "0.6.0" +version = "0.6.1" dependencies = [ "alloy-rpc-types", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index d72bafb..9221901 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kinode_process_lib" description = "A library for writing Kinode processes in Rust." -version = "0.6.0" +version = "0.6.1" edition = "2021" license-file = "LICENSE" homepage = "https://kinode.org" From e45e91602f5b5033be44832c064b59f9b320685b Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Tue, 13 Feb 2024 16:38:59 -0500 Subject: [PATCH 5/6] 0.6.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eac4aab..56253cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1010,7 +1010,7 @@ dependencies = [ [[package]] name = "kinode_process_lib" -version = "0.6.1" +version = "0.6.0" dependencies = [ "alloy-rpc-types", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 9221901..d72bafb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kinode_process_lib" description = "A library for writing Kinode processes in Rust." -version = "0.6.1" +version = "0.6.0" edition = "2021" license-file = "LICENSE" homepage = "https://kinode.org" From 95afcf9dbe902302c6a0a672864009712bdf01c9 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 14 Feb 2024 11:11:54 -0500 Subject: [PATCH 6/6] docstring added --- src/kernel_types.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/kernel_types.rs b/src/kernel_types.rs index be2928e..e79aef6 100644 --- a/src/kernel_types.rs +++ b/src/kernel_types.rs @@ -198,9 +198,15 @@ impl StateError { // package types // -pub type PackageVersion = (u32, u32, u32); - -/// the type that gets deserialized from `metadata.json` in a package +/// Represents the metadata associated with a kinode package, which is an ERC721 compatible token. +/// This is deserialized from the `metadata.json` file in a package. +/// Fields: +/// - `name`: An optional field representing the display name of the package. This does not have to be unique, and is not used for identification purposes. +/// - `description`: An optional field providing a description of the package. +/// - `image`: An optional field containing a URL to an image representing the package. +/// - `external_url`: An optional field containing a URL for more information about the package. For example, a link to the github repository. +/// - `animation_url`: An optional field containing a URL to an animation or video representing the package. +/// - `properties`: A requried field containing important information about the package. #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Erc721Metadata { pub name: Option, @@ -211,6 +217,18 @@ pub struct Erc721Metadata { pub properties: Erc721Properties, } +/// Represents critical fields of a kinode package in an ERC721 compatible format. +/// This follows the [ERC1155](https://github.com/ethereum/ercs/blob/master/ERCS/erc-1155.md#erc-1155-metadata-uri-json-schema) metadata standard. +/// +/// Fields: +/// - `package_name`: The unique name of the package, used in the `PackageId`, e.g. `package_name:publisher`. +/// - `publisher`: The KNS identity of the package publisher used in the `PackageId`, e.g. `package_name:publisher` +/// - `current_version`: A string representing the current version of the package, e.g. `1.0.0`. +/// - `mirrors`: A list of NodeIds where the package can be found, providing redundancy. +/// - `code_hashes`: A map from version names to their respective SHA-256 hashes. +/// - `license`: An optional field containing the license of the package. +/// - `screenshots`: An optional field containing a list of URLs to screenshots of the package. +/// - `wit_version`: An optional field containing the version of the WIT standard that the package adheres to. #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Erc721Properties { pub package_name: String,