Skip to content

Commit

Permalink
use arg-type arg-description css classes
Browse files Browse the repository at this point in the history
  • Loading branch information
fracek committed Jan 6, 2025
1 parent 421ee22 commit d93eb5a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions docs/v2/getting-started/indexers/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,27 @@ export default defineIndexer(StarknetStream)({ /* ... */ });

All indexers take the same configuration options.

- **`streamUrl`**<span class="text-muted-foreground">`string`</span><br/><span class="text-muted-foreground">The URL of the DNA stream to connect to.</span>
- **`filter`**<span class="text-muted-foreground">`TFilter`</span><br/><span class="text-muted-foreground">The filter to apply to the DNA stream. This argument is specific to the stream definition. You should refer to the chain's filter reference for the available options (see [Beacon Chain](/docs/v2/networks/beaconchain/filter), [EVM (Ethereum)](/docs/v2/networks/evm/filter), [Starknet](/docs/v2/networks/starknet/filter)).</span>
- **`finality`**<span class="text-muted-foreground">`"finalized" | "accepted" | "pending"`</span><br/><span class="text-muted-foreground">Receive data with the specified finality. Defaults to `accepted`.</span>
- **`startingCursor`**<span class="text-muted-foreground">`{ orderKey: bigint, uniqueKey?: string }`</span><br/><span class="text-muted-foreground">The cursor to start the indexer from. Defaults to the genesis block. The `orderKey` represents the block number, and the `uniqueKey` represents the block hash (optional).</span>
- **`debug`**<span class="text-muted-foreground">`boolean`</span><br/><span class="text-muted-foreground">Enable debug mode. This will print debug information to the console.</span>
- **`transform`**<span class="text-muted-foreground">`({ block, cursor, endCursor, finality, context }) => Promise<void>`</span><br/><span class="text-muted-foreground">The transform function called for each block received from the DNA stream.</span>
- **`factory`**<span class="text-muted-foreground">`({ block, context }) => Promise<{ filter?: TFilter }>`</span><br/><span class="text-muted-foreground">The factory function used to add data filters at runtime. Useful for creating indexers for smart contracts like Uniswap V2.</span>
- **`hooks`**<span class="text-muted-foreground">`object`</span><br/><span class="text-muted-foreground">The hooks to register with the indexer. Refer to the [plugins & hooks](/docs/v2/getting-started/plugins) page for more information.</span>
- **`plugins`**<span class="text-muted-foreground">`array`</span><br/><span class="text-muted-foreground">The plugins to register with the indexer. Refer to the [plugins & hooks](/docs/v2/getting-started/plugins) page for more information.</span>
- **`streamUrl`**<span class="arg-type">`string`</span><br/><span class="arg-description">The URL of the DNA stream to connect to.</span>
- **`filter`**<span class="arg-type">`TFilter`</span><br/><span class="arg-description">The filter to apply to the DNA stream. This argument is specific to the stream definition. You should refer to the chain's filter reference for the available options (see [Beacon Chain](/docs/v2/networks/beaconchain/filter), [EVM (Ethereum)](/docs/v2/networks/evm/filter), [Starknet](/docs/v2/networks/starknet/filter)).</span>
- **`finality`**<span class="arg-type">`"finalized" | "accepted" | "pending"`</span><br/><span class="arg-description">Receive data with the specified finality. Defaults to `accepted`.</span>
- **`startingCursor`**<span class="arg-type">`{ orderKey: bigint, uniqueKey?: string }`</span><br/><span class="arg-description">The cursor to start the indexer from. Defaults to the genesis block. The `orderKey` represents the block number, and the `uniqueKey` represents the block hash (optional).</span>
- **`debug`**<span class="arg-type">`boolean`</span><br/><span class="arg-description">Enable debug mode. This will print debug information to the console.</span>
- **`transform`**<span class="arg-type">`({ block, cursor, endCursor, finality, context }) => Promise<void>`</span><br/><span class="arg-description">The transform function called for each block received from the DNA stream.</span>
- **`factory`**<span class="arg-type">`({ block, context }) => Promise<{ filter?: TFilter }>`</span><br/><span class="arg-description">The factory function used to add data filters at runtime. Useful for creating indexers for smart contracts like Uniswap V2.</span>
- **`hooks`**<span class="arg-type">`object`</span><br/><span class="arg-description">The hooks to register with the indexer. Refer to the [plugins & hooks](/docs/v2/getting-started/plugins) page for more information.</span>
- **`plugins`**<span class="arg-type">`array`</span><br/><span class="arg-description">The plugins to register with the indexer. Refer to the [plugins & hooks](/docs/v2/getting-started/plugins) page for more information.</span>

### The transform function

The `transform` function is invoked for each block received from the DNA stream. This function is where you should implement your business logic.

**Arguments**

- **`block`**<span class="text-muted-foreground">`TBlock`</span><br/><span class="text-muted-foreground">The block received from the DNA stream. This is chain-specific (see [Beacon Chain](/docs/v2/networks/beaconchain/data), [EVM (Ethereum)](/docs/v2/networks/evm/data), [Starknet](/docs/v2/networks/starknet/data)).</span>
- **`cursor`**<span class="text-muted-foreground">`{ orderKey: bigint, uniqueKey?: string }`</span><br/><span class="text-muted-foreground">The cursor of the block before the received block.</span>
- **`endCursor`**<span class="text-muted-foreground">`{ orderKey: bigint, uniqueKey?: string }`</span><br/><span class="text-muted-foreground">The cursor of the current block.</span>
- **`finality`**<span class="text-muted-foreground">`"finalized" | "accepted" | "pending"`</span><br/><span class="text-muted-foreground">The finality of the block.</span>
- **`context`**<span class="text-muted-foreground">`object`</span><br/><span class="text-muted-foreground">The context shared between the indexer and the plugins.</span>
- **`block`**<span class="arg-type">`TBlock`</span><br/><span class="arg-description">The block received from the DNA stream. This is chain-specific (see [Beacon Chain](/docs/v2/networks/beaconchain/data), [EVM (Ethereum)](/docs/v2/networks/evm/data), [Starknet](/docs/v2/networks/starknet/data)).</span>
- **`cursor`**<span class="arg-type">`{ orderKey: bigint, uniqueKey?: string }`</span><br/><span class="arg-description">The cursor of the block before the received block.</span>
- **`endCursor`**<span class="arg-type">`{ orderKey: bigint, uniqueKey?: string }`</span><br/><span class="arg-description">The cursor of the current block.</span>
- **`finality`**<span class="arg-type">`"finalized" | "accepted" | "pending"`</span><br/><span class="arg-description">The finality of the block.</span>
- **`context`**<span class="arg-type">`object`</span><br/><span class="arg-description">The context shared between the indexer and the plugins.</span>

The following example shows a minimal indexer that streams block headers and prints them to the console.

Expand Down

0 comments on commit d93eb5a

Please sign in to comment.