Skip to content

fix(sweep): split sweep calls by owner address for correct WIF selection#82

Open
rohenaz wants to merge 1 commit intoomegafrom
fix/sweep-multi-address
Open

fix(sweep): split sweep calls by owner address for correct WIF selection#82
rohenaz wants to merge 1 commit intoomegafrom
fix/sweep-multi-address

Conversation

@rohenaz
Copy link
Member

@rohenaz rohenaz commented Feb 6, 2026

Summary

  • Ordinal sweep: Previously used a single WIF based on the first ordinal's owner address. If ordinals existed on both legacy pay and ord addresses, items on the secondary address would fail to sign. Now groups ordinals by owner and makes separate sweepOrdinals calls per group.
  • BSV-21 token sweep: Same fix -- within each tokenId group, further splits by owner address for separate sweepBsv21 calls.
  • BSV funding sweep: Was hardcoded to legacyPayWif despite scanLegacyAddresses merging funding UTXOs from both addresses. Now also groups by owner.
  • BSV-20 tokens: Confirmed intentionally omitted -- @1sat/actions does not expose a sweepBsv20 function.

The core change is a groupByOwner helper that partitions WalletOrdinal[] by the owner field. Each sweep function now iterates over these groups, selecting the correct WIF (legacyPayWif or legacyOrdWif) per group.

Test plan

  • Migration sweep with ordinals only on ord address (single group, same behavior as before)
  • Migration sweep with ordinals on both pay and ord addresses (two groups, two sweep calls)
  • Migration sweep with BSV-21 tokens split across addresses
  • Migration sweep with funding UTXOs on both addresses
  • Migration sweep with no assets (early return, unchanged)

The @1sat/actions sweep functions accept a single WIF per call. When
ordinals, BSV-21 tokens, or funding UTXOs exist on both legacy pay and
ord addresses, using a single WIF based on the first item's owner causes
signing failures for items on the other address.

Group all asset types by owner address before sweeping so each call
uses the correct WIF. Also fixes the same bug for BSV funding UTXOs,
which was hardcoded to legacyPayWif despite scanning both addresses.

BSV-20 token sweeping is intentionally omitted -- @1sat/actions does
not expose a sweepBsv20 function.
@vercel
Copy link
Contributor

vercel bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
1sat-website Ready Ready Preview, Comment Feb 6, 2026 8:03pm

Request Review

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.

1 participant