> For the complete documentation index, see [llms.txt](https://docs.pepeunchained.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pepeunchained.com/recipes/explorer-links.md).

# Explorer Links

Build pepuscan links for transactions, addresses, tokens and blocks, and link a sponsored UserOperation correctly.

pepuscan is PEPU mainnet's Blockscout explorer at `https://pepuscan.com`.

## Prerequisites

`@pepu-chain/sdk` and `pepuMainnet`. No React, no network call: link building is pure.

## Steps

Use the shorthand for the resource you have: `txUrl`, `addressUrl`, `tokenUrl`, `blockUrl`, or `explorerUrl(chain, type, value)` for the generic form. For a bundle of links at once use `explorerLinks`.

A UserOperation has no page of its own on pepuscan. Link its bundle transaction (`result.transactionHash`) and its sender (the smart account address). `SponsoredResult.explorerUrl` and the combo `act` response already carry the bundle transaction URL.

```ts
// Build pepuscan links. See docs/recipes/explorer-links.md
import { addressUrl, blockUrl, explorerLinks, explorerUrl, pepuMainnet, tokenUrl, txUrl } from "@pepu-chain/sdk";
import type { SponsoredResult } from "@pepu-chain/sdk/aa";

export const single = {
  tx: (hash: string) => txUrl(pepuMainnet, hash),
  address: (a: string) => addressUrl(pepuMainnet, a),
  token: (a: string) => tokenUrl(pepuMainnet, a),
  block: (n: number) => blockUrl(pepuMainnet, n),
  generic: (hash: string) => explorerUrl(pepuMainnet, "tx", hash),
};

// A UserOperation has no page of its own on pepuscan: link its bundle transaction
// and its sender (the smart account).
export function userOpLinks(result: SponsoredResult, smartAccount: string) {
  return explorerLinks({ tx: result.transactionHash, sender: smartAccount });
}
```

Source: `docs/snippets/explorer-links.ts`, type-checked against the SDK.

## What to expect

* `txUrl(pepuMainnet, hash)` gives `https://pepuscan.com/tx/<hash>`.
* `explorerLinks({ tx, sender })` returns only the keys you passed.
* `explorerUrl` throws for a chain with no explorer (`pepuTestnet`). Wrap the call if you need a soft failure.

## Common failures

| Symptom                                        | Cause                                        | Fix                                     |
| ---------------------------------------------- | -------------------------------------------- | --------------------------------------- |
| `explorerUrl: no block explorer is configured` | You passed `pepuTestnet`                     | Use `pepuMainnet`                       |
| A link to `/userop/...` 404s                   | Blockscout on PEPU has no UserOperation page | Link the transaction and sender instead |
| Block link by hash fails                       | Hash passed as a number                      | Pass the hash as a string               |

## Related

* [Core](/sdk/core.md#explorer-links)
* [Send a Sponsored Transaction](/recipes/sponsored-send.md)
* [Send a Transaction](/recipes/send-a-transaction.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pepeunchained.com/recipes/explorer-links.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
