Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: print helpful message after topup and dilute #516

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/command/stamp/dilute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class Dilute extends StampCommand implements LeafCommand {
throw new CommandLineError(`This postage stamp already has depth ${details.depth}. The new value must be higher.`)
}

const spinner = createSpinner('Dilute in progress. This may take a while.')
const spinner = createSpinner('Dilute in progress. This may take a few minutes.')

if (this.verbosity !== VerbosityLevel.Quiet && !this.curl) {
spinner.start()
Expand All @@ -49,6 +49,8 @@ export class Dilute extends StampCommand implements LeafCommand {
spinner.stop()
}

await this.printDepthAndAmount(this.stamp)
this.console.log(`Dilute finished. Your Bee node will soon synchronize the new values from the blockchain.`)
this.console.log(`This can take a few minutes until the value is updated.`)
this.console.log(`Check it later with swarm-cli stamp show ${this.stamp}`)
}
}
6 changes: 4 additions & 2 deletions src/command/stamp/topup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Topup extends StampCommand implements LeafCommand {
this.stamp = await pickStamp(this.bee, this.console)
}

const spinner = createSpinner('Topup in progress. This may take a while.')
const spinner = createSpinner('Topup in progress. This may take a few minutes.')

if (this.verbosity !== VerbosityLevel.Quiet && !this.curl) {
spinner.start()
Expand All @@ -41,6 +41,8 @@ export class Topup extends StampCommand implements LeafCommand {
spinner.stop()
}

await this.printDepthAndAmount(this.stamp)
this.console.log(`Topup finished. Your Bee node will soon synchronize the new values from the blockchain.`)
this.console.log(`This can take a few minutes until the value is updated.`)
this.console.log(`Check it later with swarm-cli stamp show ${this.stamp}`)
}
}
6 changes: 2 additions & 4 deletions test/command/stamp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ describeCommand(
expect(hasMessageContaining('This postage stamp already has depth 19. The new value must be higher.')).toBe(true)
consoleMessages.length = 0
await invokeTestCli(['stamp', 'dilute', '--stamp', postageBatchId, '--depth', '20'])
expect(getNthLastMessage(2)).toContain('Depth')
expect(getNthLastMessage(2)).toContain('20')
expect(getNthLastMessage(3)).toContain('Dilute finished')
})

it.skip('should top up stamp', async () => {
Expand All @@ -181,8 +180,7 @@ describeCommand(
const { postageBatchId } = command
consoleMessages.length = 0
await invokeTestCli(['stamp', 'topup', '--stamp', postageBatchId, '--amount', '1k'])
expect(getNthLastMessage(1)).toContain('Amount')
expect(getNthLastMessage(1)).toContain('2000')
expect(getNthLastMessage(3)).toContain('Topup finished')
})
},
)
Loading