getPrice(numBytes)
Returns the cost to upload the specified number of bytes.
Parameters
Name
Type
Description
numBytes
number
The number of bytes to check the price for.
Returns
Type
Description
BigNumber
Cost to upload
numBytes
, unit is the token specified when instantiating the Irys
object. Return value is in atomic units, to convert to standard units use irys.utils.fromAtomic()
.Example
ℹ️
Use a token-specific version of getIrysUploader()
to connect to an Irys Bundler before uploading. Choose one from here.
const irys = await getIrysUploader();
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}`);