Documentation Index
Fetch the complete documentation index at: https://beta.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
- An existing Squid SDK-based Solana squid using
@subsquid/solana-streamwith.setGateway()and/or.setRpc()
Migration steps
Install @portal-api packages
A. Enter your squid’s folder.B. Remove both your lock file and the C. Upgrade all SQD packages that have a D. Freeze the versions of
E. Install the dependencies:
node_modules folder:- NPM
- Yarn
- PNPM
@portal-api version to it:@portal-api packages by removing any version range specifiers (^, ~, <, >, >=, <=) preceding the package versions. Here’s a script:You can also do it manually
You can also do it manually
Here’s an example edit:
- NPM
- Yarn
- PNPM
Update your code
A. Replace all existing data sources with the portal:Also, please remove any mentions of B. Replace any block height literals with slot number literals.Use this converter to translate block heights into slot numbers. It bisects the chain through the public Portal:C. If you used the D. If you need the block height (for example to stay compatible with your old code) request it in the
SolanaRpcClient, for example:slot field of block headers anywhere in your code, replace it with .number:.setFields call:Test by re-syncing
We highly recommend that all squids migrated to Portal are tested by re-syncing them. This will allow you to make sure that everything works as expected for the whole length of the chain and catch any bugs early.To resync your squid, follow the zero-downtime update procedure:
- Deploy your squid into a new slot.
- Wait for it to sync, observing the improved data fetching.
- Assign your production tag to the new deployment to redirect the GraphQL requests there.
A workaround that allows continuous operation without a resync (not recommended)
A workaround that allows continuous operation without a resync (not recommended)
Assuming your squid is version-controlled and has one processor:
- Commit your updated squid code.
-
Stop your Cloud squid deployment.
- Reset your repo to the state before the updates.
- Add the
tofield to the argument of the.setBlockRangeDataSourceBuildercall (likely in./src/main.ts). Set it to the current slot number. - Update your deployment.
- Take a look at your squid’s logs. It should be repeatedly terminating (due to having nothing to do) and restarting.
-
Connect to the squid’s database and update the
heightfield of the status schema to contain slot instead of the block height of the block mentioned there. -
Verify that the
heightfield updated successfully by re-reading the status schema. - Reset your codebase to its updated version and redeploy your squid again.
Your squid is now configured to source data from Portal.
