setPrimaryName

setPrimaryName is a method on the ARIO class that allows the owner of an ANT that controls an ArNS name to set their primary name in a single API call.

setPrimaryName requires authentication.

Examples

setPrimaryName

const { id: txId } = await ario.setPrimaryName({
    name: 'arns'
});

Parameters

ParameterTypeDescriptionOptional
namestring

The ArNS name to set as the primary name for the caller's address.

false
fundFromstring

The source of funds: 'balance', 'stakes', 'any', or 'turbo'

true
referrerstring

Track purchase referrals for analytics (e.g. my-app.com)

true

Output

{
  "id": "abc123...def789"
}

Notes

  • This method requires that the caller owns an ANT that controls the specified ArNS name
  • The transaction will fail if the caller does not have permission to set this name as their primary name
  • This method provides a more efficient way to set a primary name compared to the previous two-step process of requesting and approving
  • Internally, this method first calls requestPrimaryName and then approvePrimaryNameRequest on the ANT
  • The fundFrom parameter determines how the operation will be funded (from balance, stakes, or turbo)
  • The referrer parameter is used for tracking and analytics purposes

Was this page helpful?