Skip to content

Commit

Permalink
Merge pull request #174 from aptos-labs/j/make-is-register-view
Browse files Browse the repository at this point in the history
add is registerable view function in router
  • Loading branch information
0xaptosj authored Sep 26, 2023
2 parents 1b46b60 + 5c15d0c commit 7b880b4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions router/sources/router.move
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ module router::router {
}
}

#[view]
public fun can_register(domain_name: String, subdomain_name: Option<String>): bool acquires RouterConfig {
let mode = get_mode();
if (mode == MODE_V1) {
domains::name_is_expired_past_grace(subdomain_name, domain_name)
} else if (mode == MODE_V1_AND_V2) {
can_register_in_v2(domain_name, subdomain_name)
} else {
abort error::not_implemented(ENOT_IMPLEMENTED_IN_MODE)
}
}

/// @notice Registers a domain name
/// @param user The user who is paying for the registration
/// @param domain_name The domain name to register
Expand Down

0 comments on commit 7b880b4

Please sign in to comment.