LDGR/Docs
DocsDevelopersDeveloper package examples

Packages for building on LDGR.

Start with the smallest published package that fits your runtime. Keep customer keys in their wallet, keep service keys in a secret manager, and keep every amount exact.

Build with your agent

Bring your AI agent.

One prompt gives your AI coding tool the networks, packages, and guides to start building on LDGR.

Get testnet tLEDRA →

Read prompt.md →

Install only the layer you need.

The packages are independent entry points. Browser apps usually need @ldgr/wallet-sdk; backend services usually need @ldgr/client. Add @ldgr/protocol when you need canonical types or exact amount and address helpers.

Code example
npm install @ldgr/protocol @ldgr/client @ldgr/wallet-core @ldgr/wallet-sdk
npm install -g @ldgr/cli

All examples below use testnet where a network is required. Switch to mainnet and ledgerId: 1 only when your integration is ready for real funds.

Connect an AI client with MCP

Use @ldgr/mcp for local stdio access, or connect to https://mcp.ldgr.ltd/mcp with Streamable HTTP. Both provide public reads and unsigned wallet requests; approval and signing stay in the local CLI.

Code example
npx -y @ldgr/mcp@latest

Configure your client using the MCP setup guide, including Codex commands and wallet approval.

01 / protocol

Canonical values, no network calls.

Use @ldgr/protocol for decimal-to-atomic conversion, public asset IDs, Bech32 addresses, payloads, and cryptographic helpers. It does not connect to a ledger or store keys.

Code example
import {
  formatAtomicAmount,
  nativeAssetDefinitionForLedger,
  parseDecimalAmount,
} from "@ldgr/protocol";

const asset = nativeAssetDefinitionForLedger(0);
const atomic = parseDecimalAmount("12.50", asset);
console.log(formatAtomicAmount(atomic, asset)); // "12.50"

02 / client

Read, verify, and send from services.

Use @ldgr/client for authoritative HTTP reads, payment verification, AMM quotes, and transfers signed by a caller-owned service wallet.

Code example
import { createLdgrClient } from "@ldgr/client";

const client = createLdgrClient({ network: "testnet" });
const balance = await client.accounts.getBalance(address, "t0");
const quote = await client.amm.quoteRoute("t0", assetOut, "10.00", 3);
const payment = await client.payments.verifyTransfer(transactionHash, {
  to: merchantAddress,
  asset: "t0",
  amount: "10.00",
});

if (payment.status === "confirmed") await fulfilOnce(payment.transactionHash);

03 / wallet-core

Self-custody primitives for wallet surfaces.

Use @ldgr/wallet-core when you are building a wallet UI or another browser-safe signing surface. Persistence belongs to your app; private material stays local and unlocked signers stay in memory.

Code example
import {
  createEncryptedWalletVault,
  unlockWalletVault,
} from "@ldgr/wallet-core";

const created = await createEncryptedWalletVault({
  ledgerId: 0,
  passphrase,
});
await walletStore.put("primary", created.vault);

const unlocked = await unlockWalletVault({
  vault: await walletStore.get("primary"),
  ledgerId: 0,
  passphrase,
});
const signer = unlocked.signer; // keep it in memory only

04 / wallet-sdk

Ask a user’s wallet to confirm.

Use @ldgr/wallet-sdk in browser apps. The root entry gives you the typed provider wrapper; the browser entry registers the payment, connect, and swap custom elements.

Code example
import { createLdgrWallet } from "@ldgr/wallet-sdk";
import "@ldgr/wallet-sdk/browser";

const wallet = createLdgrWallet(window.ldgr);
await wallet.connect({ network: "testnet" });
const receipt = await wallet.sendNative({
  to: recipientAddress,
  amount: "2.50",
});
console.log(receipt.transactionHash);

Code example
<ldgr-swap-widget
  api-base="https://tst.ldgr.ltd"
  ledger-id="0"
  token-a="t0"
  token-b="t0f8eaa3828cfa3b"
  allow-search>
</ldgr-swap-widget>

05 / cli

A local wallet in the terminal.

Use @ldgr/cli for an individual’s local self-custody wallet. It creates or imports wallets, shows balances, sends assets, and switches the selected network without putting keys in a website or backend.

Code example
npm install -g @ldgr/cli
ldgr wallet create --testnet
ldgr address
ldgr balance
ldgr send ldgrt1… 2.50
ldgr network show

Add-ons

Ledra Memory is a separate service built on the LDGR ledger. It provides encrypted project memory for agents, with scoped access and prepaid service credit. It is currently a testnet preview.

Explore Ledra Memory → · Set up the service →

The boundary that matters

Customer wallets confirm customer funds. Use the wallet SDK for that flow. A service signer created through the client SDK is caller-owned infrastructure, not a substitute for a user’s wallet.

Before shipping.

✓

Keep money exact. Pass decimal strings at API boundaries and use integer atomic units in protocol code; never use floats for money.

✓

Verify settlement. Store the expected payment terms and verify the transaction hash with @ldgr/clientbefore fulfilling an order.

✓

Match the network. Use t0 andldgrt on testnet; use t1 and ldgr on mainnet.