Skip to content

Commit

Permalink
♻️ chore: Move docs generation to package (#602)
Browse files Browse the repository at this point in the history
## Description

Move doc generation to package level instead of generating it in a
different package. Each package reference docs will be a standalone site

## Testing

Explain the quality checks that have been done on the code changes

## Additional Information

- [x] I read the [contributing docs](../docs/contributing.md) (if this
is your first contribution)

Your ENS/address:

---------

Co-authored-by: Will Cory <[email protected]>
  • Loading branch information
roninjin10 and Will Cory authored Oct 24, 2023
1 parent e5eba44 commit 408b942
Show file tree
Hide file tree
Showing 160 changed files with 16,378 additions and 25 deletions.
1 change: 1 addition & 0 deletions blockexplorer/doc/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
31 changes: 31 additions & 0 deletions blockexplorer/doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@evmts/blockexplorer / [Exports](/reference/blockexplorer/modules.md)

<p align="center">
<a href="https://evmts.dev/">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/35039927/218812217-92f0f784-cb85-43b9-9ca6-e2b9effd9eb2.png">
<img alt="evmts logo" src="https://user-images.githubusercontent.com/35039927/218812217-92f0f784-cb85-43b9-9ca6-e2b9effd9eb2.png" width="auto" height="300">
</picture>
</a>
</p>

[![CI](https://github.com/evmts/evmts-monorepo/actions/workflows/e2e.yml/badge.svg)](https://github.com/evmts/evmts-monorepo/actions/workflows/e2e.yml)
[![CI](https://github.com/evmts/evmts-monorepo/actions/workflows/unit.yml/badge.svg)](https://github.com/evmts/evmts-monorepo/actions/workflows/unit.yml)
<a href="https://www.npmjs.com/package/@evmts/blockexplorer" target="\_parent">
<img alt="" src="https://img.shields.io/npm/dm/@evmts/blockexplorer.svg" />
</a>
<a href="https://bundlephobia.com/package/@evmts/blockexplorer@latest" target="\_parent">
<img alt="" src="https://badgen.net/bundlephobia/minzip/@evmts/blockexplorer" />
</a>

# @evmts/blockexplorer

A library for interacting with a block explorer

## API

- [blockExplorer](./src/blockExplorer.js) - Utilities for interacting with a block explorer

## License 📄

<a href="./LICENSE"><img src="https://user-images.githubusercontent.com/35039927/231030761-66f5ce58-a4e9-4695-b1fe-255b1bceac92.png" width="200" /></a>
203 changes: 203 additions & 0 deletions blockexplorer/doc/classes/SafeStandardBlockExplorer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
[@evmts/blockexplorer](/reference/blockexplorer/README.md) / [Exports](/reference/blockexplorer/modules.md) / SafeStandardBlockExplorer

# Class: SafeStandardBlockExplorer

Utility for interacting with a block explorer via [Effect.ts](

Initiate with any compliant block explorer for utils like generating the url for a transaction, block, or address.

**`Example`**

```ts
import { Effect } from 'effect'
const etherscan = new SafeStandardBlockExplorer(
name: 'Etherscan',
url: 'https://etherscan.io',
chainId: 1,
)
const txUrlEffect = etherscan.getTxUrl('0x1234')
````

## Table of contents

### Constructors

- [constructor](/reference/blockexplorer/classes/SafeStandardBlockExplorer.md#constructor)

### Properties

- [chainId](/reference/blockexplorer/classes/SafeStandardBlockExplorer.md#chainid)
- [name](/reference/blockexplorer/classes/SafeStandardBlockExplorer.md#name)
- [url](/reference/blockexplorer/classes/SafeStandardBlockExplorer.md#url)
- [ERRORS](/reference/blockexplorer/classes/SafeStandardBlockExplorer.md#errors)

### Methods

- [getAddressUrl](/reference/blockexplorer/classes/SafeStandardBlockExplorer.md#getaddressurl)
- [getBlockUrl](/reference/blockexplorer/classes/SafeStandardBlockExplorer.md#getblockurl)
- [getTxUrl](/reference/blockexplorer/classes/SafeStandardBlockExplorer.md#gettxurl)

## Constructors

### constructor

**new SafeStandardBlockExplorer**(`options`)

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `options` | [`BlockExplorerOptions`](/reference/blockexplorer/interfaces/BlockExplorerOptions.md) | The options for the BlockExplorer. |

#### Defined in

[blockExplorer.js:60](https://github.com/evmts/evmts-monorepo/blob/main/blockexplorer/src/blockExplorer.js#L60)

## Properties

### chainId

**chainId**: `number`

#### Defined in

[blockExplorer.js:63](https://github.com/evmts/evmts-monorepo/blob/main/blockexplorer/src/blockExplorer.js#L63)

___

### name

**name**: `string`

#### Defined in

[blockExplorer.js:61](https://github.com/evmts/evmts-monorepo/blob/main/blockexplorer/src/blockExplorer.js#L61)

___

### url

**url**: `string`

#### Defined in

[blockExplorer.js:62](https://github.com/evmts/evmts-monorepo/blob/main/blockexplorer/src/blockExplorer.js#L62)

___

### ERRORS

`Static` **ERRORS**: `Object`

Possible Error states of the Effects

Can be used to handle errors in a typesafe way

#### Defined in

[blockExplorer.js:50](https://github.com/evmts/evmts-monorepo/blob/main/blockexplorer/src/blockExplorer.js#L50)

## Methods

### getAddressUrl

**getAddressUrl**(`address`): `Effect`<`never`, `InvalidAddressError` \| `InvalidUrlError`, `string`\>

Safely retrieves the address URL for a given address.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `address` | \`0x${string}\` | The address. |
#### Returns
`Effect`<`never`, `InvalidAddressError` \| `InvalidUrlError`, `string`\>
An effect that resolves to the address URL.
**`Example`**
```ts
const etherscan = new StandardBlockExplorer(
name: 'Etherscan',
url: 'https://etherscan.io',
chainId: 1,
)
const addressUrl = etherscan.getAddressUrl('0x1234')
```
#### Defined in
[blockExplorer.js:129](https://github.com/evmts/evmts-monorepo/blob/main/blockexplorer/src/blockExplorer.js#L129)
___
### getBlockUrl
▸ **getBlockUrl**(`blockHash`): `Effect`<`never`, `InvalidBytesError` \| `InvalidUrlError`, `string`\>
Safely retrieves the block URL for a given block hash.
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `blockHash` | \`0x${string}\` | The block hash in hexadecimal format. |
#### Returns
`Effect`<`never`, `InvalidBytesError` \| `InvalidUrlError`, `string`\>
An effect that resolves to the block URL.
**`Example`**
```ts
const etherscan = new StandardBlockExplorer(
name: 'Etherscan',
url: 'https://etherscan.io',
chainId: 1,
)
const blockUrl = etherscan.getBlockUrl('0x1234')
```
#### Defined in
[blockExplorer.js:104](https://github.com/evmts/evmts-monorepo/blob/main/blockexplorer/src/blockExplorer.js#L104)
___
### getTxUrl
▸ **getTxUrl**(`txId`): `Effect`<`never`, `InvalidBytesError` \| `InvalidUrlError`, `string`\>
Safely retrieves the transaction URL for a given transaction ID.
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `txId` | \`0x${string}\` | The transaction ID in hexadecimal format. |
#### Returns
`Effect`<`never`, `InvalidBytesError` \| `InvalidUrlError`, `string`\>
An effect that resolves to the transaction URL.
**`Example`**
```ts
const etherscan = new StandardBlockExplorer(
name: 'Etherscan',
url: 'https://etherscan.io',
chainId: 1,
)
const txUrl = etherscan.getTxUrl('0x1234')
```
#### Defined in
[blockExplorer.js:80](https://github.com/evmts/evmts-monorepo/blob/main/blockexplorer/src/blockExplorer.js#L80)
Loading

1 comment on commit 408b942

@vercel
Copy link

@vercel vercel bot commented on 408b942 Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

evmts-docs – ./

evmts-docs-git-main-evmts.vercel.app
evmts-docs-evmts.vercel.app
evmts.dev

Please sign in to comment.