File size: 1,175 Bytes
c79f28f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import argparse
from datetime import datetime, timezone
from aws_qldb import qldb_manager
def _current_period_utc() -> str:
"""Devuelve el período actual en formato YYYY-MM (UTC)."""
now = datetime.now(timezone.utc)
return now.strftime("%Y-%m")
def main() -> None:
parser = argparse.ArgumentParser(
description=(
"Publica el digest mensual de autorizaciones en Polygon "
"usando aws_qldb.qldb_manager (modo simulado por ahora)."
)
)
parser.add_argument(
"--period",
type=str,
default=None,
help="Período en formato YYYY-MM (por defecto mes actual en UTC)",
)
args = parser.parse_args()
period = args.period or _current_period_utc()
print(f"[DIGEST] Publicando digest para el período {period}...")
tx_hash = qldb_manager.publish_monthly_digest_to_polygon(period)
if tx_hash:
print(f"[DIGEST] Digest publicado correctamente. Tx hash: {tx_hash}")
else:
print("[DIGEST] No se ha publicado ningún digest (posiblemente sin datos para ese período).")
if __name__ == "__main__":
main()
|