getTokenCost
getTokenCost
is a method on the ARIO
class that calculates the cost in mARIO tokens for a specific interaction (such as buying an ArNS record). The cost is calculated based on the interaction type and its parameters.
getTokenCost
does not require authentication.
Parameters
Parameter | Type | Description | Optional |
---|---|---|---|
intent | string | The type of interaction to calculate the cost for (e.g., 'Buy-Record') | false |
args | object | The specific parameters required for the interaction type | false |
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 IO tokens for readability
console.log('Cost in IO tokens:', price);
}
main();
Output
1642.34 // Cost in IO tokens (converted from mARIO for readability)