Documentation
chevron_right
Architecture Specs
Mesa Protocol provides a type-safe, durable state machine runtime for complex financial transactions on Stellar and Soroban. It replaces imperative SDK boilerplate with declarative workflow definitions that survive server restarts, network congestion, and compliance delays.
lightbulb Technical Core: Why Durable Orchestration Matters
Web3 payment pipelines combine synchronous blockchain operations with asynchronous external dependencies (e.g., SEP-24 Anchor deposit callbacks, KYC manual sign-offs, and Soroban WASM contract execution). If a Node.js process crashes or experiences HTTP timeouts mid-pipeline, traditional in-memory try/catch blocks leave user funds stuck in inconsistent states.
close Raw Stellar SDK (Imperative)
- State lost on process crash or restart
- Sequence number collisions on retry
- No built-in compensation / refund mechanism
- Requires 150+ lines of custom glue code per endpoint
check Mesa Protocol Runtime (Durable)
- Every step transition checkpointed to database
- Resumes seamlessly at exact step after server reboot
- Automated Saga pattern compensating refunds
- Declarative JSON AST generated from TypeScript SDK
layers 3-Tier System Architecture Blueprint
Tier 1: Developer SDK & Studio Canvas (@mesaprotocol/sdk & @mesaprotocol/codegen)
Fluent method-chaining builder that validates steps against canonical Zod schemas and generates immutable JSON Flow Definitions.
โ JSON AST Flow Definition (id, version, steps) โ
Tier 2: Durable Runtime Engine & Store (@mesaprotocol/runtime)
Postgres / InMemoryPool state store, 2-second polling scheduler, webhook HMAC verification, and Saga rollback compensator.
โ Signed Transactions & RPC Payloads โ
Tier 3: Stellar Blockchain Infrastructure
Stellar Horizon RPC (on-chain XLM / token payments), Soroban RPC (WASM smart contracts), SEP-10 Auth, and SEP-24 Anchors.
Documentation
chevron_right
Providers Reference
Detailed technical specifications, parameter schemas, and output states for all 9 Mesa execution primitives.
1. Provider: sep10 (SEP-10 Web Auth)
STELLAR AUTH
Executes SEP-10 challenge transaction request, signs with private key secret reference, submits challenge back to anchor auth server, and returns cached JWT token.
SDK Builder Method:
.sep10Auth({ domain: 'anchor.stellar.org', accountSecretRef: 'SENDER_SECRET' })
Emitted Context Output:
{ sep10Auth: true, authenticatedDomain: "anchor.stellar.org", jwtToken: "sep10_jwt_..." }
2. Provider: anchor (SEP-24 Webview)
SEP-24 ANCHOR
Initiates interactive SEP-24 deposit or withdrawal flow, returns interactive webview URL, and suspends execution until anchor callback notifies successful funding.
SDK Builder Method:
.anchorDeposit({ anchorDomain: 'anchor.stellar.org', assetCode: 'USDC', amount: 100 })
Resumed Output State:
{ depositedAmount: 100, depositTxHash: "7590ce43...", depositStatus: "COMPLETED" }
3. Provider: soroban (Smart Contracts)
SOROBAN WASM
Invokes methods on deployed Soroban WASM smart contracts using Soroban RPC. Automatically serializes typed XDR contract parameters.
SDK Builder Method:
.invoke({ contractId: 'CAKJYFD...', method: 'transfer', args: '{"amount": 100}' })
4. Provider: stellar (Payments & Swaps)
HORIZON PRIMITIVES
Handles native XLM payments, custom asset token transfers, and path payment strict receive/send operations on Stellar Horizon RPC.
SDK Builder Methods:
.payment({ to: 'GA7IL...', amount: 50, asset: 'XLM' })
.pathPayment({ sendAsset: 'USDC', destAsset: 'XLM', sendAmount: 10, destMinAmount: 45, destination: 'GA7IL...' })
5. Provider: approval (Compliance Gate)
MANUAL COMPLIANCE
Suspends workflow execution and waits for an operator or compliance officer to manually approve or reject the transaction via dashboard/webhook.
SDK Builder Method:
.manualApproval({ approverRole: 'compliance-officer', timeoutSeconds: 86400 })
6. Provider: condition (Branch Router)
DIRECTED BRANCHING
Evaluates dynamic boolean expressions over context variables (depositedAmount >= 100, status == APPROVED) and routes execution to ifTrueStep or ifFalseStep.
SDK Builder Method:
.condition({ expression: 'depositedAmount >= 100', ifTrueStep: 3, ifFalseStep: 5 })
7. Provider: delay (Sanctions Timer)
NON-BLOCKING TIMER
Schedules a non-blocking timer delay (e.g. 5-second sanctions hold) using durable scheduler timestamps.
.delay({ seconds: 5 })
8. Provider: webhook (External Callback)
EXTERNAL CALLBACK
Parks execution and exposes a suspension key until an external system POSTs to /webhooks/resume.
.webhook({ url: 'https://api.myapp.com/callback' })
9. Provider: compensation (Saga Rollback)
SAGA REFUND
Executes distributed Saga compensating transactions to refund users if downstream steps fail permanently.
.compensate({ refundAddress: 'GBHTYH2...', refundAsset: 'USDC' })