├── .gitbook └── assets │ ├── hydra-diagram.png │ └── hydra-logo-horizontallockup.svg ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .vscode ├── ltex.dictionary.en-US.txt ├── ltex.disabledRules.en-US.txt └── ltex.hiddenFalsePositives.en-US.txt ├── CONTRIBUTING.md ├── Dockerfile ├── babel.config.js ├── docs ├── apeworx.md ├── cloud │ ├── _category_.json │ ├── overview-create-org.png │ ├── overview-deploy2.png │ ├── overview-deployed.png │ ├── overview-monitor.png │ ├── overview-rpc-page.png │ ├── overview-secret1.png │ ├── overview-secret2.png │ ├── overview.md │ ├── pricing.md │ ├── reference │ │ ├── _category_.json │ │ ├── deployments-two-changelog.md │ │ ├── hasura.md │ │ ├── manifest.mdx │ │ ├── pg.md │ │ ├── rpc-proxy-networks.md │ │ ├── scale.md │ │ └── squidignore.md │ ├── resources │ │ ├── _category_.json │ │ ├── best-practices.md │ │ ├── billing-setup.png │ │ ├── create-an-organization.png │ │ ├── env-variables.md │ │ ├── logging.md │ │ ├── migrate-to-portal-on-evm-or-substrate.mdx │ │ ├── migrate-to-portal-on-solana.mdx │ │ ├── monitoring.md │ │ ├── organizations.md │ │ ├── production-alias.md │ │ ├── query-optimization.md │ │ ├── rpc-proxy.md │ │ ├── slots-and-tags-development-and-production.png │ │ ├── slots-and-tags-first-squid.png │ │ ├── slots-and-tags-second-squid.png │ │ ├── slots-and-tags-slot-location.png │ │ ├── slots-and-tags-two-major-versions.png │ │ └── slots-and-tags.mdx │ └── troubleshooting.md ├── conduit-integration.mdx ├── dead.md ├── deployments-two-release-notes.md ├── external-tools.md ├── firesquid.md ├── fuel-indexing │ ├── _category_.json │ ├── cli-cheatsheet.mdx │ ├── fuel-datasource │ │ ├── _category_.json │ │ ├── context-interfaces.md │ │ ├── field-selection.md │ │ ├── general.md │ │ ├── inputs.md │ │ ├── outputs.md │ │ ├── receipts.md │ │ └── transactions.md │ ├── indexing-receipts.mdx │ └── network-api │ │ ├── _category_.json │ │ └── fuel-api.md ├── glossary.md ├── hyperliquid-support.mdx ├── index.mdx ├── migrate-to-portal-cloud.mdx ├── migrate-to-portal-sdk.md ├── network-launch-quests-rules.md ├── overview.mdx ├── portal-closed-beta-information.md ├── portal-rate-limited.md ├── portal-release-notes.mdx ├── sdk │ ├── _category_.json │ ├── examples.mdx │ ├── faq.md │ ├── how-to-start │ │ ├── _category_.json │ │ ├── cli-cheatsheet.mdx │ │ ├── development-environment-set-up.mdx │ │ ├── layout.md │ │ ├── squid-development.mdx │ │ ├── squid-from-scratch-abi-fetching.png │ │ └── squid-from-scratch.mdx │ ├── overview.mdx │ ├── quickstart-working-api.png │ ├── quickstart.md │ ├── reference │ │ ├── _category_.json │ │ ├── frontier.md │ │ ├── logger.md │ │ ├── openreader-server │ │ │ ├── _category_.json │ │ │ ├── api │ │ │ │ ├── _category_.json │ │ │ │ ├── and-or-filters.md │ │ │ │ ├── cross-relation-field-queries.md │ │ │ │ ├── intro.md │ │ │ │ ├── json-queries.md │ │ │ │ ├── nested-field-queries.md │ │ │ │ ├── paginate-query-results.md │ │ │ │ ├── queries.md │ │ │ │ ├── resolve-union-types-interfaces.md │ │ │ │ └── sorting.md │ │ │ ├── configuration │ │ │ │ ├── _category_.json │ │ │ │ ├── authorization.md │ │ │ │ ├── caching.md │ │ │ │ ├── custom-resolvers.md │ │ │ │ ├── dos-protection.md │ │ │ │ └── subscriptions.md │ │ │ └── overview.md │ │ ├── processors │ │ │ ├── _category_.json │ │ │ ├── architecture.mdx │ │ │ ├── evm-batch │ │ │ │ ├── _category_.json │ │ │ │ ├── context-interfaces.md │ │ │ │ ├── field-selection.md │ │ │ │ ├── general.md │ │ │ │ ├── logs.md │ │ │ │ ├── state-diffs.md │ │ │ │ ├── traces.md │ │ │ │ └── transactions.md │ │ │ └── substrate-batch │ │ │ │ ├── _category_.json │ │ │ │ ├── autocomplete-selectors.png │ │ │ │ ├── context-interfaces.md │ │ │ │ ├── data-requests.md │ │ │ │ ├── field-selection.md │ │ │ │ └── general.md │ │ ├── schema-file │ │ │ ├── _category_.json │ │ │ ├── entities.md │ │ │ ├── entity-relations.md │ │ │ ├── indexes-and-constraints.md │ │ │ ├── interfaces.md │ │ │ ├── intro.md │ │ │ └── unions-and-typed-json.md │ │ └── store │ │ │ ├── _category_.json │ │ │ ├── bigquery.md │ │ │ ├── file │ │ │ ├── _category_.json │ │ │ ├── csv.md │ │ │ ├── json.md │ │ │ ├── parquet.md │ │ │ └── s3-dest.md │ │ │ └── typeorm.md │ ├── resources │ │ ├── _category_.json │ │ ├── batch-processing.md │ │ ├── evm │ │ │ ├── _category_.json │ │ │ ├── factory-contracts.md │ │ │ └── proxy-contracts.md │ │ ├── external-api.md │ │ ├── migrate │ │ │ ├── _category_.json │ │ │ ├── migrate-subgraph.md │ │ │ ├── migrate-to-arrowsquid-on-substrate.md │ │ │ ├── migrate-to-arrowsquid.md │ │ │ └── migrate-to-hasura-configuration-tool-v2.md │ │ ├── multichain.md │ │ ├── persisting-data │ │ │ ├── _category_.json │ │ │ ├── bigquery.md │ │ │ ├── file.md │ │ │ ├── overview.md │ │ │ └── typeorm.md │ │ ├── self-hosting.md │ │ ├── serving-graphql-database-creds.png │ │ ├── serving-graphql.md │ │ ├── substrate │ │ │ ├── _category_.json │ │ │ ├── data-sourcing-miniguide.md │ │ │ ├── frontier-evm.md │ │ │ ├── gear.md │ │ │ ├── ink.md │ │ │ └── types-bundle-miniguide.md │ │ ├── tools │ │ │ ├── _category_.json │ │ │ ├── hasura-configuration-web-ui-import-export.png │ │ │ ├── hasura-configuration.md │ │ │ ├── migrations-gen.md │ │ │ ├── model-gen.md │ │ │ ├── squid-gen.md │ │ │ └── typegen │ │ │ │ ├── _category_.json │ │ │ │ ├── decoding.mdx │ │ │ │ ├── generation.mdx │ │ │ │ └── state-queries.mdx │ │ └── unfinalized-blocks.mdx │ ├── subsquid-vs-thegraph.md │ ├── troubleshooting.mdx │ └── tutorials │ │ ├── _category_.json │ │ ├── batch-processor-in-action.mdx │ │ ├── bayc │ │ ├── _category_.json │ │ ├── bayc-playground-step-one.png │ │ ├── bayc-playground-step-three.png │ │ ├── bayc-playground-step-two.png │ │ ├── step-four-optimizations.md │ │ ├── step-one-indexing-transfers.md │ │ ├── step-three-adding-external-data.md │ │ └── step-two-deriving-owners-and-tokens.md │ │ ├── case-studies.md │ │ ├── evm-local.md │ │ ├── file-csv.md │ │ ├── file-parquet.md │ │ ├── frontier-evm.md │ │ ├── ink.md │ │ └── substrate.md ├── solana-indexing │ ├── _category_.json │ ├── how-to-start │ │ ├── _category_.json │ │ ├── cli-cheatsheet.mdx │ │ └── indexing-orca.mdx │ ├── network-api │ │ ├── _category_.json │ │ └── solana-api.md │ └── sdk │ │ ├── _category_.json │ │ ├── solana-batch │ │ ├── _category_.json │ │ ├── balances.md │ │ ├── context-interfaces.md │ │ ├── field-selection.md │ │ ├── general.md │ │ ├── instructions.md │ │ ├── logs.md │ │ ├── rewards.md │ │ ├── token-balances.md │ │ └── transactions.md │ │ └── typegen.md ├── sqd-boost-landing.md ├── squid-cli │ ├── _category_.json │ ├── auth.md │ ├── autocomplete.md │ ├── commands-json.md │ ├── deploy.md │ ├── explorer.md │ ├── gateways.md │ ├── init.md │ ├── installation-deployment-key.png │ ├── installation.md │ ├── list.md │ ├── logs.md │ ├── prod.md │ ├── remove.md │ ├── restart.md │ ├── run.md │ ├── secrets.md │ ├── tags.md │ └── whoami.md ├── subgraphs-support-configuration.gif ├── subgraphs-support.md ├── subsquid-network │ ├── _category_.json │ ├── faq.md │ ├── overview.mdx │ ├── participate │ │ ├── _category_.json │ │ ├── delegate.md │ │ ├── delegate_dashboard.png │ │ ├── delegate_form.png │ │ ├── delegate_my_delegations.png │ │ ├── delegate_undelegate.png │ │ ├── gateway.md │ │ ├── gateway_registration_button.png │ │ ├── gateway_registration_form.png │ │ ├── gateway_registration_form_public.png │ │ ├── portal.mdx │ │ ├── portal_auto_extension.png │ │ ├── portal_lock_active.png │ │ ├── portal_lock_button.png │ │ ├── portal_lock_form.png │ │ ├── portal_lock_success.png │ │ ├── portal_registration_button.png │ │ ├── portal_registration_form.png │ │ ├── portal_registration_form_public.png │ │ ├── procuring-sqd.md │ │ ├── worker.md │ │ ├── worker_registration_form.png │ │ └── worker_registration_wallet.png │ ├── portal-open-beta.md │ ├── reference │ │ ├── _category_.json │ │ ├── evm-api.md │ │ ├── networks.mdx │ │ ├── starknet-api.md │ │ └── substrate-api.md │ ├── tokenomics.md │ └── whitepaper.md ├── tron-indexing │ ├── _category_.json │ ├── cli-cheatsheet.mdx │ ├── indexing-usdt-transfers.mdx │ ├── network-api │ │ ├── _category_.json │ │ └── tron-api.md │ └── tron-batch-processor │ │ ├── _category_.json │ │ ├── context-interfaces.md │ │ ├── field-selection.md │ │ ├── general.md │ │ ├── internal-transactions.md │ │ ├── logs.md │ │ └── transactions.md └── versions.md ├── docusaurus.config.js ├── orphaned-docs ├── evm-config-caveats.md ├── evm-processor.md ├── giant-squid-api │ ├── _README.md │ ├── _category_.json │ ├── _client-example.md │ ├── _queries.md │ ├── gs-explorer.md │ ├── gs-main.md │ ├── gs-stats.md │ ├── overview.md │ └── statuses.md ├── quickstart │ ├── _category_.json │ ├── quickstart-abi.md │ ├── quickstart-ethereum.md │ └── quickstart-substrate.md ├── squid-development.md └── substrate-processor.md ├── package-lock.json ├── package.json ├── redirectRules.js ├── scripts ├── checkAllCategorySlugs.sh ├── networksLists │ ├── bin │ │ ├── evm.js │ │ ├── rpcProxy.js │ │ └── substrate.js │ └── lib │ │ ├── formatTable.js │ │ └── getArchiveCapabilities.js ├── pageMigrationOps │ ├── README.md │ ├── checkFilesExistence.sh │ ├── redirectAddNewOnes.sh │ ├── redirectRewriteDestinations.sh │ └── rewriteLinks.sh └── validateTagsJson.js ├── sidebars.js ├── src ├── _mock │ └── code-slider-data.tsx ├── components │ ├── CodeSlider │ │ ├── CodeSlider.css │ │ └── CodeSlider.tsx │ ├── Expand │ │ ├── Expand.tsx │ │ └── ExpandContent.tsx │ ├── TagsNavigation │ │ ├── index.module.css │ │ └── index.tsx │ ├── code-step.tsx │ ├── content-feature.tsx │ ├── docs-rating.tsx │ ├── guide-card.tsx │ ├── home │ │ ├── index.module.css │ │ └── index.tsx │ ├── markdown.tsx │ └── tutorial-card.tsx ├── css │ └── custom.css └── theme │ └── DocItem │ └── Footer │ ├── index.tsx │ └── styles.module.css ├── static ├── .nojekyll ├── fonts │ ├── Archia │ │ └── archia-regular-webfont.ttf │ └── Circular │ │ └── CircularAir-Light.ttf ├── img │ ├── .gitbook │ │ └── assets │ │ │ ├── Group 513211222.png │ │ │ ├── PXL_20220124_161549932.jpg │ │ │ ├── Screenshot-2022-02-02-111440-1.png │ │ │ ├── Screenshot-2022-02-02-111440.png │ │ │ ├── Squid Architecture (1).png │ │ │ ├── Squid Architecture diagram (1).png │ │ │ ├── Squid Archive components.png │ │ │ ├── SquidSaas-full.png │ │ │ ├── SquidSaas-full_release.png │ │ │ ├── SquidSaas.png │ │ │ ├── SquidSaas_v2.png │ │ │ ├── Squid_Architecture.png │ │ │ ├── Squid_Archive.png │ │ │ ├── app-create-squid-form.png │ │ │ ├── app-deploy-squid-highlighted.jpeg │ │ │ ├── app-deploy-squid.png │ │ │ ├── app-empty-projects.png │ │ │ ├── app-home-page.png │ │ │ ├── app-squid-created-deployed.png │ │ │ ├── archive-docker-compose-up.png │ │ │ ├── archive-list.png │ │ │ ├── container-graphql.png │ │ │ ├── discord-1584x200.png │ │ │ ├── docker-build.png │ │ │ ├── folder-structure.png │ │ │ ├── hydra-diagram.png │ │ │ ├── hydra-logo-horizontallockup.svg │ │ │ ├── image-1.png │ │ │ ├── image-2.png │ │ │ ├── image-3.png │ │ │ ├── image.png │ │ │ ├── logging-1.png │ │ │ ├── logging-2.png │ │ │ ├── metrics.png │ │ │ ├── subsquid saas3 (1).png │ │ │ ├── subsquid saas4.png │ │ │ ├── subsquid-archive-docker-container-ls.png │ │ │ ├── subsquid-saas-1.png │ │ │ ├── subsquid-saas-2.png │ │ │ ├── subsquid-saas-3.png │ │ │ └── subsquid-saas.png │ ├── archive-and-sdk.png │ ├── autocomplete-selectors.png │ ├── batch-context.png │ ├── csv-files.png │ ├── deploy-squid.svg │ ├── desktop-computer-emoji.png │ ├── develop-squid.svg │ ├── dislike.png │ ├── docusaurus.png │ ├── etherscan-proxy.png │ ├── favicon.png │ ├── ganache-create-workspace-1.png │ ├── ganache-create-workspace-2.png │ ├── ganache-create-workspace.png │ ├── gear-emoji.png │ ├── header-bg.png │ ├── like.png │ ├── logo-dark.svg │ ├── logo-light.svg │ ├── mage-emoji.png │ ├── mage.png │ ├── magic-wand-emoji.png │ ├── menu-arrow.svg │ ├── network-choice.png │ ├── parquet-files.png │ ├── query-squid.svg │ ├── rocket_launch.svg │ ├── run-squid.svg │ ├── scroll-emoji.png │ ├── secrets-outdated.png │ ├── slogan.svg │ ├── smile.png │ ├── sqd-explorer-snap.png │ ├── squid-diagram.png │ ├── squid-emoji.png │ ├── subsquid-ecosystem.png │ ├── thegraph-vs-subsquid.png │ ├── undraw_docusaurus_mountain.svg │ ├── undraw_docusaurus_react.svg │ └── undraw_docusaurus_tree.svg └── json │ └── tags.json ├── tailwind.config.js ├── tsconfig.json └── versions.json /.gitbook/assets/hydra-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/.gitbook/assets/hydra-diagram.png -------------------------------------------------------------------------------- /.gitbook/assets/hydra-logo-horizontallockup.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | on: 3 | push: 4 | branches: 5 | - new-docs 6 | - develop 7 | - master 8 | paths: 9 | - .github/workflows/build.yaml 10 | - mkdocs.yml 11 | - Dockerfile 12 | - docs/** 13 | - src/** 14 | - docusaurus.config.js 15 | workflow_dispatch: {} 16 | 17 | 18 | env: 19 | PROJECT_ID: ${{ secrets.GCP_PROJECT }} 20 | 21 | jobs: 22 | setup-build-publish-deploy: 23 | name: Setup, Build, Publish, and Deploy 24 | runs-on: ubuntu-latest 25 | 26 | steps: 27 | - name: cancel previous runs 28 | uses: styfle/cancel-workflow-action@0.5.0 29 | with: 30 | access_token: ${{ github.token }} 31 | 32 | - name: Checkout 33 | uses: actions/checkout@v2 34 | 35 | - name: env 36 | id: env 37 | run: | 38 | echo "::set-output name=tag::$(git rev-parse --short HEAD)" 39 | if [ "$REF" = "refs/heads/master" ]; then 40 | echo "::set-output name=release_version::prod" 41 | else 42 | echo "::set-output name=release_version::dev" 43 | fi 44 | env: 45 | REF: ${{ github.ref }} 46 | 47 | # Setup gcloud CLI 48 | - uses: google-github-actions/setup-gcloud@v0.2.0 49 | with: 50 | project_id: ${{ secrets.GCP_PROJECT }} 51 | service_account_key: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} 52 | 53 | # Configure Docker to use the gcloud command-line tool as a credential 54 | # helper for authentication 55 | - run: |- 56 | gcloud --quiet auth configure-docker 57 | 58 | 59 | # Build the Docker image 60 | - name: Build 61 | run: |- 62 | docker build \ 63 | --tag "gcr.io/${PROJECT_ID}/subsquid-docs-${RELEASE_VERSION}:${TAG}" \ 64 | --tag "gcr.io/${PROJECT_ID}/subsquid-docs-${RELEASE_VERSION}:latest" \ 65 | . 66 | env: 67 | RELEASE_VERSION: ${{ steps.env.outputs.release_version }} 68 | TAG: ${{ steps.env.outputs.tag }} 69 | 70 | # Push the Docker image to Google Container Registry 71 | - name: Publish 72 | run: |- 73 | docker push "gcr.io/${PROJECT_ID}/subsquid-docs-${RELEASE_VERSION}:${TAG}" 74 | docker push "gcr.io/${PROJECT_ID}/subsquid-docs-${RELEASE_VERSION}:latest" 75 | env: 76 | RELEASE_VERSION: ${{ steps.env.outputs.release_version }} 77 | TAG: ${{ steps.env.outputs.tag }} 78 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | 22 | .idea 23 | -------------------------------------------------------------------------------- /.vscode/ltex.dictionary.en-US.txt: -------------------------------------------------------------------------------- 1 | extrinsics 2 | OpenReader 3 | Quickstart 4 | Extrinsics 5 | WebSocket 6 | Quickstart 7 | Subsquid 8 | FireSquid 9 | extrinsics 10 | ingester 11 | postgres-compatible 12 | parachains 13 | resync 14 | init 15 | camelCased 16 | overfetching 17 | Astar 18 | uppercased 19 | desereliazation 20 | typegen 21 | parachain 22 | testnet 23 | Polkadot 24 | Testnet 25 | Mainnet 26 | mainnet 27 | Typegen 28 | Typegen 29 | TypeORM 30 | TypeORM 31 | gRPC 32 | Typegen 33 | Acala 34 | Karura 35 | subgraph 36 | Websocket 37 | high-throuput 38 | TypeORM-compatible 39 | codegen 40 | Etherscan-like 41 | permissionless 42 | npm 43 | SquidDevs 44 | GraphiQL 45 | IPFS 46 | Coingecko 47 | Filebase 48 | Goerli 49 | Fantom 50 | Exosama 51 | Binance 52 | SKALE 53 | BOBA 54 | Arbitrum 55 | Keccak 56 | sighash 57 | sighashes 58 | prometheus 59 | async 60 | BatchContext 61 | BlastAPI 62 | BatchContext 63 | decodable 64 | EntityManager-like 65 | -------------------------------------------------------------------------------- /.vscode/ltex.disabledRules.en-US.txt: -------------------------------------------------------------------------------- 1 | UPPERCASE_SENTENCE_START 2 | MORFOLOGIK_RULE_EN_US 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ## Base ######################################################################## 2 | # Use a larger node image to do the build for native deps (e.g., gcc, python) 3 | FROM node:18-alpine as base 4 | 5 | # Reduce npm log spam and colour during install within Docker 6 | ENV NPM_CONFIG_LOGLEVEL=warn 7 | ENV NPM_CONFIG_COLOR=false 8 | 9 | # We'll run the app as the `node` user, so put it in their home directory 10 | WORKDIR /home/node/app 11 | # Copy the source code over 12 | COPY . /home/node/app/ 13 | 14 | ## Production ################################################################## 15 | # Also define a production target which doesn't use devDeps 16 | FROM base as build 17 | WORKDIR /home/node/app 18 | 19 | RUN npm ci 20 | # Build the Docusaurus app 21 | RUN npm run build 22 | 23 | ## Deploy ###################################################################### 24 | # Use a stable nginx image 25 | FROM nginx 26 | WORKDIR /home/node/app 27 | # Copy what we've installed/built from production 28 | 29 | COPY --from=build /home/node/app/build/ /usr/share/nginx/html/ 30 | EXPOSE 80 31 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /docs/cloud/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 23, 3 | "label": "SQD Cloud", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/cloud", 10 | "title": "Deploy your indexers to SQD Cloud" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/cloud/overview-create-org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/overview-create-org.png -------------------------------------------------------------------------------- /docs/cloud/overview-deploy2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/overview-deploy2.png -------------------------------------------------------------------------------- /docs/cloud/overview-deployed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/overview-deployed.png -------------------------------------------------------------------------------- /docs/cloud/overview-monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/overview-monitor.png -------------------------------------------------------------------------------- /docs/cloud/overview-rpc-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/overview-rpc-page.png -------------------------------------------------------------------------------- /docs/cloud/overview-secret1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/overview-secret1.png -------------------------------------------------------------------------------- /docs/cloud/overview-secret2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/overview-secret2.png -------------------------------------------------------------------------------- /docs/cloud/reference/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 200, 3 | "label": "Reference", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/cloud/reference", 10 | "title": "SQD Cloud reference documentation" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/cloud/reference/hasura.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 33 3 | title: addons.hasura section 4 | description: Run a Hasura instance 5 | --- 6 | 7 | # Hasura add-on 8 | 9 | ## Running Hasura 10 | 11 | To provision a [Hasura](https://hasura.io) instance, add an empty `deploy.addons.hasura` section to the [deployment manifest](/cloud/reference/manifest). Provide some basic configuration: 12 | ```yaml 13 | deploy: 14 | env: 15 | HASURA_GRAPHQL_ADMIN_SECRET: "${{ secrets.HASURA_SECRET }}" 16 | HASURA_GRAPHQL_UNAUTHORIZED_ROLE: user 17 | HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES: "true" 18 | addons: 19 | postgres: 20 | hasura: 21 | ``` 22 | Note the use of a [Cloud secret](/cloud/resources/env-variables/#secrets) for storing the admin password. 23 | 24 | ## Configuring a Hasura API 25 | 26 | ### For a squid 27 | 28 | Use the [Hasura configuration tool](/sdk/resources/tools/hasura-configuration) for squids running dedicated Hasura instances. To make Cloud initialize Hasura configuration on squid restarts, make sure that the tool runs on squid startup by adding a `deploy.init` section to the manifest, e.g. like this: 29 | ```yaml 30 | deploy: 31 | init: 32 | env: 33 | HASURA_GRAPHQL_ENDPOINT: 'http://hasura:8080' 34 | cmd: 35 | - npx 36 | - squid-hasura-configuration 37 | - apply 38 | ``` 39 | See also the [Hasura section of the GraphQL guide](/sdk/resources/serving-graphql/#hasura) and the [complete squid example](https://github.com/subsquid-labs/squid-hasura-example). 40 | 41 | ### For a DipDup indexer 42 | 43 | [DipDup](https://dipdup.io) also configures Hasura automatically. See the [DipDup section](/external-tools/#dipdup) for details. 44 | -------------------------------------------------------------------------------- /docs/cloud/reference/squidignore.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 50 3 | title: .squidignore file(s) 4 | description: Exclude files from squid images 5 | --- 6 | 7 | # .squidignore file(s) 8 | 9 | **Since @subsquid/cli@2.9.0** 10 | 11 | * If a `.squidignore` file is present in any of the squid folders (including the project root), [`sqd deploy`](/squid-cli/deploy) will read filename patterns from it and omit the matching files from the bundle to be sent to the Cloud. 12 | * Filename patterns follow the [gitignore pattern format](https://git-scm.com/docs/gitignore#_pattern_format). 13 | * Patterns read from `.squidignore` files from higher level folders (the project root being the highest) are overridden by patterns read from lower level folders. 14 | * When no `.squidignore` files are supplied, `sqd deploy` will omit the following files and folders: 15 | ``` 16 | node_modules 17 | builds 18 | lib 19 | Dockerfile 20 | .git 21 | .github 22 | .idea 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/cloud/resources/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 70, 3 | "label": "Resources", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/cloud/resources", 10 | "title": "SQD Cloud resources" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/cloud/resources/billing-setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/resources/billing-setup.png -------------------------------------------------------------------------------- /docs/cloud/resources/create-an-organization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/resources/create-an-organization.png -------------------------------------------------------------------------------- /docs/cloud/resources/logging.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 30 3 | title: Inspect logs 4 | description: Inspect the deployment logs 5 | --- 6 | 7 | # Logging 8 | 9 | SQD Cloud automatically collects the logs emitted by the squid processor, its API server and its database. Please use the [built-in SDK logger](/sdk/reference/logger) throughout your code when developing for SQD Cloud. You can set the severity flags for squids running in the Cloud via `SQD_DEBUG`, `SQD_TRACE` or `SQD_INFO` - see [Environment Variables](/cloud/resources/env-variables). 10 | 11 | To inspect and follow the squid logs from all the squid services, use [`sqd logs`](/squid-cli/logs): 12 | ```bash 13 | sqd logs -n -s -f 14 | ``` 15 | or 16 | ```bash 17 | sqd logs -n -t -f 18 | ``` 19 |
20 | 21 | For older version-based deployments... 22 | 23 | ...the slot string is `v${version}`, so use 24 | ```bash 25 | sqd logs -n -s v -f 26 | ``` 27 | Check out the [Slots and tags guide](/cloud/resources/slots-and-tags) to learn more. 28 | 29 |
30 | 31 | There are additional flags to filter the logs: 32 | - `-f` to follow the logs 33 | - `-c` allows filtering by the container (can be `processor`, `db`, `db-migrate` and `query-node`) 34 | - `-l` allows filtering by the severity 35 | - `-p` number of lines to fetch (default: `100`) 36 | - `--since` cut off by the time (default: `1d`). Accepts the notation of the [`ms` library](https://www.npmjs.com/package/ms): `1d`, `10h`, `1m`. 37 | 38 | ### Example 39 | 40 | ```bash 41 | sqd logs squid-substrate-template@v1 -f -c processor -l info --since 1d 42 | ``` 43 | 44 | -------------------------------------------------------------------------------- /docs/cloud/resources/monitoring.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 40 3 | title: Monitoring 4 | description: Prometheus endpoints for squid services 5 | --- 6 | 7 | # Monitoring 8 | 9 | Each deployed squid version exposes Prometheus metrics for external monitoring with e.g. Grafana. 10 | 11 | ## Processor metrics 12 | 13 | The processor metrics are available at 14 | 15 | - `https://${org}.squids.live/${name}@${slot}/processors/${processor}/metrics`, and at 16 | - `https://${org}.squids.live/${name}:${tag}/processors/${processor}/metrics` for each tag attached to the slot. 17 | 18 | See the [slots and tags guide](/cloud/resources/slots-and-tags). 19 | 20 | `${processor}` here is the processor name; it defaults to `processor` unless specified. 21 | 22 | The metrics are documented inline. They include some values reflecting the squid health: 23 | - `sqd_processor_last_block`. The last processed block. 24 | - `sqd_processor_chain_height`. Current chain height as reported by the RPC endpoint (when [RPC ingestion](/sdk/resources/unfinalized-blocks) is enabled) or by [SQD Network](/subsquid-network) (when it is disabled). 25 | 26 | Inspect the metrics endpoint for a full list. 27 | 28 | ## Postgres metrics 29 | 30 | Postgres metrics will be available in the future SQD Cloud releases. 31 | 32 | ## API metrics 33 | 34 | API metrics will be available in the future SQD Cloud releases. 35 | -------------------------------------------------------------------------------- /docs/cloud/resources/production-alias.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_class_name: hidden 3 | --- 4 | 5 | :::danger 6 | Production aliasing feature is deprecated in `@subsquid/cli>=3.0.0`. Use [Slots and tags](/cloud/resources/slots-and-tags) instead. 7 | ::: 8 | 9 | # Alias to the production endpoint 10 | 11 | Version aliasing is used to switch between squid versions without a downtime and updates of the downstream clients. 12 | Each squid has a canonical production endpoint URL of the form 13 | ```bash 14 | https://.subsquid.io//graphql 15 | ``` 16 | 17 | To alias a squid version to the production endpoint, use [`sqd prod`](/squid-cli/prod): 18 | ```bash 19 | sqd prod @ 20 | ``` 21 | 22 | Note that after promoting to the production the version-specific endpoint URL of the form 23 | ```bash 24 | https://.subsquid.io//v/v/graphql 25 | ``` 26 | remains to be available. 27 | 28 | 29 | ## Example 30 | 31 | Assuming your organization is called `my-org`, running 32 | 33 | ```bash 34 | sqd prod my-squid@v1 35 | ``` 36 | 37 | will make the endpoint of the v1 of `my-squid` accessible at `https://my-org.subsquid.io/my-squid/graphql`. 38 | -------------------------------------------------------------------------------- /docs/cloud/resources/slots-and-tags-development-and-production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/resources/slots-and-tags-development-and-production.png -------------------------------------------------------------------------------- /docs/cloud/resources/slots-and-tags-first-squid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/resources/slots-and-tags-first-squid.png -------------------------------------------------------------------------------- /docs/cloud/resources/slots-and-tags-second-squid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/resources/slots-and-tags-second-squid.png -------------------------------------------------------------------------------- /docs/cloud/resources/slots-and-tags-slot-location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/resources/slots-and-tags-slot-location.png -------------------------------------------------------------------------------- /docs/cloud/resources/slots-and-tags-two-major-versions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/cloud/resources/slots-and-tags-two-major-versions.png -------------------------------------------------------------------------------- /docs/cloud/troubleshooting.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 60 3 | --- 4 | 5 | # Troubleshooting 6 | 7 | ### "Secrets outdated. Please restart the squid" warning 8 | 9 | This occurs when you have a squid deployed, then create, remove or change some [secrets](/squid-cli/secrets) of [relevance](/cloud/resources/organizations). Squids must be restarted manually for such changes to have effect. Navigate to the squid version page (e.g. by clicking on the warning sign) and click restart. The restart will not touch the database, so unless your new secret values cause the squid to crash this procedure should be quick and easy. 10 | 11 | ![Secrets outdated]() 12 | 13 | ### My squid is stuck in "Building", "Deploying" or "Starting" state 14 | 15 | - Run with `SQD_DEBUG=*` as explained on the [Logging](/sdk/reference/logger/#overriding-the-log-level) page 16 | - Update the squid CLI to the latest version with 17 | ```bash 18 | npm update -g @subsquid/cli 19 | ``` 20 | - Update the Squid SDK dependencies: 21 | ```bash 22 | npm run update 23 | ``` 24 | - Check that the squid adheres to the expected [structure](/sdk/how-to-start/layout) 25 | - Make sure you can [build and run Docker images locally](/sdk/resources/self-hosting) 26 | 27 | ### `Validation error` when releasing a squid 28 | 29 | Make sure the squid name contains only alphanumeric characters, underscores and hyphens. The squid version must be also alphanumeric. 30 | Since both the squid and version name become part of the squid API endpoint URL, slashes and dots are not accepted. 31 | 32 | ### My squid ran out of disk space 33 | 34 | Edit the [postgres addon](/cloud/reference/pg) section of `squid.yaml` and request more space for the database. 35 | 36 | ### My squid is behind the chain, but is shows that it is in sync 37 | 38 | Check that your processor uses both a RPC endpoint as one of its data sources (in addition to a SQD Network gateway). 39 | -------------------------------------------------------------------------------- /docs/conduit-integration.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_class_name: hidden 3 | pagination_next: null 4 | pagination_prev: null 5 | --- 6 | 7 | # Conduit integration 8 | -------------------------------------------------------------------------------- /docs/dead.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_class_name: hidden 3 | pagination_next: null 4 | pagination_prev: null 5 | --- 6 | 7 | # Under construction 8 | 9 | If you're here you clicked on a link that we haven't filled yet. Those do not last long - check back in a day or two! 10 | -------------------------------------------------------------------------------- /docs/external-tools.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: External tools 3 | description: >- 4 | Third party tools and extensions 5 | sidebar_position: 90 6 | --- 7 | 8 | # External tools 9 | 10 | ## `@belopash/typeorm-store` 11 | 12 | [`@belopash/typeorm-store`](https://github.com/belopash/squid-typeorm-store) is a [fork](/sdk/resources/persisting-data/overview/#custom-database) of [`@subsquid/typeorm-store`](/sdk/reference/store/typeorm) that automates collecting read and write database requests into [batches](/sdk/resources/batch-processing) and caches the available entity records in RAM. Unlike the [standard `typeorm-store`](/sdk/resources/persisting-data/typeorm), @belopash's store is intended to be used with declarative code: it makes it easy to write mapping functions (e.g. event handlers) that explicitly define 13 | 14 | - what data you're going to need from the database 15 | - what code has to be executed once the data is available 16 | - how to save the results 17 | 18 | Data dependencies due to [entity relations](/sdk/reference/schema-file/entity-relations) are handled automatically, along with the caching of intermediate resultsg and in-memory batching of database requests. 19 | 20 | See [this repository](https://github.com/subsquid-labs/belopash-typeorm-store-example) for a minimal example. 21 | 22 | ## DipDup 23 | 24 | [DipDup](https://dipdup.io) is a Python indexing framework that can use [SQD Network](/subsquid-network) as a data source. It offers 25 | 26 | * SQLite, PostgreSQL and TimescaleDB data sinks 27 | * GraphQL APIs based on Hasura 28 | 29 | Development workflow uses the `dipdup` tool to generate a stub project. Once done with that, all you have to do is to define the data schema and the handlers. Take a look at their [quickstart](https://dipdup.io/docs/quickstart-evm) for more details. 30 | 31 | With its handler-based architecture and the choice of Python as the transform logic language, DipDup is easier to develop for than [Squid SDK](/sdk), but has higher requirements on database IO bandwith and CPU. The IO bandwidth issue is partially solved by DipDup's caching layer used for database access. 32 | -------------------------------------------------------------------------------- /docs/firesquid.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_class_name: hidden 3 | pagination_next: null 4 | pagination_prev: null 5 | --- 6 | 7 | # On the FireSquid release 8 | 9 | Previous major release of SQD was called FireSquid. It featured GraphQL-based archives ([EVM](https://github.com/subsquid/eth-archive), [Substrate](https://github.com/subsquid/substrate-archive-setup)) that were replaced by [SQD Network](/subsquid-network). Interfaces for data requests on the [SDK](/sdk) side were changed without keeping backwards compatibility. 10 | 11 | Actions are needed if: 12 | 13 | 1. You're relying on a squid that's using an older SDK version. One way to know that is to look at the signatures of the data requesting methods (`.addEvent()`, `.addLog()` etc): if call signatures are different from what you see in the docs ([EVM](/sdk/reference/processors/evm-batch), [Substrate](/sdk/reference/processors/substrate-batch)), then you need to migrate to the modern [ArrowSquid SDK](/sdk). 14 | 15 | 2. You're relying on a GraphQL API of an older archive. Your options are: 16 | - To rely on SQD Network instead. See its [reference documentation](/subsquid-network/reference) for info on available datasets and the API used to access them. 17 | - To fork an older archive setup and maintain it yourself. For EVM you can just fork [the repo](https://github.com/subsquid/eth-archive). If you would like to do the same for the Substrate archives, that'd require pulling some old code out of the repos' history. Ping us in the [SquidDevs TG chat](https://t.me/HydraDevs). 18 | -------------------------------------------------------------------------------- /docs/fuel-indexing/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 28, 3 | "label": "Fuel indexing", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/fuel-indexing", 10 | "title": "Index Fuel with SQD" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/fuel-indexing/cli-cheatsheet.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 50 3 | title: Cheatsheet 4 | description: Commonly used CLI commands 5 | --- 6 | 7 | # CLI cheatsheet 8 | 9 | This guide provides a quick reference to the commands needed to launch the squid and manage the database. 10 | 11 | ### Install dependencies 12 | 13 | ```sh 14 | npm i 15 | ``` 16 | 17 | ### Compile the project 18 | 19 | ```sh 20 | npx tsc 21 | ``` 22 | 23 | ### Launch Postgres database to store the data 24 | 25 | ```sh 26 | docker compose up -d 27 | ``` 28 | 29 | ### Apply database migrations to create the target schema 30 | 31 | ```sh 32 | npx squid-typeorm-migration apply 33 | ``` 34 | ### Run indexer 35 | 36 | ```sh 37 | node -r dotenv/config lib/main.js 38 | ``` 39 | 40 | ### Check out the indexed swaps 41 | 42 | ```sh 43 | docker exec "$(basename "$(pwd)")-db-1" psql -U postgres \ 44 | -c "SELECT id, logs_count, found_at FROM contract ORDER BY logs_count desc LIMIT 10" 45 | ``` 46 | 47 | You can use the `sqd` utility to shorten these commands and manage their interrelations. [Learn more here](/squid-cli/commands-json). 48 | -------------------------------------------------------------------------------- /docs/fuel-indexing/fuel-datasource/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 20, 3 | "label": "FuelDataSource", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/fuel-indexing/fuel-datasource", 10 | "title": "FuelDataSource reference documentation" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/fuel-indexing/fuel-datasource/context-interfaces.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 5 3 | description: >- 4 | Block data for Fuel 5 | --- 6 | 7 | # Block data for Fuel Network 8 | 9 | In Fuel Squid SDK, the data is processed by repeatedly calling the user-defined [batch handler](/sdk/reference/processors/architecture/#processorrun) function on batches of on-chain data. The sole argument of the batch handler is its context `ctx`, and `ctx.blocks` is an array of `Block` objects containing the data to be processed, aligned at the block level. 10 | 11 | For Fuel `DataSource` the `Block` interface is defined as follows: 12 | 13 | ```ts 14 | export interface Block { 15 | header: BlockHeader; 16 | transactions: Transaction[]; 17 | inputs: TransactionInput[]; 18 | outputs: TransactionOutput[]; 19 | receipts: Receipt[]; 20 | } 21 | ``` 22 | 23 | `Block.header` contains the block header data. The rest of the fields are iterables containing the four kinds of blockchain data. The items within each iterable are ordered in the same way as they are within blocks. 24 | 25 | The exact fields available in each data item type are inferred from the `setFields()` call argument. The method is documented on the [field selection](/fuel-indexing/fuel-datasource/field-selection) page: 26 | 27 | - [`Input` section](/fuel-indexing/fuel-datasource/field-selection#input); 28 | - [`Transaction` section](/fuel-indexing/fuel-datasource/field-selection#transaction); 29 | - [`Output` section](/fuel-indexing/fuel-datasource/field-selection#output); 30 | - [`Receipt` section](/fuel-indexing/fuel-datasource/field-selection#receipt). 31 | -------------------------------------------------------------------------------- /docs/fuel-indexing/fuel-datasource/general.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 10 3 | title: General settings 4 | description: >- 5 | Data sourcing and metrics 6 | --- 7 | 8 | # General settings 9 | 10 | :::tip 11 | The method documentation is also available inline and can be accessed via suggestions in most IDEs. 12 | ::: 13 | 14 | The following setters configure the global settings of `DataSourceBuilder` for Fuel Procesor. They return the modified instance and can be chained. 15 | 16 | The only required configuration method is [`setGateway()`](#set-gateway). If you need real-time data, please also use [`setGraphql()`](#set-graphql). 17 | 18 | - If you add both a SQD Network gateway and an RPC endpoint, the processor will obtain as much data as is currently available from the gateway, then switch to ingesting recent data via RPC. 19 | - If you only add a SQD Network gateway, your data will be being several thousands of blocks behind the chain head most of the time. 20 | 21 | ### `setGateway(url: string | GatewaySettings)` {#set-gateway} 22 | 23 | Use a [SQD Network](/subsquid-network) gateway. The argument is either a string URL of the gateway or 24 | 25 | ```ts 26 | { 27 | url: string // gateway URL 28 | requestTimeout?: number // in milliseconds 29 | } 30 | ``` 31 | 32 | ### `setGraphql(settings?: GraphqlSettings)` {#set-graphql} 33 | 34 | We must use regular GraphQL endpoint to get through the last mile and stay on top of the chain. This is a limitation, and we promise to lift it in the future. 35 | 36 | ```ts 37 | type GraphqlSettings = { 38 | url: string // e.g. https://mainnet.fuel.network/v1/graphql 39 | strideSize?: number; // `getBlock` batch call size, default 5 40 | strideConcurrency?: number; // num of concurrent connections, default 10 41 | }; 42 | ``` 43 | 44 | ### `setBlockRange({from: number, to?: number})` {#set-block-range} 45 | 46 | Limits the range of blocks to be processed. When the upper bound is specified, processor will terminate with exit code 0 once it reaches it. 47 | 48 | Note that block ranges can also be specified separately for each data request. This method sets global bounds for all block ranges in the configuration. 49 | 50 | ### `includeAllBlocks(range?: {from: number, to?: number})` {#include-all-blocks} 51 | 52 | By default, processor will fetch only blocks which contain requested items. This method modifies such behavior to fetch all chain blocks. Optionally a range of blocks can be specified for which the setting should be effective. 53 | -------------------------------------------------------------------------------- /docs/fuel-indexing/fuel-datasource/inputs.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 30 3 | description: >- 4 | Subscribe to Input data with addInput() 5 | --- 6 | 7 | # Inputs 8 | 9 | #### `addInput(options)` {#add-input} 10 | 11 | Get some _or all_ inputs on the network. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | type?: InputType[] 17 | coinOwner?: string[] 18 | coinAssetId?: string[] 19 | contractContract?: string[] 20 | messageSender?: string[] 21 | messageRecipient?: string[] 22 | 23 | // related data retrieval 24 | transaction?: boolean 25 | 26 | range?: { 27 | from: number 28 | to?: number 29 | } 30 | } 31 | ``` 32 | 33 | Data requests: 34 | 35 | - `type` sets the type of the input. You can request one or more of `'InputCoin' | 'InputContract' | 'InputMessage'`. Leave it undefined to subscribe to all inputs. 36 | 37 | Enabling the `transaction` flag will cause the processor to retrieve transactions where the selected inputs have occurred. The data will be added to the appropriate iterables within the [block data](/fuel-indexing/fuel-datasource/context-interfaces). You can also call `augmentBlock()` from `@subsquid/fuel-objects` on the block data to populate the convenience reference fields like `input.transaction`. 38 | 39 | Note that inputs can also be requested by the other `FuelDataSource` methods as related data. 40 | 41 | Selection of the exact fields to be retrieved for each transaction and the optional related data items is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 42 | 43 | ## Examples 44 | 45 | Request all inputs with `InputCoin` type and include transactions: 46 | 47 | ```ts 48 | processor 49 | .addInput({ 50 | type: ["InputCoin"], 51 | transaction: true, 52 | }) 53 | .build(); 54 | ``` 55 | -------------------------------------------------------------------------------- /docs/fuel-indexing/fuel-datasource/outputs.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 30 3 | description: >- 4 | Subscribe to outputs data with addOutput() 5 | --- 6 | 7 | # Outputs 8 | 9 | #### `addOutput(options)` {#add-output} 10 | 11 | Get some _or all_ outputs on the network. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | type?: OutputType[] 17 | 18 | // related data retrieval 19 | transaction?: boolean 20 | 21 | range?: { 22 | from: number 23 | to?: number 24 | } 25 | } 26 | ``` 27 | 28 | Data requests: 29 | 30 | - `type` sets the type of the output. Output type has the following options: `'CoinOutput' | 'ContractOutput' | 'ChangeOutput' | 'VariableOutput' | 'ContractCreated'`. Leave it undefined to subscribe to all outputs. 31 | 32 | Enabling the `transaction` flag will cause the processor to retrieve transactions where the selected outputs have occurred. The data will be added to the appropriate iterables within the [block data](/fuel-indexing/fuel-datasource/context-interfaces). You can also call `augmentBlock()` from `@subsquid/fuel-objects` on the block data to populate the convenience reference fields like `output.transaction`. 33 | 34 | Note that receipts can also be requested by the other `FuelDataSource` methods as related data. 35 | 36 | Selection of the exact fields to be retrieved for each transaction and the optional related data items is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 37 | 38 | ## Examples 39 | 40 | Request all outputs with `ChangeOutput` type and include transactions: 41 | 42 | ```ts 43 | processor 44 | .addOutput({ 45 | type: ["ChangeOutput"], 46 | transaction: true, 47 | }) 48 | .build(); 49 | ``` 50 | -------------------------------------------------------------------------------- /docs/fuel-indexing/fuel-datasource/receipts.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 30 3 | description: >- 4 | Subscribe to txn data with addTransaction() 5 | --- 6 | 7 | # Receipts 8 | 9 | #### `addReceipt(options)` {#add-receipt} 10 | 11 | Get some _or all_ transactions on the network. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | type?: ReceiptType[] 17 | contract?: string[] 18 | 19 | // related data retrieval 20 | transaction?: boolean 21 | 22 | range?: { 23 | from: number 24 | to?: number 25 | } 26 | } 27 | ``` 28 | 29 | Data requests: 30 | 31 | - `type` sets the type of the receipt. Receipt type has the following options: `'CALL' | 'RETURN' | 'RETURN_DATA' | 'PANIC' | 'REVERT' | 'LOG' | 'LOG_DATA' | 'TRANSFER' | 'TRANSFER_OUT' | 'SCRIPT_RESULT' | 'MESSAGE_OUT' | 'MINT' | 'BURN'`. Leave it undefined to subscribe to all receipts. 32 | - `contract` sets the contract addresses to track. Leave it undefined to subscribe to all receipts. 33 | 34 | Enabling the `transaction` flag will cause the processor to retrieve transactions that gave rise to the matching receipts. The data will be added to the appropriate iterables within the [block data](/fuel-indexing/fuel-datasource/context-interfaces). You can also call `augmentBlock()` from `@subsquid/fuel-objects` on the block data to populate the convenience reference fields like `receipt.transaction`. 35 | 36 | Note that receipts can also be requested by the other `FuelDataSource` methods as related data. 37 | 38 | Selection of the exact fields to be retrieved for each transaction and the optional related data items is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 39 | 40 | ## Examples 41 | 42 | Request all receipts of the `LOG_DATA` type and include parent transactions: 43 | 44 | ```ts 45 | processor 46 | .addReceipt({ 47 | type: ["LOG_DATA"], 48 | transaction: true, 49 | }) 50 | .build(); 51 | ``` 52 | -------------------------------------------------------------------------------- /docs/fuel-indexing/fuel-datasource/transactions.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 30 3 | description: >- 4 | Subscribe to txn data with addTransaction() 5 | --- 6 | 7 | # Transactions 8 | 9 | #### `addTransaction(options)` {#add-transaction} 10 | 11 | Get some _or all_ transactions on the network. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | type?: TransactionType[] 17 | 18 | // related data retrieval 19 | receipts?: boolean 20 | inputs?: boolean 21 | outputs?: boolean 22 | 23 | range?: { 24 | from: number 25 | to?: number 26 | } 27 | } 28 | ``` 29 | 30 | Data requests: 31 | 32 | - `type` sets the type of the transaction: `'Script' | 'Create' | 'Mint' | 'Upgrade' | 'Upload'`. Leave it undefined to subscribe to all transactions. 33 | 34 | Enabling the `receipts` and/or `inputs` and `outputs` flags will cause the processor to retrieve receipts, inputs and outputs that occurred as a result of each selected transaction. The data will be added to the appropriate iterables within the [block data](/fuel-indexing/fuel-datasource/context-interfaces). You can also call `augmentBlock()` from `@subsquid/fuel-objects` on the block data to populate the convenience reference fields like `transaction.receipts`. 35 | 36 | Note that transactions can also be requested by the other `FuelDataSource` methods as related data. 37 | 38 | Selection of the exact fields to be retrieved for each transaction and the optional related data items is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 39 | 40 | ## Examples 41 | 42 | Request all transactions with `Create` and `Mint` types and include receipts, inputs and outputs: 43 | 44 | ```ts 45 | processor 46 | .addTransaction({ 47 | type: ["Create", "Mint"], 48 | receipts: true, 49 | inputs: true, 50 | outputs: true, 51 | }) 52 | .build(); 53 | ``` 54 | -------------------------------------------------------------------------------- /docs/fuel-indexing/network-api/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 100, 3 | "label": "Network API", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/fuel-indexing/network-api", 10 | "title": "SQD Network API documentation for Fuel" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | title: Home 4 | hide_title: true 5 | sidebar_position: 0 6 | hide_table_of_contents: true 7 | pagination_next: null 8 | 9 | --- 10 | 11 | import Home from '@site/src/components/home'; 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/network-launch-quests-rules.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_class_name: hidden 3 | pagination_next: null 4 | pagination_prev: null 5 | --- 6 | 7 | # Rules 8 | 9 | **SQD Testnet App Rules & Motivation** 10 | 11 | **Introduction:** Welcome to the initial phase of the SQD testnet. As we embark on this journey, it's essential to understand that this is a testing phase. There might be occasional downtimes or outages. These challenges are crucial for us, as they will guide our efforts to strengthen the decentralized network, ensuring its robustness and resilience. 12 | 13 | **Our Motivation:** 14 | 1. **Reliability Assessment:** We aim to evaluate the reliability and resilience of the SQD network, especially under significant load. 15 | 2. **Cybersecurity Evaluation:** It's crucial to test the SQD network's resilience against potential cybersecurity threats. 16 | 3. **Community Engagement:** We want to recognize our most active and loyal testnet participants. 17 | 4. **Developer Collaboration:** This testnet will help us identify highly engaged developers, opening doors for potential future collaborations. 18 | 19 | **Participation Rules:** To be a part of this testnet, participants need to link their Metamask wallet. This step is crucial as the goal is to accumulate the highest amount of tSQD. Please note, once a wallet is linked, it's final; switching to another wallet won't be possible. As participants complete quests, tSQD will be credited to their accounts. 20 | 21 | **Types of Quests:** 22 | 1. **Social Quests:** 23 | - These quests revolve around social media activities. Examples include linking accounts from platforms like Twitter, Discord, and GitHub. 24 | - Stay alert! New quests will be introduced throughout the test period. Regularly visit the quest page to stay updated. 25 | 2. **Tech Quests:** 26 | - Tech quests involve deploying squids on local machines and generating a specific number of queries directed at the SQD testnet. 27 | - Follow the provided instructions and monitor your query progress directly on the quest page. 28 | 3. **Special Quests:** 29 | - These quests are for those with a deep understanding of blockchain indexing. 30 | - To attempt these quests, select the corresponding cards on the quest page and follow the instructions. Completing special quests will grant participants a higher amount of tSQD. 31 | 32 | Join us in this exciting phase, contribute to the network's growth, and earn rewards for your efforts! 33 | -------------------------------------------------------------------------------- /docs/portal-closed-beta-information.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_class_name: hidden 3 | pagination_next: null 4 | pagination_prev: null 5 | --- 6 | 7 | # SQD Portal Closed Beta Instructions 8 | 9 | Welcome to the SQD Portal Closed Beta! We appreciate your interest. Below, you’ll find clear instructions on what to do next and what to expect. 10 | 11 | ## What is the SQD Portal? 12 | 13 | The SQD Portal is a decentralized, streaming-based data retrieval solution designed to replace our centralized archives. It provides faster, more reliable, and flexible access to blockchain data. 14 | 15 | #### Key Features 16 | 17 | - **Fully Decentralized**: Powered by 1,600+ independent worker nodes. 18 | - **30x Replication**: Redundant data storage for maximum reliability, capable of querying up to **20 million blocks per second**. 19 | - **Faster Performance**: A new Rust-based query engine now leverages parallelized queries and incorporates numerous query execution performance optimizations, delivering an overall **10-50x performance boost** compared to the centralized Archives. 20 | 21 | ## What You Can Do 22 | 23 | 24 | ### 1. Explore the Public Portal 25 | 26 | - Access data for 100+ EVM networks during the closed beta. Public Portal supports filtering only by logs at the moment. We aim to include all full filtering capabilities in the general availability release ([reference](https://docs.sqd.dev/subsquid-network/reference/evm-api/)) and other VMs as well. 27 | - Note: The current Public Portal rate limit is 20 requests per 10 seconds. 28 | - **Login here**: [https://portal-ui.sqd.dev/](https://portal-ui.sqd.dev/) 29 | - **Username**: `sqd` 30 | - **Password**: `portal2025` 31 | 32 | 33 | ### 2. Migrate to the Cloud Portal 34 | 35 | - Transition from centralized archives to the Cloud Portal. 36 | - **Start here**: [Cloud Portal Migration Details](https://docs.sqd.dev/cloud/resources/migrate-to-portal/) 37 | - **Get $100 in SQD Cloud credits**: 38 | - Redeem by contacting us on [Telegram](https://t.me/+JHrJZPz34kRjYmFk) after migrating your squid/s by the 31st of December 2024. 39 | 40 | 41 | ### 3. Set Up a Self-Hosted Portal 42 | 43 | - Take full control of your data infrastructure by running your own Portal. 44 | - **Setup Guide**: [Self-Hosting Instructions](https://docs.sqd.dev/subsquid-network/participate/portal/) 45 | - **Requirements** 46 | - Minimum 10,000 SQD tokens. 47 | - A working Docker installation. 48 | - Some Arbitrum ETH for gas. 49 | 50 | ---- 51 | 52 | If you have any questions or feedback for us, please reach out to us on Telegram. We have created a special group for Portal Closed Beta participants: [https://t.me/+JHrJZPz34kRjYmFk](https://t.me/+JHrJZPz34kRjYmFk). 53 | 54 | Thank you for being part of the beta! 55 | 56 | — **The SQD Team** 57 | 58 | -------------------------------------------------------------------------------- /docs/portal-rate-limited.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_class_name: hidden 3 | pagination_next: null 4 | pagination_prev: null 5 | --- 6 | 7 | # You've been rate limited 8 | 9 | If you are seeing this page, chances are that your squids used SQD's public portal and got rate limited. This happens when you make more than 50 requests in any 10 seconds long interval. 10 | 11 | Here are your options: 12 | 13 | 1. [Set up a private SQD Network portal](/subsquid-network/participate/portal) with or without the support for real time data (see below). 14 | 15 | 2. Migrate to [SQD Cloud](/cloud) where we'll manage the portal for you. 16 | 17 | 3. Do nothing and accept the reduced sync rate. 18 | -------------------------------------------------------------------------------- /docs/sdk/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 21, 3 | "label": "Indexing SDK", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk", 10 | "title": "Extract, transform, load and query historical blockchain data from SQD data lakes" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/examples.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 80 3 | title: Examples 4 | description: Example squids 5 | --- 6 | 7 | import TagsNavigation from '@site/src/components/TagsNavigation'; 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/sdk/how-to-start/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 20, 3 | "label": "Getting started", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/how-to-start", 10 | "title": "Getting started with Squid SDK" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/how-to-start/cli-cheatsheet.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 50 3 | title: sqd CLI cheatsheet 4 | description: Commonly used CLI commands 5 | --- 6 | 7 | # Squid CLI cheatsheet 8 | 9 | The [`sqd` CLI tool](/squid-cli/) has [built-in aliasing](/squid-cli/commands-json) that picks up the commands defined in `commands.json` in the project root. In all [squid templates](/sdk/how-to-start/squid-development/#templates) this file is pre-populated with some handy scripts briefly described below. 10 | 11 | One can always inspect the available commands defined in `commands.json` with 12 | ``` 13 | sqd --help 14 | ``` 15 | The commands defined by `commands.json` will appear in the `SQUID COMMANDS` help sections. 16 | 17 | Before using the `sqd` CLI tool, make sure all the project dependencies are installed: 18 | ```sh 19 | npm i 20 | ``` 21 | 22 | ### Building the squid 23 | 24 | ```sh 25 | sqd build Build the squid project 26 | sqd clean Delete all build artifacts 27 | ``` 28 | 29 | ### Running the squid 30 | 31 | :::info 32 | Both `sqd up` and `sqd down` assume that the `docker compose` command is supported and the `docker` deamon is running. Modify the definitions in `commands.json` accordingly if `docker-compose` should be used instead. 33 | ::: 34 | 35 | ``` 36 | sqd up Start a local PG database 37 | sqd down Drop the local PG database 38 | sqd run [PATH] Run all the services defined in squid.yaml locally 39 | sqd serve Start the GraphQL server 40 | sqd serve:prod Start the GraphQL API server with caching and limits 41 | ``` 42 | 43 | ### DB migrations 44 | 45 | Read [TypeORM Migration generation](/sdk/resources/tools/migrations-gen/) for details. 46 | 47 | ``` 48 | sqd migration:apply apply pending migrations 49 | sqd migration:generate generate the migration for the schema defined in schema.graphql 50 | sqd migration:clean clean the db/migrations folder 51 | ``` 52 | 53 | ### Code generation 54 | 55 | Consult [TypeORM Model generation](/sdk/resources/tools/model-gen/) for TypeORM model generation details, and [Type-safe decoding](https://docs.subsquid.io/sdk/resources/tools/typegen/) for type generation. 56 | 57 | :::info 58 | Depending on the template, `sqd typegen` is aliased to a different typegen tool specific to the chain type and thus has different usage. Consult `sqd typegen --help` for details. 59 | ::: 60 | 61 | ``` 62 | sqd codegen Generate TypeORM entities from schema.graphql 63 | sqd typegen Generate data access classes for an ABI file(s) in the ./abi folder 64 | ``` 65 | -------------------------------------------------------------------------------- /docs/sdk/how-to-start/squid-from-scratch-abi-fetching.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/sdk/how-to-start/squid-from-scratch-abi-fetching.png -------------------------------------------------------------------------------- /docs/sdk/quickstart-working-api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/sdk/quickstart-working-api.png -------------------------------------------------------------------------------- /docs/sdk/reference/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 70, 3 | "label": "Reference", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference", 10 | "title": "Squid SDK reference documentation" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/frontier.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 120 3 | title: The frontier package 4 | description: >- 5 | Working with EVM running on Substrate 6 | --- 7 | 8 | # `@subsquid/frontier` 9 | 10 | The way the Frontier EVM pallet exposes EVM logs and transaction may change due to runtime upgrades. [`@subsquid/frontier`](https://github.com/subsquid/squid-sdk/tree/master/substrate/frontier) provides helper methods that are aware of the upgrades: 11 | 12 | #### `getEvmLog(event: Event): EvmLog` {#get-evm-log} 13 | 14 | Extract the EVM log data from `EVM.Log` event. 15 | 16 | #### `getTransaction(call: Call): LegacyTransaction | EIP2930Transaction | EIP1559Transaction` {#get-transaction} 17 | 18 | Extract the transaction data from `Ethereum.transact` call with additional fields depending on the EVM transaction type. 19 | 20 | #### `getTransactionResult(ethereumExecuted: Event): {from: string, to: string, transactionHash: string, status: 'Succeed' | 'Error' | 'Revert' | 'Fatal', statusReason: string}` {#get-transaction-result} 21 | 22 | Extract transaction result from an `Ethereum.Executed` event. 23 | 24 | See also the [Frontier EVM guide](/sdk/resources/substrate/frontier-evm). 25 | 26 | #### Example 27 | 28 | ```typescript 29 | const processor = new SubstrateBatchProcessor() 30 | .setGateway('https://v2.archive.subsquid.io/network/astar-substrate') 31 | .setRpcEndpoint('https://astar-rpc.dwellir.com') 32 | .addEthereumTransaction({}) 33 | .addEvmLog({}) 34 | 35 | processor.run(new TypeormDatabase(), async ctx => { 36 | for (const block of ctx.blocks) { 37 | for (const event of block.events) { 38 | if (event.name === 'EVM.Log') { 39 | // no need to supply any extra data to determine 40 | // the runtime version: event has all necessary references 41 | const {address, data, topics} = getEvmLog(event) 42 | 43 | // process evm log data 44 | } 45 | } 46 | for (const call of block.calls) { 47 | if (call.name==='Ethereum.transact') { 48 | const txn = getTransaction(call) 49 | // process evm txn data 50 | } 51 | } 52 | } 53 | }) 54 | ``` 55 | -------------------------------------------------------------------------------- /docs/sdk/reference/logger.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 30 3 | description: Native logger of Squid SDK 4 | --- 5 | 6 | # Logger 7 | 8 | A [`Logger`](https://github.com/subsquid/squid/tree/master/util/logger) interface is injected into the [handler context](/sdk/reference/processors/architecture/#batch-context) with `ctx.log`. It is bound to the namespace `sqd:processor:mapping`. The context logger is a recommended way of logging for squid processors. 9 | 10 | `Logger` exposes the following logging levels, in order of increasing severity: 11 | 12 | * `TRACE` 13 | * `DEBUG` 14 | * `INFO` 15 | * `WARN` 16 | * `ERROR` 17 | * `FATAL` 18 | 19 | By default, the logging level is set to `INFO`. 20 | 21 | And here is an example: 22 | 23 | ```typescript 24 | processor.run(new TypeormDatabase(), async (ctx) => { 25 | ctx.log.trace("Trace Log example"); 26 | ctx.log.debug("Debug Log example"); 27 | ctx.log.info("Info Log example"); 28 | ctx.log.warn("Warn Log example"); 29 | ctx.log.error("Error Log example"); 30 | ctx.log.fatal("Fatal Log example") 31 | }); 32 | ``` 33 | 34 | ## Overriding the log level 35 | 36 | The log level can be overridden by setting a matching namespace selector to one of the `SQD_TRACE`, ..., `SQD_FATAL` env variables. In particular, to set the handler logs level to `DEBUG` set the environment variable `SQD_DEBUG` to `sqd:processor:mapping`: 37 | 38 | ```bash 39 | SQD_DEBUG=sqd:processor:mapping 40 | ``` 41 | 42 | The namespace selector supports wildcards, so one can also enable internal debug logs of `@subsquid/substrate-processor` with 43 | ``` 44 | SQD_DEBUG=sqd:processor* 45 | ``` 46 | since all processor context loggers inherit the processor-level namespace `sqd:processor`. 47 | 48 | 49 | ## Accessing logs of a deployed Squid 50 | 51 | Processor logs can be inspected once the squid is deployed to Cloud: 52 | 53 | ```bash 54 | sqd logs -n -s -f --level= 55 | ``` 56 | or 57 | ```bash 58 | sqd logs -n -t -f --level= 59 | ``` 60 |
61 | 62 | For older version-based deployments... 63 | 64 | ...the slot string is `v${version}`, so use 65 | ```bash 66 | sqd logs -n -s v -f --level= 67 | ``` 68 | Check out the [Slots and tags guide](/cloud/resources/slots-and-tags) to learn more. 69 | 70 |
71 | 72 | The available levels are: 73 | * `info` 74 | * `warning` 75 | * `debug` 76 | * `error` - will fetch messages emitted by 77 | - `ctx.log.error` 78 | - `ctx.log.fatal` 79 | - `ctx.log.trace` 80 | 81 | See [CLI Reference](/squid-cli/logs) or `sqd logs --help` for a full list of log options supported by SQD Cloud. 82 | -------------------------------------------------------------------------------- /docs/sdk/reference/openreader-server/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 80, 3 | "label": "OpenReader", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference/openreader-server", 10 | "title": "An open source GraphQL server built by SQD" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/openreader-server/api/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 30, 3 | "label": "Core API", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference/openreader-server/api", 10 | "title": "Core queries exposed by the OpenReader API" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/openreader-server/api/and-or-filters.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 20 3 | title: AND/OR filters 4 | description: >- 5 | Basic logic operators for use in filters 6 | --- 7 | 8 | # AND/OR filters 9 | 10 | ## Overview 11 | 12 | Our GraphQL implementation offers a vast selection of tools to filter and section results. One of these is the `where` clause, very common in most database query languages and [explained here](/sdk/reference/openreader-server/api/queries/#filter-query-results--search-queries) in detail. 13 | 14 | In our GraphQL server implementation, we included logical operators to be used in the `where` clause, allowing to group multiple parameters in the same `where` argument using the `AND` and `OR` operators to filter results based on more than one criteria. 15 | 16 | Note that the [newer](/sdk/reference/openreader-server/overview/#supported-queries) and [more advanced](/sdk/reference/openreader-server/api/paginate-query-results) `{entityName}sConnection` queries support exactly the same format of the `where` argument as the older `{entityName}s` queries used in the examples provided here. 17 | 18 | ### Example of an `OR` clause: 19 | 20 | Fetch a list of `accounts` that either have a balance bigger than a certain amount, or have a specific id. 21 | 22 | ```graphql 23 | query { 24 | accounts( 25 | orderBy: balance_DESC, 26 | where: { 27 | OR: [ 28 | {balance_gte: "240000000000000000"} 29 | {id_eq: "CksmaBx9rKUG9a7eXwc5c965cJ3QiiC8ELFsLtJMYZYuRWs"} 30 | ] 31 | } 32 | ) { 33 | balance 34 | id 35 | } 36 | } 37 | 38 | ``` 39 | 40 | ### Example of `AND` clause: 41 | 42 | Fetch a list of `accounts` that have a balance between two specific amounts: 43 | 44 | ```graphql 45 | query { 46 | accounts( 47 | orderBy: balance_DESC, 48 | where: { 49 | AND: [ 50 | {balance_lte: "240000000000000000"} 51 | {balance_gte: "100000000000000"} 52 | ] 53 | } 54 | ) { 55 | balance 56 | id 57 | } 58 | } 59 | 60 | ``` 61 | -------------------------------------------------------------------------------- /docs/sdk/reference/openreader-server/api/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 10 3 | title: Intro 4 | description: >- 5 | GraphQL and its support in SQD 6 | --- 7 | 8 | :::info 9 | At the moment, [Squid SDK GraphQL server](/sdk/reference/openreader-server) can only be used with squids that use Postgres as their target database. 10 | ::: 11 | 12 | GraphQL is an API query language, and a server-side runtime for executing queries using a custom type system. Head over to the [official documentation website](https://graphql.org/learn/) for more info. 13 | 14 | A GraphQL API served by the [GraphQL server](/sdk/reference/openreader-server) has two components: 15 | 16 | 1. Core API is defined by the [schema file](/sdk/reference/schema-file). 17 | 2. Extensions added via [custom resolvers](/sdk/reference/openreader-server/configuration/custom-resolvers). 18 | 19 | In this section we cover the core GraphQL API, with short explanations on how to perform GraphQL queries, how to paginate and sort results. This functionality is supported via [OpenReader](https://github.com/subsquid/squid-sdk/tree/master/graphql/openreader), SQD's own implementation of [OpenCRUD](https://www.opencrud.org). 20 | -------------------------------------------------------------------------------- /docs/sdk/reference/openreader-server/api/json-queries.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 41 3 | description: >- 4 | Query entities with Object-typed fields 5 | --- 6 | 7 | # JSON queries 8 | 9 | The possibility of defining JSON objects as fields of a type in a GraphQL schema has been explained in the [schema reference](/sdk/reference/schema-file). 10 | 11 | This guide is focusing on how to query such objects and how to fully leverage their potential. Let's take the example of this (non-crypto related, for once😁) schema: 12 | 13 | ```graphql title="schema.graphql" 14 | type Entity @entity { 15 | id: ID! 16 | a: A 17 | } 18 | 19 | type A { 20 | a: String 21 | b: B 22 | } 23 | 24 | type B { 25 | a: A 26 | b: String 27 | e: Entity 28 | } 29 | ``` 30 | 31 | It's composed of one entity and two JSON objects definitions, used in a "nested" way. 32 | 33 | Let's now look at a simple query: 34 | 35 | ```graphql 36 | query { 37 | entities(orderBy: id_ASC) { 38 | id 39 | a { a } 40 | } 41 | } 42 | ``` 43 | 44 | This will return a result such as this one (imagining this data exists in the database): 45 | 46 | ```graphql 47 | { 48 | entities: [ 49 | {id: '1', a: {a: 'a'}}, 50 | {id: '2', a: {a: 'A'}}, 51 | {id: '3', a: {a: null}}, 52 | {id: '4', a: null} 53 | ] 54 | } 55 | ``` 56 | 57 | Simply enough, the first two objects have an object of type `A` with some content inside, the third one has an object, but its `a` field is `null` and the fourth one simply does not have an `A` object at all. 58 | -------------------------------------------------------------------------------- /docs/sdk/reference/openreader-server/api/nested-field-queries.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 30 3 | title: Nested field queries 4 | description: >- 5 | Query entities related to other entities 6 | --- 7 | 8 | # Nested field queries 9 | 10 | With OpenReader, fields of an Entity that contain fields themselves are shown as nested fields and it is possible to filter these as well. GraphQL queries can traverse related objects and their fields, letting clients fetch lots of related data in one request, instead of making several roundtrips as one would need in a classic REST architecture. 11 | 12 | As an example, this query searches for all `accounts` whose balance is bigger than a threshold value, fetching the `id` and `balance` simple fields, as well as the `historicalBalances` **nested field**. 13 | 14 | ```graphql 15 | query { 16 | accounts(orderBy: balance_ASC, where: {balance_gte: "250000000000000000"}) { 17 | id 18 | balance 19 | historicalBalances { 20 | balance 21 | date 22 | id 23 | } 24 | } 25 | } 26 | 27 | ``` 28 | 29 | A nested field is a list (one account can have multiple `historicalBalances`) of objects with fields of their own. These objects can be filtered, too. 30 | 31 | In the following query the `historicalBalances` are filtered in order to only return the balances created after a certain date: 32 | 33 | ```graphql 34 | query { 35 | accounts(orderBy: balance_ASC, where: {balance_gte: "250000000000000000"}) { 36 | id 37 | balance 38 | historicalBalances(where: {date_lte: "2020-10-31T11:59:59.000Z"}, orderBy: balance_DESC) { 39 | balance 40 | date 41 | id 42 | } 43 | } 44 | } 45 | 46 | ``` 47 | Note that the [newer](/sdk/reference/openreader-server/overview/#supported-queries) and [more advanced](/sdk/reference/openreader-server/api/paginate-query-results) `{entityName}sConnection` queries support exactly the same format of the `where` argument as the older `{entityName}s` queries used in the examples provided here. 48 | -------------------------------------------------------------------------------- /docs/sdk/reference/openreader-server/api/sorting.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 60 3 | title: Sorting 4 | description: >- 5 | The orderBy argument 6 | --- 7 | 8 | # Sorting 9 | 10 | ## Sort order 11 | 12 | The sort order (ascending vs. descending) is set by specifying an `ASC` or `DESC` suffix for the column name in the `orderBy` input object, e.g. `title_DESC`. 13 | 14 | ### **Sorting entities** 15 | 16 | Example: Fetch a list of videos sorted by their titles in an ascending order: 17 | 18 | ```graphql 19 | query { 20 | videos(orderBy: title_ASC) { 21 | id 22 | title 23 | } 24 | } 25 | ``` 26 | or 27 | ```graphql 28 | query { 29 | videos(orderBy: [title_ASC]) { 30 | id 31 | title 32 | } 33 | } 34 | ``` 35 | 36 | ### **Sorting entities by multiple fields** 37 | 38 | The `orderBy` argument takes an array of fields to allow sorting by multiple columns. 39 | 40 | Example: Fetch a list of videos that is sorted by their titles (ascending) and then on their published date (descending): 41 | 42 | ```graphql 43 | query { 44 | videos(orderBy: [title_ASC, publishedOn_DESC]) { 45 | id 46 | title 47 | publishedOn 48 | } 49 | } 50 | ``` 51 | -------------------------------------------------------------------------------- /docs/sdk/reference/openreader-server/configuration/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 20, 3 | "label": "Configuration", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference/openreader-server/configuration", 10 | "title": "Configuring and extending the server" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/openreader-server/configuration/caching.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 12 3 | title: Caching 4 | description: Enable caching for faster queries 5 | --- 6 | 7 | # Caching 8 | 9 | The GraphQL API server provided by `@subsquid/graphql-server` supports caching via additional flags. It is done on a per-query basis. The whole response is cached for a specified amount of time (`maxAge`). 10 | 11 | To enable caching when deploying to SQD Cloud, add the caching flags to the `serve:prod` command definition at [`commands.json`](/squid-cli/commands-json), then use that command to run the server in the [deployment manifest](/cloud/reference/manifest/#deploy). Cloud currently supports only in-memory cache. 12 | For example, snippets below will deploy a GraphQL API server with a `100Mb` in-memory cache and invalidation time of `5` seconds: 13 | 14 | ```json title="commands.json" 15 | ... 16 | "serve:prod": { 17 | "description": "Start the GraphQL API server with caching and limits", 18 | "cmd": [ "squid-graphql-server", 19 | "--dumb-cache", "in-memory", 20 | "--dumb-cache-ttl", "5000", 21 | "--dumb-cache-size", "100", 22 | "--dumb-cache-max-age", "5000" ] 23 | } 24 | ... 25 | ``` 26 | 27 | ```yaml title="squid.yaml" 28 | # ... 29 | deploy: 30 | # other services ... 31 | api: 32 | cmd: [ "sqd", "serve:prod" ] 33 | ``` 34 | 35 | Caching flags list is available via `npx squid-graphql-server --help`. Here are some more details on them: 36 | 37 | ### `--dumb-cache ` 38 | 39 | Enables cache, either `in-memory` or `redis`. For `redis`, a Redis connection string must be set by a variable `REDIS_URL`. SQD Cloud deployments currently support only `in-memory` cache. 40 | 41 | ### `--dumb-cache-size ` 42 | 43 | Cache max size. Applies only to in-memory cache. 44 | 45 | ### `--dumb-cache-max-age ` 46 | 47 | A globally set max age in milliseconds. The cached queries are invalidated after that period of time. 48 | 49 | ### `--dumb-cache-ttl ` 50 | 51 | Time-to-live for in-memory cache entries. Applies only to in-memory cache. The entries are eligible for eviction from the cache if not updated for longer than the time-to-live time. 52 | -------------------------------------------------------------------------------- /docs/sdk/reference/processors/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 10, 3 | "label": "Processors", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference/processors", 10 | "title": "Classes for blockchain data extraction and transformation" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/processors/evm-batch/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 10, 3 | "label": "EVM", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference/processors/evm-batch", 10 | "title": "EvmBatchProcessor reference documentation" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/processors/substrate-batch/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 40, 3 | "label": "Substrate", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference/processors/substrate-batch", 10 | "title": "SubstrateBatchProcessor reference documentation" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/processors/substrate-batch/autocomplete-selectors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/sdk/reference/processors/substrate-batch/autocomplete-selectors.png -------------------------------------------------------------------------------- /docs/sdk/reference/schema-file/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 60, 3 | "label": "Schema file", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference/schema-file", 10 | "title": "Definition of the database schema, entity classes and the core GraphQL API" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/schema-file/entities.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 11 3 | description: >- 4 | Define high-level API entities 5 | --- 6 | 7 | # Entities 8 | 9 | Entities are defined by root-level GraphQL types decorated with `@entity`. Names and properties of entities are expected to be camelCased. They are converted into snake_case for use as the corresponding database table and column names. The primary key column is always mapped to the entity field of a special `ID` type mapped as string (`varchar`). Non-nullable fields are marked with an exclamation mark (`!`) and are nullable otherwise. 10 | 11 | The following [scalar types](https://graphql.org/learn/schema/#scalar-types) are supported by the `schema.graphql` dialect: 12 | 13 | - `String` (mapped to `text`) 14 | - `Int` (mapped to `int4`) 15 | - `Float` (mapped to `numeric`, ts type `number`) 16 | - `Boolean` (mapped to `bool`) 17 | - `DateTime` (mapped to `timestamptz`, ts type `Date`) 18 | - `BigInt` (mapped to `numeric`, ts type `bigint`) 19 | - `BigDecimal` (mapped to `numeric`, ts type `BigDecimal` of [`@subsquid/big-decimal`](https://www.npmjs.com/package/@subsquid/big-decimal)) 20 | - `Bytes` (mapped to `bytea`, ts type `UInt8Array`) 21 | - `JSON` (mapped to `jsonb`, ts type `unknown`) 22 | - Enums (mapped to `text`) 23 | - User-defined scalars (non-entity types). Such properties are mapped as `jsonb` columns. 24 | 25 | **Example** 26 | ```graphql 27 | type Scalar @entity { 28 | id: ID! 29 | boolean: Boolean 30 | string: String 31 | enum: Enum 32 | bigint: BigInt 33 | dateTime: DateTime 34 | bytes: Bytes 35 | json: JSON 36 | deep: DeepScalar 37 | } 38 | 39 | type DeepScalar { 40 | bigint: BigInt 41 | dateTime: DateTime 42 | bytes: Bytes 43 | boolean: Boolean 44 | } 45 | 46 | enum Enum { 47 | A B C 48 | } 49 | ``` 50 | 51 | ## Arrays 52 | 53 | An entity field can be an array of any scalar type except `BigInt` and `BigDecimal`. It will be mapped to the corresponding Postgres array type. Array elements may be defined as nullable or non-nullable. 54 | 55 | **Example** 56 | 57 | ```graphql 58 | type Lists @entity { 59 | id: ID! 60 | intArray: [Int!]! 61 | enumArray: [Enum!] 62 | datetimeArray: [DateTime!] 63 | bytesArray: [Bytes!] 64 | listOfListsOfInt: [[Int]] 65 | listOfJsonObjects: [Foo!] 66 | } 67 | 68 | enum Enum { 69 | A B C D E F 70 | } 71 | 72 | type Foo { 73 | foo: Int 74 | bar: Int 75 | } 76 | ``` 77 | -------------------------------------------------------------------------------- /docs/sdk/reference/schema-file/indexes-and-constraints.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 21 3 | title: Indexes and constraints 4 | description: Annotate indexed fields for faster queries 5 | --- 6 | 7 | # Indexes and unique constraints 8 | 9 | :::warning 10 | The lack of indices is the most common cause of slow API queries 11 | ::: 12 | 13 | It is crucial to add database indexes to the entity fields on which one expects filtering and ordering. To add an index to a column, the corresponding entity field must be decorated with `@index`. The corresponding entity field will be decorated with [TypeORM `@Index()`](https://typeorm.io/indices#column-indices). 14 | 15 | One can additionally decorate the field with `@unique` to enforce uniqueness. It corresponds to the [`@Index({ unique: true })`](https://typeorm.io/indices#unique-indices) TypeORM decorator. 16 | 17 | ### Example 18 | 19 | ```graphql 20 | type Transfer @entity { 21 | id: ID! 22 | to: Account! 23 | amount: BigInt! @index 24 | fee: BigInt! @index @unique 25 | } 26 | ``` 27 | 28 | ## Multi-column indices 29 | 30 | Multi-column indices are defined on the entity level, with an optional `unique` constraint. 31 | 32 | ### Example 33 | 34 | ```graphql 35 | type Foo @entity @index(fields: ["foo", "bar"]) @index(fields: ["bar", "baz"]) 36 | { 37 | id: ID! 38 | bar: Int! 39 | baz: [Enum!] 40 | foo: String! 41 | 42 | type Extrinsic @entity @index(fields: ["hash", "block"], unique: true) { 43 | id: ID! 44 | hash: String! @unique 45 | block: String! 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /docs/sdk/reference/schema-file/interfaces.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 24 3 | title: Interfaces 4 | description: Queriable interfaces 5 | --- 6 | 7 | # Interfaces 8 | 9 | The schema file supports [GraphQL Interfaces](https://graphql.org/learn/schema/#interfaces) for modelling complex types sharing common traits. Interfaces are annotated with `@query` at the type level and do not affect the database schema, only enriching the GraphQL API queries with [inline fragments](https://graphql.org/learn/queries/#inline-fragments). 10 | 11 | Currently, only [OpenReader](/sdk/reference/openreader-server) supports GraphQL interfaces defined in the schema file. 12 | 13 | ### Examples 14 | 15 | 16 | ```graphql 17 | interface MyEntity @query { 18 | id: ID! 19 | name: String 20 | ref: Ref 21 | } 22 | 23 | type Ref @entity { 24 | id: ID! 25 | name: String 26 | foo: Foo! @unique 27 | bar: Bar! @unique 28 | } 29 | 30 | type Foo implements MyEntity @entity { 31 | id: ID! 32 | name: String 33 | ref: Ref @derivedFrom(field: "foo") 34 | foo: Int 35 | } 36 | 37 | type Bar implements MyEntity @entity { 38 | id: ID! 39 | name: String 40 | ref: Ref @derivedFrom(field: "bar") 41 | bar: Int 42 | } 43 | 44 | type Baz implements MyEntity @entity { 45 | id: ID! 46 | name: String 47 | ref: Ref 48 | baz: Int 49 | } 50 | ``` 51 | 52 | The `MyEntity` interface above enables `myEntities` and `myEntitiesConnection` [GraphQL API queries](/sdk/reference/openreader-server/api) with inline fragments and the `_type`, `__typename` [meta fields](https://graphql.org/learn/queries/#meta-fields): 53 | 54 | ```graphql 55 | query { 56 | myEntities(orderBy: [_type_DESC, id_ASC]) { 57 | id 58 | name 59 | ref { 60 | id 61 | name 62 | } 63 | __typename 64 | ... on Foo { foo } 65 | ... on Bar { bar } 66 | ... on Baz { baz } 67 | } 68 | } 69 | ``` 70 | -------------------------------------------------------------------------------- /docs/sdk/reference/schema-file/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 10 3 | title: Schema file and codegen 4 | description: >- 5 | Intro to the schema file and the codegen tool 6 | --- 7 | 8 | # Schema file and codegen 9 | 10 | The schema file `schema.graphql` uses a GraphQL dialect to model the target entities and entity relations. The tooling around the schema file is then used to: 11 | - Generate TypeORM entities (with `squid-typeorm-codegen(1)`, see below) 12 | - Generate the database schema from the TypeORM entities (see [db migrations](/sdk/resources/persisting-data/typeorm)) 13 | - Optionally, the schema can be used to present the target data with a [GraphQL API](/sdk/resources/serving-graphql). 14 | 15 | The schema file format is loosely compatible with the [subgraph schema](https://thegraph.com/docs/en/developing/creating-a-subgraph/) file, see [Migrate from subgraph](/sdk/resources/migrate/migrate-subgraph) section for details. 16 | 17 | 18 | ## TypeORM codegen 19 | 20 | The [`squid-typeorm-codegen(1)`](https://github.com/subsquid/squid-sdk/tree/master/typeorm/typeorm-codegen) tool is used to generate [TypeORM entity](https://typeorm.io/) classes from the schema defined in `schema.graphql`. Invoke it with 21 | 22 | ```bash 23 | npx squid-typeorm-codegen 24 | ``` 25 | 26 | By default the entity classes are generated in `src/model/generated`. 27 | 28 | ### Example 29 | 30 | A `Foo` entity defined in the schema file: 31 | ```graphql title="schema.graphql" 32 | type Foo @entity { 33 | id: ID! 34 | bar: String 35 | baz: BigInt! 36 | } 37 | ``` 38 | The generated `Foo` entity with TypeORM decorators: 39 | ```ts title="src/model/generated/foo.ts" 40 | import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_} from "typeorm" 41 | import * as marshal from "./marshal" 42 | 43 | @Entity_() 44 | export class Foo { 45 | constructor(props?: Partial) { 46 | Object.assign(this, props) 47 | } 48 | 49 | @PrimaryColumn_() 50 | id!: string 51 | 52 | @Column_("text", {nullable: true}) 53 | bar!: string | undefined | null 54 | 55 | @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) 56 | baz!: bigint 57 | } 58 | ``` 59 | -------------------------------------------------------------------------------- /docs/sdk/reference/schema-file/unions-and-typed-json.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 23 3 | title: Unions and typed JSON 4 | description: Union and JSON types 5 | --- 6 | 7 | # Unions and typed JSON 8 | 9 | Complex scalar types can be modelled using a typed JSON fields together with union types, making safe union types. 10 | 11 | ## Typed JSON 12 | 13 | It is possible to define explicit types for JSON fields. The generated entity classes and the GraphQL API will respect the type definition of the field, enforcing the data integrity. 14 | 15 | **Example** 16 | ```graphql 17 | type Entity @entity { 18 | a: A 19 | } 20 | 21 | type A { 22 | a: String 23 | b: B 24 | c: JSON 25 | } 26 | 27 | type B { 28 | a: A 29 | b: String 30 | e: Entity 31 | } 32 | ``` 33 | 34 | ## Union types 35 | 36 | One can leverage union types supported both by [Typescript](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) and [GraphQL](https://graphql.org/learn/schema/#union-types). The union operator for `schema.graphql` supports only non-entity types, including typed JSON types described above. JSON types, however, are allowed to reference an entity type. 37 | 38 | **Example** 39 | ```graphql 40 | type User @entity { 41 | id: ID! 42 | login: String! 43 | } 44 | 45 | type Farmer { 46 | user: User! 47 | crop: Int 48 | } 49 | 50 | type Degen { 51 | user: User! 52 | bag: String 53 | } 54 | 55 | union Owner = Farmer | Degen 56 | 57 | type NFT @entity { 58 | name: String! 59 | owner: Owner! 60 | } 61 | ``` 62 | -------------------------------------------------------------------------------- /docs/sdk/reference/store/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 20, 3 | "label": "Data sinks", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference/store", 10 | "title": "Classes for saving data" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/store/bigquery.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 25 3 | title: bigquery-store 4 | description: >- 5 | @subsquid/bigquery-store reference 6 | --- 7 | 8 | # `@subsquid/bigquery-store` 9 | 10 | See also the [BigQuery guide](/sdk/resources/persisting-data/bigquery). 11 | 12 | ## Column types 13 | 14 | | Column type | Value type | Dataset column type | 15 | |:------------------------------:|:--------------------------------:|:--------------------------------------------------------------------------------------------------------:| 16 | | `String()` | `string` | [STRING](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#string_type) | 17 | | `Numeric(precision, scale)` | number | bigint | [NUMERIC(P[, S])](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#parameterized_decimal_type) | 18 | | `BigNumeric(precision, scale)` | number | bigint | [BIGNUMERIC(P[, S])](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#parameterized_decimal_type) | 19 | | `Bool()` | `boolean` | [BOOL](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#boolean_type) | 20 | | `Timestamp()` | `Date` | [TIMESTAMP](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#timestamp_type) | 21 | | `Float64()` | `number` | [FLOAT64](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#floating_point_types) | 22 | | `Int64()` | number | bigint | [INT64](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#integer_types) | 23 | -------------------------------------------------------------------------------- /docs/sdk/reference/store/file/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 20, 3 | "label": "file-store extensions", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/reference/store/file", 10 | "title": "Tools for saving squid data to file-based datasets locally or on S3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/reference/store/file/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 40 3 | title: JSON support 4 | description: >- 5 | Table class for writing JSON and JSONL files 6 | --- 7 | 8 | # JSON format support 9 | 10 | ## `Table` Implementation 11 | 12 | The `@subsquid/file-store-json` package provides a `Table` implementation for writing to JSON and [JSONL](https://jsonlines.org) files. Use it by [supplying one or more of its instances via the `tables` field of the `Database` constructor argument](/sdk/resources/persisting-data/file/#database-options). The `Table` uses a constructor with the following signature: 13 | ```typescript 14 | Table>(fileName: string, options?: {lines?: boolean}) 15 | ``` 16 | Here, 17 | * **`S`** is a Typescript type describing the schema of the table data. 18 | * **`fileName: string`** is the name of the output file in every dataset partition folder. 19 | * **`options?: {lines?: boolean}`** are table options. At the moment the only available setting is whether to use JSONL instead of a plain JSON array (default: false). 20 | 21 | ## Example 22 | 23 | This saves ERC20 `Transfer` events captured by the processor to a JSONL file where each line is a JSON serialization of a `{from: string, to: string, value: number}` object. Full squid code is available in [this repo](https://github.com/subsquid-labs/file-store-json-example). 24 | 25 | ```typescript 26 | import {Database} from '@subsquid/file-store' 27 | import {Table} from '@subsquid/file-store-json' 28 | 29 | ... 30 | 31 | const dbOptions = { 32 | tables: { 33 | TransfersTable: new Table<{ 34 | from: string, 35 | to: string, 36 | value: bigint 37 | }>('transfers.jsonl', { lines: true }) 38 | }, 39 | dest: new LocalDest('./data'), 40 | chunkSizeMb: 10 41 | } 42 | 43 | processor.run(new Database(dbOptions), async (ctx) => { 44 | ... 45 | let from: string = ... 46 | let to: string = ... 47 | let value: bigint = ... 48 | ctx.store.TransfersTable.write({ from, to, value }) 49 | ... 50 | }) 51 | ``` 52 | -------------------------------------------------------------------------------- /docs/sdk/reference/store/file/s3-dest.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 50 3 | title: S3 support 4 | description: >- 5 | A Dest class for uploading data to buckets 6 | --- 7 | 8 | # S3 destination support 9 | 10 | ## Overview 11 | 12 | Writing to Amazon S3-compatible file storage services such as [AWS](https://aws.amazon.com) and [Filebase](https://filebase.com) is supported via the `S3Dest` class from the `@subsquid/file-store-s3` package. Use it by [setting the `dest` field of the `Database` constructor argument](/sdk/resources/persisting-data/file/#database-options) to its instance. Constructor of `S3Dest` accepts the following arguments: 13 | * **`url: string`**: S3 URL in the `s3://bucket/path` format. 14 | * **`optionsOrClient?: S3Client | S3ClientConfig`**: an optional [S3 client](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/Class/S3Client/) or [client config](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html). By default, a simple config parameterized by environment variables is used: 15 | ```typescript 16 | { 17 | region: process.env.S3_REGION, 18 | endpoint: process.env.S3_ENDPOINT, 19 | credentials: { 20 | accessKeyId: assertNotNull(process.env.S3_ACCESS_KEY_ID), 21 | secretAccessKey: assertNotNull(process.env.S3_SECRET_ACCESS_KEY), 22 | }, 23 | } 24 | ``` 25 | 26 | ## Example 27 | 28 | This saves the processor data in the `transfers-data` folder of the `subsquid-testing-bucket` bucket at the [Filebase](https://filebase.com) service. The service only has one region and one endpoint, and here they are hardcoded to reduce the number of required envirionment variables and illustrate how connection parameters can be supplied programmatically. Full squid code is available in [this repo](https://github.com/subsquid-labs/file-store-s3-example). 29 | 30 | ```typescript 31 | import {Database} from '@subsquid/file-store' 32 | import {S3Dest} from '@subsquid/file-store-s3' 33 | import {assertNotNull} from '@subsquid/util-internal' // pulled by @subsquid/file-store-s3 34 | 35 | ... 36 | 37 | const dbOptions = { 38 | ... 39 | dest: new S3Dest( 40 | 's3://subsquid-testing-bucket/transfers-data', 41 | { 42 | region: 'us-east-1', 43 | endpoint: 'https://s3.filebase.com', 44 | credentials: { 45 | accessKeyId: assertNotNull(process.env.S3_ACCESS_KEY_ID), 46 | secretAccessKey: assertNotNull(process.env.S3_SECRET_ACCESS_KEY) 47 | } 48 | } 49 | ), 50 | ... 51 | } 52 | 53 | processor.run(new Database(dbOptions), async (ctx) => { 54 | ... 55 | } 56 | ``` 57 | -------------------------------------------------------------------------------- /docs/sdk/resources/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 33, 3 | "label": "Features & Guides", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/resources", 10 | "title": "Resources for squid developers" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/resources/evm/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 110, 3 | "label": "EVM-specific", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/resources/evm", 10 | "title": "Topics specific to EVM" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/resources/migrate/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 140, 3 | "label": "Migration guides", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/resources/migrate", 10 | "title": "Guides to migrations from other frameworks and older SQD versions" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/resources/migrate/migrate-to-hasura-configuration-tool-v2.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 5 3 | title: hasura-configuration tool v2 4 | description: Breaking change in the Hasura configuration tool 5 | --- 6 | 7 | # Migrating to Hasura configuration tool v2 8 | 9 | Pre-2.0.0 [`@subsquid/hasura-configuration`](/sdk/resources/tools/hasura-configuration) used a fixed naming schema for [relation fields](/sdk/reference/schema-file/entity-relations/): 10 | 11 | - Forward relation fields were _always_ named after the type they referred to. Type names were `snake_case`d. For example, any field referring to an entity called `BurnTest` was called `burn_test`. 12 | - Inverse relation fields names were also determined by the relation type: 13 | + In one-to-one relation their names were `to_snake_case(typeName)`, where `typeName` is the name of the entity that the inverse field is typed with. 14 | + In one-to-many inverse relations they were named `${to_snake_case(typeName)}s`. 15 | 16 | Any names given to the fields in the [schema](/sdk/reference/schema-file) were ignored. 17 | 18 | `@subsquid/hasura-configuration@2.0.0` introduces full support for in-schema field names. Now the fields will be called exactly as they are in the schema file. If these field names are different from what's described above, your API will have a breaking change. If you'd like to avoid it, please make sure that the fields in your `schema.graphql` are named exactly as described above. 19 | 20 | To update the tool and your Hasura config: 21 | ```bash 22 | npm i @subsquid/hasura-configuration@latest 23 | npx squid-hasura-configuration regenerate 24 | ``` 25 | If you deployed to the Cloud you can safely (barring the field names change) redeploy your squid in-place. 26 | 27 | If you opted to not change your schema to accommodate the old relation field names, please follow this up by revising GraphQL queries in any of your client apps. 28 | -------------------------------------------------------------------------------- /docs/sdk/resources/persisting-data/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 100, 3 | "label": "Persisting data", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/resources/persisting-data", 10 | "title": "Supported data sinks for squid processors" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/resources/serving-graphql-database-creds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/sdk/resources/serving-graphql-database-creds.png -------------------------------------------------------------------------------- /docs/sdk/resources/substrate/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 120, 3 | "label": "Substrate-specific", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/resources/substrate", 10 | "title": "Topics specific to Substrate" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/resources/substrate/data-sourcing-miniguide.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 60 3 | description: >- 4 | Picking the right data on Substrate 5 | title: Substrate data sourcing 6 | --- 7 | 8 | ## How do I know which events and calls I need on Substrate? 9 | 10 | This part depends on the runtime business logic of the chain. The primary and the most reliable source of information is thus the Rust sources for the pallets used by the chain. 11 | 12 | For a quick lookup of the documentation and the data format, it is often useful to check Runtime section of Subscan (e.g. [Statemine](https://assethub-kusama.subscan.io/runtime)). One can see the deployed pallets and drill down to events and extrinsics from there. One can also choose the spec version on the drop down. 13 | -------------------------------------------------------------------------------- /docs/sdk/resources/substrate/gear.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 30 3 | description: >- 4 | Additional support for indexing Gear programs 5 | --- 6 | 7 | # Gear support 8 | 9 | :::info 10 | SQD Network has gateways for two networks that use Gear Protocol: **Vara** and **Vara Testnet**. Here are their endopint URLs: 11 | ``` 12 | https://v2.archive.subsquid.io/network/vara 13 | ``` 14 | ``` 15 | https://v2.archive.subsquid.io/network/vara-testnet 16 | ``` 17 | ::: 18 | 19 | Indexing [Gear](https://gear-tech.io/) programs is supported with [`addGearMessageQueued()`](/sdk/reference/processors/substrate-batch/data-requests/#addgearmessagequeued) and [`addGearUserMessageSent()`](/sdk/reference/processors/substrate-batch/data-requests/#addgearusermessagesent) specialized data requests. These subscribe to the events [`Gear.MessageQueued`](https://wiki.gear-tech.io/docs/api/events/#messagequeued) and [`Gear.UserMessageSent`](https://wiki.gear-tech.io/docs/api/events/#usermessagesent) emitted by a specified Gear program. 20 | 21 | The processor can also subscribe to any other event with [`addEvent()`](/sdk/reference/processors/substrate-batch/data-requests/#events) and filter by program ID in the batch handler, if so necessary. 22 | 23 | An example of a squid indexing a Gear program (an NFT contract) can be found [here](https://github.com/subsquid/squid-sdk/tree/master/test/gear-nft). 24 | -------------------------------------------------------------------------------- /docs/sdk/resources/substrate/ink.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 10 3 | description: >- 4 | ink! WASM smart contracts support 5 | title: ink! contracts support 6 | --- 7 | 8 | # ink! contracts support 9 | 10 | This section describes additional options available for indexing [ink!-based WASM contracts](https://use.ink), supported by chains with a `Contracts` pallet. At the moment of writing, AlephZero, Shibuya (Astar testnet), Shiden (Kusama parachain) and Astar (Polkadot parachain) are the most popular chains for deploying ink! contracts. 11 | 12 | [Generate an ink! indexing squid automatically](/sdk/resources/tools/squid-gen), follow the [WASM squid tutorial](/sdk/tutorials/ink) for a step-by-step instruction or check out the [squid-wasm-template](https://github.com/subsquid-labs/squid-wasm-template) reference project. 13 | 14 | ## Processor configuration 15 | 16 | Request events by the contract address as described on the [`SubstrateBatchProcessor` reference page](/sdk/reference/processors/substrate-batch/data-requests/#addcontractscontractemitted), e.g. 17 | 18 | ```ts 19 | import * as ss58 from '@subsquid/ss58' 20 | import {toHex} from '@subsquid/util-internal-hex' 21 | 22 | const ADDRESS = toHex(ss58.decode('XnrLUQucQvzp5kaaWLG9Q3LbZw5DPwpGn69B5YcywSWVr5w').bytes) 23 | 24 | const processor = new SubstrateBatchProcessor() 25 | .setGateway('https://v2.archive.subsquid.io/network/shibuya-substrate') 26 | .setRpcEndpoint('https://shibuya.public.blastapi.io') 27 | .addContractsContractEmitted({ 28 | contractAddress: [ADDRESS], 29 | extrinsic: true 30 | }) 31 | .setFields({ 32 | event: { 33 | phase: true 34 | } 35 | }) 36 | ``` 37 | 38 | Generate and use the facade classes for decoding ink! smart contract data as described in the [typegens reference](/sdk/resources/tools/typegen). You can also make [direct contract state queries](/sdk/resources/tools/typegen/state-queries/?typegen=ink) using the `Contract` class generated by `squid-ink-typegen`. 39 | -------------------------------------------------------------------------------- /docs/sdk/resources/substrate/types-bundle-miniguide.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 70 3 | description: >- 4 | Sourcing Substrate metadata 5 | title: Substrate types bundles 6 | --- 7 | 8 | ### Where do I get a types bundle for my chain? 9 | 10 | Types bundle is only needed for pre-Metadata v14 blocks and only if SQD does not offer a built-in support for the chain in question. 11 | 12 | Most chains publish their type bundles as an npm package (for example: [Edgeware](https://www.npmjs.com/package/@edgeware/node-types)). One of the best places to check for the latest version is the [polkadot-js/app](https://github.com/polkadot-js/apps/tree/master/packages/apps-config/src/api/spec) and [polkadot-js/api](https://github.com/polkadot-js/api/tree/master/packages/types-known/src/spec) repositories. 13 | 14 | :::info 15 | **Note:** the type bundle format for typegen is slightly different from `OverrideBundleDefinition` of `polkadot.js`. The structure is as follows, all the fields are optional. 16 | ::: 17 | 18 | ```javascript 19 | { 20 | types: {}, // top-level type definitions, as `.types` option of `ApiPromise` 21 | typesAlias: {}, // top-level type aliases, as `.typesAlias` option of `ApiPromise` 22 | versions: [ // spec version specific overrides, same as `OverrideBundleDefinition.types` of `polkadot.js` 23 | { 24 | minmax: [0, 1010] // spec range 25 | types: {}, // type overrides for the spec range 26 | typesAlias: {}, // type alias overrides for the spec range 27 | } 28 | ] 29 | } 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/sdk/resources/tools/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 130, 3 | "label": "Tools", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/resources/tools", 10 | "title": "Development tools for type-safe decoding the raw data, streamlined persistence with TypeORM, and code generation." 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/resources/tools/hasura-configuration-web-ui-import-export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/sdk/resources/tools/hasura-configuration-web-ui-import-export.png -------------------------------------------------------------------------------- /docs/sdk/resources/tools/migrations-gen.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 50 3 | title: TypeORM migration generation 4 | description: Generate TypeORM models from a schema file 5 | --- 6 | 7 | # TypeORM migration generation 8 | 9 | The [`typeorm-migration`](https://github.com/subsquid/squid-sdk/tree/master/typeorm/typeorm-migration) tool is used to generate, apply and revert database migrations. It follows the conventions below. 10 | 11 | * The migrations are generated in the `db/migrations` folder. 12 | * The database connection is inferred from the `DB_XXX` environment variables. 13 | * All entities should be exported from `lib/model` commonjs module, i.e. the entity classes must be compiled from TypeScript. 14 | 15 | Here are some useful commands: 16 | ```bash 17 | npx squid-typeorm-migration apply # apply pending migrations 18 | ``` 19 | ```bash 20 | npx squid-typeorm-migration generate # generate the migration for the schema defined in schema.graphql 21 | ``` 22 | ```bash 23 | rm -r db/migrations # clean the db/migrations folder 24 | ``` 25 | -------------------------------------------------------------------------------- /docs/sdk/resources/tools/model-gen.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 50 3 | title: TypeORM model generation 4 | description: Generate TypeORM models from a schema file 5 | --- 6 | 7 | # TypeORM model generation 8 | 9 | TypeORM entities can be automatically generated from the [schema file](/sdk/reference/schema-file) defined in `schema.graphql`. 10 | The tool is called [`squid-typeorm-codegen(1)`](https://github.com/subsquid/squid-sdk/tree/master/typeorm/typeorm-codegen) and has no additonal options. 11 | 12 | Install with 13 | ```sh 14 | npm i @subsquid/typeorm-codegen --save-dev 15 | ``` 16 | 17 | Invoke with 18 | ```sh 19 | npx squid-typeorm-codegen 20 | ``` 21 | -------------------------------------------------------------------------------- /docs/sdk/resources/tools/typegen/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 50, 3 | "label": "Type-safe decoding", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/sdk/resources/tools/typegen", 10 | "title": "Generators of code for tech-specific tasks such as decoding and querying chains directly" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/tutorials/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 60, 3 | "label": "Tutorials", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "title": "Step-by-step tutorials", 10 | "slug":"/sdk/tutorials" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/tutorials/bayc/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 15, 3 | "label": "Indexing BAYC", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "title": "Guide into building a squid that indexes transfers, tokens and token owners of Bored Ape Yach Club NFTs. Each step ends with a working squid implementing a part of the final functionality.", 10 | "slug": "/sdk/tutorials/bayc" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/sdk/tutorials/bayc/bayc-playground-step-one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/sdk/tutorials/bayc/bayc-playground-step-one.png -------------------------------------------------------------------------------- /docs/sdk/tutorials/bayc/bayc-playground-step-three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/sdk/tutorials/bayc/bayc-playground-step-three.png -------------------------------------------------------------------------------- /docs/sdk/tutorials/bayc/bayc-playground-step-two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/sdk/tutorials/bayc/bayc-playground-step-two.png -------------------------------------------------------------------------------- /docs/sdk/tutorials/case-studies.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Case studies 3 | description: >- 4 | Deep dives into larger projects built with SQD 5 | sidebar_position: 80 6 | --- 7 | 8 | Follow the links from the [SQD Medium blog](https://medium.com/subsquid) for deep dives into the development process of larger projects built from scratch. They use the FireSquid version of the framework, so much of the involved code is outdated. Still, the general approaches they illustrate endure. 9 | 10 | - [DeFi Dashboard](https://medium.com/subsquid/build-your-first-defi-dashboard-ad3ce1e9fc73). A React app for a real-time dashboard showing key statistics of the Moonwell lending protocol 11 | - [Rave name service indexing on Fantom](https://medium.com/subsquid/building-a-fast-and-scalable-web3-api-on-fantom-blockchain-94c79933b55). 12 | - [Indexing Uniswap data into parquets](https://medium.com/subsquid/how-to-scale-blockchain-data-science-for-large-datasets-b49d078c15eb). A step-by-step guide on how to extract, decode and analyze Uniswap trading data with SQD, Pandas and a Python notebook. 13 | - [Analyzing Lens Protocol](https://medium.com/subsquid/how-to-analyze-lens-protocol-activity-data-with-subsquid-e1ee3b7b43fa). An end-to-end tutorial on how to extract and analyze the social data of the Lens protocol. Includes an extra step on how to build a UI for the dashboards. 14 | -------------------------------------------------------------------------------- /docs/solana-indexing/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 27, 3 | "label": "Solana indexing", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/solana-indexing", 10 | "title": "Index Solana with SQD" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/solana-indexing/how-to-start/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 90, 3 | "label": "How to start", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/solana-indexing/how-to-start", 10 | "title": "How to Start with Solana Indexing SDK" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/solana-indexing/how-to-start/cli-cheatsheet.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 50 3 | title: Cheatsheet 4 | description: Commonly used CLI commands 5 | --- 6 | 7 | # CLI cheatsheet 8 | 9 | This quide provides a quick reference to the commands needed to launch the squid and manage the database. 10 | 11 | ### Install dependencies 12 | 13 | ```sh 14 | npm i 15 | ``` 16 | 17 | ### Compile the project 18 | 19 | ```sh 20 | npx tsc 21 | ``` 22 | 23 | ### Launch Postgres database to store the data 24 | 25 | ```sh 26 | docker compose up -d 27 | ``` 28 | 29 | ### Apply database migrations to create the target schema 30 | 31 | ```sh 32 | npx squid-typeorm-migration apply 33 | ``` 34 | ### Run indexer 35 | 36 | ```sh 37 | node -r dotenv/config lib/main.js 38 | ``` 39 | 40 | ### Check out the indexed swaps 41 | 42 | 43 | ```sh 44 | docker exec "$(basename "$(pwd)")-db-1" psql -U postgres \ 45 | -c "SELECT slot, from_token, to_token, from_amount, to_amount FROM exchange ORDER BY id LIMIT 10" 46 | ``` 47 | 48 | Notice that this project doesn't utilize `sqd` commands. 49 | -------------------------------------------------------------------------------- /docs/solana-indexing/network-api/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 100, 3 | "label": "Network API", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/solana-indexing/network-api", 10 | "title": "SQD Network API documentation for Solana" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/solana-indexing/sdk/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 90, 3 | "label": "SDK", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/solana-indexing/sdk", 10 | "title": "Index Solana with SQD" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/solana-indexing/sdk/solana-batch/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 20, 3 | "label": "SolanaDataSource", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/solana-indexing/sdk/solana-batch", 10 | "title": "SolanaDataSource reference documentation" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/solana-indexing/sdk/solana-batch/balances.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 50 3 | description: >- 4 | Track balance changes with addBalance() 5 | --- 6 | 7 | # Balances 8 | 9 | #### `addBalance(options)` {#add-balance} 10 | 11 | This allows for tracking SOL account balances. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | where?: { 17 | account?: string[] 18 | } 19 | 20 | // related data retrieval 21 | include?: { 22 | transaction?: boolean 23 | transactionInstructions?: boolean 24 | } 25 | 26 | range?: { 27 | from: number 28 | to?: number 29 | } 30 | } 31 | ``` 32 | 33 | The data requests here are: 34 | - `account`: the set of accounts to track. Leave undefined to subscribe to balance updates of all accounts in the whole network. 35 | 36 | Related data retrieval flags: 37 | - `transaction = true`: retrieve the transaction that gave rise to the balance update 38 | - `transactionInstructions = true`: retrieve all instructions executed by the parent transaction 39 | 40 | The related data will be added to the appropriate iterables within the [block data](/solana-indexing/sdk/solana-batch/context-interfaces). You can also call `augmentBlock()` from `@subsquid/solana-objects` on the block data to populate the convenience reference fields like `instruction.inner`. 41 | 42 | Selection of the exact fields to be retrieved for each balance item and the related data is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 43 | -------------------------------------------------------------------------------- /docs/solana-indexing/sdk/solana-batch/instructions.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 20 3 | description: >- 4 | Track instruction execution with addInstruction() 5 | --- 6 | 7 | # Instructions 8 | 9 | #### `addInstruction(options)` {#add-instruction} 10 | 11 | This allows for tracking program instructions. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | where?: { 17 | programId?: string[] 18 | 19 | d1?: string[] 20 | d2?: string[] 21 | d3?: string[] 22 | d4?: string[] 23 | d8?: string[] 24 | 25 | a0?: string[] 26 | a1?: string[] 27 | a2?: string[] 28 | a3?: string[] 29 | a4?: string[] 30 | a5?: string[] 31 | a6?: string[] 32 | a7?: string[] 33 | a8?: string[] 34 | a9?: string[] 35 | 36 | isCommitted?: boolean 37 | } 38 | 39 | // related data retrieval 40 | include?: { 41 | transaction?: boolean 42 | transactionTokenBalances?: boolean 43 | logs?: boolean 44 | innerInstructions?: boolean 45 | } 46 | 47 | range?: { 48 | from: number 49 | to?: number 50 | } 51 | } 52 | ``` 53 | 54 | The data requests here are: 55 | 56 | - `programId`: the set of program addresses to track. Leave undefined to subscribe to instructions data of all programs from the whole network. 57 | - `d1` through `d8`: sets of 1, 2, 3, 4 and 8-byte instruction discriminators, correspondingly. 58 | - `a0` through `a9`: sets of base58-encoded account inputs to the instruction, at positions 0-9 correspondingly. 59 | - `isCommitted`: `true` to request only instructions that did not revert. 60 | 61 | Related data retrieval flags: 62 | - `transaction = true`: retrieve the transaction that gave rise to instruction 63 | - `transactionTokenBalances = true`: retrieve all token balance records in the parent instruction 64 | - `logs = true`: retrieve all logs emitted due to the instruction 65 | - `innerInstructions = true`: retrieve the data for all instruction calls due to the matching instruction 66 | 67 | The related data will be added to the appropriate iterables within the [block data](/solana-indexing/sdk/solana-batch/context-interfaces). You can also call `augmentBlock()` from `@subsquid/solana-objects` on the block data to populate the convenience reference fields like `instruction.inner`. 68 | 69 | Selection of the exact fields to be retrieved for each instruction item and the related data is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 70 | -------------------------------------------------------------------------------- /docs/solana-indexing/sdk/solana-batch/logs.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 40 3 | description: >- 4 | Subscribe to log messages with addLog() 5 | --- 6 | 7 | # Log messages 8 | 9 | #### `addLog(options)` {#add-log} 10 | 11 | Get log messages emitted by some _or all_ programs in the network. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | where?: { 17 | programId?: string[] 18 | kind?: ('log' | 'data' | 'other')[] 19 | } 20 | 21 | // related data retrieval 22 | include?: { 23 | transaction?: boolean 24 | instruction?: boolean 25 | } 26 | 27 | range?: { 28 | from: number, 29 | to?: number 30 | } 31 | } 32 | ``` 33 | 34 | Data requests: 35 | 36 | - `programId`: the set of addresses of programs emitting the logs. Leave it undefined to subscribe to logs from all programs in the network. 37 | - `kind`: the set of values of `kind`. 38 | 39 | With `transaction = true` the processor will retrieve all parent transactions and add them to the `transactions` iterable within the [block data](/solana-indexing/sdk/solana-batch/context-interfaces). You can also call `augmentBlock()` from `@subsquid/solana-objects` on the block data to populate the convenience reference fields like `log.transaction`. 40 | 41 | Note that logs can also be requested by the other `SolanaDataSource` methods as related data. 42 | 43 | Selection of the exact fields to be retrieved for each log and its optional parent transaction is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 44 | 45 | ## Examples 46 | 47 | Fetch all event logs emitted by Orca Whirlpool. 48 | 49 | ```ts 50 | const dataSource = new DataSourceBuilder() 51 | .setGateway('https://v2.archive.subsquid.io/network/solana-mainnet') 52 | .addLog({ 53 | where: { 54 | programId: [PYTH_PUSH_ORACLE_PROGRAM_ID] 55 | }, 56 | include: { 57 | instruction: true 58 | }, 59 | range: { 60 | from: 241_000_000 61 | } 62 | }) 63 | .build() 64 | ``` 65 | -------------------------------------------------------------------------------- /docs/solana-indexing/sdk/solana-batch/rewards.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 70 3 | description: >- 4 | Track rewards with addReward() 5 | --- 6 | 7 | # Rewards 8 | 9 | #### `addReward(options)` {#add-reward} 10 | 11 | This allows for tracking rewards. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | where?: { 17 | pubkey?: string[] 18 | } 19 | 20 | range?: { 21 | from: number 22 | to?: number 23 | } 24 | } 25 | ``` 26 | 27 | `pubkey` here is the set public keys of reward receivers. Leave undefined to subscribe to all rewards. 28 | 29 | Selection of the exact fields to be retrieved for each reward item is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 30 | -------------------------------------------------------------------------------- /docs/solana-indexing/sdk/solana-batch/token-balances.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 60 3 | description: >- 4 | Track token balance changes with addTokenBalance() 5 | --- 6 | 7 | # Token balances 8 | 9 | #### `addTokenBalance(options)` {#add-token-balance} 10 | 11 | This allows for tracking token balances. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | where?: { 17 | account?: string[] 18 | preProgramId?: string[] 19 | postProgramId?: string[] 20 | preMint?: string[] 21 | postMint?: string[] 22 | preOwner?: string[] 23 | postOwner?: string[] 24 | } 25 | 26 | // related data retrieval 27 | include?: { 28 | transaction?: boolean 29 | transactionInstructions?: boolean 30 | } 31 | 32 | range?: { 33 | from: number 34 | to?: number 35 | } 36 | } 37 | ``` 38 | 39 | The data requests here are: 40 | - `account`: the set of accounts to track. Leave undefined to subscribe to balance updates of all accounts across the network. 41 | - `preProgramId` : pubkeys of the Token program that owns the account. 42 | - `postProgramId`: pubkeys of the Token program that owns the account. 43 | - `preMint`: pubkeys of the token's mint prior to execution. 44 | - `postMint`: pubkeys of the token's mint after execution. 45 | - `preOwner`: pubkeys of token balance's owner after execution. 46 | - `postOwner`: pubkeys of token balance's owner after execution. 47 | 48 | All account/pubkeys should be base58-encoded strings. 49 | 50 | Related data retrieval flags: 51 | - `transaction = true`: retrieve the transaction that gave rise to the balance update 52 | - `transactionInstructions = true`: retrieve all instructions executed by the parent transaction 53 | 54 | The related data will be added to the appropriate iterables within the [block data](/solana-indexing/sdk/solana-batch/context-interfaces). You can also call `augmentBlock()` from `@subsquid/solana-objects` on the block data to populate the convenience reference fields like `balance.transaction`. 55 | 56 | Selection of the exact fields to be retrieved for each token balance item and the related data is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 57 | -------------------------------------------------------------------------------- /docs/solana-indexing/sdk/solana-batch/transactions.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 30 3 | description: >- 4 | Subscribe to txn data with addTransaction() 5 | --- 6 | 7 | # Transactions 8 | 9 | #### `addTransaction(options)` {#add-transaction} 10 | 11 | Get some _or all_ transactions on the network. `options` has the following structure: 12 | 13 | ```typescript 14 | { 15 | // data requests 16 | where?: { 17 | feePayer?: string[] 18 | } 19 | 20 | // related data retrieval 21 | include?: { 22 | instructions?: boolean 23 | logs?: boolean 24 | } 25 | 26 | range?: { 27 | from: number 28 | to?: number 29 | } 30 | } 31 | ``` 32 | 33 | Data requests: 34 | - `feePayer` sets the addresses of the fee payers. Leave it undefined to subscribe to all transactions. 35 | 36 | Enabling the `instructions` and/or `logs` flags will cause the processor to retrieve [instructions](/solana-indexing/sdk/solana-batch/instructions) and [logs](/solana-indexing/sdk/solana-batch/logs) that occured as a result of each selected transaction. The data will be added to the appropriate iterables within the [block data](/solana-indexing/sdk/solana-batch/context-interfaces). You can also call `augmentBlock()` from `@subsquid/solana-objects` on the block data to populate the convenience reference fields like `transaction.logs`. 37 | 38 | Note that transactions can also be requested by the other `SolanaDataSource` methods as related data. 39 | 40 | Selection of the exact fields to be retrieved for each transaction and the optional related data items is done with the `setFields()` method documented on the [Field selection](../field-selection) page. 41 | 42 | ## Examples 43 | 44 | Request all transactions with fee payer `rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ` and include logs and instructions: 45 | 46 | ```ts 47 | processor 48 | .addTransaction({ 49 | where: { 50 | feePayer: ['rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ'], 51 | }, 52 | include: { 53 | logs: true, 54 | instructions: true 55 | } 56 | }) 57 | .build() 58 | ``` 59 | -------------------------------------------------------------------------------- /docs/squid-cli/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 80, 3 | "label": "Squid CLI", 4 | "collapsible": true, 5 | "collapsed": true, 6 | "className": "red", 7 | "link": { 8 | "type": "generated-index", 9 | "slug": "/squid-cli", 10 | "title": "Reference manual for the sqd utility" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /docs/squid-cli/auth.md: -------------------------------------------------------------------------------- 1 | `sqd auth` 2 | ========== 3 | 4 | Log in to the Cloud 5 | 6 | * [`sqd auth`](#sqd-auth-1) 7 | 8 | ## `sqd auth` 9 | 10 | Log in to the Cloud 11 | 12 | ``` 13 | USAGE 14 | $ sqd auth -k [--interactive] 15 | 16 | FLAGS 17 | -k, --key= (required) Cloud auth key. Log in to https://app.subsquid.io to create or update your key. 18 | --[no-]interactive Disable interactive mode 19 | ``` 20 | 21 | _See code: [src/commands/auth.ts](https://github.com/subsquid/squid-cli/tree/master/src/commands/auth.ts)_ 22 | -------------------------------------------------------------------------------- /docs/squid-cli/autocomplete.md: -------------------------------------------------------------------------------- 1 | `sqd autocomplete` 2 | ================== 3 | 4 | Display autocomplete installation instructions. 5 | -------------------------------------------------------------------------------- /docs/squid-cli/commands-json.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 20 3 | title: commands.json 4 | description: Dynamic sqd commands 5 | --- 6 | 7 | # commands.json 8 | 9 | The `sqd` tool automatically discovers and loads any extra commands defined in the `commands.json` file. Here is a sample file demonstrating the available features: 10 | 11 | ```json 12 | { // comments are ok 13 | "$schema": "https://subsquid.io/schemas/commands.json", 14 | "commands": { 15 | "clean": { 16 | "description": "delete all build artifacts", 17 | "cmd": ["rm", "-rf", "lib"] 18 | }, 19 | "build": { 20 | "description": "build the project", 21 | "deps": ["clean"], // commands to execute before 22 | "cmd": ["tsc"] 23 | }, 24 | "typegen": { 25 | "hidden": true, // Don't show in the overview listing 26 | "workdir": "abi", // change working dir 27 | "command": [ 28 | "squid-evm-typegen", // node_modules/.bin is in the PATH 29 | "../src/abi", 30 | {"glob": "*.json"} // cross-platform glob expansion 31 | ], 32 | "env": { // additional environment variables 33 | "DEBUG": "*" 34 | } 35 | } 36 | } 37 | } 38 | ``` 39 | This functionality is managed by the [`@subsquid/commands`](https://github.com/subsquid/squid-sdk/tree/master/util/commands) package. 40 | 41 | All [squid templates](/sdk/how-to-start/squid-development/#templates) include such a file with a predefined set of useful shortcuts. See [Cheatsheet](/sdk/how-to-start/cli-cheatsheet). 42 | -------------------------------------------------------------------------------- /docs/squid-cli/explorer.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_class_name: hidden 3 | --- 4 | 5 | `sqd explorer` 6 | ========== 7 | 8 | :::danger 9 | `sqd explorer` is disabled in `@subsquid/cli>=3.0.0`. If you've been using it, please let us know in the [SquidDevs Telegram channel](https://t.me/HydraDevs). 10 | ::: 11 | 12 | Visual explorer of deployed squids 13 | 14 | Left pane: List of deployed squids. 15 | Right pane: details of the selected squid. Navigate by pressing the corresponding number (e.g. `1` for Summary). 16 | 17 | 1) Summary: endpoint URL, sync status, DB storage utilization 18 | 19 | 2) Logs 20 | 21 | 3) DB access details 22 | 23 | This command requires specifying an [organization](/cloud/resources/organizations) with the `-o/--org` flag when invoked by accounts with more than one organization. SQD Cloud users with just one organization can omit this flag. 24 | 25 | ![Squid SDK]() 26 | 27 | _See code: [src/commands/explorer.ts](https://github.com/subsquid/squid-cli/tree/master/src/commands/explorer.ts)_ 28 | -------------------------------------------------------------------------------- /docs/squid-cli/gateways.md: -------------------------------------------------------------------------------- 1 | `sqd gateways` 2 | ============== 3 | 4 | Explore data sources for a squid 5 | 6 | * [`sqd gateways list`](#sqd-gateways-list) 7 | 8 | ## `sqd gateways list` 9 | 10 | List available gateways 11 | 12 | ``` 13 | USAGE 14 | $ sqd gateways list [--interactive] [-t ] [-n ] [-c ] 15 | 16 | FLAGS 17 | -c, --chain= Filter by chain ID or SS58 prefix 18 | -n, --name= Filter by network name 19 | -t, --type= Filter by network type 20 | --[no-]interactive Disable interactive mode 21 | 22 | ALIASES 23 | $ sqd gateways ls 24 | ``` 25 | 26 | _See code: [src/commands/gateways/ls.ts](https://github.com/subsquid/squid-cli/blob/master/src/commands/gateways/ls.ts)_ 27 | -------------------------------------------------------------------------------- /docs/squid-cli/init.md: -------------------------------------------------------------------------------- 1 | `sqd init` 2 | ========== 3 | 4 | Setup a new squid project from a template or github repo 5 | 6 | * [`sqd init NAME`](#sqd-init-name) 7 | 8 | ## `sqd init NAME` 9 | 10 | Setup a new squid project from a template or github repo 11 | 12 | ``` 13 | USAGE 14 | $ sqd init NAME [--interactive] [-t ] [-d ] [-r] 15 | 16 | ARGUMENTS 17 | NAME The squid name. It must contain only alphanumeric or dash ("-") symbols and must not start with "-". 18 | 19 | FLAGS 20 | -d, --dir= 21 | The target location for the squid. If omitted, a new folder NAME is created. 22 | 23 | -r, --remove 24 | Clean up the target directory if it exists 25 | 26 | -t, --template= 27 | A template for the squid. Accepts: 28 | - a github repository URL containing a valid squid.yaml manifest in the root folder 29 | or one of the pre-defined aliases: 30 | - evm A minimal squid template for indexing EVM data. 31 | - abi A template to auto-generate a squid indexing events and txs from a contract ABI 32 | - multichain A template for indexing data from multiple chains 33 | - gravatar A sample EVM squid indexing the Gravatar smart contract on Ethereum. 34 | - substrate A template squid for indexing Substrate-based chains. 35 | - ink A template for indexing Ink! smart contracts 36 | - ink-abi A template to auto-generate a squid from an ink! contract ABI 37 | - frontier-evm A template for indexing Frontier EVM chains, like Moonbeam and Astar. 38 | 39 | --[no-]interactive 40 | Disable interactive mode 41 | ``` 42 | 43 | _See code: [src/commands/init.ts](https://github.com/subsquid/squid-cli/tree/master/src/commands/init.ts)_ 44 | -------------------------------------------------------------------------------- /docs/squid-cli/installation-deployment-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subsquid/docs/1999674a68d884c047a4857816f6d2f47a444d18/docs/squid-cli/installation-deployment-key.png -------------------------------------------------------------------------------- /docs/squid-cli/installation.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 10 3 | description: Setup Squid CLI 4 | --- 5 | 6 | # Installation 7 | 8 | Squid CLI is a command line tool for 9 | 10 | - scaffolding new squids from templates 11 | - running SDK tools and scripts defined in `commands.json` in a cross-platform way 12 | - managing squid deployments in [SQD Cloud](/cloud) (former Aquarium) 13 | 14 | The CLI is distributed as a [`npm` package](https://www.npmjs.com/package/@subsquid/cli). 15 | 16 | To install Squid CLI, follow the steps below. 17 | 18 | ## 0. Install and setup Squid CLI 19 | 20 | First, install the latest version of Squid CLI as a global `npm` package: 21 | ```bash 22 | npm i -g @subsquid/cli@latest 23 | ``` 24 | 25 | Check the version: 26 | ```bash 27 | sqd --version 28 | ``` 29 | Make sure the output looks like `@subsquid/cli@`. 30 | 31 | :::info 32 | The next steps are **optional** for building and running squids. A key is required to enable the CLI commands managing the [SQD Cloud](/cloud) deployments. 33 | ::: 34 | 35 | ## 1. Obtain a SQD Cloud deployment key 36 | 37 | Sign in to [Cloud](https://app.subsquid.io/), and obtain (or refresh) the deployment key page by clicking at the profile picture > "Deployment key": 38 | 39 | ![Cloud deployment key page](./installation-deployment-key.png) 40 | 41 | ## 2. Authenticate Squid CLI 42 | 43 | Open a terminal window and run 44 | 45 | ```bash 46 | sqd auth -k 47 | ``` 48 | 49 | ## 3. Explore with `--help` 50 | 51 | Use `sqd --help` to get a list of the available command and `sqd --help` to get help on the available options for a specific command, e.g. 52 | 53 | ```bash 54 | sqd deploy --help 55 | ``` 56 | -------------------------------------------------------------------------------- /docs/squid-cli/list.md: -------------------------------------------------------------------------------- 1 | `sqd list` 2 | ======== 3 | 4 | List squids deployed to the Cloud 5 | 6 | * [`sqd list`](#sqd-list-1) 7 | 8 | ## `sqd list` 9 | 10 | List squids deployed to the Cloud 11 | 12 | ``` 13 | USAGE 14 | $ sqd list [--interactive] [--truncate] 15 | [-r [/](@|:) | -o | -n | [-s ] | [-t ]] 16 | 17 | FLAGS 18 | --[no-]interactive Disable interactive mode 19 | --[no-]truncate Truncate data in columns: false by default 20 | 21 | SQUID FLAGS 22 | -n, --name= Name of the squid 23 | -r, --reference=[/](@|:) Fully qualified reference 24 | of the squid. It can include 25 | the organization, name, slot, 26 | or tag 27 | -s, --slot= Slot of the squid 28 | -t, --tag= Tag of the squid 29 | 30 | ORG FLAGS 31 | -o, --org= Code of the organization 32 | 33 | ALIASES 34 | $ sqd ls 35 | ``` 36 | 37 | _See code: [src/commands/ls.ts](https://github.com/subsquid/squid-cli/tree/master/src/commands/ls.ts)_ 38 | -------------------------------------------------------------------------------- /docs/squid-cli/logs.md: -------------------------------------------------------------------------------- 1 | `sqd logs` 2 | ========== 3 | 4 | Fetch logs from a squid deployed to the Cloud 5 | 6 | * [`sqd logs`](#sqd-logs-1) 7 | 8 | ## `sqd logs` 9 | 10 | Fetch logs from a squid deployed to the Cloud 11 | 12 | ``` 13 | USAGE 14 | $ sqd logs [--interactive] [--since ] [--search ] [-f | -p ] 15 | [-r [/](@|:) | -o | [-s -n ] | [-t ]] 16 | [-c processor|query-node|api|db-migrate|db...] 17 | [-l error|debug|info|warning...] [--since ] 18 | 19 | FLAGS 20 | -c, --container=