Skip to content

Commit

Permalink
Merge pull request #118 from Chia-Network/log/add_cat_wallet_log
Browse files Browse the repository at this point in the history
Log/add cat wallet log
  • Loading branch information
MichaelTaylor3D authored Oct 11, 2023
2 parents db8067b + c2e01b6 commit 328e697
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions app/api/v1/tokens.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json;

from typing import Any, Dict, Tuple

from blspy import G1Element, G2Element
Expand All @@ -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()

Expand Down Expand Up @@ -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,
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"Chia Network Inc <[email protected]>"]
Expand Down

0 comments on commit 328e697

Please sign in to comment.