remove old .env.example file, add get_block script for testing

This commit is contained in:
dr-frmr 2024-02-16 16:46:43 -03:00
parent a3b8a61028
commit 31d4a68503
No known key found for this signature in database
6 changed files with 70 additions and 21 deletions

View File

@ -1,20 +0,0 @@
### node filesystem config, adjust according to your needs.
### note, will run with default values if no .env is found.
### for example, if you use remote s3, you might want to set chunk_size to 5mb, and adjust flush_to_cold_interval
### Default values automatically set (s3 defaults to None)
# MEM_BUFFER_LIMIT=5242880 # 5mb
# READ_CACHE_LIMIT=5242880 # 5mb
# CHUNK_SIZE=262144 # 256kb
# FLUSH_TO_COLD_INTERVAL=60 # 60s
# ENCRYPTION=true # true
# CLOUD_ENABLED=false # false, controls whether new writes will be to s3 or local
### Example s3 config
# S3_ACCESS_KEY=minioadmin
# S3_SECRET__KEY=minioadmin
# S3_REGION=eu-north-1
# S3_BUCKET=mylittlebucket
# S3_ENDPOINT=http://localhost:9000

10
Cargo.lock generated
View File

@ -1963,6 +1963,16 @@ dependencies = [
"zeroize",
]
[[package]]
name = "get_block"
version = "0.1.0"
dependencies = [
"kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=3232423)",
"serde",
"serde_json",
"wit-bindgen",
]
[[package]]
name = "getrandom"
version = "0.2.12"

View File

@ -18,7 +18,7 @@ members = [
"kinode/packages/app_store/download", "kinode/packages/app_store/install", "kinode/packages/app_store/uninstall",
"kinode/packages/chess/chess",
"kinode/packages/homepage/homepage",
"kinode/packages/kns_indexer/kns_indexer",
"kinode/packages/kns_indexer/kns_indexer", "kinode/packages/kns_indexer/get_block",
"kinode/packages/terminal/terminal",
"kinode/packages/terminal/alias", "kinode/packages/terminal/cat", "kinode/packages/terminal/echo", "kinode/packages/terminal/hi", "kinode/packages/terminal/m", "kinode/packages/terminal/top",
"kinode/packages/tester/tester", "kinode/packages/tester/test_runner",

View File

@ -0,0 +1,17 @@
[package]
name = "get_block"
version = "0.1.0"
edition = "2021"
[dependencies]
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "3232423" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "kinode:process"

View File

@ -0,0 +1,29 @@
use kinode_process_lib::{
await_next_request_body, call_init, eth::get_block_number, println, Address, Request, SendError,
};
wit_bindgen::generate!({
path: "wit",
world: "process",
exports: {
world: Component,
},
});
call_init!(init);
fn init(our: Address) {
let Ok(_args) = await_next_request_body() else {
println!("get_block: failed to get args, aborting");
return;
};
match get_block_number() {
Ok(block_number) => {
println!("latest block number: {block_number}");
}
Err(e) => {
println!("get_block: failed to get block number: {}", e);
}
}
}

View File

@ -0,0 +1,13 @@
{
"get_block.wasm": {
"root": false,
"public": false,
"request_networking": false,
"request_capabilities": [
"eth:distro:sys"
],
"grant_capabilities": [
"eth:distro:sys"
]
}
}