Querying
Evolution SDK provides a unified query interface across all providers (Blockfrost, Maestro, Koios, Kupo/Ogmios). Query UTxOs, delegation status, protocol parameters, datums, and transaction confirmations through your client.
Query UTxOs
Query unspent transaction outputs by address, credential, or asset
Protocol Parameters
Query current Cardano protocol parameters
Query Datums
Query datum values by hash from the blockchain
Query Delegation
Query stake delegation status and accumulated rewards
Transaction Status
Wait for transaction confirmation on the blockchain
Available Queries
| Method | Returns | Description |
|---|---|---|
getUtxos(address) | UTxO[] | UTxOs at an address |
getWalletUtxos() | UTxO[] | Your wallet's UTxOs |
getUtxosWithUnit(address, unit) | UTxO[] | UTxOs containing a specific asset |
getUtxoByUnit(unit) | UTxO | Single UTxO holding an asset |
getUtxosByOutRef(refs) | UTxO[] | UTxOs by output reference |
getDelegation(rewardAddress) | Delegation | Stake delegation and rewards |
getDatum(hash) | Data | Datum by hash |
getProtocolParameters() | ProtocolParameters | Current protocol parameters |
awaitTx(hash) | boolean | Wait for transaction confirmation |
Quick Example
import { Address, preprod, Client } from "@evolution-sdk/evolution"
const client = Client.make(preprod)
.withBlockfrost({
baseUrl: "https://cardano-preprod.blockfrost.io/api/v0",
projectId: process.env.BLOCKFROST_API_KEY!
})
.withSeed({ mnemonic: process.env.WALLET_MNEMONIC!, accountIndex: 0 })
// Query wallet UTxOs
const utxos = await client.getWalletUtxos()
console.log("Wallet has", utxos.length, "UTxOs")
// Query specific address
const addr = Address.fromBech32("addr_test1vrm9x2dgvdau8vckj4duc89m638t8djmluqw5pdrFollw8qd9k63")
const addrUtxos = await client.getUtxos(addr)
Next Steps
- UTxOs — Query unspent transaction outputs
- Protocol Parameters — Fetch current network parameters
- Datums — Query datum values by hash
- Delegation — Check stake delegation and rewards
- Transaction Status — Wait for transaction confirmation