Skip to content

PR title: feat(creator-keys): add get_cooldown_remaining view (#1050) - #1077

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
Cmitchelle7:feat/1050-get-cooldown-remaining
Oct 18, 2026
Merged

Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
Cmitchelle7:feat/1050-get-cooldown-remaining

Conversation

@Cmitchelle7

Copy link
Copy Markdown
Contributor

Summary

Closes #1050.

The trade cooldown system merged into main covers set_cooldown, get_cooldown_status, per-(creator, wallet) enforcement in buy_key/sell_key, and the CooldownViolationEvent.seconds_remaining payload — verified against creator-keys/src/lib.rs:11221 and :11249.

This PR adds the one piece of the original issue text that isn't yet exposed: get_cooldown_remaining(key_id, wallet) -> u64 — a convenience view returning seconds until the cooldown expires (0 when inactive). Matches the name used in #1050 verbatim.

Changes

creator-keys/src/lib.rs

  • get_cooldown_remaining(key_id, wallet) — thin wrapper over get_cooldown_status that returns expires_at - now (0 when inactive or unconfigured)

creator-keys/tests/trade_cooldown.rs

  • test_get_cooldown_remaining_tracks_window — full duration → half → 0
  • test_get_cooldown_remaining_zero_when_unconfigured — 0 when no cooldown
  • test_get_cooldown_remaining_is_per_wallet — one wallet's timer doesn't affect another's

Test plan

  • 3 new tests appended to the existing trade_cooldown.rs
  • cargo test -p creator-keys trade_cooldown (CI will verify)

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@Cmitchelle7 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit 42d0750 into accesslayerorg:main Oct 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build cooldown enforcement contract between consecutive key trades

2 participants