Skip to content

Commit 1946721

Browse files
committed
Merge branch 'release/0.3.1'
2 parents e51409e + 9d0b970 commit 1946721

File tree

12 files changed

+75
-30
lines changed

12 files changed

+75
-30
lines changed

AUTHORS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
409 Fabian Schuh <[email protected]>
2-
137 Fabian Schuh <[email protected]>
3-
85 Fabian Schuh <[email protected]>
2+
150 Fabian Schuh <[email protected]>
3+
88 Fabian Schuh <[email protected]>
44
27 jhtitor <[email protected]>
5+
26 pyup-bot <[email protected]>
56
6 Vladimir Kamarzin <[email protected]>
67
4 Chris Beaven <[email protected]>
78
4 Stefan Schiessl <[email protected]>

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ docs:
4747
SPHINX_APIDOC_OPTIONS="members,undoc-members,show-inheritance,inherited-members" sphinx-apidoc -d 6 -e -f -o docs . *.py tests
4848
make -C docs clean html
4949

50-
prepare: clean test apidocs authors
50+
prepare: clean test docs authors
5151

5252
release: clean check dist git
5353

bitshares/block.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ class Block(GrapheneBlock):
3131
3232
"""
3333

34-
def define_classes(self):
35-
self.type_id = "-none-"
34+
pass
3635

3736

3837
@BlockchainInstance.inject
3938
class BlockHeader(GrapheneBlockHeader):
40-
def define_classes(self):
41-
self.type_id = "-none-"
39+
pass

bitshares/genesisbalance.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -*- coding: utf-8 -*-
2+
from .account import Account
3+
from .instance import BlockchainInstance
4+
from graphenecommon.genesisbalance import (
5+
GenesisBalance as GrapheneGenesisBalance,
6+
GenesisBalances as GrapheneGenesisBalances,
7+
)
8+
9+
from bitsharesbase.account import Address, PublicKey
10+
from bitsharesbase import operations
11+
12+
13+
@BlockchainInstance.inject
14+
class GenesisBalance(GrapheneGenesisBalance):
15+
""" Read data about a Genesis Balances from the chain
16+
17+
:param str identifier: identifier of the balance
18+
:param bitshares blockchain_instance: bitshares() instance to use when
19+
accesing a RPC
20+
21+
"""
22+
23+
type_id = 15
24+
25+
def define_classes(self):
26+
self.account_class = Account
27+
self.operations = operations
28+
self.address_class = Address
29+
self.publickey_class = PublicKey
30+
31+
32+
@BlockchainInstance.inject
33+
class GenesisBalances(GrapheneGenesisBalances):
34+
""" List genesis balances that can be claimed from the
35+
keys in the wallet
36+
"""
37+
38+
def define_classes(self):
39+
self.genesisbalance_class = GenesisBalance
40+
self.publickey_class = PublicKey
41+
self.address_class = Address

bitshares/market.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,25 +149,29 @@ def ticker(self):
149149

150150
ticker = self.blockchain.rpc.get_ticker(self["base"]["id"], self["quote"]["id"])
151151
data["baseVolume"] = Amount(
152-
ticker["base_volume"], self["base"], blockchain_instance=self.blockchain
152+
ticker["base_volume"] or 0.0,
153+
self["base"],
154+
blockchain_instance=self.blockchain,
153155
)
154156
data["quoteVolume"] = Amount(
155-
ticker["quote_volume"], self["quote"], blockchain_instance=self.blockchain
157+
ticker["quote_volume"] or 0.0,
158+
self["quote"],
159+
blockchain_instance=self.blockchain,
156160
)
157161
data["lowestAsk"] = Price(
158-
ticker["lowest_ask"],
162+
ticker["lowest_ask"] or 0.0,
159163
base=self["base"],
160164
quote=self["quote"],
161165
blockchain_instance=self.blockchain,
162166
)
163167
data["highestBid"] = Price(
164-
ticker["highest_bid"],
168+
ticker["highest_bid"] or 0.0,
165169
base=self["base"],
166170
quote=self["quote"],
167171
blockchain_instance=self.blockchain,
168172
)
169173
data["latest"] = Price(
170-
ticker["latest"],
174+
ticker["latest"] or 0.0,
171175
quote=self["quote"],
172176
base=self["base"],
173177
blockchain_instance=self.blockchain,

bitshares/price.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ def __init__(self, order, **kwargs):
237237
elif isinstance(order, dict):
238238
# filled orders from account history
239239
if "op" in order:
240-
order = order["op"][1]
240+
if isinstance(order["op"], (list, set)):
241+
order = order["op"][1]
242+
elif isinstance(order["op"], dict):
243+
order = order["op"]
244+
241245
base_asset = kwargs.get("base_asset", order["receives"]["asset_id"])
242246
Price.__init__(self, order, base_asset=base_asset)
243247

docs/bitshares.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Submodules
1616
bitshares.committee
1717
bitshares.dex
1818
bitshares.exceptions
19+
bitshares.genesisbalance
1920
bitshares.htlc
2021
bitshares.instance
2122
bitshares.market

docs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
graphenelib==1.1.11
1+
graphenelib==1.1.12
22
bitshares==0.3.0
33
autobahn>=0.14
4-
pycryptodome==3.7.3
4+
pycryptodome==3.8.0
55
appdirs==1.4.3

requirements-test.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Unit testing
2-
pytest==4.3.0
3-
pytest-mock==1.10.1
4-
coverage==4.5.2
2+
pytest==4.3.1
3+
pytest-mock==1.10.2
4+
coverage==4.5.3
55
mock==2.0.0
66

77
# Code style
88
flake8==3.7.7
99
# black
10-
isort==4.3.12
10+
isort==4.3.16
1111
pre-commit==1.14.4

requirements.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
graphenelib>=1.1.11
2-
pycryptodome==3.7.3
1+
graphenelib>=1.1.16
32
websockets==7.0
4-
appdirs==1.4.3
53
Events==0.3
6-
scrypt==0.8.13
7-
pyyaml==3.13

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
ascii = codecs.lookup("ascii")
1414
codecs.register(lambda name, enc=ascii: {True: enc}.get(name == "mbcs"))
1515

16-
VERSION = "0.3.0"
16+
VERSION = "0.3.1"
1717
URL = "https://github.com/bitshares/python-bitshares"
1818

1919
setup(

tests/test_block.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
import unittest
23
from pprint import pprint
34
from bitshares import BitShares
@@ -8,16 +9,15 @@
89

910

1011
class Testcases(unittest.TestCase):
11-
1212
def setUp(self):
1313
fixture_data()
1414

1515
def test_block(self):
16-
block = Block(1)
16+
block = Block(1, use_cache=True)
1717
self.assertEqual(block["previous"], "0000000000000000000000000000000000000000")
18-
self.assertEqual(block.time(), parse_time('2015-10-13T14:12:24'))
18+
self.assertEqual(block.time(), parse_time("2015-10-13T14:12:24"))
1919

2020
def test_blockheader(self):
21-
header = BlockHeader(1)
21+
header = BlockHeader(1, use_cache=True)
2222
self.assertEqual(header["previous"], "0000000000000000000000000000000000000000")
23-
self.assertEqual(header.time(), parse_time('2015-10-13T14:12:24'))
23+
self.assertEqual(header.time(), parse_time("2015-10-13T14:12:24"))

0 commit comments

Comments
 (0)