feat(claim): Path A polish — auto-derive destinationWallet + human-readable amount#288
Merged
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #286. Two small polish features for the Path A claim flow shipped in #281:
Auto-derive
destinationWalletfrom the user's spending pubkey when omitted.ClaimParams.destinationWalletis optional again; Anthropic schema'srequiredarray 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.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 existinggetTokenDecimals+fromBaseUnitsfor the math; inlinetokenSymbolprivate helper handles the SOL/USDC/USDT lookup with prefix-suffix fallback.Test plan
tests/tools/claim-helpers.test.ts— +9 new tests (4 forderiveDestinationFromSpending, 5 forformatClaimAmount)tests/claim.test.ts— +1 new auto-derive happy-path test; 4 input-validation tests droppeddestinationWallet(no longer required); 1 tool-definition assertion updated; 1 message-truncation assertion extended for human-readable amountconsolidate.tsunchanged — still passesdestinationWallet: params.wallet(optional ≠ rejected)Scope notes
claim-helpers.tsprivate helper; SDK-levelgetTokenSymbolexport deferred (not needed by other tools today)Verification
Pre-deploy:
https://sipher-api.sip-protocol.org/admin/api/torque/statusremains{ enabled: true, network: 'devnet', ingesterReachable: true }.Post-deploy: trigger a claim from sipher chat — omit
destinationWalletfrom 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
docs/superpowers/specs/2026-05-17-claim-path-a-polish-design.mddocs/superpowers/plans/2026-05-17-claim-path-a-polish-plan.md