Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/pages/accounts/server/handler.relay.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const handler = Handler.relay({
```

```ts twoslash [client.ts]
// @noErrors
import { Provider } from 'accounts'
const provider = Provider.create()
const [account] = await provider.request({ method: 'eth_accounts' })
Expand Down Expand Up @@ -135,6 +136,7 @@ When a user has insufficient balance of a required token, the relay automaticall
:::code-group

```ts twoslash [client.ts]
// @noErrors
import { Provider } from 'accounts'
const provider = Provider.create()
const [account] = await provider.request({ method: 'eth_accounts' })
Expand Down Expand Up @@ -192,6 +194,7 @@ Picks the user's optimal `feeToken` automatically:
3. Validator fallback

```ts twoslash
// @noErrors
import { Provider } from 'accounts'
const provider = Provider.create()
const [account] = await provider.request({ method: 'eth_accounts' })
Expand Down Expand Up @@ -224,6 +227,7 @@ Simulates the transaction and returns per-account token balance diffs in `capabi
:::code-group

```ts twoslash [client.ts]
// @noErrors
import { Provider } from 'accounts'
const provider = Provider.create()
const [account] = await provider.request({ method: 'eth_accounts' })
Expand Down Expand Up @@ -271,6 +275,7 @@ Derives fee estimates from the filled transaction and returns them as both raw a
:::code-group

```ts twoslash [client.ts]
// @noErrors
import { Provider } from 'accounts'
const provider = Provider.create()
const [account] = await provider.request({ method: 'eth_accounts' })
Expand Down Expand Up @@ -310,6 +315,7 @@ const handler = Handler.relay()
For insufficient balance errors, the relay also returns a `capabilities.requireFunds` object with the exact deficit amount and token metadata — enabling UIs to prompt the user to fund their account.

```ts twoslash
// @noErrors
import { Provider } from 'accounts'
const provider = Provider.create()
const [account] = await provider.request({ method: 'eth_accounts' })
Expand Down Expand Up @@ -357,6 +363,7 @@ By default, only a minimum set of features are enabled, given on what options yo
Set [`features: 'all'`](#features) to enable all features by default such as: **fee token resolution**, **auto-swap**, and **simulation** (balance diffs + fee breakdown). This will come at the cost of slightly increased network latency.

```ts twoslash
// @noErrors
import { privateKeyToAccount } from 'viem/accounts'
import { Handler } from 'accounts/server'

Expand Down Expand Up @@ -415,6 +422,7 @@ Controls which relay features are enabled. By default, only fee payer sponsorshi
- `undefined` (default): enables only features that are configured via options (e.g. `feePayer`, `autoSwap`, etc).

```ts twoslash
// @noErrors
import { Handler } from 'accounts/server'

const handler = Handler.relay({
Expand Down
Loading