Пример #1
0
 def send_raw_transaction_pre_exec(self, tx: Transaction, is_full: bool = False):
     hex_tx_data = tx.serialize(is_hex=True)
     data = f'{{"Action":"sendrawtransaction", "Version":"1.0.0","Data":"{hex_tx_data}"}}'
     url = RestfulMethod.send_transaction_pre_exec(self._url)
     response = self.__post(url, data)
     if is_full:
         return response
     return response['Result']
Пример #2
0
 async def send_raw_transaction_pre_exec(self,
                                         tx: Transaction,
                                         is_full: bool = False):
     tx_data = tx.serialize(is_hex=True)
     msg = dict(Action='sendrawtransaction',
                Version='1.0.0',
                Id=self.__id,
                PreExec='1',
                Data=tx_data)
     return await self.__send_recv(msg, is_full)
Пример #3
0
 async def send_raw_transaction_pre_exec(self, tx: Transaction, is_full: bool = False):
     """
     This interface is used to send the transaction that is prepare to execute.
     """
     tx_data = tx.serialize(is_hex=True)
     payload = self.generate_json_rpc_payload(RpcMethod.SEND_TRANSACTION, [tx_data, 1])
     response = await self.__post(payload)
     if is_full:
         return response
     return response['result']
Пример #4
0
 async def send_raw_transaction(self, tx: Transaction, is_full: bool = False) -> str:
     """
     This interface is used to send the transaction into the network.
     """
     tx_data = tx.serialize(is_hex=True)
     payload = self.generate_json_rpc_payload(RpcMethod.SEND_TRANSACTION, [tx_data])
     response = await self.__post(payload)
     if is_full:
         return response
     result = response['result']
     return dict() if result is None else result
Пример #5
0
 def send_raw_transaction_pre_exec(self,
                                   tx: Transaction,
                                   is_full: bool = False):
     """
     This interface is used to send the transaction that is prepare to execute.
     :param tx: Transaction object in ontology Python SDK.
     :param is_full: Whether to return all information.
     :return: the execution result of transaction that is prepare to execute.
     """
     tx_data = tx.serialize(is_hex=True)
     payload = self.generate_json_rpc_payload(RpcMethod.SEND_TRANSACTION,
                                              [tx_data, 1])
     response = self.__post(self._url, payload)
     if is_full:
         return response
     return response['result']
Пример #6
0
 def send_raw_transaction(self,
                          tx: Transaction,
                          is_full: bool = False) -> str:
     """
     This interface is used to send the transaction into the network.
     :param tx: Transaction object in ontology Python SDK.
     :param is_full:
     :return: a hexadecimal transaction hash value.
     """
     tx_data = tx.serialize(is_hex=True)
     payload = self.generate_json_rpc_payload(RpcMethod.SEND_TRANSACTION,
                                              [tx_data])
     response = self.__post(self._url, payload)
     if is_full:
         return response
     return response['result']