Repository navigation
Add Mastra pre-pay x402 check example - #6
Open
killdabeat91 wants to merge 1 commit into
Open
killdabeat91 wants to merge 1 commit into
killdabeat91 wants to merge 1 commit into
Conversation
|
👀 We've notified the reward creators here. |
This branch has not been deployed
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.
/claim #3
Adds a small runnable Mastra example at
examples/mastra-prepay-check/(README.md,package.json,src/index.ts) that checks an x402 endpoint before paying it.Summary
createTool(check402) that callsrunCheck402({ url })from@agent402-dev/ai-sdk-toolsand returns its result (one HTTP request without a payment header; nothing signed or paid; no wallet, key, or RPC read).Agentinstructions to report the price andfixescount, and not pay whenfixes > 0(or whenfixesisnull).examples/mastra-prepay-check/package.json.README.md.Versions tested
@mastra/core:1.87.0@agent402-dev/ai-sdk-tools:0.1.0zod:4.3.6tsx:4.23.15google/gemini-2.5-flashv24.12.0Local verification
npm install && npm run typecheck— passed with exit code0.https://agent402-tx-receipts.agent402-ebc.workers.dev/x402/receipts?signatures=5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW):http://127.0.0.1:4021/paidreturning HTTP402withoutPAYMENT-REQUIRED):