Smart Contracts
Looking up a name
You can perform on-chain lookups for names for various examples in your packages. For example, to transfer some tokens to a given address:
use suins::{
suins,
registry::{Self, Registry},
name_record::NameRecord,
domain
}
// Find the name_record on-chain for a given domain.
// that way we can check if it's expired, whether it points to an address etc.
fun get_name_record(suins: &SuiNS, name: String) {
let name_record = registry::lookup(suins.registry(), name.new());
}
/// Gives access to the main registry
fun registry(suins: &SuiNS): &Registry {
suins.registry<Registry>()
}