Skip to content

test(privy): live-chain + real-server end-to-end tests#25

Merged
Sentinel-Bluebuilder merged 1 commit into
masterfrom
feat/privy-live-tests
Apr 27, 2026
Merged

test(privy): live-chain + real-server end-to-end tests#25
Sentinel-Bluebuilder merged 1 commit into
masterfrom
feat/privy-live-tests

Conversation

@Sentinel-Bluebuilder
Copy link
Copy Markdown
Owner

Summary

Two opt-in, env-gated tests that prove the Privy adapter works against (a) Sentinel mainnet and (b) Privy's actual production API. Neither runs in CI.

What this verifies that mocks couldn't

  • Live mainnet broadcast with a Privy-shaped raw-sign callback — chain validators accepted the signature on a real `MsgSend`. Verified TX hash + height inline in the commit message.
  • Real Privy server round-trip — created a server-managed Cosmos wallet on Privy via REST, drove our `PrivyRawSignDirectSigner` with a callback that hits `POST /v1/wallets/{id}/raw_sign`, and confirmed the bytes Privy returns produce a cosmjs `SignDoc` signature that verifies against the Privy-derived 33-byte compressed pubkey.

Together with the existing mocked suites, the adapter now has 52 assertions covering the full stack.

Files added

  • `test/privy-live-chain.test.mjs` — `MNEMONIC=... npm run test:privy:live`
  • `test/privy-real-server.test.mjs` — `PRIVY_APP_ID=... PRIVY_APP_SECRET=... npm run test:privy:server`
  • `package.json` — adds `test:privy`, `test:privy:live`, `test:privy:server` scripts
  • `docs/PRIVY-INTEGRATION.md` — adds "Run the live suites" section

Distribution safety

  • `test/` is not in the `package.json` `files` allowlist, so these scripts don't ship in the npm tarball.
  • No hard-coded secrets; both files read from env. Pre-commit grep for known credentials: clean.

Test plan

  • `npm run test:privy` — 32/32 pass (offline, CI-safe)
  • `MNEMONIC=... npm run test:privy:live` — 7/7 pass (TX `4A6BA72A…F50C7E` at height 28097905)
  • `PRIVY_APP_ID=... PRIVY_APP_SECRET=... npm run test:privy:server` — 13/13 pass

Two opt-in tests, gated by env vars, not run in CI:

test/privy-live-chain.test.mjs (MNEMONIC=...):
  - Constructs SentinelClient with both Mode A (mnemonic) and Mode B (raw-sign)
    signers and queries getBalance() against mainnet RPC.
  - Broadcasts a real self-MsgSend(1 udvpn) signed by Mode B's raw-sign
    callback. Proves cosmos-sdk validators accept the signature shape the
    adapter produces (low-S, r||s, makeSignBytes-derived digest).
  - Verified mainnet TX 4A6BA72AA4AF6A05BE10E8037AF31A5B1D6378A520FB4C0F05BF9CDD6FF50C7E
    at height 28097905 — 7/7 assertions pass.

test/privy-real-server.test.mjs (PRIVY_APP_ID, PRIVY_APP_SECRET):
  - Hits Privy's real REST API: POST /v1/wallets {chain_type: cosmos}
    creates a server-managed wallet, then POST /v1/wallets/{id}/raw_sign
    backs the adapter's signRawSecp256k1 callback.
  - Verifies the cosmjs SignDoc signature the adapter assembles from Privy's
    response bytes verifies against the Privy-derived 33-byte compressed
    pubkey using @cosmjs/crypto. 13/13 assertions pass.

Also: added npm scripts test:privy / test:privy:live / test:privy:server
and a "Run the live suites" section in docs/PRIVY-INTEGRATION.md.

Files NOT shipped in npm package (test/ not in package.json files allowlist).
@Sentinel-Bluebuilder Sentinel-Bluebuilder merged commit 9facc75 into master Apr 27, 2026
2 checks passed
@Sentinel-Bluebuilder Sentinel-Bluebuilder deleted the feat/privy-live-tests branch April 27, 2026 10:45
@Sentinel-Bluebuilder Sentinel-Bluebuilder mentioned this pull request Apr 27, 2026
4 tasks
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