Socket
Book a DemoInstallSign in
Socket

@yoroi/explorers

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yoroi/explorers

The Explorers package of Yoroi SDK

2.0.0
latest
Source
npmnpm
Version published
Weekly downloads
105
-2.78%
Maintainers
5
Weekly downloads
 
Created
Source

@yoroi/explorers

Overview

The @yoroi/explorers is a TypeScript package designed to manage and interact with various blockchain explorers supported by the Yoroi Wallet. The package provides a consistent interface for generating URLs for different blockchain networks and explorers.

Installation

To install the package, you can use npm or yarn:

npm install @yoroi/explorers

or

yarn add @yoroi/explorers

Usage

To use @yoroi/explorers, you can import the necessary types and functions to generate URLs for tokens, addresses, transactions, pools, and stake keys.

Example

import {Chain, Explorers} from '@yoroi/types'
import {explorerManager} from '@yoroi/explorers'

// Build the manager
const mainnetExplorer = explorerManager[Chain.Network.Mainnet]

// Generate URLs using Cardanoscan explorer
const tokenUrl =
  mainnetExplorer[Explorers.Explorer.Cardanoscan].token('fingerprint')
const addressUrl =
  mainnetExplorer[Explorers.Explorer.Cardanoscan].address('address')
const txUrl = mainnetExplorer[Explorers.Explorer.Cardanoscan].tx('txHash')
const poolUrl = mainnetExplorer[Explorers.Explorer.Cardanoscan].pool('poolId')
const stakeUrl =
  mainnetExplorer[Explorers.Explorer.Cardanoscan].stake('stakeAddress')

console.log(tokenUrl) // Output: https://cardanoscan.io/token/fingerprint
console.log(addressUrl) // Output: https://cardanoscan.io/address/address
console.log(txUrl) // Output: https://cardanoscan.io/transaction/txHash
console.log(poolUrl) // Output: https://cardanoscan.io/pool/poolId
console.log(stakeUrl) // Output: https://cardanoscan.io/stakeKey/stakeAddress

This example shows how to use the explorerManager object to generate URLs for different entities on the Mainnet using the Cardanoscan explorer.

About Supported Networks and Explorers

The following networks and explorers are supported:

Networks:

  • Mainnet: The live network for Cardano.
  • Preprod: The pre-production network for testing.
  • Preview: A preview network for new features.

Explorers:

  • Cardanoscan: A popular Cardano blockchain explorer.

    • Twitter X
    • Discord Discord
    • Explorer
  • Cexplorer: Another Cardano blockchain explorer.

URL Generation

For each network and explorer, the following URL generation methods are available:

token(fingerprint: string)

address(address: string)

tx(txHash: string)

pool(poolId: string)

stake(stakeAddress: string)

Adding a New Explorer

If you are a developer working on a new Cardano explorer and want to add support for it in Yoroi, you can do so by following these steps:

  • Fork the Repository Start by forking the @yoroi/explorers repository on GitHub.

  • Add Your Explorer URLs In the codebase, navigate to the explorer-manager.ts file. Add your explorer under the appropriate network with the URL generation methods (token, address, tx, pool, stake, etc).

    For example:

    [Chain.Network.Mainnet]: {
       [Explorers.Explorer.YourExplorerName]: {
         token: (fingerprint: string) => `https://yourexplorer.io/token/${fingerprint}`,
         address: (address: string) => `https://yourexplorer.io/address/${address}`,
         tx: (txHash: string) => `https://yourexplorer.io/transaction/${txHash}`,
         pool: (poolId: string) => `https://yourexplorer.io/pool/${poolId}`,
         stake: (stakeAddress: string) => `https://yourexplorer.io/stake/${stakeAddress}`,
      },
    },
    
  • Test Your Implementation Write unit tests to ensure that the URLs generated for your explorer are correct. You can follow the existing test patterns in the explorerManager test suite, 100% coverage is expected.

    Running Tests

    yarn test
    

    This will run the unit tests to ensure that everything is working as expected.

  • Submit a Pull Request (PR) Once you've implemented and tested your explorer integration, submit a PR to the repository. The Yoroi development team will review your submission.

Contributing

We welcome contributions from the community! If you find a bug or have a feature request, please open an issue or submit a pull request.

Keywords

yoroi

FAQs

Package last updated on 15 May 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.