Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
beem
Commits
ab9465ed
Commit
ab9465ed
authored
7 years ago
by
Holger Nahrstaedt
Browse files
Options
Downloads
Patches
Plain Diff
Add claimreward to cli
cli * add claimreward unit test * add unit test for claimreward
parent
0ba943a6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
beem/block.py
+1
-1
1 addition, 1 deletion
beem/block.py
beem/cli.py
+24
-10
24 additions, 10 deletions
beem/cli.py
tests/beem/test_cli.py
+5
-0
5 additions, 0 deletions
tests/beem/test_cli.py
with
30 additions
and
11 deletions
beem/block.py
+
1
−
1
View file @
ab9465ed
...
@@ -42,7 +42,7 @@ class Block(BlockchainObject):
...
@@ -42,7 +42,7 @@ class Block(BlockchainObject):
self
.
identifier
=
int
(
self
.
identifier
)
self
.
identifier
=
int
(
self
.
identifier
)
if
self
.
steem
.
rpc
.
get_use_appbase
():
if
self
.
steem
.
rpc
.
get_use_appbase
():
block
=
self
.
steem
.
rpc
.
get_block
({
"
block_num
"
:
self
.
identifier
},
api
=
"
block
"
)
block
=
self
.
steem
.
rpc
.
get_block
({
"
block_num
"
:
self
.
identifier
},
api
=
"
block
"
)
if
"
block
"
in
block
:
if
block
and
"
block
"
in
block
:
block
=
block
[
"
block
"
]
block
=
block
[
"
block
"
]
else
:
else
:
block
=
self
.
steem
.
rpc
.
get_block
(
self
.
identifier
)
block
=
self
.
steem
.
rpc
.
get_block
(
self
.
identifier
)
...
...
This diff is collapsed.
Click to expand it.
beem/cli.py
+
24
−
10
View file @
ab9465ed
...
@@ -92,19 +92,13 @@ def unlock_wallet(stm, password=None):
...
@@ -92,19 +92,13 @@ def unlock_wallet(stm, password=None):
'
--no-wallet
'
,
'
-p
'
,
is_flag
=
True
,
default
=
False
,
help
=
"
Do not load the wallet
"
)
'
--no-wallet
'
,
'
-p
'
,
is_flag
=
True
,
default
=
False
,
help
=
"
Do not load the wallet
"
)
@click.option
(
@click.option
(
'
--unsigned
'
,
'
-x
'
,
is_flag
=
True
,
default
=
False
,
help
=
"
Nothing will be signed
"
)
'
--unsigned
'
,
'
-x
'
,
is_flag
=
True
,
default
=
False
,
help
=
"
Nothing will be signed
"
)
@click.option
(
'
--blocking
'
,
is_flag
=
True
,
default
=
False
,
help
=
"
Wait for broadcasted transactions to be included in a block and return full transaction
"
)
@click.option
(
'
--bundle
'
,
is_flag
=
True
,
default
=
False
,
help
=
"
Do not broadcast transactions right away, but allow to bundle operations
"
)
@click.option
(
@click.option
(
'
--expires
'
,
'
-e
'
,
default
=
30
,
'
--expires
'
,
'
-e
'
,
default
=
30
,
help
=
'
Delay in seconds until transactions are supposed to expire(defaults to 60)
'
)
help
=
'
Delay in seconds until transactions are supposed to expire(defaults to 60)
'
)
@click.option
(
@click.option
(
'
--verbose
'
,
'
-v
'
,
default
=
3
,
help
=
'
Verbosity
'
)
'
--verbose
'
,
'
-v
'
,
default
=
3
,
help
=
'
Verbosity
'
)
@click.version_option
(
version
=
__version__
)
@click.version_option
(
version
=
__version__
)
def
cli
(
node
,
offline
,
no_broadcast
,
no_wallet
,
unsigned
,
blocking
,
bundle
,
expires
,
verbose
):
def
cli
(
node
,
offline
,
no_broadcast
,
no_wallet
,
unsigned
,
expires
,
verbose
):
# Logging
# Logging
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -125,8 +119,6 @@ def cli(node, offline, no_broadcast, no_wallet, unsigned, blocking, bundle, expi
...
@@ -125,8 +119,6 @@ def cli(node, offline, no_broadcast, no_wallet, unsigned, blocking, bundle, expi
offline
=
offline
,
offline
=
offline
,
nowallet
=
no_wallet
,
nowallet
=
no_wallet
,
unsigned
=
unsigned
,
unsigned
=
unsigned
,
blocking
=
blocking
,
bundle
=
bundle
,
expiration
=
expires
,
expiration
=
expires
,
debug
=
debug
debug
=
debug
)
)
...
@@ -227,7 +219,7 @@ def addkey(unsafe_import_key):
...
@@ -227,7 +219,7 @@ def addkey(unsafe_import_key):
if
not
unlock_wallet
(
stm
):
if
not
unlock_wallet
(
stm
):
return
return
if
not
unsafe_import_key
:
if
not
unsafe_import_key
:
unsafe_import_key
=
click
.
prompt
(
"
Enter private key
"
,
confirmation_prompt
=
False
,
hide_input
=
Fals
e
)
unsafe_import_key
=
click
.
prompt
(
"
Enter private key
"
,
confirmation_prompt
=
False
,
hide_input
=
Tru
e
)
stm
.
wallet
.
addPrivateKey
(
unsafe_import_key
)
stm
.
wallet
.
addPrivateKey
(
unsafe_import_key
)
set_shared_steem_instance
(
stm
)
set_shared_steem_instance
(
stm
)
...
@@ -1091,6 +1083,28 @@ def witnesses(account, limit):
...
@@ -1091,6 +1083,28 @@ def witnesses(account, limit):
witnesses
.
printAsTable
()
witnesses
.
printAsTable
()
@cli.command
()
@click.option
(
'
--reward_steem
'
,
help
=
'
Amount of STEEM you would like to claim
'
,
default
=
"
0 STEEM
"
)
@click.option
(
'
--reward_sbd
'
,
help
=
'
Amount of SBD you would like to claim
'
,
default
=
"
0 SBD
"
)
@click.option
(
'
--reward_vests
'
,
help
=
'
Amount of VESTS you would like to claim
'
,
default
=
"
0 VESTS
"
)
@click.option
(
'
--account
'
,
'
-a
'
,
help
=
'
Voter account name
'
)
def
claimreward
(
reward_steem
,
reward_sbd
,
reward_vests
,
account
):
"""
Claim reward balances
By default, this will claim ``all`` outstanding balances.
"""
stm
=
shared_steem_instance
()
if
not
account
:
account
=
stm
.
config
[
"
default_account
"
]
if
not
unlock_wallet
(
stm
):
return
acc
=
Account
(
account
,
steem_instance
=
stm
)
tx
=
acc
.
claim_reward_balance
(
reward_steem
,
reward_sbd
,
reward_vests
)
tx
=
json
.
dumps
(
tx
,
indent
=
4
)
print
(
tx
)
@cli.command
()
@cli.command
()
@click.argument
(
'
objects
'
,
nargs
=-
1
)
@click.argument
(
'
objects
'
,
nargs
=-
1
)
def
info
(
objects
):
def
info
(
objects
):
...
...
This diff is collapsed.
Click to expand it.
tests/beem/test_cli.py
+
5
−
0
View file @
ab9465ed
...
@@ -249,3 +249,8 @@ class Testcases(unittest.TestCase):
...
@@ -249,3 +249,8 @@ class Testcases(unittest.TestCase):
self
.
assertEqual
(
result
.
exit_code
,
0
)
self
.
assertEqual
(
result
.
exit_code
,
0
)
result
=
runner
.
invoke
(
cli
,
[
'
delprofile
'
,
'
url
'
],
input
=
"
test
\n
"
)
result
=
runner
.
invoke
(
cli
,
[
'
delprofile
'
,
'
url
'
],
input
=
"
test
\n
"
)
self
.
assertEqual
(
result
.
exit_code
,
0
)
self
.
assertEqual
(
result
.
exit_code
,
0
)
def
test_claimreward
(
self
):
runner
=
CliRunner
()
result
=
runner
.
invoke
(
cli
,
[
'
claimreward
'
],
input
=
"
test
\n
"
)
self
.
assertEqual
(
result
.
exit_code
,
0
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment