diff --git a/src/command/stamp/buy.ts b/src/command/stamp/buy.ts index 7e998236..5431ba9d 100644 --- a/src/command/stamp/buy.ts +++ b/src/command/stamp/buy.ts @@ -61,10 +61,19 @@ export class Buy extends StampCommand implements LeafCommand { const estimatedCost = Utils.getStampCostInBzz(this.depth, Number(this.amount)) const estimatedCapacity = new Storage(Utils.getStampMaximumCapacityBytes(this.depth)) + const estimatedEffectiveVolume = new Storage(Utils.getStampEffectiveBytes(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 effective volume', + estimatedEffectiveVolume.getBytes() === 0 + ? "It's likely to be smaller than estimated capacity" + : estimatedEffectiveVolume.toString(), + ), + ) this.console.log(createKeyValue('Estimated TTL', secondsToDhms(estimatedTtl))) this.console.log(createKeyValue('Type', this.immutable ? 'Immutable' : 'Mutable')) diff --git a/test/prompt/stamp-prompt.spec.ts b/test/prompt/stamp-prompt.spec.ts index bdc61bee..82231815 100644 --- a/test/prompt/stamp-prompt.spec.ts +++ b/test/prompt/stamp-prompt.spec.ts @@ -8,7 +8,8 @@ describeCommand('Postage stamp price estimation prompt', ({ consoleMessages }) = await invokeTestCli(['stamp', 'buy', '--depth', '24', '--amount', '596046400']) expect(consoleMessages[0]).toBe('Estimated cost: 1.000 BZZ') expect(consoleMessages[1]).toBe('Estimated capacity: 64.00 GB') - expect(consoleMessages[2]).toBe('Estimated TTL: 1 day 10 hours 29 minutes 36 seconds') + expect(consoleMessages[2]).toBe('Estimated effective volume: 41.17 GB') + expect(consoleMessages[3]).toBe('Estimated TTL: 1 day 10 hours 29 minutes 36 seconds') expect(inquirer.prompt).toHaveBeenCalledWith({ message: 'Confirm the purchase', name: 'value',