Skip to main content

Accounts Scope

Source: src/sdk/accounts.ts

Use sdk.accounts for account creation, lookup, lifecycle updates, address lookup, and balance retrieval.

Methods

create(dto: CreateAccountDto): Promise<Account>

Endpoint

POST /api/v1/account-manager/accounts

How it works

Creates a new account through the Account Manager service using the DTO you pass into the SDK.

Arguments

ArgumentTypeRequiredNotes
dto.customerIdstringNoExisting customer UUID.
dto.customerExternalIdstringNoExternal customer identifier.
dto.walletAccountIdstringNoWallet account identifier when used by the backend flow.
dto.accountExternalIdstringNoExternal account identifier.
dto.typeAccountTypeYesExample: AccountType.STABLECOINS.
dto.statusAccountStatusYesExample: AccountStatus.ACTIVE.
dto.namestringYesHuman-readable account name.
dto.routerDataRecord<string, unknown>NoPassed through as-is.
dto.customerNamestringNoOptional customer display name.

Returns

Promise<Account>

Behavior Notes

  • The SDK does not validate the DTO before sending it.
  • The returned object shape depends on the current Account Manager response.

Request Example

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',
customerName: 'Acme Treasury',
});

Response Example

{
id: 'eac6de80-8a71-4dc3-abee-240214cea9d5',
customer: {
id: 'cst-123',
externalId: 'customer-ext-001',
status: 'active',
participantId: 'participant-123',
accounts: [],
createdAt: '2026-04-02T09:00:00.000Z',
updatedAt: '2026-04-02T09:00:00.000Z',
},
type: 'stablecoins',
status: 'active',
name: 'Primary Stablecoin Account',
createdAt: '2026-04-02T09:00:00.000Z',
updatedAt: '2026-04-02T09:00:00.000Z',
}

findAll(filter?: { address?: string; id?: string; externalId?: string }): Promise<Account[]>

Endpoint

GET /api/v1/account-manager/accounts

How it works

Fetches accounts and maps SDK filter fields into filter[...] query parameters expected by the current endpoint.

Arguments

ArgumentTypeRequiredNotes
filter.addressstringNoSent as filter[address]=eq:<value>.
filter.idstringNoSent as filter[id]=eq:<value>.
filter.externalIdstringNoSent as filter[externalId]=eq:<value>.

Returns

Promise<Account[]>

Behavior Notes

  • The SDK always builds equality filters with the eq: prefix.
  • If no filter object is provided, the SDK sends an empty params object.

Request Example

const accounts = await sdk.accounts.findAll({
externalId: 'acct-001',
});

Response Example

[
{
id: 'eac6de80-8a71-4dc3-abee-240214cea9d5',
customer: {
id: 'cst-123',
externalId: 'customer-ext-001',
status: 'active',
participantId: 'participant-123',
accounts: [],
createdAt: '2026-04-02T09:00:00.000Z',
updatedAt: '2026-04-02T09:00:00.000Z',
},
externalId: 'acct-001',
type: 'stablecoins',
status: 'active',
name: 'Primary Stablecoin Account',
createdAt: '2026-04-02T09:00:00.000Z',
updatedAt: '2026-04-02T09:00:00.000Z',
}
]

getOrCreateOmnibus(): Promise<Account>

Endpoint

GET /api/v1/account-manager/accounts/omnibus

How it works

Calls the omnibus endpoint and returns the response body as an Account.

Arguments

This method does not accept arguments.

Returns

Promise<Account>

Behavior Notes

  • The underlying endpoint may return an existing account or create one during the call.

Request Example

const omnibus = await sdk.accounts.getOrCreateOmnibus();

Response Example

{
id: 'omnibus-account-id',
customer: {} as any,
type: 'omnibus',
status: 'active',
name: 'Participant Omnibus',
createdAt: '2026-04-02T09:00:00.000Z',
updatedAt: '2026-04-02T09:00:00.000Z',
}

getOrCreateFeePayer(): Promise<Account>

Endpoint

GET /api/v1/account-manager/accounts/fee-payer

How it works

