Skip to content
GitLab
Explore
Sign in
Register
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
ce9c5126
Commit
ce9c5126
authored
6 years ago
by
Holger
Browse files
Options
Downloads
Patches
Plain Diff
get_vesting_delegations added and block date conversion improved
parent
6b5526b2
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/account.py
+28
-0
28 additions, 0 deletions
beem/account.py
beem/block.py
+17
-33
17 additions, 33 deletions
beem/block.py
with
45 additions
and
33 deletions
beem/account.py
+
28
−
0
View file @
ce9c5126
...
@@ -938,6 +938,34 @@ class Account(BlockchainObject):
...
@@ -938,6 +938,34 @@ class Account(BlockchainObject):
else
:
else
:
return
self
.
steem
.
rpc
.
get_conversion_requests
(
account
)
return
self
.
steem
.
rpc
.
get_conversion_requests
(
account
)
def
get_vesting_delegations
(
self
,
start_account
=
""
,
limit
=
100
,
account
=
None
):
"""
Returns the vesting delegations by an account.
:param str account: When set, a different account is used for the request (Default is object account name)
:param str start_account: Only used in pre-appbase nodes
:param int limit: Only used in pre-appbase nodes
:rtype: list
.. code-block:: python
>>>
from
beem.account
import
Account
>>>
account
=
Account
(
"
test
"
)
>>>
account
.
get_vesting_delegations
()
[]
"""
if
account
is
None
:
account
=
self
[
"
name
"
]
elif
isinstance
(
account
,
Account
):
account
=
account
[
"
name
"
]
if
not
self
.
steem
.
is_connected
():
raise
OfflineHasNoRPCException
(
"
No RPC available in offline mode!
"
)
self
.
steem
.
rpc
.
set_next_node_on_empty_reply
(
False
)
if
self
.
steem
.
rpc
.
get_use_appbase
():
return
self
.
steem
.
rpc
.
find_vesting_delegations
({
'
account
'
:
account
},
api
=
"
database
"
)[
'
delegations
'
]
else
:
return
self
.
steem
.
rpc
.
get_vesting_delegations
(
account
,
start_account
,
limit
)
def
get_withdraw_routes
(
self
,
account
=
None
):
def
get_withdraw_routes
(
self
,
account
=
None
):
"""
Returns the withdraw routes for an account.
"""
Returns the withdraw routes for an account.
...
...
This diff is collapsed.
Click to expand it.
beem/block.py
+
17
−
33
View file @
ce9c5126
...
@@ -84,19 +84,13 @@ class Block(BlockchainObject):
...
@@ -84,19 +84,13 @@ class Block(BlockchainObject):
if
p
in
block
and
isinstance
(
block
.
get
(
p
),
string_types
):
if
p
in
block
and
isinstance
(
block
.
get
(
p
),
string_types
):
block
[
p
]
=
formatTimeString
(
block
.
get
(
p
,
"
1970-01-01T00:00:00
"
))
block
[
p
]
=
formatTimeString
(
block
.
get
(
p
,
"
1970-01-01T00:00:00
"
))
if
"
transactions
"
in
block
:
if
"
transactions
"
in
block
:
new_transactions
=
[]
for
i
in
range
(
len
(
block
[
"
transactions
"
])):
for
trx
in
block
[
"
transactions
"
]:
if
'
expiration
'
in
block
[
"
transactions
"
][
i
]
and
isinstance
(
block
[
"
transactions
"
][
i
][
"
expiration
"
],
string_types
):
if
'
expiration
'
in
trx
and
isinstance
(
trx
.
get
(
'
expiration
'
),
string_types
):
block
[
"
transactions
"
][
i
][
"
expiration
"
]
=
formatTimeString
(
block
[
"
transactions
"
][
i
][
"
expiration
"
])
trx
[
'
expiration
'
]
=
formatTimeString
(
trx
.
get
(
'
expiration
'
,
"
1970-01-01T00:00:00
"
))
new_transactions
.
append
(
trx
)
block
[
"
transactions
"
]
=
new_transactions
elif
"
operations
"
in
block
:
elif
"
operations
"
in
block
:
new_operations
=
[]
for
i
in
range
(
len
(
block
[
"
operations
"
])):
for
trx
in
block
[
"
operations
"
]:
if
'
timestamp
'
in
block
[
"
operations
"
][
i
]
and
isinstance
(
block
[
"
operations
"
][
i
][
"
timestamp
"
],
string_types
):
if
'
timestamp
'
in
trx
and
isinstance
(
trx
.
get
(
'
timestamp
'
),
string_types
):
block
[
"
operations
"
][
i
][
"
timestamp
"
]
=
formatTimeString
(
block
[
"
operations
"
][
i
][
"
timestamp
"
])
trx
[
'
timestamp
'
]
=
formatTimeString
(
trx
.
get
(
'
timestamp
'
,
"
1970-01-01T00:00:00
"
))
new_operations
.
append
(
trx
)
block
[
"
operations
"
]
=
new_operations
return
block
return
block
def
json
(
self
):
def
json
(
self
):
...
@@ -111,29 +105,19 @@ class Block(BlockchainObject):
...
@@ -111,29 +105,19 @@ class Block(BlockchainObject):
output
[
p
]
=
formatTimeString
(
p_date
)
output
[
p
]
=
formatTimeString
(
p_date
)
else
:
else
:
output
[
p
]
=
p_date
output
[
p
]
=
p_date
if
"
transactions
"
in
output
:
if
"
transactions
"
in
output
:
new_transactions
=
[]
for
i
in
range
(
len
(
output
[
"
transactions
"
])):
for
trx
in
output
[
"
transactions
"
]:
if
'
expiration
'
in
output
[
"
transactions
"
][
i
]
and
isinstance
(
output
[
"
transactions
"
][
i
][
"
expiration
"
],
(
datetime
,
date
)):
if
'
expiration
'
in
trx
:
output
[
"
transactions
"
][
i
][
"
expiration
"
]
=
formatTimeString
(
output
[
"
transactions
"
][
i
][
"
expiration
"
])
p_date
=
trx
.
get
(
'
expiration
'
,
datetime
(
1970
,
1
,
1
,
0
,
0
))
if
isinstance
(
p_date
,
(
datetime
,
date
)):
trx
[
'
expiration
'
]
=
formatTimeString
(
p_date
)
else
:
trx
[
'
expiration
'
]
=
p_date
new_transactions
.
append
(
trx
)
output
[
"
transactions
"
]
=
new_transactions
elif
"
operations
"
in
output
:
elif
"
operations
"
in
output
:
new_operations
=
[]
for
i
in
range
(
len
(
output
[
"
operations
"
])):
for
trx
in
output
[
"
operations
"
]:
if
'
timestamp
'
in
output
[
"
operations
"
][
i
]
and
isinstance
(
output
[
"
operations
"
][
i
][
"
timestamp
"
],
(
datetime
,
date
)):
if
'
timestamp
'
in
trx
:
output
[
"
operations
"
][
i
][
"
timestamp
"
]
=
formatTimeString
(
output
[
"
operations
"
][
i
][
"
timestamp
"
])
p_date
=
trx
.
get
(
'
timestamp
'
,
datetime
(
1970
,
1
,
1
,
0
,
0
))
if
isinstance
(
p_date
,
(
datetime
,
date
)):
ret
=
json
.
loads
(
str
(
json
.
dumps
(
output
)))
trx
[
'
timestamp
'
]
=
formatTimeString
(
p_date
)
output
=
self
.
_parse_json_data
(
output
)
else
:
return
ret
trx
[
'
timestamp
'
]
=
p_date
new_operations
.
append
(
trx
)
output
[
"
operations
"
]
=
new_operations
return
json
.
loads
(
str
(
json
.
dumps
(
output
)))
def
refresh
(
self
):
def
refresh
(
self
):
"""
Even though blocks never change, you freshly obtain its contents
"""
Even though blocks never change, you freshly obtain its contents
...
...
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