Python API
These helpers are importable from robopay_core in your own nodes. None of
them handle keys; keys stay inside payment_node.
EscrowClient
robopay_core.client.EscrowClient wraps the escrow action and the signing
services so a node can run an escrow in a few lines.
from robopay_core.client import EscrowClient
escrow = EscrowClient(node)
EscrowClient(node)Create a client bound to your node. Uses the node’s namespace.
open(payer, payee, amount, timeout_seconds, on_done=None)Send the escrow goal. Returns an
EscrowHandleimmediately.on_doneis called with the action result when the escrow finishes.sign(escrow_id, role)Sign the release as
"payer"or"payee".cancel(handle)Cancel the action goal. This stops waiting; locked funds still follow the contract rules (release with both signatures, or refund after the deadline).
EscrowHandle
escrow_idThe on-chain escrow id, available once the deposit confirms.
stateThe latest state reported in action feedback.
Note
Do not store the handle in an attribute named handle on your node.
handle is reserved by rclpy.node.Node. Use escrow_handle or similar.
Triggers
robopay_core.triggers contains plain Python helpers for safe repeated
triggering. See Condition-triggered payments.
EdgeTrigger()fired(value)returnsTrueonly whenvaluegoes from false to true.RateLimit(max_events, window_seconds)allow()returnsTrueif another event fits in the rolling window, and records it.CooldownAllows an event only after a minimum time since the last one.
DebounceFires only after a condition has held continuously for a set time.
All four accept an injectable clock, so tests can advance time without sleeping.
Invoices
robopay_core.invoice.Invoice builds and checks PaymentRequest data.
Invoice.create(...)Build an invoice with a fresh request id.
Invoice.parse(msg)Turn a received
PaymentRequestmessage into anInvoice.validate()Check addresses, amount, and asset. Raises
InvalidInvoiceon bad input.
An invoice is data. Nothing in this module sends money.
Spending limits
robopay_core.spending_limits.SpendingLimits is the cap logic the node uses.
It is exposed for testing and for tools that want to show remaining budget.
SpendingLimits(max_per_transaction="10", max_per_window="50", window_seconds=3600)Amounts are decimal strings.
check(amount)Raises
SpendingLimitExceededif the amount breaks either cap.spent_in_window()Total spent in the current window.