Skip to content

Commit 886806e

Browse files
committed
Merge branch 'release/0.1.19'
2 parents 6db177d + 44b7e0f commit 886806e

File tree

7 files changed

+26
-18
lines changed

7 files changed

+26
-18
lines changed

bitshares/bitshares.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,8 @@ def approveproposal(
10171017
""" Approve Proposal
10181018
10191019
:param list proposal_id: Ids of the proposals
1020+
:param str appprover: The account or key to use for approval
1021+
(defaults to ``account``)
10201022
:param str account: (optional) the account to allow access
10211023
to (defaults to ``default_account``)
10221024
"""
@@ -1045,7 +1047,6 @@ def approveproposal(
10451047
"fee": {"amount": 0, "asset_id": "1.3.0"},
10461048
'fee_paying_account': account["id"],
10471049
'proposal': proposal["id"],
1048-
'active_approvals_to_add': [approver["id"]],
10491050
"prefix": self.prefix
10501051
}
10511052
if is_key:
@@ -1058,8 +1059,9 @@ def approveproposal(
10581059
})
10591060
op.append(operations.Proposal_update(**update_dict))
10601061
if is_key:
1061-
self.txbuffer.appendSigner(account["name"], "active")
1062-
return self.finalizeOp(op, approver["name"], "active", **kwargs)
1062+
self.txbuffer.appendSigner(approver, "active")
1063+
return self.finalizeOp(op, account["name"], "active", **kwargs)
1064+
return self.finalizeOp(op, approver, "active", **kwargs)
10631065

10641066
def disapproveproposal(
10651067
self, proposal_ids, account=None, approver=None, **kwargs

bitshares/exceptions.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,3 @@ class WrongMemoKey(Exception):
143143
"""
144144
pass
145145

146-
147-
class KeyNotFound(Exception):
148-
""" Key not found
149-
"""
150-
pass

bitshares/memo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from bitsharesbase import memo as BtsMemo
44
from bitsharesbase.account import PrivateKey, PublicKey
55
from .account import Account
6-
from .exceptions import MissingKeyError
6+
from .exceptions import MissingKeyError, KeyNotFound
77

88

99
class Memo(object):

bitshares/price.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def __repr__(self):
507507
)),
508508
str(self["for_sale"]),
509509
)
510-
else:
510+
elif "amount_to_sell" in self:
511511
t += "{} for {} ".format(
512512
str(Amount(
513513
self["amount_to_sell"],
@@ -518,6 +518,19 @@ def __repr__(self):
518518
blockchain_instance=self.blockchain
519519
)),
520520
)
521+
elif "quote" in self and "base" in self:
522+
t += "{} for {} ".format(
523+
str(Amount({
524+
"amount": self["quote"],
525+
"asset_id": self["quote"]["asset"]["id"]},
526+
blockchain_instance=self.blockchain
527+
)),
528+
str(Amount({
529+
"amount": self["base"],
530+
"asset_id": self["base"]["asset"]["id"]},
531+
blockchain_instance=self.blockchain
532+
)),
533+
)
521534
return t + "@ " + Price.__repr__(self)
522535

523536
__str__ = __repr__

bitshares/transactionbuilder.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,12 @@ def appendSigner(self, account, permission):
210210
and permission is supposed to sign the transaction
211211
"""
212212
assert permission in ["active", "owner"], "Invalid permission"
213-
account = Account(account, blockchain_instance=self.blockchain)
214-
required_treshold = account[permission]["weight_threshold"]
215213

216214
if self.blockchain.wallet.locked():
217215
raise WalletLocked()
218216

219217
# Let's define a helper function for recursion
220-
def fetchkeys(account, perm, level=0):
218+
def fetchkeys(account, perm, level=0, required_treshold=1):
221219
if level > 2:
222220
return []
223221
r = []
@@ -234,7 +232,7 @@ def fetchkeys(account, perm, level=0):
234232
for authority in account[perm]["account_auths"]:
235233
auth_account = Account(
236234
authority[0], blockchain_instance=self.blockchain)
237-
r.extend(fetchkeys(auth_account, perm, level + 1))
235+
r.extend(fetchkeys(auth_account, perm, level + 1, required_treshold))
238236

239237
return r
240238

@@ -251,11 +249,11 @@ def fetchkeys(account, perm, level=0):
251249
else:
252250
account = Account(account, blockchain_instance=self.blockchain)
253251
required_treshold = account[permission]["weight_threshold"]
254-
keys = fetchkeys(account, permission)
252+
keys = fetchkeys(account, permission, required_treshold=required_treshold)
255253
# If we couldn't find an active key, let's try overwrite it
256254
# with an owner key
257255
if not keys and permission != "owner":
258-
keys.extend(fetchkeys(account, "owner"))
256+
keys.extend(fetchkeys(account, "owner", required_treshold=required_treshold))
259257
for x in keys:
260258
self.wifs.add(x[0])
261259

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ exclude =
2525
__pycache__,
2626
# The conf file is mostly autogenerated, ignore it
2727
docs/conf.py,
28-
max-complexity = 10
28+
max-complexity = 15

setup.py

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

14-
VERSION = '0.1.18'
14+
VERSION = '0.1.19'
1515

1616
setup(
1717
name='bitshares',

0 commit comments

Comments
 (0)