返回範例應用程式
Solana Staking UI
This application lets users quickly stake to your Solana validator with minimal setup. It comes with pre-configured wallet connections, allowing your users to connect their preferred Solana wallets and stake their tokens directly to your validator node through a simple, streamlined interface.
前端框架/函式庫:
React
語言:
TypeScript
建置工具/開發伺服器:
Next.js

概覽
This is a simple demo let's stand up a staking page to easily empower your users to stake to your validator (modeled off of Quicknode Solana Stake UI).
The demo uses
- Solana 套件
- Wallet Standard
- Next.js project bootstrapped with
create-next-app. - Radix UI
開始使用
Install Dependencies
Open the project directory:
cd sample-dapps/solana-staking-ui
Then, install the dependencies:
npm install
# or
yarn
# or
pnpm install
# or
bun install
Set Environment Variables
Make sure you have a Quicknode endpoint handy--you can get one free here.
- Rename
.env.example至.envand update with your Quicknode Solana Node Endpoint. - Specify which cluster you are using (mainnet-beta, devnet) (using
NEXT_PUBLIC_NETWORK_ENV). - Specify the validator vote address that your staker should stake to (using
NEXT_PUBLIC_VALIDATOR_ADDRESS). The default value,5s3vajJvaAbabQvxFdiMfg14y23b2jvK6K2Mw4PYcYKis Quicknode's validator.
DEVNET_RPC_ENDPOINT=https://example.solana-devnet.quiknode.pro/12345/
MAINNET_RPC_ENDPOINT=https://example.solana-mainnet.quiknode.pro/12345/
NEXT_PUBLIC_NETWORK_ENV=mainnet
NEXT_PUBLIC_VALIDATOR_ADDRESS=5s3vajJvaAbabQvxFdiMfg14y23b2jvK6K2Mw4PYcYK
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
Using the Dapp
- Upload an Image (this will be used for your token metadata)
- Fill out the form with the token details
- Connect your wallet
- Make sure you have ~0.04 SOL in your wallet to cover the new account fees
- If you are using Devnet, you can get free SOL from the Solana Faucet
- Click "Mint" to upload your image and metadata to IPFS and mint your token!
建築
src/
├── app/
│ ├── page.tsx
│ └── layout.tsx
│ └── api/
│ └── balance/
│ │ └── route.ts # Get wallet SOL balance
│ └── stake/
│ │ └── fetch/route.ts # Get a wallets' staking accounts
│ │ └── generate/route.ts # Generate staking accounts
│ └── transaction/
│ └── confirm/route.ts # Confirm a transaction
└── components/
├── stake/ # Various staking components
└── [supporting components]
└── context/ # Wallet connect context
└── hooks/ # Is wallet connected hook
└── utils/ # Is wallet connected hook
├── solana/ # Solana staking and account utils
└── config.ts # Network settup
└── constants.ts
Deploy on Vercel
貢獻與回饋
我們非常樂意聽取您的意見,並歡迎您為這個範例應用程式提供任何貢獻!
若要回報問題或提供意見回饋,請在 qn-guide-examples 儲存庫。
若要貢獻,請依照以下步驟操作:
- 分叉此儲存庫
- 建立功能分支:git checkout -b feature/amazing-feature
- 將您的變更提交:git commit -m "新增超棒的功能"
- 推送您的分支:git push origin feature/amazing-feature
- 開啟一個 Pull Request。
探索更多範例應用程式