ethersphere/swarm-cli

When purchasing stamps, include effective volume as well

Opened this issue · 1 comments

Include effective volume from the table here so users have a better idea of how much they can safely upload

This can be implemented in stamp/buy.ts:

const estimatedCost = Utils.getStampCostInBzz(this.depth, Number(this.amount))
const estimatedCapacity = new Storage(Utils.getStampMaximumCapacityBytes(this.depth))
const estimatedTtl = Utils.getStampTtlSeconds(Number(this.amount))

this.console.log(createKeyValue('Estimated cost', `${estimatedCost.toFixed(3)} BZZ`))
this.console.log(createKeyValue('Estimated capacity', estimatedCapacity.toString()))
this.console.log(createKeyValue('Estimated TTL', secondsToDhms(estimatedTtl)))

An additional utility function is required which calculates effective volume based on the table, we don't have that anywhere yet.