Skip to content

feat(solana): add guarded Pack Partner purchase signing - #655

Open
0xEdouardEth wants to merge 1 commit into
mainfrom
0xEdouardEth/collectibles-1-pack-partner-buy
Open

0xEdouardEth wants to merge 1 commit into
mainfrom
0xEdouardEth/collectibles-1-pack-partner-buy

Conversation

@0xEdouardEth

Copy link
Copy Markdown
Contributor

Explanation

Add signPackPartnerBuy to the MetaMask-only client entrypoint so Collectibles can sign the exact user-confirmed USDC purchase without another confirmation screen. The existing handler resolves the keyring account and delegates through WalletService to a stateless PackPartnerSigner. The Snap returns signed bytes and the transaction signature; Mobile owns broadcasting, pack opening and recovery.

Require a valid partner presignature, the configured mainnet/devnet authorities and USDC mint, a positive base-unit amount, the exact user debit and bounded fees. Validate the instruction allowlist and simulated account effects before deriving the user's key. A sponsored user need not hold SOL. Policy overrides, unconfigured networks and dapp/keyring/multichain access are rejected. Client logs retain the method name without logging transaction parameters.

This is part 1 of 4. No buyback method or NFT validator is enabled in this PR. Read the README contract, then PackPartnerSigner.ts, followed by its purchase tests and client/entrypoint tests.

Validation

  • 341 targeted tests passed. Covers the available Pack Partner guards, client request handlers, WalletService and entrypoint boundaries.
  • Package TypeScript check, Snap build, changed-file Oxlint/formatting and changelog validation passed.
  • Tests use synthetic keys and mocked RPC. No live purchase, buyback or fund transfer was performed.

References

  • Part 1/4 of the Pack Partner signing stack. Base: main.
  • Original implementation: 0xEdouardEth/pack-partner-guarded-signing (preserved for comparison).
  • Contract and invariants: packages/solana-wallet-snap/README.md, “Pack Partner signing (MetaMask client only)”.
Order Branch Scope
1 0xEdouardEth/collectibles-1-pack-partner-buy Purchase and common guards

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

No breaking changes; the signing capabilities are additive.

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

## Explanation

Add `signPackPartnerBuy` to the MetaMask-only client entrypoint so Collectibles can sign the exact user-confirmed USDC purchase without another confirmation screen. The existing handler resolves the keyring account and delegates through `WalletService` to a stateless `PackPartnerSigner`. The Snap returns signed bytes and the transaction signature; Mobile owns broadcasting, pack opening and recovery.

Require a valid partner presignature, the configured mainnet/devnet authorities and USDC mint, a positive base-unit amount, the exact user debit and bounded fees. Validate the instruction allowlist and simulated account effects before deriving the user's key. A sponsored user need not hold SOL. Policy overrides, unconfigured networks and dapp/keyring/multichain access are rejected. Client logs retain the method name without logging transaction parameters.

This is part 1 of 4. No buyback method or NFT validator is enabled in this PR. Read the README contract, then `PackPartnerSigner.ts`, followed by its purchase tests and client/entrypoint tests.

### Validation

- 341 targeted tests passed. Covers the available Pack Partner guards, client request handlers, WalletService and entrypoint boundaries.
- Package TypeScript check, Snap build, changed-file Oxlint/formatting and changelog validation passed.
- Tests use synthetic keys and mocked RPC. No live purchase, buyback or fund transfer was performed.

## References

- Part 1/4 of the Pack Partner signing stack. Base: `main`.
- Original implementation: `0xEdouardEth/pack-partner-guarded-signing` (preserved for comparison).
- Contract and invariants: `packages/solana-wallet-snap/README.md`, “Pack Partner signing (MetaMask client only)”.

| Order | Branch | Scope |
| --- | --- | --- |
| 1 | `0xEdouardEth/collectibles-1-pack-partner-buy` | Purchase and common guards |
| 2 | `0xEdouardEth/collectibles-2-pack-partner-cnft-core` | Buyback and Bubblegum V2 compressed NFTs |
| 3 | `0xEdouardEth/collectibles-3-pack-partner-core` | Metaplex Core buybacks |
| 4 | `0xEdouardEth/collectibles-4-pack-partner-nft-pnft` | Token Metadata classic NFT and pNFT buybacks |

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking changes](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

No breaking changes; the signing capabilities are additive.
@0xEdouardEth
0xEdouardEth requested review from a team as code owners November 19, 2026 11:30
@0xEdouardEth
0xEdouardEth deployed to default-branch November 19, 2026 11:30 — with GitHub Actions Active
@github-actions github-actions Bot added the size-XL size-XL label Nov 19, 2026
@sonarqubecloud

Copy link
Copy Markdown

This branch was successfully deployed

1 active deployment
default-branch — 8885d2ac Deployed Nov 19, 2026 by 0xEdouardEth via Determine whether this PR is a release PR #2523
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-XL size-XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant