Skip to content

Commit 3b30226

Browse files
authored
feat: frontmatter description (#138)
1 parent 8f72702 commit 3b30226

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+185
-16
lines changed

vocs/docs/pages/contract-interactions/queries.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
description: Query contract storage, deployed bytecode, and event logs from the blockchain
3+
---
4+
15
## Querying Contracts
26

37
### Query Contract Storage

vocs/docs/pages/contract-interactions/read-contract.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
description: Call view functions on smart contracts using the sol! macro's CallBuilder for read operations
3+
---
4+
15
## Reading a contract
26

37
We shall leverage the `sol!` macro and its `rpc` attribute to get the [WETH](https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) balance of an address.

vocs/docs/pages/contract-interactions/using-sol!.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
description: Generate type-safe Rust bindings from Solidity code using the powerful sol! procedural macro
3+
---
4+
15
## Using the sol! macro
26

37
Alloy provides a powerful and intuitive way to read and write to contracts using the `sol!` procedural macro.

vocs/docs/pages/contract-interactions/write-contract.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
description: Send transactions to smart contracts using the sol! macro's CallBuilder for seamless write operations
3+
---
4+
15
## Writing to a contract
26

37
The `sol!` macro also helps up building transactions and submit them to the chain seamless.

vocs/docs/pages/guides/fillers.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
description: Build transaction preprocessing pipelines using fillers to automatically fill missing transaction properties
3+
---
4+
15
# Building a High-Priority Transaction Queue with Alloy Fillers
26

37
In this guide, we will explore more advanced use cases of Alloy Providers APIs. We will cover non-standard ways to instantiate and customize providers and deep dive into custom layers and fillers implementations. We have a lot to cover, so let's get started!

vocs/docs/pages/guides/interacting-with-multiple-networks.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
description: Use the Network trait to seamlessly interact with different blockchain networks and handle varying RPC types
3+
---
4+
15
# Interacting with multiple networks
26

37
The provider trait is generic over the network type, `Provider<N: Network = Ethereum>`, with the default network set to `Ethereum`.

vocs/docs/pages/guides/layers.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
description: Customize HTTP-related aspects of RPC communication using Tower-based layers and services
3+
---
4+
15
# Customizing RPC Communication with Alloy's Layers
26

37
In the [previous guide](/guides/fillers), we covered [Alloy fillers](/rpc-providers/understanding-fillers). This time we'll discuss how to use [Alloy layers](https://alloy.rs/examples/layers/README) to customize HTTP-related aspects of RPC client communication.

vocs/docs/pages/guides/multicall.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
---
2+
description: Optimize RPC usage by batching multiple smart contract calls using Multicall Builder and Layer
3+
---
4+
15
# Multicall and Multicall Batching layer
26

3-
## What is Multicall?
7+
## What is Multicall?
8+
9+
Multicall is a smart contract and pattern that allows you to batch multiple read-only calls to the Ethereum blockchain into a single request. Instead of sending separate RPC requests, Multicall combines them into one transaction, significantly reducing network overhead and latency. This solves various problems such as reduced latency and rate-limiting, network overhead, atomic state reading & offers better UX.
410

5-
Multicall is a smart contract and pattern that allows you to batch multiple read-only calls to the Ethereum blockchain into a single request. Instead of sending separate RPC requests, Multicall combines them into one transaction, significantly reducing network overhead and latency. This solves various problems such as reduced latency and rate-limiting, network overhead, atomic state reading & offers better UX.
11+
## When should I use Multicall ?
612

7-
## When should I use Multicall ?
813
- To read multiple contract states e.g. fetching balances, allowances, or prices across multiple contracts
914
- To reduce request count e.g. working with public RPC endpoints that have rate limits
1015
- To ensure data consistency e.g. when you need multiple values from the same blockchain state
@@ -13,7 +18,8 @@ Note that Multicall is not suitable for write operations (transactions that chan
1318

1419
## Multicall with Alloy
1520

16-
Alloy provides two ways in which a user can make multicalls to the [Multicall3 contract](https://www.multicall3.com/), both of which tightly integrated with the `Provider` to make usage as easy as possible:
21+
Alloy provides two ways in which a user can make multicalls to the [Multicall3 contract](https://www.multicall3.com/), both of which tightly integrated with the `Provider` to make usage as easy as possible:
22+
1723
1. Multicall Builder: The `multicall()` method gives you explicit control over which calls to batch
1824
2. Multi-batching Layer: The batching layer automatically batches requests that are made in parallel
1925

@@ -36,15 +42,16 @@ let multicall = provider
3642

3743
You can find the complete example [here](/examples/providers/multicall)
3844

39-
This approach is suitable when:
45+
This approach is suitable when:
46+
4047
- You know exactly which calls you want to batch together
4148
- You need to explicitly collect related data in a single request
4249
- You need fine-grained control over the order of results
4350
- You are working with varied contract types in a single batch
4451

4552
### 2. Multicall Batching Layer
4653

47-
The batching layer is especially powerful because it requires no changes to your existing code and reduces the number of network requests.
54+
The batching layer is especially powerful because it requires no changes to your existing code and reduces the number of network requests.
4855

4956
However, this only works when requests are made in parallel, for example when using the
5057
[`tokio::join!`] macro or in multiple threads/tasks, as otherwise the requests will be sent one
@@ -75,5 +82,6 @@ async fn f(url: &str) -> Result<(), Box<dyn std::error::Error>> {
7582
```
7683

7784
Find the complete example [here](/examples/providers/multicall_batching). This approach is suitable when:
85+
7886
- You want to optimize existing code without restructuring it
79-
- You need to batch calls that are made from different parts of your codebase
87+
- You need to batch calls that are made from different parts of your codebase

vocs/docs/pages/guides/rpc-provider-abstraction.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1+
---
2+
description: Abstract provider implementations to work seamlessly across different transport layers and connection types
3+
---
4+
15
# RPC Provider Abstractions
26

3-
Alloy offers *Provider Wrapping* as a design pattern that lets you extend or customize the behavior of a Provider by encapsulating it inside another object.
7+
Alloy offers _Provider Wrapping_ as a design pattern that lets you extend or customize the behavior of a Provider by encapsulating it inside another object.
48

59
There are several reasons why you would want create your own RPC provider abstractions, for example to simplify complex workflows, or build more intuitive interfaces for particular use cases (like deployment, data indexing, or trading).
610

711
Let's dive into an example: Imagine you have multiple contracts that need to be deployed and monitored. Rather than repeating the same boilerplate code throughout your application, you can create specialized abstractions that wrap the Provider. Your `Deployer` struct ingests the `Provider` and the bytecode to deploy contracts and interact with them. More on this in the example snippets below.
812

9-
There are two ways to ways to implement provider wrapping, both offer different trade-offs depending on your use case:
13+
There are two ways to ways to implement provider wrapping, both offer different trade-offs depending on your use case:
1014

1115
1. Using Generics (`P: Provider`): Preserves type information and enables static dispatch
1216
2. Using Type Erasure (`DynProvider`): Simplifies types at the cost of some runtime overhead
1317

1418
## 1. Using generics `P: Provider`
1519

16-
The ideal way is by using the `P: Provider` generic on the encapsulating type. This approach Preserves full type information and static dispatch, though can lead to complex type signatures and handling generics.
20+
The ideal way is by using the `P: Provider` generic on the encapsulating type. This approach Preserves full type information and static dispatch, though can lead to complex type signatures and handling generics.
1721

1822
This is depicted by the following [example](/examples/providers/wrapped_provider). Use generics when you need maximum performance and type safety, especially in library code.
1923

2024
```rust [wrapped_provider.rs]
2125
// [!include ~/snippets/providers/examples/wrapped_provider.rs]
2226
```
2327

24-
During this approach the compiler creates a unique `Deployer` struct for each Provider type you use static dispatch with slightly better runtime overhead.
28+
During this approach the compiler creates a unique `Deployer` struct for each Provider type you use static dispatch with slightly better runtime overhead.
2529
Use this approach when performance is critical, type information is valuable e.g. when creating library code or working with embedded systems.
2630
Type information is valuable: You need to know the exact Provider type for specialized behavior
2731

@@ -35,10 +39,10 @@ Use DynProvider when you prioritize simplicity and flexibility, such as in appli
3539
// [!include ~/snippets/providers/examples/dyn_provider.rs]
3640
```
3741

38-
With `DynProvider` we use dynamic dispatch, accept a slightly slower runtime overhead but can avoid dealing with generics.
39-
Use this approach when you prefer simplicity over speed speed, minimise compile and binary size or want to create heterogeneous collections.
42+
With `DynProvider` we use dynamic dispatch, accept a slightly slower runtime overhead but can avoid dealing with generics.
43+
Use this approach when you prefer simplicity over speed speed, minimise compile and binary size or want to create heterogeneous collections.
4044

41-
## `Provider` does not require `Arc`
45+
## `Provider` does not require `Arc`
4246

4347
You might be tempted to wrap a `Provider` in `Arc` to enable sharing and cloning:
4448

@@ -57,4 +61,4 @@ struct MyProvider<P: Provider + Clone> {
5761
}
5862
```
5963

60-
This eliminates common boilerplate and prevents potential performance issues from double Arc-ing.
64+
This eliminates common boilerplate and prevents potential performance issues from double Arc-ing.

vocs/docs/pages/guides/signers-vs-ethereum-wallet.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
description: Manage different signer types within a single EthereumWallet for flexible transaction signing strategies
3+
---
4+
15
# Signers vs Ethereum Wallet
26

37
## Signer

0 commit comments

Comments
 (0)