Documentation Index
Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
Use this file to discover all available pages before exploring further.
← Back to Portal Setup
Return to the Portal setup overview to explore other deployment options.
Prerequisites
Before starting, ensure you have:- An existing EVM indexer using
@subsquid/evm-processor - Node.js and npm installed
- Access to an SQD Portal
Migration Steps
Verify Portal Support
Make sure you have an SQD portal URL for your dataset and that real-time data is supported.Public Portal URLs follows this pattern:where
<dataset-slug> is found on the networks page.Update Processor Configuration
Replace your processor configuration (typically at If your project re-exports data types (typically from Add transaction/trace/state-diff entries as needed — TypeScript errors at compile time will point you at any field still missing from the selection.
src/processor.ts or src/main.ts) with a data source configuration.Update Imports
Replace the processor imports with the new data source and object imports:src/processor.ts), update those imports too. The data types are now split across two packages:@subsquid/evm-streamexportsFieldSelection.@subsquid/evm-objectsexports the augmented block data types:BlockHeader,Block(the parent oftransactions/logs/etc., previously calledBlockData),Log,Transaction,Trace,StateDiff.
Replace Processor Initialization
ReplaceEvmBatchProcessor initialization with DataSourceBuilder:RPC endpoint and finality confirmation settings are no longer needed.
Update Type Exports
Ifsrc/processor.ts re-exports Fields/Block/BlockData/Log/Transaction and a per-project context alias (often called ProcessorContext), rewrite them in terms of the new packages. There are three changes to be aware of:BlockData<F>is renamed toBlock<F>in@subsquid/evm-objects. The single-block type that used to be calledBlock(just the header) is nowBlockHeader<F>.- The upstream
DataHandlerContextlives in@subsquid/batch-processor. Its generic arguments are flipped — it isDataHandlerContext<Block, Store>, notDataHandlerContext<Store, Fields>. It also has only{store, blocks, isHead}— nologand no_chain. Add those yourself when defining your project’s enriched context type. With the originalDataHandlerContextno longer in your imports, this is also a natural time to rename your project alias toDataHandlerContext— the name fits the role better thanProcessorContextnow that there is no processor object. - The
Fieldstype alias should be derived from the samefieldsconstant you pass to.setFields().
Expand the Field Selection
If your previousfields constant relied on the merged defaults, expand it to enumerate every field your handler actually reads. A minimum set typical for an EVM logs indexer looks like:Update Data Requests
Rewrite data requests using the newwhere-include-range syntax:Build the Data Source
Include a.build() call at the end of the data source initialization:Update the Run Function
Replace the
processor.run() call with the unified run function.Import the Run Function
Add therun function import to your main file:Create a Logger
Manually create a logger for your batch handler:Replace processor.run()
Update the run call and enrich the context:View Complete Diff Example
View Complete Diff Example
Here’s a full example of the changes up to this point:
Add RPC Client (Optional)
If you use direct RPC calls in your batch handler, you’ll need to add an RPC client to your context.If you keep a Now your contract state queries will work as before:
Install RPC Client
Initialize RPC Client
Import and initialize anRpcClient:Enrich Context
In your batch handler, add the_chain field to the context:DataHandlerContext<Store> alias in src/processor.ts, extend it so the _chain field is part of the type your handlers see:Migration Complete
Your indexer is now ready to source real-time data from an SQD Network portal. The portal provides improved performance and reliability compared to RPC endpoints.
Example Migrations
Complete migration examples for a simple USDC transfers indexer are available:Without RPC Client
Basic migration example without RPC client integration
With RPC Client
Migration example including RPC client for state queries
Next Steps
Portal API Reference
Explore the complete Portal API documentation
EVM Examples
See more examples of Portal API usage
