Skip to content

feat(claim): Path A polish — auto-derive destinationWallet + human-readable amount#288

Merged
rz1989s merged 5 commits into
mainfrom
feat/issue-286-claim-path-a-polish
May 17, 2026
Merged

feat(claim): Path A polish — auto-derive destinationWallet + human-readable amount#288
rz1989s merged 5 commits into
mainfrom
feat/issue-286-claim-path-a-polish

Conversation

@rz1989s
Copy link
Copy Markdown
Member

@rz1989s rz1989s commented May 17, 2026

Summary

Closes #286. Two small polish features for the Path A claim flow shipped in #281:

  1. Auto-derive destinationWallet from the user's spending pubkey when omitted. ClaimParams.destinationWallet is optional again; Anthropic schema's required array drops it; schema description restored to "Defaults to the spending pubkey". Path A's runtime gap (helper threw if omitted) is closed by actually deriving the pubkey via @noble/curves/ed25519.getPublicKey.

  2. Human-readable amount display in the claim result message. Instead of "Claimed payment X... → claim tx Y... (1000000 units to Z...)", the message now reads "... (1.5 SOL to Z...)" or "... (1 USDC to Z...)" or "... (1 EPjF...Dt1v to Z...)" for unknown SPL mints. Uses @sipher/sdk's existing getTokenDecimals + fromBaseUnits for the math; inline tokenSymbol private helper handles the SOL/USDC/USDT lookup with prefix-suffix fallback.

Test plan

  • tests/tools/claim-helpers.test.ts — +9 new tests (4 for deriveDestinationFromSpending, 5 for formatClaimAmount)
  • tests/claim.test.ts — +1 new auto-derive happy-path test; 4 input-validation tests dropped destinationWallet (no longer required); 1 tool-definition assertion updated; 1 message-truncation assertion extended for human-readable amount
  • Full agent suite: 1622 passed | 2 skipped (1624) (was 1612 baseline at feat(claim): Phase 2 Path A — SDK-driven claim flow with claim-tx-sig attribution #281 merge — +10 net new)
  • Workspace typecheck clean across all 4 projects (root + app + sdk + agent)
  • All commits GPG-signed, conventional prefixes, no AI attribution
  • consolidate.ts unchanged — still passes destinationWallet: params.wallet (optional ≠ rejected)

Scope notes

  • Token decimals for unknown SPL mints use SDK's default of 9 (accurate for SOL/USDC/USDT/most SPL, imprecise for low-decimal exotics — documented in helper JSDoc)
  • Token symbol mapping is inline in claim-helpers.ts private helper; SDK-level getTokenSymbol export deferred (not needed by other tools today)
  • Stealth keypair memory zeroization still tracked as a cross-cutting follow-up under Path A scope notes

Verification

Pre-deploy: https://sipher-api.sip-protocol.org/admin/api/torque/status remains { enabled: true, network: 'devnet', ingesterReachable: true }.

Post-deploy: trigger a claim from sipher chat — omit destinationWallet from the tool input and verify the funds land at the user's main wallet (the spending pubkey). Verify the chat message displays e.g. "1 USDC" instead of "1000000 units".

References

rz1989s added 5 commits May 17, 2026 09:35
Auto-derive destinationWallet from spending pubkey + human-readable
amount formatting in chat message. Single PR scope ~1-1.5hr per the
brainstorming + spec process.

Closes the Path A scope-limit where destinationWallet was made required
to satisfy the type system + opaque 'units' chat display. New helpers
land in claim-helpers.ts alongside resolveStealthContext. Uses existing
@noble/curves/ed25519 + @sipher/sdk's getTokenDecimals/fromBaseUnits
primitives — no new dependencies.
…nto executeClaim

- ClaimParams.destinationWallet optional again (auto-derive from spending pubkey)
- claimTool schema: drop destinationWallet from required, restore 'Defaults to spending pubkey' description
- executeClaim body: auto-derive via deriveDestinationFromSpending on omission
- result message: format amount as '1.5 SOL' / '1 USDC' / '<x> XXXX...YYYY' via formatClaimAmount
- claim.test.ts: drop destinationWallet from input-validation tests, add auto-derive happy-path test, extend message-truncation assertion
@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

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

Project Deployment Actions Updated (UTC)
sipher Ready Ready Preview, Comment May 17, 2026 2:40pm

@rz1989s rz1989s merged commit d651189 into main May 17, 2026
8 checks passed
@rz1989s rz1989s deleted the feat/issue-286-claim-path-a-polish branch May 17, 2026 15:05
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.

feat(claim): Path A polish — auto-derive destinationWallet + human-readable amount in chat message

1 participant