ethersphere / swarm-cli

Manage your Bee node and interact with the Swarm network via the CLI
BSD 3-Clause "New" or "Revised" License
48 stars 21 forks source link

When purchasing stamps, include effective volume as well #479

Open NoahMaizels opened 10 months ago

NoahMaizels commented 10 months ago

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

Cafe137 commented 9 months ago

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.