Implement x402-extensions crate with generic Extension<T>, bazaar, and sign-in-with-x extensions#10
Merged
takasaki404 merged 4 commits intomainfrom Mar 11, 2026
Conversation
…sionInfo trait, bazaar and sign-in-with-x extensions Co-authored-by: takasaki404 <193405421+takasaki404@users.noreply.github.com>
…ound and better panic messages Co-authored-by: takasaki404 <193405421+takasaki404@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement x402 extensions crate for PaymentRequirement
Implement Mar 4, 2026
x402-extensions crate with generic Extension<T>, bazaar, and sign-in-with-x extensions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Per the x402 v2 spec, extensions are a key-value map in
PaymentRequired/PaymentPayloadwhere each value hasinfo,schema, and optional extra fields. This PR introduces a typed extension system and implements thebazaar(resource discovery) andsign-in-with-xextensions.x402-core— Extension type refactoringExtensionbecomesExtension<T = AnyJson>— backward compatible, transport types unchangedextra: Record<AnyJson>with custom Serialize/Deserialize that flattens extra fields alongsideinfo/schemaExtensionInfotrait:const IDfor map key +fn schema()for compile-time JSON Schema generationExtensionMapInserttrait: ergonomicinsert_typed()onRecord<Extension>Extension::typed(),into_pair(),into_typed(),with_extra()x402-extensions— New cratebazaar:BazaarInfowith discriminated unionBazaarInput(Http|Mcptagged ontype),BazaarHttpInput(all HTTP methods),BazaarMcpInput(tool name, inputSchema, transport),BazaarOutput. Schema auto-generated viaschemars1.0.sign_in_with_x:SignInWithXInfo(domain, uri, nonce, timestamps, etc.) +SupportedChainhelper for thesupportedChainsextra field.x402-kit— Re-exportpub mod extensionsre-exportsx402-extensions.Usage
Users can implement their own extensions without upstream changes by implementing
ExtensionInfoon anyClone + 'statictype.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.