How milesdevx/pactora works
Pactora is a web-and-Telegram app for milestone-based MUSD escrow on Mezo Testnet. Clients create wallet-owned agreements, providers accept, clients fund them, providers submit evidence, and clients approve releases; the product also supports timeout claims, guarded refunds, mutual settlement, public receipts, verified metadata, and wallet-linked Telegram commands and alerts. The graph follows the documented lifecycle and sampled module references. Some implementation details, including contract source and notification delivery, were not sampled, so those links are omitted or marked unverified.
Main entry points: page.tsx Agreement actions · schema.ts PostgreSQL records · route.ts Agreement API · webhook.ts Bot command handling
Components 25
Web experience
- Product landing
app/page.tsx - Agreement dashboard
app/dashboard/page.tsx
Escrow lifecycle
- Create agreement
app/agreements/create/page.tsx - Agreement actions
app/agreements/[id]/page.tsx - Confirmed transactions
lib/hooks/useConfirmedTransaction.ts - Terms and amounts
lib/chain/terms.ts
Identity and records
- Agreement API
app/api/agreements/route.ts - Evidence API
app/api/agreements/[id]/evidence/route.ts - Agreement detail API
app/api/agreements/[id]/route.ts - Wallet authentication
lib/security/session.ts - Session routes
app/api/auth/verify/route.ts - Agreement metadata
lib/chain/metadata.ts - PostgreSQL records
lib/db/schema.ts
Telegram integration
- Telegram settings
app/settings/telegram/page.tsx - Telegram linking API
app/api/telegram/link/route.ts - Telegram webhook route
app/api/telegram/webhook/route.ts - Bot command handling
lib/telegram/webhook.ts - Wallet chain reads
lib/telegram/chain-reads.ts - Alert delivery
lib/telegram/notifications.ts
Mezo services
- Public receipts
lib/chain/receipts.ts - Receipt endpoint
app/api/receipts/[id]/route.ts - Chain verification
lib/chain/server.ts
Other components
- Client and provider
- Mezo Testnet
- Telegram
Connections 33
- Client and provider → Product landing: visit
README.md - Product landing → Create agreement: start agreement
app/page.tsx - Client and provider → Create agreement: set terms
README.md - Create agreement → Confirmed transactions: submit transaction
app/agreements/create/page.tsx - Confirmed transactions → Terms and amounts: hash terms
lib/hooks/useConfirmedTransaction.ts - Create agreement → Mezo Testnet: create on-chain
README.md - Client and provider → Agreement actions: accept and fund
README.md - Agreement actions → Confirmed transactions: execute actions
app/agreements/[id]/page.tsx - Client and provider → Evidence API: register evidence
README.md - Client and provider → Agreement actions: submit and approve
README.md - Agreement actions → Mezo Testnet: release or settle
README.md - Client and provider → Agreement actions: claim timeout or refund
README.md - Agreement dashboard → Client and provider: show agreements
- Agreement API → Wallet authentication: require session
app/api/agreements/route.ts - Agreement API → Chain verification: verify chain state
app/api/agreements/route.ts - Agreement API → Agreement metadata: list verified
app/api/agreements/route.ts - Agreement API → PostgreSQL records: store metadata
app/api/agreements/route.ts - Evidence API → PostgreSQL records: read and write
app/api/agreements/[id]/evidence/route.ts - Agreement detail API → Chain verification: read party agreement
app/api/agreements/[id]/route.ts - Agreement detail API → PostgreSQL records: verify metadata
app/api/agreements/[id]/route.ts - Session routes → Wallet authentication: manage session
- Chain verification → Mezo Testnet: read contract
lib/chain/server.ts - Receipt endpoint → Chain verification: read confirmed receipt
app/api/receipts/[id]/route.ts - Receipt endpoint → Public receipts: format receipt
app/api/receipts/[id]/route.ts - Telegram settings → Telegram linking API: manage link
app/settings/telegram/page.tsx - Telegram linking API → Wallet authentication: require session
app/api/telegram/link/route.ts - Telegram linking API → PostgreSQL records: persist link token
app/api/telegram/link/route.ts - Telegram → Telegram webhook route: send updates
README.md - Telegram webhook route → Bot command handling: dispatch updates
app/api/telegram/webhook/route.ts - Bot command handling → PostgreSQL records: read and update links
lib/telegram/webhook.ts - Bot command handling → Wallet chain reads: read balances
lib/telegram/webhook.ts - Bot command handling → Alert delivery: manage alerts
lib/telegram/webhook.ts - Alert delivery → Telegram: deliver alerts