@funkit/connect-core

中文文档
16.1.0发布于 2026/11/13MITTypeScriptES Module近 30 天下载 16.6万

Headless, platform-agnostic business logic shared by @funkit/connect (web) and @funkit/connect-rn (React Native). No DOM, vanilla-extract, or wagmi.

原始使用文档
文档目录3 节
  1. FunkitConnectCore
  2. Solana
  3. Fiat routing tables

FunkitConnectCore

@funkit/connect-core holds the headless, platform-agnostic business logic shared by @funkit/connect (web) and @funkit/connect-rn (React Native): domains, utils, hooks, Statsig wrappers, theme factories, and the FunLogger class.

Invariant: no DOM, vanilla-extract, or wagmi imports anywhere under src/**. Platform concerns (rendering, transports, storage) are supplied by the consuming package through the contracts defined here. See ../connect-rn/README.md for the core/web/RN architecture.

Solana

@funkit/connect-core/clients/solana runs Solana withdrawals, deposits and Convert through a FunkitSolanaAdapter the host builds with @funkit/solana-kit (Kit Rpc and TransactionSigner) or @funkit/solana-web3 (web3.js Connection and signer callbacks). Core imports no Solana library. It calls adapter.createRelayWallet() only when an execution starts, and logs solanaSigner:resolved with the adapter's address, engine and signing path.

Fiat routing tables

useFiatQuote takes a required routingTableSessionId and quotes through the routing table unless unstable_routingOverrides is set. The table sends the corridor and a methods array in its JSON body. An optional getRoutingProviderInputs callback supplies client-held provider inputs at request time; React Native reads MoonPay's access token once the buyer's connection is active. Tokens are omitted when unavailable and never enter query keys, request logs (including debug logs) or cached errors. After provider authentication, the existing table invalidation marks the table stale, so its next fetch reads fresh credentials.

Host provider overrides always use POST /fiat/quote. A listed provider whose own checkout the client runs is handed off, never quoted there, and MoonPay guest, which has no shared checkout, is dropped while its flow is off. That endpoint persists the host allowlist through backend KYC rediscovery; the routing quote endpoint only accepts the provider selected for the current quote. Moving pinned flows onto the table requires an API contract that preserves the host allowlist separately from that selection.

The client does not throttle table requests; the server rate limits them per buyer. Try again and a session remount fetch at once, and a refresh joins a request in flight. Provider exhaustion refreshes the table once per route and amount, and once per interval. A table's lifetime is read from expiresAt relative to its arrival, so a wrong phone clock does not expire it early; it is held for at least 17 seconds and at most 60. The replacement is requested 5 seconds before that deadline, and a table stops supplying providers and bounds at the deadline. A failed refresh keeps the held table until then. A failed table request is retried once (a 429 after 12 seconds), then surfaced as a quote error; unpinned table flows do not fall back to the legacy endpoint.

版本与发布记录

@funkit/connect-core 共发布 65 个版本,首次发布于 2026/06/06;过去 12 个月发布了 65 个版本。

版本发布日期距今
16.1.0latest2026/11/132 天前
16.0.02026/11/114 天前
15.0.02026/11/079 天前
14.0.12026/11/069 天前
14.0.02026/11/0511 天前
13.1.02026/11/0412 天前

其他发布通道:next → 0.4.0-next.0,snapshot-20260710210119 → 0.0.0-20260710210119。

关于 @funkit/connect-core 的常见问题

@funkit/connect-core 是什么?

Headless, platform-agnostic business logic shared by @funkit/connect (web) and @funkit/connect-rn (React Native). No DOM, vanilla-extract, or wagmi.

如何安装 @funkit/connect-core?

在项目目录运行 npm install @funkit/connect-core,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:viem(>=2.22.14)、react(>=18)、i18next(>=23)、@tanstack/react-query(>=5.0.0)、@statsig/react-bindings(>=3.25)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@funkit/connect-core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@funkit/connect-core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@funkit/connect-core 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@funkit/connect-core 可以商用吗?

@funkit/connect-core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@funkit/connect-core 的下载量有多少?

根据 npm 官方下载统计,@funkit/connect-core 在 2026/10/16 – 2026/11/14 这 30 天内被下载 165,970 次,日均约 5,532 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@funkit/connect-core 还在维护吗?

最新版本 16.1.0 发布于 2026/11/13(2 天前);至今共发布 65 个版本,其中过去 12 个月发布了 65 个;首次发布于 2026/06/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。