swarm-cli icon indicating copy to clipboard operation
swarm-cli copied to clipboard

When purchasing stamps, include effective volume as well

Open NoahMaizels opened this issue 1 year ago • 1 comments

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

NoahMaizels avatar Oct 26 '23 07:10 NoahMaizels

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.

Cafe137 avatar Nov 01 '23 10:11 Cafe137