Use the Nami Injected API (CIP-0030)
mainNami exposes a Cardano provider via window.cardano following the CIP-0030 standard. The API is accessed through the nami namespace. Returned data types are in cbor/bytes format and should be deserialized using a library like cardano-serialization-lib.
Basic Integration Flow
- Detect the provider: Check for
window.cardano. - Detect Nami: Check for
window.cardano.nami. - Enable the API: Call
window.cardano.nami.enable()to request access and receive theapiobject. - Identify Network: Check the network ID (1 = Mainnet, 0 = Testnet).
- Access Account: Use the API to retrieve the user's Cardano account.
// Basic usage pattern
if (window.cardano && window.cardano.nami) {
const api = await window.cardano.nami.enable();
const networkId = await api.getNetworkId(); // 1 for Mainnet, 0 for Testnet
const account = await api.getUsedAddresses();
}