Skip to content

refactor(keychain): add with_selector, recipients, set/remove allowed calls#43

Merged
grandizzy merged 4 commits intomainfrom
rusowsky/keychain-review-feedback
Apr 7, 2026
Merged

refactor(keychain): add with_selector, recipients, set/remove allowed calls#43
grandizzy merged 4 commits intomainfrom
rusowsky/keychain-review-feedback

Conversation

@decofe
Copy link
Copy Markdown
Member

@decofe decofe commented Apr 7, 2026

Port review feedback from tempoxyz/tempo#3469 to pytempo.

Changes

  • Add SelectorRule dataclass with recipient filtering (matches ABI's SelectorRule struct)
  • Add CallScope.with_selector() for arbitrary 4-byte selectors (parity with Rust CallScopeBuilder::with_selector)
  • Add recipients param to transfer(), approve(), transfer_with_memo() constructors
  • Add CallScope.to_abi_tuple() for clean ABI encoding with backwards-compat fallback

Testing

uv run ruff check . && uv run ruff format --check .  # clean
uv run pytest tests/ -v  # 124 passed, 36 skipped

Prompted by: rusowsky

… calls

Port review feedback from tempoxyz/tempo#3469:
- Add SelectorRule with recipient filtering
- Add CallScope.with_selector() for arbitrary 4-byte selectors
- Add recipients param to transfer/approve/transfer_with_memo constructors
- Add CallScope.to_abi_tuple() for ABI encoding
- Add AccountKeychain.set_allowed_calls and remove_allowed_calls
- Guard authorize_key against conflicting allow_any_calls + allowed_calls

Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d67e0-6ede-72ec-9fb0-da8cd59bed75
@0xrusowsky 0xrusowsky marked this pull request as ready for review April 7, 2026 12:37
@0xrusowsky 0xrusowsky requested a review from onbjerg April 7, 2026 12:37
decofe and others added 2 commits April 7, 2026 12:56
Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d67e0-6ede-72ec-9fb0-da8cd59bed75
@0xrusowsky 0xrusowsky requested a review from grandizzy April 7, 2026 13:09
@grandizzy grandizzy merged commit 257d2bd into main Apr 7, 2026
12 checks passed
@grandizzy grandizzy deleted the rusowsky/keychain-review-feedback branch April 7, 2026 13:41
@github-actions github-actions bot mentioned this pull request Apr 7, 2026
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.

4 participants