### Install graph-cli on Fedora Source: https://github.com/graphprotocol/graph-tooling/wiki/Installation-on-different-operating-systems Installs build tools, Node.js, Yarn, and the graph-cli globally. Ensure you have `gcc-c++`, `make`, `libsecret-devel`, and `git` installed. ```bash dnf install -y gcc-c++ make libsecret-devel git curl --silent --location https://rpm.nodesource.com/setup_11.x | bash - curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo \ | tee /etc/yum.repos.d/yarn.repo dnf install -y yarn yarn global add @graphprotocol/graph-cli ``` -------------------------------- ### Install Dependencies and Build Subgraph Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/substreams-powered-subgraph/README.md Installs project dependencies, prepares the Substreams module, builds the subgraph, and deploys it. ```bash yarn install # install graph-cli yarn substreams:prepare # build and package the substreams module yarn subgraph:build # build the subgraph yarn deploy # deploy the subgraph ``` -------------------------------- ### Install The Graph CLI with NPM, Yarn, or PNPM Source: https://github.com/graphprotocol/graph-tooling/blob/main/packages/cli/README.md Install the CLI using your preferred package manager when developing subgraphs locally. Ensure Node.js is installed. ```sh # NPM npm install @graphprotocol/graph-cli # Yarn yarn add @graphprotocol/graph-cli # pnpm pnpm install @graphprotocol/graph-cli ``` -------------------------------- ### Install The Graph CLI Globally with a Binary Source: https://github.com/graphprotocol/graph-tooling/blob/main/packages/cli/README.md Install the CLI globally using a shell script. This method does not require Node.js or other external dependencies. ```sh curl -LS https://cli.thegraph.com/install.sh | sudo sh ``` -------------------------------- ### Install libsecret on Debian/Ubuntu Source: https://github.com/graphprotocol/graph-tooling/blob/main/packages/cli/README.md Install the libsecret library on Debian/Ubuntu systems. This is required for storing access tokens in the system's keychain. ```sh sudo apt-get install libsecret-1-dev ``` -------------------------------- ### Install libsecret on Arch Linux Source: https://github.com/graphprotocol/graph-tooling/blob/main/packages/cli/README.md Install the libsecret library on Arch Linux systems. This is required for storing access tokens in the system's keychain. ```sh sudo pacman -S libsecret ``` -------------------------------- ### Install libsecret on Red Hat Source: https://github.com/graphprotocol/graph-tooling/blob/main/packages/cli/README.md Install the libsecret library on Red Hat systems. This is required for storing access tokens in the system's keychain. ```sh sudo yum install libsecret-devel ``` -------------------------------- ### Install graph-ts with NPM or Yarn Source: https://github.com/graphprotocol/graph-tooling/blob/main/packages/ts/README.md Add the graph-ts library as a development dependency to your project using either NPM or Yarn. ```sh npm install --dev @graphprotocol/graph-ts # NPM ``` ```sh yarn add --dev @graphprotocol/graph-ts # Yarn ``` -------------------------------- ### Generate Cosmoshub Manifest Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/cosmos-validator-rewards/README.md Run this command to generate a subgraph manifest file for the Cosmoshub network. Ensure you have the necessary dependencies installed. ```shell $ yarn prepare:cosmoshub ``` -------------------------------- ### Subgraph Mapping Example with graph-ts Source: https://github.com/graphprotocol/graph-tooling/blob/main/packages/ts/README.md Example of a subgraph mapping function using graph-ts APIs to handle an event, process data, and store entities. Requires generated types for events and entities. ```typescript import { crypto, store } from '@graphprotocol/graph-ts' // This is just an example event type generated by `graph-cli` // from an Ethereum smart contract ABI import { NameRegistered } from './types/abis/SomeContract' // This is an example of an entity type generated from a // subgraph's GraphQL schema import { Domain } from './types/schema' function handleNameRegistered(event: NameRegistered) { // Example use of a crypto function let id = crypto.keccak256(name).toHexString() // Example use of the generated `Entry` class let domain = new Domain() domain.name = name domain.owner = event.params.owner domain.timeRegistered = event.block.timestamp // Example use of the store API store.set('Name', id, entity) } ``` -------------------------------- ### Query Variables for Validator Rewards Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/cosmos-validator-rewards/README.md JSON object containing the variables required for the ValidatorRewards GraphQL query. Replace the example address with the desired validator's address. ```json { "validatorAddress": "cosmosvaloper1hjct6q7npsspsg3dgvzk3sdf89spmlpfdn6m9d" } ``` -------------------------------- ### Query Blocks Between Dates Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/cosmos-block-filtering/README.md Use this GraphQL query to retrieve all blocks with timestamps falling between a specified start and end date. Ensure you provide valid BigInt values for timestamps. ```graphql query BlocksBetweenDates($timestamp_start: BigInt!, $timestamp_end: BigInt!) { blocks(where: {timestamp_gt: $timestamp_start, timestamp_lt: $timestamp_end}) { id, number, timestamp } } ``` ```json { "timestamp_start": 1613653200, "timestamp_end": 1613656800 } ``` -------------------------------- ### Generate Subgraph Manifest for Cosmos Hub Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/cosmos-block-filtering/README.md Run this command to generate a subgraph manifest file for the Cosmos Hub network before building the subgraph. ```shell yarn prepare:cosmoshub ``` -------------------------------- ### Run integration tests with graph test Source: https://github.com/graphprotocol/graph-tooling/blob/main/NEWS.md Use the `graph test` command to run test commands against a customizable test environment. Options allow specifying custom Docker Compose files, Graph Node images, or standalone nodes. ```bash graph test [options] Options: -h, --help Show usage information --compose-file Custom Docker Compose file for additional services (optional) --node-image Custom Graph Node image to test against (default: graphprotocol/graph-node:latest) --standalone-node Use a standalone Graph Node outside Docker Compose (optional) --standalone-node-args Custom arguments to be passed to the standalone Graph Node (optional) --skip-wait-for-ipfs Don't wait for IPFS to be up at localhost:5001 (optional) --skip-wait-for-ethereum Don't wait for Ethereum to be up at localhost:8545 (optional) --skip-wait-for-postgres Don't wait for Postgres to be up at localhost:5432 (optional) --node-logs Print the Graph Node logs (optional) ``` -------------------------------- ### Update graph-cli Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/arweave-blocks-transactions/README.md Run this command to update to the latest version of the graph-cli, which is required for building Arweave subgraphs. ```bash npm-update -g i @graphprotocol/graph-cli ``` -------------------------------- ### Query Token Swaps by Sender Address Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/cosmos-osmosis-token-swaps/README.md Use this GraphQL query to retrieve all token swaps made by a specific sender address. Ensure the sender address is provided as a variable. ```graphql query SwapsForAccount($senderAddress: String!) { tokenSwaps(where: {sender: $senderAddress}) { tokenIn { amount denom }, tokenOut { amount denom } } } ``` -------------------------------- ### GraphQL Query for Validator Delegations Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/cosmos-validator-delegations/README.md Use this GraphQL query to retrieve all delegations made to a specific validator, including their addresses and amounts. ```graphql query ValidatorDelegations($validatorAddress: String!) { delegations(where: {validatorAddress: $validatorAddress}) { validatorAddress, delegatorAddress, amount { amount, denom } } } ``` -------------------------------- ### GraphQL Query Variables for Sender Address Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/cosmos-osmosis-token-swaps/README.md Provide the sender address as a JSON variable when executing the GraphQL query to fetch token swaps. ```json { "senderAddress": "osmo1wd3j7cvcnr3pfey4fx2mz9xml9euu68z6zg0xp" } ``` -------------------------------- ### Query Blocks Between Dates Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/arweave-blocks-transactions/README.md Use this GraphQL query to retrieve all blocks within a specified date range. Ensure you provide valid BigInt values for timestamp_start and timestamp_end. ```graphql query BlocksBetweenDates($timestamp_start: BigInt!, $timestamp_end: BigInt!) { blocks(where: { timestamp_gt: $timestamp_start, timestamp_lt: $timestamp_end }) { id timestamp height } } ``` -------------------------------- ### Query Validator Rewards Source: https://github.com/graphprotocol/graph-tooling/blob/main/examples/cosmos-validator-rewards/README.md GraphQL query to retrieve all rewards for a specific validator address. The `validatorAddress` variable must be provided in the query variables. ```graphql query ValidatorRewards($validatorAddress: String!) { rewards(where: {validator: $validatorAddress}) { validator, amount } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.