Skip to content

Commit d2c1a28

Browse files
committed
rename kns -> hns & kimap -> hypermap
1 parent 6a050ac commit d2c1a28

File tree

9 files changed

+73
-73
lines changed

9 files changed

+73
-73
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "hyperware_process_lib"
33
authors = ["Sybil Technologies AG"]
4-
version = "1.0.2"
4+
version = "1.0.3"
55
edition = "2021"
66
description = "A library for writing Hyperware processes in Rust."
77
homepage = "https://hyperware.ai"

hyperware-wit/hyperware.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface standard {
99
/// JSON is passed over Wasm boundary as a string.
1010
type json = string;
1111

12-
/// In types passed from kernel, node-id will be a valid Kimap entry.
12+
/// In types passed from kernel, node-id will be a valid Hypermap entry.
1313
type node-id = string;
1414

1515
/// Context, like a message body, is a protocol-defined serialized byte

src/eth.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub enum EthConfigAction {
188188
pub enum EthConfigResponse {
189189
Ok,
190190
/// Response from a GetProviders request.
191-
/// Note the [`crate::net::KnsUpdate`] will only have the correct `name` field.
191+
/// Note the [`crate::net::HnsUpdate`] will only have the correct `name` field.
192192
/// The rest of the Update is not saved in this module.
193193
Providers(SavedConfigs),
194194
/// Response from a GetAccessSettings request.
@@ -240,7 +240,7 @@ impl From<Authorization> for AlloyAuthorization {
240240
#[derive(Clone, Debug, Serialize, Hash, Eq, PartialEq)]
241241
pub enum NodeOrRpcUrl {
242242
Node {
243-
kns_update: crate::net::KnsUpdate,
243+
hns_update: crate::net::HnsUpdate,
244244
use_as_provider: bool, // false for just-routers inside saved config
245245
},
246246
RpcUrl {
@@ -252,7 +252,7 @@ pub enum NodeOrRpcUrl {
252252
impl std::cmp::PartialEq<str> for NodeOrRpcUrl {
253253
fn eq(&self, other: &str) -> bool {
254254
match self {
255-
NodeOrRpcUrl::Node { kns_update, .. } => kns_update.name == other,
255+
NodeOrRpcUrl::Node { hns_update, .. } => hns_update.name == other,
256256
NodeOrRpcUrl::RpcUrl { url, .. } => url == other,
257257
}
258258
}
@@ -276,7 +276,7 @@ impl<'de> Deserialize<'de> for NodeOrRpcUrl {
276276
#[derive(Deserialize)]
277277
enum Helper {
278278
Node {
279-
kns_update: crate::net::KnsUpdate,
279+
hns_update: crate::net::HnsUpdate,
280280
use_as_provider: bool,
281281
},
282282
RpcUrl(RpcUrlHelper),
@@ -286,10 +286,10 @@ impl<'de> Deserialize<'de> for NodeOrRpcUrl {
286286

287287
Ok(match helper {
288288
Helper::Node {
289-
kns_update,
289+
hns_update,
290290
use_as_provider,
291291
} => NodeOrRpcUrl::Node {
292-
kns_update,
292+
hns_update,
293293
use_as_provider,
294294
},
295295
Helper::RpcUrl(url_helper) => match url_helper {
@@ -675,14 +675,14 @@ impl Provider {
675675
self.send_request_and_parse_response::<Bytes>(action)
676676
}
677677

678-
/// Returns a Kimap instance with the default address using this provider.
679-
pub fn kimap(&self) -> crate::kimap::Kimap {
680-
crate::kimap::Kimap::default(self.request_timeout)
678+
/// Returns a Hypermap instance with the default address using this provider.
679+
pub fn hypermap(&self) -> crate::hypermap::Hypermap {
680+
crate::hypermap::Hypermap::default(self.request_timeout)
681681
}
682682

683-
/// Returns a Kimap instance with a custom address using this provider.
684-
pub fn kimap_with_address(self, address: Address) -> crate::kimap::Kimap {
685-
crate::kimap::Kimap::new(self, address)
683+
/// Returns a Hypermap instance with a custom address using this provider.
684+
pub fn hypermap_with_address(self, address: Address) -> crate::hypermap::Hypermap {
685+
crate::hypermap::Hypermap::new(self, address)
686686
}
687687

688688
/// Sends a raw transaction to the network.

src/http/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ impl HttpServer {
597597
/// Instead of binding at just a path, this function tells the HTTP server to
598598
/// generate a *subdomain* with our package ID (with non-ascii-alphanumeric
599599
/// characters converted to `-`, although will not be needed if package ID is
600-
/// a genuine kimap entry) and bind at that subdomain.
600+
/// a genuine hypermap entry) and bind at that subdomain.
601601
pub fn secure_bind_http_path<T>(&mut self, path: T) -> Result<(), HttpServerError>
602602
where
603603
T: Into<String>,
@@ -639,7 +639,7 @@ impl HttpServer {
639639
/// Instead of binding at just a path, this function tells the HTTP server to
640640
/// generate a *subdomain* with our package ID (with non-ascii-alphanumeric
641641
/// characters converted to `-`, although will not be needed if package ID is
642-
/// a genuine kimap entry) and bind at that subdomain.
642+
/// a genuine hypermap entry) and bind at that subdomain.
643643
pub fn secure_bind_ws_path<T>(&mut self, path: T) -> Result<(), HttpServerError>
644644
where
645645
T: Into<String>,

src/kimap.rs renamed to src/hypermap.rs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::eth::{EthError, Provider};
2-
use crate::kimap::contract::getCall;
2+
use crate::hypermap::contract::getCall;
33
use crate::net;
44
use alloy::rpc::types::request::{TransactionInput, TransactionRequest};
55
use alloy::{hex, primitives::keccak256};
@@ -11,17 +11,17 @@ use std::error::Error;
1111
use std::fmt;
1212
use std::str::FromStr;
1313

14-
/// kimap deployment address on base
15-
pub const KIMAP_ADDRESS: &'static str = "0x000000000033e5CCbC52Ec7BDa87dB768f9aA93F";
14+
/// hypermap deployment address on base
15+
pub const HYPERMAP_ADDRESS: &'static str = "0x000000000033e5CCbC52Ec7BDa87dB768f9aA93F";
1616
/// base chain id
17-
pub const KIMAP_CHAIN_ID: u64 = 8453;
18-
/// first block (minus one) of kimap deployment on base
19-
pub const KIMAP_FIRST_BLOCK: u64 = 25_346_377;
20-
/// the root hash of kimap, empty bytes32
21-
pub const KIMAP_ROOT_HASH: &'static str =
17+
pub const HYPERMAP_CHAIN_ID: u64 = 8453;
18+
/// first block (minus one) of hypermap deployment on base
19+
pub const HYPERMAP_FIRST_BLOCK: u64 = 25_346_377;
20+
/// the root hash of hypermap, empty bytes32
21+
pub const HYPERMAP_ROOT_HASH: &'static str =
2222
"0x0000000000000000000000000000000000000000000000000000000000000000";
2323

24-
/// Sol structures for Kimap requests
24+
/// Sol structures for Hypermap requests
2525
pub mod contract {
2626
use alloy_sol_macro::sol;
2727

@@ -229,33 +229,33 @@ pub mod contract {
229229
}
230230
}
231231

232-
/// A mint log from the kimap, converted to a 'resolved' format using
233-
/// namespace data saved in the kns-indexer.
232+
/// A mint log from the hypermap, converted to a 'resolved' format using
233+
/// namespace data saved in the hns-indexer.
234234
#[derive(Clone, Debug, Deserialize, Serialize)]
235235
pub struct Mint {
236236
pub name: String,
237237
pub parent_path: String,
238238
}
239239

240-
/// A note log from the kimap, converted to a 'resolved' format using
241-
/// namespace data saved in the kns-indexer
240+
/// A note log from the hypermap, converted to a 'resolved' format using
241+
/// namespace data saved in the hns-indexer
242242
#[derive(Clone, Debug, Deserialize, Serialize)]
243243
pub struct Note {
244244
pub note: String,
245245
pub parent_path: String,
246246
pub data: Bytes,
247247
}
248248

249-
/// A fact log from the kimap, converted to a 'resolved' format using
250-
/// namespace data saved in the kns-indexer
249+
/// A fact log from the hypermap, converted to a 'resolved' format using
250+
/// namespace data saved in the hns-indexer
251251
#[derive(Clone, Debug, Deserialize, Serialize)]
252252
pub struct Fact {
253253
pub fact: String,
254254
pub parent_path: String,
255255
pub data: Bytes,
256256
}
257257

258-
/// Errors that can occur when decoding a log from the kimap using
258+
/// Errors that can occur when decoding a log from the hypermap using
259259
/// [`decode_mint_log()`] or [`decode_note_log()`].
260260
#[derive(Clone, Debug, Deserialize, Serialize)]
261261
pub enum DecodeLogError {
@@ -265,7 +265,7 @@ pub enum DecodeLogError {
265265
InvalidName(String),
266266
/// An error occurred while decoding the log.
267267
DecodeError(String),
268-
/// The parent name could not be resolved with `kns-indexer`.
268+
/// The parent name could not be resolved with `hns-indexer`.
269269
UnresolvedParent(String),
270270
}
271271

@@ -284,10 +284,10 @@ impl fmt::Display for DecodeLogError {
284284

285285
impl Error for DecodeLogError {}
286286

287-
/// Canonical function to determine if a kimap entry is valid. This should
288-
/// be used whenever reading a new kimap entry from a mints query, because
287+
/// Canonical function to determine if a hypermap entry is valid. This should
288+
/// be used whenever reading a new hypermap entry from a mints query, because
289289
/// while most frontends will enforce these rules, it is possible to post
290-
/// invalid names to the kimap contract.
290+
/// invalid names to the hypermap contract.
291291
///
292292
/// This checks a **single name**, not the full path-name. A full path-name
293293
/// is comprised of valid names separated by `.`
@@ -332,7 +332,7 @@ pub fn valid_fact(fact: &str) -> bool {
332332
.all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '-')
333333
}
334334

335-
/// Produce a namehash from a kimap name.
335+
/// Produce a namehash from a hypermap name.
336336
pub fn namehash(name: &str) -> String {
337337
let mut node = B256::default();
338338

@@ -346,7 +346,7 @@ pub fn namehash(name: &str) -> String {
346346
format!("0x{}", hex::encode(node))
347347
}
348348

349-
/// Decode a mint log from the kimap into a 'resolved' format.
349+
/// Decode a mint log from the hypermap into a 'resolved' format.
350350
///
351351
/// Uses [`valid_name()`] to check if the name is valid.
352352
pub fn decode_mint_log(log: &crate::eth::Log) -> Result<Mint, DecodeLogError> {
@@ -365,7 +365,7 @@ pub fn decode_mint_log(log: &crate::eth::Log) -> Result<Mint, DecodeLogError> {
365365
}
366366
}
367367

368-
/// Decode a note log from the kimap into a 'resolved' format.
368+
/// Decode a note log from the hypermap into a 'resolved' format.
369369
///
370370
/// Uses [`valid_name()`] to check if the name is valid.
371371
pub fn decode_note_log(log: &crate::eth::Log) -> Result<Note, DecodeLogError> {
@@ -408,14 +408,14 @@ pub fn decode_fact_log(log: &crate::eth::Log) -> Result<Fact, DecodeLogError> {
408408
}
409409
}
410410

411-
/// Given a [`crate::eth::Log`] (which must be a log from kimap), resolve the parent name
411+
/// Given a [`crate::eth::Log`] (which must be a log from hypermap), resolve the parent name
412412
/// of the new entry or note.
413413
pub fn resolve_parent(log: &crate::eth::Log, timeout: Option<u64>) -> Option<String> {
414414
let parent_hash = log.topics()[1].to_string();
415415
net::get_name(&parent_hash, log.block_number, timeout)
416416
}
417417

418-
/// Given a [`crate::eth::Log`] (which must be a log from kimap), resolve the full name
418+
/// Given a [`crate::eth::Log`] (which must be a log from hypermap), resolve the full name
419419
/// of the new entry or note.
420420
///
421421
/// Uses [`valid_name()`] to check if the name is valid.
@@ -448,38 +448,38 @@ pub fn resolve_full_name(log: &crate::eth::Log, timeout: Option<u64>) -> Option<
448448
Some(format!("{name}.{parent_name}"))
449449
}
450450

451-
/// Helper struct for reading from the kimap.
451+
/// Helper struct for reading from the hypermap.
452452
#[derive(Clone, Debug, Deserialize, Serialize)]
453-
pub struct Kimap {
453+
pub struct Hypermap {
454454
pub provider: Provider,
455455
address: Address,
456456
}
457457

458-
impl Kimap {
459-
/// Creates a new Kimap instance with a specified address.
458+
impl Hypermap {
459+
/// Creates a new Hypermap instance with a specified address.
460460
///
461461
/// # Arguments
462462
/// * `provider` - A reference to the Provider.
463-
/// * `address` - The address of the Kimap contract.
463+
/// * `address` - The address of the Hypermap contract.
464464
pub fn new(provider: Provider, address: Address) -> Self {
465465
Self { provider, address }
466466
}
467467

468-
/// Creates a new Kimap instance with the default address and chain ID.
468+
/// Creates a new Hypermap instance with the default address and chain ID.
469469
pub fn default(timeout: u64) -> Self {
470-
let provider = Provider::new(KIMAP_CHAIN_ID, timeout);
471-
Self::new(provider, Address::from_str(KIMAP_ADDRESS).unwrap())
470+
let provider = Provider::new(HYPERMAP_CHAIN_ID, timeout);
471+
Self::new(provider, Address::from_str(HYPERMAP_ADDRESS).unwrap())
472472
}
473473

474-
/// Returns the in-use Kimap contract address.
474+
/// Returns the in-use Hypermap contract address.
475475
pub fn address(&self) -> &Address {
476476
&self.address
477477
}
478478

479-
/// Gets an entry from the Kimap by its string-formatted name.
479+
/// Gets an entry from the Hypermap by its string-formatted name.
480480
///
481481
/// # Parameters
482-
/// - `path`: The name-path to get from the Kimap.
482+
/// - `path`: The name-path to get from the Hypermap.
483483
/// # Returns
484484
/// A `Result<(Address, Address, Option<Bytes>), EthError>` representing the TBA, owner,
485485
/// and value if the entry exists and is a note.
@@ -508,10 +508,10 @@ impl Kimap {
508508
Ok((res.tba, res.owner, note_data))
509509
}
510510

511-
/// Gets an entry from the Kimap by its hash.
511+
/// Gets an entry from the Hypermap by its hash.
512512
///
513513
/// # Parameters
514-
/// - `entryhash`: The entry to get from the Kimap.
514+
/// - `entryhash`: The entry to get from the Hypermap.
515515
/// # Returns
516516
/// A `Result<(Address, Address, Option<Bytes>), EthError>` representing the TBA, owner,
517517
/// and value if the entry exists and is a note.
@@ -587,7 +587,7 @@ impl Kimap {
587587
///
588588
/// Example:
589589
/// ```rust
590-
/// let filter = kimap.notes_filter(&["~note1", "~note2"]);
590+
/// let filter = hypermap.notes_filter(&["~note1", "~note2"]);
591591
/// ```
592592
pub fn notes_filter(&self, notes: &[&str]) -> crate::eth::Filter {
593593
self.note_filter().topic3(
@@ -603,7 +603,7 @@ impl Kimap {
603603
///
604604
/// Example:
605605
/// ```rust
606-
/// let filter = kimap.facts_filter(&["!fact1", "!fact2"]);
606+
/// let filter = hypermap.facts_filter(&["!fact1", "!fact2"]);
607607
/// ```
608608
pub fn facts_filter(&self, facts: &[&str]) -> crate::eth::Filter {
609609
self.fact_filter().topic3(

src/kernel_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ pub struct Erc721Metadata {
289289
///
290290
/// Fields:
291291
/// - `package_name`: The unique name of the package, used in the [`crate::PackageId`], e.g. `package_name:publisher`.
292-
/// - `publisher`: The KNS identity of the package publisher used in the [`crate::PackageId`], e.g. `package_name:publisher`
292+
/// - `publisher`: The HNS identity of the package publisher used in the [`crate::PackageId`], e.g. `package_name:publisher`
293293
/// - `current_version`: A string representing the current version of the package, e.g. `1.0.0`.
294294
/// - `mirrors`: A list of NodeIds where the package can be found, providing redundancy.
295295
/// - `code_hashes`: A map from version names to their respective SHA-256 hashes.

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ pub mod http;
3939
/// be incompatible with WIT types in some cases, leading to annoying errors.
4040
/// Use only to interact with the kernel or runtime in certain ways.
4141
pub mod kernel_types;
42-
/// Interact with kimap, the onchain namespace
43-
pub mod kimap;
42+
/// Interact with hypermap, the onchain namespace
43+
pub mod hypermap;
4444
/// Interact with the key_value module
4545
///
4646
/// Your process must have the [`Capability`] to message and receive messages from

0 commit comments

Comments
 (0)