Exemplo n.º 1
0
 async def send_transaction(self, transaction):
     chain_tag = int((await thor.get_block(0))["hash"][-2:], 16)
     blk_ref = int(strip_0x((await thor.get_block("best"))["hash"])[:8], 16)
     tx = ThorTransaction(chain_tag, blk_ref, transaction)
     tx.sign(self.account_manager.get_priv_by_addr(transaction["from"]))
     raw = "0x{}".format(encode_hex(rlp.encode(tx)))
     return await self.send_raw_transaction(raw)
Exemplo n.º 2
0
 def send_transaction(self, transaction):
     tx = ThorTransaction(self, transaction)
     tx.sign(
         self.account_manager.get_priv_by_addr(
             force_obj_to_bytes(transaction["from"])))
     data = {"raw": "0x{}".format(encode_hex(rlp.encode(tx)))}
     result = self.transaction(None)(post, data=data)
     return None if result is None else result["id"]
Exemplo n.º 3
0
 def send_transaction(self, transaction):
     tx = ThorTransaction(self, transaction)
     tx.sign(self.account_manager.get_priv_by_addr(transaction["from"]))
     data = {
         "raw": "0x{}".format(encode_hex(rlp.encode(tx)))
     }
     result = self.transactions.make_request(post, data=data)
     return _attribute(result, "id")
Exemplo n.º 4
0
 def sign_transaction(self, transaction, from_key):
     tx = ThorTransaction(self, transaction)
     tx.sign(from_key)
     return "0x{}".format(encode_hex(rlp.encode(tx)))