Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# meta properties
meta_min_fee = 17740000000000
api_spend_tx = {
"amount":amount,
"fee":fee,
"nonce":nonce,
"payload":payload,
"recipient_id":recipient_id,
"sender_id":sender_id,
"type":_type,
"version":version
}
api_signed_tx = Munch.fromDict({
"block_height":181115,
"block_hash":"mh_2essz8vfq4A8UZU98Jpm5VcB3Wt7p5CbQhzBgojjsM4AFq6z2s",
"hash":tx_hash,
"signatures":[
signatures
],
"tx": api_spend_tx
})
txbl = transactions.TxBuilder()
txo_from_py = txbl.tx_spend(sender_id, recipient_id, amount, hashing.decode(payload), fee, ttl, nonce)
txo_from_api = txbl.parse_node_reply(api_signed_tx).data.tx
txo_from_str = txbl.parse_tx_string(txo_from_py.tx)
assert txo_from_py.tx == txo_from_str.tx
def _check_session(self):
""" Retrieve the session and move it to g if there is one. """
if 'FLASK_FAS_OPENID_USER' not in flask.session \
or flask.session['FLASK_FAS_OPENID_USER'] is None:
flask.g.fas_user = None
else:
user = flask.session['FLASK_FAS_OPENID_USER']
# Add approved_memberships to provide backwards compatibility
# New applications should only use g.fas_user.groups
user['approved_memberships'] = []
for group in user['groups']:
membership = dict()
membership['name'] = group
user['approved_memberships'].append(Munch.fromDict(membership))
flask.g.fas_user = Munch.fromDict(user)
flask.g.fas_user.groups = frozenset(flask.g.fas_user.groups)
flask.g.fas_session_id = 0
def _check_session(self):
if 'FLASK_FAS_OPENID_USER' not in flask.session \
or flask.session['FLASK_FAS_OPENID_USER'] is None:
flask.g.fas_user = None
else:
user = flask.session['FLASK_FAS_OPENID_USER']
# Add approved_memberships to provide backwards compatibility
# New applications should only use g.fas_user.groups
user['approved_memberships'] = []
for group in user['groups']:
membership = dict()
membership['name'] = group
user['approved_memberships'].append(Munch.fromDict(membership))
flask.g.fas_user = Munch.fromDict(user)
flask.g.fas_user.groups = frozenset(flask.g.fas_user.groups)
flask.g.fas_session_id = 0
def _check_session(self):
if 'FLASK_FAS_OPENID_USER' not in flask.session \
or flask.session['FLASK_FAS_OPENID_USER'] is None:
flask.g.fas_user = None
else:
user = flask.session['FLASK_FAS_OPENID_USER']
# Add approved_memberships to provide backwards compatibility
# New applications should only use g.fas_user.groups
user['approved_memberships'] = []
for group in user['groups']:
membership = dict()
membership['name'] = group
user['approved_memberships'].append(Munch.fromDict(membership))
flask.g.fas_user = Munch.fromDict(user)
flask.g.fas_user.groups = frozenset(flask.g.fas_user.groups)
flask.g.fas_session_id = 0
def _check_session(self):
""" Retrieve the session and move it to g if there is one. """
if 'FLASK_FAS_OPENID_USER' not in flask.session \
or flask.session['FLASK_FAS_OPENID_USER'] is None:
flask.g.fas_user = None
else:
user = flask.session['FLASK_FAS_OPENID_USER']
# Add approved_memberships to provide backwards compatibility
# New applications should only use g.fas_user.groups
user['approved_memberships'] = []
for group in user['groups']:
membership = dict()
membership['name'] = group
user['approved_memberships'].append(Munch.fromDict(membership))
flask.g.fas_user = Munch.fromDict(user)
flask.g.fas_user.groups = frozenset(flask.g.fas_user.groups)
flask.g.fas_session_id = 0
Applicable only for initiator (default: timeout_accept value)
:param timeout_awaiting_open (int): The time frame the initiator has to start an outgoing noise session to the responder's node.
Applicable only for responder (default: timeout_idle's value)
:param sign (TxSigner): Instance of TxSigner
:param offchain_message_handler (function): Callback method to receive off-chain messages.
If not provided, all the incoming messages will be ignored.
:param error_handler (function): Callback method to receive error messages.
If not provided, all error messages will be ignored.
"""
options_keys = {'sign', 'endpoint', 'url'}
endpoint = kwargs.get('endpoint', defaults.CHANNEL_ENDPOINT)
wsUrl = kwargs.get('url', defaults.CHANNEL_URL)
self.sign = kwargs.get('sign', None)
self.params = {k: kwargs[k] for k in kwargs.keys() if k not in options_keys}
self.url = self.__channel_url(wsUrl, self.params, endpoint)
self.params = Munch.fromDict(self.params)
self.status = None
self.id = None
self.is_locked = False
self.action_queue = Queue()
self.handlers = {}