Skip to content

Commit

Permalink
docs: progress
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Oct 13, 2023
1 parent 4e0e306 commit 4b900be
Show file tree
Hide file tree
Showing 30 changed files with 632 additions and 278 deletions.
10 changes: 5 additions & 5 deletions docs/.vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function getSidebar() {
],
},
{
text: 'Guides 🚧',
text: 'Guides',
items: [
{
text: 'TanStack Query',
Expand Down Expand Up @@ -251,7 +251,7 @@ export function getSidebar() {
],
},
{
text: 'Guides 🚧',
text: 'Guides',
items: [
{
text: 'Viem',
Expand Down Expand Up @@ -287,7 +287,7 @@ export function getSidebar() {
text: 'Configuration',
items: [
{ text: 'createConfig', link: '/core/api/createConfig' },
{ text: 'createConnector 🚧', link: '/core/api/createConnector' },
{ text: 'createConnector', link: '/core/api/createConnector' },
{ text: 'createStorage', link: '/core/api/createStorage' },
{ text: 'Chains', link: '/core/api/chains' },
{
Expand Down Expand Up @@ -338,7 +338,7 @@ export function getSidebar() {
{ text: 'getAccount', link: '/core/api/actions/getAccount' },
{ text: 'getBalance', link: '/core/api/actions/getBalance' },
{
text: 'getBlock 🚧',
text: 'getBlock',
link: '/core/api/actions/getBlock',
},
{
Expand Down Expand Up @@ -455,7 +455,7 @@ export function getSidebar() {
link: '/core/api/actions/watchConnectors',
},
{
text: 'watchContractEvent 🚧',
text: 'watchContractEvent',
link: '/core/api/actions/watchContractEvent',
},
{
Expand Down
24 changes: 17 additions & 7 deletions docs/cli/config/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ Array of contracts to use when running [commands](/cli/api/commands). `abi` and
`Address | Record<chainId, Address> | undefined`

Contract address or addresses. Accepts an object `{ [chainId]: address }` for targeting specific chains.

```ts {6,11-14} filename="wagmi.config.ts"

::: code-group
```ts {6,11-14} [wagmi.config.ts]
export default {
out: 'src/generated.ts',
contracts: [
Expand All @@ -34,14 +35,16 @@ export default {
],
}
```
:::

### abi

`Abi`

ABI for contract. Used by [plugins](/cli/plugins) to generate code base on properties.

```ts {5} filename="wagmi.config.ts"
::: code-group
```ts {5} [wagmi.config.ts]
export default {
out: 'src/generated.ts',
contracts: [
Expand All @@ -52,14 +55,16 @@ export default {
],
}
```
:::

### name

`string`

Name of contract. Must be unique. Used by [plugins](/cli/plugins) to name generated code.

```ts {6} filename="wagmi.config.ts"
::: code-group
```ts {6} [wagmi.config.ts]
export default {
out: 'src/generated.ts',
contracts: [
Expand All @@ -70,14 +75,16 @@ export default {
],
}
```
:::

## out

`string`

Path to output generated code. Must be unique per config. Use an [Array Config](/cli/configuration/configuring-cli#array-config) for multiple outputs.

```ts {2} filename="wagmi.config.ts"
::: code-group
```ts {2} [wagmi.config.ts]
export default {
out: 'src/generated.ts',
contracts: [
Expand All @@ -88,6 +95,7 @@ export default {
],
}
```
:::

## plugins

Expand All @@ -97,7 +105,8 @@ Plugins to use and their configuration.

Wagmi CLI has multiple [built-in plugins](/cli/api/plugins) that are used to manage ABIs, generate code, etc.

```ts {1,5-20} filename="wagmi.config.ts"
::: code-group
```ts {1,5-20} [wagmi.config.ts]
import { etherscan, react } from '@wagmi/cli/plugins'

export default {
Expand All @@ -119,4 +128,5 @@ export default {
react(),
],
}
```
```
:::
48 changes: 17 additions & 31 deletions docs/core/api/actions/estimateFeesPerGas.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,7 @@ import { estimateFeesPerGas } from '@wagmi/core'
import { estimateFeesPerGas } from '@wagmi/core'
import { config } from './config'

const {
maxFeePerGas,
maxPriorityFeePerGas
} = await estimateFeesPerGas(config)
/**
* {
* maxFeePerGas: 15_000_000_000n,
* maxPriorityFeePerGas: 1_000_000_000n,
* }
*/

const { gasPrice } = await estimateFeesPerGas(config, {
type: 'legacy'
})
/**
* { gasPrice: 15_000_000_000n }
*/
const result = await estimateFeesPerGas(config)
```
<<< @/snippets/core/config.ts[config.ts]
:::
Expand All @@ -60,7 +44,7 @@ import { estimateFeesPerGas } from '@wagmi/core'
import { mainnet } from '@wagmi/core/chains'
import { config } from './config'

const feesPerGas = await estimateFeesPerGas(config, {
const result = await estimateFeesPerGas(config, {
chainId: mainnet.id, // [!code focus]
})
```
Expand Down Expand Up @@ -88,16 +72,17 @@ const feesPerGas = estimateFeesPerGas(config, {

### type

`"legacy" | "eip1559"`
`'legacy' | 'eip1559'`

- Defaults to `"eip1559"`
- Fee value type.
- Defaults to `'eip1559'`

::: code-group
```ts [index.ts]
import { estimateFeesPerGas } from '@wagmi/core'
import { config } from './config'

const feesPerGas = estimateFeesPerGas(config, {
const result = estimateFeesPerGas(config, {
type: 'legacy', // [!code focus]
})
```
Expand All @@ -110,8 +95,12 @@ const feesPerGas = estimateFeesPerGas(config, {
import { type EstimateFeesPerGasReturnType } from '@wagmi/core'
```

### formatted
[`FeeValues`](https://viem.sh/docs/glossary/types.html#feevalues)

An estimate (in wei) for the fees per gas.

### formatted

`{ gasPrice: string | undefined; maxFeePerGas: string | undefined; maxPriorityFeePerGas: string | undefined; }`

Object of formatted values using [`formatUnits`](#formatunits).
Expand All @@ -120,25 +109,22 @@ Object of formatted values using [`formatUnits`](#formatunits).

`bigint | undefined`

> Value is `undefined` if [`type`](#type) is `"eip1559"`.
Gas price.
- Gas price.
- When [`type`](#type) is `'eip1559'`, value is `undefined`.

### maxFeePerGas

`bigint | undefined`

> Value is `undefined` if [`type`](#type) is `"legacy"`.
Max fee per gas.
- Max fee per gas.
- When [`type`](#type) is `'legacy'`, value is `undefined`.

### maxPriorityFeePerGas

`bigint | undefined`

> Value is `undefined` if [`type`](#type) is `"legacy"`.
Max priority fee per gas.
- Max priority fee per gas.
- When [`type`](#type) is `'legacy'`, value is `undefined`.

## Error

Expand Down
4 changes: 4 additions & 0 deletions docs/core/api/actions/getBlock.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ const blockNumber = await getBlock(config, {
import { type GetBlockReturnType } from '@wagmi/core'
```

[`Block`](https://viem.sh/docs/glossary/types.html#block)

Information about the block.

## Error

```ts
Expand Down
102 changes: 1 addition & 101 deletions docs/core/api/actions/getTransaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,107 +158,7 @@ const transaction = getTransaction(config, {
import { type GetTransactionReturnType } from '@wagmi/core'
```

### accessList

`AccessList | undefined`

Access list for EIP-1559 or EIP-2930 transactions.

### blockHash

`` `0x${string}` | null ``

Hash of block containing this transaction or `null` if pending.

### blockNumber

`bigint | null`

Number of block containing this transaction or `null` if pending.

### chainId

`number | undefined`

Chain ID where transaction took place.

### from

`Address`

Transaction sender.

### gas

`bigint`

Gas provided for transaction execution.

### hash

`` `0x${string}` ``

Hash of this transaction.

### input

`` `0x${string}` ``

Contract code or a hashed method call.

### nonce

`number`

Unique number identifying this transaction.

### r

`` `0x${string}` ``

ECDSA signature r.

### s

`` `0x${string}` ``

ECDSA signature s.

### to

`Address | null`

Transaction recipient or `null` if deploying a contract.

### transactionIndex

`number | null`

Index of this transaction in the block or `null` if pending.

### type

`'legacy' | 'eip1559' | 'eip2930'`

Transaction type.

### typeHex

`` `0x${string}` | null ``

The type represented as hex.

### v

`bigint`

ECDSA recovery ID.

### value

`bigint`

Value in wei sent with this transaction.
[`Transaction`](https://viem.sh/docs/glossary/types.html#transaction)

## Error

Expand Down
Loading

0 comments on commit 4b900be

Please sign in to comment.