Wallet Endpoints

Query wallet UTXOs and balances directly from Anvil's indexed blockchain data.

Query wallet data server-side without a browser wallet. Returns data ready for the Anvil transaction builder.

Endpoint
Method
Purpose

/wallets/utxos

GET

Fetch UTXOs for transaction building

/wallets/balance

GET

Get aggregated balance (ADA + native assets)

GET /wallets/utxos

Returns hex-encoded CBOR UTXOs ready for transaction building—same format as CIP-30 getUtxos()arrow-up-right.

Parameters:

Parameter
Type
Required
Description

address

string

One required

Bech32 payment address

stakeAddress

string

One required

Bech32 stake address (queries all derived addresses)

withScripts

boolean

No

Include reference scripts

includeMempool

boolean

No

Include UTXOs from pending transactions

const API_BASE = 'https://preprod.api.ada-anvil.app/v2/services';

// Fetch UTXOs by payment address
const response = await fetch(`${API_BASE}/wallets/utxos?address=addr_test1qz...`, {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' }
});
const utxos = await response.json(); // string[]

// Use directly in transaction building
await fetch(`${API_BASE}/transactions/build`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'X-Api-Key': 'YOUR_API_KEY' },
  body: JSON.stringify({
    changeAddress: 'addr_test1qz...',
    utxos, // Ready to use!
    outputs: [{ address: 'addr_test1qy...', lovelace: 5_000_000 }]
  })
});
chevron-rightQuery by stake address (all derived addresses)hashtag
chevron-rightInclude mempool for chained transactionshashtag

Use includeMempool when building chained transactions before the previous one confirms.

GET /wallets/balance

Returns aggregated balance as hex-encoded CBOR Value (lovelace + native assets).

Parameters:

Parameter
Type
Required
Description

address

string

One required

Bech32 payment address

stakeAddress

string

One required

Bech32 stake address

circle-info

The response is CBOR-encoded Value—same format as CIP-30 api.getBalance()arrow-up-right. Parse with any Cardano serialization library to extract lovelace and native assets.

When to Use

Scenario
Endpoint

Building transactions

/wallets/utxos — exact format for transactions/build

Displaying wallet balance

/wallets/balance — single aggregated value

Checking for specific asset

/wallets/utxos — inspect individual UTXOs

Query entire stake account

Either with stakeAddress parameter

circle-info

For browser dApps with connected wallets, use Weldarrow-up-right instead—UTXOs come directly from the user's wallet.


Related: Selecting UTXOs · Wallet CLI

Last updated

Was this helpful?