Skip to main content

Using this SDK

This tutorial will walk you through the basics of creating a project that uses the Changelly Fiat API SDK.

  1. First, run the following command to create a default package.json file:
> npm init --y
  1. If you choose to use TypeScript, you can now add TypeScript features to this project. The following steps will install TypeScript, create a tsconfig.json file, and gain access to most built-in types for NodeJS:
> npm install typescript
> npx tsc --init
> npm install -D @types/node
  1. Add the Changelly Fiat API SDK to your project via Node Package Manager:
> npm install @changelly/fiat-api-sdk-node
  1. Set your API keys to an environment variable such as CHANGELLY_PRIVATE_KEY and CHANGELLY_PUBLIC_KEY so that it will not be committed to source control.
  2. Create a basic index.ts file for your project that creates a Changelly Fiat API client:
import { ChangellyFiatClient } from "@changelly/fiat-api-sdk-node";

const client = new ChangellyFiatClient({
privateKey: process.env["CHANGELLY_PRIVATE_KEY"],
publicKey: process.env["CHANGELLY_PUBLIC_KEY"],
});
  1. Make an API call and check the result:
const providers = await client.getProviderList();

console.log({ providers });