
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@yoroi/explorers
Advanced tools
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.
To install the package, you can use npm or yarn:
npm install @yoroi/explorers
or
yarn add @yoroi/explorers
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.
The following networks and explorers are supported:
Networks:
Explorers:
Cardanoscan: A popular Cardano blockchain explorer.
Cexplorer: Another Cardano blockchain explorer.
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)
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.
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.
FAQs
The Explorers package of Yoroi SDK
The npm package @yoroi/explorers receives a total of 105 weekly downloads. As such, @yoroi/explorers popularity was classified as not popular.
We found that @yoroi/explorers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.