Skip to main content

Link SDK

Use the Link SDK when you want a typed JavaScript or TypeScript client for the current Link service endpoints exposed by the package.

Overview

The SDK wraps the current exported LinkSDK scopes:

  • accounts
  • assets
  • customers
  • overview
  • quote
  • transactions
  • tracker
  • web3Policy

This documentation reflects the SDK exactly as it is implemented today in src/sdk/*.ts, including methods that still call older or internal-only endpoint paths.

Audience

This section is for teams that want to:

  • integrate Link services from Node.js applications
  • use typed DTOs and enums instead of building raw HTTP requests
  • keep request configuration centralized through one SDK client

Installation

npm install @ledgerlink/link-sdk

Runtime Support

  • Package: @ledgerlink/link-sdk
  • Node.js: >=18.0.0

SDK Initialization

Create one LinkSDK instance with your environment base URL and API key.

import { LinkSDK } from '@ledgerlink/link-sdk';

const sdk = new LinkSDK(
'https://api.example.com',
process.env.LEDGERLINK_API_KEY!,
);

Authentication Model

Every scope creates an Axios client with:

  • Content-Type: application/json
  • apikey: <your-api-key>

You only provide the base URL and API key once, in the LinkSDK constructor.

Scope Map

ScopePurpose
sdk.accountsAccount creation, lookup, update, deletion, address lookup, and balance retrieval
sdk.assetsCore asset retrieval
sdk.customersCustomer CRUD and customer-address lookup
sdk.overviewDigital-assets overview dashboards (global, portfolio, and per-network)
sdk.quoteQuote and rate creation
sdk.transactionsTransaction listing, retrieval, withdrawals, frozen-state actions, portfolio execution, and message signing
sdk.trackerLog-message creation
sdk.web3PolicyWeb3 dApp policy config retrieval and replacement

Common Request Pattern

Every SDK call follows the same pattern:

  1. Construct one LinkSDK instance.
  2. Choose a scope such as sdk.accounts or sdk.transactions.
  3. Call an async method with a typed DTO or primitive arguments.
  4. Receive the typed response body returned by the current SDK implementation.
import {
AccountStatus,
AccountType,
LinkSDK,
} from '@ledgerlink/link-sdk';

const sdk = new LinkSDK('https://api.example.com', 'your-api-key');

const account = await sdk.accounts.create({
customerExternalId: 'customer-ext-001',
type: AccountType.STABLECOINS,
status: AccountStatus.ACTIVE,
name: 'Primary Stablecoin Account',
});

const balance = await sdk.accounts.getBalance(account.id);

Start Here

If you are new to the SDK, this is a good first flow:

  1. Review the Accounts scope for initialization-friendly create and lookup methods.
  2. Review the Transactions scope if you need withdrawals or portfolio execution.
  3. Review the Quote scope if you need pricing data.
  4. Review the Overview scope for digital-assets dashboard data.
  5. Review the Web3 Policy scope for dApp policy configuration.

Filtering And Pagination Notes

  • sdk.accounts.findAll() maps filter fields into filter[...] query parameters.
  • sdk.transactions.findAll(filters?, pagination?) supports filters (status, customerId, accountType) and pagination (page, pageSize) as separate arguments.
  • Other scopes currently expose simpler request shapes and do not add SDK-level pagination helpers.

Error Handling Expectations

The SDK does not wrap or normalize errors beyond Axios behavior.

  • Validation, authorization, and server failures are surfaced as rejected Axios promises.
  • The response payload shape depends on the service endpoint being called.
  • If you need centralized handling, catch errors around scope calls and inspect the Axios error response.
try {
const transaction = await sdk.transactions.getById('tx-id');
console.log(transaction.status);
} catch (error) {
console.error('SDK request failed', error);
}

DTOs And Enums

The package re-exports DTOs and enums from src/index.ts, including:

  • AccountType
  • AccountStatus
  • CustomerStatus
  • Web3SignMode
  • Web3SignMessageEncoding
  • TransactionStatus
  • TransactionType

See the scope pages for method-level usage examples.