# ODEI Onchain / Financial UX Fabric

ODEI does **not** depend on Reown / AppKit. Industry platforms demonstrate a useful *capability vocabulary*; this fabric implements those capabilities as **first-party ODEI modules** (MoMo, TonConnect, WalletConnect Protocol for EVM, OpenPayGB, Partner API, ODEI OS).

## Principle

```
ODEI Identity + Policy
        ↓
    ODELPay FABRIC (router)
   ├── FIAT / bank / cards
   ├── MOBILE MONEY (MTN, Airtel, LivePay, Relworx, …)
   └── ONCHAIN
         ├── TonConnect (TON wallet connectivity)
         ├── WalletConnect Protocol (EVM — @walletconnect/ethereum-provider)
         ├── OPGB custodial ledger (embedded continuity + gas-free UX)
         └── Future Solana / other native adapters (WalletProviderAdapter)
```

## Capability → ODEI surface

| Capability (industry vocabulary) | ODEI implementation |
|----------------------------------|---------------------|
| Wallet connectivity | TonConnect + WalletConnect Protocol + `lib/wallet/*` |
| Social/email → embedded wallet | Student/auth sessions + OPGB custodial balances |
| Universal wallet continuity | OpenPayGB ledger across hubs |
| Account graduation | OPGB custodial → TonConnect / WalletConnect self-custody |
| SIWX / multichain ID | `lib/odei-fabric/identity.ts` + cookie session authority |
| Smart accounts / gas UX | Custodial settle = sponsored UX (`gas-abstraction.ts`) |
| Smart sessions / agents | `smart-sessions.ts` + OS app scopes |
| Batched actions | `batched-actions.ts` planner |
| Payments / POS | Payment rail adapters + Partner API |
| Onramp / offramp / swaps | `/opgb/onoff` (buy · swap · Cashout), Dex AMM OPGB↔TON/USDT/USDC/BTC/ETH (all legs), MoMo fund/withdraw |
| Analytics | `analytics.ts` hooks + Master dashboards |
| Compliance / verify | `compliance.ts` + workspace verification + OS MAC approval |
| Domain / app verification | Installable apps `approved+enabled` + `allowedOrigins` |

## Code map

- `lib/odei-fabric/capabilities.ts` — catalog + status
- `lib/odei-fabric/identity.ts`
- `lib/odei-fabric/smart-sessions.ts`
- `lib/odei-fabric/gas-abstraction.ts`
- `lib/odei-fabric/batched-actions.ts`
- `lib/odei-fabric/analytics.ts`
- `lib/odei-fabric/compliance.ts`
- `lib/odei-fabric/payments-router.ts`
- `lib/wallet/*` — TonConnect + WalletConnect adapters (no Reown AppKit)
- `lib/payments/payment-rail-adapter.ts`

## Env

- `NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID` — WalletConnect Cloud project id (enables EVM QR / deep-link connect)

## Explicit non-goals

- Do not install `@reown/appkit` or bind commercial AppKit Community License thresholds.
- Do not replace MoMo / OPGB with an external onramp vendor UI.
- Do not make wallet connect the authority for tuition/OPGB settle — student sessions stay authoritative.
