Skip to content

Railgun-Community/subsquid-integration

Repository files navigation

Migration using Scripts

  1. Run docker

    NOTE: This is needed if we want to generate the migration file that is located under the folder "db". Any changes in the schema(graphql file) is only reflected after generating migration files.
    If the "db" folder is missing or the empty then we have to generate it. schema.graphql content change You need to run an instance of docker to generate db file.

  2. Build the squid

       ./build
  3. Compile the chain to generate .yaml file in "build" directory

    # chainId can be any valid supported chainId or '*' to compile all chain
    yarn compile-chain chainId=[chainId]
  4. Deploy the squid. The deploy script looks in the build folder and deploy all the yaml file

    ./deploy-chain

How to Migrate Manually

Steps to run locally

  1. Generate the DB entities from the schema

     sqd codegen
     sqd build
  2. Start local database instance and generate migrations using entities (Note: start an instance of docker)

     sqd up
     sqd migration:generate
  3. Generate typing from the ABI

     sqd typegen
  4. Start processing the data / Run processor

     sqd process

    NOTE: This bailout in local when the block reaches the final block or exceed it while processing in batch

  5. Serve the indexed data

     sqd serve

    Inspect the auto-generated GraphQL API using an interactive playground at
    http://localhost:4350/graphql

Steps to deploy on subsquid cloud

NOTE: Before deploying in the cloud, please make sure the secrets defined in the subsquid.yaml are set in the subsquid cloud. Secrets are global to all the squid. Some value specific to squid maybe need to be set in squid.yaml

  1. Generate key from subsquid cloud by going to the profile
    https://app.subsquid.io/profile/auth-key
  2. Add key in the project to authenticate
     sqd auth -k <key>
  3. Generate squid.yaml file to deploy
     npm run compile-chain chainId=[chainId]

    ** NOTE** Different config for chainId can be found on chain-squid-config.ts file which is replaced to squid template yaml file

  4. Deploy the squid
    sqd deploy -m [YAML_FILE_NAME] --hard-reset -o [organization_name]
    E.g. sqd deploy -m squid-arbitrum.yaml -o rail-squid

    NOTE: --hard-reset flag is used to start the indexing from the starting block. If that is not the case, we can remove it. But do note that any changes to the schema needs to be build and deployed from the starting block

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published