@fiatconnect/fiatconnect-sdk

中文文档
0.5.168发布于 2026/11/14MITTypeScriptCommonJS构建来源已验证近 30 天下载 2404

A helper library for wallets to integrate with FiatConnect APIs

原始使用文档
文档目录7 节
  1. Basic usage
  2. Authenticated endpoints
  3. Accessing multiple FiatConnect providers
  4. Testing with a sandbox server
  5. Running tests
  6. Contributing
  7. Publishing

fiatconnect-sdk

A lightweight Typescript helper library for wallets or dapps to integrate with FiatConnect compliant APIs.

Basic usage

To begin, install the library from your project:

yarn add @fiatconnect/fiatconnect-sdk

Next, initialize a FiatConnectClient wherever you need to access a FiatConnect API in your codebase. See examples in the Valora wallet and FiatConnect validation tests.

From there, you can access any FiatConnect endpoint by invoking a method on the FiatConnectClient instance. There is a convenient example of a full transfer in this validation test.

Authenticated endpoints

Note that some FiatConnect endpoints require authentication before they can be accessed. You can read up on FiatConnect authentication here.

The FiatConnect SDK handles authentication by taking a signingFunction as a parameter in the FiatConnectClient constructor. The FiatConnectClient instance uses the signing function to sign a SIWE message and log in with a FiatConnect provider when:

  • the login method is invoked explicitly
  • any method for an endpoint that requires authentication is invoked (and the user does not already have a valid session)

Wallets may or may not wish to require a PIN every time a SIWE message is signed, or just some of the time. They may implement whatever preference they have by writing the signingFunction accordingly.

Accessing multiple FiatConnect providers

In most cases, clients will wish to integrate with multiple FiatConnect providers. However, it is worth noting that the FiatConnectClient class deals with only a single provider. This allows for more convenient separation of session cookies and provider-specific configuration data (base URL, etc.).

For an example of how to manage multiple FiatConnect providers in your codebase using the FiatConnect SDK, you may refer to the Valora wallet, which stores an object in memory mapping provider ID's to FiatConnectClient instances. Many similar possibilities exist.

Testing with a sandbox server

At time of writing, three companies offer a FiatConnect-compliant sandbox API: Valora, Alpha Fortress, and Bitmama.

If you want to test against a sandbox server that is FiatConnect-compliant, you can ask one of these companies on Discord to share API credentials with you. In particular, you will want a base URL and client API key that can be used to instantiate a FiatConnectClient.

Alternatively, if you want to make heavier use of a sandbox server (such as for CI), you can stand up your own FiatConnect-compliant sandbox using the api starter.

Running tests

yarn test

Contributing

We welcome contributions in the form of Issues and PRs. See CONTRIBUTING.md. If you have ideas for FiatConnect SDK that you'd like to discuss with other developers, you may contact us on the FiatConnect Discord.

Publishing

  • Publishing updates is done automatically via semantic-release. Remember to use conventional commits or your PR will be rejected (since merging it would mess up the changelog and version numbers).

版本与发布记录

@fiatconnect/fiatconnect-sdk 共发布 188 个版本,首次发布于 2022/05/17;过去 12 个月发布了 12 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.5.168latest2026/11/14今天
0.5.1672026/11/077 天前
0.5.1662026/07/154 个月前
0.5.1652026/06/254 个月前
0.5.1642026/03/167 个月前
0.5.1632026/03/058 个月前

其他发布通道:alpha → 0.2.1-alpha.2。

关于 @fiatconnect/fiatconnect-sdk 的常见问题

@fiatconnect/fiatconnect-sdk 是什么?

A helper library for wallets to integrate with FiatConnect APIs

如何安装 @fiatconnect/fiatconnect-sdk?

在项目目录运行 npm install @fiatconnect/fiatconnect-sdk,或使用 pnpm add / yarn add / bun add。

@fiatconnect/fiatconnect-sdk 支持 TypeScript 吗?

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

@fiatconnect/fiatconnect-sdk 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fiatconnect/fiatconnect-sdk 可以商用吗?

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

@fiatconnect/fiatconnect-sdk 的下载量有多少?

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

@fiatconnect/fiatconnect-sdk 还在维护吗?

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