Skip to main content
The TypeScript SDK provides typed access to the full Dfns API with automatic request signing. The server-side packages handle key-based signing for service accounts and backend services. You can find the repository here.

Installation

npm i @dfns/sdk @dfns/sdk-keysigner
Requirements: Node 18+.

Quick start

1. Read-only operations

For read-only operations (listing wallets, fetching balances, etc.), you only need an auth token:
import { DfnsApiClient } from '@dfns/sdk'

const dfns = new DfnsApiClient({
  baseUrl: 'https://api.dfns.io',
  orgId: 'or-...',
  authToken: '...',
})

const { items } = await dfns.wallets.listWallets()
for (const wallet of items) {
  console.log(`${wallet.id}: ${wallet.network} ${wallet.address}`)
}
For a quick test you can get your login token (short-lived) from the Dfns Dashboard under Settings > Personal Access Tokens.

2. Signing requests

State-changing operations (creating wallets, signing transactions, etc.) require cryptographic request signing. Choose your approach based on where the private key lives:
Use DfnsApiClient with an AsymmetricKeySigner when your backend has direct access to the private key.
import { DfnsApiClient } from '@dfns/sdk'
import { AsymmetricKeySigner } from '@dfns/sdk-keysigner'

const signer = new AsymmetricKeySigner({
  credId: 'cr-...',
  privateKey: process.env.DFNS_PRIVATE_KEY!,
})

const dfns = new DfnsApiClient({
  baseUrl: 'https://api.dfns.io',
  orgId: 'or-...',
  authToken: '...',
  signer,
})

const wallet = await dfns.wallets.createWallet({
  body: { network: 'EthereumSepolia' },
})
console.log(`Created wallet: ${wallet.id}`)

Next steps

Last modified on March 13, 2026