npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fiatconnect/fiatconnect-sdk

v0.5.62

Published

A helper library for wallets to integrate with FiatConnect APIs

Downloads

2,907

Readme

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).