Skip to main content

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

ParameterTypeDescription
domain&strLowercase top-level .sns name.
spaceu32Bytes allocated for the name account.
buyer&PubkeyBuyer, owner, fee payer, and required signer.
buyer_token_account&PubkeyPayment token account.
mintOption<&Pubkey>Payment mint; None selects USDC.
referrer_keyOption<&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)?;