Esempio n. 1
0
    async def send_transaction(
        self, wallet_id: str, amount: uint64, address: str, fee: uint64 = uint64(0)
    ) -> TransactionRecord:

        res = await self.fetch(
            "send_transaction",
            {"wallet_id": wallet_id, "amount": amount, "address": address, "fee": fee},
        )
        return TransactionRecord.from_json_dict(res["transaction"])
 async def get_transaction(self, wallet_id: str,
                           transaction_id: bytes32) -> TransactionRecord:
     res = await self.fetch(
         "get_transaction",
         {
             "walled_id": wallet_id,
             "transaction_id": transaction_id.hex()
         },
     )
     return TransactionRecord.from_json_dict(res["transaction"])
Esempio n. 3
0
 async def get_transactions(
     self,
     wallet_id: str,
 ) -> List[TransactionRecord]:
     res = await self.fetch(
         "get_transactions",
         {"wallet_id": wallet_id},
     )
     reverted_tx: List[TransactionRecord] = []
     for modified_tx in res["transactions"]:
         # Server returns address instead of ph, but TransactionRecord requires ph
         modified_tx["to_puzzle_hash"] = decode_puzzle_hash(modified_tx["to_address"]).hex()
         del modified_tx["to_address"]
         reverted_tx.append(TransactionRecord.from_json_dict(modified_tx))
     return reverted_tx