Open
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c8fc5f4:
|
Contributor
|
any reason we haven't merged this yet? Definitely something I'd like to reference for some customers |
…g using verbatimModuleSyntax
…yments Add a new example demonstrating how AI agents can use Turnkey wallets to autonomously pay for x402-protected resources on Solana using Faremeter. - Headless auth via API keys (no browser/WebAuthn) - Wallet creation/retrieval using @turnkey/sdk-server + @turnkey/solana - Faremeter wrapFetch integration for automatic 402 payment handling - Follows existing repo conventions (env var naming, package.json shape)
…upport - Implement custom gasless payment handler for Echo server compatibility - Add v2 protocol support (accepted field, CAIP-2 network IDs) - Use correct Solana transaction structure (3 instructions) - Add USDC balance checking - Update README with accurate usage instructions
Track v2 payment context per transaction instead of global vars to prevent cross-request/race mismatches in adapted payment headers.
Extract protocol internals (gasless handler, v2 normalization) into x402-client.ts, exposing a single createX402Client() factory. This makes the agent integration pattern clearer in index.ts.
Include copy-paste snippets for OpenAI function calling, Anthropic tool use, and a generic agent pattern
…r payment handling
Bump @faremeter/* deps to ^0.17.0 and remove ~230 lines of protocol workaround code (normalizing fetch, adaptive v2 headers, CAIP-2 mapping) now handled natively by faremeter. Add partiallySignTransaction to wallet adapter per updated interface.
…phase1Fetch to patch PAYMENT-REQUIRED headers missing the resource object, which the Echo server doesn't include yet.
81736ee to
9ab8e96
Compare
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.
This PR adds a new
example/with-x402-faremeterflow for headless Solana x402 payments using Turnkey + Faremeter.What Changed
with-x402-faremeterexample with:@faremeter/fetch+@faremeter/payment-solana/exactresponse parsing, and CAIP-2 network identifier handling
patchV2Fetchworkaround for servers (e.g. Echo)that send a PAYMENT-REQUIRED header without the required
resourceobjectTest Plan
pnpm --filter @turnkey/example-with-x402-faremeter typecheckpnpm startinexamples/with-x402-faremeterwith:TEST_PAYWALL_URL=https://x402.payai.network/api/solana-devnet/paid-contentNote
Echo server uses gasless settlement semantics (server covers SOL fee);
Faremeter's exact payment handler supports this path directly via
extra.feePayer.