Referência de funções
Godot 4 · GDScript · Currency & store
get_ledger
Fetches recent currency ledger entries for this player, newest first.
Asynchronous (result via signal)
Signature
get_ledger(limit: int = 50, offset: int = 0) -> voidWhat it does
GETs /currency/ledger?limit&offset (session-auth); limit/offset travel in the query string, not the body. entries is an Array of Dictionary, each a ledger row { id, currency_id, delta, balance_after, op_type, ref_kind, ref_value, idempotency_key, metadata, created_at }, newest first. Emits [] on failure or no active session.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| limit | int | 50 | How many entries to return; clamped to 1..200. |
| offset | int | 0 | How many entries to skip, for paging; floored at 0. |
How to call it
Connect ledger_loaded first, then call get_ledger(). Pass limit/offset to page through history.
Result signal: ledger_loaded(entries: Array)
Example
Gamdato.ledger_loaded.connect(_on_ledger)
Gamdato.get_ledger()
func _on_ledger(entries: Array) -> void:
for e in entries:
print("%s %+d -> %d" % [e.op_type, e.delta, e.balance_after])Use cases
- Show a transaction history of grants, purchases, and top-ups.
- Page through older currency movements with limit and offset.