@0xsquid/mpp
v0.2.0
Published
Cross-chain payment adapter for Tempo using Squid Router
Readme
squid-mpp
Cross-chain payment method for mppx that fulfills MPP charge challenges via Squid Router.
Given a viem Account, it scans all Squid-supported EVM chains for available balances, selects a viable source token, bridges it to the challenge currency on Tempo mainnet, and returns a credential containing the destination tx hash.
Agent on Base (or other chain) → Squid bridge → Tempo chain → MPP recipientInstall
npm install @0xsquid/mppUsage
import { Mppx } from "mppx/client"
import { squid } from "@0xsquid/mpp"
import { privateKeyToAccount } from "viem/accounts"
const account = privateKeyToAccount(process.env.PRIVATE_KEY! as `0x${string}`)
const { fetch: mppxFetch } = Mppx.create({
polyfill: false,
methods: [
squid({
account,
integratorId: "my-app"
})
]
})
const response = await mppxFetch("https://some-mpp-api.com/resource")
console.log(await response.json())Options
| Option | Type | Required | Description |
| -------------- | --------- | -------- | ------------------------------------------------------------------- |
| account | Account | yes | viem Account — Squid scans all supported chains for available funds |
| integratorId | string | yes | Your Squid integrator ID |
How it works
- Receives a Tempo charge challenge
{ amount, currency, recipient }from a 402 response - Queries Squid for all supported tokens across EVM chains and finds ones held by the account
- Selects the best source token and constructs a bridge route to the challenge currency on Tempo
- Executes the bridge transaction and polls for the destination tx on Tempo (every 5s, up to 5min)
- Returns a credential
{ type: "hash", hash }containing the Tempo destination tx hash
The server verifies the credential by fetching the receipt from Tempo and checking that the Transfer event matches the challenge parameters exactly (token address, recipient, amount).
