Rust SDK API Reference / Domain registration / register_domain
Function: register_domain()
pub fn register_domain(domain: &str, space: u32, buyer: &Pubkey, buyer_token_account: &Pubkey, mint: Option<&Pubkey>, referrer_key: Option<&Pubkey>) -> Result<Vec<Instruction>, SnsError>
Defined in: register_domain.rs:226
Builds registration instructions for a canonical top-level .sns domain. It defaults mint to USDC; a configured referrer adds an idempotent associated-token-account instruction before the registration instruction.
Parameters
| Parameter | Type | Description |
|---|---|---|
domain | &str | Lowercase top-level .sns name. |
space | u32 | Bytes allocated for the name account. |
buyer | &Pubkey | Buyer, owner, fee payer, and required signer. |
buyer_token_account | &Pubkey | Payment token account. |
mint | Option<&Pubkey> | Payment mint; None selects USDC. |
referrer_key | Option<&Pubkey> | Referral recipient, if configured. |
Returns
Vec<Instruction> in transaction order. Errors include domain parsing errors and SnsError::UnsupportedMint for an unsupported payment mint.
Example
use sns_sdk::bindings::register_domain::register_domain;
let instructions = register_domain("example.sns", 1_000, &buyer, &buyer_token_account, None, None)?;