Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

cardano-uri-parser

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cardano-uri-parser

A modular, type-safe Cardano URI parser supporting CIP-13, claim, stake, browse, and future authorities.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Cardano URI Parser

A modular, type-safe Cardano URI parser supporting:

CIP-13 (payment + stake URIs) ✅ CIP-99 (claim URIs) ✅ CIP-107 (transaction + block URIs) ✅ CIP-134 (address URIs) ✅ CIP-PR843 (pay URIs) ✅ CIP-PR1058 (browse URIs)

📊 Build & Status

CI & Publish npm version License

🚀 Supported CIPs

The cardano-uri-parser library currently supports:

CIP/AuthorityDescription
CIP-13 (payment)Basic Cardano payment URIs (address + amount)
CIP-13 (stake)Stake pool delegation URIs
CIP-99 (claim)Token claim URIs with faucet references
CIP-107 (block)Block URIs by hash or height
CIP-107 (transaction)Transaction URIs by hash, with optional output index or metadata references
CIP-134 (address)Shelley, Byron (Daedalus, Icarus), mainnet/testnet address URIs with optional stake references
CIP-PR843 (pay)Enhanced payment URIs with lovelace, payment ID, note, and native token support
CIP-PR1058 (browse)Deep-linking to external dApps (with full URL reconstruction)

📦 Installation

npm install cardano-uri-parser

✨ Features

  • Modular handlers per authority (claim, stake, browse, block, transaction, address, pay)
  • Type-safe TypeScript definitions
  • Network + era inference: Byron (DdzFF, Ae2), Shelley (addr1, stake1), Testnet (addr_test1)
  • Clean parse() (throws on error) and safeParse() (returns null) APIs
  • Apache 2.0 licensed

🔗 Relevant CIPs

💡 Use Cases

✅ Deep link mobile users directly into:

  • dApp pages inside their Cardano wallet
  • faucet claims for test tokens or airdrops
  • staking delegation flows
  • transaction explorers (block, tx, metadata lookup)
  • address viewers (including Byron + Shelley, mainnet + testnet)

✅ Generate QR codes for:

  • events and conferences
  • point-of-sale terminals
  • airdrop or promotion campaigns

✅ Validate incoming URIs inside wallet apps

🚀 Quick Example

import {parse, safeParse} from "cardano-uri-parser";

// CIP Pull Request #1058 App Browse URI example
try {
    const result = parse("web+cardano://browse/https/fi.sundae.app/exchange?param=val");
    console.log("Parsed:", result);
} catch (err) {
    console.error("Invalid URI:", err);
}

// CIP-99 Claim URI Example using safeParse
const safeResult = safeParse("web+cardano://claim/v1?faucet_url=https%3A%2F%2Ffaucet.io&code=abc123");

if (safeResult) {
    console.log("Parsed safely:", safeResult);
} else {
    console.log("Invalid or unsupported URI");
}

// CIP-107 Transaction URI Example
try {
    const txResult = parse("web+cardano://transaction/7704a68404facf7126fa356f1b09f0e4c552aeef454cd0daba4208f3a64372e9#1");
    console.log("Parsed transaction:", txResult);
} catch (err) {
    console.error("Invalid URI:", err);
}

// CIP-107 Block URI Example with safeParse (results or returns null)
const safeBlockResult = safeParse('web+cardano://block?height=12345678');

if (safeBlockResult) {
    consol.log("Parsed safely:", safeResult);
} else {
    console.log("Invalid or unsupported URI");
}

⚙️ Development

npm install
npm run build
npm run test

📜 License

Apache 2.0 © 2025 Adam Dean (crypto2099)

📜 References

Keywords

cardano

FAQs

Package last updated on 21 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts