Skip to content

refactor: move walletId to v2 activity models #112

Description

@ovitrif

Problem

walletId was added to the current v1 activity models. That changes the v1 schema without changing the version.

This has not shipped to production mobile users yet, so we can still fix the model before Android and iOS integrate it as stable behavior.

Requested change

Move walletId to the next activity model version.

  • Keep the existing LightningActivityV1 and OnchainActivityV1 payloads unchanged.
  • Add LightningActivityV2 and OnchainActivityV2 with walletId.
  • Treat v1 activities as default-wallet activities when Core migrates or imports them.
  • Store new wallet-scoped activity data as the latest activity model version.
  • Keep lookup, list, delete, tags, seen state, and transaction details wallet-scoped without making v1 JSON invalid.

API and search invariants

Moving walletId to v2 should not leave callers dealing with a mixed v1/v2 activity set.

  • Public search/list/detail APIs should return the canonical/latest activity shape after migration, not both old and new versions of the same logical activity.
  • Wallet-scoped APIs should not silently fall back to raw id or txid searches across wallet scopes.
  • Activity identity should be consistently scoped by (walletId, activityId) once data is migrated.
  • If Core keeps versioned enum variants internally, queries must still dedupe or normalize so callers do not see duplicate v1/v2 entries.
  • Tests should cover a v1 and v2 activity with the same raw id and verify wallet-scoped lookup/list/search returns only the expected current record.

Migration expectation

The storage and backup migration details belong in:

Acceptance criteria

  • walletId is not required on v1 activity payloads.
  • New wallet-scoped activities serialize as a versioned model that includes walletId.
  • Old v1 activity JSON without walletId decodes successfully.
  • Wallet-scoped APIs treat imported/migrated v1 activities as default-wallet activities.
  • Public queries do not return mixed or duplicate v1/v2 entries for the same logical activity.
  • Tests cover old v1 decode, v2 hardware-wallet activity creation, and mixed v1/v2 search behavior.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions