1
1
use crate :: eth:: { EthError , Provider } ;
2
- use crate :: kimap :: contract:: getCall;
2
+ use crate :: hypermap :: contract:: getCall;
3
3
use crate :: net;
4
4
use alloy:: rpc:: types:: request:: { TransactionInput , TransactionRequest } ;
5
5
use alloy:: { hex, primitives:: keccak256} ;
@@ -11,17 +11,17 @@ use std::error::Error;
11
11
use std:: fmt;
12
12
use std:: str:: FromStr ;
13
13
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" ;
16
16
/// 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 =
22
22
"0x0000000000000000000000000000000000000000000000000000000000000000" ;
23
23
24
- /// Sol structures for Kimap requests
24
+ /// Sol structures for Hypermap requests
25
25
pub mod contract {
26
26
use alloy_sol_macro:: sol;
27
27
@@ -229,33 +229,33 @@ pub mod contract {
229
229
}
230
230
}
231
231
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.
234
234
#[ derive( Clone , Debug , Deserialize , Serialize ) ]
235
235
pub struct Mint {
236
236
pub name : String ,
237
237
pub parent_path : String ,
238
238
}
239
239
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
242
242
#[ derive( Clone , Debug , Deserialize , Serialize ) ]
243
243
pub struct Note {
244
244
pub note : String ,
245
245
pub parent_path : String ,
246
246
pub data : Bytes ,
247
247
}
248
248
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
251
251
#[ derive( Clone , Debug , Deserialize , Serialize ) ]
252
252
pub struct Fact {
253
253
pub fact : String ,
254
254
pub parent_path : String ,
255
255
pub data : Bytes ,
256
256
}
257
257
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
259
259
/// [`decode_mint_log()`] or [`decode_note_log()`].
260
260
#[ derive( Clone , Debug , Deserialize , Serialize ) ]
261
261
pub enum DecodeLogError {
@@ -265,7 +265,7 @@ pub enum DecodeLogError {
265
265
InvalidName ( String ) ,
266
266
/// An error occurred while decoding the log.
267
267
DecodeError ( String ) ,
268
- /// The parent name could not be resolved with `kns -indexer`.
268
+ /// The parent name could not be resolved with `hns -indexer`.
269
269
UnresolvedParent ( String ) ,
270
270
}
271
271
@@ -284,10 +284,10 @@ impl fmt::Display for DecodeLogError {
284
284
285
285
impl Error for DecodeLogError { }
286
286
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
289
289
/// 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.
291
291
///
292
292
/// This checks a **single name**, not the full path-name. A full path-name
293
293
/// is comprised of valid names separated by `.`
@@ -332,7 +332,7 @@ pub fn valid_fact(fact: &str) -> bool {
332
332
. all ( |c| c. is_ascii_lowercase ( ) || c. is_ascii_digit ( ) || c == '-' )
333
333
}
334
334
335
- /// Produce a namehash from a kimap name.
335
+ /// Produce a namehash from a hypermap name.
336
336
pub fn namehash ( name : & str ) -> String {
337
337
let mut node = B256 :: default ( ) ;
338
338
@@ -346,7 +346,7 @@ pub fn namehash(name: &str) -> String {
346
346
format ! ( "0x{}" , hex:: encode( node) )
347
347
}
348
348
349
- /// Decode a mint log from the kimap into a 'resolved' format.
349
+ /// Decode a mint log from the hypermap into a 'resolved' format.
350
350
///
351
351
/// Uses [`valid_name()`] to check if the name is valid.
352
352
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> {
365
365
}
366
366
}
367
367
368
- /// Decode a note log from the kimap into a 'resolved' format.
368
+ /// Decode a note log from the hypermap into a 'resolved' format.
369
369
///
370
370
/// Uses [`valid_name()`] to check if the name is valid.
371
371
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> {
408
408
}
409
409
}
410
410
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
412
412
/// of the new entry or note.
413
413
pub fn resolve_parent ( log : & crate :: eth:: Log , timeout : Option < u64 > ) -> Option < String > {
414
414
let parent_hash = log. topics ( ) [ 1 ] . to_string ( ) ;
415
415
net:: get_name ( & parent_hash, log. block_number , timeout)
416
416
}
417
417
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
419
419
/// of the new entry or note.
420
420
///
421
421
/// 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<
448
448
Some ( format ! ( "{name}.{parent_name}" ) )
449
449
}
450
450
451
- /// Helper struct for reading from the kimap .
451
+ /// Helper struct for reading from the hypermap .
452
452
#[ derive( Clone , Debug , Deserialize , Serialize ) ]
453
- pub struct Kimap {
453
+ pub struct Hypermap {
454
454
pub provider : Provider ,
455
455
address : Address ,
456
456
}
457
457
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.
460
460
///
461
461
/// # Arguments
462
462
/// * `provider` - A reference to the Provider.
463
- /// * `address` - The address of the Kimap contract.
463
+ /// * `address` - The address of the Hypermap contract.
464
464
pub fn new ( provider : Provider , address : Address ) -> Self {
465
465
Self { provider, address }
466
466
}
467
467
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.
469
469
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 ( ) )
472
472
}
473
473
474
- /// Returns the in-use Kimap contract address.
474
+ /// Returns the in-use Hypermap contract address.
475
475
pub fn address ( & self ) -> & Address {
476
476
& self . address
477
477
}
478
478
479
- /// Gets an entry from the Kimap by its string-formatted name.
479
+ /// Gets an entry from the Hypermap by its string-formatted name.
480
480
///
481
481
/// # Parameters
482
- /// - `path`: The name-path to get from the Kimap .
482
+ /// - `path`: The name-path to get from the Hypermap .
483
483
/// # Returns
484
484
/// A `Result<(Address, Address, Option<Bytes>), EthError>` representing the TBA, owner,
485
485
/// and value if the entry exists and is a note.
@@ -508,10 +508,10 @@ impl Kimap {
508
508
Ok ( ( res. tba , res. owner , note_data) )
509
509
}
510
510
511
- /// Gets an entry from the Kimap by its hash.
511
+ /// Gets an entry from the Hypermap by its hash.
512
512
///
513
513
/// # Parameters
514
- /// - `entryhash`: The entry to get from the Kimap .
514
+ /// - `entryhash`: The entry to get from the Hypermap .
515
515
/// # Returns
516
516
/// A `Result<(Address, Address, Option<Bytes>), EthError>` representing the TBA, owner,
517
517
/// and value if the entry exists and is a note.
@@ -587,7 +587,7 @@ impl Kimap {
587
587
///
588
588
/// Example:
589
589
/// ```rust
590
- /// let filter = kimap .notes_filter(&["~note1", "~note2"]);
590
+ /// let filter = hypermap .notes_filter(&["~note1", "~note2"]);
591
591
/// ```
592
592
pub fn notes_filter ( & self , notes : & [ & str ] ) -> crate :: eth:: Filter {
593
593
self . note_filter ( ) . topic3 (
@@ -603,7 +603,7 @@ impl Kimap {
603
603
///
604
604
/// Example:
605
605
/// ```rust
606
- /// let filter = kimap .facts_filter(&["!fact1", "!fact2"]);
606
+ /// let filter = hypermap .facts_filter(&["!fact1", "!fact2"]);
607
607
/// ```
608
608
pub fn facts_filter ( & self , facts : & [ & str ] ) -> crate :: eth:: Filter {
609
609
self . fact_filter ( ) . topic3 (
0 commit comments