From 175c434a96b70254eb2a26c9408caf91205994ca Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Wed, 11 Oct 2023 15:48:07 -0400 Subject: [PATCH 1/2] chore: add logging when creating permissionless retirement --- app/api/v1/tokens.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/api/v1/tokens.py b/app/api/v1/tokens.py index 31cdba7..ba8d7c9 100644 --- a/app/api/v1/tokens.py +++ b/app/api/v1/tokens.py @@ -1,3 +1,5 @@ +import json; + from typing import Any, Dict, Tuple from blspy import G1Element, G2Element @@ -14,6 +16,7 @@ from app.core.climate_wallet.wallet import ClimateWallet from app.core.types import ClimateTokenIndex, GatewayMode from app.utils import disallow +from app.logger import logger router = APIRouter() @@ -302,6 +305,22 @@ async def create_permissionless_retirement_tx( wallet_client=wallet_rpc_client, ) + # Create a dictionary with the variables you want to log + log_data = { + "amount": payment.amount, + "fee": payment.fee, + "beneficiary_name": payment.beneficiary_name.encode(), + "beneficiary_address": payment.beneficiary_address.encode(), + "beneficiary_puzzle_hash": payment.beneficiary_puzzle_hash, + "wallet_id": cat_wallet_info.id + } + + # Convert the dictionary to a JSON-formatted string + log_data_json = json.dumps(log_data) + + # Log the JSON-formatted string + logger.warning(log_data_json) + result: Dict = await wallet.send_permissionless_retirement_transaction( amount=payment.amount, fee=payment.fee, @@ -310,6 +329,7 @@ async def create_permissionless_retirement_tx( beneficiary_puzzle_hash=payment.beneficiary_puzzle_hash, wallet_id=cat_wallet_info.id, ) + (transaction_record, *_) = result["transaction_records"] return schemas.PermissionlessRetirementTxResponse( From c2e01b6b2a35db3ed61cca7b78af8e26fb1d925e Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Wed, 11 Oct 2023 15:48:32 -0400 Subject: [PATCH 2/2] chore: bump to 1.0.31 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7f01f4b..b0c6f30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "Chia Climate Token Driver" -version = "1.0.30" +version = "1.0.31" description = "https://github.com/Chia-Network/climate-token-driver" authors = ["Harry Hsu ", "Chia Network Inc "]