Skip to content
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
- name: Run bee-dev
run: npx bee-dev --port 16337 &

- name: Run bee-dev with --no-swap
run: npx bee-dev --port 16338 --no-swap &

- name: Start fdp-play environment
run: fdp-play start --detach --fresh --bee-version ${{ matrix.bee-version }}

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
"dependencies": {
"@ethereumjs/wallet": "^2.0.4",
"@ethersphere/bee-js": "^9.8.1",
"@ethersphere/bee-js": "^10.0.1",
"cafe-utility": "^31.0.0",
"chalk": "^2.4.2",
"cli-progress": "^3.11.2",
Expand Down
2 changes: 1 addition & 1 deletion src/command/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Addresses extends RootCommand implements LeafCommand {
this.console.log('')
this.console.log(chalk.bold('Chequebook Address'))
this.console.divider()
this.console.log(chequebookAddress.chequebookAddress)
this.console.log(chequebookAddress.chequebookAddress.toHex())
})

this.console.quiet('Ethereum ' + this.nodeAddresses.ethereum)
Expand Down
3 changes: 3 additions & 0 deletions src/command/pss/subscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export class Subscribe extends PssCommand implements LeafCommand {
onError: (error: BeeError) => {
this.console.error(error.message)
},
onClose: () => {
this.console.log('Subscription closed')
},
})
}
}
22 changes: 16 additions & 6 deletions src/command/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,27 @@ export class Status extends RootCommand implements LeafCommand {
if (nodeInfo.beeMode !== BeeModes.ULTRA_LIGHT && nodeInfo.beeMode !== BeeModes.DEV) {
this.console.all('')
this.console.all(chalk.bold('Wallet'))
const { bzzBalance, nativeTokenBalance } = await this.bee.getWalletBalance()
this.console.all(createKeyValue('xBZZ', bzzBalance.toDecimalString()))
this.console.all(createKeyValue('xDAI', nativeTokenBalance.toDecimalString()))
try {
const { bzzBalance, nativeTokenBalance } = await this.bee.getWalletBalance()
this.console.all(createKeyValue('xBZZ', bzzBalance.toDecimalString()))
this.console.all(createKeyValue('xDAI', nativeTokenBalance.toDecimalString()))
} catch {
this.console.all(chalk.yellow('Wallet balance not available'))
this.console.all('This is normal if chequebook is disabled in the node configuration.')
}
}

if (nodeInfo.beeMode !== BeeModes.ULTRA_LIGHT && nodeInfo.beeMode !== BeeModes.DEV) {
this.console.all('')
this.console.all(chalk.bold('Chequebook'))
const { totalBalance, availableBalance } = await this.bee.getChequebookBalance()
this.console.all(createKeyValue('Available xBZZ', availableBalance.toDecimalString()))
this.console.all(createKeyValue('Total xBZZ', totalBalance.toDecimalString()))
try {
const { totalBalance, availableBalance } = await this.bee.getChequebookBalance()
this.console.all(createKeyValue('Available xBZZ', availableBalance.toDecimalString()))
this.console.all(createKeyValue('Total xBZZ', totalBalance.toDecimalString()))
} catch {
this.console.all(chalk.yellow('Chequebook balance not available'))
this.console.all('This is normal if chequebook is disabled in the node configuration.')
}
}

if (nodeInfo.beeMode === BeeModes.FULL) {
Expand Down
6 changes: 3 additions & 3 deletions test/coverage/coverage-summary.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"total": {"lines":{"total":2674,"covered":1953,"skipped":0,"pct":73.03},"statements":{"total":2694,"covered":1966,"skipped":0,"pct":72.97},"functions":{"total":318,"covered":242,"skipped":0,"pct":76.1},"branches":{"total":569,"covered":302,"skipped":0,"pct":53.07},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
{"total": {"lines":{"total":2681,"covered":1959,"skipped":0,"pct":73.06},"statements":{"total":2701,"covered":1972,"skipped":0,"pct":73},"functions":{"total":319,"covered":242,"skipped":0,"pct":75.86},"branches":{"total":569,"covered":302,"skipped":0,"pct":53.07},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/home/runner/work/swarm-cli/swarm-cli/src/application.ts": {"lines":{"total":2,"covered":0,"skipped":0,"pct":0},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":2,"covered":0,"skipped":0,"pct":0},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/home/runner/work/swarm-cli/swarm-cli/src/config.ts": {"lines":{"total":31,"covered":30,"skipped":0,"pct":96.77},"functions":{"total":1,"covered":0,"skipped":0,"pct":0},"statements":{"total":31,"covered":30,"skipped":0,"pct":96.77},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/home/runner/work/swarm-cli/swarm-cli/src/curl.ts": {"lines":{"total":24,"covered":24,"skipped":0,"pct":100},"functions":{"total":7,"covered":7,"skipped":0,"pct":100},"statements":{"total":25,"covered":25,"skipped":0,"pct":100},"branches":{"total":13,"covered":12,"skipped":0,"pct":92.3}}
Expand All @@ -7,7 +7,7 @@
,"/home/runner/work/swarm-cli/swarm-cli/src/command/addresses.ts": {"lines":{"total":37,"covered":32,"skipped":0,"pct":86.48},"functions":{"total":6,"covered":5,"skipped":0,"pct":83.33},"statements":{"total":37,"covered":32,"skipped":0,"pct":86.48},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/download.ts": {"lines":{"total":35,"covered":28,"skipped":0,"pct":80},"functions":{"total":4,"covered":4,"skipped":0,"pct":100},"statements":{"total":35,"covered":28,"skipped":0,"pct":80},"branches":{"total":11,"covered":4,"skipped":0,"pct":36.36}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/hash.ts": {"lines":{"total":10,"covered":8,"skipped":0,"pct":80},"functions":{"total":2,"covered":1,"skipped":0,"pct":50},"statements":{"total":10,"covered":8,"skipped":0,"pct":80},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/status.ts": {"lines":{"total":73,"covered":51,"skipped":0,"pct":69.86},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":73,"covered":51,"skipped":0,"pct":69.86},"branches":{"total":11,"covered":11,"skipped":0,"pct":100}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/status.ts": {"lines":{"total":79,"covered":57,"skipped":0,"pct":72.15},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":79,"covered":57,"skipped":0,"pct":72.15},"branches":{"total":11,"covered":11,"skipped":0,"pct":100}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/upload.ts": {"lines":{"total":212,"covered":147,"skipped":0,"pct":69.33},"functions":{"total":15,"covered":13,"skipped":0,"pct":86.66},"statements":{"total":213,"covered":148,"skipped":0,"pct":69.48},"branches":{"total":95,"covered":53,"skipped":0,"pct":55.78}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/cheque/cashout.ts": {"lines":{"total":32,"covered":30,"skipped":0,"pct":93.75},"functions":{"total":4,"covered":4,"skipped":0,"pct":100},"statements":{"total":32,"covered":30,"skipped":0,"pct":93.75},"branches":{"total":2,"covered":2,"skipped":0,"pct":100}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/cheque/cheque-command.ts": {"lines":{"total":25,"covered":21,"skipped":0,"pct":84},"functions":{"total":5,"covered":5,"skipped":0,"pct":100},"statements":{"total":26,"covered":22,"skipped":0,"pct":84.61},"branches":{"total":2,"covered":0,"skipped":0,"pct":0}}
Expand Down Expand Up @@ -54,7 +54,7 @@
,"/home/runner/work/swarm-cli/swarm-cli/src/command/pss/pss-command.ts": {"lines":{"total":8,"covered":8,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":8,"covered":8,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/pss/receive.ts": {"lines":{"total":24,"covered":18,"skipped":0,"pct":75},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":24,"covered":18,"skipped":0,"pct":75},"branches":{"total":6,"covered":2,"skipped":0,"pct":33.33}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/pss/send.ts": {"lines":{"total":34,"covered":29,"skipped":0,"pct":85.29},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":34,"covered":29,"skipped":0,"pct":85.29},"branches":{"total":5,"covered":2,"skipped":0,"pct":40}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/pss/subscribe.ts": {"lines":{"total":17,"covered":8,"skipped":0,"pct":47.05},"functions":{"total":4,"covered":1,"skipped":0,"pct":25},"statements":{"total":17,"covered":8,"skipped":0,"pct":47.05},"branches":{"total":4,"covered":0,"skipped":0,"pct":0}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/pss/subscribe.ts": {"lines":{"total":18,"covered":8,"skipped":0,"pct":44.44},"functions":{"total":5,"covered":1,"skipped":0,"pct":20},"statements":{"total":18,"covered":8,"skipped":0,"pct":44.44},"branches":{"total":4,"covered":0,"skipped":0,"pct":0}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/root-command/command-config.ts": {"lines":{"total":36,"covered":30,"skipped":0,"pct":83.33},"functions":{"total":6,"covered":6,"skipped":0,"pct":100},"statements":{"total":39,"covered":32,"skipped":0,"pct":82.05},"branches":{"total":9,"covered":5,"skipped":0,"pct":55.55}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/root-command/command-log.ts": {"lines":{"total":78,"covered":60,"skipped":0,"pct":76.92},"functions":{"total":9,"covered":6,"skipped":0,"pct":66.66},"statements":{"total":78,"covered":60,"skipped":0,"pct":76.92},"branches":{"total":11,"covered":7,"skipped":0,"pct":63.63}}
,"/home/runner/work/swarm-cli/swarm-cli/src/command/root-command/index.ts": {"lines":{"total":44,"covered":40,"skipped":0,"pct":90.9},"functions":{"total":4,"covered":4,"skipped":0,"pct":100},"statements":{"total":44,"covered":40,"skipped":0,"pct":90.9},"branches":{"total":9,"covered":5,"skipped":0,"pct":55.55}}
Expand Down
32 changes: 32 additions & 0 deletions test/misc/status-swap.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { toMatchLinesInOrder } from '../custom-matcher'
import { describeCommand, invokeTestCli } from '../utility'

expect.extend({
toMatchLinesInOrder,
})

describeCommand('Status command and swap', ({ consoleMessages }) => {
it('should print wallet and chequebook balance', async () => {
await invokeTestCli(['status', '--bee-api-url', 'http://localhost:16337'])
expect(consoleMessages).toMatchLinesInOrder([
['Wallet'],
['xBZZ'],
['xDAI'],
['Chequebook'],
['Available xBZZ'],
['Total xBZZ'],
])
})

it('should handle missing wallet and chequebook balance', async () => {
await invokeTestCli(['status', '--bee-api-url', 'http://localhost:16338'])
expect(consoleMessages).toMatchLinesInOrder([
['Wallet'],
['Wallet balance not available'],
['This is normal if chequebook is disabled in the node configuration.'],
['Chequebook'],
['Chequebook balance not available'],
['This is normal if chequebook is disabled in the node configuration.'],
])
})
})