Skip to content

Commit

Permalink
Reduce number of required API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
xeroc committed Oct 22, 2020
1 parent 5564e86 commit 1376490
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion grapheneapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ def __init__(self, urls, user=None, password=None, connect=True, **kwargs):
# Let's also be able to deal with infinite connection
self.urls = cycle(urls)
self._cnt_retries = 0
self._network = None

# Connect!
if connect:
self.connect()
self._network = self.get_network()

# Get chain parameters
@property
def chain_params(self):
return self.get_network()
if self._network is None:
self._network = self.get_network()
return self._network

def get_network(self):
return self.get_chain_properties()
Expand Down
2 changes: 1 addition & 1 deletion graphenecommon/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def finalizeOp(self, ops, account, permission, **kwargs):
elif self.bundle:
# In case we want to add more ops to the tx (bundle)
self.txbuffer.appendSigner(account, permission)
return self.txbuffer.json()
return self.txbuffer
else:
# default behavior: sign + broadcast
self.txbuffer.appendSigner(account, permission)
Expand Down
2 changes: 1 addition & 1 deletion graphenecommon/transactionbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(
proposal_review=None,
parent=None,
*args,
**kwargs
**kwargs,
):
self.define_classes()
assert self.operation_class
Expand Down

0 comments on commit 1376490

Please sign in to comment.