Skip to content

Releases: icdevsorg/icrc2.mo

ReRelease

24 Feb 22:14

Choose a tag to compare

[0.2.0] - 2026-02-24

Added

  • Mixin pattern (mo:icrc2-mo/ICRC2/mixin) for automatic endpoint generation using persistent actor class and Class+
  • Inspect module (mo:icrc2-mo/ICRC2/Inspect) for cycle drain protection with two-layer defense:
    • inspect* functions (return Bool) for use in system func inspect()
    • guard* functions (trap on invalid) for inter-canister protection
    • Built-in guards in mixin for icrc2_approve, icrc2_transfer_from, icrc2_allowance, icrc103_get_allowances, icrc130_get_allowances
    • Configurable limits via Config type and configWith() helper (includes maxTake for pagination)
  • Interface module (mo:icrc2-mo/ICRC2/Interface) with extensible before/after hooks for all ICRC-2 endpoints
  • ICRC-21 consent message support: consent builders for icrc2_approve and icrc2_transfer_from
  • ICRC-130 alias endpoint that mirrors ICRC-103 get_allowances functionality
  • Timer-based cleanup: cleanup_interval InitArgs option for automatic periodic removal of expired approvals
  • Balance-aware cleanup: cleanup_on_zero_balance InitArgs option removes approvals when account balance reaches zero
  • Configurable ICRC-103: icrc103_max_take_value (default: 1000) and icrc103_public_allowances (default: true) options
  • defaultMixinArgs() helper for ergonomic mixin configuration with with syntax
  • Complete README with mixin usage examples, inspect documentation, API reference tables, and migration guide
  • Comprehensive Phase 2 test suite: 20 new PocketIC tests for concurrent approvals, expiration, boundaries, ICRC-103, fees, and cleanup
  • Performance benchmarks for approval storage, lookup, and pagination operations

Fixed

  • Index iterator bug: getIndex now properly handles prev parameter by finding the correct starting position in the approval map
  • ICRC-103 access control bug: getAllowances() was checking isPrivate = icrc103_public_allowances instead of not icrc103_public_allowances, causing public mode to behave like private mode
  • Double fee collection bug in transfer_from: the fee was being transferred to the fee_collector twice — once via handleFeeCollector() and again via an explicit transfer_balance() call

Changed

  • Set all debug channels to false for production safety
  • Removed icrc2_trigger_cleanup from public mixin interface (still available via lib.mo for advanced users)