irys.getPrice(numBytes)
Returns the cost to upload the specified number of bytes.
Parameters
-numBytes
: The number of bytes to check the price for
Returns
price
: Cost to uploadnumBytes
, unit is the token specified when instantiating theIrys
object Return value is in atomic units, to convert to standard units useirys.utils.fromAtomic()
Example
const irys = await getIrys();
const numBytes = 1048576; // Number of bytes to check
const priceAtomic = await irys.getPrice(numBytes);
// Convert from atomic units to standard units
const priceConverted = irys.utils.fromAtomic(priceAtomic);
console.log(`Uploading ${numBytes} bytes costs ${priceConverted}`);