Calls the fee-payer endpoint and returns the response body as an Account.

Arguments

This method does not accept arguments.

Returns

Promise<Account>

Behavior Notes

  • The endpoint can create the fee-payer account when it does not already exist.

Request Example

const feePayer = await sdk.accounts.getOrCreateFeePayer();

Response Example

{
id: 'fee-payer-account-id',
customer: {} as any,
type: 'fee_payer',
status: 'active',
name: 'Participant Fee Payer',
createdAt: '2026-04-02T09:00:00.000Z',
updatedAt: '2026-04-02T09:00:00.000Z',
}

getById(id: string): Promise<Account>

Endpoint

GET /api/v1/account-manager/accounts/:id

How it works

Fetches one account by identifier.

Arguments

ArgumentTypeRequiredNotes
idstringYesAccount identifier.

Returns

Promise<Account>

Request Example

const account = await sdk.accounts.getById('account-id');

Response Example

{
id: 'account-id',
customer: {} as any,
type: 'stablecoins',
status: 'active',
name: 'Primary Stablecoin Account',
createdAt: '2026-04-02T09:00:00.000Z',
updatedAt: '2026-04-02T09:00:00.000Z',
}

update(id: string, dto: UpdateAccountDto): Promise<Account>

Endpoint

PUT /api/v1/account-manager/accounts/:id

How it works

Sends the update DTO to the account update endpoint.

Arguments

ArgumentTypeRequiredNotes
idstringYesAccount identifier.
dto.statusAccountStatusYesThe current SDK DTO requires status.

Returns

Promise<Account>

Behavior Notes

  • The SDK update DTO currently only exposes status.

Request Example

const updated = await sdk.accounts.update('account-id', {
status: AccountStatus.INACTIVE,
});

Response Example

{
id: 'account-id',
customer: {} as any,
type: 'stablecoins',
status: 'inactive',
name: 'Primary Stablecoin Account',
createdAt: '2026-04-02T09:00:00.000Z',
updatedAt: '2026-04-02T09:10:00.000Z',
}

delete(id: string): Promise<void>

Endpoint

DELETE /api/v1/account-manager/accounts/:id

How it works

Calls the delete endpoint and resolves with no value when the request succeeds.

Arguments

ArgumentTypeRequiredNotes
idstringYesAccount identifier.

Returns

Promise<void>

Behavior Notes

  • The SDK does not return a body for this method.
  • Whether the backend actually permits deletion depends on the endpoint implementation.

Request Example

await sdk.accounts.delete('account-id');

getAllAddresses(id: string): Promise<string[]>

Endpoint

GET /api/v1/account-manager/accounts/:id/addresses

How it works

Retrieves the address collection for one account.

Arguments

ArgumentTypeRequiredNotes
idstringYesAccount identifier.

Returns

Promise<string[]>

Request Example

const addresses = await sdk.accounts.getAllAddresses('account-id');

Response Example

[
'0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
'7Y5P4E1XwP1h5ya9Lz7h2n3VgJY6QmE1K4m6mV9S1E2f',
]

getBalance(accountId: string): Promise<AccountBalanceResponse>

Endpoint

GET /api/v1/account-manager/accounts/:accountId/balance

How it works

Fetches the account balance summary and asset breakdown for one account.

Arguments

ArgumentTypeRequiredNotes
accountIdstringYesAccount identifier.

Returns

Promise<AccountBalanceResponse>

Behavior Notes

  • The current SDK balance DTO returns currency, totalBalance, assets, and timestamp.
  • This is the SDK response shape, even if the public service docs describe a different payload.

Request Example

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

Response Example

{
accountId: 'account-id',
currency: 'USD',
totalBalance: 15234.75,
assets: [
{
assetCode: 'USDC',
network: 'ethereum',
assetIds: ['asset-eth-usdc'],
quantity: 15234.75,
usdValue: 15234.75,
usdQuoteTimestamp: '2026-04-02T09:00:00.000Z',
usdQuoteRate: 1,
},
],
timestamp: '2026-04-02T09:00:00.000Z',
}