Skip to content

TODO: Implement roll_over_proofs() for NIP-60 state transitions #19

@shroominic

Description

@shroominic

TODO Location

sixty_nuts/wallet.py:824

Priority

🔴 High Priority - Core functionality that blocks essential features

Current Code

async def roll_over_proofs(
    self,
    *,
    spent_proofs: list[ProofDict],
    unspent_proofs: list[ProofDict],
    deleted_event_ids: list[str],
) -> str:
    """Roll over unspent proofs after a partial spend and return new token id."""
    # TODO: Implement roll over logic
    return ""

What needs to be done

  • Implement the logic for NIP-60 proof rollovers when only some proofs from a token event are spent
  • Create a new token event containing only the unspent proofs
  • Mark the old token event as superseded using the del field
  • Return the new token event ID
  • This is critical for proper state transitions and preventing double-spending

Implementation details

  1. Convert unspent proofs to NIP-60 format (base64 secrets)
  2. Create new token event with del field pointing to old event IDs
  3. Publish to relays using EventManager
  4. Handle errors gracefully to prevent proof loss

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions