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:
accountsassetscustomersoverviewquotetransactionstrackerweb3Policy
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/jsonapikey: <your-api-key>
You only provide the base URL and API key once, in the LinkSDK constructor.
Scope Map
| Scope | Purpose |
|---|---|
sdk.accounts | Account creation, lookup, update, deletion, address lookup, and balance retrieval |
sdk.assets | Core asset retrieval |
sdk.customers | Customer CRUD and customer-address lookup |
sdk.overview | Digital-assets overview dashboards (global, portfolio, and per-network) |
sdk.quote | Quote and rate creation |
sdk.transactions | Transaction listing, retrieval, withdrawals, frozen-state actions, portfolio execution, and message signing |
sdk.tracker | Log-message creation |
sdk.web3Policy | Web3 dApp policy config retrieval and replacement |
Common Request Pattern
Every SDK call follows the same pattern:
- Construct one
LinkSDKinstance. - Choose a scope such as
sdk.accountsorsdk.transactions. - Call an async method with a typed DTO or primitive arguments.
- 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:
- Review the Accounts scope for initialization-friendly create and lookup methods.
- Review the Transactions scope if you need withdrawals or portfolio execution.
- Review the Quote scope if you need pricing data.
- Review the Overview scope for digital-assets dashboard data.
- Review the Web3 Policy scope for dApp policy configuration.
Filtering And Pagination Notes
sdk.accounts.findAll()maps filter fields intofilter[...]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:
AccountTypeAccountStatusCustomerStatusWeb3SignModeWeb3SignMessageEncodingTransactionStatusTransactionType
See the scope pages for method-level usage examples.