11use crate :: eth:: { EthError , Provider } ;
2- use crate :: kimap :: contract:: getCall;
2+ use crate :: hypermap :: contract:: getCall;
33use crate :: net;
44use alloy:: rpc:: types:: request:: { TransactionInput , TransactionRequest } ;
55use alloy:: { hex, primitives:: keccak256} ;
@@ -11,17 +11,17 @@ use std::error::Error;
1111use std:: fmt;
1212use 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
2525pub 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 ) ]
235235pub 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 ) ]
243243pub 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 ) ]
252252pub 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 ) ]
261261pub 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
285285impl 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.
336336pub 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.
352352pub 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.
371371pub 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.
413413pub 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 (
0 commit comments