SDKs

We have created a TypeScript SDK hosted on NPM to help developers integrate with our DeFi API more efficiently. We may develop additional SDKs for other programming languages in the future. The SDK offers type safety and better code completion in your IDE, simplified authentication handling, automatic request/response parsing, and others.

Configuration

Before using any of the APIs, you need to:

  1. Obtaining an API Key
  2. Set up the configuration per the instructions in the Set Up the Development Environment guide

That can be done as follows:

import { Configuration } from '@blockdaemon/blockdaemon-defi-api-typescript-fetch';

export const apiConfig = new Configuration({
  basePath: "https://svc.blockdaemon.com/defi/v1",
  headers: {
    authorization: `Bearer ${process.env.BLOCKDAEMON_API_KEY}`,
  },
});

Make sure to set your Blockdaemon API key in the .env file.


Please refer to the SDK's type definitions for more details on specific request and response types. The API also includes endpoints for other operations related to chains, tokens, prices, integrations, and lending/borrowing, which are not covered in this documentation.

👍

You may also check our guides and examples to understand better how to use the SDK.

This SDK is based on the following APIs:

  • account: API endpoints for interactions with accounts
  • chains: API endpoints for fetching information about blockchains
  • exchange: API endpoints for exchanging assets. Includes operations related to transaction statuses
  • tokens: API endpoints for fetching information about tokens
  • balances: Retrieves individual token balances and market data for an account across multiple chains
  • approvals: List ERC20 token approvals across multiple chains.
  • transactions: Get transaction history for an account across multiple chains.s

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.