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
255f2521
Commit
255f2521
authored
6 years ago
by
Holger Nahrstaedt
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in Vote and added authorperm property
Tutorial about Transactionbuilder fixed
parent
95fc301b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beem/vote.py
+14
-2
14 additions, 2 deletions
beem/vote.py
docs/tutorials.rst
+31
-13
31 additions, 13 deletions
docs/tutorials.rst
with
45 additions
and
15 deletions
beem/vote.py
+
14
−
2
View file @
255f2521
...
...
@@ -119,6 +119,18 @@ class Vote(BlockchainObject):
def
voter
(
self
):
return
self
[
"
voter
"
]
@property
def
authorperm
(
self
):
if
"
authorperm
"
in
self
:
return
self
[
"
authorperm
"
]
elif
"
authorpermvoter
"
in
self
:
[
author
,
permlink
,
voter
]
=
resolve_authorpermvoter
(
self
[
"
authorpermvoter
"
])
return
construct_authorperm
(
author
,
permlink
)
elif
"
author
"
in
self
and
"
permlink
"
in
self
:
return
construct_authorperm
(
self
[
"
author
"
],
self
[
"
permlink
"
])
else
:
return
""
@property
def
votee
(
self
):
votee
=
''
...
...
@@ -284,9 +296,9 @@ class VotesObject(list):
authorperm
=
item
return
(
any
([
name
==
x
[
"
voter
"
]
for
x
in
self
])
or
any
([
name
==
x
.
voter
for
x
in
self
])
or
any
([
name
==
x
.
votee
for
x
in
self
])
or
any
([
authorperm
==
x
[
"
authorperm
"
]
for
x
in
self
])
any
([
authorperm
==
x
.
authorperm
for
x
in
self
])
)
def
__str__
(
self
):
...
...
This diff is collapsed.
Click to expand it.
docs/tutorials.rst
+
31
−
13
View file @
255f2521
...
...
@@ -267,35 +267,53 @@ Lets display all Posts from an account:
Transactionbuilder
------------------
Sign transactions with beem without using the wallet and build the transaction by hand.
Example with
out using
the wallet:
Example with
one operation with and without
the wallet:
.. code-block:: python
from beem import Steem
from beem.transactionbuilder import TransactionBuilder
from beembase import operations
stm = Steem()
# Uncomment the following when using a wallet:
# stm.wallet.unlock("secret_password")
tx = TransactionBuilder(steem_instance=stm)
tx.appendOps(Transfer(**{"from": 'user_a',
"to": 'user_b',
"amount": '1.000 SBD',
"memo": 'test 2'}))
op = operations.Transfer(**{"from": 'user_a',
"to": 'user_b',
"amount": '1.000 SBD',
"memo": 'test 2'}))
tx.appendOps(op)
# Comment appendWif out and uncomment appendSigner when using a stored key from the wallet
tx.appendWif('5.....') # `user_a`
# tx.appendSigner('user_a', 'active')
tx.sign()
tx.broadcast()
Example with
u
si
ng the wallet
:
Example with si
gning and broadcasting two operations
:
.. code-block:: python
from beem.transactionbuilder import TransactionBuilder
from beem import Steem
from beem.transactionbuilder import TransactionBuilder
from beembase import operations
stm = Steem()
stm.wallet.unlock("secret_password")
# Uncomment the following when using a wallet:
# stm.wallet.unlock("secret_password")
tx = TransactionBuilder(steem_instance=stm)
tx.appendOps(Transfer(**{"from": 'user_a',
"to": 'user_b',
"amount": '1.000 SBD',
"memo": 'test 2'}))
tx.appendSigner('user_a', 'active')
ops = []
op = operations.Transfer(**{"from": 'user_a',
"to": 'user_b',
"amount": '1.000 SBD',
"memo": 'test 2'}))
ops.append(op)
op = operations.Vote(**{"voter": v,
"author": author,
"permlink": permlink,
"weight": int(percent * 100)})
ops.append(op)
tx.appendOps(ops)
# Comment appendWif out and uncomment appendSigner when using a stored key from the wallet
tx.appendWif('5.....') # `user_a`
# tx.appendSigner('user_a', 'active')
tx.sign()
tx.broadcast()
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