Beispiel #1
0
 def _from_json_data_object(self, data):
     # decode sender info
     if 'sender' in data:
         bot_data = data['sender']
         self._sender_botid = int(bot_data.get('id', 0) or 0)
         self._sender_signature = ED25519Signature.from_json(bot_data.get('signature', None) or None)
     else:
         self._sender_botid = None
         self._sender_signature = None
     # decode receiver info
     if 'receiver' in data:
         bot_data = data['receiver']
         self._receiver_botid = int(bot_data.get('id', 0) or 0)
         self._receiver_signature = ED25519Signature.from_json(bot_data.get('signature', None) or None)
     else:
         self._receiver_botid = None
         self._receiver_signature = None
     # decode names
     self._names = [BotName.from_json(name) for name in data.get('names', []) or []]
     # decode transaction fee
     if 'txfee' in data:
         self._transaction_fee = Currency.from_json(data['txfee'])
     else:
         self._transaction_fee = None
     # decode coin inputs
     self._coin_inputs = [CoinInput.from_json(ci) for ci in data.get('coininputs', []) or []]
     # decode refund coin output
     if 'refundcoinoutput' in data:
         self._refund_coin_output = CoinOutput.from_json(data['refundcoinoutput'])
     else:
         self._refund_coin_output = None
Beispiel #2
0
 def _from_json_data_object(self, data):
     self._addresses = [
         NetworkAddress.from_json(address)
         for address in data.get('addresses', []) or []
     ]
     self._names = [
         BotName.from_json(name) for name in data.get('names', []) or []
     ]
     self._number_of_months = int(data.get('nrofmonths', 0) or 0)
     if 'txfee' in data:
         self._transaction_fee = Currency.from_json(data['txfee'])
     else:
         self._transaction_fee = None
     self._coin_inputs = [
         CoinInput.from_json(ci) for ci in data.get('coininputs', []) or []
     ]
     if 'refundcoinoutput' in data:
         self._refund_coin_output = CoinOutput.from_json(
             data['refundcoinoutput'])
     else:
         self._refund_coin_output = None
     if 'identification' not in data or data['identification'] in (None,
                                                                   {}):
         self._public_key = None
         self._signature = None
     else:
         identification = data['identification']
         self._public_key = PublicKey.from_json(identification['publickey'])
         self._signature = ED25519Signature.from_json(
             identification['signature'], as_array=True)
Beispiel #3
0
 def _from_json_data_object(self, data):
     self._botid = int(data.get('id', 0) or 0)
     addresses = data.get('addresses', {}) or {}
     self._addresses_to_add = [
         NetworkAddress.from_json(address)
         for address in addresses.get('add', []) or []
     ]
     self._addresses_to_remove = [
         NetworkAddress.from_json(address)
         for address in addresses.get('remove', []) or []
     ]
     names = data.get('names', {}) or {}
     self._names_to_add = [
         BotName.from_json(name) for name in names.get('add', []) or []
     ]
     self._names_to_remove = [
         BotName.from_json(name) for name in names.get('remove', []) or []
     ]
     self._number_of_months = int(data.get('nrofmonths', 0) or 0)
     if 'txfee' in data:
         self._transaction_fee = Currency.from_json(data['txfee'])
     else:
         self._transaction_fee = None
     self._coin_inputs = [
         CoinInput.from_json(ci) for ci in data.get('coininputs', []) or []
     ]
     if 'refundcoinoutput' in data:
         self._refund_coin_output = CoinOutput.from_json(
             data['refundcoinoutput'])
     else:
         self._refund_coin_output = None
     self._signature = ED25519Signature.from_json(
         data.get('signature', None) or None)
Beispiel #4
0
 def _from_json_data_object(self, data):
     # decode public key
     if 'pubkey' in data:
         self._public_key = PublicKey.from_json(data['pubkey'])
     else:
         self._public_key = None
     # decode signature
     if 'signature' in data:
         self._signature = ED25519Signature.from_json(data['signature'])
     else:
         self._signature = None
     # decode registration fee
     if 'regfee' in data:
         self.registration_fee = Currency.from_json(data['regfee'])
     else:
         self.registration_fee = None
     # decode transaction fee
     if 'txfee' in data:
         self._transaction_fee = Currency.from_json(data['txfee'])
     else:
         self._transaction_fee = None
     # decode coin inputs
     self._coin_inputs = [
         CoinInput.from_json(ci) for ci in data.get('coininputs', []) or []
     ]
     # decode refund coin output (if it exists)
     if 'refundcoinoutput' in data:
         self._refund_coin_output = CoinOutput.from_json(
             data['refundcoinoutput'])
     else:
         self._refund_coin_output = None