getTokenCost

getTokenCost is a method on the ARIO class that calculates the price in mARIO to perform the interaction in question. e.g. a Buy-Record interaction, where args are the specific params for that interaction.

getTokenCost does not require authentication.

Parameters

ParameterTypeDescriptionOptional
intentstringThe action to check the token cost for.false
argsvariedThe parameters for the action being checkedfalse

Examples

getTokenCost

const { ARIO } = require('@ar.io/sdk');

async function main() {
  const ario = ARIO.init();
  const price = await ario
    .getTokenCost({
        intent: 'Buy-Record',
        name: 'ar-io',
        type: 'permabuy',
    })
    .then((p) => new mIOToken(p).toIO()); // convert to ARIO for readability
}

main();

Output

1642.34