converting-minikit-to-farcaster
Converts Mini Apps from MiniKit (OnchainKit) to native Farcaster SDK. Use when migrating from @coinbase/onchainkit/minikit, converting MiniKit hooks, removing MiniKitProvider, or when user mentions MiniKit, OnchainKit, or Farcaster SDK migration.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 80
- Forks
- 17
01 前言 Front Matter
- name
- converting-minikit-to-farcaster
- description
- Converts Mini Apps from MiniKit (OnchainKit) to native Farcaster SDK. Use when migrating from @coinbase/onchainkit/minikit, converting MiniKit hooks, removing MiniKitProvider, or when user mentions MiniKit, OnchainKit, or Farcaster SDK migration.
02 资源文件 13
- 脚本analyze_project.py8.8 KB
- 参考文档AUTH.md1.1 KB
- 参考文档DEPENDENCIES.md959 B
- 参考文档EXAMPLES.md3.5 KB
- 许可证LICENSE1.0 KB
- 参考文档MANIFEST.md1.1 KB
- 参考文档MAPPING.md9.1 KB
- 参考文档PITFALLS.md4.1 KB
- 参考文档PROVIDER.md3.6 KB
- 参考文档README.md750 B
- 参考文档SOURCE.md156 B
- 参考文档TRUST.auto.yaml2.1 KB
- 脚本validate_conversion.py12.6 KB
03 SKILL.md 正文
MiniKit to Farcaster SDK
Breaking Changes (SDK v0.2.0+)
sdk.contextis a Promise — must awaitsdk.isInMiniApp()accepts no parameterssdk.actions.setPrimaryButton()has no onClick callback
Check version: npm list @farcaster/miniapp-sdk
Quick Reference
| MiniKit | Farcaster SDK | Notes |
|---|---|---|
useMiniKit().setFrameReady() |
await sdk.actions.ready() |
|
useMiniKit().context |
await sdk.context |
Async |
useMiniKit().isSDKLoaded |
await sdk.isInMiniApp() |
No params |
useClose() |
await sdk.actions.close() |
|
useOpenUrl(url) |
await sdk.actions.openUrl(url) |
|
useViewProfile(fid) |
await sdk.actions.viewProfile({ fid }) |
|
useViewCast(hash) |
await sdk.actions.viewCast({ hash }) |
|
useComposeCast() |
await sdk.actions.composeCast({ text, embeds }) |
|
useAddFrame() |
await sdk.actions.addMiniApp() |
|
usePrimaryButton(opts, cb) |
await sdk.actions.setPrimaryButton(opts) |
No callback |
useAuthenticate() |
sdk.quickAuth.getToken() |
See AUTH.md |
Context Access Pattern
// WRONG
const fid = sdk.context?.user?.fid;
// CORRECT
const context = await sdk.context;
const fid = context?.user?.fid;
In React components, use state:
const [context, setContext] = useState(null);
useEffect(() => {
const load = async () => {
const ctx = await sdk.context;
setContext(ctx);
};
load();
}, []);
Conversion Workflow
- Verify Node.js >= 22.11.0
- Update dependencies — see DEPENDENCIES.md
- Replace imports:
@coinbase/onchainkit/minikit→@farcaster/miniapp-sdk - Convert hooks using reference above
- Add FrameProvider — see PROVIDER.md
- Update manifest:
frame→miniapp— see MANIFEST.md
Common Errors
"Property 'user' does not exist on type 'Promise<MiniAppContext>'"
→ Await sdk.context before accessing properties
"Expected 0 arguments, but got 1"
→ Remove parameters from sdk.isInMiniApp()
Context is null in components → Ensure FrameProvider is in your provider chain
References
- MAPPING.md — Complete hook-by-hook conversion reference
- EXAMPLES.md — Before/after code examples
- PROVIDER.md — Provider setup with FrameProvider
- PITFALLS.md — Common errors and solutions
- DEPENDENCIES.md — Package updates
- AUTH.md — Quick Auth migration
- MANIFEST.md — farcaster.json changes
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.