Paymaster proxy example#46
Open
bobo-k2 wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Next.js API route in the testapp that proxies Startale Cloud Services (SCS) paymaster requests so paymaster secrets (API key / paymaster ID) remain server-side, and updates the example app + CI to use it (including Cloudflare tunnel exposure for e2e against prod SuperApp).
Changes:
- Add
/api/paymaster/[chainId]proxy route that injectspaymasterIdinto ERC-7677 paymaster JSON-RPC calls and forwards to SCS using server-side env vars. - Update the testapp SDK setup to point
paymasterOptionsat the proxy route (with an optional public base URL override). - Adjust Next config to make
output: 'export'opt-in, add env example, and update e2e workflow to support sponsored tests via a Cloudflare tunnel.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/testapp/src/pages/api/paymaster/[chainId].page.ts | Implements the server-side paymaster proxy and paymasterId injection. |
| examples/testapp/src/context/EIP1193ProviderContextProvider.tsx | Switches the SDK paymaster URL to the same-origin/public proxy route. |
| examples/testapp/next.config.mjs | Makes static export opt-in so API routes can run by default. |
| examples/testapp/.env.local.example | Documents required env vars for the paymaster proxy setup. |
| .github/workflows/e2e-tests.yaml | Adds tunnel + paymaster env wiring for sponsored e2e flows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
This PR brings example on how to proxy paymaster and provide paymaster url to Startale app SDK
Proxying is important to hide paymaster secrets.
App developers still needs to set up a proper paymaster policy since the paymaster URL is visible to all app users.
How did you test your changes?