Solana integration
Overview
This sample demonstrates how to integrate Openfort's embedded wallet infrastructure with the Solana blockchain. It showcases user creation, transaction execution on Solana, and cross-chain capabilities with EVM networks.
View Sample Code
GitHub Repository
Complete source code for the Solana integration sample with Openfort embedded wallets.
Project structure
solana-sample/
├── src/
│ ├── App.tsx # Main application component
│ ├── main.tsx # React entry point
│ ├── Login.tsx # Authentication flow
│ ├── content.tsx # UI content and components
│ ├── solana.tsx # Solana blockchain interactions
│ ├── openfort.ts # Openfort SDK configuration
│ ├── index.css # Global styles
│ ├── vite-env.d.ts # Vite type definitions
│ └── assets/ # Static assets (logos, icons)
│ ├── openfort.svg
│ └── solanaLogo.svg
├── public/
│ └── favicon.ico # Favicon
├── .env.local.example # Environment template
├── package.json # Dependencies and scripts
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript configuration
└── README.md # Project documentationKey features
- Openfort embedded wallet creation
- Solana transaction execution
- Cross-chain support (Solana ↔ EVM chains)
- Simple authentication flow
- Chain switching capabilities
| Component | Technology |
|---|---|
| Frontend | React + Vite + TypeScript |
| Blockchain | Solana (+ Polygon Amoy for chain switching) |
| Key Libraries | @openfort/openfort-js, @solana/kit |
| Styling | CSS |
Quick start
Clone the repository and navigate to the solana sample:
git clone https://github.com/openfort-xyz/openfort-js.git
cd openfort-js
pnpm install
pnpm build
cd examples/apps/solana-samplePrerequisites
- Node.js 18+
- pnpm
- Openfort account with configured API keys
- Modern web browser
Configuration
-
Copy the environment template:
cp .env.local.example .env.local -
Add your Openfort credentials to
.env.local:VITE_PROJECT_PUBLISHABLE_KEY=your_publishable_key VITE_SHIELD_PUBLISHABLE_KEY=your_shield_key VITE_SOLANA_TEST_RECEIVE_ADDRESS=your_solana_receive_address
Install and run
From the openfort-js project root:
pnpm dev:solanaOr from the solana-sample directory:
pnpm install
pnpm devHow it works
The application demonstrates three core functionalities:
- User Creation: Creates a new Openfort user with embedded wallet support
- Solana Transactions: Executes transactions on the Solana blockchain using Openfort's signer
- Chain Switching: Demonstrates cross-chain capabilities by switching to Polygon Amoy (EVM chain)
This sample is ideal for developers looking to add Solana support to their applications while maintaining the flexibility to work with EVM-compatible chains.