token: add spending-condition inspection helpers and token_secrets() #1124

Merged
a1denvalu3 merged 11 commits from token-info into main 2025-09-26 19:56:01 +00:00
a1denvalu3 commented 2025-09-25 13:58:22 +00:00 (Migrated from github.com)

Description

This PR adds a lightweight API to inspect SpendingConditions directly from a Token and without requiring Mint keysets:

  • New helpers on Token:
    • spending_conditions
    • p2pk_pubkeys
    • p2pk_refund_pubkeys
    • htlc_hashes
    • locktimes
  • New token_secrets() unifies V3/V4 proof traversal and removes code duplication.
  • Bypasses short→long keyset-id mapping since only Secret is needed for condition parsing.
  • Improves DX: external users can extract P2PK and HTLC metadata without mint context.
### Description This PR adds a lightweight API to inspect `SpendingConditions` directly from a `Token` and without requiring Mint keysets: - New helpers on Token: - `spending_conditions` - `p2pk_pubkeys` - `p2pk_refund_pubkeys` - `htlc_hashes` - `locktimes` - New token_secrets() unifies V3/V4 proof traversal and removes code duplication. - Bypasses short→long keyset-id mapping since only Secret is needed for condition parsing. - Improves DX: external users can extract P2PK and HTLC metadata without mint context.
thesimplekid commented 2025-09-25 18:03:45 +00:00 (Migrated from github.com)

as @davidcaseria said we should also add these to cdk-ffi.

I wonder about the hashset as the return type is that handled well my uniffi? Should we just make it a list and convert from hashset to list internally to make it a unique list. These are also going to be small lists so can probably avoid the hashset all together and just do a contains check.

as @davidcaseria said we should also add these to cdk-ffi. I wonder about the hashset as the return type is that handled well my uniffi? Should we just make it a list and convert from hashset to list internally to make it a unique list. These are also going to be small lists so can probably avoid the hashset all together and just do a contains check.
a1denvalu3 commented 2025-09-26 17:54:39 +00:00 (Migrated from github.com)

@thesimplekid addressed

@thesimplekid addressed
thesimplekid (Migrated from github.com) approved these changes 2025-09-26 19:55:38 +00:00
cdk-bot commented 2025-10-28 16:59:23 +00:00 (Migrated from github.com)

Successfully created backport PR for v0.13.x:

Successfully created backport PR for `v0.13.x`: - #1236
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk!1124
No description provided.