getTokenCost

getTokenCost is a method on the ARIO class that calculates the cost in mARIO tokens for various ArNS operations such as buying records, extending leases, increasing undername limits, upgrading to permabuy, and requesting primary names.

getTokenCost does not require authentication.

Examples

getTokenCost

const cost = await ario.getTokenCost({
    intent: 'Buy-Record',
    name: 'example-name',
    type: 'lease',
    years: 1
});

Parameters

The getTokenCost method accepts different parameter sets depending on the intent (the specific action you want to check the cost for). Each intent requires a different combination of parameters as outlined below:

Buy Record / Buy Name

ParameterTypeDescriptionOptional
intentstring'Buy-Record' or 'Buy-Name'false
namestringThe ArNS name to calculate cost forfalse
typestring'lease' or 'permabuy'false
yearsnumber

Number of years for lease (required for all lease operations)

false

Extend Lease

ParameterTypeDescriptionOptional
intentstring'Extend-Lease'false
namestringThe ArNS name to extendfalse
yearsnumberNumber of years to extend the leasefalse

Increase Undername Limit

ParameterTypeDescriptionOptional
intentstring'Increase-Undername-Limit'false
namestringThe ArNS name to increase limit forfalse
quantitynumberNumber of additional undernames to allowfalse

Upgrade to Permabuy

ParameterTypeDescriptionOptional
intentstring'Upgrade-Name'false
namestringThe ArNS name to upgrade from lease to permabuyfalse

Primary Name Request

ParameterTypeDescriptionOptional
intentstring'Primary-Name-Request'false
namestringThe ArNS name to request as primary namefalse

Output

{
  "permabuyPrice": 164234000000,     // Cost in mARIO (6 decimal places)
  "leasePrice": 82117000000,         // Cost in mARIO (6 decimal places)
  "extensionPrice": 164234000000,    // Cost in mARIO (6 decimal places)
  "increasePrice": 500000000,        // Cost in mARIO (6 decimal places)
  "upgradePrice": 82117000000,       // Cost in mARIO (6 decimal places)
  "primaryNamePrice": 2500000000000  // Cost in mARIO (6 decimal places)
}

Was this page helpful?