Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ICRC-72 Subscriber for Motoko

A reusable Motoko component for receiving ICRC-72 event notifications, managing subscriptions and replays, batching confirmations, and optionally participating in ICRC-85 open value sharing.

Install

mops add icrc72-subscriber-mo
import Subscriber "mo:icrc72-subscriber-mo";

The package uses the ClassPlus and migration patterns for stable state management. See example/ for integration wiring.

This is alpha software. Use it at your own risk.

Features

  • Subscription registration and updates
  • Notification processing with persistent out-of-order backlogs
  • Broadcaster authorization and validation
  • Retryable, cycle-funded confirmation batches
  • Synchronous and asynchronous execution listeners
  • ICRC-77 replay registration and status support
  • ICRC-85 open value sharing

Initialization

Initialize the component through its ClassPlus-compatible Init function, supplying an initialization manager, stable state, arguments, environment loader, initialization callback, and storage-change callback. The environment provides application-specific record, ordering, pricing, and subscription-readiness handlers.

Register notification handlers with registerExecutionListenerSync or registerExecutionListenerAsync. Subscription operations and statistics are exposed by registerSubscriptions, updateSubscription, and stats.

ICRC-85

The default open-value-sharing behavior funds continued maintenance. Applications may override or disable the sharing configuration under ICRC-85. The default calculation starts at 1 XDR per month and adds 1 XDR per 10,000 processed actions, capped at 100 XDR. The default beneficiary is the ICDevs.org collector configured by the package.

Development

mops install
dfx build --check example
mops bench

The saved benchmark compares the collection types used for notification and confirmation batching.

See BENCHMARKS.md for results and the collection-choice rationale.

License

MIT. Copyright ICDevs.org.

About

Motoko ICRC-72 subscriber component

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages