-
Notifications
You must be signed in to change notification settings - Fork 17
Add mega-mpp-sdk skill routing #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
moldy93
wants to merge
3
commits into
0xBreadguy:main
Choose a base branch
from
moldy93:codex/add-mega-mpp-sdk-skill-routing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # `@moldy/mega-mpp-sdk` | ||
|
|
||
| Thin integration guide for a MegaETH Machine Payments Protocol SDK. | ||
|
|
||
| Use this file when the user: | ||
| - explicitly names `@moldy/mega-mpp-sdk` | ||
| - wants MPP-compatible paid routes on MegaETH | ||
| - needs reusable `session` payment channels, not just one-shot x402 | ||
|
|
||
| Do not use this file for every paid API task: | ||
| - use [x402-payments.md](x402-payments.md) for raw Permit2 / x402 proxy integrations without this SDK | ||
| - use [meridian.md](meridian.md) when settlement goes through Meridian's facilitator and `/v1/settle` | ||
|
|
||
| This file covers the current `@moldy/mega-mpp-sdk` integration path. If the | ||
| MegaETH / MPP ecosystem later standardizes on a different recommended SDK, | ||
| update this routing. | ||
|
|
||
| ## Public package entrypoints | ||
|
|
||
| Use only these imports: | ||
|
|
||
| ```ts | ||
| import { Mppx, Store, megaeth } from "@moldy/mega-mpp-sdk/server"; | ||
| import { Mppx as ClientMppx, megaeth as megaethClient } from "@moldy/mega-mpp-sdk/client"; | ||
| import { megaethMainnet, megaethTestnet } from "@moldy/mega-mpp-sdk/chains"; | ||
| ``` | ||
|
|
||
| Do not import internal files from the SDK repo. | ||
|
|
||
| ## Choose the flow | ||
|
|
||
| - Default to `charge` for one payment per protected request. | ||
| - Use `session` only when the caller explicitly needs a reusable funded channel across many requests. | ||
| - For `charge`, keep `submissionMode` omitted unless the user needs `sync` or `sendAndWait`. Omitted means `realtime`. | ||
| - For server-broadcast `charge` and all `session` flows, keep the settlement wallet and `recipient` aligned. | ||
|
|
||
| ## What must stay explicit | ||
|
|
||
| Always keep these values explicit: | ||
| - `chainId` | ||
| - `recipient` | ||
|
|
||
| Use published values instead of guessing: | ||
|
|
||
| | Network | Chain ID | RPC | Charge Token | Permit2 | Session Escrow | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | Mainnet | `4326` | `https://mainnet.megaeth.com/rpc` | USDm `0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7` | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | bring your own | | ||
| | Testnet | `6343` | `https://carrot.megaeth.com/rpc` | USDC `0x75139a9559c9cd1ad69b7e239c216151d2c81e6f` | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `0xD83A68408539868e5f48D0E93537f56afBB9d512` | | ||
|
|
||
| Do not invent a mainnet session escrow address. Mainnet `session` requires a deployed or user-provided escrow contract. | ||
|
|
||
| ## Cloudflare Worker path | ||
|
|
||
| Cloudflare Workers are a first-class supported runtime for this SDK. | ||
|
|
||
| When the integration target already lives on Cloudflare: | ||
| - keep the payment backend inside the Worker boundary | ||
| - keep replay and session state in a shared store such as Durable Objects | ||
| - do not create a fresh in-memory store per request for live paid routes | ||
| - do not add a separate non-Cloudflare backend unless the user explicitly asks | ||
|
|
||
| ## Canonical docs | ||
|
|
||
| Use the SDK repo as source of truth: | ||
| - Agent guide: <https://github.com/ifavo/mega-mpp-sdk/blob/main/docs/agent-integration.md> | ||
| - Charge docs: <https://github.com/ifavo/mega-mpp-sdk/blob/main/docs/methods/charge.md> | ||
| - Session docs: <https://github.com/ifavo/mega-mpp-sdk/blob/main/docs/methods/session.md> | ||
| - Worker demo guide: <https://github.com/ifavo/mega-mpp-sdk/blob/main/demo/README.md> | ||
| - Repository overview: <https://github.com/ifavo/mega-mpp-sdk/blob/main/README.md> | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update these to the new testnet deployments of USDm?