A Next.js application that allows users to deposit USDC and receive Kenyan Shillings directly to their M-Pesa account using Starknet blockchain technology.
- M-Pesa Integration: Users can provide their M-Pesa phone number to receive funds
- USDC Deposits: Deposit USDC from your Starknet wallet
- Real-time Conversion: See the exact amount of Kenyan Shillings you'll receive (1 USDC = 130 KES)
- Wallet Connection: Seamless wallet integration using StarknetKit
- API Integration: Calls external API (example.com) to process transactions
- User-friendly UI: Clean, modern interface with dark theme
- Framework: Next.js 14 with TypeScript
- Styling: Tailwind CSS 4
- Blockchain: Starknet with @starknet-react/core
- Wallet: StarknetKit for wallet connections
- Icons: Lucide React
- Node.js 18+
- npm or yarn
- Clone the repository:
git clone https://github.com/mistcash/mist-ramp.git
cd mist-ramp- Install dependencies:
npm install- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
npm run build
npm startmist-ramp/
├── app/
│ ├── layout.tsx # Root layout with StarknetProvider
│ ├── page.tsx # Home page with MPesaDepositUI
│ └── globals.css # Global styles
├── components/
│ ├── MPesaDepositUI.tsx # Main deposit interface
│ ├── StarknetProvider.tsx # Starknet configuration
│ ├── StarknetWalletGate.tsx # Wallet connection component
│ └── UI.tsx # Reusable UI components
└── public/ # Static assets
The main component that handles:
- M-Pesa phone number input with validation
- USDC amount input
- Real-time KES conversion display
- Wallet balance display
- Transaction submission
- API calls to example.com
Handles wallet connection/disconnection:
- Shows "Connect Wallet" button when disconnected
- Displays connected address with disconnect option
- Wraps protected content that requires wallet connection
Reusable components based on the provided gists:
Button: Styled button with loading statesField: Form field wrapper with label and subtitleInputField: Input with icon and optional action buttonDropdown: Custom dropdown componentLoadingSpinner: Animated loading indicator
The app uses the Starknet USDC contract:
const USDC_ADDRESS = "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8";Current exchange rate is set to:
const EXCHANGE_RATE = 130; // 1 USDC = 130 KESWhen the user submits a deposit, the app makes a POST request to:
https://example.com/api/deposit
With the following payload:
{
"mpesaPhone": "254712345678",
"usdcAmount": "100",
"kesAmount": "13000.00",
"walletAddress": "0x..."
}The app validates Kenyan phone numbers in the following formats:
0712345678(starts with 0)254712345678(country code without +)+254712345678(with + prefix)
Valid prefixes: 07 or 01 followed by 8 digits
MIT
Contributions are welcome! Please feel free to submit a Pull Request.

