diff --git a/website/src/pages/ar/about.mdx b/website/src/pages/ar/about.mdx index 93dbeb51f658..7fda868aab9d 100644 --- a/website/src/pages/ar/about.mdx +++ b/website/src/pages/ar/about.mdx @@ -1,67 +1,46 @@ --- -title: حول The Graph +title: About The Graph +description: This page summarizes the core concepts and basics of The Graph Network. --- ## What is The Graph? -The Graph is a powerful decentralized protocol that enables seamless querying and indexing of blockchain data. It simplifies the complex process of querying blockchain data, making dapp development faster and easier. +The Graph is a decentralized protocol for indexing and querying blockchain data across [90+ networks](/supported-networks/). -## Understanding the Basics +Its data services include: -Projects with complex smart contracts such as [Uniswap](https://uniswap.org/) and NFTs initiatives like [Bored Ape Yacht Club](https://boredapeyachtclub.com/) store data on the Ethereum blockchain, making it very difficult to read anything other than basic data directly from the blockchain. +- [Subgraphs](/subgraphs/developing/subgraphs/): Open APIs to query blockchain data that can be created or queried by anyone. +- [Substreams](/substreams/introduction/): High-performance data streams for real-time blockchain processing, built with modular components. +- [Token API Beta](/token-api/quick-start/): Instant access to standardized token data requiring zero setup. -### Challenges Without The Graph +### Why Blockchain Data is Difficult to Query -In the case of the example listed above, Bored Ape Yacht Club, you can perform basic read operations on [the contract](https://etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d#code). You can read the owner of a certain Ape, read the content URI of an Ape based on their ID, or read the total supply. +Reading data from blockchains requires processing smart contract events, parsing metadata from IPFS, and manually aggregating data. -- This can be done because these read operations are programmed directly into the smart contract itself. However, more advanced, specific, and real-world queries and operations like aggregation, search, relationships, and non-trivial filtering, **are not possible**. +The result is slow performance, complex infrastructure, and scalability issues. -- For instance, if you want to inquire about Apes owned by a specific address and refine your search based on a particular characteristic, you would not be able to obtain that information by directly interacting with the contract itself. +## How The Graph Solves This -- To get more data, you would have to process every single [`transfer`](https://etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d#code#L1746) event ever emitted, read the metadata from IPFS using the Token ID and IPFS hash, and then aggregate it. +The Graph uses a combination of cutting-edge research, core dev expertise, and independent Indexers to make blockchain data accessible for developers. -### Why is this a problem? +Find the perfect data service for you: -It would take **hours or even days** for a decentralized application (dapp) running in a browser to get an answer to these simple questions. +### 1. Custom Real-Time Data Streams -Alternatively, you have the option to set up your own server, process the transactions, store them in a database, and create an API endpoint to query the data. However, this option is [resource intensive](/resources/benefits/), needs maintenance, presents a single point of failure, and breaks important security properties required for decentralization. +**Use Case:** High-frequency trading, live analytics. -Blockchain properties, such as finality, chain reorganizations, and uncled blocks, add complexity to the process, making it time-consuming and conceptually challenging to retrieve accurate query results from blockchain data. +- [Build Substreams](/substreams/introduction/) +- [Browse Community Substreams](https://substreams.dev/) -## The Graph Provides a Solution +### 2. Instant Token Data -The Graph solves this challenge with a decentralized protocol that indexes and enables the efficient and high-performance querying of blockchain data. These APIs (indexed "Subgraphs") can then be queried with a standard GraphQL API. +**Use Case:** Wallet balances, liquidity pools, transfer events. -Today, there is a decentralized protocol that is backed by the open source implementation of [Graph Node](https://github.com/graphprotocol/graph-node) that enables this process. +- [Start with Token API](/token-api/quick-start/) -### How The Graph Functions +### 3. Flexible Historical Queries -Indexing blockchain data is very difficult, but The Graph makes it easy. The Graph learns how to index Ethereum data by using Subgraphs. Subgraphs are custom APIs built on blockchain data that extract data from a blockchain, processes it, and stores it so that it can be seamlessly queried via GraphQL. +**Use Case:** Dapp frontends, custom analytics. -#### Specifics - -- The Graph uses Subgraph descriptions, which are known as the Subgraph manifest inside the Subgraph. - -- The Subgraph description outlines the smart contracts of interest for a Subgraph, the events within those contracts to focus on, and how to map event data to the data that The Graph will store in its database. - -- When creating a Subgraph, you need to write a Subgraph manifest. - -- After writing the `subgraph manifest`, you can use the Graph CLI to store the definition in IPFS and instruct an Indexer to start indexing data for that Subgraph. - -The diagram below provides more detailed information about the flow of data after a Subgraph manifest has been deployed with Ethereum transactions. - -![A graphic explaining how The Graph uses Graph Node to serve queries to data consumers](/img/graph-dataflow.png) - -تدفق البيانات يتبع الخطوات التالية: - -1. A dapp adds data to Ethereum through a transaction on a smart contract. -2. العقد الذكي يصدر حدثا واحدا أو أكثر أثناء معالجة الإجراء. -3. Graph Node continually scans Ethereum for new blocks and the data for your Subgraph they may contain. -4. Graph Node finds Ethereum events for your Subgraph in these blocks and runs the mapping handlers you provided. The mapping is a WASM module that creates or updates the data entities that Graph Node stores in response to Ethereum events. -5. The dapp queries the Graph Node for data indexed from the blockchain, using the node's [GraphQL endpoint](https://graphql.org/learn/). The Graph Node in turn translates the GraphQL queries into queries for its underlying data store in order to fetch this data, making use of the store's indexing capabilities. The dapp displays this data in a rich UI for end-users, which they use to issue new transactions on Ethereum. The cycle repeats. - -## الخطوات التالية - -The following sections provide a more in-depth look at Subgraphs, their deployment and data querying. - -Before you write your own Subgraph, it's recommended to explore [Graph Explorer](https://thegraph.com/explorer) and review some of the already deployed Subgraphs. Each Subgraph's page includes a GraphQL playground, allowing you to query its data. +- [Explore Subgraphs](https://thegraph.com/explorer) +- [Build Your Subgraph](/subgraphs/quick-start) diff --git a/website/src/pages/ar/ai-suite/_meta-titles.json b/website/src/pages/ar/ai-suite/_meta-titles.json new file mode 100644 index 000000000000..5eb482a7092b --- /dev/null +++ b/website/src/pages/ar/ai-suite/_meta-titles.json @@ -0,0 +1,6 @@ +{ + "graph-assistant": "Graph Assistant", + "ai-introduction": "The Graph's AI", + "subgraph-mcp": "Subgraph MCP", + "token-api-mcp": "Token API MCP" +} diff --git a/website/src/pages/ar/ai-suite/ai-introduction.mdx b/website/src/pages/ar/ai-suite/ai-introduction.mdx new file mode 100644 index 000000000000..d25cc9f77358 --- /dev/null +++ b/website/src/pages/ar/ai-suite/ai-introduction.mdx @@ -0,0 +1,58 @@ +--- +title: The Graph's AI +--- + +Build with speed and scale faster with The Graph's AI. + +## Using AI on The Graph + +Instead of relying on static datasets or centralized APIs, you can now access live blockchain data through our **agentic** app, [Graph Assistant](/ai-suite/graph-assistant/introduction/), and use our AI-native tooling, [Subgraph MCP](/ai-suite/subgraph-mcp/introduction/), and [Token API MCP](/ai-suite/token-api-mcp/introduction/). + +### Why Use Onchain Data with AI? + +Using onchain data with AI unlocks powerful new ways to interact with and understand blockchain ecosystems. + +- **AI for Non-Technical End Users**: AI can turn complex onchain data into accessible insights. Assistants powered by AI enable you to explore and analyze blockchain data without coding. +- **AI for Developers**: You can use AI to interact directly with The Graph's data through your agents or build AI-powered applications on top of it. This streamlines development and opens up more intuitive, dynamic use cases. + +## AI for Non-Technical/End Users + +[Graph Assistant](/ai-suite/graph-assistant/introduction/) is a powerful **agentic** application that empowers users to easily interact with blockchain data. Ask questions in simple, natural language and get rich, AI powered insights. Both technical developers and non-technical product teams can move faster, make smarter decisions, and gain a clearer understanding than ever before. + +### Benefits of Using Graph Assistant + +- **Natural language Input**: You don't need to write complex queries or sift through dashboards. Simply ask your question in plain English and get clear, structured results. +- **Multi-source support**: Works across multiple Subgraphs and Token API. The Assistant automatically determines which data source to use, so you don't have to switch tools or manage endpoints. +- **Schema-free access**: You don't need to understand the schema. You can refer to tokens, protocols, dates, or addresses using natural language. The Assistant takes care of the rest. + +### Conversational Querying with Graph Assistant + +**Example queries:** + +- "List the top-5 swaps by USD value in the last 24 hours." +- "Give me the daily volume on Uniswap." +- "List the 20 most recently registered .eth names." + +[Graph Assistant](/ai-suite/graph-assistant/introduction/) will eventually be a one-stop shop for interacting with The Graph. Right now, it's an agentic AI app that uses state-of-the-art AI techniques, LLMs, and MCPs to understand and answer your questions about [Subgraphs](/subgraphs/developing/subgraphs/) and [Token API](/token-api/quick-start/) data. + +## AI for Developers + +### Enable Natural Language Access to Onchain Data + +[Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) servers connect to Claude, Cline, and Cursor. They enable models to understand, query, and interact with structured onchain data using natural language. MCPs remove the need to write low-level queries or interact with APIs directly. + +### Subgraph MCP + +The [Subgraph MCP](/ai-suite/subgraph-mcp/introduction/) server connects models to Subgraphs on The Graph Network. It allows language models to explore Subgraph schemas, execute GraphQL queries, find relevant Subgraphs by keyword or contract, and surface usage metrics using natural language. + +### Token API MCP + +The [Token API MCP](/ai-suite/token-api-mcp/introduction/) MCP server enables models to access onchain token data. It supports querying token metadata, wallet balances, transfer history, and top token holders through simple prompts. + +#### Benefits of Using Subgraph and Token API MCPs + +- Query Subgraphs and token data using natural language +- Access GraphQL schemas and token metadata without manual queries +- Find Subgraphs by keyword or contract and check 30-day usage +- Retrieve real-time data from The Graph and onchain token sources +- Get wallet balances, transfer history, and top token holders diff --git a/website/src/pages/ar/ai-suite/graph-assistant/faq.mdx b/website/src/pages/ar/ai-suite/graph-assistant/faq.mdx new file mode 100644 index 000000000000..9dead67acc55 --- /dev/null +++ b/website/src/pages/ar/ai-suite/graph-assistant/faq.mdx @@ -0,0 +1,26 @@ +--- +title: Graph Assistant FAQ +sidebarTitle: FAQ +--- + +This page summarizes some of the most common questions for developers using Graph Assistant. + +1. What is The Graph Assistant? + +The Graph Assistant is an AI-powered chat interface that lets you query blockchain data in plain English. Under the hood, it translates your questions into GraphQL calls against Subgraphs and the Token API, then returns results, no coding required. + +2. What is an agentic application? + +An agentic application combines AI-driven reasoning with external data sources or APIs to take autonomous actions on your behalf. In this case, Graph Assistant acts as an “agent” that interprets your natural-language prompts, builds and dispatches GraphQL queries, and formats the results so that you don't need to write or manage queries yourself. + +3. Which networks and data does Graph Assistant support? + +The Assistant has access to Subgraphs across multiple chains. If a Subgraph is published to The Graph Network and is being indexed, the Assistant can automatically route queries to it. The Assistant also has access to the Token API on Ethereum Mainnet, BSC, Unichain, Arbitrum-One, Optimism, and Polygon. + +4. Is there a usage limit or quota? + +Yes, 10 questions per hour. + +5. What if the Assistant can't interpret my question? + +When the Assistant fails to parse your intent (for example, ambiguous token name, missing context, or an unsupported request), it will prompt you for clarification. For instance, it might ask, “Did you mean XYZ on Ethereum or XYZ on Arbitrum?” or “Please specify a date range for this query.” If you continue to see parsing errors, check that you're using correct token symbols or specifying networks and time frames clearly. diff --git a/website/src/pages/ar/ai-suite/graph-assistant/how-to-guide.mdx b/website/src/pages/ar/ai-suite/graph-assistant/how-to-guide.mdx new file mode 100644 index 000000000000..84bcab5cdac0 --- /dev/null +++ b/website/src/pages/ar/ai-suite/graph-assistant/how-to-guide.mdx @@ -0,0 +1,56 @@ +--- +title: How To Use The Graph Assistant +sidebarTitle: How-to Guide +--- + +## نظره عامة + +You type a natural language question into the chat interface, such as: + +```yaml +'On Uniswap, return the top-10 pools by total value locked in USD.' +``` + +> [!IMPORTANT] All users can process 10 free queries per user per hour. +> +> [!NOTE] Disclaimer: By using Graph Assistant, you acknowledge that your requests may be logged and used to improve the performance of the underlying agents. Do not share sensitive, personal, or private information. + +### Behind the Scenes + +The Assistant: + +1. Interprets your intent +2. Maps it to the correct Subgraphs or Token API endpoint +3. Executes optimized queries +4. Returns clean, structured results + +You don't need to write queries or understand a Subgraph's schema, you simply ask. + +### Example Use Cases + +**Protocol Analytics** + +- “Compare daily active users on Aave vs. Compound in May 2025.” +- “Show me the total value locked (TVL) for XYZDAO over the last quarter.” + +**Token Insights** + +- “What are the top 10 tokens by market cap on Ethereum right now?” +- “How many XYZ did I receive between May 1 and May 15?” + +**Historical Data Retrieval** + +- “Fetch the token price history of XYZ for the last six months.” +- “What was the average gas price on Ethereum during April?” + +**Portfolio Monitoring** + +- “List my wallet’s current token balances and their USD equivalents.” +- “Calculate profit/loss on XYZ since xyz date.” + +**Cross-Chain Comparison** + +- “Show me the 7-day trading volume of XYZ on Ethereum vs. Polygon.” +- “How many XYZ swaps occurred on Arbitrum yesterday?” + +To get started follow the [quickstart](/ai-suite/graph-assistant/quick-start/) and explore its capabilities. diff --git a/website/src/pages/ar/ai-suite/graph-assistant/introduction.mdx b/website/src/pages/ar/ai-suite/graph-assistant/introduction.mdx new file mode 100644 index 000000000000..f63cf0ac1f56 --- /dev/null +++ b/website/src/pages/ar/ai-suite/graph-assistant/introduction.mdx @@ -0,0 +1,31 @@ +--- +title: مقدمة +--- + +> [!IMPORTANT] Graph Assistant is still in **beta**. Expect breaking changes, rate limits, and potential downtime. + +[Graph Assistant](https://thegraph.com/graph-assistant) (Beta) gives instant, code-free access to blockchain data, transforming natural language into precise, AI-powered queries without the need to code. + +## نظره عامة + +[Graph Assistant](https://thegraph.com/graph-assistant) is an advanced, [agentic](/en/ai-suite/graph-assistant/faq/) easy-to-use chat interface for querying blockchain data using natural language. Unlike a basic chatbot, Graph Assistant can understand your intent, build complex queries, and execute them automatically. This gives you rich, AI-powered insights from onchain data without writing any code. + +- **Automatically** interprets user intent, generates precise queries, executes them via The Graph's Subgraphs and Token API, and presents structured, AI-powered answers without requiring any code. +- **Removes** the technical complexity found in traditional dashboards or chatbots. It provides composable insights directly from indexed Subgraphs and Token datasets. + +## Core Features + +| Feature | الوصف | +| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| **Friendly Interface** | Conversational access to blockchain data via natural language. You simply ask questions, the Assistant fetches the answer, and renders results. | +| **Backed by Subgraphs** | Uses subgraphs to index protocol-specific data like transactions, events, and protocol metrics. | +| **Backed by Token API** | Uses Token API for token-level information like balances, transfers, and metadata. | +| **No Setup Required** | No need to configure data sources or write queries. | +| **Automatic Query Building** | The Assistant performs complex queries such as fetching historical token volumes, protocol analytics, or cross-chain data and handles filtering, pagination, and joins across Subgraphs automatically. | + +## Help Shape What's Next + +This is in **beta**, and community input is essential. If you have ideas, questions, or run into anything unexpected, we'd love to hear from you: + +- Join the community on [Discord](https://discord.com/invite/graphprotocol): Provide feedback and stay in the loop with other builders. You'll be able to join the `#graph-assistant` channel to share your experience directly. +- Interested in going deeper? Reach out to become a dedicated beta tester so your specific use case can be better supported. diff --git a/website/src/pages/ar/ai-suite/graph-assistant/quick-start.mdx b/website/src/pages/ar/ai-suite/graph-assistant/quick-start.mdx new file mode 100644 index 000000000000..dd6260992692 --- /dev/null +++ b/website/src/pages/ar/ai-suite/graph-assistant/quick-start.mdx @@ -0,0 +1,44 @@ +--- +title: بداية سريعة +--- + +> [!IMPORTANT] Graph Assistant is still in **beta**. Expect breaking changes, rate limits, and potential downtime. + +This guide provides step-by-step instructions for getting started with Graph Assistant quickly. + +## Step-by Step + +### Step 1. Create an Account + +Go to: [Graph Assistant](https://thegraph.com/graph-assistant) + +- Click Sign Up (or Log In if you already have an account). +- Use your Google, GitHub, X, email or wallet credentials to log in. +- No additional setup is required. + +### Step 2. Open the Assistant Chat + +After logging in: + +- You'll see Graph Assistant's interface. +- At the bottom of the page, you will find a chat input bar. This is where you will interact with the Assistant. + +### Step 3: Ask Your First Question + +> [!IMPORTANT] All users can process 10 free queries per user per hour. + +In the input bar, type a natural-language query (everyday language). + +Example: + +```yaml +Show me the 24-hour trading volume of XYZ token on Ethereum +``` + +> [!NOTE] Disclaimer: By using Graph Assistant, you acknowledge that your requests may be logged and used to improve the performance of the AI interface. Do not share sensitive, personal, or private information. + +The Assistant will: + +- Digest your question +- Fetch onchain data using Subgraphs or the Token API +- Return a clean, formatted response with the data you need diff --git a/website/src/pages/ar/ai-suite/subgraph-mcp/claude.mdx b/website/src/pages/ar/ai-suite/subgraph-mcp/claude.mdx new file mode 100644 index 000000000000..d92ef86ad7e4 --- /dev/null +++ b/website/src/pages/ar/ai-suite/subgraph-mcp/claude.mdx @@ -0,0 +1,170 @@ +--- +title: Claude Desktop +--- + +This guide walks you through the integration of Subgraph [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) to access Subgraph data via natural language conversations with Claude. + +## Prerequisites + +- [Node.js](https://nodejs.org/en) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed (latest version) +- A Gateway API key from [Subgraph Studio](https://thegraph.com/studio/) + +## Installation Options + +### Option 1: Using npx (Recommended) + +#### Configuration Steps using npx + +#### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Settings** > **Developer** > **Edit Config** + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +#### 2. Add Configuration + +Paste the following settings into your config file: + +```json +{ + "mcpServers": { + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +#### 3. Add Your Gateway API Key + +Replace `GATEWAY_API_KEY` with your API key from [Subgraph Studio](https://thegraph.com/studio/). + +#### 4. Save and Restart + +Once you've entered your Gateway API key into your settings, save the file and restart Claude Desktop. + +### Option 2: Building from Source + +#### Requirements + +- Rust (latest stable version recommended: 1.75+) + ```bash + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + ``` + Follow the on-screen instructions. For other platforms, see the [official Rust installation guide](https://www.rust-lang.org/tools/install). + +#### Installation Steps + +1. **Clone and Build the Repository** + + ```bash + git clone git@github.com:graphops/subgraph-mcp.git + cd subgraph-mcp + cargo build --release + ``` + +2. **Find the Command Path** + + After building, the executable will be located at `target/release/subgraph-mcp` inside your project directory. + + - Navigate to your `subgraph-mcp` directory in terminal + - Run `pwd` to get the full path + - Combine the output with `/target/release/subgraph-mcp` + +3. **Configure Claude Desktop** + + Open your `claude_desktop_config.json` file as described above and add: + + ```json + { + "mcpServers": { + "subgraph": { + "command": "/path/to/your/subgraph-mcp/target/release/subgraph-mcp", + "env": { + "GATEWAY_API_KEY": "your-api-key-here" + } + } + } + } + ``` + + Replace `/path/to/your/subgraph-mcp/target/release/subgraph-mcp` with the actual path to the compiled binary. + +## Using The Graph Resource in Claude + +After configuring Claude Desktop: + +1. Restart Claude Desktop +2. Start a new conversation +3. Click on the context menu (top right) +4. Add "Subgraph Server Instructions" as a resource by adding `graphql://subgraph` to your chat context + +> **Important**: Claude Desktop may not automatically utilize the Subgraph MCP. You must manually add "Subgraph Server Instructions" resource to your chat context for each conversation where you want to use it. + +## Troubleshooting + +To enable logs for the MCP when using the npx option, add the `--verbose true` option to your args array. + +## Available Subgraph Tools and Usage + +The Subgraph MCP provides several tools for interacting with Subgraphs: + +### Schema Retrieval Tools + +- **Get schema by deployment ID**: Access the GraphQL schema using a deployment ID (0x...) +- **Get schema by Subgraph ID**: Access the schema for the current deployment of a Subgraph (5zvR82...) +- **Get schema by IPFS hash**: Access the schema using a Subgraph's IPFS manifest hash (Qm...) + +### Query Execution Tools + +- **Execute query by deployment ID/IPFS hash**: Run GraphQL queries against specific, immutable deployments +- **Execute query by Subgraph ID**: Run GraphQL queries against the latest version of a Subgraph + +### Discovery Tools + +- **Search subgraphs by keyword**: Find subgraphs by keyword in their display names, ordered by signal +- **Get deployment 30-day query counts**: Get aggregate query count over the last 30 days for multiple subgraph deployments +- **Get top Subgraph deployments for a contract**: Find the top 3 Subgraph deployments indexing a specific contract on a particular chain, ordered by query fees + +## Key Identifier Types + +- **Subgraph ID** (e.g., `5zvR82...`): Logical identifier for a subgraph. Use `execute_query_by_subgraph_id` or `get_schema_by_subgraph_id`. +- **Deployment ID** (e.g., `0x4d7c...`): Identifier for a specific, immutable deployment. Use `execute_query_by_deployment_id` or `get_schema_by_deployment_id`. +- **IPFS Hash** (e.g., `QmTZ8e...`): Identifier for the manifest of a specific, immutable deployment. Use `execute_query_by_deployment_id` (the gateway treats it like a deployment ID for querying) or `get_schema_by_ipfs_hash`. + +## Benefits of Natural Language Queries + +One of the most powerful features of the Subgraph MCP integration is the ability to ask questions in natural language. Claude will: + +1. Understand your goal (lookup, find Subgraphs, query, get schema) +2. Find relevant deployments if needed +3. Fetch and interpret the Subgraph schema +4. Convert your question into an appropriate GraphQL query +5. Execute the query and present the results in a readable format + +### Example Natural Language Queries + +``` +What are the pairs with maximum volume on deployment 0xde0a7b5368f846f7d863d9f64949b688ad9818243151d488b4c6b206145b9ea3? +``` + +``` +Which tokens have the highest market cap in this Subgraph? +``` + +``` +Show me the most recent 5 swaps for the USDC/ETH pair +``` + +``` +Find the top subgraphs for contract 0x1f98431c8ad98523631ae4a59f267346ea31f984 on arbitrum-one +``` diff --git a/website/src/pages/ar/ai-suite/subgraph-mcp/cline.mdx b/website/src/pages/ar/ai-suite/subgraph-mcp/cline.mdx new file mode 100644 index 000000000000..eb8044bfe991 --- /dev/null +++ b/website/src/pages/ar/ai-suite/subgraph-mcp/cline.mdx @@ -0,0 +1,99 @@ +--- +title: Cline +--- + +This guide walks you through the integration of Subgraph [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) to access Subgraph data through natural language conversations with Cline. + +## Prerequisites + +- [Cline](https://cline.bot/) installed (latest version) +- A Gateway API key from [Subgraph Studio](https://thegraph.com/studio/) +- [`npx`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) or [`bunx`](https://bun.sh/) installed and available in your path + +## Configuration Steps + +### 1. Open Configuration File + +Create or edit your `cline_mcp_settings.json` file. + +> **MCP Servers** > **Installed** > **Configure MCP Servers** + +### 2. Add Configuration + +```json +{ + "mcpServers": { + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Key + +Replace `GATEWAY_API_KEY` with your API key from Subgraph Studio. + +## Using The Graph Resource in Cline + +After configuring Cline: + +1. Restart Cline +2. Start a new conversation +3. Enable the Subgraph MCP from the context menu +4. Add "Subgraph Server Instructions" as a resource to your chat context + +## Available Tools and Usage + +The Subgraph MCP provides several tools for interacting with Subgraphs: + +### Schema Retrieval Tools + +- **Get schema by deployment ID**: Access the GraphQL schema using a deployment ID (0x...) +- **Get schema by Subgraph ID**: Access the schema for the current deployment of a Subgraph (5zvR82...) +- **Get schema by IPFS hash**: Access the schema using a Subgraph's IPFS manifest hash (Qm...) + +### Query Execution Tools + +- **Execute query by deployment ID**: Run GraphQL queries against specific, immutable deployments +- **Execute query by Subgraph ID**: Run GraphQL queries against the latest version of a Subgraph + +### Discovery Tools + +- **Get top Subgraph deployments**: Find the top 3 Subgraph deployments indexing a specific contract on a particular chain + +## Natural Language Queries + +One of the most powerful features of the Subgraph MCP integration is the ability to ask questions in natural language. Cline will: + +1. Understand your goal (lookup, find Subgraphs, query, get schema) +2. Find relevant deployments if needed +3. Fetch and interpret the Subgraph schema +4. Convert your question into an appropriate GraphQL query +5. Execute the query and present the results in a readable format + +### Example Natural Language Queries + +``` +What are the pairs with maximum volume on deployment 0xde0a7b5368f846f7d863d9f64949b688ad9818243151d488b4c6b206145b9ea3? +``` + +``` +Which tokens have the highest market cap in this Subgraph? +``` + +``` +Show me the most recent 5 swaps for the USDC/ETH pair +``` + +## Key Identifier Types + +When working with Subgraphs, you'll encounter different types of identifiers: + +- **Subgraph ID** (e.g., `5zvR82...`): Logical identifier for a Subgraph +- **Deployment ID** (e.g., `0x4d7c...`): Identifier for a specific, immutable deployment +- **IPFS Hash** (e.g., `QmTZ8e...`): Identifier for the manifest of a specific deployment diff --git a/website/src/pages/ar/ai-suite/subgraph-mcp/cursor.mdx b/website/src/pages/ar/ai-suite/subgraph-mcp/cursor.mdx new file mode 100644 index 000000000000..6291caf4b06b --- /dev/null +++ b/website/src/pages/ar/ai-suite/subgraph-mcp/cursor.mdx @@ -0,0 +1,94 @@ +--- +title: Cursor +--- + +This guide walks you through the integration of Subgraph [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) to access Subgraph data through natural language conversations with Cline. + +## Prerequisites + +- [Cursor](https://www.cursor.com/) installed (latest version) +- A Gateway API key from [Subgraph Studio](https://thegraph.com/studio/) +- [`npx`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) or [`bunx`](https://bun.sh/) installed and available in your path + +## Configuration Steps + +### 1. Open Configuration File + +Create or edit your `~/.cursor/mcp.json` file. + +> **Cursor Settings** > **MCP** > **Add new global MCP Server** + +### 2. Add Configuration + +```json +{ + "mcpServers": { + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Key + +Replace `GATEWAY_API_KEY` with your API key from Subgraph Studio. + +### 4. Restart Cursor + +Restart Cursor, and start a new chat. + +## Available Subgraph Tools and Usage + +The Subgraph MCP provides several tools for interacting with Subgraphs: + +### Schema Retrieval Tools + +- **Get schema by deployment ID**: Access the GraphQL schema using a deployment ID (0x...) +- **Get schema by Subgraph ID**: Access the schema for the current deployment of a Subgraph (5zvR82...) +- **Get schema by IPFS hash**: Access the schema using a Subgraph's IPFS manifest hash (Qm...) + +### Query Execution Tools + +- **Execute query by deployment ID**: Run GraphQL queries against specific, immutable deployments +- **Execute query by Subgraph ID**: Run GraphQL queries against the latest version of a Subgraph + +### Discovery Tools + +- **Get top Subgraph deployments**: Find the top 3 Subgraph deployments indexing a specific contract on a particular chain + +## Benefits of Natural Language Queries + +One of the most powerful features of the Subgraph MCP integration is the ability to ask questions in natural language. Cursor will: + +1. Understand your goal (lookup, find Subgraphs, query, get schema) +2. Find relevant deployments if needed +3. Fetch and interpret the Subgraph schema +4. Convert your question into an appropriate GraphQL query +5. Execute the query and present the results in a readable format + +### Example Natural Language Queries + +``` +What are the pairs with maximum volume on deployment 0xde0a7b5368f846f7d863d9f64949b688ad9818243151d488b4c6b206145b9ea3? +``` + +``` +Which tokens have the highest market cap in this Subgraph? +``` + +``` +Show me the most recent 5 swaps for the USDC/ETH pair +``` + +## Key Identifier Types + +When working with Subgraphs, you'll encounter different types of identifiers: + +- **Subgraph ID** (e.g., `5zvR82...`): Logical identifier for a Subgraph +- **Deployment ID** (e.g., `0x4d7c...`): Identifier for a specific, immutable deployment +- **IPFS Hash** (e.g., `QmTZ8e...`): Identifier for the manifest of a specific deployment diff --git a/website/src/pages/ar/ai-suite/subgraph-mcp/introduction.mdx b/website/src/pages/ar/ai-suite/subgraph-mcp/introduction.mdx new file mode 100644 index 000000000000..20854a4e20c0 --- /dev/null +++ b/website/src/pages/ar/ai-suite/subgraph-mcp/introduction.mdx @@ -0,0 +1,22 @@ +--- +title: Subgraph MCP Introduction +sidebarTitle: مقدمة +--- + +Subgraph MCP server is an open-source implementation of [Anthropic's Model Context Protocol](https://modelcontextprotocol.io/introduction). + +It presents The Graph's Subgraph data through a set of MCP tools that any MCP-compatible client can call. With these tools, clients can search for relevant Subgraphs, inspect GraphQL schemas, and run queries against specific deployments on The Graph Network all within a single, standardized interface. + +The server itself does not hold a language model. Instead, it translates incoming MCP requests into Subgraph queries and returns the structured results, allowing the client's LLM to transform a natural-language prompt into actionable blockchain data. + +Think of it as a USB-C hub: it standardizes the plug-and-play connection between AI agents and The Graph's Subgraph ecosystem. + +## What You Can Do + +- Access GraphQL schemas for any Subgraph on The Graph Network +- Run GraphQL queries on any Subgraph deployment +- Discover top Subgraph deployments by keyword or contract address +- Retrieve 30-day query volumes for Subgraph deployments +- Ask questions about Subgraph data without writing GraphQL manually + +The Subgraph MCP server allows smooth integration with [Claude](/ai-suite/subgraph-mcp/claude/), [Cline](/ai-suite/subgraph-mcp/cline/), or [Cursor](/ai-suite/subgraph-mcp/cursor/), making blockchain data queries with The Graph Network a conversational experience. diff --git a/website/src/pages/ar/ai-suite/token-api-mcp/claude.mdx b/website/src/pages/ar/ai-suite/token-api-mcp/claude.mdx new file mode 100644 index 000000000000..e958ef16ebac --- /dev/null +++ b/website/src/pages/ar/ai-suite/token-api-mcp/claude.mdx @@ -0,0 +1,52 @@ +--- +title: Using Claude Desktop to Access the Token API via MCP +sidebarTitle: Claude Desktop +--- + +## Prerequisites + +- [Claude Desktop](https://claude.ai/download) installed. +- A [JWT token](/token-api/quick-start) from [The Graph Market](https://thegraph.market/). +- [`npx`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) or [`bunx`](https://bun.sh/) installed and available in your path. +- The `@pinax/mcp` package requires Node 18+, as it relies on built-in `fetch()` / `Headers`, which are not available in Node 17 or older. You may need to specify an exact path to an up-to-date Node version, or uninstall previous versions of Node to ensure `@pinax/mcp` uses the correct version. + +## Configuration + +Create or edit your `claude_desktop_config.json` file. + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +```json label="claude_desktop_config.json" +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "" + } + } + } +} +``` + +## Troubleshooting + +To enable logs for the MCP, add the option `"--verbose", "true"` under `"args"`. + +### ENOENT + +![Error dialog in Claude Desktop showing 'ENOENT' system error, indicating the npx/bunx command wasn't found in the system path.](/img/claude-ENOENT.png) + +Try to use the full path of the command instead: + +- Run `which npx` or `which bunx` in the command line interface to get the path of the command. +- Replace `npx` or `bunx` in the configuration file with the full path (e.g. `/home/user/bin/bunx`). + +### Server disconnected + +![Connection error notification in Claude Desktop displaying 'Server disconnected' message.](/img/claude-server-disconnect.png) + +Double-check your API key. Otherwise, look in your navigator if `https://token-api.mcp.thegraph.com/sse` is reachable. diff --git a/website/src/pages/ar/ai-suite/token-api-mcp/cline.mdx b/website/src/pages/ar/ai-suite/token-api-mcp/cline.mdx new file mode 100644 index 000000000000..e885d21366cd --- /dev/null +++ b/website/src/pages/ar/ai-suite/token-api-mcp/cline.mdx @@ -0,0 +1,52 @@ +--- +title: Using Cline to Access the Token API via MCP +sidebarTitle: Cline +--- + +## Prerequisites + +- [Cline](https://cline.bot/) installed. +- A [JWT token](/token-api/quick-start) from [The Graph Market](https://thegraph.market/). +- [`npx`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) or [`bunx`](https://bun.sh/) installed and available in your path. +- The `@pinax/mcp` package requires Node 18+, as it relies on built-in `fetch()` / `Headers`, which are not available in Node 17 or older. You may need to specify an exact path to an up-to-date Node version, or uninstall previous versions of Node to ensure `@pinax/mcp` uses the correct version. + +![Screenshot of Cline's MCP server configuration interface displaying the JSON settings file with mcp-pinax server details visible.](/img/cline-preview-token-api.png) + +## Configuration + +Create or edit your `cline_mcp_settings.json` file. + +> **MCP Servers** > **Installed** > **Configure MCP Servers** + +```json label="cline_mcp_settings.json" +{ + "mcpServers": { + "mcp-pinax": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "" + } + } + } +} +``` + +## Troubleshooting + +To enable logs for the MCP, use the `--verbose true` option. + +### ENOENT + +![Cline error dialog showing 'ENOENT' system alert.](/img/cline-error.png) + +Try to use the full path of the command instead: + +- Run `which npx` or `which bunx` to get the path of the command. +- Replace `npx` or `bunx` in the configuration file with the full path (e.g. `/home/user/bin/bunx`). + +### Server disconnected + +![Cline connection error notification displaying server disconnection warning.](/img/cline-missing-variables.png) + +Double-check your API key otherwise look in your navigator if `https://token-api.mcp.thegraph.com/sse` is reachable. diff --git a/website/src/pages/ar/ai-suite/token-api-mcp/cursor.mdx b/website/src/pages/ar/ai-suite/token-api-mcp/cursor.mdx new file mode 100644 index 000000000000..68fe2fdb201c --- /dev/null +++ b/website/src/pages/ar/ai-suite/token-api-mcp/cursor.mdx @@ -0,0 +1,50 @@ +--- +title: Using Cursor to Access the Token API via MCP +sidebarTitle: Cursor +--- + +## Prerequisites + +- [Cursor](https://www.cursor.com/) installed. +- A [JWT token](/token-api/quick-start) from [The Graph Market](https://thegraph.market/). +- [`npx`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) or [`bunx`](https://bun.sh/) installed and available in your path. +- The `@pinax/mcp` package requires Node 18+, as it relies on built-in `fetch()` / `Headers`, which are not available in Node 17 or older. You may need to specify an exact path to an up-to-date Node version, or uninstall previous versions of Node to ensure `@pinax/mcp` uses the correct version. + +![Screenshot of Cursor's MCP configuration panel.](/img/cursor-preview-token-api.png) + +## Configuration + +Create or edit your `~/.cursor/mcp.json` file. + +> **Cursor Settings** > **MCP** > **Add new global MCP Server** + +```json label="mcp.json" +{ + "mcpServers": { + "mcp-pinax": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "" + } + } + } +} +``` + +## Troubleshooting + +![Cursor IDE error notification that reads, "Failed to create client"](/img/cursor-error.png) + +To enable logs for the MCP, use the `--verbose true` option. + +### ENOENT + +Try to use the full path of the command instead: + +- Run `which npx` or `which bunx` to get the path of the command. +- Replace `npx` or `bunx` in the configuration file with the full path (e.g. `/home/user/bin/bunx`). + +### Server disconnected + +Double-check your API key otherwise look in your navigator if `https://token-api.mcp.thegraph.com/sse` is reachable. diff --git a/website/src/pages/ar/ai-suite/token-api-mcp/introduction.mdx b/website/src/pages/ar/ai-suite/token-api-mcp/introduction.mdx new file mode 100644 index 000000000000..a51c79db7d88 --- /dev/null +++ b/website/src/pages/ar/ai-suite/token-api-mcp/introduction.mdx @@ -0,0 +1,23 @@ +--- +title: Token API MCP Introduction +sidebarTitle: مقدمة +--- + +Token API MCP server is an open-source implementation of [Anthropic's Model Context Protocol](https://modelcontextprotocol.io/introduction). + +This MCP server makes on-chain token data, including metadata, balances, transfers, and holder statistics, accessible through a set of MCP tools. Any compatible client can use these tools to fetch and analyze token information through a standardized interface. It connects to The Graph's hosted Token API database, enabling AI assistants to query real-time blockchain data using natural language requests that get translated into optimized SQL queries. + +The server itself does not host any language model. It simply converts MCP calls into data look-ups and returns structured results, letting the client's own LLM incorporate the results. + +Think of it as a USB-C hub: it standardizes the plug-and-play connection between AI agents and The Graph's Token API data. + +## What You Can Do + +- Retrieve token metadata including name, symbol, decimals, total supply, and contract address +- Get token balances for any wallet address holding a supported ERC-20 token +- Fetch token transfer activity including sender, receiver, amount, and timestamp +- Identify top holders and analyze token distribution +- Ask natural language questions about token data without writing smart contract calls +- Access historical transfer data to analyze token movement over time + +The Token MCP server provides [Claude](/ai-suite/token-api-mcp/claude/), [Cline](/ai-suite/token-api-mcp/cline/), and [Cursor](/ai-suite/token-api-mcp/cursor/) with direct, conversational access to onchain token data. diff --git a/website/src/pages/ar/archived/arbitrum/arbitrum-faq.mdx b/website/src/pages/ar/archived/arbitrum/arbitrum-faq.mdx index e1dbbea03383..16ef2a30b4a9 100644 --- a/website/src/pages/ar/archived/arbitrum/arbitrum-faq.mdx +++ b/website/src/pages/ar/archived/arbitrum/arbitrum-faq.mdx @@ -2,6 +2,8 @@ title: Arbitrum FAQ --- +> [!IMPORTANT] L2 Transfer Tools have been deprecated, and The Graph now runs on Arbitrum, a Layer 2 blockchain. + Click [here](#billing-on-arbitrum-faqs) if you would like to skip to the Arbitrum Billing FAQs. ## Why did The Graph implement an L2 Solution? @@ -25,7 +27,6 @@ The Graph’s billing system accepts GRT on Arbitrum, and users will need ETH on Consequently, to pay for queries, you need GRT on Arbitrum. Here are a few different ways to achieve this: - If you already have GRT on Ethereum, you can bridge it to Arbitrum. You can do this via the GRT bridging option provided in Subgraph Studio or by using one of the following bridges: - - [The Arbitrum Bridge](https://bridge.arbitrum.io/?l2ChainId=42161) - [TransferTo](https://transferto.xyz/swap) diff --git a/website/src/pages/ar/archived/arbitrum/l2-transfer-tools-faq.mdx b/website/src/pages/ar/archived/arbitrum/l2-transfer-tools-faq.mdx index 965c96f7355a..6e57cf282bc8 100644 --- a/website/src/pages/ar/archived/arbitrum/l2-transfer-tools-faq.mdx +++ b/website/src/pages/ar/archived/arbitrum/l2-transfer-tools-faq.mdx @@ -2,6 +2,8 @@ title: الأسئلة الشائعة حول أدوات النقل L2 --- +> [!IMPORTANT] L2 Transfer Tools have been deprecated, and The Graph now runs on Arbitrum, a Layer 2 blockchain. + ## عام ### ما هي أدوات النقل L2؟ @@ -116,7 +118,9 @@ Once transferred, your Ethereum mainnet version of this Subgraph will be depreca ### ماذا يحدث لمكافآتي إذا بدأت عملية تحويل وكان لا يزال التخصيص مفتوحا على Ethereum mainnet؟ -If the Indexer to whom you're delegating is still operating on L1, when you transfer to Arbitrum you will forfeit any delegation rewards from open allocations on Ethereum mainnet. This means that you will lose the rewards from, at most, the last 28-day period. If you time the transfer right after the Indexer has closed allocations you can make sure this is the least amount possible. If you have a communication channel with your Indexer(s), consider discussing with them to find the best time to do your transfer. +If the Indexer to whom you're delegating has started transferring stake to L2 but is still operating on L1, when you transfer to Arbitrum you will forfeit any delegation rewards from open allocations on Ethereum mainnet. This means that you will lose the rewards from, at most, the last 28-day period. If you time the transfer right after the Indexer has closed allocations you can make sure this is the least amount possible. If you have a communication channel with your Indexer(s), consider discussing with them to find the best time to do your transfer. Other than this, your unrealized rewards will be transferred to L2 with the delegation. + +If the Indexer has transferred all their stake to L2, they will not have open allocations on L1 and therefore all your rewards will be transferred to L2 with the delegation transfer. ### ماذا يحدث إذا كان المفهرس الذي أفوضه حاليًا غير موجود في Arbitrum One؟ diff --git a/website/src/pages/ar/archived/arbitrum/l2-transfer-tools-guide.mdx b/website/src/pages/ar/archived/arbitrum/l2-transfer-tools-guide.mdx index 5863ff2de0a2..dd03421d3506 100644 --- a/website/src/pages/ar/archived/arbitrum/l2-transfer-tools-guide.mdx +++ b/website/src/pages/ar/archived/arbitrum/l2-transfer-tools-guide.mdx @@ -2,6 +2,8 @@ title: L2 Transfer Tools Guide --- +> [!IMPORTANT] L2 Transfer Tools have been deprecated, and The Graph now runs on Arbitrum, a Layer 2 blockchain. + يسهل الغراف الانتقال إلى الطبقة الثانبة على أربترم. لكل مشارك في البروتوكول ، توجد مجموعة من أدوات نقل الطبقة الثانبة لجعل النقل إليها سلسًا لجميع المشاركين في الشبكة. ستطلب منك هذه الأدوات اتباع مجموعة محددة من الخطوات بناءً على ما تقوم بنقله. Some frequent questions about these tools are answered in the [L2 Transfer Tools FAQ](/archived/arbitrum/l2-transfer-tools-faq/). The FAQs contain in-depth explanations of how to use the tools, how they work, and things to keep in mind when using them. diff --git a/website/src/pages/ar/global.json b/website/src/pages/ar/global.json index d9110259f5cb..209dd9844579 100644 --- a/website/src/pages/ar/global.json +++ b/website/src/pages/ar/global.json @@ -6,6 +6,7 @@ "subgraphs": "Subgraphs", "substreams": "متعدد-السلاسل", "sps": "Substreams-Powered Subgraphs", + "ai-suite": "AI Suite", "tokenApi": "Token API", "indexing": "Indexing", "resources": "Resources", diff --git a/website/src/pages/ar/index.json b/website/src/pages/ar/index.json index 2443372843a8..fe978cba0bc1 100644 --- a/website/src/pages/ar/index.json +++ b/website/src/pages/ar/index.json @@ -2,7 +2,7 @@ "title": "Home", "hero": { "title": "The Graph Docs", - "description": "Kick-start your web3 project with the tools to extract, transform, and load blockchain data.", + "description": "The Graph is a blockchain data solution that powers applications, analytics, and AI on 90+ chains. The Graph's core products include the Token API for web3 apps, Subgraphs for indexing smart contracts, and Substreams for real-time and historical data streaming.", "cta1": "How The Graph works", "cta2": "Build your first subgraph" }, @@ -19,10 +19,10 @@ "description": "Fetch and consume blockchain data with parallel execution.", "cta": "Develop with Substreams" }, - "sps": { - "title": "Substreams-Powered Subgraphs", - "description": "Boost your subgraph's efficiency and scalability by using Substreams.", - "cta": "Set up a Substreams-powered subgraph" + "tokenApi": { + "title": "Token API", + "description": "Query token data and leverage native MCP support.", + "cta": "Develop with Token API" }, "graphNode": { "title": "Graph Node", @@ -31,7 +31,7 @@ }, "firehose": { "title": "Firehose", - "description": "Extract blockchain data into flat files to enhance sync times and streaming capabilities.", + "description": "Extract blockchain data into flat files to speed sync times.", "cta": "Get started with Firehose" } }, @@ -58,6 +58,7 @@ "networks": "networks", "completeThisForm": "complete this form" }, + "seeAllNetworks": "See all {0} networks", "emptySearch": { "title": "No networks found", "description": "No networks match your search for \"{0}\"", @@ -70,7 +71,29 @@ "subgraphs": "Subgraphs", "substreams": "متعدد-السلاسل", "firehose": "Firehose", - "tokenapi": "Token API" + "tokenApi": "Token API" + }, + "tableLegend": { + "subgraphs": { + "basic": "Hosted (No issuance)", + "full": "The Graph Network (Issuance)" + }, + "substreams": { + "basic": "Base", + "full": "Extended (EVM only)" + }, + "firehose": { + "basic": "Base", + "full": "Extended (EVM only)" + }, + "tokenApi": { + "full": "All endpoints supported" + }, + "icons": { + "checkmark": "Checkmark", + "checkmarks": "Checkmarks" + }, + "legendTitle": "Table Legend" } }, "networkGuides": { @@ -79,10 +102,22 @@ "title": "Subgraph quick start", "description": "Kickstart your journey into subgraph development." }, - "substreams": { - "title": "متعدد-السلاسل", + "substreamsQuickStart": { + "title": "Substreams quick start", "description": "Stream high-speed data for real-time indexing." }, + "tokenApi": { + "title": "The Graph's Token API", + "description": "Query token data and leverage native MCP support." + }, + "graphExplorer": { + "title": "Graph Explorer", + "description": "Find and query existing blockchain data." + }, + "substreamsDev": { + "title": "Substreams.dev", + "description": "Access tutorials, templates, and documentation to build custom data modules." + }, "timeseries": { "title": "Timeseries & Aggregations", "description": "Learn to track metrics like daily volumes or user growth." @@ -109,12 +144,16 @@ "title": "Substreams.dev", "description": "Access tutorials, templates, and documentation to build custom data modules." }, + "customSubstreamsSinks": { + "title": "Custom Substreams Sinks", + "description": "Leverage existing Substreams sinks to access data." + }, "substreamsStarter": { "title": "Substreams starter", "description": "Leverage this boilerplate to create your first Substreams module." }, "substreamsRepo": { - "title": "Substreams repo", + "title": "Substreams GitHub repository", "description": "Study, contribute to, or customize the core Substreams framework." } } diff --git a/website/src/pages/ar/indexing/new-chain-integration.mdx b/website/src/pages/ar/indexing/new-chain-integration.mdx index b204d002b25d..ad200a351dd2 100644 --- a/website/src/pages/ar/indexing/new-chain-integration.mdx +++ b/website/src/pages/ar/indexing/new-chain-integration.mdx @@ -25,7 +25,7 @@ For Graph Node to be able to ingest data from an EVM chain, the RPC node must ex - `eth_getBlockByHash` - `net_version` - `eth_getTransactionReceipt`، ضمن طلب دفعة استدعاء الإجراء عن بُعد باستخدام تمثيل كائنات جافا سكريبت -- `trace_filter` *(limited tracing and optionally required for Graph Node)* +- `trace_filter` _(limited tracing and optionally required for Graph Node)_ ### 2. Firehose Integration @@ -63,7 +63,7 @@ Configuring Graph Node is as easy as preparing your local environment. Once your > Do not change the env var name itself. It must remain `ethereum` even if the network name is different. -3. Run an IPFS node or use the one used by The Graph: https://api.thegraph.com/ipfs/ +3. Run an IPFS node or use the one used by The Graph: https://ipfs.thegraph.com ## Substreams-powered Subgraphs diff --git a/website/src/pages/ar/indexing/overview.mdx b/website/src/pages/ar/indexing/overview.mdx index 200a3a6a64e5..b6ff33835155 100644 --- a/website/src/pages/ar/indexing/overview.mdx +++ b/website/src/pages/ar/indexing/overview.mdx @@ -110,12 +110,12 @@ Indexers may differentiate themselves by applying advanced techniques for making - **Medium** - Production Indexer supporting 100 Subgraphs and 200-500 requests per second. - **Large** - Prepared to index all currently used Subgraphs and serve requests for the related traffic. -| Setup | Postgres
(CPUs) | Postgres
(memory in GBs) | Postgres
(disk in TBs) | VMs
(CPUs) | VMs
(memory in GBs) | -| --- | :-: | :-: | :-: | :-: | :-: | -| Small | 4 | 8 | 1 | 4 | 16 | -| Standard | 8 | 30 | 1 | 12 | 48 | -| Medium | 16 | 64 | 2 | 32 | 64 | -| Large | 72 | 468 | 3.5 | 48 | 184 | +| Setup | Postgres
(CPUs) | Postgres
(memory in GBs) | Postgres
(disk in TBs) | VMs
(CPUs) | VMs
(memory in GBs) | +| -------- | :------------------: | :---------------------------: | :-------------------------: | :-------------: | :----------------------: | +| Small | 4 | 8 | 1 | 4 | 16 | +| Standard | 8 | 30 | 1 | 12 | 48 | +| Medium | 16 | 64 | 2 | 32 | 64 | +| Large | 72 | 468 | 3.5 | 48 | 184 | ### What are some basic security precautions an Indexer should take? @@ -131,7 +131,7 @@ At the center of an Indexer's infrastructure is the Graph Node which monitors th - **Data endpoint** - For EVM-compatible networks, Graph Node needs to be connected to an endpoint that exposes an EVM-compatible JSON-RPC API. This may take the form of a single client or it could be a more complex setup that load balances across multiple. It's important to be aware that certain Subgraphs will require particular client capabilities such as archive mode and/or the parity tracing API. -- **IPFS node (version less than 5)** - Subgraph deployment metadata is stored on the IPFS network. The Graph Node primarily accesses the IPFS node during Subgraph deployment to fetch the Subgraph manifest and all linked files. Network Indexers do not need to host their own IPFS node, an IPFS node for the network is hosted at https://ipfs.network.thegraph.com. +- **IPFS node (version less than 5)** - Subgraph deployment metadata is stored on the IPFS network. The Graph Node primarily accesses the IPFS node during Subgraph deployment to fetch the Subgraph manifest and all linked files. Network Indexers do not need to host their own IPFS node, an IPFS node for the network is hosted at https://ipfs.thegraph.com. - **Indexer service** - Handles all required external communications with the network. Shares cost models and indexing statuses, passes query requests from gateways on to a Graph Node, and manages the query payments via state channels with the gateway. @@ -147,20 +147,20 @@ Note: To support agile scaling, it is recommended that query and indexing concer #### Graph Node -| Port | Purpose | Routes | CLI Argument | Environment Variable | -| --- | --- | --- | --- | --- | -| 8000 | GraphQL HTTP server
(for Subgraph queries) | /subgraphs/id/...
/subgraphs/name/.../... | \--http-port | - | -| 8001 | GraphQL WS
(for Subgraph subscriptions) | /subgraphs/id/...
/subgraphs/name/.../... | \--ws-port | - | -| 8020 | JSON-RPC
(for managing deployments) | / | \--admin-port | - | -| 8030 | Subgraph indexing status API | /graphql | \--index-node-port | - | -| 8040 | Prometheus metrics | /metrics | \--metrics-port | - | +| Port | Purpose | Routes | CLI Argument | Environment Variable | +| ---- | ----------------------------------------------- | ---------------------------------------------- | ------------------ | -------------------- | +| 8000 | GraphQL HTTP server
(for Subgraph queries) | /subgraphs/id/...
/subgraphs/name/.../... | \--http-port | - | +| 8001 | GraphQL WS
(for Subgraph subscriptions) | /subgraphs/id/...
/subgraphs/name/.../... | \--ws-port | - | +| 8020 | JSON-RPC
(for managing deployments) | / | \--admin-port | - | +| 8030 | Subgraph indexing status API | /graphql | \--index-node-port | - | +| 8040 | Prometheus metrics | /metrics | \--metrics-port | - | #### Indexer Service -| Port | Purpose | Routes | CLI Argument | Environment Variable | -| --- | --- | --- | --- | --- | -| 7600 | GraphQL HTTP server
(for paid Subgraph queries) | /subgraphs/id/...
/status
/channel-messages-inbox | \--port | `INDEXER_SERVICE_PORT` | -| 7300 | Prometheus metrics | /metrics | \--metrics-port | - | +| Port | Purpose | Routes | CLI Argument | Environment Variable | +| ---- | ---------------------------------------------------- | ----------------------------------------------------------- | --------------- | ---------------------- | +| 7600 | GraphQL HTTP server
(for paid Subgraph queries) | /subgraphs/id/...
/status
/channel-messages-inbox | \--port | `INDEXER_SERVICE_PORT` | +| 7300 | Prometheus metrics | /metrics | \--metrics-port | - | #### Indexer Agent @@ -331,7 +331,7 @@ createdb graph-node cargo run -p graph-node --release -- \ --postgres-url postgresql://[USERNAME]:[PASSWORD]@localhost:5432/graph-node \ --ethereum-rpc [NETWORK_NAME]:[URL] \ - --ipfs https://ipfs.network.thegraph.com + --ipfs https://ipfs.thegraph.com ``` #### Getting started using Docker @@ -680,13 +680,11 @@ graph indexer actions execute approve Note that supported action types for allocation management have different input requirements: - `Allocate` - allocate stake to a specific Subgraph deployment - - required action params: - deploymentID - amount - `Unallocate` - close allocation, freeing up the stake to reallocate elsewhere - - required action params: - allocationID - deploymentID @@ -695,7 +693,6 @@ Note that supported action types for allocation management have different input - force (forces using the provided POI even if it doesn’t match what the graph-node provides) - `Reallocate` - atomically close allocation and open a fresh allocation for the same Subgraph deployment - - required action params: - allocationID - deploymentID @@ -708,42 +705,6 @@ Note that supported action types for allocation management have different input Cost models provide dynamic pricing for queries based on market and query attributes. The Indexer Service shares a cost model with the gateways for each Subgraph for which they intend to respond to queries. The gateways, in turn, use the cost model to make Indexer selection decisions per query and to negotiate payment with chosen Indexers. -#### Agora - -The Agora language provides a flexible format for declaring cost models for queries. An Agora price model is a sequence of statements that execute in order for each top-level query in a GraphQL query. For each top-level query, the first statement which matches it determines the price for that query. - -A statement is comprised of a predicate, which is used for matching GraphQL queries, and a cost expression which when evaluated outputs a cost in decimal GRT. Values in the named argument position of a query may be captured in the predicate and used in the expression. Globals may also be set and substituted in for placeholders in an expression. - -Example cost model: - -``` -# This statement captures the skip value, -# uses a boolean expression in the predicate to match specific queries that use `skip` -# and a cost expression to calculate the cost based on the `skip` value and the SYSTEM_LOAD global -query { pairs(skip: $skip) { id } } when $skip > 2000 => 0.0001 * $skip * $SYSTEM_LOAD; - -# This default will match any GraphQL expression. -# It uses a Global substituted into the expression to calculate cost -default => 0.1 * $SYSTEM_LOAD; -``` - -Example query costing using the above model: - -| Query | Price | -| ---------------------------------------------------------------------------- | ------- | -| { pairs(skip: 5000) { id } } | 0.5 GRT | -| { tokens { symbol } } | 0.1 GRT | -| { pairs(skip: 5000) { id } tokens { symbol } } | 0.6 GRT | - -#### Applying the cost model - -Cost models are applied via the Indexer CLI, which passes them to the Indexer Management API of the Indexer agent for storing in the database. The Indexer Service will then pick them up and serve the cost models to gateways whenever they ask for them. - -```sh -indexer cost set variables '{ "SYSTEM_LOAD": 1.4 }' -indexer cost set model my_model.agora -``` - ## Interacting with the network ### Stake in the protocol @@ -772,7 +733,7 @@ Once an Indexer has staked GRT in the protocol, the [Indexer components](/indexi 1. Open the [Remix app](https://remix.ethereum.org/) in a browser -2. In the `File Explorer` create a file named **Staking.abi** with the staking ABI. +2. In the `File Explorer` create a file named **Staking.abi** with the [staking ABI](https://raw.githubusercontent.com/graphprotocol/contracts/mainnet-deploy-build/build/abis/Staking.json). 3. With `Staking.abi` selected and open in the editor, switch to the `Deploy and run transactions` section in the Remix interface. diff --git a/website/src/pages/ar/indexing/supported-network-requirements.mdx b/website/src/pages/ar/indexing/supported-network-requirements.mdx index 4205fe314802..b2dc4b0bcac3 100644 --- a/website/src/pages/ar/indexing/supported-network-requirements.mdx +++ b/website/src/pages/ar/indexing/supported-network-requirements.mdx @@ -2,17 +2,19 @@ title: Supported Network Requirements --- -| Network | Guides | System Requirements | Indexing Rewards | -| --- | --- | --- | :-: | -| Arbitrum | [Baremetal Guide](https://docs.infradao.com/archive-nodes-101/arbitrum/baremetal)
[Docker Guide](https://docs.infradao.com/archive-nodes-101/arbitrum/docker) | 4+ core CPU
Ubuntu 22.04
16GB+ RAM
>= 8 TiB NVMe SSD
_last updated August 2023_ | ✅ | -| Avalanche | [Docker Guide](https://docs.infradao.com/archive-nodes-101/avalanche/docker) | 4 core / 8 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 5 TiB NVMe SSD
_last updated August 2023_ | ✅ | -| Base | [Erigon Baremetal Guide](https://docs.infradao.com/archive-nodes-101/base/erigon/baremetal)

[GETH Baremetal Guide](https://docs.infradao.com/archive-nodes-101/base/geth/baremetal)
[GETH Docker Guide](https://docs.infradao.com/archive-nodes-101/base/geth/docker) | 8+ core CPU
Debian 12/Ubuntu 22.04
16 GB RAM
>= 4.5TB (NVME preferred)
_last updated 14th May 2024_ | ✅ | -| Binance | [Erigon Baremetal Guide](https://docs.infradao.com/archive-nodes-101/binance/erigon/baremetal) | 8 core / 16 threads CPU
Ubuntu 22.04
>=32 GB RAM
>= 14 TiB NVMe SSD
_last updated 22nd June 2024_ | ✅ | -| Celo | [Docker Guide](https://docs.infradao.com/archive-nodes-101/celo/docker) | 4 core / 8 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 2 TiB NVMe SSD
_last updated August 2023_ | ✅ | -| Ethereum | [Docker Guide](https://docs.infradao.com/archive-nodes-101/ethereum/erigon/docker) | Higher clock speed over core count
Ubuntu 22.04
16GB+ RAM
>=3TB (NVMe recommended)
_last updated August 2023_ | ✅ | -| Fantom | [Docker Guide](https://docs.infradao.com/archive-nodes-101/fantom/docker) | 4 core / 8 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 13 TiB NVMe SSD
_last updated August 2023_ | ✅ | -| Gnosis | [Baremetal Guide](https://docs.infradao.com/archive-nodes-101/gnosis/erigon/baremetal) | 6 core / 12 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 3 TiB NVMe SSD
_last updated August 2023_ | ✅ | -| Linea | [Baremetal Guide](https://docs.infradao.com/archive-nodes-101/linea/baremetal) | 4+ core CPU
Ubuntu 22.04
16GB+ RAM
>= 1 TiB NVMe SSD
_last updated 2nd April 2024_ | ✅ | -| Optimism | [Erigon Baremetal Guide](https://docs.infradao.com/archive-nodes-101/optimism/erigon/baremetal)

[GETH Baremetal Guide](https://docs.infradao.com/archive-nodes-101/optimism/geth/baremetal)
[GETH Docker Guide](https://docs.infradao.com/archive-nodes-101/optimism/geth/docker) | 4 core / 8 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 8 TiB NVMe SSD
_last updated August 2023_ | ✅ | -| بوليجون | [Docker Guide](https://docs.infradao.com/archive-nodes-101/polygon/docker) | 16 core CPU
Ubuntu 22.04
32GB+ RAM
>= 10 TiB NVMe SSD
_last updated August 2023_ | ✅ | -| Scroll | [Baremetal Guide](https://docs.infradao.com/archive-nodes-101/scroll/baremetal)
[Docker Guide](https://docs.infradao.com/archive-nodes-101/scroll/docker) | 4 core / 8 threads CPU
Debian 12
16GB+ RAM
>= 1 TiB NVMe SSD
_last updated 3rd April 2024_ | ✅ | +import { Check } from '@edgeandnode/gds/icons' + +| Network | Guides | System Requirements | Indexing Rewards | +| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | :-----------------------: | +| Arbitrum | [Baremetal Guide](https://docs.infradao.com/archive-nodes-101/arbitrum/baremetal)
[Docker Guide](https://docs.infradao.com/archive-nodes-101/arbitrum/docker) | 4+ core CPU
Ubuntu 22.04
16GB+ RAM
>= 8 TiB NVMe SSD
_last updated August 2023_ | | +| Avalanche | [Docker Guide](https://docs.infradao.com/archive-nodes-101/avalanche/docker) | 4 core / 8 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 5 TiB NVMe SSD
_last updated August 2023_ | | +| Base | [Erigon Baremetal Guide](https://docs.infradao.com/archive-nodes-101/base/erigon/baremetal)

[GETH Baremetal Guide](https://docs.infradao.com/archive-nodes-101/base/geth/baremetal)
[GETH Docker Guide](https://docs.infradao.com/archive-nodes-101/base/geth/docker) | 8+ core CPU
Debian 12/Ubuntu 22.04
16 GB RAM
>= 4.5TB (NVME preferred)
_last updated 14th May 2024_ | | +| Binance | [Erigon Baremetal Guide](https://docs.infradao.com/archive-nodes-101/binance/erigon/baremetal) | 8 core / 16 threads CPU
Ubuntu 22.04
>=32 GB RAM
>= 14 TiB NVMe SSD
_last updated 22nd June 2024_ | | +| Celo | [Docker Guide](https://docs.infradao.com/archive-nodes-101/celo/docker) | 4 core / 8 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 2 TiB NVMe SSD
_last updated August 2023_ | | +| Ethereum | [Docker Guide](https://docs.infradao.com/archive-nodes-101/ethereum/erigon/docker) | Higher clock speed over core count
Ubuntu 22.04
16GB+ RAM
>=3TB (NVMe recommended)
_last updated August 2023_ | | +| Fantom | [Docker Guide](https://docs.infradao.com/archive-nodes-101/fantom/docker) | 4 core / 8 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 13 TiB NVMe SSD
_last updated August 2023_ | | +| Gnosis | [Baremetal Guide](https://docs.infradao.com/archive-nodes-101/gnosis/erigon/baremetal) | 6 core / 12 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 3 TiB NVMe SSD
_last updated August 2023_ | | +| Linea | [Baremetal Guide](https://docs.infradao.com/archive-nodes-101/linea/baremetal) | 4+ core CPU
Ubuntu 22.04
16GB+ RAM
>= 1 TiB NVMe SSD
_last updated 2nd April 2024_ | | +| Optimism | [Erigon Baremetal Guide](https://docs.infradao.com/archive-nodes-101/optimism/erigon/baremetal)

[GETH Baremetal Guide](https://docs.infradao.com/archive-nodes-101/optimism/geth/baremetal)
[GETH Docker Guide](https://docs.infradao.com/archive-nodes-101/optimism/geth/docker) | 4 core / 8 threads CPU
Ubuntu 22.04
16GB+ RAM
>= 8 TiB NVMe SSD
_last updated August 2023_ | | +| بوليجون | [Docker Guide](https://docs.infradao.com/archive-nodes-101/polygon/docker) | 16 core CPU
Ubuntu 22.04
32GB+ RAM
>= 10 TiB NVMe SSD
_last updated August 2023_ | | +| Scroll | [Baremetal Guide](https://docs.infradao.com/archive-nodes-101/scroll/baremetal)
[Docker Guide](https://docs.infradao.com/archive-nodes-101/scroll/docker) | 4 core / 8 threads CPU
Debian 12
16GB+ RAM
>= 1 TiB NVMe SSD
_last updated 3rd April 2024_ | | diff --git a/website/src/pages/ar/indexing/tap.mdx b/website/src/pages/ar/indexing/tap.mdx index e7085e5680bb..80b06076747e 100644 --- a/website/src/pages/ar/indexing/tap.mdx +++ b/website/src/pages/ar/indexing/tap.mdx @@ -2,7 +2,7 @@ title: GraphTally Guide --- -Learn about The Graph’s new payment system, **GraphTally** [(previously Timeline Aggregation Protocol)](https://docs.rs/tap_core/latest/tap_core/index.html). This system provides fast, efficient microtransactions with minimized trust. +Learn about The Graph's new payment system, **GraphTally** [(previously Timeline Aggregation Protocol)](https://docs.rs/tap_core/latest/tap_core/index.html). This system provides fast, efficient microtransactions with minimized trust. ## نظره عامة @@ -11,35 +11,30 @@ GraphTally is a drop-in replacement to the Scalar payment system currently in pl - Efficiently handles micropayments. - Adds a layer of consolidations to onchain transactions and costs. - Allows Indexers control of receipts and payments, guaranteeing payment for queries. -- It enables decentralized, trustless gateways and improves `indexer-service` performance for multiple senders. +- Enables decentralized, trustless gateways and improves indexer service performance for multiple senders. -### Specifics +### How It Works -GraphTally allows a sender to make multiple payments to a receiver, **Receipts**, which aggregates these payments into a single payment, a **Receipt Aggregate Voucher**, also known as a **RAV**. This aggregated payment can then be verified on the blockchain, reducing the number of transactions and simplifying the payment process. +GraphTally allows a sender to make multiple payments to a receiver through **Receipts**, which are then aggregated into a single payment called a **Receipt Aggregate Voucher (RAV)**. This aggregated payment can be verified on the blockchain, reducing the number of transactions and simplifying the payment process. -For each query, the gateway will send you a `signed receipt` that is stored on your database. Then, these queries will be aggregated by a `tap-agent` through a request. Afterwards, you’ll receive a RAV. You can update a RAV by sending it with newer receipts and this will generate a new RAV with an increased value. +For each query, the gateway sends a signed receipt that is stored in your database. The `indexer-tap-agent` aggregates these receipts into RAVs through periodic requests. You can update a RAV by sending it with newer receipts, which generates a new RAV with an increased value. ### RAV Details -- It’s money that is waiting to be sent to the blockchain. - -- It will continue to send requests to aggregate and ensure that the total value of non-aggregated receipts does not exceed the `amount willing to lose`. - +- RAVs represent money waiting to be sent to the blockchain. +- The system continuously aggregates receipts to ensure that the total value of non-aggregated receipts does not exceed the configured `max_amount_willing_to_lose_grt`. - Each RAV can be redeemed once in the contracts, which is why they are sent after the allocation is closed. -### Redeeming RAV - -As long as you run `tap-agent` and `indexer-agent`, everything will be executed automatically. The following provides a detailed breakdown of the process: - -1. An Indexer closes allocation. - -2. ` period, tap-agent` takes all pending receipts for that specific allocation and requests an aggregation into a RAV, marking it as `last`. +### Redeeming RAVs -3. `indexer-agent` takes all the last RAVS and sends redeem requests to the blockchain, which will update the value of `redeem_at`. +The redemption process is fully automated when running both `indexer-tap-agent` and `indexer-agent`: -4. During the `` period, `indexer-agent` monitors if the blockchain has any reorganizations that revert the transaction. - - - If it was reverted, the RAV is resent to the blockchain. If it was not reverted, it gets marked as `final`. +1. An Indexer closes an allocation. +2. After the `recently-closed-allocation-buffer` period, `indexer-tap-agent` takes all pending receipts for that allocation and requests aggregation into a final RAV, marking it as `last`. +3. `indexer-agent` takes all the last RAVs and sends redeem requests to the blockchain, updating the `redeem_at` value. +4. During the `finality-time` period, `indexer-agent` monitors for blockchain reorganizations: + - If the transaction was reverted, the RAV is resent to the blockchain. + - If not reverted, it gets marked as `final`. ## Blockchain Addresses @@ -59,135 +54,259 @@ As long as you run `tap-agent` and `indexer-agent`, everything will be executed | Signers | `0xfF4B7A5EfD00Ff2EC3518D4F250A27e4c29A2211` | `0xFb142dE83E261e43a81e9ACEADd1c66A0DB121FE` | | Aggregator | `https://tap-aggregator.network.thegraph.com` | `https://tap-aggregator.testnet.thegraph.com` | -### Prerequisites +## Prerequisites -In addition to the typical requirements to run an indexer, you’ll need a `tap-escrow-subgraph` endpoint to query updates. You can use The Graph Network to query or host yourself on your `graph-node`. +In addition to typical indexer requirements, you'll need a `tap-escrow-subgraph` endpoint to query escrow information. You can use The Graph Network to query or self-host on your `graph-node`: - [Graph TAP Arbitrum Sepolia Subgraph (for The Graph testnet)](https://thegraph.com/explorer/subgraphs/7ubx365MiqBH5iUz6XWXWT8PTof5BVAyEzdb8m17RvbD) - [Graph TAP Arbitrum One Subgraph (for The Graph mainnet)](https://thegraph.com/explorer/subgraphs/4sukbNVTzGELnhdnpyPqsf1QqtzNHEYKKmJkgaT8z6M1) -> Note: `indexer-agent` does not currently handle the indexing of this Subgraph like it does for the network Subgraph deployment. As a result, you have to index it manually. +> Note: `indexer-agent` does not currently handle the indexing of this Subgraph like it does for the Network Subgraph deployment. You must index it manually. ## Migration Guide -### Software versions +### Software Requirements -The required software version can be found [here](https://github.com/graphprotocol/indexer/blob/main/docs/networks/arbitrum-one.md#latest-releases). +#### Required Versions -### Steps +- **indexer-agent**: [Latest version supporting TAP](https://github.com/graphprotocol/indexer/releases) +- **indexer-service-rs**: [Latest release](https://github.com/graphprotocol/indexer-rs/releases?q=indexer-service-rs) +- **indexer-tap-agent**: [Latest release](https://github.com/graphprotocol/indexer-rs/releases?q=indexer-tap-agent) -1. **Indexer Agent** +#### Docker Images - - Follow the [same process](https://github.com/graphprotocol/indexer/pkgs/container/indexer-agent#graph-protocol-indexer-components). - - Give the new argument `--tap-subgraph-endpoint` to activate the new GraphTally codepaths and enable redeeming of RAVs. +```bash +# Indexer Service +docker pull ghcr.io/graphprotocol/indexer-service-rs:latest -2. **Indexer Service** +# TAP Agent +docker pull ghcr.io/graphprotocol/indexer-tap-agent:latest +``` - - Fully replace your current configuration with the [new Indexer Service rs](https://github.com/graphprotocol/indexer-rs). It's recommend that you use the [container image](https://github.com/orgs/graphprotocol/packages?repo_name=indexer-rs). - - Like the older version, you can scale Indexer Service horizontally easily. It is still stateless. +### Migration Steps -3. **TAP Agent** +#### 1. Update Indexer Agent - - Run _one_ single instance of [TAP Agent](https://github.com/graphprotocol/indexer-rs) at all times. It's recommend that you use the [container image](https://github.com/orgs/graphprotocol/packages?repo_name=indexer-rs). +- Continue using your existing `indexer-agent` +- Add the `--tap-subgraph-endpoint` argument to enable TAP functionality and RAV redemption +- Example: `--tap-subgraph-endpoint https://api.thegraph.com/subgraphs/name/graphprotocol/tap-mainnet` -4. **Configure Indexer Service and TAP Agent** +#### 2. Replace Indexer Service - Configuration is a TOML file shared between `indexer-service` and `tap-agent`, supplied with the argument `--config /path/to/config.toml`. +- Fully replace your TypeScript indexer-service with `indexer-service-rs` +- The new service is stateless and can be scaled horizontally +- Use the same database as your existing setup - Check out the full [configuration](https://github.com/graphprotocol/indexer-rs/blob/main/config/maximal-config-example.toml) and the [default values](https://github.com/graphprotocol/indexer-rs/blob/main/config/default_values.toml) +#### 3. Deploy TAP Agent -For minimal configuration, use the following template: +- Run exactly **one instance** of `indexer-tap-agent` +- This component manages receipt aggregation and RAV creation +- It must have access to the same database as other indexer components -```bash -# You will have to change *all* the values below to match your setup. -# -# Some of the config below are global graph network values, which you can find here: -# -# -# Pro tip: if you need to load some values from the environment into this config, you -# can overwrite with environment variables. For example, the following can be replaced -# by [PREFIX]_DATABASE_POSTGRESURL, where PREFIX can be `INDEXER_SERVICE` or `TAP_AGENT`: -# -# [database] -# postgres_url = "postgresql://indexer:${POSTGRES_PASSWORD}@postgres:5432/indexer_components_0" +#### 4. Configuration + +Both `indexer-service-rs` and `indexer-tap-agent` share a TOML configuration file. Create a configuration file and pass it with `--config /path/to/config.toml`. + +##### Minimal Configuration Example + +```toml +# Essential configuration for indexer-rs components +# All values below must be updated to match your setup [indexer] indexer_address = "0x1111111111111111111111111111111111111111" -operator_mnemonic = "celery smart tip orange scare van steel radio dragon joy alarm crane" +operator_mnemonic = "your twelve word mnemonic phrase here ..." [database] -# The URL of the Postgres database used for the indexer components. The same database -# that is used by the `indexer-agent`. It is expected that `indexer-agent` will create -# the necessary tables. -postgres_url = "postgres://postgres@postgres:5432/postgres" +# Use the same database as your indexer-agent +postgres_url = "postgresql://user:password@localhost:5432/indexer_db" [graph_node] -# URL to your graph-node's query endpoint -query_url = "" -# URL to your graph-node's status endpoint -status_url = "" +# Your graph-node endpoints +query_url = "http://graph-node:8000" +status_url = "http://graph-node:8000/graphql" [subgraphs.network] -# Query URL for the Graph Network Subgraph. -query_url = "" -# Optional, deployment to look for in the local `graph-node`, if locally indexed. -# Locally indexing the Subgraph is recommended. -# NOTE: Use `query_url` or `deployment_id` only -deployment_id = "Qmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +# The Graph Network Subgraph (use query_url OR deployment_id, not both) +query_url = "https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-arbitrum" +# deployment_id = "QmUVskWrz1ZiQZ76AtyhcfFDEH1ELnRpoyEhVL8p6NFTbR" [subgraphs.escrow] -# Query URL for the Escrow Subgraph. -query_url = "" -# Optional, deployment to look for in the local `graph-node`, if locally indexed. -# Locally indexing the Subgraph is recommended. -# NOTE: Use `query_url` or `deployment_id` only -deployment_id = "Qmaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +# TAP Escrow Subgraph (use query_url OR deployment_id, not both) +query_url = "https://api.thegraph.com/subgraphs/name/graphprotocol/tap-arbitrum-one" +# deployment_id = "QmPcbDomKwfsmVBNbvncU8gdWTvUiH9zVFYxDMc5ohpjvU" [blockchain] -# The chain ID of the network that the graph network is running on -chain_id = 1337 -# Contract address of TAP's receipt aggregate voucher (RAV) verifier. -receipts_verifier_address = "0x2222222222222222222222222222222222222222" - -######################################## -# Specific configurations to tap-agent # -######################################## +# For Arbitrum mainnet +chain_id = 42161 +receipts_verifier_address = "0x33f9E93266ce0E108fc85DdE2f71dab555A0F05a" + +# For Arbitrum Sepolia testnet, use: +# chain_id = 421614 +# receipts_verifier_address = "0xfC24cE7a4428A6B89B52645243662A02BA734ECF" + [tap] -# This is the amount of fees you are willing to risk at any given time. For ex. -# if the sender stops supplying RAVs for long enough and the fees exceed this -# amount, the indexer-service will stop accepting queries from the sender -# until the fees are aggregated. -# NOTE: Use strings for decimal values to prevent rounding errors -# e.g: -# max_amount_willing_to_lose_grt = "0.1" -max_amount_willing_to_lose_grt = 20 +# Maximum GRT amount to risk before requiring aggregation +# Use string format to prevent rounding errors +max_amount_willing_to_lose_grt = "0.1" [tap.sender_aggregator_endpoints] -# Key-Value of all senders and their aggregator endpoints -# This one below is for the E&N testnet gateway for example. -0xDDE4cfFd3D9052A9cb618fC05a1Cd02be1f2F467 = "https://tap-aggregator.network.thegraph.com" +# Gateway endpoints for RAV aggregation +# Mainnet +"0xDDE4cfFd3D9052A9cb618fC05a1Cd02be1f2F467" = "https://tap-aggregator.network.thegraph.com" + +# For testnet, use: +# "0xC3dDf37906724732FfD748057FEBe23379b0710D" = "https://tap-aggregator.testnet.thegraph.com" ``` -Notes: +##### Environment Variable Overrides + +You can override any configuration value using environment variables: + +```bash +# Pattern: [PREFIX]__[SECTION]__[KEY] +# PREFIX can be INDEXER_SERVICE or TAP_AGENT + +# Examples: +export INDEXER_SERVICE__DATABASE__POSTGRES_URL="postgresql://..." +export TAP_AGENT__TAP__MAX_AMOUNT_WILLING_TO_LOSE_GRT="0.5" +export INDEXER_SERVICE__BLOCKCHAIN__RECEIPTS_VERIFIER_ADDRESS="0x..." +``` -- Values for `tap.sender_aggregator_endpoints` can be found in the [gateway section](/indexing/tap/#gateway). -- Values for `blockchain.receipts_verifier_address` must be used accordingly to the [Blockchain addresses section](/indexing/tap/#contracts) using the appropriate chain id. +##### Advanced Configuration -**Log Level** +For all configuration options, see: -- You can set the log level by using the `RUST_LOG` environment variable. -- It’s recommended that you set it to `RUST_LOG=indexer_tap_agent=debug,info`. +- [Full configuration example](https://github.com/graphprotocol/indexer-rs/blob/main/crates/config/maximal-config-example.toml) +- [Default values](https://github.com/graphprotocol/indexer-rs/blob/main/crates/config/default_values.toml) + +### Logging + +Set the log level using the `RUST_LOG` environment variable: + +```bash +# Recommended for production +export RUST_LOG=indexer_service=info,indexer_tap_agent=info + +# For debugging +export RUST_LOG=indexer_service=debug,indexer_tap_agent=debug + +# TAP-specific debugging +export RUST_LOG=indexer_tap_agent=debug,info +``` ## Monitoring ### Metrics -All components expose the port 7300 to be queried by prometheus. +All components expose Prometheus metrics on port 7300: + +- `http://indexer-service:7300/metrics` +- `http://tap-agent:7300/metrics` + +Key metrics to monitor: + +- **Receipt Processing**: Track receipt validation, aggregation rates, and failures +- **RAV Creation**: Monitor RAV request success/failure rates +- **Unaggregated Fees**: Ensure fees stay below `max_amount_willing_to_lose_grt` +- **Sender Balances**: Track escrow account balances and obligations ### Grafana Dashboard -You can download [Grafana Dashboard](https://github.com/graphprotocol/indexer-rs/blob/main/docs/dashboard.json) and import. +Import the [official Grafana dashboard](https://github.com/graphprotocol/indexer-rs/blob/main/docs/dashboard.json) for comprehensive monitoring of: + +- TAP receipt flow and aggregation status +- RAV creation and redemption lifecycle +- System performance and error rates +- Database query performance + +### Troubleshooting + +Common issues and solutions: + +1. **RAV requests failing**: + - Check aggregator endpoint connectivity + - Verify sender configuration in `tap.sender_aggregator_endpoints` + - Review debug logs for specific error messages + +2. **Receipts not aggregating**: + - Ensure `tap-agent` is running (only one instance) + - Check database connectivity + - Verify `max_amount_willing_to_lose_grt` is not too high + +3. **High unaggregated fees**: + - Lower `max_amount_willing_to_lose_grt` to trigger more frequent aggregation + - Check if specific senders are having aggregation issues + - Monitor the Grafana dashboard for aggregation patterns + +## Deployment Options + +### Docker Compose + +Example compose configuration for both services: + +```yaml +version: '3.8' + +services: + indexer-service: + image: ghcr.io/graphprotocol/indexer-service-rs:latest + ports: + - '7600:7600' # Service port + - '7300:7300' # Metrics port + volumes: + - ./config.toml:/config.toml + command: ['--config', '/config.toml'] + environment: + - RUST_LOG=indexer_service=info + restart: unless-stopped + + tap-agent: + image: ghcr.io/graphprotocol/indexer-tap-agent:latest + ports: + - '7301:7300' # Metrics port (different host port) + volumes: + - ./config.toml:/config.toml + command: ['--config', '/config.toml'] + environment: + - RUST_LOG=indexer_tap_agent=info + restart: unless-stopped +``` + +### Kubernetes + +For Kubernetes deployments, see the [Graph Launchpad charts](https://github.com/graphops/launchpad-charts/tree/main/charts/graph-network-indexer) which include: + +- Helm charts for both services +- ConfigMap templates for configuration +- Service and ingress definitions +- Prometheus ServiceMonitor resources + +## Best Practices + +1. **Database Performance**: + - Ensure your PostgreSQL instance has adequate resources + - Monitor query performance through metrics + - Regular maintenance of receipt tables + +2. **High Availability**: + - Run multiple `indexer-service-rs` instances behind a load balancer + - Keep `tap-agent` as a single instance with proper monitoring + - Use database connection pooling + +3. **Security**: + - Store operator mnemonic securely (use environment variables) + - Restrict database access to indexer components only + - Monitor for unusual receipt patterns + +4. **Capacity Planning**: + - Monitor receipt growth rate + - Plan database storage accordingly + - Set appropriate `max_amount_willing_to_lose_grt` based on query volume -### Launchpad +## مصادر إضافية -Currently, there is a WIP version of `indexer-rs` and `tap-agent` that can be found [here](https://github.com/graphops/launchpad-charts/tree/main/charts/graph-network-indexer) +- [indexer-rs Repository](https://github.com/graphprotocol/indexer-rs) +- [TAP Core Documentation](https://docs.rs/tap_core/latest/tap_core/) +- [The Graph Discord](https://thegraph.com/discord) - Get help in the #indexers channel +- [Support](https://github.com/graphprotocol/indexer-rs/issues) - Report issues or get help diff --git a/website/src/pages/ar/indexing/tooling/graph-node.mdx b/website/src/pages/ar/indexing/tooling/graph-node.mdx index edde8a157fd3..56cea09618e3 100644 --- a/website/src/pages/ar/indexing/tooling/graph-node.mdx +++ b/website/src/pages/ar/indexing/tooling/graph-node.mdx @@ -26,7 +26,7 @@ While some Subgraphs may just require a full node, some may have indexing featur ### IPFS Nodes -Subgraph deployment metadata is stored on the IPFS network. The Graph Node primarily accesses the IPFS node during Subgraph deployment to fetch the Subgraph manifest and all linked files. Network indexers do not need to host their own IPFS node. An IPFS node for the network is hosted at https://ipfs.network.thegraph.com. +Subgraph deployment metadata is stored on the IPFS network. The Graph Node primarily accesses the IPFS node during Subgraph deployment to fetch the Subgraph manifest and all linked files. Network indexers do not need to host their own IPFS node. An IPFS node for the network is hosted at https://ipfs.thegraph.com. ### Prometheus metrics server @@ -66,7 +66,7 @@ createdb graph-node cargo run -p graph-node --release -- \ --postgres-url postgresql://[USERNAME]:[PASSWORD]@localhost:5432/graph-node \ --ethereum-rpc [NETWORK_NAME]:[URL] \ - --ipfs https://ipfs.network.thegraph.com + --ipfs https://ipfs.thegraph.com ``` ### Getting started with Kubernetes @@ -77,15 +77,20 @@ A complete Kubernetes example configuration can be found in the [indexer reposit When it is running Graph Node exposes the following ports: -| Port | Purpose | Routes | CLI Argument | Environment Variable | -| --- | --- | --- | --- | --- | -| 8000 | GraphQL HTTP server
(for Subgraph queries) | /subgraphs/id/...
/subgraphs/name/.../... | \--http-port | - | -| 8001 | GraphQL WS
(for Subgraph subscriptions) | /subgraphs/id/...
/subgraphs/name/.../... | \--ws-port | - | -| 8020 | JSON-RPC
(for managing deployments) | / | \--admin-port | - | -| 8030 | Subgraph indexing status API | /graphql | \--index-node-port | - | -| 8040 | Prometheus metrics | /metrics | \--metrics-port | - | - -> **Important**: Be careful about exposing ports publicly - **administration ports** should be kept locked down. This includes the the Graph Node JSON-RPC endpoint. +| Port | Purpose | Routes | CLI Argument | Environment Variable | +| ---- | ----------------------------------------------- | ---------------------------------------------- | ------------------ | -------------------- | +| 8000 | GraphQL HTTP server
(for Subgraph queries) | /subgraphs/id/...
/subgraphs/name/.../... | \--http-port | - | +| 8001 | GraphQL WS
(for Subgraph subscriptions) | /subgraphs/id/...
/subgraphs/name/.../... | \--ws-port | - | +| 8020 | JSON-RPC
(for managing deployments) | / | \--admin-port | - | +| 8030 | Subgraph indexing status API | /graphql | \--index-node-port | - | +| 8040 | Prometheus metrics | /metrics | \--metrics-port | - | + +> **WARNING: Never expose Graph Node's administrative ports to the public**. +> +> - Exposing Graph Node's internal ports can lead to a full system compromise. +> - These ports must remain **private**: JSON-RPC Admin endpoint, Indexing Status API, and PostgreSQL. +> - Do not expose 8000 (GraphQL HTTP) and 8001 (GraphQL WebSocket) directly to the internet. Even though these are used for GraphQL queries, they should ideally be proxied though `indexer-agent` and served behind a production-grade proxy. +> - Lock everything else down with firewalls or private networks. ## Advanced Graph Node configuration @@ -330,7 +335,7 @@ Database tables that store entities seem to generally come in two varieties: 'tr For account-like tables, `graph-node` can generate queries that take advantage of details of how Postgres ends up storing data with such a high rate of change, namely that all of the versions for recent blocks are in a small subsection of the overall storage for such a table. -The command `graphman stats show shows, for each entity type/table in a deployment, how many distinct entities, and how many entity versions each table contains. That data is based on Postgres-internal estimates, and is therefore necessarily imprecise, and can be off by an order of magnitude. A `-1` in the `entities` column means that Postgres believes that all rows contain a distinct entity. +The command `graphman stats show ` shows, for each entity type/table in a deployment, how many distinct entities, and how many entity versions each table contains. That data is based on Postgres-internal estimates, and is therefore necessarily imprecise, and can be off by an order of magnitude. A `-1` in the `entities` column means that Postgres believes that all rows contain a distinct entity. In general, tables where the number of distinct entities are less than 1% of the total number of rows/entity versions are good candidates for the account-like optimization. When the output of `graphman stats show` indicates that a table might benefit from this optimization, running `graphman stats show ` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> This is new functionality, which will be available in Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/ar/resources/benefits.mdx b/website/src/pages/ar/resources/benefits.mdx index 00a32f92a1a3..9c5a12012023 100644 --- a/website/src/pages/ar/resources/benefits.mdx +++ b/website/src/pages/ar/resources/benefits.mdx @@ -21,53 +21,53 @@ Here is an analysis: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Cost Comparison | Self Hosted | The Graph Network | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $0+ | $0 per month | -| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | -| Cost per query | $0 | $0 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $750+ per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $750+ | $0 | +| Cost Comparison | Self Hosted | The Graph Network | +| :--------------------------: | :-------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $0+ | $0 per month | +| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | +| Cost per query | $0 | $0 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $750+ per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Cost Comparison | Self Hosted | The Graph Network | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $500 per month | $120 per month | -| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~3,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Engineering expense | $200 per hour | Included | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $1,650+ | $120 | +| Cost Comparison | Self Hosted | The Graph Network | +| :--------------------------: | :----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $500 per month | $120 per month | +| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~3,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Engineering expense | $200 per hour | Included | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Cost Comparison | Self Hosted | The Graph Network | -| :-: | :-: | :-: | -| Monthly server cost\* | $1100 per month, per node | $0 | -| Query costs | $4000 | $1,200 per month | -| Number of nodes needed | 10 | Not applicable | -| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~30,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $11,000+ | $1,200 | +| Cost Comparison | Self Hosted | The Graph Network | +| :--------------------------: | :-----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $1100 per month, per node | $0 | +| Query costs | $4000 | $1,200 per month | +| Number of nodes needed | 10 | Not applicable | +| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~30,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $11,000+ | $1,200 | \*including costs for backup: $50-$100 per month diff --git a/website/src/pages/ar/resources/claude-mcp.mdx b/website/src/pages/ar/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/ar/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/ar/subgraphs/developing/creating/advanced.mdx b/website/src/pages/ar/subgraphs/developing/creating/advanced.mdx index c35d101f373e..d9d357e1284a 100644 --- a/website/src/pages/ar/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/ar/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## نظره عامة -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/ar/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/ar/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/ar/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/ar/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/ar/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/ar/subgraphs/developing/creating/graph-ts/api.mdx index a721f6bcd8d4..95b0e023b551 100644 --- a/website/src/pages/ar/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/ar/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| الاصدار | ملاحظات الإصدار | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| الاصدار | ملاحظات الإصدار | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### الأنواع المضمنة (Built-in) @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Looking up entities created withing a block +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### معالجة الاستدعاءات المعادة @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### البيانات الوصفية لمصدر البيانات diff --git a/website/src/pages/ar/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/ar/subgraphs/developing/creating/install-the-cli.mdx index 81469bc1837b..2f0e7f3be241 100644 --- a/website/src/pages/ar/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/ar/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/ar/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/ar/subgraphs/developing/creating/ql-schema.mdx index a9d52647e13e..0f858388b0b7 100644 --- a/website/src/pages/ar/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/ar/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica 'Null value resolved for non-null field 'name ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| النوع | الوصف | -| --- | --- | -| `Bytes` | مصفوفة Byte ، ممثلة كسلسلة سداسية عشرية. يشيع استخدامها في Ethereum hashes وعناوينه. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| النوع | الوصف | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | مصفوفة Byte ، ممثلة كسلسلة سداسية عشرية. يشيع استخدامها في Ethereum hashes وعناوينه. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums @@ -318,7 +318,7 @@ Supported language dictionaries: Supported algorithms for ordering results: -| Algorithm | Description | -| ------------- | --------------------------------------------------------------- | -| rank | استخدم جودة مطابقة استعلام النص-الكامل (0-1) لترتيب النتائج. | -| proximityRank | Similar to rank but also includes the proximity of the matches. | +| Algorithm | Description | +| ------------- | ----------------------------------------------------------------------- | +| rank | استخدم جودة مطابقة استعلام النص-الكامل (0-1) لترتيب النتائج. | +| proximityRank | Similar to rank but also includes the proximity of the matches. | diff --git a/website/src/pages/ar/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/ar/subgraphs/developing/creating/starting-your-subgraph.mdx index fa6c44e61fb2..b7d5f7168427 100644 --- a/website/src/pages/ar/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/ar/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| الاصدار | ملاحظات الإصدار | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| الاصدار | ملاحظات الإصدار | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ar/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/ar/subgraphs/developing/creating/subgraph-manifest.mdx index 29a666a8a297..18e5621893a3 100644 --- a/website/src/pages/ar/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/ar/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ dataSources: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ dataSources: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Call handlers will only trigger in one of two cases: when the function specified is called by an account other than the contract itself or when it is marked as external in Solidity and called as part of another function in the same contract. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### تعريف معالج الاستدعاء @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. The absence of a filter for a block handler will ensure that the handler is called every block. A data source can only contain one block handler for each filter type. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## كتل البدء The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| الاصدار | ملاحظات الإصدار | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| الاصدار | ملاحظات الإصدار | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ar/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/ar/subgraphs/developing/creating/unit-testing-framework.mdx index 44c9fedacb10..6eb32f6c76ea 100644 --- a/website/src/pages/ar/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/ar/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ or /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ This will run all tests in the test folder: graph test ``` -This will run a test named gravity.test.ts and/or all test inside of a folder named gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Write a Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Assuming we have the following handler function (along with two helper functions to make our life easier): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. This is an example of how that might look like: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - We're setting up our initial state and adding one custom Gravatar entity; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that gets added when the handler function is called; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. There we go - we've created our first test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interacting with Event metadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure you're code doesn't have critical logs in deployment, and you should notice right away if that were to happen. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing derived fields @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/ar/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/ar/subgraphs/developing/deploying/multiple-networks.mdx index 3b2b1bbc70ae..5c8016b18c91 100644 --- a/website/src/pages/ar/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/ar/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/ar/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/ar/subgraphs/developing/deploying/using-subgraph-studio.mdx index 1e0826bfe148..15ac3901d9fb 100644 --- a/website/src/pages/ar/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/ar/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/ar/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/ar/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 2bc0ec5f514c..e3e3a7e3d455 100644 --- a/website/src/pages/ar/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/ar/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> Jedná se o novou funkci, která bude k dispozici v uzlu Graf 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/cs/resources/benefits.mdx b/website/src/pages/cs/resources/benefits.mdx index d0b336ece33a..25868fb9baa6 100644 --- a/website/src/pages/cs/resources/benefits.mdx +++ b/website/src/pages/cs/resources/benefits.mdx @@ -21,53 +21,53 @@ Zde je analýza: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Srovnání nákladů | Vlastní hostitel | The Graph Network | -| :-: | :-: | :-: | -| Měsíční náklady na server\* | $350 měsíčně | $0 | -| Náklady na dotazování | $0+ | $0 per month | -| Inženýrský čas | $400 měsíčně | Žádné, zabudované do sítě s globálně distribuovanými indexery | -| Dotazy za měsíc | Omezeno na infra schopnosti | 100,000 (Free Plan) | -| Náklady na jeden dotaz | $0 | $0 | -| Infrastructure | Centralizovaný | Decentralizované | -| Geografická redundancy | $750+ Usd za další uzel | Zahrnuto | -| Provozuschopnost | Různé | 99.9%+ | -| Celkové měsíční náklady | $750+ | $0 | +| Srovnání nákladů | Vlastní hostitel | The Graph Network | +| :-------------------------: | :-------------------------------------: | :-----------------------------------------------------------: | +| Měsíční náklady na server\* | $350 měsíčně | $0 | +| Náklady na dotazování | $0+ | $0 per month | +| Inženýrský čas | $400 měsíčně | Žádné, zabudované do sítě s globálně distribuovanými indexery | +| Dotazy za měsíc | Omezeno na infra schopnosti | 100,000 (Free Plan) | +| Náklady na jeden dotaz | $0 | $0 | +| Infrastructure | Centralizovaný | Decentralizované | +| Geografická redundancy | $750+ Usd za další uzel | Zahrnuto | +| Provozuschopnost | Různé | 99.9%+ | +| Celkové měsíční náklady | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Srovnání nákladů | Vlastní hostitel | The Graph Network | -| :-: | :-: | :-: | -| Měsíční náklady na server\* | $350 měsíčně | $0 | -| Náklady na dotazování | $500 měsíčně | $120 per month | -| Inženýrský čas | $800 měsíčně | Žádné, zabudované do sítě s globálně distribuovanými indexery | -| Dotazy za měsíc | Omezeno na infra schopnosti | ~3,000,000 | -| Náklady na jeden dotaz | $0 | $0.00004 | -| Infrastructure | Centralizovaný | Decentralizované | -| Výdaje inženýrskou | $200 za hodinu | Zahrnuto | -| Geografická redundancy | $1,200 celkových nákladů na další uzel | Zahrnuto | -| Provozuschopnost | Různé | 99.9%+ | -| Celkové měsíční náklady | $1,650+ | $120 | +| Srovnání nákladů | Vlastní hostitel | The Graph Network | +| :-------------------------: | :----------------------------------------: | :-----------------------------------------------------------: | +| Měsíční náklady na server\* | $350 měsíčně | $0 | +| Náklady na dotazování | $500 měsíčně | $120 per month | +| Inženýrský čas | $800 měsíčně | Žádné, zabudované do sítě s globálně distribuovanými indexery | +| Dotazy za měsíc | Omezeno na infra schopnosti | ~3,000,000 | +| Náklady na jeden dotaz | $0 | $0.00002 | +| Infrastructure | Centralizovaný | Decentralizované | +| Výdaje inženýrskou | $200 za hodinu | Zahrnuto | +| Geografická redundancy | $1,200 celkových nákladů na další uzel | Zahrnuto | +| Provozuschopnost | Různé | 99.9%+ | +| Celkové měsíční náklady | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Srovnání nákladů | Vlastní hostitel | The Graph Network | -| :-: | :-: | :-: | -| Měsíční náklady na server\* | $1100 měsíčně za uzel | $0 | -| Náklady na dotazování | $4000 | $1,200 per month | -| Počet potřebných uzlů | 10 | Nepoužije se | -| Inženýrský čas | 6$, 000 nebo více měsíčně | Žádné, zabudované do sítě s globálně distribuovanými indexery | -| Dotazy za měsíc | Omezeno na infra schopnosti | ~30,000,000 | -| Náklady na jeden dotaz | $0 | $0.00004 | -| Infrastructure | Centralizovaný | Decentralizované | -| Geografická redundancy | $1,200 celkových nákladů na další uzel | Zahrnuto | -| Provozuschopnost | Různé | 99.9%+ | -| Celkové měsíční náklady | $11,000+ | $1,200 | +| Srovnání nákladů | Vlastní hostitel | The Graph Network | +| :-------------------------: | :-----------------------------------------: | :-----------------------------------------------------------: | +| Měsíční náklady na server\* | $1100 měsíčně za uzel | $0 | +| Náklady na dotazování | $4000 | $1,200 per month | +| Počet potřebných uzlů | 10 | Nepoužije se | +| Inženýrský čas | 6$, 000 nebo více měsíčně | Žádné, zabudované do sítě s globálně distribuovanými indexery | +| Dotazy za měsíc | Omezeno na infra schopnosti | ~30,000,000 | +| Náklady na jeden dotaz | $0 | $0.00002 | +| Infrastructure | Centralizovaný | Decentralizované | +| Geografická redundancy | $1,200 celkových nákladů na další uzel | Zahrnuto | +| Provozuschopnost | Různé | 99.9%+ | +| Celkové měsíční náklady | $11,000+ | $1,200 | \*včetně nákladů na zálohování: $50-$100 měsíčně diff --git a/website/src/pages/cs/resources/claude-mcp.mdx b/website/src/pages/cs/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/cs/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/cs/subgraphs/developing/creating/advanced.mdx b/website/src/pages/cs/subgraphs/developing/creating/advanced.mdx index e8db267667c0..d8eede1a9306 100644 --- a/website/src/pages/cs/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/cs/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Přehled -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -246,7 +246,7 @@ The CID of the file as a readable string can be accessed via the `dataSource` as const cid = dataSource.stringParam() ``` -Příklad +Příklad ```typescript import { json, Bytes, dataSource } from '@graphprotocol/graph-ts' @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/cs/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/cs/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/cs/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/cs/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/cs/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/cs/subgraphs/developing/creating/graph-ts/api.mdx index 87734452737d..d79b78aad4ee 100644 --- a/website/src/pages/cs/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/cs/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ Knihovna `@graphprotocol/graph-ts` poskytuje následující API: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Verze | Poznámky vydání | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Přidá ověření existence polí ve schéma při ukládání entity. | -| 0.0.7 | Přidání tříd `TransactionReceipt` a `Log` do typů Ethereum
Přidání pole `receipt` do objektu Ethereum událost | -| 0.0.6 | Přidáno pole `nonce` do objektu Ethereum Transaction
Přidáno `baseFeePerGas` do objektu Ethereum bloku | +| Verze | Poznámky vydání | +| :---: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Přidá ověření existence polí ve schéma při ukládání entity. | +| 0.0.7 | Přidání tříd `TransactionReceipt` a `Log` do typů Ethereum
Přidání pole `receipt` do objektu Ethereum událost | +| 0.0.6 | Přidáno pole `nonce` do objektu Ethereum Transaction
Přidáno `baseFeePerGas` do objektu Ethereum bloku | | 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Přidání pole `functionSignature` do objektu Ethereum SmartContractCall | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Přidání pole `input` do objektu Ethereum Transackce | +| 0.0.4 | Přidání pole `functionSignature` do objektu Ethereum SmartContractCall | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Přidání pole `input` do objektu Ethereum Transackce | ### Vestavěné typy @@ -147,7 +147,7 @@ _Math_ - `x.notEqual(y: BigInt): bool` –lze zapsat jako `x != y`. - `x.lt(y: BigInt): bool` – lze zapsat jako `x < y`. - `x.le(y: BigInt): bool` – lze zapsat jako `x <= y`. -- `x.gt(y: BigInt): bool` – lze zapsat jako `x > y`. +- `x.gt(y: BigInt): bool` – lze zapsat jako `x > y`. - `x.ge(y: BigInt): bool` – lze zapsat jako `x >= y`. - `x.neg(): BigInt` – lze zapsat jako `-x`. - `x.divDecimal(y: BigDecimal): BigDecimal` – dělí desetinným číslem, čímž získá desetinný výsledek. @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Vyhledávání entit vytvořených v rámci bloku +#### Looking up entities created within a block Od verzí `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 a `@graphprotocol/graph-cli` v0.49.0 je metoda `loadInBlock` dostupná pro všechny typy entit. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` je zde aliasován na `TransferEvent`, aby nedošlo ke konfliktu názvů s typ entity +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. Pokud má smlouva `ERC20Contract` na platformě Ethereum veřejnou funkci pouze pro čtení s názvem `symbol`, lze ji volat pomocí `.symbol()`. Pro veřejné stavové proměnné se automaticky vytvoří metoda se stejným názvem. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Zpracování vrácených volání @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ Pokud je typ hodnoty jistý, lze ji převést na [vestavěný typ](#built-in-typ | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimální) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ Pokud je typ hodnoty jistý, lze ji převést na [vestavěný typ](#built-in-typ | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimální) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimální) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Metadata zdroje dat diff --git a/website/src/pages/cs/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/cs/subgraphs/developing/creating/install-the-cli.mdx index 536b416c9465..496f4e2f0e0c 100644 --- a/website/src/pages/cs/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/cs/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/cs/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/cs/subgraphs/developing/creating/ql-schema.mdx index ddc97aeed9e9..88e11011cc22 100644 --- a/website/src/pages/cs/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/cs/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Vyřešení nulové hodnoty pro pole 'name', které není nulové ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Typ | Popis | -| --- | --- | -| `Bytes` | Pole bajtů reprezentované jako hexadecimální řetězec. Běžně se používá pro hashe a adresy Ethereum. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Typ | Popis | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Pole bajtů reprezentované jako hexadecimální řetězec. Běžně se používá pro hashe a adresy Ethereum. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums diff --git a/website/src/pages/cs/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/cs/subgraphs/developing/creating/starting-your-subgraph.mdx index a0fcb52875ca..04f1eee28246 100644 --- a/website/src/pages/cs/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/cs/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Verze | Poznámky vydání | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | +| Verze | Poznámky vydání | +| :---: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | | 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/cs/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/cs/subgraphs/developing/creating/subgraph-manifest.mdx index 6b5bae4680cd..4dd71381fb6e 100644 --- a/website/src/pages/cs/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/cs/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ Důležité položky, které je třeba v manifestu aktualizovat, jsou: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ Důležité položky, které je třeba v manifestu aktualizovat, jsou: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Obsluhy volání se spustí pouze v jednom ze dvou případů: když je zadaná funkce volána jiným účtem než samotnou smlouvou nebo když je v Solidity označena jako externí a volána jako součást jiné funkce ve stejné smlouvě. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Definice obsluhy volání @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. Protože pro obsluhu bloku neexistuje žádný filtr, zajistí, že obsluha bude volána každý blok. Zdroj dat může obsahovat pouze jednu blokovou obsluhu pro každý typ filtru. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Výchozí bloky The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Verze | Poznámky vydání | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | +| Verze | Poznámky vydání | +| :---: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | | 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/cs/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/cs/subgraphs/developing/creating/unit-testing-framework.mdx index 691624b81344..a4e6b817dd55 100644 --- a/website/src/pages/cs/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/cs/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ nebo /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ Tím se spustí všechny testy ve složce testů: test graf ``` -Spustí se test s názvem gravity.test.ts a/nebo všechny testy uvnitř složky s názvem gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh testovací gravitace graf @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Napsat jednotkový test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Předpokládejme, že máme následující obslužnou funkci (spolu se dvěma pomocnými funkcemi, které nám usnadní život): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -Nejprve musíme v projektu vytvořit testovací soubor. Toto je příklad, jak by to mohlo vypadat: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - Nastavujeme počáteční stav a přidáváme jednu vlastní entita Gravatar; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- Ujišťujeme se o stavu obchodu. Jak to funguje? - Předáváme jedinečnou kombinaci typu Entity a id. Pak zkontrolujeme konkrétní pole této entity a potvrdíme, že má hodnotu, kterou očekáváme. Toto provádíme jak pro počáteční Entitu Gravatar, kterou jsme přidali do úložiště, tak pro dvě entity Gravatar, které se přidají při volání funkce obsluhy; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. A je to tady - vytvořili jsme první test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interakce s metadaty událostí @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Zaznamenáním kritických chyb se provádění testů zastaví a vše se pokazí. Koneckonců - chceme mít jistotu, že váš kód nemá při nasazení kritické log, a pokud by se tak stalo, měli byste si toho okamžitě všimnout. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testování odvozených polí @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/cs/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/cs/subgraphs/developing/deploying/multiple-networks.mdx index e9848601ebc7..796f1de30b74 100644 --- a/website/src/pages/cs/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/cs/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/cs/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/cs/subgraphs/developing/deploying/using-subgraph-studio.mdx index 14be0175123c..01056c092ca2 100644 --- a/website/src/pages/cs/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/cs/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/cs/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/cs/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 29c75273aa17..6a3f991fa0b6 100644 --- a/website/src/pages/cs/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/cs/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` eine vollständige Zählung der Tabelle durch - das kann langsam sein, liefert aber ein genaues Maß für das Verhältnis von eindeutigen Entitäten zu den gesamten Entitätsversionen. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Entfernen von Subgraphen -> This is new functionality, which will be available in Graph Node 0.29.x - Irgendwann möchte ein Indexer vielleicht einen bestimmten Subgraph entfernen. Dies kann einfach mit `graphman drop` gemacht werden, welches einen Einsatz und alle indizierten Daten löscht. Der Einsatz kann entweder als Name eines Subgraphen, als IPFS-Hash `Qm..` oder als Datenbank-Namensraum `sgdNNN` angegeben werden. Weitere Dokumentation ist [hier](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop) verfügbar. diff --git a/website/src/pages/de/resources/benefits.mdx b/website/src/pages/de/resources/benefits.mdx index 414897ac5365..d06502287951 100644 --- a/website/src/pages/de/resources/benefits.mdx +++ b/website/src/pages/de/resources/benefits.mdx @@ -21,60 +21,59 @@ Hier ist eine Analyse: ### Niedrigere und flexiblere Kostenstruktur -Keine Verträge. Keine monatlichen Gebühren. Sie zahlen nur für die Abfragen, die Sie nutzen - mit durchschnittlichen Kosten pro Abfrage von $40 pro Million Abfragen (~$0,00004 pro Abfrage). Abfragen werden in USD abgerechnet und in GRT oder per Kreditkarte bezahlt. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Die Abfragekosten können variieren; die angegebenen Kosten sind der Durchschnitt zum Zeitpunkt der Veröffentlichung (März 2024). ## Benutzer mit geringem Volumen (weniger als 100.000 Abfragen pro Monat) -| Kostenvergleich | Selbst gehostet | The Graph Network | -| :-: | :-: | :-: | -| Monatliche Serverkosten\* | $350 pro Monat | $0 | -| Abfragekosten | $0+ | $0 pro Monat | -| Entwicklungszeit | $400 pro Monat | Keine, eingebaut in das Netzwerk mit global verteilten Indexern | -| Abfragen pro Monat | Begrenzt auf infrastrukturelle Funktionen | 100.000 (kostenloser Plan) | -| Kosten pro Abfrage | $0 | $0 | -| Infrastruktur | Zentralisiert | Dezentralisiert | -| Geografische Redundanz | $750+ pro zusätzlichem Knoten | Eingeschlossen | -| Betriebszeit | Variiert | 99.9%+ | -| Monatliche Gesamtkosten | $750+ | $0 | +| Kostenvergleich | Selbst gehostet | The Graph Network | +| :--------------------------: | :---------------------------------------: | :-------------------------------------------------------------: | +| Monatliche Serverkosten\* | $350 pro Monat | $0 | +| Abfragekosten | $0+ | $0 pro Monat | +| Entwicklungszeit | $400 pro Monat | Keine, eingebaut in das Netzwerk mit global verteilten Indexern | +| Abfragen pro Monat | Begrenzt auf infrastrukturelle Funktionen | 100.000 (kostenloser Plan) | +| Kosten pro Abfrage | $0 | $0 | +| Infrastruktur | Zentralisiert | Dezentralisiert | +| Geografische Redundanz | $750+ pro zusätzlichem Knoten | Eingeschlossen | +| Betriebszeit | Variiert | 99.9%+ | +| Monatliche Gesamtkosten | $750+ | $0 | ## Benutzer mit mittlerem Volumen (~3M Abfragen pro Monat) -| Kostenvergleich | Selbst gehostet | The Graph Network | -| :-: | :-: | :-: | -| Monatliche Serverkosten\* | $350 pro Monat | $0 | -| Abfragekosten | $500 pro Monat | $120 pro Monat | -| Entwicklungszeit | $800 pro Monat | Keine, eingebaut in das Netzwerk mit global verteilten Indexern | -| Abfragen pro Monat | Begrenzt auf infrastrukturelle Funktionen | ~3,000,000 | -| Kosten pro Abfrage | $0 | $0.00004 | -| Infrastruktur | Zentralisiert | Dezentralisiert | -| Engineering-Kosten | $200 pro Stunde | Eingeschlossen | -| Geografische Redundanz | $1,200 Gesamtkosten pro zusätzlichem Knoten | Eingeschlossen | -| Betriebszeit | Variiert | 99.9%+ | -| Monatliche Gesamtkosten | $1.650+ | $120 | +| Kostenvergleich | Selbst gehostet | The Graph Network | +| :--------------------------: | :-----------------------------------------: | :-------------------------------------------------------------: | +| Monatliche Serverkosten\* | $350 pro Monat | $0 | +| Abfragekosten | $500 pro Monat | $120 pro Monat | +| Entwicklungszeit | $800 pro Monat | Keine, eingebaut in das Netzwerk mit global verteilten Indexern | +| Abfragen pro Monat | Begrenzt auf infrastrukturelle Funktionen | ~3,000,000 | +| Kosten pro Abfrage | $0 | $0.00002 | +| Infrastruktur | Zentralisiert | Dezentralisiert | +| Engineering-Kosten | $200 pro Stunde | Eingeschlossen | +| Geografische Redundanz | $1,200 Gesamtkosten pro zusätzlichem Knoten | Eingeschlossen | +| Betriebszeit | Variiert | 99.9%+ | +| Monatliche Gesamtkosten | $1.650+ | $120 | ## Benutzer mit hohem Volumen (~30M Abfragen pro Monat) -| Kostenvergleich | Selbst gehostet | The Graph Network | -| :-: | :-: | :-: | -| Monatliche Serverkosten\* | $1100 pro Monat, pro Knoten | $0 | -| Abfragekosten | $4000 | $1,200 pro Monat | -| Anzahl der benötigten Knoten | 10 | Nicht anwendbar | -| Entwicklungszeit | $6,000 oder mehr pro Monat | Keine, eingebaut in das Netzwerk mit global verteilten Indexern | -| Abfragen pro Monat | Begrenzt auf infrastrukturelle Funktionen | ~30,000,000 | -| Kosten pro Abfrage | $0 | $0.00004 | -| Infrastruktur | Zentralisiert | Dezentralisiert | -| Geografische Redundanz | $1,200 Gesamtkosten pro zusätzlichem Knoten | Eingeschlossen | -| Betriebszeit | Variiert | 99.9%+ | -| Monatliche Gesamtkosten | $11,000+ | $1,200 | +| Kostenvergleich | Selbst gehostet | The Graph Network | +| :--------------------------: | :-----------------------------------------: | :-------------------------------------------------------------: | +| Monatliche Serverkosten\* | $1100 pro Monat, pro Knoten | $0 | +| Abfragekosten | $4000 | $1,200 pro Monat | +| Anzahl der benötigten Knoten | 10 | Nicht anwendbar | +| Entwicklungszeit | $6,000 oder mehr pro Monat | Keine, eingebaut in das Netzwerk mit global verteilten Indexern | +| Abfragen pro Monat | Begrenzt auf infrastrukturelle Funktionen | ~30,000,000 | +| Kosten pro Abfrage | $0 | $0.00002 | +| Infrastruktur | Zentralisiert | Dezentralisiert | +| Geografische Redundanz | $1,200 Gesamtkosten pro zusätzlichem Knoten | Eingeschlossen | +| Betriebszeit | Variiert | 99.9%+ | +| Monatliche Gesamtkosten | $11,000+ | $1,200 | \*einschließlich der Kosten für die Datensicherung: $50-$100 pro Monat Engineering-Zeit auf der Grundlage von 200 $ pro Stunde angenommen -Reflektiert die Kosten für den Datenkonsumenten. Für Abfragen im Rahmen des „Free Plan“ werden nach wie vor -Abfragegebühren an Indexer gezahlt. +Reflektiert die Kosten für den Datenkonsumenten. Für Abfragen im Rahmen des „Free Plan“ werden nach wie vor Abfragegebühren an Indexer gezahlt. Die geschätzten Kosten gelten nur für Ethereum Mainnet Subgraphen - die Kosten sind noch höher, wenn man selbst einen `graph-node` in anderen Netzwerken hostet. Einige Nutzer müssen ihren Subgraphen möglicherweise auf eine neue Version aktualisieren. Aufgrund der Ethereum-Gas-Gebühren kostet ein Update zum Zeitpunkt des Schreibens ~$50. Beachten Sie, dass die Gasgebühren auf [Arbitrum](/archived/arbitrum/arbitrum-faq/) wesentlich niedriger sind als im Ethereum Mainnet. diff --git a/website/src/pages/de/resources/claude-mcp.mdx b/website/src/pages/de/resources/claude-mcp.mdx new file mode 100644 index 000000000000..bc6c2283cde1 --- /dev/null +++ b/website/src/pages/de/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Voraussetzungen + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/de/subgraphs/developing/creating/advanced.mdx b/website/src/pages/de/subgraphs/developing/creating/advanced.mdx index e1245dcae9a8..f875e1c2644b 100644 --- a/website/src/pages/de/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/de/subgraphs/developing/creating/advanced.mdx @@ -4,15 +4,15 @@ title: Erweiterte Subgraph-Funktionen ## Überblick -Fügen Sie fortgeschrittene Subgraph-Funktionen hinzu und implementieren Sie sie, um Ihre Subgraphen zu verbessern. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Ab `specVersion` `0.0.4` müssen Subgraph-Funktionen explizit im Abschnitt `features` auf der obersten Ebene der Manifestdatei unter Verwendung ihres `camelCase`-Namens deklariert werden, wie in der folgenden Tabelle aufgeführt: -| Funktion | Name | -| ------------------------------------------------- | ---------------- | -| [Non-fatal errors](#non-fatal-errors) | `nonFatalErrors` | -| [Volltextsuche](#defining-fulltext-search-fields) | "Volltextsuche" | -| [Grafting](#grafting-onto-existing-subgraphs) | `grafting` | +| Funktion | Name | +| ----------------------------------------------------- | ---------------- | +| [Non-fatal errors](#non-fatal-errors) | `nonFatalErrors` | +| [Volltextsuche](#defining-fulltext-search-fields) | "Volltextsuche" | +| [Grafting](#grafting-onto-existing-subgraphs) | `grafting` | Wenn ein Subgraph beispielsweise die Funktionen **Volltextsuche** und **Nicht fatale Fehler** verwendet, sollte das Feld „Features“ im Manifest lauten: @@ -173,17 +173,17 @@ Ursprüngliche kombinierte Einheit: ```graphql type Token @entity { - id: ID! - tokenID: BigInt! - tokenURI: String! - externalURL: String! - ipfsURI: String! - image: String! - name: String! - description: String! - type: String! - updatedAtTimestamp: BigInt - owner: User! + id: ID! + tokenID: BigInt! + tokenURI: String! + externalURL: String! + ipfsURI: String! + image: String! + name: String! + description: String! + type: String! + updatedAtTimestamp: BigInt + owner: User! } ``` @@ -191,20 +191,20 @@ Neu, geteilte Einheit: ```graphql type Token @entity { - id: ID! - tokenID: BigInt! - tokenURI: String! - ipfsURI: TokenMetadata - updatedAtTimestamp: BigInt - owner: String! + id: ID! + tokenID: BigInt! + tokenURI: String! + ipfsURI: TokenMetadata + updatedAtTimestamp: BigInt + owner: String! } type TokenMetadata @entity { - id: ID! - image: String! - externalURL: String! - name: String! - description: String! + id: ID! + image: String! + externalURL: String! + name: String! + description: String! } ``` @@ -456,8 +456,6 @@ In dieser Konfiguration: ## Deklariert eth_call -> Hinweis: Dies ist eine experimentelle Funktion, die derzeit noch nicht in einer stabilen Graph Node-Version verfügbar ist. Sie können sie nur in Subgraph Studio oder Ihrem selbst gehosteten Knoten verwenden. - Deklarative `eth_calls` sind eine wertvolle Funktion von Subgraph, die es erlaubt, `eth_calls` im Voraus auszuführen, so dass `graph-node` sie parallel ausführen kann. Diese Funktion hat die folgenden Aufgaben: @@ -528,7 +526,7 @@ subgraph.yaml„ unter Verwendung von “event.params ```yaml Aufrufe: - - ERC20DecimalsToken0: ERC20[event.params.token0].decimals() + - ERC20DecimalsToken0: ERC20[event.params.token0].decimals() ``` ### Grafting auf bestehende Subgraphen @@ -542,8 +540,8 @@ Ein Subgraph wird auf einen Basis-Subgraph gepfropft, wenn das Subgraph-Manifest ```yaml Beschreibung: ... graft: - base: Qm ... # Subgraph ID des Basis-Subgraphen - block: 7345624 # Blocknummer + base: Qm ... # Subgraph ID des Basis-Subgraphen + block: 7345624 # Blocknummer ``` Wenn ein Subgraph, dessen Manifest einen „graft“-Block enthält, bereitgestellt wird, kopiert Graph Node die Daten des ‚Basis‘-Subgraphen bis einschließlich des angegebenen „Blocks“ und fährt dann mit der Indizierung des neuen Subgraphen ab diesem Block fort. Der Basis-Subgraph muss auf der Ziel-Graph-Node-Instanz existieren und mindestens bis zum angegebenen Block indexiert sein. Aufgrund dieser Einschränkung sollte Grafting nur während der Entwicklung oder in Notfällen verwendet werden, um die Erstellung eines äquivalenten, nicht gepfropften Subgraphen zu beschleunigen. diff --git a/website/src/pages/de/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/de/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 9dace9f39aaf..89111c270bba 100644 --- a/website/src/pages/de/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/de/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch-Änderungen + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Geringfügige Änderungen diff --git a/website/src/pages/de/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/de/subgraphs/developing/creating/graph-ts/api.mdx index c56511a3a35c..06a1271927c3 100644 --- a/website/src/pages/de/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/de/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ Die Bibliothek `@graphprotocol/graph-ts` bietet die folgenden APIs: Die `apiVersion` im Subgraph-Manifest gibt die Mapping-API-Version an, die von Graph Node für einen bestimmten Subgraph ausgeführt wird. -| Version | Hinweise zur Version | -| :-: | --- | -| 0.0.9 | Fügt neue Host-Funktionen hinzu [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Fügt eine Validierung für das Vorhandensein von Feldern im Schema beim Speichern einer Entität hinzu. | -| 0.0.7 | Klassen `TransactionReceipt` und `Log` zu den Ethereum-Typen hinzugefügt<br />Feld `Receipt` zum Ethereum Event Objekt hinzugefügt | -| 0.0.6 | Feld `nonce` zum Ethereum Transaction Objekt hinzugefügt<br />`baseFeePerGas` zum Ethereum Block Objekt hinzugefügt | -| 0.0.5 | AssemblyScript wurde auf Version 0.19.10 aktualisiert (dies beinhaltet einige Änderungen, siehe [`Migrationsanleitung`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` umbenannt in `ethereum.transaction.gasLimit` | -| 0.0.4 | Feld `functionSignature` zum Ethereum SmartContractCall Objekt hinzugefügt | -| 0.0.3 | Feld `von` zum Ethereum Call Objekt hinzugefügt<br />`ethereum.call.address` umbenannt in `ethereum.call.to` | -| 0.0.2 | Feld „Eingabe“ zum Ethereum-Transaktionsobjekt hinzugefügt | +| Version | Hinweise zur Version | +| :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Fügt neue Host-Funktionen hinzu [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Fügt eine Validierung für das Vorhandensein von Feldern im Schema beim Speichern einer Entität hinzu. | +| 0.0.7 | Klassen `TransactionReceipt` und `Log` zu den Ethereum-Typen hinzugefügt<br />Feld `Receipt` zum Ethereum Event Objekt hinzugefügt | +| 0.0.6 | Feld `nonce` zum Ethereum Transaction Objekt hinzugefügt<br />`baseFeePerGas` zum Ethereum Block Objekt hinzugefügt | +| 0.0.5 | AssemblyScript wurde auf Version 0.19.10 aktualisiert (dies beinhaltet einige Änderungen, siehe [`Migrationsanleitung`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` umbenannt in `ethereum.transaction.gasLimit` | +| 0.0.4 | Feld `functionSignature` zum Ethereum SmartContractCall Objekt hinzugefügt | +| 0.0.3 | Feld `von` zum Ethereum Call Objekt hinzugefügt<br />`ethereum.call.address` umbenannt in `ethereum.call.to` | +| 0.0.2 | Feld „Eingabe“ zum Ethereum-Transaktionsobjekt hinzugefügt | ### Integrierte Typen @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Suchen nach Entitäten, die innerhalb eines Blocks erstellt wurden +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Jeder andere Vertrag, der Teil des Subgraphen ist, kann aus dem generierten Code importiert werden und an eine gültige Adresse gebunden werden. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Bearbeitung rückgängig gemachter Anrufe @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Metadaten der Datenquelle diff --git a/website/src/pages/de/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/de/subgraphs/developing/creating/install-the-cli.mdx index bb9fe36ade05..92cd6f979a35 100644 --- a/website/src/pages/de/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/de/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - Die Graph CLI stützt sich auf einen öffentlichen RPC-Endpunkt. Gelegentliche Fehler sind zwar zu erwarten, aber durch Wiederholungen lässt sich dieses Problem in der Regel beheben. Bei anhaltenden Fehlern sollten Sie eine lokale ABI verwenden. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph dataSources" sind Schlüsselkomponenten von Subgraphs. Sie definieren die Datenquellen, die der Subgraph indiziert und verarbeitet. Eine „Datenquelle“ gibt an, auf welche Smart Contracts zu hören ist, welche Ereignisse zu verarbeiten sind und wie sie zu behandeln sind. -Neuere Versionen der Graph CLI unterstützen das Hinzufügen neuer Datenquellen zu einem bestehenden Subgraphen durch den Befehl „Graph add“: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Optionen: #### Besonderheiten -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/de/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/de/subgraphs/developing/creating/ql-schema.mdx index 40df6bfff105..2911b9cbb253 100644 --- a/website/src/pages/de/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/de/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Type | Beschreibung | -| --- | --- | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Type | Beschreibung | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums diff --git a/website/src/pages/de/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/de/subgraphs/developing/creating/starting-your-subgraph.mdx index c198baf1e1f1..a2f39804cff0 100644 --- a/website/src/pages/de/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/de/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Starten Sie den Prozess und erstellen Sie einen Subgraphen, der Ihren Anforderun Erkunden Sie zusätzliche [Ressourcen für APIs](/subgraphs/developing/creating/graph-ts/README/) und führen Sie lokale Tests mit [Matchstick](/subgraphs/developing/creating/unit-testing-framework/) durch. -| Version | Hinweise zur Version | -| :-: | --- | -| 1.2.0 | Unterstützung für [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) hinzugefügt & `eth_call` erklärt | -| 1.1.0 | Unterstützt [Timeseries & Aggregations](#timeseries-and-aggregations). Unterstützung für Typ `Int8` für `id` hinzugefügt. | -| 1.0.0 | Unterstützt die Funktion [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) zum Beschneiden von Subgraphen | -| 0.0.9 | Unterstützt `endBlock` Funktion | -| 0.0.8 | Unterstützung für die Abfrage von [Block-Handlern](/developing/creating-a-subgraph/#polling-filter) und [Initialisierungs-Handlern](/developing/creating-a-subgraph/#once-filter) hinzugefügt. | -| 0.0.7 | Unterstützung für [Dateidatenquellen](/developing/creating-a-subgraph/#file-data-sources) hinzugefügt. | -| 0.0.6 | Unterstützt schnelle [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) Berechnungsvariante. | -| 0.0.5 | Unterstützung für Event-Handler mit Zugriff auf Transaktionsbelege hinzugefügt. | -| 0.0.4 | Unterstützung für die Verwaltung von Subgraphen-Features wurde hinzugefügt. | +| Version | Hinweise zur Version | +| :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.2.0 | Unterstützung für [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) hinzugefügt & `eth_call` erklärt | +| 1.1.0 | Unterstützt [Timeseries & Aggregations](#timeseries-and-aggregations). Unterstützung für Typ `Int8` für `id` hinzugefügt. | +| 1.0.0 | Unterstützt die Funktion [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) zum Beschneiden von Subgraphen | +| 0.0.9 | Unterstützt `endBlock` Funktion | +| 0.0.8 | Unterstützung für die Abfrage von [Block-Handlern](/developing/creating-a-subgraph/#polling-filter) und [Initialisierungs-Handlern](/developing/creating-a-subgraph/#once-filter) hinzugefügt. | +| 0.0.7 | Unterstützung für [Dateidatenquellen](/developing/creating-a-subgraph/#file-data-sources) hinzugefügt. | +| 0.0.6 | Unterstützt schnelle [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) Berechnungsvariante. | +| 0.0.5 | Unterstützung für Event-Handler mit Zugriff auf Transaktionsbelege hinzugefügt. | +| 0.0.4 | Unterstützung für die Verwaltung von Subgraphen-Features wurde hinzugefügt. | diff --git a/website/src/pages/de/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/de/subgraphs/developing/creating/subgraph-manifest.mdx index b5f88df96a89..d3b265ec3172 100644 --- a/website/src/pages/de/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/de/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ Die wichtigen Einträge, die für das Manifest aktualisiert werden müssen, sind - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ Die wichtigen Einträge, die für das Manifest aktualisiert werden müssen, sind - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. Ein einzelner Subgraph kann Daten von mehreren Smart Contracts indizieren. Fügen Sie dem Array „DataSources“ einen Eintrag für jeden Vertrag hinzu, von dem Daten indiziert werden müssen. @@ -153,7 +153,7 @@ Während Ereignisse eine effektive Möglichkeit bieten, relevante Änderungen am Call-Handler werden nur in einem von zwei Fällen ausgelöst: wenn die angegebene Funktion von einem anderen Konto als dem Vertrag selbst aufgerufen wird oder wenn sie in Solidity als extern markiert ist und als Teil einer anderen Funktion im selben Vertrag aufgerufen wird. -> **Hinweis:** Call-Handler sind derzeit von der Parity-Tracing-API abhängig. Bestimmte Netzwerke, wie die BNB-Kette und Arbitrum, unterstützen diese API nicht. Wenn ein Subgraph, der eines dieser Netzwerke indiziert, einen oder mehrere Call-Handler enthält, wird er nicht mit der Synchronisierung beginnen. Subgraph-Entwickler sollten stattdessen Event-Handler verwenden. Diese sind weitaus leistungsfähiger als Call-Handler und werden von jedem evm-Netzwerk unterstützt. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Defining a Call Handler @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. The absence of a filter for a block handler will ensure that the handler is called every block. A data source can only contain one block handler for each filter type. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Start Blocks Der „Startblock“ ist eine optionale Einstellung, mit der Sie festlegen können, ab welchem Block in der Kette die Datenquelle mit der Indizierung beginnen soll. Die Einstellung des Startblocks ermöglicht es der Datenquelle, potenziell Millionen von Blöcken zu überspringen, die irrelevant sind. Typischerweise wird ein Subgraph-Entwickler `startBlock` auf den Block setzen, in dem der Smart Contract der Datenquelle erstellt wurde. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Veröffentlichungen -| Version | Hinweise zur Version | -| :-: | --- | -| 1.3.0 | Unterstützung für [Subgraph Composition](/cookbook/subgraph-composition-three-sources) hinzugefügt | -| 1.2.0 | Unterstützung für [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) hinzugefügt & `eth_call` erklärt | -| 1.1.0 | Unterstützt [Zeitreihen & Aggregationen](/developing/creating/advanced/#timeseries-and-aggregations). Unterstützung für den Typ `Int8` für `id` hinzugefügt. | -| 1.0.0 | Unterstützt die Funktion [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) zum Beschneiden von Subgraphen | -| 0.0.9 | Unterstützt `endBlock` Funktion | -| 0.0.8 | Unterstützung für das Polling von [Block-Handlern](/entwickeln/erstellen/subgraph-manifest/#polling-filter) und [Initialisierungs-Handlern](/entwickeln/erstellen/subgraph-manifest/#once-filter) hinzugefügt. | -| 0.0.7 | Unterstützung für [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources) hinzugefügt. | -| 0.0.6 | Unterstützt schnelle [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) Berechnungsvariante. | -| 0.0.5 | Unterstützung für Event-Handler mit Zugriff auf Transaktionsbelege hinzugefügt. | -| 0.0.4 | Unterstützung für die Verwaltung von Subgraphen-Features wurde hinzugefügt. | +| Version | Hinweise zur Version | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Unterstützung für [Subgraph Composition](/cookbook/subgraph-composition-three-sources) hinzugefügt | +| 1.2.0 | Unterstützung für [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) hinzugefügt & `eth_call` erklärt | +| 1.1.0 | Unterstützt [Zeitreihen & Aggregationen](/developing/creating/advanced/#timeseries-and-aggregations). Unterstützung für den Typ `Int8` für `id` hinzugefügt. | +| 1.0.0 | Unterstützt die Funktion [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) zum Beschneiden von Subgraphen | +| 0.0.9 | Unterstützt `endBlock` Funktion | +| 0.0.8 | Unterstützung für das Polling von [Block-Handlern](/entwickeln/erstellen/subgraph-manifest/#polling-filter) und [Initialisierungs-Handlern](/entwickeln/erstellen/subgraph-manifest/#once-filter) hinzugefügt. | +| 0.0.7 | Unterstützung für [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources) hinzugefügt. | +| 0.0.6 | Unterstützt schnelle [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) Berechnungsvariante. | +| 0.0.5 | Unterstützung für Event-Handler mit Zugriff auf Transaktionsbelege hinzugefügt. | +| 0.0.4 | Unterstützung für die Verwaltung von Subgraphen-Features wurde hinzugefügt. | diff --git a/website/src/pages/de/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/de/subgraphs/developing/creating/unit-testing-framework.mdx index 357617cfce50..5695774565ed 100644 --- a/website/src/pages/de/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/de/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ oder /node_modules/gluegun/build/index.js:13 throw up; ``` -Bitte stellen Sie sicher, dass Sie eine neuere Version von Node.js verwenden. graph-cli unterstützt **v10.19.0** nicht mehr, und das ist immer noch die Standardversion für neue Ubuntu-Images auf WSL. Zum Beispiel ist Matchstick bestätigt, dass es auf WSL mit **v18.1.0** funktioniert, Sie können entweder über **nvm** darauf umsteigen oder wenn Sie Ihr globales Node.js aktualisieren. Vergessen Sie nicht, `node_modules` zu löschen und `npm install` erneut auszuführen, nachdem Sie Ihr nodejs aktualisiert haben! Stellen Sie dann sicher, dass Sie **libpq** installiert haben, indem Sie +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ Dadurch werden alle Tests im Testordner ausgeführt: graph test ``` -Dies führt einen Test namens gravity.test.ts und/oder alle Tests in einem Ordner namens gravity aus: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -155,7 +155,7 @@ Also you can check out the video series on ["How to use Matchstick to write unit ## Struktur der Tests -WICHTIG: Die unten beschriebene Teststruktur hängt von der Version `matchstick-as` >=0.5.0\*\*\_ ab. +WICHTIG: Die unten beschriebene Teststruktur hängt von der Version `matchstick-as` >=0.5.0\*\*_ ab. ### describe() @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Write a Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Assuming we have the following handler function (along with two helper functions to make our life easier): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. This is an example of how that might look like: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ Das ist eine Menge zum Auspacken! Zunächst einmal ist es wichtig zu wissen, das - Wir richten unseren Ausgangszustand ein und fügen eine benutzerdefinierte Gravatar-Entität hinzu; - Wir definieren zwei „NewGravatar“-Ereignisobjekte zusammen mit ihren Daten, indem wir die Funktion „CreateNewGravatarEvent()“ verwenden; - Wir rufen Handler-Methoden für diese Ereignisse auf - „handleNewGravatars()“ - und übergeben die Liste unserer eigenen Ereignisse; -- Wir behaupten den Zustand des Ladens. Wie funktioniert das? - Wir übergeben eine eindeutige Kombination aus Entity-Typ und ID. Dann überprüfen wir ein bestimmtes Feld dieser Entität und stellen sicher, dass es den erwarteten Wert hat. Wir tun dies sowohl für die ursprüngliche Gravatar-Entität, die wir dem Speicher hinzugefügt haben, als auch für die beiden Gravatar-Entitäten, die hinzugefügt werden, wenn die Handler-Funktion aufgerufen wird; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - Und schließlich bereinigen wir den Speicher mit `clearStore()`, damit unser nächster Test mit einem frischen und leeren Speicherobjekt beginnen kann. Wir können so viele Testblöcke definieren, wie wir wollen. There we go - we've created our first test! 👏 @@ -728,12 +728,12 @@ import { addMetadata, assert, createMockedFunction, clearStore, test } from 'mat import { Gravity } from '../../generated/Gravity/Gravity' import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts' -let contractAddress = Address.fromString('0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7') +let contractAddress = Address. fromString('0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7') let expectedResult = Address.fromString('0x90cBa2Bbb19ecc291A12066Fd8329D65FA1f1947') -let bigIntParam = BigInt.fromString('1234') +let bigIntParam = BigInt. fromString('1234') createMockedFunction(contractAddress, 'gravatarToOwner', 'gravatarToOwner(uint256):(address)') - .withArgs([ethereum.Value.fromSignedBigInt(bigIntParam)]) - .returns([ethereum.Value.fromAddress(Address.fromString('0x90cBa2Bbb19ecc291A12066Fd8329D65FA1f1947'))]) +.withArgs([ethereum.Value.fromSignedBigInt(bigIntParam)]) +.returns([ethereum.Value.fromAddress(Address. fromString('0x90cBa2Bbb19ecc291A12066Fd8329D65FA1f1947'))]) let gravity = Gravity.bind(contractAddress) let result = gravity.gravatarToOwner(bigIntParam) @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interacting with Event metadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Die Protokollierung kritischer Fehler wird die Ausführung der Tests stoppen und alles in die Luft jagen. Schließlich wollen wir sicherstellen, dass Ihr Code bei der Bereitstellung keine kritischen Protokolle enthält, und Sie sollten sofort bemerken, wenn das passiert. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing derived fields @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () =&gt; { Mit **Matchstick** können die Entwickler von Subgraph ein Skript ausführen, das die Testabdeckung der geschriebenen Unit-Tests berechnet. -Das Testabdeckungswerkzeug nimmt die kompilierten Test-Binärdateien „wasm“ und konvertiert sie in ‚wat‘-Dateien, die dann leicht inspiziert werden können, um zu sehen, ob die in „subgraph.yaml“ definierten Handler aufgerufen wurden oder nicht. Da die Codeabdeckung (und das Testen als Ganzes) in AssemblyScript und WebAssembly noch in den Kinderschuhen steckt, kann **Matchstick** nicht auf Zweigabdeckung prüfen. Stattdessen verlassen wir uns auf die Behauptung, dass, wenn ein bestimmter Handler aufgerufen wurde, das Ereignis/die Funktion für diesen Handler korrekt gespottet wurde. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Voraussetzungen diff --git a/website/src/pages/de/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/de/subgraphs/developing/deploying/multiple-networks.mdx index 6db33ed6bf1e..9d918a953466 100644 --- a/website/src/pages/de/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/de/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Jeder Subgraph, der von dieser Richtlinie betroffen ist, hat die Möglichkeit, d Wenn ein Subgraph erfolgreich synchronisiert wird, ist das ein gutes Zeichen dafür, dass er für immer gut laufen wird. Neue Auslöser im Netzwerk könnten jedoch dazu führen, dass Ihr Subgraph auf eine ungetestete Fehlerbedingung stößt, oder er könnte aufgrund von Leistungsproblemen oder Problemen mit den Knotenbetreibern ins Hintertreffen geraten. -Graph Node stellt einen GraphQL-Endpunkt zur Verfügung, den Sie abfragen können, um den Status Ihres Subgraphen zu überprüfen. Auf dem gehosteten Dienst ist er unter `https://api.thegraph.com/index-node/graphql` verfügbar. Auf einem lokalen Knoten ist er standardmäßig auf Port `8030/graphql` verfügbar. Das vollständige Schema für diesen Endpunkt finden Sie [hier](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Hier ist ein Datenbeispiel für eine Abfrage, die den Status der aktuellen Version eines Subgraphen überprüft: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/de/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/de/subgraphs/developing/deploying/using-subgraph-studio.mdx index 4f784b4304b8..2428cc8eca51 100644 --- a/website/src/pages/de/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/de/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Sobald Sie bereit sind, können Sie Ihren Subgraph in Subgraph Studio bereitstellen. > Wenn Sie einen Subgraphen mit der Befehlszeilenschnittstelle bereitstellen, wird er in das Studio übertragen, wo Sie ihn testen und die Metadaten aktualisieren können. Durch diese Aktion wird Ihr Subgraph nicht im dezentralen Netzwerk veröffentlicht. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Verwenden Sie den folgenden CLI-Befehl, um Ihren Subgraph zu verteilen: @@ -104,6 +106,8 @@ Nach der Ausführung dieses Befehls wird die CLI nach einer Versionsbezeichnung Nach dem Deployment können Sie Ihren Subgraph testen (entweder in Subgraph Studio oder in Ihrer eigenen Anwendung, mit der Deployment-Query-URL), eine weitere Version deployen, die Metadaten aktualisieren und im [Graph Explorer](https://thegraph.com/explorer) veröffentlichen, wenn Sie bereit sind. +> **Note**: The development query URL is limited to 3,000 queries per day. + Verwenden Sie Subgraph Studio, um die Protokolle auf dem Dashboard zu überprüfen und nach Fehlern in Ihrem Subgraphen zu suchen. ## Veröffentlichen Sie Ihren Subgraph diff --git a/website/src/pages/de/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/de/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 2fa5e3654038..474081f817d5 100644 --- a/website/src/pages/de/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/de/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> Se trata de una nueva funcionalidad, que estará disponible en Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/es/resources/benefits.mdx b/website/src/pages/es/resources/benefits.mdx index 764dabb8ba50..672565ccf07c 100644 --- a/website/src/pages/es/resources/benefits.mdx +++ b/website/src/pages/es/resources/benefits.mdx @@ -21,53 +21,53 @@ Aqui hay un analisis: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Comparación de costos | Self Hosted | The Graph Network | -| :-: | :-: | :-: | -| Costo mensual del servidor\* | $350 por mes | $0 | -| Costos de consulta | $0+ | $0 per month | -| Tiempo de ingeniería | $400 por mes | Ninguno, integrado en la red con Indexadores distribuidos globalmente | -| Consultas por mes | Limitado a capacidades de infraestructura | 100,000 (Free Plan) | -| Costo por consulta | $0 | $0 | -| Infrastructure | Centralizado | Descentralizado | -| Redundancia geográfica | $750+ por nodo adicional | Incluido | -| Tiempo de actividad | Varía | 99.9%+ | -| Costos mensuales totales | $750+ | $0 | +| Comparación de costos | Self Hosted | The Graph Network | +| :------------------------------: | :---------------------------------------: | :-------------------------------------------------------------------: | +| Costo mensual del servidor\* | $350 por mes | $0 | +| Costos de consulta | $0+ | $0 per month | +| Tiempo de ingeniería | $400 por mes | Ninguno, integrado en la red con Indexadores distribuidos globalmente | +| Consultas por mes | Limitado a capacidades de infraestructura | 100,000 (Free Plan) | +| Costo por consulta | $0 | $0 | +| Infrastructure | Centralizado | Descentralizado | +| Redundancia geográfica | $750+ por nodo adicional | Incluido | +| Tiempo de actividad | Varía | 99.9%+ | +| Costos mensuales totales | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Comparación de costos | Self Hosted | The Graph Network | -| :-: | :-: | :-: | -| Costo mensual del servidor\* | $350 por mes | $0 | -| Costos de consulta | $500 por mes | $120 per month | -| Tiempo de ingeniería | $800 por mes | Ninguno, integrado en la red con Indexadores distribuidos globalmente | -| Consultas por mes | Limitado a capacidades de infraestructura | ~3,000,000 | -| Costo por consulta | $0 | $0.00004 | -| Infrastructure | Centralizado | Descentralizado | -| Gastos de ingeniería | $200 por hora | Incluido | -| Redundancia geográfica | $1,200 en costos totales por nodo adicional | Incluido | -| Tiempo de actividad | Varía | 99.9%+ | -| Costos mensuales totales | $1,650+ | $120 | +| Comparación de costos | Self Hosted | The Graph Network | +| :------------------------------: | :-----------------------------------------: | :-------------------------------------------------------------------: | +| Costo mensual del servidor\* | $350 por mes | $0 | +| Costos de consulta | $500 por mes | $120 per month | +| Tiempo de ingeniería | $800 por mes | Ninguno, integrado en la red con Indexadores distribuidos globalmente | +| Consultas por mes | Limitado a capacidades de infraestructura | ~3,000,000 | +| Costo por consulta | $0 | $0.00002 | +| Infrastructure | Centralizado | Descentralizado | +| Gastos de ingeniería | $200 por hora | Incluido | +| Redundancia geográfica | $1,200 en costos totales por nodo adicional | Incluido | +| Tiempo de actividad | Varía | 99.9%+ | +| Costos mensuales totales | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Comparación de costos | Self Hosted | The Graph Network | -| :-: | :-: | :-: | -| Costo mensual del servidor\* | $1100 por mes, por nodo | $0 | -| Costos de consulta | $4000 | $1,200 per month | -| Número de nodos necesarios | 10 | No aplica | -| Tiempo de ingeniería | $6,000 o más por mes | Ninguno, integrado en la red con Indexadores distribuidos globalmente | -| Consultas por mes | Limitado a capacidades de infraestructura | ~30,000,000 | -| Costo por consulta | $0 | $0.00004 | -| Infrastructure | Centralizado | Descentralizado | -| Redundancia geográfica | $1,200 en costos totales por nodo adicional | Incluido | -| Tiempo de actividad | Varía | 99.9%+ | -| Costos mensuales totales | $11,000+ | $1,200 | +| Comparación de costos | Self Hosted | The Graph Network | +| :------------------------------: | :-----------------------------------------: | :-------------------------------------------------------------------: | +| Costo mensual del servidor\* | $1100 por mes, por nodo | $0 | +| Costos de consulta | $4000 | $1,200 per month | +| Número de nodos necesarios | 10 | No aplica | +| Tiempo de ingeniería | $6,000 o más por mes | Ninguno, integrado en la red con Indexadores distribuidos globalmente | +| Consultas por mes | Limitado a capacidades de infraestructura | ~30,000,000 | +| Costo por consulta | $0 | $0.00002 | +| Infrastructure | Centralizado | Descentralizado | +| Redundancia geográfica | $1,200 en costos totales por nodo adicional | Incluido | +| Tiempo de actividad | Varía | 99.9%+ | +| Costos mensuales totales | $11,000+ | $1,200 | \*incluidos los costos de copia de seguridad: $50-$100 por mes diff --git a/website/src/pages/es/resources/claude-mcp.mdx b/website/src/pages/es/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/es/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/es/subgraphs/developing/creating/advanced.mdx b/website/src/pages/es/subgraphs/developing/creating/advanced.mdx index eec792c562e4..44de42f43e2b 100644 --- a/website/src/pages/es/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/es/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Descripción -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/es/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/es/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/es/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/es/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/es/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/es/subgraphs/developing/creating/graph-ts/api.mdx index 7673a925ad21..acee9e3c320b 100644 --- a/website/src/pages/es/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/es/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Version | Notas del lanzamiento | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Version | Notas del lanzamiento | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Tipos Incorporados @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Buscando entidades creadas dentro de un bloque +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Tratamiento de las Llamadas Revertidas @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### API IPFS ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Metadatos de la Fuente de Datos diff --git a/website/src/pages/es/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/es/subgraphs/developing/creating/install-the-cli.mdx index d968a59b17ff..273c0262ee4e 100644 --- a/website/src/pages/es/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/es/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/es/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/es/subgraphs/developing/creating/ql-schema.mdx index 2f2b8c25e231..719bbe344b14 100644 --- a/website/src/pages/es/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/es/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Tipo | Descripción | -| --- | --- | -| `Bytes` | Byte array, representado como un string hexadecimal. Comúnmente utilizado para los hashes y direcciones de Ethereum. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Tipo | Descripción | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, representado como un string hexadecimal. Comúnmente utilizado para los hashes y direcciones de Ethereum. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums @@ -318,7 +318,7 @@ Diccionarios de idiomas admitidos: Algoritmos admitidos para ordenar los resultados: -| Algorithm | Description | -| --- | --- | -| rank | Usa la calidad de coincidencia (0-1) de la consulta de texto completo para ordenar los resultados. | -| rango de proximidad | Similar to rank but also includes the proximity of the matches. | +| Algorithm | Description | +| ------------------- | -------------------------------------------------------------------------------------------------- | +| rank | Usa la calidad de coincidencia (0-1) de la consulta de texto completo para ordenar los resultados. | +| rango de proximidad | Similar to rank but also includes the proximity of the matches. | diff --git a/website/src/pages/es/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/es/subgraphs/developing/creating/starting-your-subgraph.mdx index aad5349fb149..669a29583ee8 100644 --- a/website/src/pages/es/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/es/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Version | Notas del lanzamiento | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Notas del lanzamiento | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/es/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/es/subgraphs/developing/creating/subgraph-manifest.mdx index c2a3e8156927..330ee0c10df7 100644 --- a/website/src/pages/es/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/es/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ Las entradas importantes a actualizar para el manifiesto son: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ Las entradas importantes a actualizar para el manifiesto son: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Los call handlers solo se activarán en uno de estos dos casos: cuando la función especificada sea llamada por una cuenta distinta del propio contrato o cuando esté marcada como externa en Solidity y sea llamada como parte de otra función en el mismo contrato. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Definición de un Call Handler @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. La ausencia de un filtro para un handler de bloque asegurará que el handler sea llamado en cada bloque. Una fuente de datos solo puede contener un handler de bloque para cada tipo de filtro. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Bloques iniciales The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Version | Notas del lanzamiento | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Notas del lanzamiento | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/es/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/es/subgraphs/developing/creating/unit-testing-framework.mdx index 7be3dfb08f89..d025339a56f4 100644 --- a/website/src/pages/es/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/es/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ o /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ Esto ejecutará todas las pruebas en la carpeta de prueba: graph test ``` -Esto ejecutará una prueba llamada gravity.test.ts y/o todas las pruebas dentro de una carpeta llamada gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Escribir un Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Suponiendo que tenemos la siguiente función handler (junto con dos funciones auxiliares para hacernos la vida más fácil): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -Primero tenemos que crear un archivo de prueba en nuestro proyecto. Este es un ejemplo de cómo podría verse: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - Estamos configurando nuestro estado inicial y agregando una entidad Gravatar personalizada; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- Hacemos valer el estado del almacén. ¿Cómo funciona eso? - Pasamos una combinación única de tipo de Entidad e id. A continuación, comprobamos un campo específico de esa Entidad y afirmamos que tiene el valor que esperamos que tenga. Hacemos esto tanto para la Entidad Gravatar inicial que añadimos al almacén, como para las dos entidades Gravatar que se añaden cuando se llama a la función del handler; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. Ahí vamos: ¡hemos creado nuestra primera prueba! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interactuar con metadatos de eventos @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -El logging de errores críticos detendrá la ejecución de las pruebas y explotará todo. Después de todo, queremos asegurarnos de que tu código no tenga logs críticos en el deployment, y deberías darte cuenta de inmediato si eso sucediera. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing de campos derivados @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/es/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/es/subgraphs/developing/deploying/multiple-networks.mdx index a96efc430a61..33807eefc5be 100644 --- a/website/src/pages/es/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/es/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/es/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/es/subgraphs/developing/deploying/using-subgraph-studio.mdx index 29eed7358005..82b865a94db2 100644 --- a/website/src/pages/es/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/es/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/es/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/es/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 67c076d0a156..ac0a6b970883 100644 --- a/website/src/pages/es/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/es/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` effectuera un comptage complet de la table - ce qui peut être lent, mais donne une mesure précise du ratio d'entités distinctes par rapport au nombre total de versions d'entités. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> Il s'agit d'une nouvelle fonctionnalité qui sera disponible dans Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/fr/resources/benefits.mdx b/website/src/pages/fr/resources/benefits.mdx index 2e389d78427c..9db40f894589 100644 --- a/website/src/pages/fr/resources/benefits.mdx +++ b/website/src/pages/fr/resources/benefits.mdx @@ -21,60 +21,59 @@ Voici une analyse : ### Structure de coûts plus faible et plus flexible -Pas de contrat. Pas de frais mensuels. Vous ne payez que pour les requêtes que vous utilisez, avec un coût moyen par requête de 40 $ par million de requêtes (~0,00004 $ par requête). Les requêtes sont facturées en USD et payées en GRT ou par carte de crédit. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Les coûts d'interrogation peuvent varier ; le coût indiqué est la moyenne au moment de la publication (mars 2024). ## Utilisateur à faible volume (moins de 100 000 requêtes par mois) -| Cost Comparison | Auto-hébergé | The Graph Network | -| :-: | :-: | :-: | -| Coût mensuel du serveur\* | 350 $ au mois | 0 $ | -| Frais de requête | - 0 $ | 0$ par mois | -| Temps d'ingénierie | 400 $ au mois | Aucun, intégré au réseau avec des indexeurs distribués à l'échelle mondiale | -| Requêtes au mois | Limité aux capacités infra | 100 000 (Plan Gratuit) | -| Tarif par requête | 0 $ | 0$ | -| Infrastructure | Centralisée | Décentralisée | -| La redondance géographique | 750$+ par nœud complémentaire | Compris | -| Temps de disponibilité | Variable | - 99.9% | -| Total des coûts mensuels | 750 $+ | 0 $ | +| Cost Comparison | Auto-hébergé | The Graph Network | +| :----------------------------: | :--------------------------------------: | :-------------------------------------------------------------------------: | +| Coût mensuel du serveur\* | 350 $ au mois | 0 $ | +| Frais de requête | - 0 $ | 0$ par mois | +| Temps d'ingénierie | 400 $ au mois | Aucun, intégré au réseau avec des indexeurs distribués à l'échelle mondiale | +| Requêtes au mois | Limité aux capacités infra | 100 000 (Plan Gratuit) | +| Tarif par requête | 0 $ | 0$ | +| Infrastructure | Centralisée | Décentralisée | +| La redondance géographique | 750$+ par nœud complémentaire | Compris | +| Temps de disponibilité | Variable | - 99.9% | +| Total des coûts mensuels | 750 $+ | 0 $ | ## Utilisateur à volume moyen (~3M requêtes par mois) -| Cost Comparison | Auto-hébergé | The Graph Network | -| :-: | :-: | :-: | -| Coût mensuel du serveur\* | 350 $ au mois | 0 $ | -| Frais de requête | 500 $ au mois | 120$ par mois | -| Temps d'ingénierie | 800 $ au mois | Aucun, intégré au réseau avec des indexeurs distribués à l'échelle mondiale | -| Requêtes au mois | Limité aux capacités infra | ~3,000,000 | -| Tarif par requête | 0 $ | $0.00004 | -| Infrastructure | Centralisée | Décentralisée | -| Frais d'ingénierie | 200 $ au mois | Compris | -| La redondance géographique | 1 200 $ coût total par nœud supplémentaire | Compris | -| Temps de disponibilité | Variable | - 99.9% | -| Total des coûts mensuels | 1 650 $+ | 120$ | +| Cost Comparison | Auto-hébergé | The Graph Network | +| :----------------------------: | :-----------------------------------------: | :-------------------------------------------------------------------------: | +| Coût mensuel du serveur\* | 350 $ au mois | 0 $ | +| Frais de requête | 500 $ au mois | 120$ par mois | +| Temps d'ingénierie | 800 $ au mois | Aucun, intégré au réseau avec des indexeurs distribués à l'échelle mondiale | +| Requêtes au mois | Limité aux capacités infra | ~3,000,000 | +| Tarif par requête | 0 $ | $0.00002 | +| Infrastructure | Centralisée | Décentralisée | +| Frais d'ingénierie | 200 $ au mois | Compris | +| La redondance géographique | 1 200 $ coût total par nœud supplémentaire | Compris | +| Temps de disponibilité | Variable | - 99.9% | +| Total des coûts mensuels | 1 650 $+ | 120$ | ## Utilisateur à volume élevé (~30M requêtes par mois) -| Cost Comparison | Auto-hébergé | The Graph Network | -| :-: | :-: | :-: | -| Coût mensuel du serveur\* | 1100 $ au mois, par nœud | 0 $ | -| Frais de requête | 4000 $ | 1 200 $ par mois | -| Nombre de nœuds obligatoires | 10 | Sans objet | -| Temps d'ingénierie | 6000 $ ou plus au mois | Aucun, intégré au réseau avec des indexeurs distribués à l'échelle mondiale | -| Requêtes au mois | Limité aux capacités infra | ~30,000,000 | -| Tarif par requête | 0 $ | $0.00004 | -| Infrastructure | Centralisée | Décentralisée | -| La redondance géographique | 1 200 $ coût total par nœud supplémentaire | Compris | -| Temps de disponibilité | Variable | - 99.9% | -| Total des coûts mensuels | 11 000 $+ | 1,200$ | +| Cost Comparison | Auto-hébergé | The Graph Network | +| :----------------------------: | :------------------------------------------: | :-------------------------------------------------------------------------: | +| Coût mensuel du serveur\* | 1100 $ au mois, par nœud | 0 $ | +| Frais de requête | 4000 $ | 1 200 $ par mois | +| Nombre de nœuds obligatoires | 10 | Sans objet | +| Temps d'ingénierie | 6000 $ ou plus au mois | Aucun, intégré au réseau avec des indexeurs distribués à l'échelle mondiale | +| Requêtes au mois | Limité aux capacités infra | ~30,000,000 | +| Tarif par requête | 0 $ | $0.00002 | +| Infrastructure | Centralisée | Décentralisée | +| La redondance géographique | 1 200 $ coût total par nœud supplémentaire | Compris | +| Temps de disponibilité | Variable | - 99.9% | +| Total des coûts mensuels | 11 000 $+ | 1,200$ | \*y compris les coûts de sauvegarde : $50-$ à 100 dollars au mois Temps d'ingénierie basé sur une hypothèse de 200 $ de l'heure -Reflète le coût pour le consommateur de données. Les frais de requête sont toujours payés aux Indexeurs pour -les requêtes du Plan Gratuit. +Reflète le coût pour le consommateur de données. Les frais de requête sont toujours payés aux Indexeurs pour les requêtes du Plan Gratuit. Estimated costs are only for Ethereum Mainnet Subgraphs — costs are even higher when self hosting a `graph-node` on other networks. Some users may need to update their Subgraph to a new version. Due to Ethereum gas fees, an update costs ~$50 at time of writing. Note that gas fees on [Arbitrum](/archived/arbitrum/arbitrum-faq/) are substantially lower than Ethereum mainnet. diff --git a/website/src/pages/fr/resources/claude-mcp.mdx b/website/src/pages/fr/resources/claude-mcp.mdx new file mode 100644 index 000000000000..2b8bc1a175e5 --- /dev/null +++ b/website/src/pages/fr/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prérequis + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/fr/subgraphs/developing/creating/advanced.mdx b/website/src/pages/fr/subgraphs/developing/creating/advanced.mdx index 5992294de057..03682774c93b 100644 --- a/website/src/pages/fr/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/fr/subgraphs/developing/creating/advanced.mdx @@ -4,15 +4,15 @@ title: Fonctionnalités avancées des subgraphs ## Aperçu -Ajouter et mettre en œuvre des fonctionnalités avancées de subgraph pour améliorer la construction de votre subgraph. +Add and implement advanced Subgraph features to enhance your Subgraph's build. A partir de la `specVersion` `0.0.4`, les fonctionnalités de Subgraph doivent être explicitement déclarées dans la section `features` au premier niveau du fichier manifest, en utilisant leur nom `camelCase`, comme listé dans le tableau ci-dessous : -| Fonctionnalité | Nom | -| --------------------------------------------------------- | ---------------- | -| [Erreurs non fatales](#non-fatal-errors) | `nonFatalErrors` | -| [Recherche plein texte](#defining-fulltext-search-fields) | `fullTextSearch` | -| [Greffage](#grafting-onto-existing-subgraphs) | `grafting` | +| Fonctionnalité | Nom | +| ----------------------------------------------------------- | ---------------- | +| [Erreurs non fatales](#non-fatal-errors) | `nonFatalErrors` | +| [Recherche plein texte](#defining-fulltext-search-fields) | `fullTextSearch` | +| [Greffage](#grafting-onto-existing-subgraphs) | `grafting` | Par exemple, si un subgraph utilise les fonctionnalités **Recherche plein texte** et **Erreurs non fatales**, le champ `features` dans le manifeste devrait être : @@ -456,8 +456,6 @@ Dans cette configuration: ## Déclaration eth_call -> Remarque : Il s'agit d'une fonctionnalité expérimentale qui n'est pas encore disponible dans une version stable de Graph Node. Vous ne pouvez l'utiliser que dans Subgraph Studio ou sur votre nœud auto-hébergé. - Les `eth_calls` déclaratifs sont une fonctionnalité précieuse de Subgraph qui permet aux `eth_calls` d'être exécutés à l'avance, permettant à `graph-node` de les exécuter en parallèle. Cette fonctionnalité permet de : diff --git a/website/src/pages/fr/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/fr/subgraphs/developing/creating/graph-ts/CHANGELOG.md index e1411a2c1465..04cb4a8d91ec 100644 --- a/website/src/pages/fr/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/fr/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Changements dans les correctifs + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/fr/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/fr/subgraphs/developing/creating/graph-ts/api.mdx index 90bc58c98943..caccc4939777 100644 --- a/website/src/pages/fr/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/fr/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ La bibliothèque `@graphprotocol/graph-ts` fournit les API suivantes : La `apiVersion` dans le manifeste du subgraph spécifie la version de l'API de mappage qui est exécutée par Graph Node pour un subgraph donné. -| Version | Notes de version | -| :-: | --- | -| 0.0.9 | Ajout de nouvelles fonctions hôtes [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Ajout de la validation pour l'existence des champs dans le schéma lors de l'enregistrement d'une entité. | -| 0.0.7 | Ajout des classes `TransactionReceipt` et `Log`aux types Ethereum
Ajout du champ `receipt` à l'objet Ethereum Event | -| 0.0.6 | Ajout du champ `nonce` à l'objet Ethereum Transaction
Ajout de `baseFeePerGas` à l'objet Ethereum Block | -| 0.0.5 | AssemblyScript mis à jour vers la version 0.19.10 (cela inclut des changements de rupture, veuillez consulter le [`Guide de migration`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renommé en `ethereum.transaction.gasLimit` | -| 0.0.4 | Ajout du champ `functionSignature` à l'objet Ethereum SmartContractCall | -| 0.0.3 | Ajout du champ `from` à l'objet Ethereum Call
`ethereum.call.address` renommé en `ethereum.call.to` | -| 0.0.2 | Ajout du champ `input` à l'objet Ethereum Transaction | +| Version | Notes de version | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 0.0.9 | Ajout de nouvelles fonctions hôtes [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Ajout de la validation pour l'existence des champs dans le schéma lors de l'enregistrement d'une entité. | +| 0.0.7 | Ajout des classes `TransactionReceipt` et `Log`aux types Ethereum
Ajout du champ `receipt` à l'objet Ethereum Event | +| 0.0.6 | Ajout du champ `nonce` à l'objet Ethereum Transaction
Ajout de `baseFeePerGas` à l'objet Ethereum Block | +| 0.0.5 | AssemblyScript mis à jour vers la version 0.19.10 (cela inclut des changements de rupture, veuillez consulter le [`Guide de migration`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renommé en `ethereum.transaction.gasLimit` | +| 0.0.4 | Ajout du champ `functionSignature` à l'objet Ethereum SmartContractCall | +| 0.0.3 | Ajout du champ `from` à l'objet Ethereum Call
`ethereum.call.address` renommé en `ethereum.call.to` | +| 0.0.2 | Ajout du champ `input` à l'objet Ethereum Transaction | ### Types intégrés @@ -276,7 +276,7 @@ Comme l'entité peut ne pas encore exister dans le magasin, la méthode `load` r > Remarque : Le chargement des entités n'est nécessaire que si les modifications apportées dans le mappage dépendent des données précédentes d'une entité. Consultez la section suivante pour savoir les deux façons de mettre à jour les entités existantes. -#### Recherche d'entités créées dans un bloc +#### Looking up entities created within a block Depuis `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 et `@graphprotocol/graph-cli` v0.49.0 la méthode `loadInBlock` est disponible pour tous les types d'entités. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` est remplacé par `TransferEvent` ici pour éviter un conflit de nommage avec le type d'entité +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. Tant que le `ERC20Contract` sur Ethereum a une fonction publique en lecture seule appelée `symbol`, elle peut être appelée avec `.symbol()`. Pour les variables d'état publiques, une méthode du même nom est créée automatiquement. -Tout autre contrat faisant partie du subgraph peut être importé à partir du code généré et peut être lié à une adresse valide. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Gestion des appels retournés @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -770,44 +790,45 @@ Lorsque le type d'une valeur est certain, il peut être converti en un [type int ### Référence des conversions de types -| Source(s) | Destination | Fonctions de conversion | -| -------------------- | -------------------- | ---------------------------- | -| Address | Bytes | aucune | -| Address | String | s.toHexString() | -| BigDecimal | String | s.toString() | -| BigInt | BigDecimal | s.toBigDecimal() | -| BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | -| BigInt | String (unicode) | s.toString() | -| BigInt | i32 | s.toI32() | -| Boolean | Boolean | aucune | -| Bytes (signé) | BigInt | BigInt.fromSignedBytes(s) | -| Bytes (non signé) | BigInt | BigInt.fromUnsignedBytes(s) | -| Bytes | String (hexadecimal) | s.toHexString() or s.toHex() | -| Bytes | String (unicode) | s.toString() | -| Bytes | String (base58) | s.toBase58() | -| Bytes | i32 | s.toI32() | -| Bytes | u32 | s.toU32() | -| Bytes | JSON | json.fromBytes(s) | -| int8 | i32 | aucune | -| int32 | i32 | aucune | -| int32 | BigInt | BigInt.fromI32(s) | -| uint24 | i32 | aucune | -| int64 - int256 | BigInt | aucune | -| uint32 - uint256 | BigInt | aucune | -| JSON | boolean | s.toBool() | -| JSON | i64 | s.toI64() | -| JSON | u64 | s.toU64() | -| JSON | f64 | s.toF64() | -| JSON | BigInt | s.toBigInt() | -| JSON | string | s.toString() | -| JSON | Array | s.toArray() | -| JSON | Object | s.toObject() | -| String | Address | Address.fromString(s) | -| Bytes | Address | Address.fromBytes(s) | -| String | BigInt | BigInt.fromString(s) | -| String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| Source(s) | Destination | Fonctions de conversion | +| --------------------- | -------------------- | -------------------------------- | +| Address | Bytes | aucune | +| Address | String | s.toHexString() | +| BigDecimal | String | s.toString() | +| BigInt | BigDecimal | s.toBigDecimal() | +| BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | +| BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | +| BigInt | i32 | s.toI32() | +| Boolean | Boolean | aucune | +| Bytes (signé) | BigInt | BigInt.fromSignedBytes(s) | +| Bytes (non signé) | BigInt | BigInt.fromUnsignedBytes(s) | +| Bytes | String (hexadecimal) | s.toHexString() or s.toHex() | +| Bytes | String (unicode) | s.toString() | +| Bytes | String (base58) | s.toBase58() | +| Bytes | i32 | s.toI32() | +| Bytes | u32 | s.toU32() | +| Bytes | JSON | json.fromBytes(s) | +| int8 | i32 | aucune | +| int32 | i32 | aucune | +| int32 | BigInt | BigInt.fromI32(s) | +| uint24 | i32 | aucune | +| int64 - int256 | BigInt | aucune | +| uint32 - uint256 | BigInt | aucune | +| JSON | boolean | s.toBool() | +| JSON | i64 | s.toI64() | +| JSON | u64 | s.toU64() | +| JSON | f64 | s.toF64() | +| JSON | BigInt | s.toBigInt() | +| JSON | string | s.toString() | +| JSON | Array | s.toArray() | +| JSON | Object | s.toObject() | +| String | Address | Address.fromString(s) | +| Bytes | Address | Address.fromBytes(s) | +| String | BigInt | BigInt.fromString(s) | +| String | BigDecimal | BigDecimal.fromString(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Métadonnées de la source de données diff --git a/website/src/pages/fr/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/fr/subgraphs/developing/creating/install-the-cli.mdx index eaa6d4601d27..b5c4ff7291a4 100644 --- a/website/src/pages/fr/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/fr/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - La commande tente de récupérer l'ABI du contrat depuis Etherscan. - - Graph CLI repose sur un endpoint RPC public. Bien que des échecs occasionnels soient attendus, les réessais résolvent généralement ce problème. Si les échecs persistent, envisagez d'utiliser un ABI local. - Si certains arguments optionnels manquent, il vous guide à travers un formulaire interactif. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph Les `sources de données` sont des composants clés des subgraphs. Ils définissent les sources de données que le subgraph indexe et traite. Une `dataSource` spécifie quel contrat intelligent écouter, quels événements traiter et comment les traiter. -Les versions récentes de Graph CLI permettent d'ajouter de nouvelles `dataSources` à un Subgraph existant grâce à la commande `graph add` : +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Spécificités⁠ -La commande `graph add` récupère l'ABI depuis Etherscan (à moins qu'un chemin ABI ne soit spécifié avec l'option `--abi`) et crée une nouvelle `dataSource`, de la même manière que la commande `graph init` crée une `dataSource` `--from-contract`, en mettant à jour le schéma et les mappages en conséquence. Cela vous permet d'indexer les contrats d'implémentation à partir de leurs contrats proxy. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - L'option `--merge-entities` identifie comment le développeur souhaite gérer les conflits de noms entre `entity` et `event` : diff --git a/website/src/pages/fr/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/fr/subgraphs/developing/creating/ql-schema.mdx index 5786aa5f8364..0bd49bfe8ec4 100644 --- a/website/src/pages/fr/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/fr/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Les champs d'entité peuvent être définis comme obligatoires ou facultatifs. L Null value resolved for non-null field 'name' ``` -Chaque entité doit avoir un champ `id`, qui doit être de type `Bytes!` ou `String!`. Il est généralement recommandé d'utiliser `Bytes!`, à moins que l'`id` ne contienne du texte lisible par l'homme, car les entités avec des identifiants `Bytes!` seront plus rapides à écrire et à interroger que celles avec un `id` `String!`. Le champ `id` sert de clé primaire et doit être unique parmi toutes les entités du même type. Pour des raisons historiques, le type `ID!` est également accepté et est un synonyme de `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. Pour certains types d'entités, l'`id` de `Bytes!` est construit à partir des id de deux autres entités ; cela est possible en utilisant `concat`, par exemple, `let id = left.id.concat(right.id) ` pour former l'id à partir des id de `left` et `right`. De même, pour construire un identifiant à partir de l'identifiant d'une entité existante et d'un compteur `count`, `let id = left.id.concatI32(count)` peut être utilisé. La concaténation est garantie pour produire des identifiants uniques tant que la longueur de `left` est la même pour toutes ces entités, par exemple, parce que `left.id` est une `Address`. @@ -72,16 +72,16 @@ Pour certains types d'entités, l'`id` de `Bytes!` est construit à partir des i Les scalaires suivants sont supportés dans l'API GraphQL : -| Type | Description | -| --- | --- | -| `Bytes` | Tableau d'octets, représenté sous forme de chaîne hexadécimale. Couramment utilisé pour les hachages et adresses Ethereum. | -| `String` | Scalaire pour les valeurs de type `string`. Les caractères nuls ne sont pas pris en charge et sont automatiquement supprimés. | -| `Boolean` | Scalaire pour les valeurs de type `boolean` (booléennes). | -| `Int` | La spécification GraphQL définit `Int` comme un entier signé de 32 bits. | -| `Int8` | Un entier signé de 8 octets, également connu sous le nom d'entier signé de 64 bits, peut stocker des valeurs comprises entre -9 223 372 036 854 775 808 et 9 223 372 036 854 775 807. Il est préférable de l'utiliser pour représenter `i64` de l'ethereum. | -| `BigInt` | Grands entiers. Utilisé pour les types Ethereum `uint32`, `int64`, `uint64`, ..., `uint256`. Note : Tout ce qui est inférieur à `uint32`, comme `int32`, `uint24` ou `int8` est représenté par `i32`. | -| `BigDecimal` | `BigDecimal` Décimales de haute précision représentées par un significatif et un exposant. L'exposant est compris entre -6143 et +6144. Arrondi à 34 chiffres significatifs. | -| `Timestamp` | Il s'agit d'une valeur `i64` en microsecondes. Couramment utilisé pour les champs `timestamp` des séries chronologiques et des agrégations. | +| Type | Description | +| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Tableau d'octets, représenté sous forme de chaîne hexadécimale. Couramment utilisé pour les hachages et adresses Ethereum. | +| `String` | Scalaire pour les valeurs de type `string`. Les caractères nuls ne sont pas pris en charge et sont automatiquement supprimés. | +| `Boolean` | Scalaire pour les valeurs de type `boolean` (booléennes). | +| `Int` | La spécification GraphQL définit `Int` comme un entier signé de 32 bits. | +| `Int8` | Un entier signé de 8 octets, également connu sous le nom d'entier signé de 64 bits, peut stocker des valeurs comprises entre -9 223 372 036 854 775 808 et 9 223 372 036 854 775 807. Il est préférable de l'utiliser pour représenter `i64` de l'ethereum. | +| `BigInt` | Grands entiers. Utilisé pour les types Ethereum `uint32`, `int64`, `uint64`, ..., `uint256`. Note : Tout ce qui est inférieur à `uint32`, comme `int32`, `uint24` ou `int8` est représenté par `i32`. | +| `BigDecimal` | `BigDecimal` Décimales de haute précision représentées par un significatif et un exposant. L'exposant est compris entre -6143 et +6144. Arrondi à 34 chiffres significatifs. | +| `Timestamp` | Il s'agit d'une valeur `i64` en microsecondes. Couramment utilisé pour les champs `timestamp` des séries chronologiques et des agrégations. | ### Enums @@ -222,7 +222,7 @@ Cette approche nécessite que les requêtes descendent vers un niveau supplémen query usersWithOrganizations { users { organizations { - # ceci est une entité UserOrganization + # ceci est une entité UserOrganization organization { name } @@ -295,30 +295,30 @@ Le choix d'une langue différente aura un effet définitif, bien que parfois sub Dictionnaires de langues pris en charge : -| Code | Dictionnaire | -| ------ | ------------ | -| simple | Général | -| da | Danois | -| nl | Néerlandais | -| en | Anglais | -| fi | Finlandais | -| fr | Français | -| de | Allemand | -| hu | Hongrois | -| it | Italien | -| no | Norvégien | -| pt | Portugais | -| ro | Roumain | -| ru | Russe | -| es | Espagnol | -| sv | Suédois | -| tr | Turc | +| Code | Dictionnaire | +| ------ | ---------------- | +| simple | Général | +| da | Danois | +| nl | Néerlandais | +| en | Anglais | +| fi | Finlandais | +| fr | Français | +| de | Allemand | +| hu | Hongrois | +| it | Italien | +| no | Norvégien | +| pt | Portugais | +| ro | Roumain | +| ru | Russe | +| es | Espagnol | +| sv | Suédois | +| tr | Turc | ### Algorithmes de classement Algorithmes de classement: -| Algorithme | Description | -| --- | --- | -| rank | Utilisez la qualité de correspondance (0-1) de la requête en texte intégral pour trier les résultats. | -| proximitéRang | Similaire au classement, mais inclut également la proximité des correspondances. | +| Algorithme | Description | +| -------------- | ----------------------------------------------------------------------------------------------------- | +| rank | Utilisez la qualité de correspondance (0-1) de la requête en texte intégral pour trier les résultats. | +| proximitéRang | Similaire au classement, mais inclut également la proximité des correspondances. | diff --git a/website/src/pages/fr/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/fr/subgraphs/developing/creating/starting-your-subgraph.mdx index 247c5e721c94..2e161787acff 100644 --- a/website/src/pages/fr/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/fr/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Commencez le processus et construisez un subgraph qui correspond à vos besoins Explorez d'autres [ressources pour les API](/subgraphs/developing/creating/graph-ts/README/) et effectuez des tests en local avec [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Version | Notes de version | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supporte la fonctionnalité [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) pour élaguer les subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Notes de version | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supporte la fonctionnalité [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) pour élaguer les subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/fr/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/fr/subgraphs/developing/creating/subgraph-manifest.mdx index 6fbfab0c5411..100a9ccdf5a4 100644 --- a/website/src/pages/fr/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/fr/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ Les entrées importantes à mettre à jour pour le manifeste sont : - `indexerHints.prune` : Définit la conservation des données de blocs historiques pour un Subgraph. Voir [élaguage](#prune) dans la section [indexerHints](#indexer-hints). -- `dataSources.source` : l'adresse du contrat intelligent dont le Subgraph s'inspire, et l'ABI du contrat intelligent à utiliser. L'adresse est optionnelle ; l'omettre permet d'indexer les événements correspondants de tous les contrats. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock` : le numéro optionnel du bloc à partir duquel la source de données commence l'indexation. Dans la plupart des cas, nous suggérons d'utiliser le bloc dans lequel le contrat a été créé. @@ -109,7 +109,7 @@ Les entrées importantes à mettre à jour pour le manifeste sont : - `dataSources.mapping.callHandlers` : liste les fonctions du contrat intelligent auxquelles ce Subgraph réagit et les handlers dans le mappage qui transforment les entrées et sorties des appels de fonction en entités dans le store. -- `dataSources.mapping.blockHandlers` : liste les blocs auxquels ce subgraph réagit et les gestionnaires du mappage à exécuter lorsqu'un bloc est ajouté à la blockchain. Sans filtre, le gestionnaire de bloc sera exécuté à chaque bloc. Un filtre d'appel optionnel peut être fourni en ajoutant un champ `filter` avec `kind : call` au gestionnaire. Ceci ne lancera le gestionnaire que si le bloc contient au moins un appel au contrat de la source de données. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. Un seul Subgraph peut indexer les données de plusieurs contrats intelligents. Ajoutez une entrée pour chaque contrat dont les données doivent être indexées dans le tableau `dataSources`. @@ -153,7 +153,7 @@ Bien que les événements constituent un moyen efficace de collecter les modific Les gestionnaires d'appels ne se déclencheront que dans l'un des deux cas suivants : lorsque la fonction spécifiée est appelée par un compte autre que le contrat lui-même ou lorsqu'elle est marquée comme externe dans Solidity et appelée dans le cadre d'une autre fonction du même contrat. -> **Note:** Les gestionnaires d'appels dépendent actuellement de l'API de traçage de Parity. Certains réseaux, tels que BNB chain et Arbitrum, ne supportent pas cette API. Si un subgraph indexant l'un de ces réseaux contient un ou plusieurs gestionnaires d'appels, il ne commencera pas à se synchroniser. Les développeurs de subgraphs devraient plutôt utiliser des gestionnaires d'événements. Ceux-ci sont bien plus performants que les gestionnaires d'appels et sont pris en charge par tous les réseaux evm. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Définir un gestionnaire d'appels @@ -218,7 +218,7 @@ filter: _Le gestionnaire défini sera appelé une fois pour chaque bloc qui contient un appel au contrat (source de données) sous lequel le gestionnaire est défini._ -> **Note:** Le filtre `call` dépend actuellement de l'API de traçage de Parity. Certains réseaux, tels que BNB chain et Arbitrum, ne supportent pas cette API. Si un subgraph indexant un de ces réseaux contient un ou plusieurs block handlers avec un filtre `call`, il ne commencera pas à se synchroniser. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. L'absence de filtre pour un gestionnaire de bloc garantira que le gestionnaire est appelé à chaque bloc. Une source de données ne peut contenir qu'un seul gestionnaire de bloc pour chaque type de filtre. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') Il existe des setters et getters comme `setString` et `getString` pour tous les types de valeurs. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Blocs de démarrage Le `startBlock` est un paramètre optionnel qui vous permet de définir à partir de quel bloc de la chaîne la source de données commencera l'indexation. La définition du bloc de départ permet à la source de données de sauter des millions de blocs potentiellement non pertinents. Typiquement, un développeur de Subgraph définira `startBlock` au bloc dans lequel le contrat intelligent de la source de données a été créé. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Version | Notes de version | -| :-: | --- | -| 1.3.0 | Ajout de la prise en charge de la [Composition de Subgraphs] (/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Ajout de la prise en charge pour le [Filtrage des arguments indexés](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & les `eth_call` déclarés | -| 1.1.0 | Prend en charge les [Séries Chronologiques & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Ajout de la prise en charge du type `Int8` pour `id`. | -| 1.0.0 | Supporte la fonctionnalité [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) pour élaguer les Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Ajout de la prise en charge de l'interrogation des [Gestionnaires de blocs](/developing/creating/subgraph-manifest/#polling-filter) et des [Gestionnaires d'initialisation](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Ajout de la prise en charge des [fichiers sources de données](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Notes de version | +| :-----: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Ajout de la prise en charge de la [Composition de Subgraphs] (/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Ajout de la prise en charge pour le [Filtrage des arguments indexés](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & les `eth_call` déclarés | +| 1.1.0 | Prend en charge les [Séries Chronologiques & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Ajout de la prise en charge du type `Int8` pour `id`. | +| 1.0.0 | Supporte la fonctionnalité [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) pour élaguer les Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Ajout de la prise en charge de l'interrogation des [Gestionnaires de blocs](/developing/creating/subgraph-manifest/#polling-filter) et des [Gestionnaires d'initialisation](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Ajout de la prise en charge des [fichiers sources de données](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/fr/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/fr/subgraphs/developing/creating/unit-testing-framework.mdx index 61b209325211..ec356ad9a12f 100644 --- a/website/src/pages/fr/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/fr/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ ou bien /node_modules/gluegun/build/index.js:13 throw up; ``` -Veuillez vous assurer que vous êtes sur une version plus récente de Node.js graph-cli ne prend plus en charge **v10.19.0**, et c'est toujours la version par défaut pour les nouvelles images Ubuntu sur le WSL. Par exemple, il est confirmé que Matchstick fonctionne sur WSL avec **v18.1.0**, vous pouvez passer à cette version via **nvm** ou si vous mettez à jour votre Node.js global. N'oubliez pas de supprimer `node_modules` et de relancer `npm install` après avoir mis à jour votre nodejs ! Ensuite, assurez-vous que **libpq** est installé, vous pouvez le faire en exécutant +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ Cette opération permet d'exécuter tous les tests contenus dans le dossier test graph test ``` -Ceci lancera un test nommé gravity.test.ts et/ou tous les tests à l'intérieur d'un dossier nommé gravity : +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh gravity graph test @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Écrire un test unitaire -Voyons à quoi ressemblerait un test unitaire simple en utilisant les exemples de Gravatar dans le [Subgraph de Démo](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). En supposant que nous disposions de la fonction de traitement suivante (ainsi que de deux fonctions d'aide pour nous faciliter la vie) : @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -Nous devons tout d'abord créer un fichier de test dans notre projet. Voici un exemple de ce à quoi cela pourrait ressembler : +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ Cela fait beaucoup à décortiquer ! Tout d'abord, une chose importante à noter - Mettons en place notre état initial et ajoutons une entité Gravatar personnalisée ; - Nous définissons deux objets d'événement `NewGravatar` avec leurs données, en utilisant la fonction `createNewGravatarEvent()` ; - Nous appelons les méthodes de gestion de ces événements - `handleNewGravatars()` et nous passons la liste de nos événements personnalisés ; -- Affirmons l'état du magasin. Comment cela fonctionne-t-il ? - Nous passons une combinaison unique de type d'entité et d'identifiant. Ensuite, nous vérifions un champ spécifique de cette entité et affirmons qu'il a la valeur que nous attendons. Nous faisons cela à la fois pour l'entité Gravatar initiale que nous avons ajoutée au magasin, ainsi que pour les deux entités Gravatar qui sont ajoutées lorsque la fonction de gestion est appelée ; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - Enfin, nous nettoyons le store en utilisant `clearStore()` afin que notre prochain test puisse commencer avec un objet de store frais et vide. Nous pouvons définir autant de blocs de test que nous le souhaitons. Et voilà, nous avons formulé notre premier test ! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -L'exécution de la fonction assert.fieldEquals() permet de vérifier l'égalité du champ donné par rapport à la valeur attendue donnée. Le test échouera et un message d'erreur sera affiché si les valeurs **NE SONT PAS** égales. Dans le cas contraire, le test passera avec succès. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interagir avec les métadonnées d'événement @@ -954,7 +954,7 @@ test('Tout faire exploser', () => { }) ``` -La journalisation des erreurs critiques arrêtera l’exécution des tests et fera tout exploser. Après tout, nous voulons nous assurer que votre code ne contient pas de journaux critiques lors du déploiement, et vous devriez le remarquer immédiatement si cela devait se produire. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Tests dérivés @@ -1216,8 +1216,8 @@ type TokenLockMetadata @entity { ##### Exemple de gestionnaire ```typescript -export function handleMetadata(content: Bytes): void { - // dataSource.stringParams() renvoie le CID du fichier de la source de données +export function handleMetadata(content : Bytes) : void { + // dataSource.stringParams() renvoie le CID du fichier de la source de données // stringParam() sera simulé dans le test du gestionnaire // pour plus d'informations https://thegraph.com/docs/en/developing/creating-a-subgraph/#create-a-new-handler-to-process-files let tokenMetadata = new TokenLockMetadata(dataSource.stringParam()) @@ -1291,7 +1291,7 @@ test('exemple de création d'une dataSource file/ipfs', () => { En utilisant **Matchstick**, les développeurs de Subgraph peuvent exécuter un script qui calculera la couverture des tests unitaires écrits. -L'outil de couverture des tests prend les binaires de test compilés `wasm` et les convertit en fichiers `wat`, qui peuvent alors être facilement inspectés pour voir si les gestionnaires définis dans `subgraph.yaml` ont été appelés ou non. Comme la couverture du code (et les tests dans leur ensemble) n'en est qu'à ses débuts en AssemblyScript et WebAssembly, **Matchstick** ne peut pas vérifier la couverture des branches. Au lieu de cela, nous nous appuyons sur l'affirmation que si un gestionnaire donné a été appelé, l'événement/la fonction correspondant(e) a été correctement simulé(e). +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prérequis diff --git a/website/src/pages/fr/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/fr/subgraphs/developing/deploying/multiple-networks.mdx index 2916c6fa07ad..5e4b27c8b13b 100644 --- a/website/src/pages/fr/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/fr/subgraphs/developing/deploying/multiple-networks.mdx @@ -211,7 +211,7 @@ Chaque Subgraph concerné par cette politique a la possibilité de rétablir la Si un Subgraph se synchronise avec succès, c'est le signe qu'il continuera à fonctionner correctement pour toujours. Toutefois, de nouveaux déclencheurs sur le réseau peuvent entraîner une condition d'erreur non testée dans votre Subgraph ou un retard dû à des problèmes de performance ou à des problèmes avec les opérateurs de nœuds. -Graph Node expose un endpoint GraphQL que vous pouvez interroger pour vérifier l'état de votre subgraph. Sur le service hébergé, il est disponible à `https://api.thegraph.com/index-node/graphql`. Sur un nœud local, il est disponible sur le port `8030/graphql` par défaut. Le schéma complet de ce point d'accès peut être trouvé [ici](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Voici un exemple de requête qui vérifie le statut de la version actuelle d'un subgraph : +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/fr/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/fr/subgraphs/developing/deploying/using-subgraph-studio.mdx index 4582f8643eb7..e1a4559b28bf 100644 --- a/website/src/pages/fr/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/fr/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Une fois que vous êtes prêt, vous pouvez déployer votre Subgraph dans Subgraph Studio. > Le déploiement d'un Subgraph à l'aide de la CLI le transfère dans le Studio, où vous pouvez le tester et mettre à jour les métadonnées. Cette action ne publie pas votre Subgraph sur le réseau décentralisé. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Utilisez la commande CLI suivante pour déployer votre Subgraph : @@ -104,6 +106,8 @@ Après avoir exécuté cette commande, la CLI demandera une étiquette de versio Après le déploiement, vous pouvez tester votre Subgraph (soit dans Subgraph Studio, soit dans votre propre application, avec l'URL de requête de déploiement), déployer une autre version, mettre à jour les métadonnées et publier sur [Graph Explorer](https://thegraph.com/explorer) lorsque vous êtes prêt. +> **Note**: The development query URL is limited to 3,000 queries per day. + Utilisez Subgraph Studio pour vérifier les journaux du tableau de bord et rechercher les erreurs éventuelles de votre Subgraph. ## Publiez votre subgraph diff --git a/website/src/pages/fr/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/fr/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 88b91fcd179c..3d936960605a 100644 --- a/website/src/pages/fr/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/fr/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -47,18 +47,18 @@ Depuis la version 0.73.0, vous pouvez également publier votre Subgraph avec [`g Vous pouvez télécharger votre Subgraph sur un nœud IPFS spécifique et personnaliser davantage votre déploiement à l'aide des flags suivants : ``` -UTILISATION +USAGE $ graph publish [SUBGRAPH-MANIFEST] [-h] [--protocol-network arbitrum-one|arbitrum-sepolia --subgraph-id ] [-i ] [--ipfs-hash ] [--webapp-url ] FLAGS - -h, --help Affiche l'aide CLI. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Charge les résultats du build sur un noeud IPFS. - --ipfs-hash= hash IPFS du manifeste du subgraph à déployer. - --protocol-network=
` चलाने पर तालिका की पूरी गणना की जाती है - यह धीमा हो सकता है, लेकिन विशिष्ट entities और कुल entities संस्करणों के अनुपात का सटीक माप प्रदान करता है। @@ -340,6 +345,4 @@ Uniswap जैसी Subgraphs के लिए, `pair` और `token` टेब #### सबग्राफ हटाना -> यह new functionality है, जो garph node 0.29.x में उपलब्ध होगी - At some point, एक Indexer किसी दिए गए Subgraph को हटाना चाह सकता है। यह आसानी से `graphman drop` के माध्यम से किया जा सकता है, जो एक deployment और उसके सभी indexed डेटा को हटा देता है। Deployment को या तो सबग्राफ नाम, एक IPFS हैश `Qm..`, या डेटाबेस namespace `sgdNNN` के रूप में निर्दिष्ट किया जा सकता है। आगे का दस्तावेज़ [यहाँ](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop) उपलब्ध है। diff --git a/website/src/pages/hi/resources/benefits.mdx b/website/src/pages/hi/resources/benefits.mdx index 3392b29fe908..9d27123e0630 100644 --- a/website/src/pages/hi/resources/benefits.mdx +++ b/website/src/pages/hi/resources/benefits.mdx @@ -21,60 +21,59 @@ socialImage: https://thegraph.com/docs/img/seo/benefits.jpg ### कम और अधिक लचीला लागत संरचना -**कोई अनुबंध नहीं। कोई मासिक शुल्क नहीं। केवल उपयोग की गई **queries** के लिए भुगतान करें—औसत लागत $40 प्रति मिलियन **queries** (~$0.00004 प्रति **query**)। **Queries** की कीमत **USD** में होती है और भुगतान **GRT** या **क्रेडिट कार्ड** से किया जा सकता है।** +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query लागत भिन्न हो सकती है; उद्धृत लागत प्रकाशन के समय (मार्च 2024) की औसत है। ## कम वॉल्यूम उपयोगकर्ता (100,000 queries प्रति माह से कम) -| लागत तुलना | स्वयं होस्ट किया गया | The Graph Network | -| :-: | :-: | :-: | -| मासिक सर्वर लागत\* | $350 प्रति माह | $0 | -| पूछताछ लागत | $0+ | $0 प्रति माह | -| इंजीनियरिंग का समय | $ 400 प्रति माह | कोई नहीं, विश्व स्तर पर वितरित इंडेक्सर्स के साथ नेटवर्क में बनाया गया | -| प्रति माह प्रश्न | इन्फ्रा क्षमताओं तक सीमित | 100,000 (नि: शुल्क योजना) | -| लागत प्रति क्वेरी | $0 | $0 | -| इंफ्रास्ट्रक्चर | केंद्रीकृत | विकेन्द्रीकृत | -| भौगोलिक अतिरेक | $750+ प्रति अतिरिक्त नोड | शामिल | -| अपटाइम | भिन्न | 99.9%+ | -| कुल मासिक लागत | $750+ | $0 | +| लागत तुलना | स्वयं होस्ट किया गया | The Graph Network | +| :----------------------------: | :-------------------------------------: | :--------------------------------------------------------------------: | +| मासिक सर्वर लागत\* | $350 प्रति माह | $0 | +| पूछताछ लागत | $0+ | $0 प्रति माह | +| इंजीनियरिंग का समय | $ 400 प्रति माह | कोई नहीं, विश्व स्तर पर वितरित इंडेक्सर्स के साथ नेटवर्क में बनाया गया | +| प्रति माह प्रश्न | इन्फ्रा क्षमताओं तक सीमित | 100,000 (नि: शुल्क योजना) | +| लागत प्रति क्वेरी | $0 | $0 | +| इंफ्रास्ट्रक्चर | केंद्रीकृत | विकेन्द्रीकृत | +| भौगोलिक अतिरेक | $750+ प्रति अतिरिक्त नोड | शामिल | +| अपटाइम | भिन्न | 99.9%+ | +| कुल मासिक लागत | $750+ | $0 | ## मध्यम वॉल्यूम उपयोगकर्ता (~3 मिलियन queries प्रति माह) -| लागत तुलना | स्वयं होस्ट किया गया | The Graph Network | -| :-: | :-: | :-: | -| मासिक सर्वर लागत\* | $350 प्रति माह | $0 | -| पूछताछ लागत | $ 500 प्रति माह | $120 प्रति माह | -| इंजीनियरिंग का समय | $800 प्रति माह | कोई नहीं, विश्व स्तर पर वितरित इंडेक्सर्स के साथ नेटवर्क में बनाया गया | -| प्रति माह प्रश्न | इन्फ्रा क्षमताओं तक सीमित | ~3,000,000 | -| लागत प्रति क्वेरी | $0 | $0.00004 | -| इंफ्रास्ट्रक्चर | केंद्रीकृत | विकेन्द्रीकृत | -| इंजीनियरिंग खर्च | $ 200 प्रति घंटा | शामिल | -| भौगोलिक अतिरेक | प्रति अतिरिक्त नोड कुल लागत में $1,200 | शामिल | -| अपटाइम | भिन्न | 99.9%+ | -| कुल मासिक लागत | $1,650+ | $120 | +| लागत तुलना | स्वयं होस्ट किया गया | The Graph Network | +| :----------------------------: | :----------------------------------------: | :--------------------------------------------------------------------: | +| मासिक सर्वर लागत\* | $350 प्रति माह | $0 | +| पूछताछ लागत | $ 500 प्रति माह | $120 प्रति माह | +| इंजीनियरिंग का समय | $800 प्रति माह | कोई नहीं, विश्व स्तर पर वितरित इंडेक्सर्स के साथ नेटवर्क में बनाया गया | +| प्रति माह प्रश्न | इन्फ्रा क्षमताओं तक सीमित | ~3,000,000 | +| लागत प्रति क्वेरी | $0 | $0.00002 | +| इंफ्रास्ट्रक्चर | केंद्रीकृत | विकेन्द्रीकृत | +| इंजीनियरिंग खर्च | $ 200 प्रति घंटा | शामिल | +| भौगोलिक अतिरेक | प्रति अतिरिक्त नोड कुल लागत में $1,200 | शामिल | +| अपटाइम | भिन्न | 99.9%+ | +| कुल मासिक लागत | $1,650+ | $120 | ## उच्च वॉल्यूम उपयोगकर्ता (~30 मिलियन queries प्रति माह) -| लागत तुलना | स्वयं होस्ट किया गया | The Graph Network | -| :-: | :-: | :-: | -| मासिक सर्वर लागत\* | $1100 प्रति माह, प्रति नोड | $0 | -| पूछताछ लागत | $4000 | $1,200 प्रति माह | -| आवश्यक नोड्स की संख्या | 10 | Not applicable | -| इंजीनियरिंग का समय | $6,000 or more per month | कोई नहीं, विश्व स्तर पर वितरित इंडेक्सर्स के साथ नेटवर्क में बनाया गया | -| प्रति माह प्रश्न | इन्फ्रा क्षमताओं तक सीमित | ~30,000,000 | -| लागत प्रति क्वेरी | $0 | $0.00004 | -| इंफ्रास्ट्रक्चर | केंद्रीकृत | विकेन्द्रीकृत | -| भौगोलिक अतिरेक | प्रति अतिरिक्त नोड कुल लागत में $1,200 | शामिल | -| अपटाइम | भिन्न | 99.9%+ | -| कुल मासिक लागत | $11,000+ | $1,200 | +| लागत तुलना | स्वयं होस्ट किया गया | The Graph Network | +| :----------------------------: | :-----------------------------------------: | :--------------------------------------------------------------------: | +| मासिक सर्वर लागत\* | $1100 प्रति माह, प्रति नोड | $0 | +| पूछताछ लागत | $4000 | $1,200 प्रति माह | +| आवश्यक नोड्स की संख्या | 10 | Not applicable | +| इंजीनियरिंग का समय | $6,000 or more per month | कोई नहीं, विश्व स्तर पर वितरित इंडेक्सर्स के साथ नेटवर्क में बनाया गया | +| प्रति माह प्रश्न | इन्फ्रा क्षमताओं तक सीमित | ~30,000,000 | +| लागत प्रति क्वेरी | $0 | $0.00002 | +| इंफ्रास्ट्रक्चर | केंद्रीकृत | विकेन्द्रीकृत | +| भौगोलिक अतिरेक | प्रति अतिरिक्त नोड कुल लागत में $1,200 | शामिल | +| अपटाइम | भिन्न | 99.9%+ | +| कुल मासिक लागत | $11,000+ | $1,200 | \*बैकअप की लागत सहित: $50-$100 प्रति माह इंजीनियरिंग समय $200 प्रति घंटे की धारणा पर आधारित है - डेटा उपभोक्ता के लिए लागत को दर्शाता है। निःशुल्क योजना की queries के लिए query fees अभी भी indexers को -भुगतान की जाती है। + डेटा उपभोक्ता के लिए लागत को दर्शाता है। निःशुल्क योजना की queries के लिए query fees अभी भी indexers को भुगतान की जाती है। Ethereum मेननेट सबग्राफ के लिए अनुमानित लागतें ही दी गई हैं — अन्य नेटवर्क पर `graph-node` को स्वयं होस्ट करने पर लागतें और भी अधिक होती हैं। कुछ उपयोगकर्ताओं को अपने सबग्राफ को नए संस्करण में अपडेट करने की आवश्यकता हो सकती है। Ethereum गैस शुल्क के कारण, एक अपडेट की लागत लेखन के समय लगभग $50 होती है। ध्यान दें कि [Arbitrum](/archived/arbitrum/arbitrum-faq/) पर गैस शुल्क Ethereum मेननेट की तुलना में काफी कम है। diff --git a/website/src/pages/hi/resources/claude-mcp.mdx b/website/src/pages/hi/resources/claude-mcp.mdx new file mode 100644 index 000000000000..58716b917d63 --- /dev/null +++ b/website/src/pages/hi/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## आवश्यक शर्तें + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/hi/resources/tokenomics.mdx b/website/src/pages/hi/resources/tokenomics.mdx index ac420f323ab7..00ea0f5b3cef 100644 --- a/website/src/pages/hi/resources/tokenomics.mdx +++ b/website/src/pages/hi/resources/tokenomics.mdx @@ -6,7 +6,7 @@ description: The Graph Network को शक्तिशाली टोकन ## Overview -The Graph एक **decentralized protocol** है, जो **blockchain data** तक आसान पहुँच प्रदान करता है। यह **blockchain data** को उसी तरह **index** करता है, जैसे **Google** वेब को **index** करता है। अगर आपने किसी ऐसे **dapp** का उपयोग किया है जो किसी **Subgraph** से डेटा प्राप्त करता है, तो आपने संभवतः **The Graph** के साथ इंटरैक्ट किया है। आज, **Web3 ecosystem** में हजारों [लोकप्रिय dapps](https://thegraph.com/explorer) **The Graph** का उपयोग कर रहे हैं। +The Graph एक **decentralized protocol** है, जो **blockchain data** तक आसान पहुँच प्रदान करता है। यह **blockchain data** को उसी तरह **index** करता है, जैसे **Google** वेब को **index** करता है। अगर आपने किसी ऐसे **dapp** का उपयोग किया है जो किसी **Subgraph** से डेटा प्राप्त करता है, तो आपने संभवतः **The Graph** के साथ इंटरैक्ट किया है। आज, **Web3 ecosystem** में हजारों [लोकप्रिय dapps](https://thegraph.com/explorer) **The Graph** का उपयोग कर रहे हैं। ## विशिष्टताएँ @@ -36,7 +36,7 @@ The Graph ब्लॉकचेन डेटा को अधिक सुलभ ## Delegator(निष्क्रिय रूप से GRT कमाएं) -**Indexers** को **Delegators** द्वारा **GRT** डेलिगेट किया जाता है, जिससे नेटवर्क पर Subgraphs में Indexer की **stake** बढ़ती है। इसके बदले में, **Delegators** को Indexer से मिलने वाले कुल **query fees** और **indexing rewards** का एक निश्चित प्रतिशत मिलता है। हर **Indexer** स्वतंत्र रूप से तय करता है कि वह **Delegators** को कितना रिवार्ड देगा, जिससे **Indexers** के बीच **Delegators** को आकर्षित करने की प्रतिस्पर्धा बनी रहती है। अधिकांश **Indexers** सालाना **9-12%** रिटर्न ऑफर करते हैं। +**Indexers** को **Delegators** द्वारा **GRT** डेलिगेट किया जाता है, जिससे नेटवर्क पर Subgraphs में Indexer की **stake** बढ़ती है। इसके बदले में, **Delegators** को Indexer से मिलने वाले कुल **query fees** और **indexing rewards** का एक निश्चित प्रतिशत मिलता है। हर **Indexer** स्वतंत्र रूप से तय करता है कि वह **Delegators** को कितना रिवार्ड देगा, जिससे **Indexers** के बीच **Delegators** को आकर्षित करने की प्रतिस्पर्धा बनी रहती है। अधिकांश **Indexers** सालाना **9-12%** रिटर्न ऑफर करते हैं। यदि कोई Delegator 15k GRT को किसी ऐसे Indexer को डेलिगेट करता है जो 10% की पेशकश कर रहा है, तो Delegator को वार्षिक रूप से ~1,500 GRT का इनाम प्राप्त होगा। @@ -46,7 +46,7 @@ The Graph ब्लॉकचेन डेटा को अधिक सुलभ ## Curators (GRT कमाएं) -**Curators** उच्च-गुणवत्ता वाले **Subgraphs** की पहचान करते हैं और उन्हें **"curate"** करते हैं (अर्थात, उन पर **GRT signal** करते हैं) ताकि **curation shares** कमा सकें। ये **curation shares** उस **Subgraph** द्वारा उत्पन्न सभी भविष्य की **query fees** का एक निश्चित प्रतिशत सुनिश्चित करते हैं। हालाँकि कोई भी स्वतंत्र नेटवर्क प्रतिभागी **Curator** बन सकता है, आमतौर पर **Subgraph developers** अपने स्वयं के **Subgraphs** के पहले **Curators** होते हैं, क्योंकि वे सुनिश्चित करना चाहते हैं कि उनका **Subgraph indexed** हो। +**Curators** उच्च-गुणवत्ता वाले **Subgraphs** की पहचान करते हैं और उन्हें **"curate"** करते हैं (अर्थात, उन पर **GRT signal** करते हैं) ताकि **curation shares** कमा सकें। ये **curation shares** उस **Subgraph** द्वारा उत्पन्न सभी भविष्य की **query fees** का एक निश्चित प्रतिशत सुनिश्चित करते हैं। हालाँकि कोई भी स्वतंत्र नेटवर्क प्रतिभागी **Curator** बन सकता है, आमतौर पर **Subgraph developers** अपने स्वयं के **Subgraphs** के पहले **Curators** होते हैं, क्योंकि वे सुनिश्चित करना चाहते हैं कि उनका **Subgraph indexed** हो। **Subgraph developers** को सलाह दी जाती है कि वे अपने **Subgraph** को कम से कम **3,000 GRT** के साथ **curate** करें। हालांकि, यह संख्या **network activity** और **community participation** के अनुसार बदल सकती है। @@ -54,11 +54,11 @@ The Graph ब्लॉकचेन डेटा को अधिक सुलभ ## डेवलपर्स -**Developers** **Subgraphs** बनाते हैं और उन्हें **query** करके **blockchain data** प्राप्त करते हैं। चूंकि **Subgraphs** **open source** होते हैं, **developers** मौजूदा **Subgraphs** को **query** करके अपने **dapps** में **blockchain data** लोड कर सकते हैं। **Developers** द्वारा किए गए **queries** के लिए **GRT** में भुगतान किया जाता है, जो नेटवर्क प्रतिभागियों के बीच वितरित किया जाता है। +**Developers** **Subgraphs** बनाते हैं और उन्हें **query** करके **blockchain data** प्राप्त करते हैं। चूंकि **Subgraphs** **open source** होते हैं, **developers** मौजूदा **Subgraphs** को **query** करके अपने **dapps** में **blockchain data** लोड कर सकते हैं। **Developers** द्वारा किए गए **queries** के लिए **GRT** में भुगतान किया जाता है, जो नेटवर्क प्रतिभागियों के बीच वितरित किया जाता है। ### Creating a Subgraph -**Developers** **[Subgraph create](/developing/creating-a-subgraph/)** करके **blockchain** पर डेटा **index** कर सकते हैं। **Subgraphs** यह निर्देश देते हैं कि **Indexers** को कौन सा डेटा **consumers** को उपलब्ध कराना चाहिए। +**Developers** **[Subgraph create](/developing/creating-a-subgraph/)** करके **blockchain** पर डेटा **index** कर सकते हैं। **Subgraphs** यह निर्देश देते हैं कि **Indexers** को कौन सा डेटा **consumers** को उपलब्ध कराना चाहिए। जब **developers** अपना **Subgraph** बना और टेस्ट कर लेते हैं, तो वे इसे **The Graph** के **decentralized network** पर **[publish](/subgraphs/developing/publishing/publishing-a-subgraph/)** कर सकते हैं। @@ -92,9 +92,8 @@ Indexers दो तरीकों से GRT रिवार्ड्स कम **प्रारंभिक टोकन आपूर्ति** 10 बिलियन **GRT** है, और **Indexers** को **Subgraphs** पर **stake allocate** करने के लिए प्रति वर्ष **3%** नई **GRT issuance** का लक्ष्य रखा गया है। इसका मतलब है कि हर साल **Indexers** के योगदान के लिए नए टोकन जारी किए जाएंगे, जिससे कुल **GRT आपूर्ति** 3% बढ़ेगी। -The Graph में नए टोकन **issuance** को संतुलित करने के लिए कई **burning mechanisms** शामिल किए गए हैं। सालाना लगभग **1% GRT supply** विभिन्न नेटवर्क गतिविधियों के माध्यम से **burn** हो जाती है, और यह संख्या नेटवर्क की वृद्धि के साथ बढ़ रही है। ये **burning mechanisms** शामिल हैं: - **0.5% Delegation Tax**: जब कोई **Delegator** किसी **Indexer** को **GRT** डेलीगेट करता है। - -- **1% Curation Tax**: जब **Curators** किसी **Subgraph** पर **GRT signal** करते हैं। +The Graph में नए टोकन **issuance** को संतुलित करने के लिए कई **burning mechanisms** शामिल किए गए हैं। सालाना लगभग **1% GRT supply** विभिन्न नेटवर्क गतिविधियों के माध्यम से **burn** हो जाती है, और यह संख्या नेटवर्क की वृद्धि के साथ बढ़ रही है। ये **burning mechanisms** शामिल हैं: - **0.5% Delegation Tax**: जब कोई **Delegator** किसी **Indexer** को **GRT** डेलीगेट करता है। +- **1% Curation Tax**: जब **Curators** किसी **Subgraph** पर **GRT signal** करते हैं। - **1% Query Fees Burn**: जब **ब्लॉकचेन डेटा** के लिए **queries** की जाती हैं। ![कुल जले हुए GRT](/img/total-burned-grt.jpeg) @@ -103,4 +102,4 @@ The Graph में नए टोकन **issuance** को संतुलि ## प्रोटोकॉल में सुधार करना -The Graph Network निरंतर विकसित हो रहा है और प्रोटोकॉल की आर्थिक संरचना में सुधार किए जा रहे हैं ताकि सभी नेटवर्क प्रतिभागियों को सर्वोत्तम अनुभव मिल सके। The Graph Council प्रोटोकॉल परिवर्तनों की निगरानी करता है और समुदाय के सदस्यों को भाग लेने के लिए प्रोत्साहित किया जाता है। प्रोटोकॉल सुधारों में शामिल हों [The Graph Forum] (https://forum.thegraph.com/) में। + The Graph Network निरंतर विकसित हो रहा है और प्रोटोकॉल की आर्थिक संरचना में सुधार किए जा रहे हैं ताकि सभी नेटवर्क प्रतिभागियों को सर्वोत्तम अनुभव मिल सके। The Graph Council प्रोटोकॉल परिवर्तनों की निगरानी करता है और समुदाय के सदस्यों को भाग लेने के लिए प्रोत्साहित किया जाता है। प्रोटोकॉल सुधारों में शामिल हों [The Graph Forum] (https://forum.thegraph.com/) में। diff --git a/website/src/pages/hi/subgraphs/developing/creating/advanced.mdx b/website/src/pages/hi/subgraphs/developing/creating/advanced.mdx index 22a80fd744e2..cc6d609966a4 100644 --- a/website/src/pages/hi/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/hi/subgraphs/developing/creating/advanced.mdx @@ -4,15 +4,15 @@ title: उन्नत Subgraph विशेषताएँ ## Overview -अपने Subgraph के निर्माण को उन्नत करने के लिए उन्नत सबग्राफ सुविधाएँ जोड़ें और लागू करें। +Add and implement advanced Subgraph features to enhance your Subgraph's build. `specVersion` `0.0.4` से शुरू होकर, सबग्राफ सुविधाओं को स्पष्ट रूप से `विशेषता` अनुभाग में शीर्ष स्तर पर घोषित किया जाना चाहिए, जो उनके `camelCase` नाम का उपयोग करके किया जाता है, जैसा कि नीचे दी गई तालिका में सूचीबद्ध है: -| विशेषता | नाम | -| ------------------------------------------------- | -------------------- | -| [गैर-घातक त्रुटियाँ](#non-fatal-errors) | `गैर-घातक त्रुटियाँ` | -| [पूर्ण-पाठ खोज](#defining-fulltext-search-fields) | `पूर्ण-पाठ खोज` | -| [Grafting](#grafting-onto-existing-subgraphs) | `grafting` | +| विशेषता | नाम | +| ------------------------------------------------------ | -------------------- | +| [गैर-घातक त्रुटियाँ](#non-fatal-errors) | `गैर-घातक त्रुटियाँ` | +| [पूर्ण-पाठ खोज](#defining-fulltext-search-fields) | `पूर्ण-पाठ खोज` | +| [Grafting](#grafting-onto-existing-subgraphs) | `grafting` | instance के लिए, यदि कोई सबग्राफ **Full-Text Search** और **Non-fatal Errors** सुविधाओं का उपयोग करता है, तो मैनिफेस्ट में `विशेषता` फ़ील्ड इस प्रकार होनी चाहिए: @@ -97,7 +97,7 @@ type Stats @aggregation(intervals: ["hour", "day"], source: "Data") { ## गैर-घातक त्रुटियाँ -indexing त्रुटियाँ, जो पहले से सिंक हो चुके सबग्राफ पर होती हैं, डिफ़ॉल्ट रूप से सबग्राफ को विफल कर देंगी और सिंकिंग रोक देंगी। वैकल्पिक रूप से, सबग्राफ को इस तरह कॉन्फ़िगर किया जा सकता है कि वे त्रुटियों की उपस्थिति में भी सिंकिंग जारी रखें, उन परिवर्तनों को अनदेखा करके जो उस handler द्वारा किए गए थे जिसने त्रुटि उत्पन्न की। यह सबग्राफ लेखकों को अपने सबग्राफ को सही करने का समय देता है, जबकि नवीनतम ब्लॉक के विरुद्ध क्वेरीज़ दी जाती रहती हैं, हालांकि परिणाम उस बग के कारण असंगत हो सकते हैं जिसने त्रुटि उत्पन्न की थी। ध्यान दें कि कुछ त्रुटियाँ फिर भी हमेशा घातक होती हैं। गैर-घातक होने के लिए, त्रुटि को निर्धारक (deterministic) रूप से ज्ञात होना चाहिए। +indexing त्रुटियाँ, जो पहले से सिंक हो चुके सबग्राफ पर होती हैं, डिफ़ॉल्ट रूप से सबग्राफ को विफल कर देंगी और सिंकिंग रोक देंगी। वैकल्पिक रूप से, सबग्राफ को इस तरह कॉन्फ़िगर किया जा सकता है कि वे त्रुटियों की उपस्थिति में भी सिंकिंग जारी रखें, उन परिवर्तनों को अनदेखा करके जो उस handler द्वारा किए गए थे जिसने त्रुटि उत्पन्न की। यह सबग्राफ लेखकों को अपने सबग्राफ को सही करने का समय देता है, जबकि नवीनतम ब्लॉक के विरुद्ध क्वेरीज़ दी जाती रहती हैं, हालांकि परिणाम उस बग के कारण असंगत हो सकते हैं जिसने त्रुटि उत्पन्न की थी। ध्यान दें कि कुछ त्रुटियाँ फिर भी हमेशा घातक होती हैं। गैर-घातक होने के लिए, त्रुटि को निर्धारक (deterministic) रूप से ज्ञात होना चाहिए। > **नोट:**ग्राफ नेटवर्क अभी तक गैर-घातक त्रुटियों का समर्थन नहीं करता है, और डेवलपर्स को स्टूडियो के माध्यम से उस कार्यक्षमता का उपयोग करके सबग्राफ को नेटवर्क पर परिनियोजित नहीं करना चाहिए। @@ -343,7 +343,8 @@ export function handleTransfer(event: TransferEvent): void { आप [ DataSource context](/subgraphs/developing/creating/graph-ts/api/#entity-and-datasourcecontext) का उपयोग कर सकते हैं जब आप File Data साधन बना रहे हों ताकि अतिरिक्त जानकारी पास की जा सके जो File Data साधन handler में उपलब्ध होगी। -यदि आपके पास ऐसी entities हैं जो कई बार रिफ्रेश होती हैं, तो IPFS हैश और entity ID का उपयोग करके unique file-based entities बनाएं, और उन्हें chain-based entity में एक derived field का उपयोग करके संदर्भित करें। entities +यदि आपके पास ऐसी entities हैं जो कई बार रिफ्रेश होती हैं, तो IPFS हैश और entity ID का उपयोग करके unique file-based entities बनाएं, और उन्हें chain-based entity में एक derived field का उपयोग करके संदर्भित करें। +entities > हम ऊपर दिए गए सुझाव को बेहतर बनाने के लिए काम कर रहे हैं, इसलिए क्वेरी केवल "नवीनतम" संस्करण लौटाती हैं @@ -355,7 +356,7 @@ export function handleTransfer(event: TransferEvent): void { #### उदाहरण -[Crypto Coven सबग्राफ migration](https://github.com/azf20/cryptocoven-api/tree/file-data-sources-refactor) +[Crypto Coven सबग्राफ migration](https://github.com/azf20/cryptocoven-api/tree/file-data-sources-refactor) #### संदर्भ @@ -456,8 +457,6 @@ eventHandlers: ## घोषित eth_call -> नोट: यह एक प्रयोगात्मक फीचर है जो अभी तक स्थिर Graph Node रिलीज़ में उपलब्ध नहीं है। आप इसे केवल Subgraph Studio या अपने स्वयं-होस्टेड नोड में ही उपयोग कर सकते हैं। - Declarative `eth_calls` एक मूल्यवान सबग्राफ विशेषता है जो `eth_calls` को पहले से निष्पादित करने की अनुमति देती है, जिससे `graph-node` उन्हें समानांतर रूप से निष्पादित कर सकता है। यह फ़ीचर निम्नलिखित कार्य करता है: @@ -529,13 +528,14 @@ calls: ```yaml calls: - ERC20DecimalsToken0: ERC20[event.params.token0].decimals() + ``` ### मौजूदा सबग्राफ पर ग्राफ्टिंग > **नोट**: प्रारंभिक रूप से The Graph Network में अपग्रेड करते समय graft का उपयोग करने की अनुशंसा नहीं की जाती है। अधिक जानें [यहाँ](/subgraphs/cookbook/grafting/#important-note-on-grafting-when-upgrading-to-the-network)। -जब कोई सबग्राफ पहली बार डिप्लॉय किया जाता है, तो यह संबंधित चेन के जेनेसिस ब्लॉक (या प्रत्येक डेटा स्रोत के साथ परिभाषित `startBlock`) से इवेंट्स को indexing करना शुरू करता है। कुछ परिस्थितियों में, मौजूदा सबग्राफ से डेटा को पुन: उपयोग करना और किसी बाद के ब्लॉक से इंडेक्सिंग शुरू करना फायदेमंद होता है। इस indexing मोड को _Grafting_ कहा जाता है। उदाहरण के लिए, विकास के दौरान, यह मैपिंग में छोटे एरर्स को जल्दी से पार करने या किसी मौजूदा सबग्राफ को फिर से चालू करने के लिए उपयोगी होता है, यदि वह फेल हो गया हो। +जब कोई सबग्राफ पहली बार डिप्लॉय किया जाता है, तो यह संबंधित चेन के जेनेसिस ब्लॉक (या प्रत्येक डेटा स्रोत के साथ परिभाषित `startBlock`) से इवेंट्स को indexing करना शुरू करता है। कुछ परिस्थितियों में, मौजूदा सबग्राफ से डेटा को पुन: उपयोग करना और किसी बाद के ब्लॉक से इंडेक्सिंग शुरू करना फायदेमंद होता है। इस indexing मोड को _Grafting_ कहा जाता है। उदाहरण के लिए, विकास के दौरान, यह मैपिंग में छोटे एरर्स को जल्दी से पार करने या किसी मौजूदा सबग्राफ को फिर से चालू करने के लिए उपयोगी होता है, यदि वह फेल हो गया हो। एक सबग्राफ को एक बेस सबग्राफ पर graft किया जाता है जब `subgraph.yaml` में सबग्राफ manifest में शीर्ष स्तर पर एक `graft` ब्लॉक होता है। @@ -546,7 +546,7 @@ graft: block: 7345624 # Block number ``` -जब कोई सबग्राफ , जिसकी मैनिफेस्ट में `graft` ब्लॉक शामिल होता है, डिप्लॉय किया जाता है, तो ग्राफ-नोड दिए गए `block` तक base सबग्राफ के डेटा को कॉपी करेगा और फिर उस ब्लॉक से नए सबग्राफ को इंडेक्स करना जारी रखेगा। base सबग्राफ को लक्षित ग्राफ-नोड इंस्टेंस पर मौजूद होना चाहिए और कम से कम दिए गए ब्लॉक तक इंडेक्स किया जाना चाहिए। इस प्रतिबंध के कारण, ग्राफ्टिंग का उपयोग केवल डेवलपमेंट के दौरान या किसी आपात स्थिति में एक समान गैर-ग्राफ्टेड सबग्राफ को जल्दी से तैयार करने के लिए किया जाना चाहिए। +जब कोई सबग्राफ , जिसकी मैनिफेस्ट में `graft` ब्लॉक शामिल होता है, डिप्लॉय किया जाता है, तो ग्राफ-नोड दिए गए `block` तक base सबग्राफ के डेटा को कॉपी करेगा और फिर उस ब्लॉक से नए सबग्राफ को इंडेक्स करना जारी रखेगा। base सबग्राफ को लक्षित ग्राफ-नोड इंस्टेंस पर मौजूद होना चाहिए और कम से कम दिए गए ब्लॉक तक इंडेक्स किया जाना चाहिए। इस प्रतिबंध के कारण, ग्राफ्टिंग का उपयोग केवल डेवलपमेंट के दौरान या किसी आपात स्थिति में एक समान गैर-ग्राफ्टेड सबग्राफ को जल्दी से तैयार करने के लिए किया जाना चाहिए। ग्राफ्टिंग मूल डेटा के बजाय प्रतिलिपियाँ बनाता है, इसलिए यह शुरू से इंडेक्सिंग करने की तुलना में सबग्राफ को वांछित ब्लॉक तक पहुँचाने में कहीं अधिक तेज़ होता है, हालाँकि बहुत बड़े सबग्राफ के लिए प्रारंभिक डेटा कॉपी करने में अभी भी कई घंटे लग सकते हैं। जब तक ग्राफ्ट किया गया सबग्राफ प्रारंभिक रूप से स्थापित हो रहा होता है, तब तक The ग्राफ नोड उन entity प्रकारों के बारे में जानकारी लॉग करेगा जिन्हें पहले ही कॉपी किया जा चुका है। diff --git a/website/src/pages/hi/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/hi/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/hi/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/hi/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/hi/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/hi/subgraphs/developing/creating/graph-ts/api.mdx index 1bed291fc89f..09cac84df876 100644 --- a/website/src/pages/hi/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/hi/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ Learn what built-in APIs can be used when writing Subgraph mappings. There are t The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Version | Release notes | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Version | Release notes | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Built-in Types @@ -276,7 +276,7 @@ if (transfer == null) { > ध्यान दें: एंटिटी लोड करना तभी आवश्यक है जब मैपिंग में किए गए परिवर्तन किसी एंटिटी के पिछले डेटा पर निर्भर हों। मौजूदा एंटिटी को अपडेट करने के दो तरीकों के लिए अगला सेक्शन देखें। -#### एक ब्लॉक के साथ बनाई गई संस्थाओं को देखना +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### रिवर्टेड कॉल्स को हैंडल करना @@ -595,11 +613,7 @@ The `log` API includes the following functions: The `log` API takes a format string and an array of string values. It then replaces placeholders with the string values from the array. The first `{}` placeholder gets replaced by the first value in the array, the second `{}` placeholder gets replaced by the second value and so on. ```typescript -log.info('संदेश प्रदर्शित किया जाना है: {}, {}, {}', [ - value.toString(), - OtherValue.toString(), - 'पहले से ही एक स्ट्रिंग', -]) +log.info ('संदेश प्रदर्शित किया जाना है: {}, {}, {}', [value.toString (), OtherValue.toString (), 'पहले से ही एक स्ट्रिंग']) ``` #### एक या अधिक मान लॉग करना @@ -670,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### आईपीएफएस एपीआई ```typescript @@ -782,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() या s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -810,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Data Source Metadata diff --git a/website/src/pages/hi/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/hi/subgraphs/developing/creating/install-the-cli.mdx index 031c70bf3507..986587a72cf4 100644 --- a/website/src/pages/hi/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/hi/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - कमांड Etherscan से कॉन्ट्रैक्ट ABI को पुनः प्राप्त करने की कोशिश करता है। - - The Graph CLI एक सार्वजनिक RPC एंडपॉइंट पर निर्भर करता है। जबकि कुछ असफलताएँ अपेक्षित हैं, पुनः प्रयास आमतौर पर इस समस्या को हल कर देते हैं। यदि असफलताएँ बनी रहती हैं, तो एक स्थानीय ABI का उपयोग करने पर विचार करें। - यदि कोई वैकल्पिक तर्क गायब है, तो यह आपको एक इंटरैक्टिव फॉर्म के माध्यम से मार्गदर्शन करता है। @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### विशिष्टताएँ -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/hi/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/hi/subgraphs/developing/creating/ql-schema.mdx index 47c7f97d0406..9db3bf3128ec 100644 --- a/website/src/pages/hi/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/hi/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica गैर-शून्य फ़ील्ड 'नाम' के लिए हल किया गया शून्य मान ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two नीचे दिए गए स्केलर्स GraphQL API में समर्थित हैं: -| प्रकार | Description | -| --- | --- | -| `Bytes` | बाइट सरणी, एक हेक्साडेसिमल स्ट्रिंग के रूप में दर्शाया गया है। आमतौर पर एथेरियम हैश और पतों के लिए उपयोग किया जाता है। | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| प्रकार | Description | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | बाइट सरणी, एक हेक्साडेसिमल स्ट्रिंग के रूप में दर्शाया गया है। आमतौर पर एथेरियम हैश और पतों के लिए उपयोग किया जाता है। | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums @@ -295,24 +295,24 @@ query { समर्थित भाषा शब्दकोश: -| Code | शब्दकोष | -| ------ | --------- | -| simple | General | -| da | Danish | -| nl | Dutch | -| en | English | -| fi | Finnish | -| fr | French | -| de | German | -| hu | Hungarian | -| it | Italian | -| no | Norwegian | -| pt | पुर्तगाली | -| ro | Romanian | -| ru | Russian | -| es | Spanish | -| sv | Swedish | -| tr | Turkish | +| Code | शब्दकोष | +| ------ | ---------- | +| simple | General | +| da | Danish | +| nl | Dutch | +| en | English | +| fi | Finnish | +| fr | French | +| de | German | +| hu | Hungarian | +| it | Italian | +| no | Norwegian | +| pt | पुर्तगाली | +| ro | Romanian | +| ru | Russian | +| es | Spanish | +| sv | Swedish | +| tr | Turkish | ### रैंकिंग एल्गोरिदम diff --git a/website/src/pages/hi/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/hi/subgraphs/developing/creating/starting-your-subgraph.mdx index 180a343470b1..4931e6b1fd34 100644 --- a/website/src/pages/hi/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/hi/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Version | Release notes | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/hi/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/hi/subgraphs/developing/creating/subgraph-manifest.mdx index f3900aeaa283..a2cc8d361012 100644 --- a/website/src/pages/hi/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/hi/subgraphs/developing/creating/subgraph-manifest.mdx @@ -20,7 +20,7 @@ A single Subgraph can: - कई स्मार्ट कॉन्ट्रैक्ट्स से डेटा को इंडेक्स करें (लेकिन कई नेटवर्क नहीं)। -- IPFS फ़ाइलों से डेटा को डेटा स्रोत फ़ाइलें का उपयोग करके अनुक्रमित करें। +- IPFS फ़ाइलों से डेटा को डेटा स्रोत फ़ाइलें का उपयोग करके अनुक्रमित करें। - Add an entry for each contract that requires indexing to the `dataSources` array. @@ -93,7 +93,7 @@ dataSources: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ dataSources: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o कॉल हैंडलर केवल दो मामलों में से एक में ट्रिगर होंगे: जब निर्दिष्ट फ़ंक्शन को अनुबंध के अलावा किसी अन्य खाते द्वारा कॉल किया जाता है या जब इसे सॉलिडिटी में बाहरी के रूप में चिह्नित किया जाता है और उसी अनुबंध में किसी अन्य फ़ंक्शन के भाग के रूप में कॉल किया जाता है। -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### कॉल हैंडलर को परिभाषित करना @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. ब्लॉक हैंडलर के लिए फ़िल्टर की अनुपस्थिति सुनिश्चित करेगी कि हैंडलर को प्रत्येक ब्लॉक कहा जाता है। डेटा स्रोत में प्रत्येक फ़िल्टर प्रकार के लिए केवल एक ब्लॉक हैंडलर हो सकता है। @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Start Blocks The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Version | Release notes | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/hi/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/hi/subgraphs/developing/creating/unit-testing-framework.mdx index 64ec49930c33..a07801358cf4 100644 --- a/website/src/pages/hi/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/hi/subgraphs/developing/creating/unit-testing-framework.mdx @@ -35,7 +35,7 @@ yarn add --dev matchstick-as brew install postgresql ``` -यहां तक कि नवीनतम libpq.5.lib\_ का एक symlink बनाएं। आपको पहले यह dir बनाने की आवश्यकता हो सकती है: `/usr/local/opt/postgresql/lib/` +यहां तक कि नवीनतम libpq.5.lib_ का एक symlink बनाएं। आपको पहले यह dir बनाने की आवश्यकता हो सकती है: `/usr/local/opt/postgresql/lib/` ```sh ln -sf /usr/local/opt/postgresql@14/lib/postgresql@14/libpq.5.dylib /usr/local/opt/postgresql/lib/libpq.5.dylib @@ -63,7 +63,7 @@ static BYTES = Symbol("Bytes") SyntaxError: Unexpected token = /node_modules/gluegun/build/index.js:13 throw up; ``` -कृपया सुनिश्चित करें कि आप नोड.js के नए वर्जन पर हैं, क्योंकि** v10.19.0** अब graph-cli द्वारा समर्थित नहीं है, और यह अभी भी WSL पर नए Ubuntu इमेज के लिए डिफ़ॉल्ट वर्जन है। उदाहरण के लिए,instances Matchstick की पुष्टि हो चुकी है कि यह WSL पर **v18.1.0** के साथ काम कर रहा है। आप इसे **nvm** के माध्यम से या अपने ग्लोबल नोड.js को अपडेट करके स्विच कर सकते हैं।अपडेट के बाद, `नोड_modules` को डिलीट करना न भूलें और \`npm install दोबारा चलाएँ। फिर, सुनिश्चित करें कि आपके पास **libpq** इंस्टॉल है। आप इसे निम्नलिखित कमांड चलाकर कर सकते हैं: +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -99,7 +99,7 @@ To use **Matchstick** in your Subgraph project just open up a terminal, navigate graph test ``` -यह gravity.test.ts नाम का एक परीक्षण चलाएगा और/या गुरुत्वाकर्षण नामक फ़ोल्डर के अंदर सभी परीक्षण चलाएगा: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -567,7 +567,7 @@ assert.dataSourceExists( ## यूनिट टेस्ट लिखें -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). मान लें कि हमारे पास निम्नलिखित हैंडलर फ़ंक्शन हैं (हमारे जीवन को आसान बनाने के लिए दो सहायक कार्यों के साथ): @@ -620,7 +620,7 @@ export function createNewGravatarEvent( } ``` -हमें पहले अपने प्रोजेक्ट में एक टेस्ट फाइल बनानी होगी। यह कैसा दिख सकता है इसका एक उदाहरण है: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -659,7 +659,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - हम अपनी प्रारंभिक स्थिति सेट कर रहे हैं और एक कस्टम Gravatar इकाई जोड़ रहे हैं; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- हम स्टोर की स्थिति पर जोर देते हैं। वह कैसे काम करता है? - हम इकाई प्रकार और आईडी का एक अनूठा संयोजन पारित कर रहे हैं। फिर हम उस इकाई पर एक विशिष्ट क्षेत्र की जाँच करते हैं और दावा करते हैं कि इसका वह मूल्य है जिसकी हम अपेक्षा करते हैं। हम यह दोनों प्रारंभिक Gravatar एंटिटी के लिए कर रहे हैं जिसे हमने स्टोर में जोड़ा है, साथ ही दो Gravatar एंटिटी जो हैंडलर फ़ंक्शन को कॉल करने पर जुड़ जाती हैं; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. ये रहा - हमने अपना पहला परीक्षण बना लिया है! 👏 @@ -859,7 +859,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### इवेंट मेटाडेटा के साथ इंटरैक्ट करना @@ -956,7 +956,7 @@ test('Blow everything up', () => { }) ``` -महत्वपूर्ण त्रुटियों को लॉग करने से परीक्षणों का निष्पादन बंद हो जाएगा और सब कुछ उड़ जाएगा। आखिरकार - हम यह सुनिश्चित करना चाहते हैं कि आपके कोड में परिनियोजन में महत्वपूर्ण लॉग नहीं हैं, और यदि ऐसा होता है तो आपको तुरंत ध्यान देना चाहिए। +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### व्युत्पन्न क्षेत्रों का परीक्षण @@ -1293,7 +1293,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### आवश्यक शर्तें diff --git a/website/src/pages/hi/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/hi/subgraphs/developing/deploying/multiple-networks.mdx index d10ef9160dc6..6a4efc49ef2e 100644 --- a/website/src/pages/hi/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/hi/subgraphs/developing/deploying/multiple-networks.mdx @@ -213,7 +213,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/hi/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/hi/subgraphs/developing/deploying/using-subgraph-studio.mdx index eab335f08623..e4a38c427323 100644 --- a/website/src/pages/hi/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/hi/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -25,7 +25,7 @@ In Subgraph Studio,आप निम Deploy करने से पहले, आपको The Graph CLI इंस्टॉल करना होगा। -आपको The Graph CLI का उपयोग करने के लिए Node.js(https://nodejs.org/) और आपकी पसंद का पैकेज मैनेजर (npm, yarn या pnpm) स्थापित होना चाहिए। सबसे हालिया (https://github.com/graphprotocol/graph-tooling/releases?q=%40graphprotocol%2Fgraph-cli&expanded=true) CLI संस्करण की जांच करें। +आपको The Graph CLI का उपयोग करने के लिए Node.js(https://nodejs.org/) और आपकी पसंद का पैकेज मैनेजर (npm, yarn या pnpm) स्थापित होना चाहिए। सबसे हालिया (https://github.com/graphprotocol/graph-tooling/releases?q=%40graphprotocol%2Fgraph-cli&expanded=true) CLI संस्करण की जांच करें। ### इंस्टॉल करें 'yarn' के साथ @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ graph deploy After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## अपने Subgraph को प्रकाशित करें diff --git a/website/src/pages/hi/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/hi/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 4de4472caf4c..ef1a8060175f 100644 --- a/website/src/pages/hi/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/hi/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> Si tratta di una nuova funzionalità, che sarà disponibile in Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/it/resources/benefits.mdx b/website/src/pages/it/resources/benefits.mdx index e3da622b854c..30648d13ad74 100644 --- a/website/src/pages/it/resources/benefits.mdx +++ b/website/src/pages/it/resources/benefits.mdx @@ -21,53 +21,53 @@ Ecco l'analisi: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Confronto costi | Self Hosted | The Graph Network | -| :-: | :-: | :-: | -| Costo mensile del server\* | $350 al mese | $0 | -| Costi di query | $0+ | $0 per month | -| Tempo di progettazione | $400 al mese | Nessuno, integrato nella rete con indicizzatori distribuiti a livello globale | -| Query al mese | Limitato alle capacità di infra | 100,000 (Free Plan) | -| Costo per query | $0 | $0 | -| Infrastructure | Centralizzato | Decentralizzato | -| Ridondanza geografica | $750+ per nodo aggiuntivo | Incluso | -| Tempo di attività | Variabile | 99.9%+ | -| Costo totale mensile | $750+ | $0 | +| Confronto costi | Self Hosted | The Graph Network | +| :--------------------------------: | :-------------------------------------: | :---------------------------------------------------------------------------: | +| Costo mensile del server\* | $350 al mese | $0 | +| Costi di query | $0+ | $0 per month | +| Tempo di progettazione | $400 al mese | Nessuno, integrato nella rete con indicizzatori distribuiti a livello globale | +| Query al mese | Limitato alle capacità di infra | 100,000 (Free Plan) | +| Costo per query | $0 | $0 | +| Infrastructure | Centralizzato | Decentralizzato | +| Ridondanza geografica | $750+ per nodo aggiuntivo | Incluso | +| Tempo di attività | Variabile | 99.9%+ | +| Costo totale mensile | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Confronto costi | Self Hosted | The Graph Network | -| :-: | :-: | :-: | -| Costo mensile del server\* | $350 al mese | $0 | -| Costi di query | $500 al mese | $120 per month | -| Tempo di progettazione | $800 al mese | Nessuno, integrato nella rete con indicizzatori distribuiti a livello globale | -| Query al mese | Limitato alle capacità di infra | ~3,000,000 | -| Costo per query | $0 | $0.00004 | -| Infrastructure | Centralizzato | Decentralizzato | -| Costi di ingegneria | $200 all'ora | Incluso | -| Ridondanza geografica | $1.200 di costi totali per nodo aggiuntivo | Incluso | -| Tempo di attività | Variabile | 99.9%+ | -| Costo totale mensile | $1,650+ | $120 | +| Confronto costi | Self Hosted | The Graph Network | +| :--------------------------------: | :----------------------------------------: | :---------------------------------------------------------------------------: | +| Costo mensile del server\* | $350 al mese | $0 | +| Costi di query | $500 al mese | $120 per month | +| Tempo di progettazione | $800 al mese | Nessuno, integrato nella rete con indicizzatori distribuiti a livello globale | +| Query al mese | Limitato alle capacità di infra | ~3,000,000 | +| Costo per query | $0 | $0.00002 | +| Infrastructure | Centralizzato | Decentralizzato | +| Costi di ingegneria | $200 all'ora | Incluso | +| Ridondanza geografica | $1.200 di costi totali per nodo aggiuntivo | Incluso | +| Tempo di attività | Variabile | 99.9%+ | +| Costo totale mensile | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Confronto costi | Self Hosted | The Graph Network | -| :-: | :-: | :-: | -| Costo mensile del server\* | $1100 al mese, per nodo | $0 | -| Costi di query | $4000 | $1,200 per month | -| Numero di nodi necessari | 10 | Non applicabile | -| Tempo di progettazione | $6.000 o più al mese | Nessuno, integrato nella rete con indicizzatori distribuiti a livello globale | -| Query al mese | Limitato alle capacità di infra | ~30,000,000 | -| Costo per query | $0 | $0.00004 | -| Infrastructure | Centralizzato | Decentralizzato | -| Ridondanza geografica | $1.200 di costi totali per nodo aggiuntivo | Incluso | -| Tempo di attività | Variabile | 99.9%+ | -| Costo totale mensile | $11,000+ | $1,200 | +| Confronto costi | Self Hosted | The Graph Network | +| :--------------------------------: | :-----------------------------------------: | :---------------------------------------------------------------------------: | +| Costo mensile del server\* | $1100 al mese, per nodo | $0 | +| Costi di query | $4000 | $1,200 per month | +| Numero di nodi necessari | 10 | Non applicabile | +| Tempo di progettazione | $6.000 o più al mese | Nessuno, integrato nella rete con indicizzatori distribuiti a livello globale | +| Query al mese | Limitato alle capacità di infra | ~30,000,000 | +| Costo per query | $0 | $0.00002 | +| Infrastructure | Centralizzato | Decentralizzato | +| Ridondanza geografica | $1.200 di costi totali per nodo aggiuntivo | Incluso | +| Tempo di attività | Variabile | 99.9%+ | +| Costo totale mensile | $11,000+ | $1,200 | \*inclusi i costi per il backup: $50-$100 al mese diff --git a/website/src/pages/it/resources/claude-mcp.mdx b/website/src/pages/it/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/it/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/it/subgraphs/developing/creating/advanced.mdx b/website/src/pages/it/subgraphs/developing/creating/advanced.mdx index 741d77c979d9..8080e3107a56 100644 --- a/website/src/pages/it/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/it/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Panoramica -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/it/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/it/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/it/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/it/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/it/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/it/subgraphs/developing/creating/graph-ts/api.mdx index 06fd431e7048..40d0d67f002f 100644 --- a/website/src/pages/it/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/it/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ La libreria `@graphprotocol/graph-ts` fornisce le seguenti API: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Versione | Note di rilascio | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Aggiunte le classi `TransactionReceipt` e `Log` ai tipi di Ethereum
Aggiunto il campo `receipt` all'oggetto Ethereum Event | -| 0.0.6 | Aggiunto il campo `nonce` all'oggetto Ethereum Transaction
Aggiunto `baseFeePerGas` all'oggetto Ethereum Block | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Aggiunto il campo `functionSignature` all'oggetto Ethereum SmartContractCall | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Aggiunto il campo `input` all'oggetto Ethereum Transaction | +| Versione | Note di rilascio | +| :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Aggiunte le classi `TransactionReceipt` e `Log` ai tipi di Ethereum
Aggiunto il campo `receipt` all'oggetto Ethereum Event | +| 0.0.6 | Aggiunto il campo `nonce` all'oggetto Ethereum Transaction
Aggiunto `baseFeePerGas` all'oggetto Ethereum Block | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Aggiunto il campo `functionSignature` all'oggetto Ethereum SmartContractCall | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Aggiunto il campo `input` all'oggetto Ethereum Transaction | ### Tipi integrati @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Ricerca delle entità create all'interno di un blocco +#### Looking up entities created within a block A partire da `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 e `@graphprotocol/graph-cli` v0.49.0 il metodo `loadInBlock` è disponibile per tutti i tipi di entità. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` è alias di `TransferEvent` qui per evitare un conflitto di nomi con il tipo di entità +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. Finché il `ERC20Contract` su Ethereum ha una funzione pubblica di sola lettura chiamata `symbol`, questa può essere chiamata con `.symbol()`. Per le variabili di stato pubbliche viene creato automaticamente un metodo con lo stesso nome. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Gestione delle chiamate annullate @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -770,44 +790,45 @@ Quando il tipo di un valore è certo, può essere convertito in un [tipo incorpo ### Riferimento alle conversioni di tipo -| Fonte(i) | Destinazione | Funzione di conversione | -| -------------------- | -------------------- | --------------------------- | -| Address | Bytes | none | -| Address | String | s.toHexString() | -| BigDecimal | String | s.toString() | -| BigInt | BigDecimal | s.toBigDecimal() | -| BigInt | String (hexadecimal) | s.toHexString() o s.toHex() | -| BigInt | String (unicode) | s.toString() | -| BigInt | i32 | s.toI32() | -| Boolean | Boolean | none | -| Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | -| Bytes (unsigned) | BigInt | BigInt.fromUnsignedBytes(s) | -| Bytes | String (hexadecimal) | s.toHexString() o s.toHex() | -| Bytes | String (unicode) | s.toString() | -| Bytes | String (base58) | s.toBase58() | -| Bytes | i32 | s.toI32() | -| Bytes | u32 | s.toU32() | -| Bytes | JSON | json.fromBytes(s) | -| int8 | i32 | none | -| int32 | i32 | none | -| int32 | BigInt | BigInt.fromI32(s) | -| uint24 | i32 | none | -| int64 - int256 | BigInt | none | -| uint32 - uint256 | BigInt | none | -| JSON | boolean | s.toBool() | -| JSON | i64 | s.toI64() | -| JSON | u64 | s.toU64() | -| JSON | f64 | s.toF64() | -| JSON | BigInt | s.toBigInt() | -| JSON | string | s.toString() | -| JSON | Array | s.toArray() | -| JSON | Object | s.toObject() | -| String | Address | Address.fromString(s) | -| Bytes | Address | Address.fromBytes(s) | -| String | BigInt | BigInt.fromString(s) | -| String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| Fonte(i) | Destinazione | Funzione di conversione | +| -------------------- | --------------------- | -------------------------------- | +| Address | Bytes | none | +| Address | String | s.toHexString() | +| BigDecimal | String | s.toString() | +| BigInt | BigDecimal | s.toBigDecimal() | +| BigInt | String (hexadecimal) | s.toHexString() o s.toHex() | +| BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | +| BigInt | i32 | s.toI32() | +| Boolean | Boolean | none | +| Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | +| Bytes (unsigned) | BigInt | BigInt.fromUnsignedBytes(s) | +| Bytes | String (hexadecimal) | s.toHexString() o s.toHex() | +| Bytes | String (unicode) | s.toString() | +| Bytes | String (base58) | s.toBase58() | +| Bytes | i32 | s.toI32() | +| Bytes | u32 | s.toU32() | +| Bytes | JSON | json.fromBytes(s) | +| int8 | i32 | none | +| int32 | i32 | none | +| int32 | BigInt | BigInt.fromI32(s) | +| uint24 | i32 | none | +| int64 - int256 | BigInt | none | +| uint32 - uint256 | BigInt | none | +| JSON | boolean | s.toBool() | +| JSON | i64 | s.toI64() | +| JSON | u64 | s.toU64() | +| JSON | f64 | s.toF64() | +| JSON | BigInt | s.toBigInt() | +| JSON | string | s.toString() | +| JSON | Array | s.toArray() | +| JSON | Object | s.toObject() | +| String | Address | Address.fromString(s) | +| Bytes | Address | Address.fromBytes(s) | +| String | BigInt | BigInt.fromString(s) | +| String | BigDecimal | BigDecimal.fromString(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Metadati della Data Source diff --git a/website/src/pages/it/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/it/subgraphs/developing/creating/install-the-cli.mdx index 20770b2e37b7..0e088bc21a52 100644 --- a/website/src/pages/it/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/it/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/it/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/it/subgraphs/developing/creating/ql-schema.mdx index 0ff55e8a7234..c9af877de779 100644 --- a/website/src/pages/it/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/it/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Tipo | Descrizione | -| --- | --- | -| `Bytes` | Byte array, rappresentato come una stringa esadecimale. Comunemente utilizzato per gli hash e gli indirizzi di Ethereum. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Tipo | Descrizione | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, rappresentato come una stringa esadecimale. Comunemente utilizzato per gli hash e gli indirizzi di Ethereum. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enum diff --git a/website/src/pages/it/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/it/subgraphs/developing/creating/starting-your-subgraph.mdx index 49090d6b963f..5b0ac052a82d 100644 --- a/website/src/pages/it/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/it/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Versione | Note di rilascio | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Versione | Note di rilascio | +| :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/it/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/it/subgraphs/developing/creating/subgraph-manifest.mdx index e2ca99ea6043..e47c569d3a90 100644 --- a/website/src/pages/it/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/it/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ Le voci importanti da aggiornare per il manifesto sono: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ Le voci importanti da aggiornare per il manifesto sono: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o I gestori di chiamate si attivano solo in uno dei due casi: quando la funzione specificata viene chiamata da un conto diverso dal contratto stesso o quando è contrassegnata come esterna in Solidity e chiamata come parte di un'altra funzione nello stesso contratto. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Definire un gestore di chiamate @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. L'assenza di un filtro per un gestore di blocchi garantisce che il gestore venga chiamato a ogni blocco. Una data source può contenere un solo gestore di blocchi per ogni tipo di filtro. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Blocchi di partenza The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Versione | Note di rilascio | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Versione | Note di rilascio | +| :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/it/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/it/subgraphs/developing/creating/unit-testing-framework.mdx index c3e791437e9f..9bf48b240a33 100644 --- a/website/src/pages/it/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/it/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ oppure /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ This will run all tests in the test folder: graph test ``` -This will run a test named gravity.test.ts and/or all test inside of a folder named gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Write a Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Assuming we have the following handler function (along with two helper functions to make our life easier): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. This is an example of how that might look like: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - We're setting up our initial state and adding one custom Gravatar entity; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that gets added when the handler function is called; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. There we go - we've created our first test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interacting with Event metadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure you're code doesn't have critical logs in deployment, and you should notice right away if that were to happen. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing derived fields @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/it/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/it/subgraphs/developing/deploying/multiple-networks.mdx index f8b9f74c6479..14056f78d173 100644 --- a/website/src/pages/it/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/it/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/it/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/it/subgraphs/developing/deploying/using-subgraph-studio.mdx index 3a07d7d50b24..f1e69207ee72 100644 --- a/website/src/pages/it/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/it/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/it/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/it/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 1672a6619d13..985a5bd7d9d7 100644 --- a/website/src/pages/it/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/it/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> これは新しい機能で、Graph Node 0.29.xで利用可能になる予定です。 - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/ja/resources/benefits.mdx b/website/src/pages/ja/resources/benefits.mdx index ff45cbdff7c3..04eb86d76b11 100644 --- a/website/src/pages/ja/resources/benefits.mdx +++ b/website/src/pages/ja/resources/benefits.mdx @@ -21,53 +21,53 @@ The benefits of this decentralized protocol cannot be replicated by running a `g ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| コスト比較 | セルフホスト | グラフネットワーク | -| :-: | :-: | :-: | -| 月額サーバー代 | $350/月 | $0 | -| クエリコスト | $0+ | $0 per month | -| エンジニアリングタイム | $400/月 | なし/ グローバルに分散されたインデクサーでネットワークに組み込まれる | -| 月ごとのクエリ | インフラ機能に限定 | 100,000 (Free Plan) | -| クエリごとのコスト | $0 | $0 | -| Infrastructure | 集中管理型 | 分散型 | -| 地理的な冗長性 | 追加1ノードにつき$750+ | 含まれる | -| アップタイム | バリエーション | 99.9%+ | -| 月額費用合計 | $750+ | $0 | +| コスト比較 | セルフホスト | グラフネットワーク | +| :---------------------: | :-------------------------------------: | :---------------------------------: | +| 月額サーバー代 | $350/月 | $0 | +| クエリコスト | $0+ | $0 per month | +| エンジニアリングタイム | $400/月 | なし/ グローバルに分散されたインデクサーでネットワークに組み込まれる | +| 月ごとのクエリ | インフラ機能に限定 | 100,000 (Free Plan) | +| クエリごとのコスト | $0 | $0 | +| Infrastructure | 集中管理型 | 分散型 | +| 地理的な冗長性 | 追加1ノードにつき$750+ | 含まれる | +| アップタイム | バリエーション | 99.9%+ | +| 月額費用合計 | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| コスト比較 | セルフホスト | グラフネットワーク | -| :-: | :-: | :-: | -| 月額サーバー代 | $350/月 | $0 | -| クエリコスト | $500/月 | $120 per month | -| エンジニアリングタイム | $800/月 | なし/ グローバルに分散されたインデクサーでネットワークに組み込まれる | -| 月ごとのクエリ | インフラ機能に限定 | ~3,000,000 | -| クエリごとのコスト | $0 | $0.00004 | -| Infrastructure | 集中管理型 | 分散型 | -| エンジニアリングコスト | $200/時 | 含まれる | -| 地理的な冗長性 | ノード追加1台につき合計1,200ドル | 含まれる | -| アップタイム | バリエーション | 99.9%+ | -| 月額費用合計 | $1,650+ | $120 | +| コスト比較 | セルフホスト | グラフネットワーク | +| :---------------------: | :----------------------------------------: | :---------------------------------: | +| 月額サーバー代 | $350/月 | $0 | +| クエリコスト | $500/月 | $120 per month | +| エンジニアリングタイム | $800/月 | なし/ グローバルに分散されたインデクサーでネットワークに組み込まれる | +| 月ごとのクエリ | インフラ機能に限定 | ~3,000,000 | +| クエリごとのコスト | $0 | $0.00002 | +| Infrastructure | 集中管理型 | 分散型 | +| エンジニアリングコスト | $200/時 | 含まれる | +| 地理的な冗長性 | ノード追加1台につき合計1,200ドル | 含まれる | +| アップタイム | バリエーション | 99.9%+ | +| 月額費用合計 | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| コスト比較 | セルフホスト | グラフネットワーク | -| :-: | :-: | :-: | -| 月額サーバー代 | $1100/月(ノードごと) | $0 | -| クエリコスト | $4000 | $1,200 per month | -| 必要ノード数 | 10 | 該当なし | -| エンジニアリングタイム | $6,000/月 | なし/ グローバルに分散されたインデクサーでネットワークに組み込まれる | -| 月ごとのクエリ | インフラ機能に限定 | ~30,000,000 | -| クエリごとのコスト | $0 | $0.00004 | -| Infrastructure | 集中管理型 | 分散型 | -| 地理的な冗長性 | ノード追加1台につき合計1,200ドル | 含まれる | -| アップタイム | バリエーション | 99.9%+ | -| 月額費用合計 | $11,000+ | $1,200 | +| コスト比較 | セルフホスト | グラフネットワーク | +| :---------------------: | :-----------------------------------------: | :---------------------------------: | +| 月額サーバー代 | $1100/月(ノードごと) | $0 | +| クエリコスト | $4000 | $1,200 per month | +| 必要ノード数 | 10 | 該当なし | +| エンジニアリングタイム | $6,000/月 | なし/ グローバルに分散されたインデクサーでネットワークに組み込まれる | +| 月ごとのクエリ | インフラ機能に限定 | ~30,000,000 | +| クエリごとのコスト | $0 | $0.00002 | +| Infrastructure | 集中管理型 | 分散型 | +| 地理的な冗長性 | ノード追加1台につき合計1,200ドル | 含まれる | +| アップタイム | バリエーション | 99.9%+ | +| 月額費用合計 | $11,000+ | $1,200 | \*バックアップ費用含む:月額$50〜$100 diff --git a/website/src/pages/ja/resources/claude-mcp.mdx b/website/src/pages/ja/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/ja/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/ja/subgraphs/developing/creating/advanced.mdx b/website/src/pages/ja/subgraphs/developing/creating/advanced.mdx index fc0e92c003b1..42cdf42d1ded 100644 --- a/website/src/pages/ja/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/ja/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## 概要 -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/ja/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/ja/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/ja/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/ja/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/ja/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/ja/subgraphs/developing/creating/graph-ts/api.mdx index 94df906daad7..fb1a5fba4b21 100644 --- a/website/src/pages/ja/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/ja/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ Since language mappings are written in AssemblyScript, it is useful to review th The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| バージョン | リリースノート | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Ethereum タイプに `TransactionReceipt` と `Log` クラスを追加
Ethereum Event オブジェクトに `receipt` フィールドを追加。 | -| 0.0.6 | Ethereum Transactionオブジェクトに`nonce`フィールドを追加
Ethereum Blockオブジェクトに`baseFeePerGas`を追加。 | +| バージョン | リリースノート | +| :---: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Ethereum タイプに `TransactionReceipt` と `Log` クラスを追加
Ethereum Event オブジェクトに `receipt` フィールドを追加。 | +| 0.0.6 | Ethereum Transactionオブジェクトに`nonce`フィールドを追加
Ethereum Blockオブジェクトに`baseFeePerGas`を追加。 | | 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Ethereum SmartContractCall オブジェクトにfunctionSignatureフィールドを追加 | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Ethereum Transaction オブジェクトに inputフィールドを追加 | +| 0.0.4 | Ethereum SmartContractCall オブジェクトにfunctionSignatureフィールドを追加 | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Ethereum Transaction オブジェクトに inputフィールドを追加 | ### 組み込み型 @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### ブロック内で作成されたエンティティの検索 +#### Looking up entities created within a block graph-node v0.31.0、@graphprotocol/graph-ts v0.30.0、および @graphprotocol/graph-cli v0.49.0 以降、 loadInBlock メソッドはすべてのエンティティ タイプで使用できます。 @@ -286,7 +286,7 @@ The store API facilitates the retrieval of entities that were created or updated - For some Subgraphs, these missed lookups can contribute significantly to the indexing time. ```typescript -let id = event.transaction.hash // または ID が構築される方法 +let id =event.transaction.hash // または ID が構築される方法 let transfer = Transfer.loadInBlock(id) if (transfer == null) { transfer = 新しい転送(id) @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -Transferは、エンティティタイプとの名前の衝突を避けるために、ここではTransferEventにエイリアスされています。 +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. Ethereum の ERC20Contractにsymbolというパブリックな読み取り専用の関数があれば、.symbol()で呼び出すことができます。 パブリックな状態変数については、同じ名前のメソッドが自動的に作成されます。 -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### リバートされた呼び出しの処理 @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -770,44 +790,45 @@ if (value.kind == JSONValueKind.BOOL) { ### タイプ 変換参照 -| Source(s) | Destination | Conversion function | -| -------------------- | -------------------- | ---------------------------- | -| Address | Bytes | none | -| Address | String | s.toHexString() | -| BigDecimal | String | s.toString() | -| BigInt | BigDecimal | s.toBigDecimal() | -| BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | -| BigInt | String (unicode) | s.toString() | -| BigInt | i32 | s.toI32() | -| Boolean | Boolean | none | -| Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | -| Bytes (unsigned) | BigInt | BigInt.fromUnsignedBytes(s) | -| Bytes | String (hexadecimal) | s.toHexString() or s.toHex() | -| Bytes | String (unicode) | s.toString() | -| Bytes | String (base58) | s.toBase58() | -| Bytes | i32 | s.toI32() | -| Bytes | u32 | s.toU32() | -| Bytes | JSON | json.fromBytes(s) | -| int8 | i32 | none | -| int32 | i32 | none | -| int32 | BigInt | Bigint.fromI32(s) | -| uint24 | i32 | none | -| int64 - int256 | BigInt | none | -| uint32 - uint256 | BigInt | none | -| JSON | boolean | s.toBool() | -| JSON | i64 | s.toI64() | -| JSON | u64 | s.toU64() | -| JSON | f64 | s.toF64() | -| JSON | BigInt | s.toBigInt() | -| JSON | string | s.toString() | -| JSON | Array | s.toArray() | -| JSON | Object | s.toObject() | -| String | Address | Address.fromString(s) | -| Bytes | Address | Address.fromString(s) | -| String | BigInt | BigDecimal.fromString(s) | -| String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| Source(s) | Destination | Conversion function | +| -------------------- | -------------------- | -------------------------------- | +| Address | Bytes | none | +| Address | String | s.toHexString() | +| BigDecimal | String | s.toString() | +| BigInt | BigDecimal | s.toBigDecimal() | +| BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | +| BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | +| BigInt | i32 | s.toI32() | +| Boolean | Boolean | none | +| Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | +| Bytes (unsigned) | BigInt | BigInt.fromUnsignedBytes(s) | +| Bytes | String (hexadecimal) | s.toHexString() or s.toHex() | +| Bytes | String (unicode) | s.toString() | +| Bytes | String (base58) | s.toBase58() | +| Bytes | i32 | s.toI32() | +| Bytes | u32 | s.toU32() | +| Bytes | JSON | json.fromBytes(s) | +| int8 | i32 | none | +| int32 | i32 | none | +| int32 | BigInt | Bigint.fromI32(s) | +| uint24 | i32 | none | +| int64 - int256 | BigInt | none | +| uint32 - uint256 | BigInt | none | +| JSON | boolean | s.toBool() | +| JSON | i64 | s.toI64() | +| JSON | u64 | s.toU64() | +| JSON | f64 | s.toF64() | +| JSON | BigInt | s.toBigInt() | +| JSON | string | s.toString() | +| JSON | Array | s.toArray() | +| JSON | Object | s.toObject() | +| String | Address | Address.fromString(s) | +| Bytes | Address | Address.fromString(s) | +| String | BigInt | BigDecimal.fromString(s) | +| String | BigDecimal | BigDecimal.fromString(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### データソースのメタデータ diff --git a/website/src/pages/ja/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/ja/subgraphs/developing/creating/install-the-cli.mdx index 3352df16b841..09236f7f6d6e 100644 --- a/website/src/pages/ja/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/ja/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/ja/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/ja/subgraphs/developing/creating/ql-schema.mdx index 5ee3f442eef9..8c875342570e 100644 --- a/website/src/pages/ja/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/ja/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null 以外のフィールド 'name' の null 値が解決されました ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| タイプ | 説明書き | -| --- | --- | -| `Bytes` | Byte 配列で、16 進数の文字列で表されます。Ethereum のハッシュやアドレスによく使われます。 | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| タイプ | 説明書き | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte 配列で、16 進数の文字列で表されます。Ethereum のハッシュやアドレスによく使われます。 | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums @@ -296,29 +296,29 @@ query { サポートされている言語の辞書: | Code | 辞書 | -| ------ | ------------ | -| simple | General | -| da | Danish | -| nl | Dutch | -| en | English | -| fi | Finnish | -| fr | French | -| de | German | -| hu | Hungarian | -| it | Italian | -| no | Norwegian | -| pt | ポルトガル語 | -| ro | Romanian | -| ru | Russian | -| es | Spanish | -| sv | Swedish | -| tr | Turkish | +| ------ | ---------- | +| simple | General | +| da | Danish | +| nl | Dutch | +| en | English | +| fi | Finnish | +| fr | French | +| de | German | +| hu | Hungarian | +| it | Italian | +| no | Norwegian | +| pt | ポルトガル語 | +| ro | Romanian | +| ru | Russian | +| es | Spanish | +| sv | Swedish | +| tr | Turkish | ### ランキングアルゴリズム サポートされている結果の順序付けのアルゴリズム: -| Algorithm | Description | -| ------------- | ------------------------------------------------------------------- | -| rank | フルテキストクエリのマッチ品質 (0-1) を使用して結果を並べ替えます。 | -| proximityRank | Similar to rank but also includes the proximity of the matches. | +| Algorithm | Description | +| ------------- | ----------------------------------------------------------------------- | +| rank | フルテキストクエリのマッチ品質 (0-1) を使用して結果を並べ替えます。 | +| proximityRank | Similar to rank but also includes the proximity of the matches. | diff --git a/website/src/pages/ja/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/ja/subgraphs/developing/creating/starting-your-subgraph.mdx index 3fd648b44813..3c40e48ef42d 100644 --- a/website/src/pages/ja/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/ja/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| バージョン | リリースノート | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | +| バージョン | リリースノート | +| :---: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | | 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ja/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/ja/subgraphs/developing/creating/subgraph-manifest.mdx index fb2a17678456..fda6bc0dd55a 100644 --- a/website/src/pages/ja/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/ja/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ dataSources: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ dataSources: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o コールハンドラーは、次の 2 つのケースのいずれかでのみトリガされます:指定された関数がコントラクト自身以外のアカウントから呼び出された場合、または Solidity で外部としてマークされ、同じコントラクト内の別の関数の一部として呼び出された場合。 -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### コールハンドラーの定義 @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. ブロックハンドラーにフィルターがない場合、ハンドラーはブロックごとに呼び出されます。1 つのデータソースには、各フィルタータイプに対して 1 つのブロックハンドラーしか含めることができません。 @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## スタートブロック(start Blocks) The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| バージョン | リリースノート | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | +| バージョン | リリースノート | +| :---: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | | 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ja/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/ja/subgraphs/developing/creating/unit-testing-framework.mdx index ececebba24c5..7bdf6779e6a3 100644 --- a/website/src/pages/ja/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/ja/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ static BYTES = Symbol("Bytes") SyntaxError: Unexpected token = /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev (インストール) @@ -97,7 +97,7 @@ To use **Matchstick** in your Subgraph project just open up a terminal, navigate グラフテスト ``` -これは、gravity.test.tsという名前のテストと、gravityというフォルダの中にあるすべてのテストを実行します: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh gravityのテスト @@ -565,7 +565,7 @@ assert.dataSourceExists( ## 単体テストを書く -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). 次のようなハンドラ関数があるとします(さらに、生活を便利にするための2つのヘルパー関数もあります)。 @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -まず、プロジェクト内にテストファイルを作成する必要があります。これは、そのような例です: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - 初期状態を設定し、カスタムGravatarエンティティを1つ追加しています; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- storeの状態をアサートする場合、これはどのように行われるのでしょうか。- Entityの種類とidの一意の組み合わせを渡します。そして、そのEntityの特定のフィールドをチェックし、期待通りの値を持っていることを表明します。これはstoreに追加した最初の Gravatar Entity と、ハンドラ関数が呼び出されたときに追加される 2 つの Gravatar Entity の両方に対して行っているのです。 +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. これで最初のテストが完成しました! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### イベントメタデータとのやりとり @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -クリティカルエラーのログを取るとテストの実行が止まり、すべてが飛んでしまいます。コードに重要なログがデプロイされていないことを確認し、もし発生した場合にはすぐに気付く必要があります。 +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### 派生フィールドのテスト @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/ja/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/ja/subgraphs/developing/deploying/multiple-networks.mdx index a43e7a32c7b8..271a81b74cfa 100644 --- a/website/src/pages/ja/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/ja/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/ja/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/ja/subgraphs/developing/deploying/using-subgraph-studio.mdx index 4e8503e208e4..3b4a1ecf9ba7 100644 --- a/website/src/pages/ja/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/ja/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/ja/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/ja/subgraphs/developing/publishing/publishing-a-subgraph.mdx index c26672ec6b84..4efa2628552b 100644 --- a/website/src/pages/ja/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/ja/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> This is new functionality, which will be available in Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/ko/resources/benefits.mdx b/website/src/pages/ko/resources/benefits.mdx index bc912072b801..ef5fe95daf7d 100644 --- a/website/src/pages/ko/resources/benefits.mdx +++ b/website/src/pages/ko/resources/benefits.mdx @@ -21,53 +21,53 @@ Here is an analysis: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Cost Comparison | Self Hosted | The Graph 네트워크 | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $0+ | $0 per month | -| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | -| Cost per query | $0 | $0 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $750+ per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $750+ | $0 | +| Cost Comparison | Self Hosted | The Graph 네트워크 | +| :--------------------------: | :-------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $0+ | $0 per month | +| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | +| Cost per query | $0 | $0 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $750+ per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Cost Comparison | Self Hosted | The Graph 네트워크 | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $500 per month | $120 per month | -| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~3,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Engineering expense | $200 per hour | Included | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $1,650+ | $120 | +| Cost Comparison | Self Hosted | The Graph 네트워크 | +| :--------------------------: | :----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $500 per month | $120 per month | +| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~3,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Engineering expense | $200 per hour | Included | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Cost Comparison | Self Hosted | The Graph 네트워크 | -| :-: | :-: | :-: | -| Monthly server cost\* | $1100 per month, per node | $0 | -| Query costs | $4000 | $1,200 per month | -| Number of nodes needed | 10 | Not applicable | -| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~30,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $11,000+ | $1,200 | +| Cost Comparison | Self Hosted | The Graph 네트워크 | +| :--------------------------: | :-----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $1100 per month, per node | $0 | +| Query costs | $4000 | $1,200 per month | +| Number of nodes needed | 10 | Not applicable | +| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~30,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $11,000+ | $1,200 | \*including costs for backup: $50-$100 per month diff --git a/website/src/pages/ko/resources/claude-mcp.mdx b/website/src/pages/ko/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/ko/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/ko/subgraphs/developing/creating/advanced.mdx b/website/src/pages/ko/subgraphs/developing/creating/advanced.mdx index 8dbc48253034..461c41304b08 100644 --- a/website/src/pages/ko/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/ko/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Overview -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/ko/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/ko/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/ko/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/ko/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/ko/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/ko/subgraphs/developing/creating/graph-ts/api.mdx index 5be2530c4d6b..b7c9a1a4ecbe 100644 --- a/website/src/pages/ko/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/ko/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Version | Release notes | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Version | Release notes | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Built-in Types @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Looking up entities created withing a block +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Handling Reverted Calls @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Data Source Metadata diff --git a/website/src/pages/ko/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/ko/subgraphs/developing/creating/install-the-cli.mdx index c9d6966ef5fe..e33a1b5f9ef7 100644 --- a/website/src/pages/ko/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/ko/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/ko/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/ko/subgraphs/developing/creating/ql-schema.mdx index 7e0f889447c5..ae80ab827544 100644 --- a/website/src/pages/ko/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/ko/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Type | Description | -| --- | --- | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Type | Description | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums diff --git a/website/src/pages/ko/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/ko/subgraphs/developing/creating/starting-your-subgraph.mdx index 180a343470b1..4931e6b1fd34 100644 --- a/website/src/pages/ko/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/ko/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Version | Release notes | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ko/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/ko/subgraphs/developing/creating/subgraph-manifest.mdx index 78e4a3a55e7d..2c4bc1e9b1b5 100644 --- a/website/src/pages/ko/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/ko/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ The important entries to update for the manifest are: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ The important entries to update for the manifest are: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Call handlers will only trigger in one of two cases: when the function specified is called by an account other than the contract itself or when it is marked as external in Solidity and called as part of another function in the same contract. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Defining a Call Handler @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. The absence of a filter for a block handler will ensure that the handler is called every block. A data source can only contain one block handler for each filter type. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Start Blocks The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Version | Release notes | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ko/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/ko/subgraphs/developing/creating/unit-testing-framework.mdx index e56e1109bc04..1ec03c5555c7 100644 --- a/website/src/pages/ko/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/ko/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ or /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ This will run all tests in the test folder: graph test ``` -This will run a test named gravity.test.ts and/or all test inside of a folder named gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Write a Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Assuming we have the following handler function (along with two helper functions to make our life easier): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. This is an example of how that might look like: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - We're setting up our initial state and adding one custom Gravatar entity; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that gets added when the handler function is called; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. There we go - we've created our first test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interacting with Event metadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure you're code doesn't have critical logs in deployment, and you should notice right away if that were to happen. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing derived fields @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/ko/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/ko/subgraphs/developing/deploying/multiple-networks.mdx index 3b2b1bbc70ae..5c8016b18c91 100644 --- a/website/src/pages/ko/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/ko/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/ko/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/ko/subgraphs/developing/deploying/using-subgraph-studio.mdx index 77d10212c770..d44f9b375203 100644 --- a/website/src/pages/ko/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/ko/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/ko/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/ko/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 2bc0ec5f514c..e3e3a7e3d455 100644 --- a/website/src/pages/ko/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/ko/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> This is new functionality, which will be available in Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/mr/resources/benefits.mdx b/website/src/pages/mr/resources/benefits.mdx index 7bf7e9392b3f..99cb720a067a 100644 --- a/website/src/pages/mr/resources/benefits.mdx +++ b/website/src/pages/mr/resources/benefits.mdx @@ -21,53 +21,53 @@ The benefits of this decentralized protocol cannot be replicated by running a `g ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| खर्चाची तुलना | स्वत: होस्ट केलेले | आलेख नेटवर्क | -| :-: | :-: | :-: | -| मासिक सर्व्हर खर्च\* | दरमहा $350 | $0 | -| क्वेरी खर्च | $0+ | $0 per month | -| अभियांत्रिकी वेळ | दरमहा $400 | काहीही नाही, जागतिक स्तरावर वितरित इंडेक्सर्ससह नेटवर्कमध्ये तयार केलेले | -| प्रति महिना प्रश्न | इन्फ्रा क्षमतांपुरती मर्यादित | 100,000 (Free Plan) | -| प्रति क्वेरी खर्च | $0 | $0 | -| Infrastructure | केंद्रीकृत | विकेंद्रित | -| भौगोलिक रिडंडंसी | प्रति अतिरिक्त नोड $750+ | समाविष्ट | -| अपटाइम | बदलते | 99.9%+ | -| एकूण मासिक खर्च | $750+ | $0 | +| खर्चाची तुलना | स्वत: होस्ट केलेले | आलेख नेटवर्क | +| :--------------------------: | :-------------------------------------: | :----------------------------------------------------------------------: | +| मासिक सर्व्हर खर्च\* | दरमहा $350 | $0 | +| क्वेरी खर्च | $0+ | $0 per month | +| अभियांत्रिकी वेळ | दरमहा $400 | काहीही नाही, जागतिक स्तरावर वितरित इंडेक्सर्ससह नेटवर्कमध्ये तयार केलेले | +| प्रति महिना प्रश्न | इन्फ्रा क्षमतांपुरती मर्यादित | 100,000 (Free Plan) | +| प्रति क्वेरी खर्च | $0 | $0 | +| Infrastructure | केंद्रीकृत | विकेंद्रित | +| भौगोलिक रिडंडंसी | प्रति अतिरिक्त नोड $750+ | समाविष्ट | +| अपटाइम | बदलते | 99.9%+ | +| एकूण मासिक खर्च | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| खर्चाची तुलना | स्वत: होस्ट केलेले | आलेख नेटवर्क | -| :-: | :-: | :-: | -| मासिक सर्व्हर खर्च\* | दरमहा $350 | $0 | -| क्वेरी खर्च | दरमहा $500 | $120 per month | -| अभियांत्रिकी वेळ | दरमहा $800 | काहीही नाही, जागतिक स्तरावर वितरित इंडेक्सर्ससह नेटवर्कमध्ये तयार केलेले | -| प्रति महिना प्रश्न | इन्फ्रा क्षमतांपुरती मर्यादित | ~3,000,000 | -| प्रति क्वेरी खर्च | $0 | $0.00004 | -| Infrastructure | केंद्रीकृत | विकेंद्रित | -| अभियांत्रिकी खर्च | $200 प्रति तास | समाविष्ट | -| भौगोलिक रिडंडंसी | प्रति अतिरिक्त नोड एकूण खर्चात $1,200 | समाविष्ट | -| अपटाइम | बदलते | 99.9%+ | -| एकूण मासिक खर्च | $1,650+ | $120 | +| खर्चाची तुलना | स्वत: होस्ट केलेले | आलेख नेटवर्क | +| :--------------------------: | :----------------------------------------: | :----------------------------------------------------------------------: | +| मासिक सर्व्हर खर्च\* | दरमहा $350 | $0 | +| क्वेरी खर्च | दरमहा $500 | $120 per month | +| अभियांत्रिकी वेळ | दरमहा $800 | काहीही नाही, जागतिक स्तरावर वितरित इंडेक्सर्ससह नेटवर्कमध्ये तयार केलेले | +| प्रति महिना प्रश्न | इन्फ्रा क्षमतांपुरती मर्यादित | ~3,000,000 | +| प्रति क्वेरी खर्च | $0 | $0.00002 | +| Infrastructure | केंद्रीकृत | विकेंद्रित | +| अभियांत्रिकी खर्च | $200 प्रति तास | समाविष्ट | +| भौगोलिक रिडंडंसी | प्रति अतिरिक्त नोड एकूण खर्चात $1,200 | समाविष्ट | +| अपटाइम | बदलते | 99.9%+ | +| एकूण मासिक खर्च | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| खर्चाची तुलना | स्वत: होस्ट केलेले | आलेख नेटवर्क | -| :-: | :-: | :-: | -| मासिक सर्व्हर खर्च\* | प्रति नोड, प्रति महिना $1100 | $0 | -| क्वेरी खर्च | $4000 | $1,200 per month | -| आवश्यक नोड्सची संख्या | 10 | लागू नाही | -| अभियांत्रिकी वेळ | दरमहा $6,000 किंवा अधिक | काहीही नाही, जागतिक स्तरावर वितरित इंडेक्सर्ससह नेटवर्कमध्ये तयार केलेले | -| प्रति महिना प्रश्न | इन्फ्रा क्षमतांपुरती मर्यादित | ~30,000,000 | -| प्रति क्वेरी खर्च | $0 | $0.00004 | -| Infrastructure | केंद्रीकृत | विकेंद्रित | -| भौगोलिक रिडंडंसी | प्रति अतिरिक्त नोड एकूण खर्चात $1,200 | समाविष्ट | -| अपटाइम | बदलते | 99.9%+ | -| एकूण मासिक खर्च | $11,000+ | $1,200 | +| खर्चाची तुलना | स्वत: होस्ट केलेले | आलेख नेटवर्क | +| :--------------------------: | :-----------------------------------------: | :----------------------------------------------------------------------: | +| मासिक सर्व्हर खर्च\* | प्रति नोड, प्रति महिना $1100 | $0 | +| क्वेरी खर्च | $4000 | $1,200 per month | +| आवश्यक नोड्सची संख्या | 10 | लागू नाही | +| अभियांत्रिकी वेळ | दरमहा $6,000 किंवा अधिक | काहीही नाही, जागतिक स्तरावर वितरित इंडेक्सर्ससह नेटवर्कमध्ये तयार केलेले | +| प्रति महिना प्रश्न | इन्फ्रा क्षमतांपुरती मर्यादित | ~30,000,000 | +| प्रति क्वेरी खर्च | $0 | $0.00002 | +| Infrastructure | केंद्रीकृत | विकेंद्रित | +| भौगोलिक रिडंडंसी | प्रति अतिरिक्त नोड एकूण खर्चात $1,200 | समाविष्ट | +| अपटाइम | बदलते | 99.9%+ | +| एकूण मासिक खर्च | $11,000+ | $1,200 | \*बॅकअपच्या खर्चासह: $50-$100 प्रति महिना diff --git a/website/src/pages/mr/resources/claude-mcp.mdx b/website/src/pages/mr/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/mr/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/mr/subgraphs/developing/creating/advanced.mdx b/website/src/pages/mr/subgraphs/developing/creating/advanced.mdx index e83051efd7a9..25b409920d9e 100644 --- a/website/src/pages/mr/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/mr/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## सविश्लेषण -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/mr/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/mr/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/mr/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/mr/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/mr/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/mr/subgraphs/developing/creating/graph-ts/api.mdx index c84987c66e17..02ba54a8ed35 100644 --- a/website/src/pages/mr/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/mr/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| आवृत्ती | रिलीझ नोट्स | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| आवृत्ती | रिलीझ नोट्स | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### अंगभूत प्रकार @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### ब्लॉकसह तयार केलेल्या संस्था शोधत आहे +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### रिव्हर्ट केलेले कॉल हाताळणे @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | स्ट्रिंग (हेक्साडेसिमल) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| स्ट्रिंग (हेक्साडेसिमल) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| स्ट्रिंग (हेक्साडेसिमल) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### डेटा स्रोत मेटाडेटा diff --git a/website/src/pages/mr/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/mr/subgraphs/developing/creating/install-the-cli.mdx index c6892188ddfa..17eb61d10799 100644 --- a/website/src/pages/mr/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/mr/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/mr/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/mr/subgraphs/developing/creating/ql-schema.mdx index 73a098322d52..89899c2892bc 100644 --- a/website/src/pages/mr/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/mr/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica नॉन-नल फील्ड 'नावासाठी शून्य मूल्य सोडवले ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| प्रकार | वर्णन | -| --- | --- | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| प्रकार | वर्णन | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### एनम्स @@ -295,30 +295,30 @@ query { समर्थित भाषा शब्दकोश: -| Code | शब्दकोश | -| ---- | --------- | -| सोपे | General | -| da | Danish | -| nl | Dutch | -| en | English | -| fi | Finnish | -| fr | French | -| de | German | -| hu | Hungarian | -| it | Italian | -| no | Norwegian | -| pt | पोर्तुगीज | -| ro | Romanian | -| ru | Russian | -| es | Spanish | -| sv | Swedish | -| tr | Turkish | +| Code | शब्दकोश | +| ------ | ---------- | +| सोपे | General | +| da | Danish | +| nl | Dutch | +| en | English | +| fi | Finnish | +| fr | French | +| de | German | +| hu | Hungarian | +| it | Italian | +| no | Norwegian | +| pt | पोर्तुगीज | +| ro | Romanian | +| ru | Russian | +| es | Spanish | +| sv | Swedish | +| tr | Turkish | ### रँकिंग अल्गोरिदम परिणाम ऑर्डर करण्यासाठी समर्थित अल्गोरिदम: -| Algorithm | Description | -| ------------- | ---------------------------------------------------------------------- | -| rank | निकाल ऑर्डर करण्यासाठी फुलटेक्स्ट क्वेरीची जुळणी गुणवत्ता (0-1) वापरा. | -| proximityRank | Similar to rank but also includes the proximity of the matches. | +| Algorithm | Description | +| ------------- | ----------------------------------------------------------------------- | +| rank | निकाल ऑर्डर करण्यासाठी फुलटेक्स्ट क्वेरीची जुळणी गुणवत्ता (0-1) वापरा. | +| proximityRank | Similar to rank but also includes the proximity of the matches. | diff --git a/website/src/pages/mr/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/mr/subgraphs/developing/creating/starting-your-subgraph.mdx index daed9ec13c64..8b40bdfde4fc 100644 --- a/website/src/pages/mr/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/mr/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| आवृत्ती | रिलीझ नोट्स | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| आवृत्ती | रिलीझ नोट्स | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/mr/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/mr/subgraphs/developing/creating/subgraph-manifest.mdx index 97a686e21ad9..f007f48c488e 100644 --- a/website/src/pages/mr/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/mr/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ dataSources: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ dataSources: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o कॉल हँडलर्स फक्त दोनपैकी एका प्रकरणात ट्रिगर होतील: जेव्हा निर्दिष्ट केलेल्या फंक्शनला कॉन्ट्रॅक्ट व्यतिरिक्त इतर खात्याद्वारे कॉल केले जाते किंवा जेव्हा ते सॉलिडिटीमध्ये बाह्य म्हणून चिन्हांकित केले जाते आणि त्याच कॉन्ट्रॅक्टमधील दुसर्‍या फंक्शनचा भाग म्हणून कॉल केले जाते. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### कॉल हँडलरची व्याख्या @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. ब्लॉक हँडलरसाठी फिल्टरची अनुपस्थिती हे सुनिश्चित करेल की हँडलरला प्रत्येक ब्लॉक म्हटले जाईल. डेटा स्त्रोतामध्ये प्रत्येक फिल्टर प्रकारासाठी फक्त एक ब्लॉक हँडलर असू शकतो. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## ब्लॉक सुरू करा The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| आवृत्ती | रिलीझ नोट्स | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| आवृत्ती | रिलीझ नोट्स | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/mr/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/mr/subgraphs/developing/creating/unit-testing-framework.mdx index 0b3909e9ff3b..a7f1ca099c5b 100644 --- a/website/src/pages/mr/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/mr/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ static BYTES = Symbol("Bytes") SyntaxError: Unexpected token = /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ To use **Matchstick** in your Subgraph project just open up a terminal, navigate आलेख चाचणी ``` -हे gravity.test.ts नावाची चाचणी आणि/किंवा गुरुत्वाकर्षण नावाच्या फोल्डरच्या आत सर्व चाचणी चालवेल: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## एक युनिट चाचणी लिहा -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). असे गृहीत धरून की आमच्याकडे खालील हँडलर फंक्शन आहे (आपले जीवन सोपे करण्यासाठी दोन मदतनीस कार्यांसह): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -आम्हाला आमच्या प्रोजेक्टमध्ये प्रथम चाचणी फाइल तयार करावी लागेल. ते कसे दिसू शकते याचे हे उदाहरण आहे: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - आम्ही आमची प्रारंभिक स्थिती सेट करत आहोत आणि एक कस्टम Gravatar अस्तित्व जोडत आहोत; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- आम्ही स्टोअरच्या स्थितीवर ठाम आहोत. ते कसे कार्य करते? - आम्ही अस्तित्व प्रकार आणि आयडीचे एक अद्वितीय संयोजन पास करत आहोत. मग आम्ही त्या घटकावरील विशिष्ट फील्ड तपासतो आणि असे प्रतिपादन करतो की तिच्याकडे अपेक्षित मूल्य आहे. आम्ही स्टोअरमध्ये जोडलेल्या सुरुवातीच्या Gravatar एंटिटीसाठी तसेच हँडलर फंक्शन कॉल केल्यावर जोडल्या जाणार्‍या दोन Gravatar घटकांसाठी आम्ही हे करत आहोत; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. आम्ही तिथे जातो - आम्ही आमची पहिली चाचणी तयार केली आहे! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### इव्हेंट मेटाडेटासह संवाद साधत आहे @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -गंभीर त्रुटी लॉग केल्याने चाचण्यांची अंमलबजावणी थांबेल आणि सर्वकाही उडून जाईल. शेवटी - आम्ही हे सुनिश्चित करू इच्छितो की तुमच्या कोडमध्ये डिप्लॉयमेंटमध्ये गंभीर नोंदी नाहीत, आणि तसे झाल्यास तुम्हाला लगेच लक्षात येईल. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### व्युत्पन्न फील्ड चाचणी @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/mr/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/mr/subgraphs/developing/deploying/multiple-networks.mdx index 3e34f743a6c0..6fc6fe500de3 100644 --- a/website/src/pages/mr/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/mr/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/mr/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/mr/subgraphs/developing/deploying/using-subgraph-studio.mdx index 2319974d45ed..e07a0f3d1531 100644 --- a/website/src/pages/mr/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/mr/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/mr/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/mr/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 78b641e5ae0a..5c0177c85d87 100644 --- a/website/src/pages/mr/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/mr/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> This is new functionality, which will be available in Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/nl/resources/benefits.mdx b/website/src/pages/nl/resources/benefits.mdx index 238e055693bd..9e782ea8eea1 100644 --- a/website/src/pages/nl/resources/benefits.mdx +++ b/website/src/pages/nl/resources/benefits.mdx @@ -21,53 +21,53 @@ Hier is een analyse: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Kostenvergelijking | Zelf hosten | De Graph Netwerk | -| :-: | :-: | :-: | -| Maandelijkse serverkosten | $350 per maand | $0 | -| Querykosten | $0+ | $0 per month | -| Onderhoud tijd | $400 per maand | Geen, deze kosten worden opgevangen door het wereldwijd gedistribueerde netwerk van indexeerders | -| Aantal queries per maand | Beperkt tot infrastructuurcapaciteiten | 100,000 (Free Plan) | -| Kosten per query | $0 | $0 | -| Infrastructure | Gecentraliseerd | Gedecentraliseerd | -| Geografische redundantie | $750+ per extra node | Inbegrepen | -| Uptime | Wisselend | 99,9%+ | -| Totale maandelijkse kosten | $750+ | $0 | +| Kostenvergelijking | Zelf hosten | De Graph Netwerk | +| :------------------------: | :-------------------------------------: | :----------------------------------------------------------------------------------------------: | +| Maandelijkse serverkosten | $350 per maand | $0 | +| Querykosten | $0+ | $0 per month | +| Onderhoud tijd | $400 per maand | Geen, deze kosten worden opgevangen door het wereldwijd gedistribueerde netwerk van indexeerders | +| Aantal queries per maand | Beperkt tot infrastructuurcapaciteiten | 100,000 (Free Plan) | +| Kosten per query | $0 | $0 | +| Infrastructure | Gecentraliseerd | Gedecentraliseerd | +| Geografische redundantie | $750+ per extra node | Inbegrepen | +| Uptime | Wisselend | 99,9%+ | +| Totale maandelijkse kosten | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Kostenvergelijking | Zelf hosten | De Graph Netwerk | -| :-: | :-: | :-: | -| Maandelijkse serverkosten | $350 per maand | $0 | -| Querykosten | $500 per maand | $120 per month | -| Onderhoud tijd | $800 per maand | Geen, deze kosten worden opgevangen door het wereldwijd gedistribueerde netwerk van indexeerders | -| Aantal queries per maand | Beperkt tot infrastructuurcapaciteiten | ~3,000,000 | -| Kosten per query | $0 | $0.00004 | -| Infrastructure | Gecentraliseerd | Gedecentraliseerd | -| Technische personeelskosten | $200 per uur | Inbegrepen | -| Geografische redundantie | $1200 totale kosten per extra node | Inbegrepen | -| Uptime | Wisselend | 99,9%+ | -| Totale maandelijkse kosten | $1,650+ | $120 | +| Kostenvergelijking | Zelf hosten | De Graph Netwerk | +| :-------------------------: | :----------------------------------------: | :----------------------------------------------------------------------------------------------: | +| Maandelijkse serverkosten | $350 per maand | $0 | +| Querykosten | $500 per maand | $120 per month | +| Onderhoud tijd | $800 per maand | Geen, deze kosten worden opgevangen door het wereldwijd gedistribueerde netwerk van indexeerders | +| Aantal queries per maand | Beperkt tot infrastructuurcapaciteiten | ~3,000,000 | +| Kosten per query | $0 | $0.00002 | +| Infrastructure | Gecentraliseerd | Gedecentraliseerd | +| Technische personeelskosten | $200 per uur | Inbegrepen | +| Geografische redundantie | $1200 totale kosten per extra node | Inbegrepen | +| Uptime | Wisselend | 99,9%+ | +| Totale maandelijkse kosten | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Kostenvergelijking | Zelf hosten | De Graph Netwerk | -| :-: | :-: | :-: | -| Maandelijkse serverkosten | $1100 per maand, per node | $0 | -| Querykosten | $4000 | $1,200 per month | -| Aantal benodigde nodes | 10 | Niet van toepassing | -| Onderhoud tijd | $6000 of meer per maand | Geen, deze kosten worden opgevangen door het wereldwijd gedistribueerde netwerk van indexeerders | -| Aantal queries per maand | Beperkt tot infrastructuurcapaciteiten | ~30,000,000 | -| Kosten per query | $0 | $0.00004 | -| Infrastructure | Gecentraliseerd | Gedecentraliseerd | -| Geografische redundantie | $1200 totale kosten per extra node | Inbegrepen | -| Uptime | Wisselend | 99,9%+ | -| Totale maandelijkse kosten | $11,000+ | $1,200 | +| Kostenvergelijking | Zelf hosten | De Graph Netwerk | +| :------------------------: | :-----------------------------------------: | :----------------------------------------------------------------------------------------------: | +| Maandelijkse serverkosten | $1100 per maand, per node | $0 | +| Querykosten | $4000 | $1,200 per month | +| Aantal benodigde nodes | 10 | Niet van toepassing | +| Onderhoud tijd | $6000 of meer per maand | Geen, deze kosten worden opgevangen door het wereldwijd gedistribueerde netwerk van indexeerders | +| Aantal queries per maand | Beperkt tot infrastructuurcapaciteiten | ~30,000,000 | +| Kosten per query | $0 | $0.00002 | +| Infrastructure | Gecentraliseerd | Gedecentraliseerd | +| Geografische redundantie | $1200 totale kosten per extra node | Inbegrepen | +| Uptime | Wisselend | 99,9%+ | +| Totale maandelijkse kosten | $11,000+ | $1,200 | \*inclusief kosten voor een back-up: $50-$100 per maand diff --git a/website/src/pages/nl/resources/claude-mcp.mdx b/website/src/pages/nl/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/nl/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/nl/subgraphs/developing/creating/advanced.mdx b/website/src/pages/nl/subgraphs/developing/creating/advanced.mdx index 8dbc48253034..461c41304b08 100644 --- a/website/src/pages/nl/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/nl/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Overview -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/nl/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/nl/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/nl/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/nl/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/nl/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/nl/subgraphs/developing/creating/graph-ts/api.mdx index 5be2530c4d6b..b7c9a1a4ecbe 100644 --- a/website/src/pages/nl/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/nl/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Version | Release notes | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Version | Release notes | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Built-in Types @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Looking up entities created withing a block +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Handling Reverted Calls @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Data Source Metadata diff --git a/website/src/pages/nl/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/nl/subgraphs/developing/creating/install-the-cli.mdx index 004d0f94c99e..459ae8a5fd39 100644 --- a/website/src/pages/nl/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/nl/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/nl/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/nl/subgraphs/developing/creating/ql-schema.mdx index 7e0f889447c5..ae80ab827544 100644 --- a/website/src/pages/nl/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/nl/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Type | Description | -| --- | --- | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Type | Description | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums diff --git a/website/src/pages/nl/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/nl/subgraphs/developing/creating/starting-your-subgraph.mdx index 180a343470b1..4931e6b1fd34 100644 --- a/website/src/pages/nl/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/nl/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Version | Release notes | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/nl/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/nl/subgraphs/developing/creating/subgraph-manifest.mdx index 78e4a3a55e7d..2c4bc1e9b1b5 100644 --- a/website/src/pages/nl/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/nl/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ The important entries to update for the manifest are: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ The important entries to update for the manifest are: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Call handlers will only trigger in one of two cases: when the function specified is called by an account other than the contract itself or when it is marked as external in Solidity and called as part of another function in the same contract. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Defining a Call Handler @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. The absence of a filter for a block handler will ensure that the handler is called every block. A data source can only contain one block handler for each filter type. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Start Blocks The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Version | Release notes | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/nl/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/nl/subgraphs/developing/creating/unit-testing-framework.mdx index e56e1109bc04..1ec03c5555c7 100644 --- a/website/src/pages/nl/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/nl/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ or /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ This will run all tests in the test folder: graph test ``` -This will run a test named gravity.test.ts and/or all test inside of a folder named gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Write a Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Assuming we have the following handler function (along with two helper functions to make our life easier): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. This is an example of how that might look like: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - We're setting up our initial state and adding one custom Gravatar entity; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that gets added when the handler function is called; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. There we go - we've created our first test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interacting with Event metadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure you're code doesn't have critical logs in deployment, and you should notice right away if that were to happen. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing derived fields @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/nl/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/nl/subgraphs/developing/deploying/multiple-networks.mdx index 3b2b1bbc70ae..5c8016b18c91 100644 --- a/website/src/pages/nl/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/nl/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/nl/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/nl/subgraphs/developing/deploying/using-subgraph-studio.mdx index 370e428284cc..c64fab1db15e 100644 --- a/website/src/pages/nl/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/nl/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/nl/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/nl/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 2bc0ec5f514c..e3e3a7e3d455 100644 --- a/website/src/pages/nl/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/nl/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> This is new functionality, which will be available in Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/pl/resources/benefits.mdx b/website/src/pages/pl/resources/benefits.mdx index 311d327f3fff..03467bdf52be 100644 --- a/website/src/pages/pl/resources/benefits.mdx +++ b/website/src/pages/pl/resources/benefits.mdx @@ -21,53 +21,53 @@ Here is an analysis: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Cost Comparison | Self Hosted | Sieć The Graph | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $0+ | $0 per month | -| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | -| Cost per query | $0 | $0 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $750+ per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $750+ | $0 | +| Cost Comparison | Self Hosted | Sieć The Graph | +| :--------------------------: | :-------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $0+ | $0 per month | +| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | +| Cost per query | $0 | $0 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $750+ per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Cost Comparison | Self Hosted | Sieć The Graph | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $500 per month | $120 per month | -| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~3,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Engineering expense | $200 per hour | Included | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $1,650+ | $120 | +| Cost Comparison | Self Hosted | Sieć The Graph | +| :--------------------------: | :----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $500 per month | $120 per month | +| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~3,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Engineering expense | $200 per hour | Included | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Cost Comparison | Self Hosted | Sieć The Graph | -| :-: | :-: | :-: | -| Monthly server cost\* | $1100 per month, per node | $0 | -| Query costs | $4000 | $1,200 per month | -| Number of nodes needed | 10 | Not applicable | -| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~30,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $11,000+ | $1,200 | +| Cost Comparison | Self Hosted | Sieć The Graph | +| :--------------------------: | :-----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $1100 per month, per node | $0 | +| Query costs | $4000 | $1,200 per month | +| Number of nodes needed | 10 | Not applicable | +| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~30,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $11,000+ | $1,200 | \*including costs for backup: $50-$100 per month diff --git a/website/src/pages/pl/resources/claude-mcp.mdx b/website/src/pages/pl/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/pl/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/pl/subgraphs/developing/creating/advanced.mdx b/website/src/pages/pl/subgraphs/developing/creating/advanced.mdx index 8dbc48253034..461c41304b08 100644 --- a/website/src/pages/pl/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/pl/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Overview -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/pl/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/pl/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/pl/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/pl/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/pl/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/pl/subgraphs/developing/creating/graph-ts/api.mdx index 5be2530c4d6b..b7c9a1a4ecbe 100644 --- a/website/src/pages/pl/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/pl/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Version | Release notes | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Version | Release notes | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Built-in Types @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Looking up entities created withing a block +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Handling Reverted Calls @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Data Source Metadata diff --git a/website/src/pages/pl/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/pl/subgraphs/developing/creating/install-the-cli.mdx index 112f0952a1e8..3d5cb826df27 100644 --- a/website/src/pages/pl/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/pl/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/pl/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/pl/subgraphs/developing/creating/ql-schema.mdx index 7e0f889447c5..ae80ab827544 100644 --- a/website/src/pages/pl/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/pl/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Type | Description | -| --- | --- | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Type | Description | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums diff --git a/website/src/pages/pl/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/pl/subgraphs/developing/creating/starting-your-subgraph.mdx index 180a343470b1..4931e6b1fd34 100644 --- a/website/src/pages/pl/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/pl/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Version | Release notes | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/pl/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/pl/subgraphs/developing/creating/subgraph-manifest.mdx index 78e4a3a55e7d..2c4bc1e9b1b5 100644 --- a/website/src/pages/pl/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/pl/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ The important entries to update for the manifest are: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ The important entries to update for the manifest are: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Call handlers will only trigger in one of two cases: when the function specified is called by an account other than the contract itself or when it is marked as external in Solidity and called as part of another function in the same contract. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Defining a Call Handler @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. The absence of a filter for a block handler will ensure that the handler is called every block. A data source can only contain one block handler for each filter type. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Start Blocks The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Version | Release notes | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/pl/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/pl/subgraphs/developing/creating/unit-testing-framework.mdx index e56e1109bc04..1ec03c5555c7 100644 --- a/website/src/pages/pl/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/pl/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ or /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ This will run all tests in the test folder: graph test ``` -This will run a test named gravity.test.ts and/or all test inside of a folder named gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Write a Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Assuming we have the following handler function (along with two helper functions to make our life easier): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. This is an example of how that might look like: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - We're setting up our initial state and adding one custom Gravatar entity; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that gets added when the handler function is called; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. There we go - we've created our first test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interacting with Event metadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure you're code doesn't have critical logs in deployment, and you should notice right away if that were to happen. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing derived fields @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/pl/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/pl/subgraphs/developing/deploying/multiple-networks.mdx index 3b2b1bbc70ae..5c8016b18c91 100644 --- a/website/src/pages/pl/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/pl/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/pl/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/pl/subgraphs/developing/deploying/using-subgraph-studio.mdx index c21ff6dc2358..cd107113c9fd 100644 --- a/website/src/pages/pl/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/pl/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/pl/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/pl/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 2bc0ec5f514c..e3e3a7e3d455 100644 --- a/website/src/pages/pl/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/pl/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` fará uma contagem completa da tábua - que pode ser lenta, mas dá uma medida precisa da proporção entre entidades distintas e total de versões. @@ -340,6 +345,4 @@ Para subgraphs parecidos com o Uniswap, as tábuas `pair` e `token` são ótimas #### Como remover subgraphs -> Esta é uma funcionalidade nova, que estará disponível no Graph Node 0.29.x - Em certo ponto, o indexador pode querer remover um subgraph. É só usar o `graphman drop`, que apaga uma implantação e todos os seus dados indexados. A implantação pode ser especificada como o nome de um subgraph, um hash IPFS `Qm..`, ou o namespace de banco de dados `sgdNNN`. Mais documentos sobre o processo [aqui](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/pt/resources/benefits.mdx b/website/src/pages/pt/resources/benefits.mdx index a534aa140070..9a5a300d173f 100644 --- a/website/src/pages/pt/resources/benefits.mdx +++ b/website/src/pages/pt/resources/benefits.mdx @@ -21,60 +21,59 @@ Aqui está uma análise: ### Estrutura Mais Flexível e Custo Menor -Nada de contratos ou taxas mensais. Só pague pelos queries que usa — com um custo-por-query de $40 dólares por milhão de queries (cerca de $0.0004 por query). Estes tem preços em Dólar (USD), pagos em GRT ou cartão de crédito. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Os custos de query podem variar; o custo citado é o normal até o fechamento da publicação (Março de 2024). ## Utilizador de Baixo Volume (menos de 100 mil queries por mês) -| Comparação de Custos | Auto-hospedagem | The Graph Network | -| :-: | :-: | :-: | -| Custo mensal de servidor\* | $350 por mês | $0 | -| Custos de query | $0+ | $0 por mês | -| Tempo de engenharia | $400 por mês | Nenhum, embutido na rede com Indexadores distribuídos globalmente | -| Queries por mês | Limitadas pelas capabilidades da infra | 100 mil (Plano Grátis) | -| Custo por query | $0 | $0 | -| Infraestrutura | Centralizada | Descentralizada | -| Redundância geográfica | $750+ por node adicional | Incluída | -| Uptime (disponibilidade) | Varia | 99.9%+ | -| Custos mensais totais | $750+ | $0 | +| Comparação de Custos | Auto-hospedagem | The Graph Network | +| :-----------------------------: | :-------------------------------------: | :---------------------------------------------------------------: | +| Custo mensal de servidor\* | $350 por mês | $0 | +| Custos de query | $0+ | $0 por mês | +| Tempo de engenharia | $400 por mês | Nenhum, embutido na rede com Indexadores distribuídos globalmente | +| Queries por mês | Limitadas pelas capabilidades da infra | 100 mil (Plano Grátis) | +| Custo por query | $0 | $0 | +| Infraestrutura | Centralizada | Descentralizada | +| Redundância geográfica | $750+ por node adicional | Incluída | +| Uptime (disponibilidade) | Varia | 99.9%+ | +| Custos mensais totais | $750+ | $0 | ## Utilizador de Volume Médio (cerca de 3 milhões de queries por mês) -| Comparação de Custos | Auto-hospedagem | The Graph Network | -| :-: | :-: | :-: | -| Custo mensal de servidor\* | $350 por mês | $0 | -| Custos de query | $500 por mês | $120 por mês | -| Tempo de engenharia | $800 por mês | Nenhum, embutido na rede com Indexadores distribuídos globalmente | -| Queries por mês | Limitadas pelas capabilidades da infra | ~3 milhões | -| Custo por query | $0 | $0.00004 | -| Infraestrutura | Centralizada | Descentralizada | -| Custo de engenharia | $200 por hora | Incluída | -| Redundância geográfica | $1.200 em custos totais por node adicional | Incluída | -| Uptime (disponibilidade) | Varia | 99.9%+ | -| Custos mensais totais | $1.650+ | $120 | +| Comparação de Custos | Auto-hospedagem | The Graph Network | +| :-----------------------------: | :----------------------------------------: | :---------------------------------------------------------------: | +| Custo mensal de servidor\* | $350 por mês | $0 | +| Custos de query | $500 por mês | $120 por mês | +| Tempo de engenharia | $800 por mês | Nenhum, embutido na rede com Indexadores distribuídos globalmente | +| Queries por mês | Limitadas pelas capabilidades da infra | ~3 milhões | +| Custo por query | $0 | $0.00002 | +| Infraestrutura | Centralizada | Descentralizada | +| Custo de engenharia | $200 por hora | Incluída | +| Redundância geográfica | $1.200 em custos totais por node adicional | Incluída | +| Uptime (disponibilidade) | Varia | 99.9%+ | +| Custos mensais totais | $1.650+ | $120 | ## Utilizador de Volume Alto (cerca de 30 milhões de queries por mês) -| Comparação de Custos | Auto-hospedagem | The Graph Network | -| :-: | :-: | :-: | -| Custo mensal de servidor\* | $1.100 por mês, por node | $0 | -| Custos de query | $4.000 | $1,200 por mês | -| Número de nodes necessário | 10 | Não se aplica | -| Tempo de engenharia | $6.000 ou mais por mês | Nenhum, embutido na rede com Indexadores distribuídos globalmente | -| Queries por mês | Limitadas pelas capabilidades da infra | Cerca de 30 milhões | -| Custo por query | $0 | $0.00004 | -| Infraestrutura | Centralizada | Descentralizada | -| Redundância geográfica | $1.200 em custos totais por node adicional | Incluída | -| Uptime (disponibilidade) | Varia | 99.9%+ | -| Custos mensais totais | $11.000+ | $1.200 | +| Comparação de Custos | Auto-hospedagem | The Graph Network | +| :-----------------------------: | :-----------------------------------------: | :---------------------------------------------------------------: | +| Custo mensal de servidor\* | $1.100 por mês, por node | $0 | +| Custos de query | $4.000 | $1,200 por mês | +| Número de nodes necessário | 10 | Não se aplica | +| Tempo de engenharia | $6.000 ou mais por mês | Nenhum, embutido na rede com Indexadores distribuídos globalmente | +| Queries por mês | Limitadas pelas capabilidades da infra | Cerca de 30 milhões | +| Custo por query | $0 | $0.00002 | +| Infraestrutura | Centralizada | Descentralizada | +| Redundância geográfica | $1.200 em custos totais por node adicional | Incluída | +| Uptime (disponibilidade) | Varia | 99.9%+ | +| Custos mensais totais | $11.000+ | $1.200 | \*com custos de backup incluídos: $50-$100 por mês Tempo de engenharia baseado numa hipótese de $200 por hora -Reflete o custo ao consumidor de dados. Taxas de query ainda são pagas a Indexadores por queries do Plano -Grátis. +Reflete o custo ao consumidor de dados. Taxas de query ainda são pagas a Indexadores por queries do Plano Grátis. Estimated costs are only for Ethereum Mainnet Subgraphs — costs are even higher when self hosting a `graph-node` on other networks. Some users may need to update their Subgraph to a new version. Due to Ethereum gas fees, an update costs ~$50 at time of writing. Note that gas fees on [Arbitrum](/archived/arbitrum/arbitrum-faq/) are substantially lower than Ethereum mainnet. diff --git a/website/src/pages/pt/resources/claude-mcp.mdx b/website/src/pages/pt/resources/claude-mcp.mdx new file mode 100644 index 000000000000..548c933f72e5 --- /dev/null +++ b/website/src/pages/pt/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Pré-requisitos + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/pt/subgraphs/best-practices/timeseries.mdx b/website/src/pages/pt/subgraphs/best-practices/timeseries.mdx index b0a9925207eb..bb25b602d8dd 100644 --- a/website/src/pages/pt/subgraphs/best-practices/timeseries.mdx +++ b/website/src/pages/pt/subgraphs/best-practices/timeseries.mdx @@ -1,5 +1,5 @@ --- -title: 'Melhores Práticas para um Subgraph #5 — Simplifique e Otimize com Séries Temporais e Agregações' +title: "Melhores Práticas para um Subgraph #5 — Simplifique e Otimize com Séries Temporais e Agregações" sidebarTitle: Séries de Tempo e Agregações --- diff --git a/website/src/pages/pt/subgraphs/developing/creating/advanced.mdx b/website/src/pages/pt/subgraphs/developing/creating/advanced.mdx index 51adc5cea9a6..4554e9b7f596 100644 --- a/website/src/pages/pt/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/pt/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Funções Avançadas de Subgraph ## Visão geral -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ Nesta configuração: ## eth_call declarada -> Nota: Esta é uma função experimental que atualmente não está disponível numa versão estável do Graph Node, e só pode ser usada no Subgraph Studio ou no seu node auto-hospedado. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. Esta ferramenta faz o seguinte: diff --git a/website/src/pages/pt/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/pt/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/pt/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/pt/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/pt/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/pt/subgraphs/developing/creating/graph-ts/api.mdx index ee20c583603e..b9c64b3608b9 100644 --- a/website/src/pages/pt/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/pt/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ A biblioteca `@graphprotocol/graph-ts` fornece as seguintes APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Versão | Notas de atualização | -| :-: | --- | -| 0.0.9 | Adiciona novas funções de host [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adiciona validação para existência de campos no schema ao salvar uma entidade. | -| 0.0.7 | Classes `TransactionReceipt` e `Log` adicionadas aos tipos do EthereumCampo
Campo `receipt` adicionado ao objeto Ethereum Event | -| 0.0.6 | Campo `nonce` adicionado ao objeto Ethereum TransactionCampo
`baseFeePerGas` adicionado ao objeto Ethereum Block | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Campo `functionSignature` adicionado ao objeto Ethereum SmartContractCall | -| 0.0.3 | Campo `from` adicionado ao objeto de chamada no Ethereum
`Callethereum.call.address` renomeado para `ethereum.call.to` | -| 0.0.2 | Campo `input` adicionado ao objeto Ethereum Transaction | +| Versão | Notas de atualização | +| :----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adiciona novas funções de host [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adiciona validação para existência de campos no schema ao salvar uma entidade. | +| 0.0.7 | Classes `TransactionReceipt` e `Log` adicionadas aos tipos do EthereumCampo
Campo `receipt` adicionado ao objeto Ethereum Event | +| 0.0.6 | Campo `nonce` adicionado ao objeto Ethereum TransactionCampo
`baseFeePerGas` adicionado ao objeto Ethereum Block | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Campo `functionSignature` adicionado ao objeto Ethereum SmartContractCall | +| 0.0.3 | Campo `from` adicionado ao objeto de chamada no Ethereum
`Callethereum.call.address` renomeado para `ethereum.call.to` | +| 0.0.2 | Campo `input` adicionado ao objeto Ethereum Transaction | ### Tipos Embutidos @@ -166,7 +166,8 @@ _Matemática_ import { TypedMap } from '@graphprotocol/graph-ts' ``` -O `TypedMap` pode servir para armazenar pares de chave e valor (key e value ). Confira [este exemplo](https://github.com/graphprotocol/aragon-subgraph/blob/29dd38680c5e5104d9fdc2f90e740298c67e4a31/individual-dao-subgraph/mappings/constants.ts#L51). +O `TypedMap` pode servir para armazenar pares de chave e valor (key e value +). Confira [este exemplo](https://github.com/graphprotocol/aragon-subgraph/blob/29dd38680c5e5104d9fdc2f90e740298c67e4a31/individual-dao-subgraph/mappings/constants.ts#L51). A classe `TypedMap` tem a seguinte API: @@ -276,7 +277,7 @@ Como a entidade pode ainda não existir no armazenamento, o método `load` retor > Nota: Só é necessário carregar entidades se as mudanças feitas no mapeamento dependem dos dados anteriores de uma entidade. Veja a próxima seção para ver as duas maneiras de atualizar entidades existentes. -#### Como consultar entidades criadas dentro de um bloco +#### Looking up entities created within a block Desde o `graph-node` v0.31.0, o `@graphprotocol/graph-ts` v0.30.0 e o `@graphprotocol/graph-cli v0.49.0`, o método `loadInBlock` está disponível em todos os tipos de entidade. @@ -502,11 +503,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -O `Transfer` é apelidado de `TransferEvent` aqui para evitar confusões de nomenclatura com o tipo da entidade +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. Enquanto o `ERC20Contract` no Ethereum tiver uma função pública de apenas-leitura chamada `symbol`, ele pode ser chamado com o `.symbol()`. Para variáveis de estado público, um método com o mesmo nome é criado automaticamente. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Como Lidar com Chamadas Revertidas @@ -666,6 +685,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### API do IPFS ```typescript @@ -770,44 +791,45 @@ Quando o tipo de um valor é confirmado, ele pode ser convertido num [tipo embut ### Referência de Conversões de Tipos -| Fonte(s) | Destino | Função de conversão | -| -------------------- | -------------------- | ---------------------------- | -| Address | Bytes | nenhum | -| Address | String | s.toHexString() | -| BigDecimal | String | s.toString() | -| BigInt | BigDecimal | s.toBigDecimal() | -| BigInt | String (hexadecimal) | s.toHexString() ou s.toHex() | -| BigInt | String (unicode) | s.toString() | -| BigInt | i32 | s.toI32() | -| Boolean | Boolean | nenhum | -| Bytes (assinado) | BigInt | BigInt.fromSignedBytes(s) | -| Bytes (não assinado) | BigInt | BigInt.fromUnsignedBytes(s) | -| Bytes | String (hexadecimal) | s.toHexString() ou s.toHex() | -| Bytes | String (unicode) | s.toString() | -| Bytes | String (base58) | s.toBase58() | -| Bytes | i32 | s.toI32() | -| Bytes | u32 | s.toU32() | -| Bytes | JSON | json.fromBytes(s) | -| int8 | i32 | nenhum | -| int32 | i32 | nenhum | -| int32 | BigInt | BigInt.fromI32(s) | -| uint24 | i32 | nenhum | -| int64 - int256 | BigInt | nenhum | -| uint32 - uint256 | BigInt | nenhum | -| JSON | boolean | s.toBool() | -| JSON | i64 | s.toI64() | -| JSON | u64 | s.toU64() | -| JSON | f64 | s.toF64() | -| JSON | BigInt | s.toBigInt() | -| JSON | string | s.toString() | -| JSON | Array | s.toArray() | -| JSON | Object | s.toObject() | -| String | Address | Address.fromString(s) | -| Bytes | Address | Address.fromBytes(s) | -| String | BigInt | BigInt.fromString(s) | -| String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| Fonte(s) | Destino | Função de conversão | +| ------------------------ | -------------------- | ------------------------------ | +| Address | Bytes | nenhum | +| Address | String | s.toHexString() | +| BigDecimal | String | s.toString() | +| BigInt | BigDecimal | s.toBigDecimal() | +| BigInt | String (hexadecimal) | s.toHexString() ou s.toHex() | +| BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | +| BigInt | i32 | s.toI32() | +| Boolean | Boolean | nenhum | +| Bytes (assinado) | BigInt | BigInt.fromSignedBytes(s) | +| Bytes (não assinado) | BigInt | BigInt.fromUnsignedBytes(s) | +| Bytes | String (hexadecimal) | s.toHexString() ou s.toHex() | +| Bytes | String (unicode) | s.toString() | +| Bytes | String (base58) | s.toBase58() | +| Bytes | i32 | s.toI32() | +| Bytes | u32 | s.toU32() | +| Bytes | JSON | json.fromBytes(s) | +| int8 | i32 | nenhum | +| int32 | i32 | nenhum | +| int32 | BigInt | BigInt.fromI32(s) | +| uint24 | i32 | nenhum | +| int64 - int256 | BigInt | nenhum | +| uint32 - uint256 | BigInt | nenhum | +| JSON | boolean | s.toBool() | +| JSON | i64 | s.toI64() | +| JSON | u64 | s.toU64() | +| JSON | f64 | s.toF64() | +| JSON | BigInt | s.toBigInt() | +| JSON | string | s.toString() | +| JSON | Array | s.toArray() | +| JSON | Object | s.toObject() | +| String | Address | Address.fromString(s) | +| Bytes | Address | Address.fromBytes(s) | +| String | BigInt | BigInt.fromString(s) | +| String | BigDecimal | BigDecimal.fromString(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Metadados de Fontes de Dados diff --git a/website/src/pages/pt/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/pt/subgraphs/developing/creating/install-the-cli.mdx index ee2f14a8e76f..de1fa8edc56a 100644 --- a/website/src/pages/pt/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/pt/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - O comando tenta resgatar o contrato da ABI do Etherscan. - - A CLI do The Graph depende de um endpoint público de RPC. Enquanto falhas ocasionais são de se esperar, basta tentar de novo para resolver. Se as falhas persistirem, considere usar uma ABI local. - Se faltar algum dos argumentos opcionais, você será guiado para um formulário interativo. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Opções: #### Especificações -O comando `graph add` pegará a ABI do Etherscan (a não ser que um local de ABI seja especificado com a opção --abi), e criará um novo `dataSource` da mesma maneira que o comando `graph init` cria um `dataSource` `--from-contract`, assim atualizando o schema e os mapeamentos de acordo. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - A opção `--merge entities` identifica como o programador gostaria de lidar com conflitos de nome em `entity` e `event`: diff --git a/website/src/pages/pt/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/pt/subgraphs/developing/creating/ql-schema.mdx index 9fd41c7e9594..1fcf20831d62 100644 --- a/website/src/pages/pt/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/pt/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Os campos da entidade podem ser definidos como obrigatórios ou opcionais. Os ca Null value resolved for non-null field 'name' ``` -Cada entidade deve ter um campo `id`, que deve ser do tipo `Bytes!` ou `String!`. Geralmente é melhor usar `Bytes!` — a não ser que o `id` tenha texto legível para humanos, já que entidades com as ids `Bytes!` são mais fáceis de escrever e consultar que aquelas com um `id` `String!`. O campo `id` serve como a chave primária, e deve ser singular entre todas as entidades do mesmo tipo. Por razões históricas, o tipo `ID!` também é aceite, como um sinónimo de `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. Para alguns tipos de entidade, o `id` é construído das id's de duas outras entidades; isto é possível com o `concat`, por ex., `let id = left.id.concat(right.id)` para formar a id a partir das id's de `left` e `right`. Da mesma forma, para construir uma id a partir da id de uma entidade existente e um contador `count`, pode ser usado o `let id = left.id.concatI32(count)`. Isto garante a concatenação a produzir id's únicas enquanto o comprimento do `left` for o mesmo para todas as tais entidades; por exemplo, porque o `left.id` é um `Address` (endereço). @@ -72,16 +72,16 @@ Para alguns tipos de entidade, o `id` é construído das id's de duas outras ent As seguintes escalas são apoiadas na API da GraphQL: -| Tipo | Descrição | -| --- | --- | -| `Bytes` | Arranjo de bytes, representado como string hexadecimal. Usado frequentemente por hashes e endereços no Ethereum. | -| `String` | Escalar para valores string. Caracteres nulos serão removidos automaticamente. | -| `Boolean` | Escalar para valores `boolean`. | -| `Int` | A especificação da GraphQL define `Int` como um inteiro assinado de 32 bits. | -| `Int8` | Um número inteiro assinado em 8 bits, também conhecido como um número inteiro assinado em 64 bits, pode armazenar valores de -9,223,372,036,854,775,808 a 9,223,372,036,854,775,807. É melhor usar isto para representar o i64 do ethereum. | -| `BigInt` | Números inteiros grandes. Usados para os tipos `uint32`, `int64`, `uint64`, ..., `uint256` do Ethereum. Nota: Tudo abaixo de `uint32`, como `int32`, `uint24` ou `int8` é representado como `i32`. | -| `BigDecimal` | Decimais de alta precisão `BigDecimal` representados como um significando e um exponente. O alcance de exponentes é de -6143 até +6144. Arredondado para 34 dígitos significantes. | -| `Timestamp` | É um valor i64 em microssegundos. Usado frequentemente para campos `timestamp` para séries temporais e agregações. | +| Tipo | Descrição | +| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Arranjo de bytes, representado como string hexadecimal. Usado frequentemente por hashes e endereços no Ethereum. | +| `String` | Escalar para valores string. Caracteres nulos serão removidos automaticamente. | +| `Boolean` | Escalar para valores `boolean`. | +| `Int` | A especificação da GraphQL define `Int` como um inteiro assinado de 32 bits. | +| `Int8` | Um número inteiro assinado em 8 bits, também conhecido como um número inteiro assinado em 64 bits, pode armazenar valores de -9,223,372,036,854,775,808 a 9,223,372,036,854,775,807. É melhor usar isto para representar o i64 do ethereum. | +| `BigInt` | Números inteiros grandes. Usados para os tipos `uint32`, `int64`, `uint64`, ..., `uint256` do Ethereum. Nota: Tudo abaixo de `uint32`, como `int32`, `uint24` ou `int8` é representado como `i32`. | +| `BigDecimal` | Decimais de alta precisão `BigDecimal` representados como um significando e um exponente. O alcance de exponentes é de -6143 até +6144. Arredondado para 34 dígitos significantes. | +| `Timestamp` | É um valor i64 em microssegundos. Usado frequentemente para campos `timestamp` para séries temporais e agregações. | ### Enums @@ -295,24 +295,24 @@ Escolher um idioma diferente terá um efeito definitivo, porém às vezes sutil, Dicionários apoiados: -| Código | Dicionário | -| ------ | ----------- | -| simple | Geral | -| da | Dinamarquês | -| nl | Neerlandês | -| en | Inglês | -| fi | Finlandês | -| fr | Francês | -| de | Alemão | -| hu | Húngaro | -| it | Italiano | -| no | Norueguês | -| pt | Português | -| ro | Romeno | -| ru | Russo | -| es | Espanhol | -| sv | Sueco | -| tr | Turco | +| Código | Dicionário | +| -------- | --------------- | +| simple | Geral | +| da | Dinamarquês | +| nl | Neerlandês | +| en | Inglês | +| fi | Finlandês | +| fr | Francês | +| de | Alemão | +| hu | Húngaro | +| it | Italiano | +| no | Norueguês | +| pt | Português | +| ro | Romeno | +| ru | Russo | +| es | Espanhol | +| sv | Sueco | +| tr | Turco | ### Algoritmos de Ordem diff --git a/website/src/pages/pt/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/pt/subgraphs/developing/creating/starting-your-subgraph.mdx index e80ca1803b20..2d834dedec0b 100644 --- a/website/src/pages/pt/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/pt/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore mais [recursos para APIs](/subgraphs/developing/creating/graph-ts/README/) e realize testes locais com [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Versão | Notas de atualização | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Versão | Notas de atualização | +| :----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/pt/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/pt/subgraphs/developing/creating/subgraph-manifest.mdx index 92002efba848..4bfce6426aa5 100644 --- a/website/src/pages/pt/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/pt/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ As entradas importantes para atualizar para o manifest são: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: o número opcional do bloco de onde a fonte de dados começa a indexar. Em muitos casos, sugerimos usar o bloco em que o contrato foi criado. @@ -109,7 +109,7 @@ As entradas importantes para atualizar para o manifest são: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Handlers de chamadas só serão ativados em um de dois casos: quando a função especificada é chamada por uma conta que não for do próprio contrato, ou quando ela é marcada como externa no Solidity e chamada como parte de outra função no mesmo contrato. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Como Definir um Handler de Chamada @@ -218,7 +218,7 @@ filter: _O handler definido será chamado uma vez para cada bloco, que contém uma chamada ao contrato (fonte de dados) sob o qual o handler está definido._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. A ausência de um filtro para um handler de blocos garantirá que o handler seja chamado a todos os blocos. Uma fonte de dados só pode conter um handler de bloco para cada tipo de filtro. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') Há setters e getters como `setString` e `getString` para todos os tipos de valores. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Blocos Iniciais The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Versão | Notas de atualização | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Versão | Notas de atualização | +| :----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/pt/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/pt/subgraphs/developing/creating/unit-testing-framework.mdx index c1676c2773d7..04e09865d294 100644 --- a/website/src/pages/pt/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/pt/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ ou /node_modules/gluegun/build/index.js:13 throw up; ``` -Verifique se está em uma versão mais recente do Node.js. O graph-cli não apoia mais a **v10.19.0**, que ainda é a versão padrão para novas imagens de Ubuntu no WSL. Por exemplo, se o Matchstick é confirmado como funcional no WSL com a **v18.1.0**, pode trocar para essa versão através do **nvm** ou ao atualizar o seu Node.js global. Não se esqueça de apagar o `node_modules` e executar o `npm install` novamente após atualizar o seu nodejs! Depois, garanta que tem o **libpq** instalado. Isto pode ser feito ao executar: +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ Isto executará todos os testes na pasta-teste: graph test ``` -Isto executará um teste chamado gravity.test.ts e/ou todos os testes dentro de uma pasta chamada gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Como Escrever um Teste de Unidade -Vamos ver como seria um simples teste unitário usando os exemplos de Gravatar no [Subgraph de Demonstração](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Suponhamos que temos a seguinte função de handler (com duas funções de helper para facilitar): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -Primeiro, devemos criar um arquivo de teste no nosso projeto. Este é um exemplo de como ele pode ficar: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ Quanta coisa! Primeiro, note que estamos a importar coisas do `matchstick-as`, a - Configuramos nosso estado inicial e adicionamos uma entidade de Gravatar personalizada; - Definimos dois eventos `NewGravatar` com os seus dados, usando a função `createNewGravatarEvent()`; - Chamamos métodos de handlers para estes eventos — `handleNewGravatars()` — e passamos a lista dos nossos eventos personalizados; -- Garantimos o estado da loja. Como isto funciona? — Passamos uma combinação do tipo e da id da Entidade. Depois conferimos um campo específico naquela Entidade e garantimos que ela tem o valor que esperamos que tenha. Estamos a fazer isto tanto para a Entidade Gravatar inicial adicionada ao armazenamento, quanto para as duas entidades Gravatar adicionadas ao chamar a função de handler; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - E por último — limpamos o armazenamento com `clearStore()`, para que o nosso próximo teste comece com um objeto de armazenamento novo em folha. Podemos definir quantos blocos de teste quisermos. Prontinho — criamos o nosso primeiro teste! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -A função assert.fieldEquals() conferirá a igualdade do campo dado contra o valor dado esperado. O teste acabará em erro, com mensagem correspondente, caso os valores **NÃO** sejam iguais. Caso contrário, o teste terá êxito. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Como interagir com metadados de Eventos @@ -954,7 +954,7 @@ test('Explodir tudo', () = { }) ``` -Logar erros críticos interromperá a execução dos testes e causará um desastre. Afinal, queremos ter certeza que o seu código não tenha logs críticos no lançamento; perceberia imediatamente se isto acontecer. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Como testar campos derivados @@ -1031,7 +1031,7 @@ describe('loadInBlock', () => { assert.stringEquals('gravatarId0', retrievedGravatar!.get('id')!.toString()) }) - test('Retorna null ao chamar entity.loadInBlock() se uma entidade não existir no bloco atual', () => { + test("Retorna null ao chamar entity.loadInBlock() se uma entidade não existir no bloco atual", () => { let retrievedGravatar = Gravatar.loadInBlock('IDoNotExist') assert.assertNull(retrievedGravatar) }) @@ -1292,7 +1292,7 @@ com dataSourceMock de matchstick-as Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -A ferramenta de cobertura de testes pega os binários de teste `wasm` compilados e os converte a arquivos `wat`, que podem então ser facilmente vistoriados para ver se os handlers definidos em `subgraph.yaml` foram chamados ou não. Como a cobertura de código (e os testes em geral) está num estado primitivo no AssemblyScript e WebAssembly, o **Matchstick** não pode procurar por coberturas de branch. Em vez disto, supomos que, se um handler foi chamado, o evento/a função correspondente já foi simulado com êxito. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Pré-requisitos @@ -1376,29 +1376,19 @@ A saída do log inclui a duração do teste. Veja um exemplo: ## Erros comuns do compilador -> -> Critical: Could not create WasmInstance from valid module with context: unknown import: -> wasi_snapshot_preview1::fd_write has not been defined -> +> Critical: Could not create WasmInstance from valid module with context: unknown import: wasi_snapshot_preview1::fd_write has not been defined Isso significa que você usou `console.log` no seu código, que não é apoiado pelo AssemblyScript. Por favor, considere usar a [API de registo](/subgraphs/developing/creating/graph-ts/api/#logging-api) > ERROR TS2554: Expected ? arguments, but got ?. > -> -> return new ethereum.Block(defaultAddressBytes, defaultAddressBytes, defaultAddressBytes, defaultAddress, -> defaultAddressBytes, defaultAddressBytes, defaultAddressBytes, defaultBigInt, defaultBigInt, defaultBigInt, -> defaultBigInt, defaultBigInt, defaultBigInt, defaultBigInt, defaultBigInt); -> +> return new ethereum.Block(defaultAddressBytes, defaultAddressBytes, defaultAddressBytes, defaultAddress, defaultAddressBytes, defaultAddressBytes, defaultAddressBytes, defaultBigInt, defaultBigInt, defaultBigInt, defaultBigInt, defaultBigInt, defaultBigInt, defaultBigInt, defaultBigInt); > > in ~lib/matchstick-as/assembly/defaults.ts(18,12) > > ERROR TS2554: Expected ? arguments, but got ?. > -> -> return new ethereum.Transaction(defaultAddressBytes, defaultBigInt, defaultAddress, defaultAddress, defaultBigInt, -> defaultBigInt, defaultBigInt, defaultAddressBytes, defaultBigInt); -> +> return new ethereum.Transaction(defaultAddressBytes, defaultBigInt, defaultAddress, defaultAddress, defaultBigInt, defaultBigInt, defaultBigInt, defaultAddressBytes, defaultBigInt); > > in ~lib/matchstick-as/assembly/defaults.ts(24,12) diff --git a/website/src/pages/pt/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/pt/subgraphs/developing/deploying/multiple-networks.mdx index 1a1aca2c7b9e..ee4731e3ff4a 100644 --- a/website/src/pages/pt/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/pt/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/pt/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/pt/subgraphs/developing/deploying/using-subgraph-studio.mdx index 5a8e4fb9f905..5ba582a0ab0c 100644 --- a/website/src/pages/pt/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/pt/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ Após executar este comando, a CLI solicitará um número de versão. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Edite o Seu Subgraph diff --git a/website/src/pages/pt/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/pt/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 1d25ded18a61..0d14ba96dc81 100644 --- a/website/src/pages/pt/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/pt/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -52,13 +52,13 @@ USAGE ] FLAGS - -h, --help Mostra ajuda da CLI. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Envia resultados da build a um node IPFS. - --ipfs-hash= Hash IPFS do manifest do subgraph a ser implantado. - --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> This is new functionality, which will be available in Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/ro/resources/benefits.mdx b/website/src/pages/ro/resources/benefits.mdx index 8b6c8a74c0a6..5180919a90fc 100644 --- a/website/src/pages/ro/resources/benefits.mdx +++ b/website/src/pages/ro/resources/benefits.mdx @@ -21,53 +21,53 @@ Here is an analysis: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Cost Comparison | Self Hosted | Rețeaua The Graph | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $0+ | $0 per month | -| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | -| Cost per query | $0 | $0 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $750+ per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $750+ | $0 | +| Cost Comparison | Self Hosted | Rețeaua The Graph | +| :--------------------------: | :-------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $0+ | $0 per month | +| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | +| Cost per query | $0 | $0 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $750+ per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Cost Comparison | Self Hosted | Rețeaua The Graph | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $500 per month | $120 per month | -| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~3,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Engineering expense | $200 per hour | Included | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $1,650+ | $120 | +| Cost Comparison | Self Hosted | Rețeaua The Graph | +| :--------------------------: | :----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $500 per month | $120 per month | +| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~3,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Engineering expense | $200 per hour | Included | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Cost Comparison | Self Hosted | Rețeaua The Graph | -| :-: | :-: | :-: | -| Monthly server cost\* | $1100 per month, per node | $0 | -| Query costs | $4000 | $1,200 per month | -| Number of nodes needed | 10 | Not applicable | -| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~30,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $11,000+ | $1,200 | +| Cost Comparison | Self Hosted | Rețeaua The Graph | +| :--------------------------: | :-----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $1100 per month, per node | $0 | +| Query costs | $4000 | $1,200 per month | +| Number of nodes needed | 10 | Not applicable | +| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~30,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $11,000+ | $1,200 | \*including costs for backup: $50-$100 per month diff --git a/website/src/pages/ro/resources/claude-mcp.mdx b/website/src/pages/ro/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/ro/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/ro/subgraphs/developing/creating/advanced.mdx b/website/src/pages/ro/subgraphs/developing/creating/advanced.mdx index 8dbc48253034..461c41304b08 100644 --- a/website/src/pages/ro/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/ro/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Overview -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/ro/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/ro/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/ro/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/ro/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/ro/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/ro/subgraphs/developing/creating/graph-ts/api.mdx index 5be2530c4d6b..b7c9a1a4ecbe 100644 --- a/website/src/pages/ro/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/ro/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Version | Release notes | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Version | Release notes | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Built-in Types @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Looking up entities created withing a block +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Handling Reverted Calls @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Data Source Metadata diff --git a/website/src/pages/ro/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/ro/subgraphs/developing/creating/install-the-cli.mdx index ee168286548b..f08a7bbb33be 100644 --- a/website/src/pages/ro/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/ro/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/ro/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/ro/subgraphs/developing/creating/ql-schema.mdx index 7e0f889447c5..ae80ab827544 100644 --- a/website/src/pages/ro/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/ro/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Type | Description | -| --- | --- | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Type | Description | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums diff --git a/website/src/pages/ro/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/ro/subgraphs/developing/creating/starting-your-subgraph.mdx index 180a343470b1..4931e6b1fd34 100644 --- a/website/src/pages/ro/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/ro/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Version | Release notes | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ro/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/ro/subgraphs/developing/creating/subgraph-manifest.mdx index 78e4a3a55e7d..2c4bc1e9b1b5 100644 --- a/website/src/pages/ro/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/ro/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ The important entries to update for the manifest are: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ The important entries to update for the manifest are: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Call handlers will only trigger in one of two cases: when the function specified is called by an account other than the contract itself or when it is marked as external in Solidity and called as part of another function in the same contract. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Defining a Call Handler @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. The absence of a filter for a block handler will ensure that the handler is called every block. A data source can only contain one block handler for each filter type. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Start Blocks The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Version | Release notes | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ro/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/ro/subgraphs/developing/creating/unit-testing-framework.mdx index e56e1109bc04..1ec03c5555c7 100644 --- a/website/src/pages/ro/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/ro/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ or /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ This will run all tests in the test folder: graph test ``` -This will run a test named gravity.test.ts and/or all test inside of a folder named gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Write a Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Assuming we have the following handler function (along with two helper functions to make our life easier): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. This is an example of how that might look like: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - We're setting up our initial state and adding one custom Gravatar entity; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that gets added when the handler function is called; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. There we go - we've created our first test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interacting with Event metadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure you're code doesn't have critical logs in deployment, and you should notice right away if that were to happen. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing derived fields @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/ro/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/ro/subgraphs/developing/deploying/multiple-networks.mdx index 3b2b1bbc70ae..5c8016b18c91 100644 --- a/website/src/pages/ro/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/ro/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/ro/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/ro/subgraphs/developing/deploying/using-subgraph-studio.mdx index 77d10212c770..d44f9b375203 100644 --- a/website/src/pages/ro/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/ro/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/ro/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/ro/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 2bc0ec5f514c..e3e3a7e3d455 100644 --- a/website/src/pages/ro/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/ro/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` произведёт полный расчет таблицы. Этот процесс может быть медленным, но обеспечит точную степень соотношения отдельных объектов к общему количеству версий объекта. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> Это новый функционал, который будет доступен в Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/ru/resources/benefits.mdx b/website/src/pages/ru/resources/benefits.mdx index dc1e73eeb255..cb8af8484c6b 100644 --- a/website/src/pages/ru/resources/benefits.mdx +++ b/website/src/pages/ru/resources/benefits.mdx @@ -21,53 +21,53 @@ socialImage: https://thegraph.com/docs/img/seo/benefits.jpg ### Более низкая и гибкая структура затрат -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Сравнение затрат | Самостоятельный хостинг | Сеть The Graph | -| :-: | :-: | :-: | -| Ежемесячная стоимость сервера\* | $350 в месяц | $0 | -| Стоимость запроса | $0+ | $0 per month | -| Время разработки | $400 в месяц | Нет, встроен в сеть с глобально распределенными Индексаторами | -| Запросы в месяц | Ограничен возможностями инфраструктуры | 100,000 (Free Plan) | -| Стоимость одного запроса | $0 | $0 | -| Инфраструктура | Централизованная | Децентрализованная | -| Географическая избыточность | $750+ за каждую дополнительную ноду | Включено | -| Время безотказной работы | Варьируется | 99.9%+ | -| Общие ежемесячные расходы | $750+ | $0 | +| Сравнение затрат | Самостоятельный хостинг | Сеть The Graph | +| :-----------------------------: | :-------------------------------------: | :-----------------------------------------------------------: | +| Ежемесячная стоимость сервера\* | $350 в месяц | $0 | +| Стоимость запроса | $0+ | $0 per month | +| Время разработки | $400 в месяц | Нет, встроен в сеть с глобально распределенными Индексаторами | +| Запросы в месяц | Ограничен возможностями инфраструктуры | 100,000 (Free Plan) | +| Стоимость одного запроса | $0 | $0 | +| Инфраструктура | Централизованная | Децентрализованная | +| Географическая избыточность | $750+ за каждую дополнительную ноду | Включено | +| Время безотказной работы | Варьируется | 99.9%+ | +| Общие ежемесячные расходы | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Сравнение затрат | Самостоятельный хостинг | Сеть The Graph | -| :-: | :-: | :-: | -| Ежемесячная стоимость сервера\* | $350 в месяц | $0 | -| Стоимость запроса | $500 в месяц | $120 per month | -| Время разработки | $800 в месяц | Нет, встроен в сеть с глобально распределенными Индексаторами | -| Запросы в месяц | Ограничен возможностями инфраструктуры | ~3,000,000 | -| Стоимость одного запроса | $0 | $0.00004 | -| Инфраструктура | Централизованная | Децентрализованная | -| Инженерные расходы | $200 в час | Включено | -| Географическая избыточность | общие затраты на каждую дополнительную ноду составляют $1,200 | Включено | -| Время безотказной работы | Варьируется | 99.9%+ | -| Общие ежемесячные расходы | $1,650+ | $120 | +| Сравнение затрат | Самостоятельный хостинг | Сеть The Graph | +| :-----------------------------: | :-----------------------------------------------------------: | :-----------------------------------------------------------: | +| Ежемесячная стоимость сервера\* | $350 в месяц | $0 | +| Стоимость запроса | $500 в месяц | $120 per month | +| Время разработки | $800 в месяц | Нет, встроен в сеть с глобально распределенными Индексаторами | +| Запросы в месяц | Ограничен возможностями инфраструктуры | ~3,000,000 | +| Стоимость одного запроса | $0 | $0.00002 | +| Инфраструктура | Централизованная | Децентрализованная | +| Инженерные расходы | $200 в час | Включено | +| Географическая избыточность | общие затраты на каждую дополнительную ноду составляют $1,200 | Включено | +| Время безотказной работы | Варьируется | 99.9%+ | +| Общие ежемесячные расходы | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Сравнение затрат | Самостоятельный хостинг | Сеть The Graph | -| :-: | :-: | :-: | -| Ежемесячная стоимость сервера\* | $1100 в месяц за ноду | $0 | -| Стоимость запроса | $4000 | $1,200 per month | -| Необходимое количество нод | 10 | Не подходит | -| Время разработки | $6,000 или больше в месяц | Нет, встроен в сеть с глобально распределенными Индексаторами | -| Запросы в месяц | Ограничен возможностями инфраструктуры | ~30,000,000 | -| Стоимость одного запроса | $0 | $0.00004 | -| Инфраструктура | Централизованная | Децентрализованная | -| Географическая избыточность | общие затраты на каждую дополнительную ноду составляют $1,200 | Включено | -| Время безотказной работы | Варьируется | 99.9%+ | -| Общие ежемесячные расходы | $11,000+ | $1,200 | +| Сравнение затрат | Самостоятельный хостинг | Сеть The Graph | +| :-----------------------------: | :-----------------------------------------------------------: | :-----------------------------------------------------------: | +| Ежемесячная стоимость сервера\* | $1100 в месяц за ноду | $0 | +| Стоимость запроса | $4000 | $1,200 per month | +| Необходимое количество нод | 10 | Не подходит | +| Время разработки | $6,000 или больше в месяц | Нет, встроен в сеть с глобально распределенными Индексаторами | +| Запросы в месяц | Ограничен возможностями инфраструктуры | ~30,000,000 | +| Стоимость одного запроса | $0 | $0.00002 | +| Инфраструктура | Централизованная | Децентрализованная | +| Географическая избыточность | общие затраты на каждую дополнительную ноду составляют $1,200 | Включено | +| Время безотказной работы | Варьируется | 99.9%+ | +| Общие ежемесячные расходы | $11,000+ | $1,200 | \* включая расходы на резервное копирование: $50-$100 в месяц diff --git a/website/src/pages/ru/resources/claude-mcp.mdx b/website/src/pages/ru/resources/claude-mcp.mdx new file mode 100644 index 000000000000..2deada9d37eb --- /dev/null +++ b/website/src/pages/ru/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Предварительные требования + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/ru/subgraphs/developing/creating/advanced.mdx b/website/src/pages/ru/subgraphs/developing/creating/advanced.mdx index 662c71ed059f..d3eaa9fbaeab 100644 --- a/website/src/pages/ru/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/ru/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Обзор -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ eventHandlers: ## Декларированный eth_call -> Примечание: Это экспериментальная функция, которая пока недоступна в стабильной версии Graph Node. Вы можете использовать её только в Subgraph Studio или на своей локальной ноде. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. Эта функция выполняет следующие действия: diff --git a/website/src/pages/ru/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/ru/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/ru/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/ru/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/ru/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/ru/subgraphs/developing/creating/graph-ts/api.mdx index 4d3c6ff563f5..b206b2c53541 100644 --- a/website/src/pages/ru/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/ru/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ Learn what built-in APIs can be used when writing Subgraph mappings. There are t The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Версия | Примечания к релизу | -| :-: | --- | -| 0.0.9 | Добавлены новые функции хоста [`eth_get_balance`](#balance-of-an-address) и [`hasCode`](#check-if-an-address-a-contract-or-eoa) | -| 0.0.8 | Добавлена проверка наличия полей в схеме при сохранении объекта. | -| 0.0.7 | К типам Ethereum добавлены классы `TransactionReceipt` и `Log`
К объекту Ethereum Event добавлено поле `receipt` | -| 0.0.6 | В объект Ethereum Transaction добавлено поле `nonce`
В объект Ethereum Block добавлено поле `baseFeePerGas` | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | В объект Ethereum SmartContractCall добавлено поле `functionSignature` | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | В объект Ethereum Transaction добавлено поле `input` | +| Версия | Примечания к релизу | +| :----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Добавлены новые функции хоста [`eth_get_balance`](#balance-of-an-address) и [`hasCode`](#check-if-an-address-a-contract-or-eoa) | +| 0.0.8 | Добавлена проверка наличия полей в схеме при сохранении объекта. | +| 0.0.7 | К типам Ethereum добавлены классы `TransactionReceipt` и `Log`
К объекту Ethereum Event добавлено поле `receipt` | +| 0.0.6 | В объект Ethereum Transaction добавлено поле `nonce`
В объект Ethereum Block добавлено поле `baseFeePerGas` | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | В объект Ethereum SmartContractCall добавлено поле `functionSignature` | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | В объект Ethereum Transaction добавлено поле `input` | ### Встроенные типы @@ -233,7 +233,7 @@ Entities written to the store map one-to-one to the `@entity` types defined in t // Импорт класса событий Transfer, сгенерированного из ERC20 ABI import { Transfer as TransferEvent } from '../generated/ERC20/ERC20' -// Импорт типа объекта Transfer, сгенерированного из схемы GraphQL +// Импорт типа объекта Transfer, сгенерированного из схемы GraphQL import { Transfer } from '../generated/schema' событие // Обработчик события передачи @@ -269,6 +269,7 @@ if (transfer == null) { transfer = new Transfer(id) } + // Используйте объект Transfer, как и раньше ``` @@ -276,7 +277,7 @@ if (transfer == null) { > Примечание: Загрузка объектов необходима только в том случае, если изменения, внесенные в мэппинг, зависят от предыдущих данных объекта. В следующем разделе описаны два способа обновления существующих объектов. -#### Поиск объектов, созданных внутри блока +#### Looking up entities created within a block Начиная с `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 и `@graphprotocol/graph-cli` v0.49.0 метод `loadInBlock` доступен для всех типов объектов. @@ -292,6 +293,7 @@ if (transfer == null) { transfer = new Transfer(id) } + // Используйте объект Transfer, как и раньше ``` @@ -502,11 +504,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` связывается с `TransferEvent`, чтобы избежать конфликта наименований с типом объекта +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. Пока `ERC20Contract` в Ethereum имеет общедоступную функцию только для чтения, называемую `symbol`, ее можно вызвать с помощью `.symbol()`. Для общедоступных переменных состояния автоматически создается метод с таким же именем. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Обработка возвращенных вызовов @@ -666,6 +686,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -695,8 +717,8 @@ let data = ipfs.cat(path) import { JSONValue, Value } from '@graphprotocol/graph-ts' export function processItem(value: JSONValue, userData: Value): void { - // Смотрите документацию по JsonValue для получения подробной информации о работе - // со значениями JSON +// Смотрите документацию по JsonValue для получения подробной информации о работе +// со значениями JSON let obj = value.toObject() let id = obj.get('id') let title = obj.get('title') @@ -705,7 +727,7 @@ export function processItem(value: JSONValue, userData: Value): void { return } - // Обратные вызовы также могут создавать объекты +// Обратные вызовы также могут создавать объекты let newItem = new Item(id) newItem.title = title.toString() newitem.parent = userData.toString() // Установите для родителя значение "parentId" @@ -770,44 +792,45 @@ if (value.kind == JSONValueKind.BOOL) { ### Справка по преобразованию типов -| Источник(и) | Место назначения | Функция преобразования | -| -------------------- | -------------------- | ----------------------------- | -| Address | Bytes | отсутствует | -| Address | String | s.toHexString() | -| BigDecimal | String | s.toString() | -| BigInt | BigDecimal | s.toBigDecimal() | -| BigInt | String (hexadecimal) | s.toHexString() или s.toHex() | -| BigInt | String (unicode) | s.toString() | -| BigInt | i32 | s.toI32() | -| Boolean | Boolean | отсутствует | -| Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | -| Bytes (unsigned) | BigInt | BigInt.fromUnsignedBytes(s) | -| Bytes | String (hexadecimal) | s.toHexString() или s.toHex() | -| Bytes | String (unicode) | s.toString() | -| Bytes | String (base58) | s.toBase58() | -| Bytes | i32 | s.toI32() | -| Bytes | u32 | s.toU32() | -| Bytes | JSON | json.fromBytes(s) | -| int8 | i32 | отсутствует | -| int32 | i32 | отсутствует | -| int32 | BigInt | BigInt.fromI32(s) | -| uint24 | i32 | отсутствует | -| int64 - int256 | BigInt | отсутствует | -| uint32 - uint256 | BigInt | отсутствует | -| JSON | boolean | s.toBool() | -| JSON | i64 | s.toU64() | -| JSON | u64 | s.toU64() | -| JSON | f64 | s.toF64() | -| JSON | BigInt | s.toBigInt() | -| JSON | string | s.toString() | -| JSON | Array | s.toArray() | -| JSON | Object | s.toObject() | -| String | Address | Address.fromString(s) | -| Bytes | Address | Address.fromBytes(s) | -| String | BigInt | BigInt.fromString(s) | -| String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| Источник(и) | Место назначения | Функция преобразования | +| ---------------------- | ------------------------- | ----------------------------------- | +| Address | Bytes | отсутствует | +| Address | String | s.toHexString() | +| BigDecimal | String | s.toString() | +| BigInt | BigDecimal | s.toBigDecimal() | +| BigInt | String (hexadecimal) | s.toHexString() или s.toHex() | +| BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | +| BigInt | i32 | s.toI32() | +| Boolean | Boolean | отсутствует | +| Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | +| Bytes (unsigned) | BigInt | BigInt.fromUnsignedBytes(s) | +| Bytes | String (hexadecimal) | s.toHexString() или s.toHex() | +| Bytes | String (unicode) | s.toString() | +| Bytes | String (base58) | s.toBase58() | +| Bytes | i32 | s.toI32() | +| Bytes | u32 | s.toU32() | +| Bytes | JSON | json.fromBytes(s) | +| int8 | i32 | отсутствует | +| int32 | i32 | отсутствует | +| int32 | BigInt | BigInt.fromI32(s) | +| uint24 | i32 | отсутствует | +| int64 - int256 | BigInt | отсутствует | +| uint32 - uint256 | BigInt | отсутствует | +| JSON | boolean | s.toBool() | +| JSON | i64 | s.toU64() | +| JSON | u64 | s.toU64() | +| JSON | f64 | s.toF64() | +| JSON | BigInt | s.toBigInt() | +| JSON | string | s.toString() | +| JSON | Array | s.toArray() | +| JSON | Object | s.toObject() | +| String | Address | Address.fromString(s) | +| Bytes | Address | Address.fromBytes(s) | +| String | BigInt | BigInt.fromString(s) | +| String | BigDecimal | BigDecimal.fromString(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Метаданные источника данных diff --git a/website/src/pages/ru/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/ru/subgraphs/developing/creating/install-the-cli.mdx index 0208397aeb4d..15c7bbb61bea 100644 --- a/website/src/pages/ru/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/ru/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - Команда пытается получить ABI контракта из Etherscan. - - Интерфейс командной строки The Graph использует общедоступную конечную точку RPC. Несмотря на то, что возможны периодические сбои, повторные попытки обычно решают эту проблему. Если сбои продолжаются, рассмотрите возможность использования локального ABI. - Если какой-либо из необязательных аргументов отсутствует, Вам будет предложено воспользоваться интерактивной формой. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Специфические особенности -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/ru/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/ru/subgraphs/developing/creating/ql-schema.mdx index 5b4f6c643b60..23fe3781478b 100644 --- a/website/src/pages/ru/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/ru/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ type GravatarDeclined @entity { Null value resolved for non-null field 'name' ``` -Каждый объект должен иметь поле `id`, которое должно быть типа `Bytes!` или `String!`. Обычно рекомендуется использовать `Bytes!`, если только `id` не содержит текст, читаемый человеком, поскольку объекты с `id` типа `Bytes!` будут быстрее записываться и запрашиваться, чем те, у которых `id` типа `String!`. Поле `id` служит основным ключом и должно быть уникальным среди всех объектов одного типа. По историческим причинам также принимается тип `ID!`, который является синонимом `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. Для некоторых типов объектов `id` для `Bytes!` формируется из `id` двух других объектов. Это возможно с использованием функции `concat`, например, `let id = left.id.concat(right.id)`, чтобы сформировать `id` из `id` объектов `left` и `right`. Аналогично, чтобы сформировать `id` из `id` существующего объекта и счетчика `count`, можно использовать `let id = left.id.concatI32(count)`. Конкатенация гарантирует, что `id` будет уникальным, если длина `left.id` одинаковая для всех таких объектов, например, если `left.id` — это `Address`. @@ -72,16 +72,16 @@ Null value resolved for non-null field 'name' В API GraphQL поддерживаются следующие скаляры: -| Тип | Описание | -| --- | --- | -| `Bytes` | Массив байтов, представленный в виде шестнадцатеричной строки. Обычно используется для хэшей и адресов Ethereum. | -| `String` | Скаляр для значений типа `string`. Нулевые символы не поддерживаются и автоматически удаляются. | -| `Boolean` | Скаляр для значений `boolean`. | -| `Int` | Спецификация GraphQL определяет тип `Int` как знаковое 32-битное целое число. | -| `Int8` | 8-байтовое целое число со знаком, также известное как 64-битное целое число со знаком, может хранить значения в диапазоне от -9,223,372,036,854,775,808 до 9,223,372,036,854,775,807. Рекомендуется использовать его для представления типа `i64` из ethereum. | -| `BigInt` | Большие целые числа. Используются для типов `uint32`, `int64`, `uint64`, ..., `uint256` из Ethereum. Примечание: все типы, меньше чем `uint32`, такие как `int32`, `uint24` или `int8`, представлены как `i32`. | -| `BigDecimal` | `BigDecimal` Высокоточные десятичные числа, представленные как мантисса и экспонента. Диапазон экспоненты от −6143 до +6144. Округляется до 34 значащих цифр. | -| `Timestamp` | Это значение типа `i64` в микросекундах. Обычно используется для полей `timestamp` в временных рядах и агрегациях. | +| Тип | Описание | +| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Массив байтов, представленный в виде шестнадцатеричной строки. Обычно используется для хэшей и адресов Ethereum. | +| `String` | Скаляр для значений типа `string`. Нулевые символы не поддерживаются и автоматически удаляются. | +| `Boolean` | Скаляр для значений `boolean`. | +| `Int` | Спецификация GraphQL определяет тип `Int` как знаковое 32-битное целое число. | +| `Int8` | 8-байтовое целое число со знаком, также известное как 64-битное целое число со знаком, может хранить значения в диапазоне от -9,223,372,036,854,775,808 до 9,223,372,036,854,775,807. Рекомендуется использовать его для представления типа `i64` из ethereum. | +| `BigInt` | Большие целые числа. Используются для типов `uint32`, `int64`, `uint64`, ..., `uint256` из Ethereum. Примечание: все типы, меньше чем `uint32`, такие как `int32`, `uint24` или `int8`, представлены как `i32`. | +| `BigDecimal` | `BigDecimal` Высокоточные десятичные числа, представленные как мантисса и экспонента. Диапазон экспоненты от −6143 до +6144. Округляется до 34 значащих цифр. | +| `Timestamp` | Это значение типа `i64` в микросекундах. Обычно используется для полей `timestamp` в временных рядах и агрегациях. | ### Перечисления @@ -295,24 +295,24 @@ query { Поддерживаемые языковые словари: -| Код | Словарь | -| ------- | ------------- | -| простой | Общий | -| da | Датский | -| nl | Голландский | -| en | Английский | -| fi | Финский | -| fr | Французский | -| de | Немецкий | -| hu | Венгерский | -| it | Итальянский | -| no | Норвежский | -| pt | Португальский | -| ro | Румынский | -| ru | Русский | -| es | Испанский | -| sv | Шведский | -| tr | Турецкий | +| Код | Словарь | +| ------- | ---------------- | +| простой | Общий | +| da | Датский | +| nl | Голландский | +| en | Английский | +| fi | Финский | +| fr | Французский | +| de | Немецкий | +| hu | Венгерский | +| it | Итальянский | +| no | Норвежский | +| pt | Португальский | +| ro | Румынский | +| ru | Русский | +| es | Испанский | +| sv | Шведский | +| tr | Турецкий | ### Алгоритмы ранжирования diff --git a/website/src/pages/ru/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/ru/subgraphs/developing/creating/starting-your-subgraph.mdx index 0103ec85f145..60fcbd1a8dd9 100644 --- a/website/src/pages/ru/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/ru/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Версия | Примечания к релизу | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Версия | Примечания к релизу | +| :----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ru/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/ru/subgraphs/developing/creating/subgraph-manifest.mdx index 57530a38868e..e736891c91ed 100644 --- a/website/src/pages/ru/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/ru/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ dataSources: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ dataSources: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Обработчики вызовов срабатывают только в одном из двух случаев: когда указанная функция вызывается учетной записью, отличной от самого контракта, или когда она помечена как внешняя в Solidity и вызывается как часть другой функции в том же контракте. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Определение обработчика вызова @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. Отсутствие фильтра для обработчика блоков гарантирует, что обработчик вызывается для каждого блока. Источник данных может содержать только один обработчик блоков для каждого типа фильтра. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Стартовые блоки The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Версия | Примечания к релизу | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Версия | Примечания к релизу | +| :----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ru/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/ru/subgraphs/developing/creating/unit-testing-framework.mdx index 336ce2398d0d..4908986c6dbc 100644 --- a/website/src/pages/ru/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/ru/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ static BYTES = Symbol("Bytes") SyntaxError: Unexpected token = /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ To use **Matchstick** in your Subgraph project just open up a terminal, navigate graph test ``` -Это запустит тест с именем gravity.test.ts и/или все тесты внутри папки с именем gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Напишите юнит-тест -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Предположим, у нас есть следующая функция-обработчик (наряду с двумя вспомогательными функциями, облегчающими нашу жизнь): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -Сначала мы должны создать тестовый файл в нашем проекте. Вот пример того, как это могло бы выглядеть: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - Мы настраиваем наше исходное состояние и добавляем один пользовательский объект Gravatar; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- Мы утверждаем состояние хранилища. Как это происходит? - Мы передаем уникальную комбинацию типа объекта и идентификатора. Затем мы проверяем конкретное поле в этом объекте и утверждаем, что оно имеет то значение, которое мы ожидаем от него получить. Мы делаем это как для исходного объекта Gravatar, который мы добавили в хранилище, так и для двух объектов Gravatar, которые добавляются при вызове функции-обработчика; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. Вот и все - мы создали наш первый тест! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Взаимодействие с метаданными событий @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Логирование критических ошибок остановит выполнение тестов и все испортит. В конце концов, мы хотим быть уверены, что Ваш код не содержит критических логов при развертывании, и Вы сразу заметите, если это произойдет. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Тестирование производных полей @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Предварительные требования diff --git a/website/src/pages/ru/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/ru/subgraphs/developing/deploying/multiple-networks.mdx index 4f15c642b820..d14ae3c8bc1a 100644 --- a/website/src/pages/ru/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/ru/subgraphs/developing/deploying/multiple-networks.mdx @@ -211,7 +211,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/ru/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/ru/subgraphs/developing/deploying/using-subgraph-studio.mdx index 3ff9c8594763..9e6a7496d87c 100644 --- a/website/src/pages/ru/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/ru/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ graph deploy After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Публикация Вашего субграфа diff --git a/website/src/pages/ru/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/ru/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 8838c90b6889..e207c46cc418 100644 --- a/website/src/pages/ru/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/ru/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> Detta är ny funktionalitet, som kommer att vara tillgänglig i Graf Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/sv/resources/benefits.mdx b/website/src/pages/sv/resources/benefits.mdx index bbeb6f2f631c..395822db5f39 100644 --- a/website/src/pages/sv/resources/benefits.mdx +++ b/website/src/pages/sv/resources/benefits.mdx @@ -21,53 +21,53 @@ Här är en analys: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Kostnadsjämförelse | Egen Värd | The Graph Nätverk | -| :-: | :-: | :-: | -| Månatlig kostnad för server\* | $350 per månad | $0 | -| Kostnad för frågor | $0+ | $0 per month | -| Konstruktionstid | $400 per månad | Ingen, inbyggd i nätverket med globalt distribuerade Indexers | -| Frågor per månad | Begränsad till infra kapacitet | 100,000 (Free Plan) | -| Kostnad per fråga | $0 | $0 | -| Infrastructure | Centraliserad | Decentraliserad | -| Geografisk redundans | $750+ per extra nod | Inkluderat | -| Drifttid | Varierande | 99.9%+ | -| Total Månadskostnad | $750+ | $0 | +| Kostnadsjämförelse | Egen Värd | The Graph Nätverk | +| :---------------------------: | :-------------------------------------: | :-----------------------------------------------------------: | +| Månatlig kostnad för server\* | $350 per månad | $0 | +| Kostnad för frågor | $0+ | $0 per month | +| Konstruktionstid | $400 per månad | Ingen, inbyggd i nätverket med globalt distribuerade Indexers | +| Frågor per månad | Begränsad till infra kapacitet | 100,000 (Free Plan) | +| Kostnad per fråga | $0 | $0 | +| Infrastructure | Centraliserad | Decentraliserad | +| Geografisk redundans | $750+ per extra nod | Inkluderat | +| Drifttid | Varierande | 99.9%+ | +| Total Månadskostnad | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Kostnadsjämförelse | Egen Värd | The Graph Nätverk | -| :-: | :-: | :-: | -| Månatlig kostnad för server\* | $350 per månad | $0 | -| Kostnad för frågor | $500 per månad | $120 per month | -| Konstruktionstid | $800 per månad | Ingen, inbyggd i nätverket med globalt distribuerade Indexers | -| Frågor per månad | Begränsad till infra kapacitet | ~3,000,000 | -| Kostnad per fråga | $0 | $0.00004 | -| Infrastructure | Centraliserad | Decentraliserad | -| Kostnader för ingenjörsarbete | $200 per timme | Inkluderat | -| Geografisk redundans | $1,200 i totala kostnader per extra nod | Inkluderat | -| Drifttid | Varierande | 99.9%+ | -| Total Månadskostnad | $1,650+ | $120 | +| Kostnadsjämförelse | Egen Värd | The Graph Nätverk | +| :---------------------------: | :----------------------------------------: | :-----------------------------------------------------------: | +| Månatlig kostnad för server\* | $350 per månad | $0 | +| Kostnad för frågor | $500 per månad | $120 per month | +| Konstruktionstid | $800 per månad | Ingen, inbyggd i nätverket med globalt distribuerade Indexers | +| Frågor per månad | Begränsad till infra kapacitet | ~3,000,000 | +| Kostnad per fråga | $0 | $0.00002 | +| Infrastructure | Centraliserad | Decentraliserad | +| Kostnader för ingenjörsarbete | $200 per timme | Inkluderat | +| Geografisk redundans | $1,200 i totala kostnader per extra nod | Inkluderat | +| Drifttid | Varierande | 99.9%+ | +| Total Månadskostnad | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Kostnadsjämförelse | Egen Värd | The Graph Nätverk | -| :-: | :-: | :-: | -| Månatlig kostnad för server\* | $1100 per månad, per nod | $0 | -| Kostnad för frågor | $4000 | $1,200 per month | -| Antal noder som behövs | 10 | Ej tillämpligt | -| Konstruktionstid | $6,000 eller mer per månad | Ingen, inbyggd i nätverket med globalt distribuerade Indexers | -| Frågor per månad | Begränsad till infra kapacitet | ~30,000,000 | -| Kostnad per fråga | $0 | $0.00004 | -| Infrastructure | Centraliserad | Decentraliserad | -| Geografisk redundans | $1,200 i totala kostnader per extra nod | Inkluderat | -| Drifttid | Varierande | 99.9%+ | -| Total Månadskostnad | $11,000+ | $1,200 | +| Kostnadsjämförelse | Egen Värd | The Graph Nätverk | +| :---------------------------: | :-----------------------------------------: | :-----------------------------------------------------------: | +| Månatlig kostnad för server\* | $1100 per månad, per nod | $0 | +| Kostnad för frågor | $4000 | $1,200 per month | +| Antal noder som behövs | 10 | Ej tillämpligt | +| Konstruktionstid | $6,000 eller mer per månad | Ingen, inbyggd i nätverket med globalt distribuerade Indexers | +| Frågor per månad | Begränsad till infra kapacitet | ~30,000,000 | +| Kostnad per fråga | $0 | $0.00002 | +| Infrastructure | Centraliserad | Decentraliserad | +| Geografisk redundans | $1,200 i totala kostnader per extra nod | Inkluderat | +| Drifttid | Varierande | 99.9%+ | +| Total Månadskostnad | $11,000+ | $1,200 | \*inklusive kostnader för backup: $50-$100 per månad diff --git a/website/src/pages/sv/resources/claude-mcp.mdx b/website/src/pages/sv/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/sv/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/sv/subgraphs/developing/creating/advanced.mdx b/website/src/pages/sv/subgraphs/developing/creating/advanced.mdx index e8476a0d9bdf..3ee204a36480 100644 --- a/website/src/pages/sv/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/sv/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Översikt -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/sv/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/sv/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/sv/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/sv/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/sv/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/sv/subgraphs/developing/creating/graph-ts/api.mdx index afc7cbab6a60..a3cd8d939bce 100644 --- a/website/src/pages/sv/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/sv/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Version | Versionsanteckningar | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Version | Versionsanteckningar | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Inbyggda typer @@ -163,7 +163,7 @@ _Math_ #### TypedMap ```typescript -import { TypedMap } from '@graphprotocol/graph-ts' +import { TypedMap } from "@graphprotocol/graph-ts"; ``` `TypedMap` can be used to store key-value pairs. See [this example](https://github.com/graphprotocol/aragon-subgraph/blob/29dd38680c5e5104d9fdc2f90e740298c67e4a31/individual-dao-subgraph/mappings/constants.ts#L51). @@ -179,7 +179,7 @@ The `TypedMap` class has the following API: #### Bytes ```typescript -import { Bytes } from '@graphprotocol/graph-ts' +import { Bytes } from "@graphprotocol/graph-ts"; ``` `Bytes` is used to represent arbitrary-length arrays of bytes. This includes Ethereum values of type `bytes`, `bytes32`, etc. @@ -205,7 +205,7 @@ _Operators_ #### Address ```typescript -import { Address } from '@graphprotocol/graph-ts' +import { Address } from "@graphprotocol/graph-ts"; ``` `Address` extends `Bytes` to represent Ethereum `address` values. @@ -218,7 +218,7 @@ It adds the following method on top of the `Bytes` API: ### Store API ```typescript -import { store } from '@graphprotocol/graph-ts' +import { store } from "@graphprotocol/graph-ts"; ``` The `store` API allows to load, save and remove entities from and to the Graph Node store. @@ -231,24 +231,24 @@ Följande är ett vanligt mönster för att skapa entiteter från Ethereum-händ ```typescript // Importera händelseklassen Transfer som genererats från ERC20 ABI -import { Transfer as TransferEvent } from '../generated/ERC20/ERC20' +import { Transfer as TransferEvent } from "../generated/ERC20/ERC20"; // Importera entitetstypen Transfer som genererats från GraphQL-schemat -import { Transfer } from '../generated/schema' +import { Transfer } from "../generated/schema"; // Händelsehanterare för överföring export function handleTransfer(event: TransferEvent): void { // Skapa en Transfer-entitet, med transaktionshash som enhets-ID - let id = event.transaction.hash - let transfer = new Transfer(id) + let id = event.transaction.hash; + let transfer = new Transfer(id); // Ange egenskaper för entiteten med hjälp av händelseparametrarna - transfer.from = event.params.from - transfer.to = event.params.to - transfer.amount = event.params.amount + transfer.from = event.params.from; + transfer.to = event.params.to; + transfer.amount = event.params.amount; // Spara entiteten till lagret - transfer.save() + transfer.save(); } ``` @@ -263,10 +263,10 @@ Each entity must have a unique ID to avoid collisions with other entities. It is Om en entitet redan finns kan den laddas från lagret med följande: ```typescript -let id = event.transaction.hash // eller hur ID konstrueras -let transfer = Transfer.load(id) +let id = event.transaction.hash; // eller hur ID konstrueras +let transfer = Transfer.load(id); if (transfer == null) { - transfer = new Transfer(id) + transfer = new Transfer(id); } // Använd överföringsenheten som tidigare @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Sökning av entiteter skapade inom ett block +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -286,10 +286,10 @@ The store API facilitates the retrieval of entities that were created or updated - For some Subgraphs, these missed lookups can contribute significantly to the indexing time. ```typescript -let id = event.transaction.hash // eller hur ID konstrueras -let transfer = Transfer.loadInBlock(id) +let id = event.transaction.hash; // eller hur ID konstrueras +let transfer = Transfer.loadInBlock(id); if (transfer == null) { - transfer = new Transfer(id) + transfer = new Transfer(id); } // Använd överföringsenheten som tidigare @@ -343,7 +343,7 @@ transfer.amount = ... Det är också möjligt att avaktivera egenskaper med en av följande två instruktioner: ```typescript -transfer.from.unset() +transfer.from.unset(); transfer.from = null ``` @@ -353,14 +353,14 @@ Updating array properties is a little more involved, as the getting an array fro ```typescript // Detta kommer inte att fungera -entity.numbers.push(BigInt.fromI32(1)) -entity.save() +entity.numbers.push(BigInt.fromI32(1)); +entity.save(); // Detta kommer att fungera -let numbers = entity.numbers -numbers.push(BigInt.fromI32(1)) -entity.numbers = numbers -entity.save() +let numbers = entity.numbers; +numbers.push(BigInt.fromI32(1)); +entity.numbers = numbers; +entity.save(); ``` #### Ta bort entiteter från lagret @@ -398,12 +398,12 @@ type Transfer @entity { and a `Transfer(address,address,uint256)` event signature on Ethereum, the `from`, `to` and `amount` values of type `address`, `address` and `uint256` are converted to `Address` and `BigInt`, allowing them to be passed on to the `Bytes!` and `BigInt!` properties of the `Transfer` entity: ```typescript -let id = event.transaction.hash -let transfer = new Transfer(id) -transfer.from = event.params.from -transfer.to = event.params.to -transfer.amount = event.params.amount -transfer.save() +let id = event.transaction.hash; +let transfer = new Transfer(id); +transfer.from = event.params.from; +transfer.to = event.params.to; +transfer.amount = event.params.amount; +transfer.save(); ``` #### Händelser och Block/Transaktionsdata @@ -489,24 +489,45 @@ En vanlig mönster är att komma åt kontraktet från vilket en händelse härst ```typescript // Importera den genererade kontraktsklassen och den genererade klassen för överföringshändelser -import { ERC20Contract, Transfer as TransferEvent } from '../generated/ERC20Contract/ERC20Contract' +import { + ERC20Contract, + Transfer as TransferEvent, +} from "../generated/ERC20Contract/ERC20Contract"; // Importera den genererade entitetsklassen -import { Transfer } from '../generated/schema' +import { Transfer } from "../generated/schema"; export function handleTransfer(event: TransferEvent) { // Bind kontraktet till den adress som skickade händelsen - let contract = ERC20Contract.bind(event.address) + let contract = ERC20Contract.bind(event.address); // Åtkomst till tillståndsvariabler och funktioner genom att anropa dem - let erc20Symbol = contract.symbol() + let erc20Symbol = contract.symbol(); } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Hantering av återkallade anrop @@ -515,12 +536,12 @@ If the read-only methods of your contract may revert, then you should handle tha - For example, the Gravity contract exposes the `gravatarToOwner` method. This code would be able to handle a revert in that method: ```typescript -let gravitera = gravitera.bind(event.address) -let callResult = gravitera_gravatarToOwner(gravatar) +let gravitera = gravitera.bind(event.address); +let callResult = gravitera_gravatarToOwner(gravatar); if (callResult.reverted) { - log.info('getGravatar reverted', []) + log.info("getGravatar reverted", []); } else { - let owner = callResult.value + let owner = callResult.value; } ``` @@ -579,7 +600,7 @@ let isContract = ethereum.hasCode(eoa).inner // returns false ### API för loggning ```typescript -import { log } from '@graphprotocol/graph-ts' +import { log } from "@graphprotocol/graph-ts"; ``` The `log` API allows Subgraphs to log information to the Graph Node standard output as well as Graph Explorer. Messages can be logged using different log levels. A basic format string syntax is provided to compose log messages from argument. @@ -595,7 +616,11 @@ The `log` API includes the following functions: The `log` API takes a format string and an array of string values. It then replaces placeholders with the string values from the array. The first `{}` placeholder gets replaced by the first value in the array, the second `{}` placeholder gets replaced by the second value and so on. ```typescript -log.info('Message to be displayed: {}, {}, {}', [value.toString(), anotherValue.toString(), 'already a string']) +log.info("Message to be displayed: {}, {}, {}", [ + value.toString(), + anotherValue.toString(), + "already a string", +]); ``` #### Loggning av ett eller flera värden @@ -618,11 +643,11 @@ export function handleSomeEvent(event: SomeEvent): void { I exemplet nedan loggas endast det första värdet i argument arrayen, trots att arrayen innehåller tre värden. ```typescript -let myArray = ['A', 'B', 'C'] +let myArray = ["A", "B", "C"]; export function handleSomeEvent(event: SomeEvent): void { // Visar : "Mitt värde är: A" (Även om tre värden skickas till `log.info`) - log.info('Mitt värde är: {}', myArray) + log.info("Mitt värde är: {}", myArray); } ``` @@ -631,11 +656,14 @@ export function handleSomeEvent(event: SomeEvent): void { Each entry in the arguments array requires its own placeholder `{}` in the log message string. The below example contains three placeholders `{}` in the log message. Because of this, all three values in `myArray` are logged. ```typescript -let myArray = ['A', 'B', 'C'] +let myArray = ["A", "B", "C"]; export function handleSomeEvent(event: SomeEvent): void { // Visar: "Mitt första värde är: A, andra värdet är: B, tredje värdet är: C" - log.info('My first value is: {}, second value is: {}, third value is: {}', myArray) + log.info( + "My first value is: {}, second value is: {}, third value is: {}", + myArray + ); } ``` @@ -646,7 +674,7 @@ För att visa ett specifikt värde i arrayen måste det indexeras och tillhandah ```typescript export function handleSomeEvent(event: SomeEvent): void { // Visar : "Mitt tredje värde är C" - log.info('My third value is: {}', [myArray[2]]) + log.info("My third value is: {}", [myArray[2]]); } ``` @@ -655,21 +683,23 @@ export function handleSomeEvent(event: SomeEvent): void { I exemplet nedan loggas blocknummer, blockhash och transaktionshash från en händelse: ```typescript -import { log } from '@graphprotocol/graph-ts' +import { log } from "@graphprotocol/graph-ts"; export function handleSomeEvent(event: SomeEvent): void { - log.debug('Block number: {}, block hash: {}, transaction hash: {}', [ + log.debug("Block number: {}, block hash: {}, transaction hash: {}", [ event.block.number.toString(), // "47596000" event.block.hash.toHexString(), // "0x..." event.transaction.hash.toHexString(), // "0x..." - ]) + ]); } ``` + + ### IPFS API ```typescript -import { ipfs } from '@graphprotocol/graph-ts' +import { ipfs } from "@graphprotocol/graph-ts" ``` Smart contracts occasionally anchor IPFS files onchain. This allows mappings to obtain the IPFS hashes from the contract and read the corresponding files from IPFS. The file data will be returned as `Bytes`, which usually requires further processing, e.g. with the `json` API documented later on this page. @@ -678,13 +708,13 @@ För att läsa en fil från IPFS med en given IPFS-hash eller sökväg görs fö ```typescript // Placera detta i en händelsehanterare i mappningen -let hash = 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D' -let data = ipfs.cat(hash) +let hash = "QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D"; +let data = ipfs.cat(hash); // Sökvägar som `QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D/Makefile` // som inkluderar filer i kataloger stöds också -let path = 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D/Makefile' -let data = ipfs.cat(path) +let path = "QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D/Makefile"; +let data = ipfs.cat(path); ``` **Note:** `ipfs.cat` is not deterministic at the moment. If the file cannot be retrieved over the IPFS network before the request times out, it will return `null`. Due to this, it's always worth checking the result for `null`. @@ -692,31 +722,31 @@ let data = ipfs.cat(path) It is also possible to process larger files in a streaming fashion with `ipfs.map`. The function expects the hash or path for an IPFS file, the name of a callback, and flags to modify its behavior: ```typescript -import { JSONValue, Value } from '@graphprotocol/graph-ts' +import { JSONValue, Value } from "@graphprotocol/graph-ts"; export function processItem(value: JSONValue, userData: Value): void { // Se JSONValue-dokumentationen för mer information om hur man hanterar // med JSON-värden - let obj = value.toObject() - let id = obj.get('id') - let title = obj.get('title') + let obj = value.toObject(); + let id = obj.get("id"); + let title = obj.get("title"); if (!id || !title) { - return + return; } // Callbacks kan också skapa enheter - let newItem = new Item(id) - newItem.title = title.toString() - newitem.parent = userData.toString() // Ange parent till "parentId" - newitem.save() + let newItem = new Item(id); + newItem.title = title.toString(); + newitem.parent = userData.toString(); // Ange parent till "parentId" + newitem.save(); } // Placera detta i en händelsehanterare i mappningen -ipfs.map('Qm...', 'processItem', Value.fromString('parentId'), ['json']) +ipfs.map("Qm...", "processItem", Value.fromString("parentId"), ["json"]); // Alternativt kan du använda `ipfs.mapJSON`. -ipfs.mapJSON('Qm...', 'processItem', Value.fromString('parentId')) +ipfs.mapJSON("Qm...", "processItem", Value.fromString("parentId")); ``` The only flag currently supported is `json`, which must be passed to `ipfs.map`. With the `json` flag, the IPFS file must consist of a series of JSON values, one value per line. The call to `ipfs.map` will read each line in the file, deserialize it into a `JSONValue` and call the callback for each of them. The callback can then use entity operations to store data from the `JSONValue`. Entity changes are stored only when the handler that called `ipfs.map` finishes successfully; in the meantime, they are kept in memory, and the size of the file that `ipfs.map` can process is therefore limited. @@ -726,7 +756,7 @@ On success, `ipfs.map` returns `void`. If any invocation of the callback causes ### Crypto API ```typescript -import { crypto } from '@graphprotocol/graph-ts' +import { crypto } from "@graphprotocol/graph-ts"; ``` The `crypto` API makes a cryptographic functions available for use in mappings. Right now, there is only one: @@ -736,7 +766,7 @@ The `crypto` API makes a cryptographic functions available for use in mappings. ### JSON API ```typescript -import { json, JSONValueKind } from '@graphprotocol/graph-ts' +import { json, JSONValueKind } from "@graphprotocol/graph-ts" ``` JSON data can be parsed using the `json` API: @@ -778,6 +808,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | Sträng (hexadecimal) | s.toHexString() eller s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +837,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| Sträng (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| Sträng (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Metadata för datakälla diff --git a/website/src/pages/sv/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/sv/subgraphs/developing/creating/install-the-cli.mdx index 21e3401cd8e9..b83ba22b7cdc 100644 --- a/website/src/pages/sv/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/sv/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/sv/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/sv/subgraphs/developing/creating/ql-schema.mdx index 839bfd17d19d..319f220276b9 100644 --- a/website/src/pages/sv/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/sv/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Typ | Beskrivning | -| --- | --- | -| `Bytes` | Bytematris, representerad som en hexadecimal sträng. Vanligt används för Ethereum-hashar och adresser. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Typ | Beskrivning | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Bytematris, representerad som en hexadecimal sträng. Vanligt används för Ethereum-hashar och adresser. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums @@ -259,7 +259,12 @@ type _Schema_ name: "bandSearch" language: en algorithm: rank - include: [{ entity: "Band", fields: [{ name: "name" }, { name: "description" }, { name: "bio" }] }] + include: [ + { + entity: "Band" + fields: [{ name: "name" }, { name: "description" }, { name: "bio" }] + } + ] ) type Band @entity { @@ -295,24 +300,24 @@ Att välja ett annat språk kommer att ha en definitiv, om än ibland subtil, ef Stödda språkordböcker: -| Code | Ordbok | -| ----- | ------------ | -| enkel | General | -| da | Danish | -| nl | Dutch | -| en | English | -| fi | Finnish | -| fr | French | -| de | German | -| hu | Hungarian | -| it | Italian | -| no | Norwegian | -| pt | Portugisiska | -| ro | Romanian | -| ru | Russian | -| es | Spanish | -| sv | Swedish | -| tr | Turkish | +| Code | Ordbok | +| ------ | ------------ | +| enkel | General | +| da | Danish | +| nl | Dutch | +| en | English | +| fi | Finnish | +| fr | French | +| de | German | +| hu | Hungarian | +| it | Italian | +| no | Norwegian | +| pt | Portugisiska | +| ro | Romanian | +| ru | Russian | +| es | Spanish | +| sv | Swedish | +| tr | Turkish | ### Rankningsalgoritmer diff --git a/website/src/pages/sv/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/sv/subgraphs/developing/creating/starting-your-subgraph.mdx index db4c083402f9..3c7846394f04 100644 --- a/website/src/pages/sv/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/sv/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Version | Versionsanteckningar | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Versionsanteckningar | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/sv/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/sv/subgraphs/developing/creating/subgraph-manifest.mdx index b86383d95712..138a2ac1a0f9 100644 --- a/website/src/pages/sv/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/sv/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ De viktiga posterna att uppdatera för manifestet är: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ De viktiga posterna att uppdatera för manifestet är: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Anropsbehandlare utlöses endast i ett av två fall: när den specificerade funktionen anropas av ett konto som inte är kontraktet självt eller när den är markerad som extern i Solidity och anropas som en del av en annan funktion i samma kontrakt. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Definiera en Anropsbehandlare @@ -189,15 +189,15 @@ The `function` is the normalized function signature to filter calls by. The `han Each call handler takes a single parameter that has a type corresponding to the name of the called function. In the example Subgraph above, the mapping contains a handler for when the `createGravatar` function is called and receives a `CreateGravatarCall` parameter as an argument: ```typescript -import { CreateGravatarCall } from '../generated/Gravity/Gravity' -import { Transaction } from '../generated/schema' +import { CreateGravatarCall } from "../generated/Gravity/Gravity"; +import { Transaction } from "../generated/schema"; export function handleCreateGravatar(call: CreateGravatarCall): void { - let id = call.transaction.hash - let transaction = new Transaction(id) - transaction.displayName = call.inputs._displayName - transaction.imageUrl = call.inputs._imageUrl - transaction.save() + let id = call.transaction.hash; + let transaction = new Transaction(id); + transaction.displayName = call.inputs._displayName; + transaction.imageUrl = call.inputs._imageUrl; + transaction.save(); } ``` @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. Avsaknaden av ett filter för en blockhanterare kommer att säkerställa att hanteraren kallas för varje block. En datakälla kan endast innehålla en blockhanterare för varje filttyp. @@ -280,9 +280,9 @@ The defined handler with the once filter will be called only once before all oth ```ts export function handleOnce(block: ethereum.Block): void { - let data = new InitialData(Bytes.fromUTF8('initial')) - data.data = 'Setup data here' - data.save() + let data = new InitialData(Bytes.fromUTF8("initial")); + data.data = "Setup data here"; + data.save(); } ``` @@ -291,12 +291,12 @@ export function handleOnce(block: ethereum.Block): void { The mapping function will receive an `ethereum.Block` as its only argument. Like mapping functions for events, this function can access existing Subgraph entities in the store, call smart contracts and create or update entities. ```typescript -import { ethereum } from '@graphprotocol/graph-ts' +import { ethereum } from "@graphprotocol/graph-ts"; export function handleBlock(block: ethereum.Block): void { - let id = block.hash - let entity = new Block(id) - entity.save() + let id = block.hash; + let entity = new Block(id); + entity.save(); } ``` @@ -414,12 +414,12 @@ templates: In the final step, you update your main contract mapping to create a dynamic data source instance from one of the templates. In this example, you would change the main contract mapping to import the `Exchange` template and call the `Exchange.create(address)` method on it to start indexing the new exchange contract. ```typescript -import { Exchange } from '../generated/templates' +import { Exchange } from "../generated/templates"; export function handleNewExchange(event: NewExchange): void { // Start indexing the exchange; `event.params.exchange` is the // address of the new exchange contract - Exchange.create(event.params.exchange) + Exchange.create(event.params.exchange); } ``` @@ -432,26 +432,28 @@ export function handleNewExchange(event: NewExchange): void { Data source contexts allow passing extra configuration when instantiating a template. In our example, let's say exchanges are associated with a particular trading pair, which is included in the `NewExchange` event. That information can be passed into the instantiated data source, like so: ```typescript -import { Exchange } from '../generated/templates' +import { Exchange } from "../generated/templates"; export function handleNewExchange(event: NewExchange): void { - let context = new DataSourceContext() - context.setString('tradingPair', event.params.tradingPair) - Exchange.createWithContext(event.params.exchange, context) + let context = new DataSourceContext(); + context.setString("tradingPair", event.params.tradingPair); + Exchange.createWithContext(event.params.exchange, context); } ``` Inside a mapping of the `Exchange` template, the context can then be accessed: ```typescript -import { dataSource } from '@graphprotocol/graph-ts' +import { dataSource } from "@graphprotocol/graph-ts"; -let context = dataSource.context() -let tradingPair = context.getString('tradingPair') +let context = dataSource.context(); +let tradingPair = context.getString("tradingPair") ``` There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Startblock The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Version | Versionsanteckningar | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Versionsanteckningar | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/sv/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/sv/subgraphs/developing/creating/unit-testing-framework.mdx index 83b346d47707..204a10a19038 100644 --- a/website/src/pages/sv/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/sv/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ eller /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ Detta kommer att köra alla tester i testmappen: graph test ``` -Detta kommer att köra en test med namnet gravity.test.ts och/eller alla tester inuti en mapp med namnet gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Skriv en enhetstest -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Antag att vi har följande hanteringsfunktion (tillsammans med två hjälpfunktioner för att göra vårt liv enklare): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -Vi måste först skapa en testfil i vårt projekt. Det här är ett exempel på hur det kan se ut: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - Vi ställer in vår inledande status och lägger till en anpassad Gravatar-entitet; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- Vi försäkrar oss om statusen för lagringen. Hur fungerar det? - Vi skickar en unik kombination av entitetstyp och id. Sedan kontrollerar vi ett specifikt fält på den entiteten och försäkrar oss om att det har det värde vi förväntar oss. Vi gör detta både för den ursprungliga Gravatar-entiteten vi lade till i lagringen och de två Gravatar-entiteterna som läggs till när hanteringsfunktionen anropas; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. Så där har vi skapat vårt första test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interagera med händelsemetadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Loggning av kritiska fel kommer att stoppa utförandet av testerna och orsaka total krasch. Trots allt vill vi säkerställa att din kod inte har kritiska loggar i produktion, och du bör märka det omedelbart om det skulle inträffa. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testning av härledda fält @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/sv/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/sv/subgraphs/developing/deploying/multiple-networks.mdx index b45b0701bfdd..016d1a3970e6 100644 --- a/website/src/pages/sv/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/sv/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/sv/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/sv/subgraphs/developing/deploying/using-subgraph-studio.mdx index dc1facd6d5cb..0afc63760767 100644 --- a/website/src/pages/sv/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/sv/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/sv/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/sv/subgraphs/developing/publishing/publishing-a-subgraph.mdx index e13f4a7f9f7c..905759049aca 100644 --- a/website/src/pages/sv/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/sv/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` komutunu çalıştırmak tablonun tam bir sayımını yapacaktır. Bu sayım yavaş olabilir ama farklı varlıkların genel varlık sürümlerine oranını tam olarak ölçer. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> Bu, Graph Node 0.29.x sürümünde kullanılabilir olan yeni bir fonksiyonelliktir - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/tr/resources/benefits.mdx b/website/src/pages/tr/resources/benefits.mdx index 34e23eccc9cc..f1be9628af43 100644 --- a/website/src/pages/tr/resources/benefits.mdx +++ b/website/src/pages/tr/resources/benefits.mdx @@ -21,60 +21,59 @@ Here is an analysis: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Cost Comparison | Self Hosted | Graph Ağı | -| :-: | :-: | :-: | -| Aylık sunucu maliyeti\* | Aylık 350$ | 0$ | -| Sorgu maliyetleri | $0+ | $0 per month | -| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | -| Cost per query | 0$ | $0 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $750+ per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $750+ | 0$ | +| Cost Comparison | Self Hosted | Graph Ağı | +| :--------------------------: | :-------------------------------------: | :-------------------------------------------------------------: | +| Aylık sunucu maliyeti\* | Aylık 350$ | 0$ | +| Sorgu maliyetleri | $0+ | $0 per month | +| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | +| Cost per query | 0$ | $0 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $750+ per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $750+ | 0$ | ## Medium Volume User (~3M queries per month) -| Cost Comparison | Self Hosted | Graph Ağı | -| :-: | :-: | :-: | -| Aylık sunucu maliyeti\* | Aylık 350$ | 0$ | -| Sorgu maliyetleri | $500 per month | $120 per month | -| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~3,000,000 | -| Cost per query | 0$ | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Engineering expense | $200 per hour | Included | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $1,650+ | $120 | +| Cost Comparison | Self Hosted | Graph Ağı | +| :--------------------------: | :----------------------------------------: | :-------------------------------------------------------------: | +| Aylık sunucu maliyeti\* | Aylık 350$ | 0$ | +| Sorgu maliyetleri | $500 per month | $120 per month | +| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~3,000,000 | +| Cost per query | 0$ | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Engineering expense | $200 per hour | Included | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Cost Comparison | Self Hosted | Graph Ağı | -| :-: | :-: | :-: | -| Aylık sunucu maliyeti\* | $1100 per month, per node | 0$ | -| Sorgu maliyetleri | $4000 | $1,200 per month | -| Number of nodes needed | 10 | Not applicable | -| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~30,000,000 | -| Cost per query | 0$ | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $11,000+ | $1,200 | +| Cost Comparison | Self Hosted | Graph Ağı | +| :--------------------------: | :-----------------------------------------: | :-------------------------------------------------------------: | +| Aylık sunucu maliyeti\* | $1100 per month, per node | 0$ | +| Sorgu maliyetleri | $4000 | $1,200 per month | +| Number of nodes needed | 10 | Not applicable | +| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~30,000,000 | +| Cost per query | 0$ | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $11,000+ | $1,200 | \*including costs for backup: $50-$100 per month Engineering time based on $200 per hour assumption -Veri tüketicisi için maliyeti yansıtır. Ücretsiz Plan kullanılarak yapılan sorgular için de Endeksleyicilere -sorgu ücretleri ödenir. +Veri tüketicisi için maliyeti yansıtır. Ücretsiz Plan kullanılarak yapılan sorgular için de Endeksleyicilere sorgu ücretleri ödenir. Estimated costs are only for Ethereum Mainnet Subgraphs — costs are even higher when self hosting a `graph-node` on other networks. Some users may need to update their Subgraph to a new version. Due to Ethereum gas fees, an update costs ~$50 at time of writing. Note that gas fees on [Arbitrum](/archived/arbitrum/arbitrum-faq/) are substantially lower than Ethereum mainnet. diff --git a/website/src/pages/tr/resources/claude-mcp.mdx b/website/src/pages/tr/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/tr/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/tr/subgraphs/developing/creating/advanced.mdx b/website/src/pages/tr/subgraphs/developing/creating/advanced.mdx index 76cad13dfa04..676c99661ff9 100644 --- a/website/src/pages/tr/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/tr/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Genel Bakış -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ Bu konfigürasyonda: ## Deklare edilmiş eth_call -> Not: Bu, henüz stabil bir Graph Düğümü sürümünde mevcut olmayan deneysel bir özelliktir. Yalnızca Subgraph Studio'da veya sağlayıcılığını kendiniz yaptığınız düğümünüzde kullanabilirsiniz. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. Bu özellik: diff --git a/website/src/pages/tr/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/tr/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/tr/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/tr/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/tr/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/tr/subgraphs/developing/creating/graph-ts/api.mdx index 1b8f899e6161..867571da14c1 100644 --- a/website/src/pages/tr/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/tr/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ Dil eşlemeleri AssemblyScript ile yazıldığından, [AssemblyScript wiki'sinde The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Sürüm | Sürüm Notları | -| :-: | --- | -| 0.0.9 | Yeni host fonksiyonları ekler: [`eth_get_balance`](#balance-of-an-address) ve [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Bir varlığı kaydederken şemadaki alanların varlığını doğrulama mekanizması ekler. | -| 0.0.7 | Ethereum türlerine `TransactionReceipt` ve `Log` sınıfları eklendi
Ethereum Event nesnesine `receipt` alanı eklendi | -| 0.0.6 | Ethereum Transaction nesnesine `nonce` alanı eklendi
Ethereum Block nesnesine `baseFeePerGas` eklendi | +| Sürüm | Sürüm Notları | +| :---: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Yeni host fonksiyonları ekler: [`eth_get_balance`](#balance-of-an-address) ve [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Bir varlığı kaydederken şemadaki alanların varlığını doğrulama mekanizması ekler. | +| 0.0.7 | Ethereum türlerine `TransactionReceipt` ve `Log` sınıfları eklendi
Ethereum Event nesnesine `receipt` alanı eklendi | +| 0.0.6 | Ethereum Transaction nesnesine `nonce` alanı eklendi
Ethereum Block nesnesine `baseFeePerGas` eklendi | | 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Ethereum SmartContractCall nesnesine `functionSignature` alanı eklendi | -| 0.0.3 | Ethereum Call nesnesine `from` alanı eklendi
`ethereum.call.address`, `ethereum.call.to` olarak yeniden adlandırıldı | -| 0.0.2 | Ethereum Transaction nesnesine `input` alanı eklendi | +| 0.0.4 | Ethereum SmartContractCall nesnesine `functionSignature` alanı eklendi | +| 0.0.3 | Ethereum Call nesnesine `from` alanı eklendi
`ethereum.call.address`, `ethereum.call.to` olarak yeniden adlandırıldı | +| 0.0.2 | Ethereum Transaction nesnesine `input` alanı eklendi | ### Dahili Türler @@ -241,15 +241,15 @@ export function handleTransfer(event: TransferEvent): void { // İşlem hash'ını olay kimliği olarak kullanarak bir Transfer varlığı oluşturun let id = event.transaction.hash let transfer = new Transfer(id) - + // Olay parametrelerini kullanarak varlığın özelliklerini ayarlayın transfer.from = event.params.from transfer.to = event.params.to transfer.amount = event.params.amount - + // Varlığı depoya kaydedin transfer.save() -} + } ``` Zincir işlenirken bir `Transfer` olayıyla karşılaşıldığında, oluşturulan `Transfer` türü (burada varlık türüyle adlandırma çakışmasını önlemek için `TransferEvent` olarak adlandırılmıştır) kullanılarak `handleTransfer` olay işleyicisine aktarılır. Bu tür, olayın ana işlemi ve parametreleri gibi verilere erişim sağlar. @@ -276,7 +276,7 @@ Varlık henüz depoda mevcut olmayabileceğinden, `load` yöntemi `Transfer | nu > Not: Varlıkları yüklemek, yalnızca, eşlemede yapılan değişikliklerin bir varlığın önceki verilerine bağlı olması durumunda gereklidir. Mevcut varlıkları güncellemenin iki yolunu görmek için bir sonraki bölüme bakın. -#### Bir blok içinde oluşturulan varlıkları arama +#### Looking up entities created within a block `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 ve `@graphprotocol/graph-cli` v0.49.0 itibarıyla `loadInBlock` metodu tüm varlık türlerinde kullanılabilir hale gelmiştir. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -Burada `Transfer`, varlık türüyle adlandırma çakışmasını önlemek için `TransferEvent` olarak yeniden adlandırılmıştır +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. Ethereum üzerindeki `ERC20Contract` sözleşmesi `symbol` adında herkese açık ve salt okunur bir fonksiyona sahip olduğu sürece, `.symbol()` ile çağrılabilir. Genel durum değişkenleri için otomatik olarak aynı ada sahip bir metot oluşturulur. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Geri Dönen Çağrıları Yönetme @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -771,44 +791,45 @@ Bir değerin türü kesin olduğunda, aşağıdaki yöntemlerden biri kullanıla ### Tip Dönüşümleri Referansı -| Kaynak(lar) | Hedef | Dönüşüm fonksiyonu | -| ----------------- | ----------------- | ---------------------------- | -| Address | Bytes | yok | -| Address | String | s.toHexString() | -| BigDecimal | String | s.toString() | -| BigInt | BigDecimal | s.toBigDecimal() | -| BigInt | Dizgi (onaltılık) | s.toHexString() or s.toHex() | -| BigInt | String (unicode) | s.toString() | -| BigInt | i32 | s.toI32() | -| Boolean | Boolean | yok | -| Bytes (işaretli) | BigInt | BigInt.fromSignedBytes(s) | -| Bytes (işaretsiz) | BigInt | BigInt.fromUnsignedBytes(s) | -| Bytes | Dizgi (onaltılık) | s.toHexString() or s.toHex() | -| Bytes | String (unicode) | s.toString() | -| Bytes | String (base58) | s.toBase58() | -| Bytes | i32 | s.toI32() | -| Bytes | u32 | s.toU32() | -| Bytes | JSON | json.fromBytes(s) | -| int8 | i32 | yok | -| int32 | i32 | yok | -| int32 | BigInt | BigInt.fromI32(s) | -| uint24 | i32 | yok | -| int64 - int256 | BigInt | yok | -| uint32 - uint256 | BigInt | yok | -| JSON | boolean | s.toBool() | -| JSON | i64 | s.toI64() | -| JSON | u64 | s.toU64() | -| JSON | f64 | s.toF64() | -| JSON | BigInt | s.toBigInt() | -| JSON | string | s.toString() | -| JSON | Array | s.toArray() | -| JSON | Object | s.toObject() | -| String | Address | Address.fromString(s) | -| Bytes | Address | Address.fromBytes(s) | -| String | BigInt | BigInt.fromString(s) | -| String | BigDecimal | BigDecimal.fromString(s) | -| Dizgi (onaltılık) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| Kaynak(lar) | Hedef | Dönüşüm fonksiyonu | +| ---------------------- | -------------------- | ---------------------------- | +| Address | Bytes | yok | +| Address | String | s.toHexString() | +| BigDecimal | String | s.toString() | +| BigInt | BigDecimal | s.toBigDecimal() | +| BigInt | Dizgi (onaltılık) | s.toHexString() or s.toHex() | +| BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | +| BigInt | i32 | s.toI32() | +| Boolean | Boolean | yok | +| Bytes (işaretli) | BigInt | BigInt.fromSignedBytes(s) | +| Bytes (işaretsiz) | BigInt | BigInt.fromUnsignedBytes(s) | +| Bytes | Dizgi (onaltılık) | s.toHexString() or s.toHex() | +| Bytes | String (unicode) | s.toString() | +| Bytes | String (base58) | s.toBase58() | +| Bytes | i32 | s.toI32() | +| Bytes | u32 | s.toU32() | +| Bytes | JSON | json.fromBytes(s) | +| int8 | i32 | yok | +| int32 | i32 | yok | +| int32 | BigInt | BigInt.fromI32(s) | +| uint24 | i32 | yok | +| int64 - int256 | BigInt | yok | +| uint32 - uint256 | BigInt | yok | +| JSON | boolean | s.toBool() | +| JSON | i64 | s.toI64() | +| JSON | u64 | s.toU64() | +| JSON | f64 | s.toF64() | +| JSON | BigInt | s.toBigInt() | +| JSON | string | s.toString() | +| JSON | Array | s.toArray() | +| JSON | Object | s.toObject() | +| String | Address | Address.fromString(s) | +| Bytes | Address | Address.fromBytes(s) | +| String | BigInt | BigInt.fromString(s) | +| String | BigDecimal | BigDecimal.fromString(s) | +| Dizgi (onaltılık) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Veri Kaynağı Meta Verileri diff --git a/website/src/pages/tr/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/tr/subgraphs/developing/creating/install-the-cli.mdx index 08c282f651d6..3f771a4f1a19 100644 --- a/website/src/pages/tr/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/tr/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - Bu komut, sözleşme ABI'sini Etherscan’den almaya çalışır. - - Graph CLI, bir umumi RPC uç noktasına bağlıdır. Ara sıra başarısızlık beklenebilir, ancak genellikle yeniden denemeler sorunu çözer. Sorunlar devam ederse, yerel bir ABI kullanmayı düşünün. - İsteğe bağlı argümanlar eksikse, komut sizi bir etkileşimli forma yönlendirir. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Ayrıntılar -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/tr/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/tr/subgraphs/developing/creating/ql-schema.mdx index 1d13ea1eba9f..b6d5d55c04e1 100644 --- a/website/src/pages/tr/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/tr/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two GraphQL API'sinde desteklenen skalarlardan bazıları şunlardır: -| Tür | Tanım | -| --- | --- | -| `Bytes` | Byte dizisi, onaltılık bir dizgi olarak temsil edilir. Ethereum hash değerleri ve adresleri için yaygın olarak kullanılır. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Tür | Tanım | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte dizisi, onaltılık bir dizgi olarak temsil edilir. Ethereum hash değerleri ve adresleri için yaygın olarak kullanılır. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Numaralandırmalar @@ -295,24 +295,24 @@ Farklı bir dil seçmek, tam metin arama API'sı üzerinde bazen az olsa da kesi Desteklenen dil sözlükleri: -| Code | Sözlük | -| ----- | ---------- | -| yalın | General | -| da | Danish | -| nl | Dutch | -| en | English | -| fi | Finnish | -| fr | French | -| de | German | -| hu | Hungarian | -| it | Italian | -| no | Norwegian | -| pt | Portekizce | -| ro | Romanian | -| ru | Russian | -| es | Spanish | -| sv | Swedish | -| tr | Turkish | +| Code | Sözlük | +| ------ | ---------- | +| yalın | General | +| da | Danish | +| nl | Dutch | +| en | English | +| fi | Finnish | +| fr | French | +| de | German | +| hu | Hungarian | +| it | Italian | +| no | Norwegian | +| pt | Portekizce | +| ro | Romanian | +| ru | Russian | +| es | Spanish | +| sv | Swedish | +| tr | Turkish | ### Algoritmaları Sıralama diff --git a/website/src/pages/tr/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/tr/subgraphs/developing/creating/starting-your-subgraph.mdx index bfa4920f6360..2c2d7767abb6 100644 --- a/website/src/pages/tr/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/tr/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Sürüm | Sürüm Notları | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | +| Sürüm | Sürüm Notları | +| :---: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | | 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | İşleyicilerin işlem makbuzlarına erişim desteği eklendi. | -| 0.0.4 | Subgraph özelliklerini yönetme desteği eklendi. | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | İşleyicilerin işlem makbuzlarına erişim desteği eklendi. | +| 0.0.4 | Subgraph özelliklerini yönetme desteği eklendi. | diff --git a/website/src/pages/tr/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/tr/subgraphs/developing/creating/subgraph-manifest.mdx index f6be12c03edb..f281cfbe75bc 100644 --- a/website/src/pages/tr/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/tr/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ Manifest için güncellenmesi gereken önemli girdiler şunlardır: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ Manifest için güncellenmesi gereken önemli girdiler şunlardır: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Çağrı işleyicileri yalnızca iki durumdan birinde tetiklenir: belirtilen işlevin sözleşme tarafından değil, başka bir hesap tarafından çağrılması durumunda veya Solidity'de harici olarak işaretlenip aynı sözleşmenin başka bir işlevinin bir parçası olarak çağrılması durumunda yalnızca tetiklenir. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Bir Çağrı İşleyici Tanımlama @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. Bir blok işleyicisi için filtre olmaması, işleyicinin her blok için çağrılacağı anlamına gelir. Bir veri kaynağı, her filtre türü için yalnızca bir blok işleyicisi içerebilir. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Başlangıç Blokları The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Sürüm | Sürüm Notları | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | +| Sürüm | Sürüm Notları | +| :---: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | | 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | İşleyicilerin işlem makbuzlarına erişim desteği eklendi. | -| 0.0.4 | Subgraph özelliklerini yönetme desteği eklendi. | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | İşleyicilerin işlem makbuzlarına erişim desteği eklendi. | +| 0.0.4 | Subgraph özelliklerini yönetme desteği eklendi. | diff --git a/website/src/pages/tr/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/tr/subgraphs/developing/creating/unit-testing-framework.mdx index 05268d06e3d3..c02828908a70 100644 --- a/website/src/pages/tr/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/tr/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ yada /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ Bu, test klasöründeki tüm testleri çalıştıracaktır: graph test ``` -Bu, gravity.test.ts adında bir testi ve/veya gravity adında bir klasördeki tüm testleri çalıştıracaktır: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Bir Birim Testi Yazın -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Aşağıdaki işleyici fonksiyonuna sahip olduğumuzu varsayarsak (iki yardımcı işlevle birlikte): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -Önce projemizde bir test dosyası oluşturmamız gerekiyor. Bunun nasıl görünebileceğine dair bir örnek: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - İlk durumumuzu ayarlıyor ve bir özel Gravatar varlığı ekliyoruz; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- Depo durumunu doğruluyoruz. Bu nasıl çalışır? - Bir varlık türü ve kimliğinin benzersiz bir kombinasyonunu geçiriyoruz. Ardından, bu varlıkta belirli bir alanı kontrol ediyoruz ve beklediğimiz değeri almasını sağlıyoruz. Hem depoya eklediğimiz ilk Gravatar Varlığı için hem de işleyici işlevi çağrıldığında eklenen iki Gravatar varlığı için bunu yapıyoruz; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. İşte başardın - ilk testimizi oluşturduk! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Olay üst verileriyle etkileşim @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Kritik hataları kayıt altına almak, testlerin yürütülmesini durduracak ve her şeyi mahvedecektir. Sonuçta, kodunuzun dağıtımda kritik kayıtları içermediğinden emin olmak istiyoruz ve bunun olması durumunda hemen fark etmeniz gerekiyor. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Türetilmiş alanların test edilmesi @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/tr/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/tr/subgraphs/developing/deploying/multiple-networks.mdx index d401f6ad16b2..9af6e4bb44d7 100644 --- a/website/src/pages/tr/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/tr/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/tr/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/tr/subgraphs/developing/deploying/using-subgraph-studio.mdx index a4e8ca41d951..caa7b1cc5a3f 100644 --- a/website/src/pages/tr/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/tr/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ Bu komutu çalıştırdıktan sonra CLI sizden bir sürüm etiketi isteyecektir. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Subgraph’inizi Yayımlama diff --git a/website/src/pages/tr/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/tr/subgraphs/developing/publishing/publishing-a-subgraph.mdx index e315eb8c74fb..04bc6abfcded 100644 --- a/website/src/pages/tr/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/tr/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -47,18 +47,18 @@ As of version 0.73.0, you can also publish your Subgraph with the [`graph-cli`]( You can upload your Subgraph build to a specific IPFS node and further customize your deployment with the following flags: ``` -KULLANIM +USAGE $ graph publish [SUBGRAPH-MANIFEST] [-h] [--protocol-network arbitrum-one|arbitrum-sepolia --subgraph-id ] [-i ] [--ipfs-hash ] [--webapp-url ] -BAYRAKLAR - -h, --help CLI yardımını gösterir. - -i, --ipfs= [varsayılan: https://api.thegraph.com/ipfs/api/v0] Derleme sonuçlarını bir IPFS düğümüne yükler. - --ipfs-hash= Dağıtılacak subgraph manifestosunun IPFS hash değeri. - --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> This is new functionality, which will be available in Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/uk/resources/benefits.mdx b/website/src/pages/uk/resources/benefits.mdx index e7643ee0d7cf..4b7b9b84745d 100644 --- a/website/src/pages/uk/resources/benefits.mdx +++ b/website/src/pages/uk/resources/benefits.mdx @@ -21,53 +21,53 @@ Here is an analysis: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Порівняння вартості послуг | Самостійний хостинг | Graph мережа | -| :-: | :-: | :-: | -| Щомісячна плата за сервер\* | $350 на місяць | $0 | -| Вартість запитів | $0+ | $0 per month | -| Час технічного обслуговування | $400 на місяць | Немає, вбудовані в мережу з глобально розподіленими індексаторами | -| Кількість запитів за місяць | Обмежується інфраструктурними можливостями | 100,000 (Free Plan) | -| Вартість одного запиту | $0 | $0 | -| Infrastructure | Централізована | Децентралізована | -| Географічне резервування | $750+ за кожну додаткову ноду | Включено | -| Час безвідмовної роботи | Варіюється | 99.9%+ | -| Загальна сума щомісячних витрат | $750+ | $0 | +| Порівняння вартості послуг | Самостійний хостинг | Graph мережа | +| :---------------------------------------: | :----------------------------------------: | :---------------------------------------------------------------: | +| Щомісячна плата за сервер\* | $350 на місяць | $0 | +| Вартість запитів | $0+ | $0 per month | +| Час технічного обслуговування | $400 на місяць | Немає, вбудовані в мережу з глобально розподіленими індексаторами | +| Кількість запитів за місяць | Обмежується інфраструктурними можливостями | 100,000 (Free Plan) | +| Вартість одного запиту | $0 | $0 | +| Infrastructure | Централізована | Децентралізована | +| Географічне резервування | $750+ за кожну додаткову ноду | Включено | +| Час безвідмовної роботи | Варіюється | 99.9%+ | +| Загальна сума щомісячних витрат | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Порівняння вартості послуг | Самостійний хостинг | Graph мережа | -| :-: | :-: | :-: | -| Щомісячна плата за сервер\* | $350 на місяць | $0 | -| Вартість запитів | $500 на місяць | $120 per month | -| Час технічного обслуговування | $800 на місяць | Немає, вбудовані в мережу з глобально розподіленими індексаторами | -| Кількість запитів за місяць | Обмежується інфраструктурними можливостями | ~3,000,000 | -| Вартість одного запиту | $0 | $0.00004 | -| Infrastructure | Централізована | Децентралізована | -| Інженерно-технічні витрати | $200 на годину | Включено | -| Географічне резервування | $1,200 загальних витрат на кожну додаткову ноду | Включено | -| Час безвідмовної роботи | Варіюється | 99.9%+ | -| Загальна сума щомісячних витрат | $1,650+ | $120 | +| Порівняння вартості послуг | Самостійний хостинг | Graph мережа | +| :---------------------------------------: | :---------------------------------------------: | :---------------------------------------------------------------: | +| Щомісячна плата за сервер\* | $350 на місяць | $0 | +| Вартість запитів | $500 на місяць | $120 per month | +| Час технічного обслуговування | $800 на місяць | Немає, вбудовані в мережу з глобально розподіленими індексаторами | +| Кількість запитів за місяць | Обмежується інфраструктурними можливостями | ~3,000,000 | +| Вартість одного запиту | $0 | $0.00002 | +| Infrastructure | Централізована | Децентралізована | +| Інженерно-технічні витрати | $200 на годину | Включено | +| Географічне резервування | $1,200 загальних витрат на кожну додаткову ноду | Включено | +| Час безвідмовної роботи | Варіюється | 99.9%+ | +| Загальна сума щомісячних витрат | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Порівняння вартості послуг | Самостійний хостинг | Graph мережа | -| :-: | :-: | :-: | -| Щомісячна плата за сервер\* | $1100 на місяць, за одну ноду | $0 | -| Вартість запитів | $4000 | $1,200 per month | -| Кількість необхідних нод | 10 | Не стосується | -| Час технічного обслуговування | $6,000 і більше на місяць | Немає, вбудовані в мережу з глобально розподіленими індексаторами | -| Кількість запитів за місяць | Обмежується інфраструктурними можливостями | ~30,000,000 | -| Вартість одного запиту | $0 | $0.00004 | -| Infrastructure | Централізована | Децентралізована | -| Географічне резервування | $1,200 загальних витрат на кожну додаткову ноду | Включено | -| Час безвідмовної роботи | Варіюється | 99.9%+ | -| Загальна сума щомісячних витрат | $11,000+ | $1,200 | +| Порівняння вартості послуг | Самостійний хостинг | Graph мережа | +| :---------------------------------------: | :---------------------------------------------: | :---------------------------------------------------------------: | +| Щомісячна плата за сервер\* | $1100 на місяць, за одну ноду | $0 | +| Вартість запитів | $4000 | $1,200 per month | +| Кількість необхідних нод | 10 | Не стосується | +| Час технічного обслуговування | $6,000 і більше на місяць | Немає, вбудовані в мережу з глобально розподіленими індексаторами | +| Кількість запитів за місяць | Обмежується інфраструктурними можливостями | ~30,000,000 | +| Вартість одного запиту | $0 | $0.00002 | +| Infrastructure | Централізована | Децентралізована | +| Географічне резервування | $1,200 загальних витрат на кожну додаткову ноду | Включено | +| Час безвідмовної роботи | Варіюється | 99.9%+ | +| Загальна сума щомісячних витрат | $11,000+ | $1,200 | \*включаючи витрати на резервне копіювання: $50-$100 на місяць diff --git a/website/src/pages/uk/resources/claude-mcp.mdx b/website/src/pages/uk/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/uk/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/uk/subgraphs/developing/creating/advanced.mdx b/website/src/pages/uk/subgraphs/developing/creating/advanced.mdx index 0a60a469c86a..6e6705d26478 100644 --- a/website/src/pages/uk/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/uk/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Overview -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/uk/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/uk/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/uk/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/uk/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/uk/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/uk/subgraphs/developing/creating/graph-ts/api.mdx index 5be2530c4d6b..b7c9a1a4ecbe 100644 --- a/website/src/pages/uk/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/uk/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Version | Release notes | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Version | Release notes | +| :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Built-in Types @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Looking up entities created withing a block +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Handling Reverted Calls @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Data Source Metadata diff --git a/website/src/pages/uk/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/uk/subgraphs/developing/creating/install-the-cli.mdx index cac462d8e960..f4aeefe6e278 100644 --- a/website/src/pages/uk/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/uk/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/uk/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/uk/subgraphs/developing/creating/ql-schema.mdx index 7e0f889447c5..ae80ab827544 100644 --- a/website/src/pages/uk/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/uk/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Null value resolved for non-null field 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Type | Description | -| --- | --- | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Type | Description | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums diff --git a/website/src/pages/uk/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/uk/subgraphs/developing/creating/starting-your-subgraph.mdx index 180a343470b1..4931e6b1fd34 100644 --- a/website/src/pages/uk/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/uk/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Version | Release notes | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/uk/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/uk/subgraphs/developing/creating/subgraph-manifest.mdx index 78e4a3a55e7d..2c4bc1e9b1b5 100644 --- a/website/src/pages/uk/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/uk/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ The important entries to update for the manifest are: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ The important entries to update for the manifest are: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Call handlers will only trigger in one of two cases: when the function specified is called by an account other than the contract itself or when it is marked as external in Solidity and called as part of another function in the same contract. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Defining a Call Handler @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. The absence of a filter for a block handler will ensure that the handler is called every block. A data source can only contain one block handler for each filter type. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Start Blocks The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Version | Release notes | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Version | Release notes | +| :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/uk/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/uk/subgraphs/developing/creating/unit-testing-framework.mdx index 0437eaabff1e..a6fb1059ecf4 100644 --- a/website/src/pages/uk/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/uk/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ or /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ This will run all tests in the test folder: graph test ``` -This will run a test named gravity.test.ts and/or all test inside of a folder named gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Write a Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Assuming we have the following handler function (along with two helper functions to make our life easier): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. This is an example of how that might look like: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - We're setting up our initial state and adding one custom Gravatar entity; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that gets added when the handler function is called; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. There we go - we've created our first test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interacting with Event metadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure you're code doesn't have critical logs in deployment, and you should notice right away if that were to happen. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing derived fields @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/uk/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/uk/subgraphs/developing/deploying/multiple-networks.mdx index 3b2b1bbc70ae..5c8016b18c91 100644 --- a/website/src/pages/uk/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/uk/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/uk/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/uk/subgraphs/developing/deploying/using-subgraph-studio.mdx index 2b4c1c11efa0..a3ebd8c532fc 100644 --- a/website/src/pages/uk/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/uk/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/uk/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/uk/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 2bc0ec5f514c..e3e3a7e3d455 100644 --- a/website/src/pages/uk/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/uk/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> یہ نئی فعالیت ہے، جو گراف نوڈ 0.29.x میں دستیاب ہوگی - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/ur/resources/benefits.mdx b/website/src/pages/ur/resources/benefits.mdx index 35137ff0d524..5a6f83b49409 100644 --- a/website/src/pages/ur/resources/benefits.mdx +++ b/website/src/pages/ur/resources/benefits.mdx @@ -21,53 +21,53 @@ The benefits of this decentralized protocol cannot be replicated by running a `g ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| اخراجات کا موازنہ | خود میزبان | The Graph Network | -| :-: | :-: | :-: | -| ماہانہ سرور کی قیمت/\* | $350 فی مہینہ | $0 | -| استفسار کے اخراجات | $0+ | $0 per month | -| انجینئرنگ کا وقت | $400 فی مہینہ | کوئی بھی نہیں، عالمی سطح پر تقسیم شدہ انڈیکسرز کے ساتھ نیٹ ورک میں بنایا گیا ہے | -| فی مہینہ سوالات | بنیادی صلاحیتوں تک محدود | 100,000 (Free Plan) | -| قیمت فی سوال | $0 | $0 | -| Infrastructure | سینٹرلائزڈ | ڈیسینٹرلائزڈ | -| جغرافیائی فالتو پن | $750+ فی اضافی نوڈ | شامل | -| اپ ٹائم | اتار چڑھاو | 99.9%+ | -| کل ماہانہ اخراجات | $750+ | $0 | +| اخراجات کا موازنہ | خود میزبان | The Graph Network | +| :--------------------------: | :-------------------------------------: | :-----------------------------------------------------------------------------: | +| ماہانہ سرور کی قیمت/\* | $350 فی مہینہ | $0 | +| استفسار کے اخراجات | $0+ | $0 per month | +| انجینئرنگ کا وقت | $400 فی مہینہ | کوئی بھی نہیں، عالمی سطح پر تقسیم شدہ انڈیکسرز کے ساتھ نیٹ ورک میں بنایا گیا ہے | +| فی مہینہ سوالات | بنیادی صلاحیتوں تک محدود | 100,000 (Free Plan) | +| قیمت فی سوال | $0 | $0 | +| Infrastructure | سینٹرلائزڈ | ڈیسینٹرلائزڈ | +| جغرافیائی فالتو پن | $750+ فی اضافی نوڈ | شامل | +| اپ ٹائم | اتار چڑھاو | 99.9%+ | +| کل ماہانہ اخراجات | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| اخراجات کا موازنہ | خود میزبان | The Graph Network | -| :-: | :-: | :-: | -| ماہانہ سرور کی قیمت/\* | $350 فی مہینہ | $0 | -| استفسار کے اخراجات | $500 فی مہینہ | $120 per month | -| انجینئرنگ کا وقت | $800 فی مہینہ | کوئی بھی نہیں، عالمی سطح پر تقسیم شدہ انڈیکسرز کے ساتھ نیٹ ورک میں بنایا گیا ہے | -| فی مہینہ سوالات | بنیادی صلاحیتوں تک محدود | ~3,000,000 | -| قیمت فی سوال | $0 | $0.00004 | -| Infrastructure | سینٹرلائزڈ | ڈیسینٹرلائزڈ | -| انجینئرنگ کے اخراجات | $200 فی گھنٹہ | شامل | -| جغرافیائی فالتو پن | فی اضافی نوڈ کل اخراجات میں $1,200 | شامل | -| اپ ٹائم | اتار چڑھاو | 99.9%+ | -| کل ماہانہ اخراجات | $1,650+ | $120 | +| اخراجات کا موازنہ | خود میزبان | The Graph Network | +| :--------------------------: | :----------------------------------------: | :-----------------------------------------------------------------------------: | +| ماہانہ سرور کی قیمت/\* | $350 فی مہینہ | $0 | +| استفسار کے اخراجات | $500 فی مہینہ | $120 per month | +| انجینئرنگ کا وقت | $800 فی مہینہ | کوئی بھی نہیں، عالمی سطح پر تقسیم شدہ انڈیکسرز کے ساتھ نیٹ ورک میں بنایا گیا ہے | +| فی مہینہ سوالات | بنیادی صلاحیتوں تک محدود | ~3,000,000 | +| قیمت فی سوال | $0 | $0.00002 | +| Infrastructure | سینٹرلائزڈ | ڈیسینٹرلائزڈ | +| انجینئرنگ کے اخراجات | $200 فی گھنٹہ | شامل | +| جغرافیائی فالتو پن | فی اضافی نوڈ کل اخراجات میں $1,200 | شامل | +| اپ ٹائم | اتار چڑھاو | 99.9%+ | +| کل ماہانہ اخراجات | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| اخراجات کا موازنہ | خود میزبان | The Graph Network | -| :-: | :-: | :-: | -| ماہانہ سرور کی قیمت/\* | $1100 فی مہینہ، فی نوڈ | $0 | -| استفسار کے اخراجات | $4000 | $1,200 per month | -| نوڈس کی تعداد درکار ہے | 10 | قابل اطلاق نہیں | -| انجینئرنگ کا وقت | $6,000 یا اس سے زیادہ فی مہینہ | کوئی بھی نہیں، عالمی سطح پر تقسیم شدہ انڈیکسرز کے ساتھ نیٹ ورک میں بنایا گیا ہے | -| فی مہینہ سوالات | بنیادی صلاحیتوں تک محدود | ~30,000,000 | -| قیمت فی سوال | $0 | $0.00004 | -| Infrastructure | سینٹرلائزڈ | ڈیسینٹرلائزڈ | -| جغرافیائی فالتو پن | فی اضافی نوڈ کل اخراجات میں $1,200 | شامل | -| اپ ٹائم | اتار چڑھاو | 99.9%+ | -| کل ماہانہ اخراجات | $11,000+ | $1,200 | +| اخراجات کا موازنہ | خود میزبان | The Graph Network | +| :--------------------------: | :-----------------------------------------: | :-----------------------------------------------------------------------------: | +| ماہانہ سرور کی قیمت/\* | $1100 فی مہینہ، فی نوڈ | $0 | +| استفسار کے اخراجات | $4000 | $1,200 per month | +| نوڈس کی تعداد درکار ہے | 10 | قابل اطلاق نہیں | +| انجینئرنگ کا وقت | $6,000 یا اس سے زیادہ فی مہینہ | کوئی بھی نہیں، عالمی سطح پر تقسیم شدہ انڈیکسرز کے ساتھ نیٹ ورک میں بنایا گیا ہے | +| فی مہینہ سوالات | بنیادی صلاحیتوں تک محدود | ~30,000,000 | +| قیمت فی سوال | $0 | $0.00002 | +| Infrastructure | سینٹرلائزڈ | ڈیسینٹرلائزڈ | +| جغرافیائی فالتو پن | فی اضافی نوڈ کل اخراجات میں $1,200 | شامل | +| اپ ٹائم | اتار چڑھاو | 99.9%+ | +| کل ماہانہ اخراجات | $11,000+ | $1,200 | /\*بیک اپ کے اخراجات سمیت: $50-$100 فی مہینہ diff --git a/website/src/pages/ur/resources/claude-mcp.mdx b/website/src/pages/ur/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/ur/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/ur/subgraphs/developing/creating/advanced.mdx b/website/src/pages/ur/subgraphs/developing/creating/advanced.mdx index 2870853839df..8cb83fe33568 100644 --- a/website/src/pages/ur/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/ur/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## جائزہ -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/ur/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/ur/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/ur/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/ur/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/ur/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/ur/subgraphs/developing/creating/graph-ts/api.mdx index d936e38aa363..4b88cebe0bfc 100644 --- a/website/src/pages/ur/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/ur/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| ورزن | جاری کردہ نوٹس | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| ورزن | جاری کردہ نوٹس | +| :---: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | | 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### بلٹ ان اقسام @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### بلاک کے ساتھ تخلیق کردہ ہستیوں کو تلاش کرنا +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### واپس آنے والی کالوں کو ہینڈل کرنا @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### ڈیٹا ماخذ میٹا ڈیٹا diff --git a/website/src/pages/ur/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/ur/subgraphs/developing/creating/install-the-cli.mdx index fc2b95935dc4..6781f728204a 100644 --- a/website/src/pages/ur/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/ur/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/ur/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/ur/subgraphs/developing/creating/ql-schema.mdx index 71165595a765..dc9da808f1f9 100644 --- a/website/src/pages/ur/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/ur/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica غیر صفر فیلڈ 'name' کے لیے خالی ویلیو حل ہو گئی ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| قسم | تفصیل | -| --- | --- | -| `Bytes` | Byte array، ایک ہیکساڈیسیمل سٹرنگ کے طور پر پیش کیا جاتا ہے. عام طور پر Ethereum hashes اور ایڈریسیس کے لیے استعمال ہوتا ہے. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| قسم | تفصیل | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array، ایک ہیکساڈیسیمل سٹرنگ کے طور پر پیش کیا جاتا ہے. عام طور پر Ethereum hashes اور ایڈریسیس کے لیے استعمال ہوتا ہے. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums @@ -318,7 +318,7 @@ query { نتائج ترتیب دینے کے لیے معاون الگورتھم: -| Algorithm | Description | -| ------------ | --------------------------------------------------------------------------- | -| rank | نتائج ترتیب دینے کے لیے فل ٹیکسٹ کیوری کے میچ کوالٹی (1-0) کا استعمال کریں. | -| قربت کا درجہ | Similar to rank but also includes the proximity of the matches. | +| Algorithm | Description | +| ------------- | --------------------------------------------------------------------------- | +| rank | نتائج ترتیب دینے کے لیے فل ٹیکسٹ کیوری کے میچ کوالٹی (1-0) کا استعمال کریں. | +| قربت کا درجہ | Similar to rank but also includes the proximity of the matches. | diff --git a/website/src/pages/ur/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/ur/subgraphs/developing/creating/starting-your-subgraph.mdx index ec107baa126f..6361010625cb 100644 --- a/website/src/pages/ur/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/ur/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| ورزن | جاری کردہ نوٹس | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | +| ورزن | جاری کردہ نوٹس | +| :---: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | | 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ur/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/ur/subgraphs/developing/creating/subgraph-manifest.mdx index b87cc57c42ce..72b9769a9198 100644 --- a/website/src/pages/ur/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/ur/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ dataSources: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ dataSources: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o کال ہینڈلرز صرف دو صورتوں میں سے ایک میں ٹرگر کریں گے: جب مخصوص کردہ فنکشن کو کنٹریکٹ کے علاوہ کسی دوسرے اکاؤنٹ سے کال جاتا ہے یا جب اسے سولیڈیٹی میں بیرونی کے طور پر نشان زد کیا جاتا ہے اور اسی کنٹریکٹ میں کسی دوسرے فنکشن کے حصے کے طور پر کال کیا جاتا ہے. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### کال ہینڈلر کی تعریف @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. بلاک ہینڈلر کے لیے فلٹر کی عدم موجودگی اس بات کو یقینی بنائے گی کہ ہینڈلر کو ہر بلاک کے لیے کال کیا جاتا ہے. ڈیٹا سورس میں ہر فلٹر کی قسم کے لیے صرف ایک بلاک ہینڈلر ہو سکتا ہے. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## بلاکس شروع کریں The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| ورزن | جاری کردہ نوٹس | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | +| ورزن | جاری کردہ نوٹس | +| :---: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | | 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/ur/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/ur/subgraphs/developing/creating/unit-testing-framework.mdx index 891fc27e2cf7..6a6bceb0b592 100644 --- a/website/src/pages/ur/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/ur/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ static BYTES = Symbol("Bytes") SyntaxError: Unexpected token = /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ To use **Matchstick** in your Subgraph project just open up a terminal, navigate graph test ``` -یہ gravity.test.ts نامی ٹیسٹ اور/یا کشش ثقل نامی فولڈر کے اندر تمام ٹیسٹ چلائے گا: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## یونٹ ٹیسٹ لکھیں -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). یہ فرض کرتے ہوئے کہ ہمارے پاس مندرجہ ذیل ہینڈلر فنکشن ہے (ہماری زندگی کو آسان بنانے کے لیے دو مددگار افعال کے ساتھ): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -ہمیں پہلے اپنے پروجیکٹ میں ایک ٹیسٹ فائل بنانا ہوگی۔ یہ اس کی ایک مثال ہے کہ یہ کس طرح نظر آسکتا ہے: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - ہم اپنی ابتدائی حالت قائم کر رہے ہیں اور ایک حسب ضرورت Gravatar ہستی شامل کر رہے ہیں; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- ہم اسٹور کی حالت پر زور دیتے ہیں۔ یہ کیسے کام کرتا ہے؟ - ہم ہستی کی قسم اور آئی ڈی کا ایک انوکھا امتزاج پاس کر رہے ہیں۔ پھر ہم اس ہستی پر ایک مخصوص فیلڈ کو چیک کرتے ہیں اور اس بات پر زور دیتے ہیں کہ اس کی وہ قدر ہے جس کی ہم اس سے توقع رکھتے ہیں۔ ہم یہ دونوں ابتدائی Gravatar ہستی کے لیے کر رہے ہیں جسے ہم نے سٹور میں شامل کیا ہے، اور ساتھ ہی وہ دو Gravatar اداروں کے لیے جو ہینڈلر فنکشن کو کال کرنے پر شامل ہو جاتی ہیں; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. ہم وہاں جاتے ہیں - ہم نے اپنا پہلا ٹیسٹ بنایا ہے! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### ایونٹ میٹا ڈیٹا کے ساتھ تعامل کرنا @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -اہم غلطیوں کو لاگ کرنا ٹیسٹوں پر عمل درآمد روک دے گا اور سب کچھ اڑا دے گا۔ آخر کار - ہم یہ یقینی بنانا چاہتے ہیں کہ آپ کے کوڈ میں تعیناتی میں اہم لاگز نہیں ہیں، اور اگر ایسا ہونا تھا تو آپ کو فوراً نوٹس لینا چاہیے. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### ماخوذ فیلڈز کی جانچ کرنا @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/ur/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/ur/subgraphs/developing/deploying/multiple-networks.mdx index 018d2eb471e7..08562fb93c31 100644 --- a/website/src/pages/ur/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/ur/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/ur/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/ur/subgraphs/developing/deploying/using-subgraph-studio.mdx index f41499fd9c51..741771522fd9 100644 --- a/website/src/pages/ur/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/ur/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/ur/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/ur/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 0029f0a41559..6a8e4d17a9ff 100644 --- a/website/src/pages/ur/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/ur/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
` will perform a full count of the table - that can be slow, but gives a precise measure of the ratio of distinct entities to overall entity versions. @@ -340,6 +345,4 @@ For Uniswap-like Subgraphs, the `pair` and `token` tables are prime candidates f #### Removing Subgraphs -> This is new functionality, which will be available in Graph Node 0.29.x - At some point an indexer might want to remove a given Subgraph. This can be easily done via `graphman drop`, which deletes a deployment and all it's indexed data. The deployment can be specified as either a Subgraph name, an IPFS hash `Qm..`, or the database namespace `sgdNNN`. Further documentation is available [here](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop). diff --git a/website/src/pages/vi/resources/benefits.mdx b/website/src/pages/vi/resources/benefits.mdx index 6e22015b8fdb..7794822f5124 100644 --- a/website/src/pages/vi/resources/benefits.mdx +++ b/website/src/pages/vi/resources/benefits.mdx @@ -21,53 +21,53 @@ Here is an analysis: ### Lower & more Flexible Cost Structure -No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $40 per million queries (~$0.00004 per query). Queries are priced in USD and paid in GRT or credit card. +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. Query costs may vary; the quoted cost is the average at time of publication (March 2024). ## Low Volume User (less than 100,000 queries per month) -| Cost Comparison | Self Hosted | Mạng The Graph | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $0+ | $0 per month | -| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | -| Cost per query | $0 | $0 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $750+ per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $750+ | $0 | +| Cost Comparison | Self Hosted | Mạng The Graph | +| :--------------------------: | :-------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $0+ | $0 per month | +| Engineering time | $400 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | 100,000 (Free Plan) | +| Cost per query | $0 | $0 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $750+ per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $750+ | $0 | ## Medium Volume User (~3M queries per month) -| Cost Comparison | Self Hosted | Mạng The Graph | -| :-: | :-: | :-: | -| Monthly server cost\* | $350 per month | $0 | -| Query costs | $500 per month | $120 per month | -| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~3,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Engineering expense | $200 per hour | Included | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $1,650+ | $120 | +| Cost Comparison | Self Hosted | Mạng The Graph | +| :--------------------------: | :----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $350 per month | $0 | +| Query costs | $500 per month | $120 per month | +| Engineering time | $800 per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~3,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Engineering expense | $200 per hour | Included | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $1,650+ | $120 | ## High Volume User (~30M queries per month) -| Cost Comparison | Self Hosted | Mạng The Graph | -| :-: | :-: | :-: | -| Monthly server cost\* | $1100 per month, per node | $0 | -| Query costs | $4000 | $1,200 per month | -| Number of nodes needed | 10 | Not applicable | -| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | -| Queries per month | Limited to infra capabilities | ~30,000,000 | -| Cost per query | $0 | $0.00004 | -| Infrastructure | Centralized | Decentralized | -| Geographic redundancy | $1,200 in total costs per additional node | Included | -| Uptime | Varies | 99.9%+ | -| Total Monthly Costs | $11,000+ | $1,200 | +| Cost Comparison | Self Hosted | Mạng The Graph | +| :--------------------------: | :-----------------------------------------: | :-------------------------------------------------------------: | +| Monthly server cost\* | $1100 per month, per node | $0 | +| Query costs | $4000 | $1,200 per month | +| Number of nodes needed | 10 | Not applicable | +| Engineering time | $6,000 or more per month | None, built into the network with globally distributed Indexers | +| Queries per month | Limited to infra capabilities | ~30,000,000 | +| Cost per query | $0 | $0.00002 | +| Infrastructure | Centralized | Decentralized | +| Geographic redundancy | $1,200 in total costs per additional node | Included | +| Uptime | Varies | 99.9%+ | +| Total Monthly Costs | $11,000+ | $1,200 | \*including costs for backup: $50-$100 per month diff --git a/website/src/pages/vi/resources/claude-mcp.mdx b/website/src/pages/vi/resources/claude-mcp.mdx new file mode 100644 index 000000000000..44ed075cffda --- /dev/null +++ b/website/src/pages/vi/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## Troubleshooting + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/vi/subgraphs/developing/creating/advanced.mdx b/website/src/pages/vi/subgraphs/developing/creating/advanced.mdx index 15e48ee9a6a8..45e643fd9f7c 100644 --- a/website/src/pages/vi/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/vi/subgraphs/developing/creating/advanced.mdx @@ -4,7 +4,7 @@ title: Advanced Subgraph Features ## Tổng quan -Add and implement advanced Subgraph features to enhanced your Subgraph's built. +Add and implement advanced Subgraph features to enhance your Subgraph's build. Starting from `specVersion` `0.0.4`, Subgraph features must be explicitly declared in the `features` section at the top level of the manifest file, using their `camelCase` name, as listed in the table below: @@ -456,8 +456,6 @@ In this configuration: ## Declared eth_call -> Note: This is an experimental feature that is not currently available in a stable Graph Node release yet. You can only use it in Subgraph Studio or your self-hosted node. - Declarative `eth_calls` are a valuable Subgraph feature that allows `eth_calls` to be executed ahead of time, enabling `graph-node` to execute them in parallel. This feature does the following: diff --git a/website/src/pages/vi/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/vi/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 5f964d3cbb78..edc1d88dc6cf 100644 --- a/website/src/pages/vi/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/vi/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### Patch Changes + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### Minor Changes diff --git a/website/src/pages/vi/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/vi/subgraphs/developing/creating/graph-ts/api.mdx index bb95b05932cc..71c98aa8ae9e 100644 --- a/website/src/pages/vi/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/vi/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ The `@graphprotocol/graph-ts` library provides the following APIs: The `apiVersion` in the Subgraph manifest specifies the mapping API version which is run by Graph Node for a given Subgraph. -| Phiên bản | Ghi chú phát hành | -| :-: | --- | -| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | -| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | -| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | -| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | -| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | -| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Phiên bản | Ghi chú phát hành | +| :-------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | Adds new host functions [`eth_get_balance`](#balance-of-an-address) & [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | Adds validation for existence of fields in the schema when saving an entity. | +| 0.0.7 | Added `TransactionReceipt` and `Log` classes to the Ethereum types
Added `receipt` field to the Ethereum Event object | +| 0.0.6 | Added `nonce` field to the Ethereum Transaction object
Added `baseFeePerGas` to the Ethereum Block object | +| 0.0.5 | AssemblyScript upgraded to version 0.19.10 (this includes breaking changes, please see the [`Migration Guide`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed` renamed to `ethereum.transaction.gasLimit` | +| 0.0.4 | Added `functionSignature` field to the Ethereum SmartContractCall object | +| 0.0.3 | Added `from` field to the Ethereum Call object
`ethereum.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Các loại cài sẵn @@ -276,7 +276,7 @@ As the entity may not exist in the store yet, the `load` method returns a value > Note: Loading entities is only necessary if the changes made in the mapping depend on the previous data of an entity. See the next section for the two ways of updating existing entities. -#### Looking up entities created withing a block +#### Looking up entities created within a block As of `graph-node` v0.31.0, `@graphprotocol/graph-ts` v0.30.0 and `@graphprotocol/graph-cli` v0.49.0 the `loadInBlock` method is available on all entity types. @@ -502,11 +502,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. As long as the `ERC20Contract` on Ethereum has a public read-only function called `symbol`, it can be called with `.symbol()`. For public state variables a method with the same name is created automatically. -Any other contract that is part of the Subgraph can be imported from the generated code and can be bound to a valid address. +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### Xử lý các lệnh gọi được hoàn nguyên @@ -666,6 +684,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -778,6 +798,7 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | BigInt | BigDecimal | s.toBigDecimal() | | BigInt | String (hexadecimal) | s.toHexString() or s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | @@ -806,8 +827,8 @@ When the type of a value is certain, it can be converted to a [built-in type](#b | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### Siêu Dữ liệu Nguồn Dữ liệu diff --git a/website/src/pages/vi/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/vi/subgraphs/developing/creating/install-the-cli.mdx index f9573b198f89..3fb73677fefb 100644 --- a/website/src/pages/vi/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/vi/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - The command tries to retrieve the contract ABI from Etherscan. - - The Graph CLI relies on a public RPC endpoint. While occasional failures are expected, retries typically resolve this issue. If failures persist, consider using a local ABI. - If any of the optional arguments are missing, it guides you through an interactive form. @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `dataSources` are key components of Subgraphs. They define the sources of data that the Subgraph indexes and processes. A `dataSource` specifies which smart contract to listen to, which events to process, and how to handle them. -Recent versions of the Graph CLI supports adding new `dataSources` to an existing Subgraph through the `graph add` command: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### Specifics -The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and creates a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - The `--merge-entities` option identifies how the developer would like to handle `entity` and `event` name conflicts: diff --git a/website/src/pages/vi/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/vi/subgraphs/developing/creating/ql-schema.mdx index 7e28150b4e4a..de08b54a8e16 100644 --- a/website/src/pages/vi/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/vi/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ Entity fields can be defined as required or optional. Required fields are indica Giá trị rỗng (null) được giải quyết cho trường không phải null 'name' ``` -Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query as those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. For some entity types the `id` for `Bytes!` is constructed from the id's of two other entities; that is possible using `concat`, e.g., `let id = left.id.concat(right.id) ` to form the id from the id's of `left` and `right`. Similarly, to construct an id from the id of an existing entity and a counter `count`, `let id = left.id.concatI32(count)` can be used. The concatenation is guaranteed to produce unique id's as long as the length of `left` is the same for all such entities, for example, because `left.id` is an `Address`. @@ -72,16 +72,16 @@ For some entity types the `id` for `Bytes!` is constructed from the id's of two The following scalars are supported in the GraphQL API: -| Loại | Miêu tả | -| --- | --- | -| `Bytes` | Mảng byte, được biểu diễn dưới dạng chuỗi thập lục phân. Thường được sử dụng cho các mã băm và địa chỉ Ethereum. | -| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | -| `Boolean` | Scalar for `boolean` values. | -| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | -| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | -| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | -| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | +| Loại | Miêu tả | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Mảng byte, được biểu diễn dưới dạng chuỗi thập lục phân. Thường được sử dụng cho các mã băm và địa chỉ Ethereum. | +| `String` | Scalar for `string` values. Null characters are not supported and are automatically removed. | +| `Boolean` | Scalar for `boolean` values. | +| `Int` | The GraphQL spec defines `Int` to be a signed 32-bit integer. | +| `Int8` | An 8-byte signed integer, also known as a 64-bit signed integer, can store values in the range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Prefer using this to represent `i64` from ethereum. | +| `BigInt` | Large integers. Used for Ethereum's `uint32`, `int64`, `uint64`, ..., `uint256` types. Note: Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a significand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| `Timestamp` | It is an `i64` value in microseconds. Commonly used for `timestamp` fields for timeseries and aggregations. | ### Enums diff --git a/website/src/pages/vi/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/vi/subgraphs/developing/creating/starting-your-subgraph.mdx index 84a5ebbc5d34..ccca7d43804a 100644 --- a/website/src/pages/vi/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/vi/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ Start the process and build a Subgraph that matches your needs: Explore additional [resources for APIs](/subgraphs/developing/creating/graph-ts/README/) and conduct local testing with [Matchstick](/subgraphs/developing/creating/unit-testing-framework/). -| Phiên bản | Ghi chú phát hành | -| :-: | --- | -| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Phiên bản | Ghi chú phát hành | +| :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1.2.0 | Added support for [Indexed Argument Filtering](/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating-a-subgraph/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating-a-subgraph/#polling-filter) and [Initialisation Handlers](/developing/creating-a-subgraph/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating-a-subgraph/#file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/vi/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/vi/subgraphs/developing/creating/subgraph-manifest.mdx index 3edc8a28180f..6ff6d8802454 100644 --- a/website/src/pages/vi/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/vi/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ Các mục nhập quan trọng cần cập nhật cho tệp kê khai là: - `indexerHints.prune`: Defines the retention of historical block data for a Subgraph. See [prune](#prune) in [indexerHints](#indexer-hints) section. -- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts. +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created. @@ -109,7 +109,7 @@ Các mục nhập quan trọng cần cập nhật cho tệp kê khai là: - `dataSources.mapping.callHandlers`: lists the smart contract functions this Subgraph reacts to and handlers in the mapping that transform the inputs and outputs to function calls into entities in the store. -- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. A single Subgraph can index data from multiple smart contracts. Add an entry for each contract from which data needs to be indexed to the `dataSources` array. @@ -153,7 +153,7 @@ While events provide an effective way to collect relevant changes to the state o Call handlers will only trigger in one of two cases: when the function specified is called by an account other than the contract itself or when it is marked as external in Solidity and called as part of another function in the same contract. -> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### Xác định một Trình xử lý lệnh gọi @@ -218,7 +218,7 @@ filter: _The defined handler will be called once for every block which contains a call to the contract (data source) the handler is defined under._ -> **Note:** The `call` filter currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, does not support this API. If a Subgraph indexing one of these networks contain one or more block handlers with a `call` filter, it will not start syncing. +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. The absence of a filter for a block handler will ensure that the handler is called every block. A data source can only contain one block handler for each filter type. @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') There are setters and getters like `setString` and `getString` for all value types. +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## Khối Bắt đầu The `startBlock` is an optional setting that allows you to define from which block in the chain the data source will start indexing. Setting the start block allows the data source to skip potentially millions of blocks that are irrelevant. Typically, a Subgraph developer will set `startBlock` to the block in which the smart contract of the data source was created. @@ -535,15 +537,15 @@ indexerHints: ## SpecVersion Releases -| Phiên bản | Ghi chú phát hành | -| :-: | --- | -| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | -| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | -| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | -| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | -| 0.0.9 | Supports `endBlock` feature | -| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | -| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | -| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | -| 0.0.5 | Added support for event handlers having access to transaction receipts. | -| 0.0.4 | Added support for managing subgraph features. | +| Phiên bản | Ghi chú phát hành | +| :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | Added support for [Subgraph Composition](/cookbook/subgraph-composition-three-sources) | +| 1.2.0 | Added support for [Indexed Argument Filtering](/developing/creating/advanced/#indexed-argument-filters--topic-filters) & declared `eth_call` | +| 1.1.0 | Supports [Timeseries & Aggregations](/developing/creating/advanced/#timeseries-and-aggregations). Added support for type `Int8` for `id`. | +| 1.0.0 | Supports [`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints) feature to prune Subgraphs | +| 0.0.9 | Supports `endBlock` feature | +| 0.0.8 | Added support for polling [Block Handlers](/developing/creating/subgraph-manifest/#polling-filter) and [Initialisation Handlers](/developing/creating/subgraph-manifest/#once-filter). | +| 0.0.7 | Added support for [File Data Sources](/developing/creating/advanced/#ipfsarweave-file-data-sources). | +| 0.0.6 | Supports fast [Proof of Indexing](/indexing/overview/#what-is-a-proof-of-indexing-poi) calculation variant. | +| 0.0.5 | Added support for event handlers having access to transaction receipts. | +| 0.0.4 | Added support for managing subgraph features. | diff --git a/website/src/pages/vi/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/vi/subgraphs/developing/creating/unit-testing-framework.mdx index 720f612265cd..4011ce3e083c 100644 --- a/website/src/pages/vi/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/vi/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ or /node_modules/gluegun/build/index.js:13 throw up; ``` -Please make sure you're on a newer version of Node.js graph-cli doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance Matchstick is confirmed to be working on WSL with **v18.1.0**, you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating you nodejs! Then, make sure you have **libpq** installed, you can do that by running +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ This will run all tests in the test folder: graph test ``` -This will run a test named gravity.test.ts and/or all test inside of a folder named gravity: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## Write a Unit Test -Let's see how a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). Assuming we have the following handler function (along with two helper functions to make our life easier): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. This is an example of how that might look like: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ That's a lot to unpack! First off, an important thing to notice is that we're im - We're setting up our initial state and adding one custom Gravatar entity; - We define two `NewGravatar` event objects along with their data, using the `createNewGravatarEvent()` function; - We're calling out handler methods for those events - `handleNewGravatars()` and passing in the list of our custom events; -- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that gets added when the handler function is called; +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - And lastly - we're cleaning the store using `clearStore()` so that our next test can start with a fresh and empty store object. We can define as many test blocks as we want. There we go - we've created our first test! 👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be outputted if the values are **NOT** equal. Otherwise the test will pass successfully. +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### Interacting with Event metadata @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure you're code doesn't have critical logs in deployment, and you should notice right away if that were to happen. +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### Testing derived fields @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { Using **Matchstick**, Subgraph developers are able to run a script that will calculate the test coverage of the written unit tests. -The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### Prerequisites diff --git a/website/src/pages/vi/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/vi/subgraphs/developing/deploying/multiple-networks.mdx index 3b2b1bbc70ae..5c8016b18c91 100644 --- a/website/src/pages/vi/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/vi/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Every Subgraph affected with this policy has an option to bring the version in q If a Subgraph syncs successfully, that is a good sign that it will continue to run well forever. However, new triggers on the network might cause your Subgraph to hit an untested error condition or it may start to fall behind due to performance issues or issues with the node operators. -Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph. On the hosted service, it is available at `https://api.thegraph.com/index-node/graphql`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/vi/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/vi/subgraphs/developing/deploying/using-subgraph-studio.mdx index 8e89b2999d96..6c1cd5654231 100644 --- a/website/src/pages/vi/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/vi/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth Once you are ready, you can deploy your Subgraph to Subgraph Studio. > Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network. +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. Use the following CLI command to deploy your Subgraph: @@ -104,6 +106,8 @@ After running this command, the CLI will ask for a version label. After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. +> **Note**: The development query URL is limited to 3,000 queries per day. + Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph. ## Publish Your Subgraph diff --git a/website/src/pages/vi/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/vi/subgraphs/developing/publishing/publishing-a-subgraph.mdx index 2bc0ec5f514c..e3e3a7e3d455 100644 --- a/website/src/pages/vi/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/vi/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=
`;将执行表的完整计数-这可能很慢,但可以精确衡量不同实体与整体实体版本的比率。 @@ -340,6 +345,4 @@ The command `graphman stats show shows, for each entity type/table in #### 删除子图 -> 这是一项新功能,将在Graph节点0.29.x中提供。 - 在某个时刻,索引人可能想要删除给定的子图。这可以通过删除部署及其所有索引数据的`graphman drop`, 轻松完成。部署可以被指定为子图名称、IPFS has、`Qm..`,或数据库命名空间`sgdNNN`。[此处](https://github.com/graphprotocol/graph-node/blob/master/docs/graphman.md#-drop)提供了更多文档。 diff --git a/website/src/pages/zh/resources/benefits.mdx b/website/src/pages/zh/resources/benefits.mdx index 24ed916085f2..e9ae2ce95b5e 100644 --- a/website/src/pages/zh/resources/benefits.mdx +++ b/website/src/pages/zh/resources/benefits.mdx @@ -21,53 +21,53 @@ Graph的去中心化网络经过精心设计和完善,创造了强大的索引 ### 更低及更灵活的成本结构 -没有合约。没有月费。只为您使用的查询付费,每次查询的平均成本为每百万个查询40美元(每个查询约0.00004美元)。查询以美元计价,以GRT或信用卡支付。 +No contracts. No monthly fees. Only pay for the queries you use—with an average cost-per-query of $20 per million queries (~$0.00002 per query). Queries are priced in USD and paid in GRT or credit card. 查询成本可能有所不同;报价成本为出版时(2024年3月)的平均值。 ## 低用量用户(每月少于100,000次查询) -| 成本比较 | 自托管 | Graph网络 | -| :------------------: | :-------------------------------------: | :----------------------------------------: | -| 每月服务器费用 \* | 每月350美元 | 0美元 | -| 查询成本 | $0+ | 每月0美元 | -| 工程时间 | 400美元每月 | 没有,内置在具有全球去中心化索引者的网络中 | -| 每月查询 | 受限于基础设施能力 | 100,000 (免费计划) | -| 每个查询的成本 | 0美元 | $0 | -| 基础设施 | 中心化 | 去中心化 | -| 异地备援 | 每个额外节点 $750 + | 包括在内 | -| 正常工作时间 | 变量 | 99.9%+ | -| 每月总成本 | $750+ | 0美元 | +| 成本比较 | 自托管 | Graph网络 | +| :--------------: | :-------------------------------------: | :-------------------: | +| 每月服务器费用 \* | 每月350美元 | 0美元 | +| 查询成本 | $0+ | 每月0美元 | +| 工程时间 | 400美元每月 | 没有,内置在具有全球去中心化索引者的网络中 | +| 每月查询 | 受限于基础设施能力 | 100,000 (免费计划) | +| 每个查询的成本 | 0美元 | $0 | +| 基础设施 | 中心化 | 去中心化 | +| 异地备援 | 每个额外节点 $750 + | 包括在内 | +| 正常工作时间 | 变量 | 99.9%+ | +| 每月总成本 | $750+ | 0美元 | ## 中等容量用户(每月超过约3M查询) -| 成本比较 | 自托管 | Graph网络 | -| :------------------: | :----------------------------------------: | :----------------------------------------: | -| 每月服务器费用 \* | 每月350美元 | 0美元 | -| 查询成本 | 每月500美元 | 每月120美元 | -| 工程时间 | 每月800美元 | 没有,内置在具有全球去中心化索引者的网络中 | -| 每月查询 | 受限于基础设施能力 | ~3,000,000 | -| 每个查询的成本 | 0美元 | $0.00004 | -| 基础设施 | 中心化 | 去中心化 | -| 工程费用 | 每小时200美元 | 包括在内 | -| 异地备援 | 每个额外节点的总成本为1200美元 | 包括在内 | -| 正常工作时间 | 变量 | 99.9%+ | -| 每月总成本 | $1,650+ | $120 | +| 成本比较 | 自托管 | Graph网络 | +| :--------------: | :----------------------------------------: | :-------------------: | +| 每月服务器费用 \* | 每月350美元 | 0美元 | +| 查询成本 | 每月500美元 | 每月120美元 | +| 工程时间 | 每月800美元 | 没有,内置在具有全球去中心化索引者的网络中 | +| 每月查询 | 受限于基础设施能力 | ~3,000,000 | +| 每个查询的成本 | 0美元 | $0.00002 | +| 基础设施 | 中心化 | 去中心化 | +| 工程费用 | 每小时200美元 | 包括在内 | +| 异地备援 | 每个额外节点的总成本为1200美元 | 包括在内 | +| 正常工作时间 | 变量 | 99.9%+ | +| 每月总成本 | $1,650+ | $120 | ## 高用量用户(每月超过约30M次查询) -| 成本比较 | 自托管 | Graph网络 | -| :------------------: | :-----------------------------------------: | :----------------------------------------: | -| 每月服务器费用 \* | 1100美元每月每节点 | 0美元 | -| 查询成本 | 4000美元 | 每月1,200美元 | -| 需要的节点数量 | 10 | 不适用 | -| 工程时间 | 每月6000美元或以上 | 没有,内置在具有全球去中心化索引者的网络中 | -| 每月查询 | 受限于基础设施能力 | ~30,000,000 | -| 每个查询的成本 | 0美元 | $0.00004 | -| 基础设施 | 中心化 | 去中心化 | -| 异地备援 | 每个额外节点的总成本为1200美元 | 包括在内 | -| 正常工作时间 | 变量 | 99.9%+ | -| 每月总成本 | $11,000+ | $1,200 | +| 成本比较 | 自托管 | Graph网络 | +| :--------------: | :-----------------------------------------: | :-------------------: | +| 每月服务器费用 \* | 1100美元每月每节点 | 0美元 | +| 查询成本 | 4000美元 | 每月1,200美元 | +| 需要的节点数量 | 10 | 不适用 | +| 工程时间 | 每月6000美元或以上 | 没有,内置在具有全球去中心化索引者的网络中 | +| 每月查询 | 受限于基础设施能力 | ~30,000,000 | +| 每个查询的成本 | 0美元 | $0.00002 | +| 基础设施 | 中心化 | 去中心化 | +| 异地备援 | 每个额外节点的总成本为1200美元 | 包括在内 | +| 正常工作时间 | 变量 | 99.9%+ | +| 每月总成本 | $11,000+ | $1,200 | - 包括后备费用: 每月$50-$100美元 diff --git a/website/src/pages/zh/resources/claude-mcp.mdx b/website/src/pages/zh/resources/claude-mcp.mdx new file mode 100644 index 000000000000..f6fbb9ec4f00 --- /dev/null +++ b/website/src/pages/zh/resources/claude-mcp.mdx @@ -0,0 +1,122 @@ +--- +title: Claude MCP +--- + +This guide walks you through configuring Claude Desktop to use The Graph ecosystem's [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) resources: Token API and Subgraph. These integrations allow you to interact with blockchain data through natural language conversations with Claude. + +## What You Can Do + +With these integrations, you can: + +- **Token API**: Access token and wallet information across multiple blockchains +- **Subgraph**: Find relevant Subgraphs for specific keywords and contracts, explore Subgraph schemas, and execute GraphQL queries + +## 先决条件 + +- [Node.js](https://nodejs.org/en/download/) installed and available in your path +- [Claude Desktop](https://claude.ai/download) installed +- API keys: + - Token API key from [The Graph Market](https://thegraph.market/) + - Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +## Configuration Steps + +### 1. Open Configuration File + +Navigate to your `claude_desktop_config.json` file: + +> **Claude Desktop** > **Settings** > **Developer** > **Edit Config** + +Paths by operating system: + +- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` +- Linux: `.config/Claude/claude_desktop_config.json` + +### 2. Add Configuration + +Replace the contents of the existing config file with: + +```json +{ + "mcpServers": { + "token-api": { + "command": "npx", + "args": ["@pinax/mcp", "--sse-url", "https://token-api.mcp.thegraph.com/sse"], + "env": { + "ACCESS_TOKEN": "ACCESS_TOKEN" + } + }, + "subgraph": { + "command": "npx", + "args": ["mcp-remote", "--header", "Authorization:${AUTH_HEADER}", "https://subgraphs.mcp.thegraph.com/sse"], + "env": { + "AUTH_HEADER": "Bearer GATEWAY_API_KEY" + } + } + } +} +``` + +### 3. Add Your API Keys + +Replace: + +- `ACCESS_TOKEN` with your Token API key from [The Graph Market](https://thegraph.market/) +- `GATEWAY_API_KEY` with your Gateway API key from [Subgraph Studio](https://thegraph.com/studio/apikeys/) + +### 4. Save and Restart + +- Save the configuration file +- Restart Claude Desktop + +### 5. Add The Graph Resources in Claude + +After configuration: + +1. Start a new conversation in Claude Desktop +2. Click on the context menu (top right) +3. Add "Subgraph Server Instructions" as a resource by entering `graphql://subgraph` for Subgraph MCP + +> **Important**: You must manually add The Graph resources to your chat context for each conversation where you want to use them. + +### 6. Run Queries + +Here are some example queries you can try after setting up the resources: + +### Subgraph Queries + +``` +What are the top pools in Uniswap? +``` + +``` +Who are the top Delegators of The Graph Protocol? +``` + +``` +Please make a bar chart for the number of active loans in Compound for the last 7 days +``` + +### Token API Queries + +``` +Show me the current price of ETH +``` + +``` +What are the top tokens by market cap on Ethereum? +``` + +``` +Analyze this wallet address: 0x... +``` + +## 故障排除 + +If you encounter issues: + +1. **Verify Node.js Installation**: Ensure Node.js is correctly installed by running `node -v` in your terminal +2. **Check API Keys**: Verify that your API keys are correctly entered in the configuration file +3. **Enable Verbose Logging**: Add `--verbose true` to the args array in your configuration to see detailed logs +4. **Restart Claude Desktop**: After making changes to the configuration, always restart Claude Desktop diff --git a/website/src/pages/zh/subgraphs/best-practices/timeseries.mdx b/website/src/pages/zh/subgraphs/best-practices/timeseries.mdx index c18b61169631..47c83a56f7e4 100644 --- a/website/src/pages/zh/subgraphs/best-practices/timeseries.mdx +++ b/website/src/pages/zh/subgraphs/best-practices/timeseries.mdx @@ -161,7 +161,7 @@ type TokenStats @aggregation(intervals: ["hour", "day"], source: "TokenData") { - 最大正金额: @aggregate(fn: "max", arg: "greatest(amount0, amount1, 0)") - 条件总和: @aggregate(fn: "sum", arg: "case when amount0 > amount1 then amount0 else 0 end") -支持的运算符和函数包括基本算术(+、-、\_、/)、比较运算符、逻辑运算符(和、或、非)以及最大、最小、合并等SQL函数。 +支持的运算符和函数包括基本算术(+、-、_、/)、比较运算符、逻辑运算符(和、或、非)以及最大、最小、合并等SQL函数。 ### 查询参数 diff --git a/website/src/pages/zh/subgraphs/developing/creating/advanced.mdx b/website/src/pages/zh/subgraphs/developing/creating/advanced.mdx index e279b181ffb2..c3c065e7b38c 100644 --- a/website/src/pages/zh/subgraphs/developing/creating/advanced.mdx +++ b/website/src/pages/zh/subgraphs/developing/creating/advanced.mdx @@ -4,15 +4,15 @@ title: 高级子图功能 ## 概述 -添加并实现高级子图功能,以增强子图的构建。 +Add and implement advanced Subgraph features to enhance your Subgraph's build. -从 `specVersion ``0.0.4` 开始,子图特征必须使用它们的 `camelCase` 名称,在清单文件顶层的 `features` 部分中显式声明,如下表所列: +从 ```specVersion ``0.0.4``` 开始,子图特征必须使用它们的 `camelCase` 名称,在清单文件顶层的 `features` 部分中显式声明,如下表所列: -| 功能 | 名字 | -| -------------------------------------------- | ---------------- | -| [非致命错误](#non-fatal-errors) | `nonFatalErrors` | -| [全文搜索](#defining-fulltext-search-fields) | `fullTextSearch` | -| [嫁接](#grafting-onto-existing-subgraphs) | `grafting` | +| 功能 | 名字 | +| ----------------------------------------------- | ---------------- | +| [非致命错误](#non-fatal-errors) | `nonFatalErrors` | +| [全文搜索](#defining-fulltext-search-fields) | `fullTextSearch` | +| [嫁接](#grafting-onto-existing-subgraphs) | `grafting` | 例如,如果子图使用 **Full-Text Search** 和 **Non-fatal Errors** 功能,则清单中的 `features` 字段应为: @@ -343,7 +343,7 @@ export function handleTransfer(event: TransferEvent): void { 在创建文件数据源时,您可以使用[DataSource上下文](/subgraphs/developing/creating/graph-ts/api/#entity-and-datasourcecontext)传递额外的信息,这些信息将可供文件数据源处理程序使用。 -如果您有多次刷新的实体,请使用 IPFS 一的基于文件的实体。实体 ID,并使用基于链的实体中的派生字段引用它们。 +如果您有多次刷新的实体,请使用 IPFS 一的基于文件的实体。实体 ID,并使用基于链的实体中的派生字段引用它们。 > 我们正在努力改进上述建议,因此查询只返回“最新”版本。 @@ -456,8 +456,6 @@ eventHandlers: ## 已声明eth_call -> 注意:这是一个实验性功能,目前尚未在稳定的Graph Node版本中提供。您只能在Subgraph Studio或自托管节点中使用它。 - 声明性`eth_calls`是一个有价值的子图特性,它允许`eth_call`提前执行,使`graph-node`能够并行执行它们。 此功能执行以下操作: @@ -535,7 +533,7 @@ calls: > **注意:**不建议在最初升级到The Graph网络时使用嫁接。了解更多信息[此处](/subgraphs/cookbook/grafting/#important-note-on-grafting-when-upgrading-to-the-network)。 -首次部署子图时,它会在相应链的启动区块(或每个数据源定义的 `startBlock` 处)开始索引事件。在某些情况下,可以使用现有子图已经索引的数据并在更晚的区块上开始索引。 这种索引模式称为*Grafting*。 例如,嫁接在开发过程中非常有用,可以快速克服映射中的简单错误,或者在现有子图失败后暂时恢复工作。 +首次部署子图时,它会在相应链的启动区块(或每个数据源定义的 `startBlock` 处)开始索引事件。在某些情况下,可以使用现有子图已经索引的数据并在更晚的区块上开始索引。 这种索引模式称为_Grafting_。 例如,嫁接在开发过程中非常有用,可以快速克服映射中的简单错误,或者在现有子图失败后暂时恢复工作。 当 `subgraph.yaml` 中的子图清单在顶层包含 `graft` 区块时,子图被嫁接到基础子图: diff --git a/website/src/pages/zh/subgraphs/developing/creating/graph-ts/CHANGELOG.md b/website/src/pages/zh/subgraphs/developing/creating/graph-ts/CHANGELOG.md index 20c96b935045..7349928a0860 100644 --- a/website/src/pages/zh/subgraphs/developing/creating/graph-ts/CHANGELOG.md +++ b/website/src/pages/zh/subgraphs/developing/creating/graph-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphprotocol/graph-ts +## 0.38.1 + +### 补丁更改 + +- [#2006](https://github.com/graphprotocol/graph-tooling/pull/2006) [`3fb730b`](https://github.com/graphprotocol/graph-tooling/commit/3fb730bdaf331f48519e1d9fdea91d2a68f29fc9) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - fix global variables in wasm + ## 0.38.0 ### 微小变化 diff --git a/website/src/pages/zh/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/zh/subgraphs/developing/creating/graph-ts/api.mdx index 6efd4699dd7b..9e3700fa0e55 100644 --- a/website/src/pages/zh/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/zh/subgraphs/developing/creating/graph-ts/api.mdx @@ -29,16 +29,16 @@ title: 汇编脚本API 子图清单中的 `apiVersion` 指定了由 Graph Node 运行的特定子图的映射 API 版本。 -| 版本 | Release 说明 | -| :-: | --- | -| 0.0.9 | 添加新的主机函数[`eth_get_balance`](#balance-of-an-address) 和 [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | -| 0.0.8 | 在保存实体时添加对模式中是否存在字段的验证。 | -| 0.0.7 | 添加了 `TransactionReceipt` 和 `Log` 类到以太坊类型。
已将 `receipt` 字段添加到Ethereum Event对象。 | -| 0.0.6 | 向Ethereum Transaction对象添加了 nonce 字段 向 Etherum Block对象添加
baseFeePerGas字段 | +| 版本 | Release 说明 | +| :---: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.9 | 添加新的主机函数[`eth_get_balance`](#balance-of-an-address) 和 [`hasCode`](#check-if-an-address-is-a-contract-or-eoa) | +| 0.0.8 | 在保存实体时添加对模式中是否存在字段的验证。 | +| 0.0.7 | 添加了 `TransactionReceipt` 和 `Log` 类到以太坊类型。
已将 `receipt` 字段添加到Ethereum Event对象。 | +| 0.0.6 | 向Ethereum Transaction对象添加了 nonce 字段 向 Etherum Block对象添加
baseFeePerGas字段 | | 0.0.5 | AssemblyScript 升级到版本 0.19.10(这包括重大更改,参阅[`迁移指南`](/resources/migration-guides/assemblyscript-migration-guide/))
`ethereum.transaction.gasUsed 重命名为 `ethereum.transaction.gasLimit\` | -| 0.0.4 | 已向 Ethereum SmartContractCall对象添加了 `functionSignature` 字段。 | -| 0.0.3 | 已向Ethereum Call 对象添加了 `from` 字段。
`ethereum.call.address` 被重命名为 `ethereum.call.to`。 | -| 0.0.2 | 已向Ethereum Transaction对象添加了 `input` 字段。 | +| 0.0.4 | 已向 Ethereum SmartContractCall对象添加了 `functionSignature` 字段。 | +| 0.0.3 | 已向Ethereum Call 对象添加了 `from` 字段。
`ethereum.call.address` 被重命名为 `ethereum.call.to`。 | +| 0.0.2 | 已向Ethereum Transaction对象添加了 `input` 字段。 | ### 内置类型 @@ -276,7 +276,7 @@ if (transfer == null) { > 注意: 仅当映射中所做的更改依赖于实体的先前数据时,才需要加载实体。 有关更新现有实体的两种方法,请参阅下一节。 -#### 查找在区块中创建的实体 +#### Looking up entities created within a block 截至 `graph-node` v0.31.0、`@graphprotocol/graph-ts` v0.30.0 和 `@graphprotocol/graph-cli` v0.49.0,所有实体类型上都提供了 `loadInBlock` 方法。 @@ -501,11 +501,29 @@ export function handleTransfer(event: TransferEvent) { } ``` -这里将 `Transfer` 别名为 `TransferEvent`,以避免与实体类型产生命名冲突。 +`Transfer` is aliased to `TransferEvent` here to avoid a naming conflict with the entity type. 只要以太坊上的 `ERC20Contract` 有一个名为 `symbol` 的公共只读函数,就可以使用 `.symbol()` 来调用它。对于公共状态变量,将自动生成一个同名的方法。 -作为子图一部分的任何其他合约都可以从生成的代码中导入,并且可以绑定到一个有效地址。 +Any other contract that is part of the subgraph can be imported from the generated code and can be bound to a valid address. An example of that is presented within the steps below: + +- Extend `subgraph.yaml` file with desired ABI file: + +```yaml +mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Gravatar + abis: + - name: Gravity + file: ./abis/Gravity.json + - name: OtherContract + file: ./abis/OtherContract.json +``` + +- Import and bind to the contract using its address #### 处理重复调用 @@ -534,8 +552,7 @@ import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts' let tupleArray: Array = [ ethereum.Value.fromAddress(Address.fromString('0x0000000000000000000000000000000000000420')), - ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(62)), -] + ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(62)),] let tuple = tupleArray as ethereum.Tuple @@ -665,6 +682,8 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` + + ### IPFS API ```typescript @@ -769,19 +788,20 @@ if (value.kind == JSONValueKind.BOOL) { ### 类型转换参考 -| 源类型 | 目标类型 | 转换函数 | +| 源类型 | 目标类型 | 转换函数 | | -------------------- | -------------------- | ---------------------------- | | Address | Bytes | none | | Address | String | s.toHexString() | | BigDecimal | String | s.toString() | | BigInt | BigDecimal | s.toBigDecimal() | -| BigInt | String (hexadecimal) | s.toHexString() 或 s.toHex() | +| BigInt | String (hexadecimal) | s.toHexString() 或 s.toHex() | | BigInt | String (unicode) | s.toString() | +| BigInt | Bytes | s.fromBigInt() | | BigInt | i32 | s.toI32() | | Boolean | Boolean | none | | Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | | Bytes (unsigned) | BigInt | BigInt.fromUnsignedBytes(s) | -| Bytes | String (hexadecimal) | s.toHexString() 或 s.toHex() | +| Bytes | String (hexadecimal) | s.toHexString() 或 s.toHex() | | Bytes | String (unicode) | s.toString() | | Bytes | String (base58) | s.toBase58() | | Bytes | i32 | s.toI32() | @@ -805,8 +825,8 @@ if (value.kind == JSONValueKind.BOOL) { | Bytes | Address | Address.fromBytes(s) | | String | BigInt | BigInt.fromString(s) | | String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| String (hexadecimal) | Bytes | Bytes.fromHexString(s) | +| String (UTF-8) | Bytes | Bytes.fromUTF8(s) | ### 数据源元数据 diff --git a/website/src/pages/zh/subgraphs/developing/creating/install-the-cli.mdx b/website/src/pages/zh/subgraphs/developing/creating/install-the-cli.mdx index b8fa541b7453..e798b86c1f6e 100644 --- a/website/src/pages/zh/subgraphs/developing/creating/install-the-cli.mdx +++ b/website/src/pages/zh/subgraphs/developing/creating/install-the-cli.mdx @@ -46,7 +46,6 @@ graph init \ ``` - 该命令试图从Etherscan检索合约ABI。 - - Graph CLI依赖于公共RPC端点。虽然偶尔会出现故障,但重试通常可以解决此问题。如果故障持续存在,请考虑使用本地ABI。 - 如果缺少任何可选参数,它将引导您完成交互式表单。 @@ -69,7 +68,7 @@ graph init --from-example=example-subgraph `数据源`是子图的关键组成部分。它们定义了子图索引和处理的数据来源。`dataSource`指定要监听哪个智能合约、处理哪些事件以及如何处理它们。 -最近版本的Graph CLI支持通过`graph add`命令向现有子图添加新的`数据源`: +Recent versions of the Graph CLI support adding new `dataSources` to an existing Subgraph through the `graph add` command: ```sh graph add
[] @@ -84,7 +83,7 @@ Options: #### 详情 -`graph add`命令将从Etherscan获取ABI(除非使用`--abi`选项指定了ABI路径),并创建一个新的`dataSource`,类似于`graph-init`指令如何`从合约`创建`data. Source`,从而相应地更新模式和映射。这允许您从代理合约中索引实现合约。 +The `graph add` command will fetch the ABI from Etherscan (unless an ABI path is specified with the `--abi` option) and create a new `dataSource`, similar to how the `graph init` command creates a `dataSource` `--from-contract`, updating the schema and mappings accordingly. This allows you to index implementation contracts from their proxy contracts. - `--merge-entities`选项标识开发人员希望如何处理`实体`和`事件`名称冲突: diff --git a/website/src/pages/zh/subgraphs/developing/creating/ql-schema.mdx b/website/src/pages/zh/subgraphs/developing/creating/ql-schema.mdx index af89158103ba..f1de0702b2be 100644 --- a/website/src/pages/zh/subgraphs/developing/creating/ql-schema.mdx +++ b/website/src/pages/zh/subgraphs/developing/creating/ql-schema.mdx @@ -62,7 +62,7 @@ type GravatarDeclined @entity { Null value resolved for non-null field 'name' ``` -每个实体必须有一个 `id` 字段,其类型必须是 `Bytes!`或者`String!`。通常建议使用`Bytes!`,除非 `id` 包含人类可读的文本,因为有`Bytes!` `id`的实体比使用`String!``id`的写入和查询速度会更快。`id` 字段充当主钥,并且需要在同一类型的所有实体中是唯一的。由于历史原因,类型 `ID!`也被接受,是 `String!`的同义词。 +Each entity must have an `id` field, which must be of type `Bytes!` or `String!`. It is generally recommended to use `Bytes!`, unless the `id` contains human-readable text, since entities with `Bytes!` id's will be faster to write and query than those with a `String!` `id`. The `id` field serves as the primary key, and needs to be unique among all entities of the same type. For historical reasons, the type `ID!` is also accepted and is a synonym for `String!`. 对于`Bytes!`的某些实体类型,`id` 是由另外两个实体的 id 构成的; 这可以使用 `concat`,例如,`let id = left.id.concat(right.id) ` 来从`left`和`right`的 id 构成 id。类似地,要从现有实体的 id 和`count`构造 id,可以使用 `let id = left.id.concatI32(count)` 。只要`left`的长度对于所有这样的实体都是相同的,这种串联就一定会产生唯一的 id,例如,因为 `left.id`是一个 `Address`。 @@ -72,16 +72,16 @@ Null value resolved for non-null field 'name' GraphQL API支持以下缩写: -| 类型 | 描述 | -| --- | --- | -| `Bytes` | 字节数组,表示为十六进制字符串。 通常用于以太坊hash和地址。 | -| `String` | `string`值的标量。不支持空字符,将被自动删除。 | -| `Boolean` | `boolean` 值的标量。 | -| `Int` | GraphQL spec定义`Int`为一个带符号的32位整数。 | -| `Int8` | 一个8字节有符号整数,也称为64位有符号整数,可以存储从-9,223,372,036,854,775,808到9,223,372,036,854,775,807的范围内的值。建议使用此类型来表示以太坊中的`i64`。 | -| `BigInt` | 大整数。 用于以太坊的 `uint32`, `int64`, `uint64`, ..., `uint256` 类型。 注意:`uint32`以下的所有类型,例如`int32`, `uint24`或`int8`都表示为`i32`。 | -| `BigDecimal` | `BigDecimal`表示为有效数字和指数的高精度小数。 指数范围是 -6143 到 +6144。 四舍五入到 34 位有效数字。 | -| `Timestamp` | 它是一个微秒的`i64`值。通常用于时间序列和聚合的`时间戳`字段。 | +| 类型 | 描述 | +| ------------ | ------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | 字节数组,表示为十六进制字符串。 通常用于以太坊hash和地址。 | +| `String` | `string`值的标量。不支持空字符,将被自动删除。 | +| `Boolean` | `boolean` 值的标量。 | +| `Int` | GraphQL spec定义`Int`为一个带符号的32位整数。 | +| `Int8` | 一个8字节有符号整数,也称为64位有符号整数,可以存储从-9,223,372,036,854,775,808到9,223,372,036,854,775,807的范围内的值。建议使用此类型来表示以太坊中的`i64`。 | +| `BigInt` | 大整数。 用于以太坊的 `uint32`, `int64`, `uint64`, ..., `uint256` 类型。 注意:`uint32`以下的所有类型,例如`int32`, `uint24`或`int8`都表示为`i32`。 | +| `BigDecimal` | `BigDecimal`表示为有效数字和指数的高精度小数。 指数范围是 -6143 到 +6144。 四舍五入到 34 位有效数字。 | +| `Timestamp` | 它是一个微秒的`i64`值。通常用于时间序列和聚合的`时间戳`字段。 | ### 枚举类型 @@ -295,30 +295,30 @@ query { 支持的语言词典: -| 代码 | 词典 | +| 代码 | 词典 | | ------ | ---------- | -| simple | 通用 | -| da | 丹麦语 | -| nl | 荷兰语 | -| en | 英语 | -| fi | 芬兰语 | +| simple | 通用 | +| da | 丹麦语 | +| nl | 荷兰语 | +| en | 英语 | +| fi | 芬兰语 | | fr | French | -| de | 德语 | -| hu | 匈牙利语 | -| it | 意大利语 | -| no | 挪威语 | -| pt | 葡萄牙语 | -| ro | 罗马尼亚语 | -| ru | 俄语 | -| es | 西班牙语 | -| sv | 瑞典语 | -| tr | 土耳其语 | +| de | 德语 | +| hu | 匈牙利语 | +| it | 意大利语 | +| no | 挪威语 | +| pt | 葡萄牙语 | +| ro | 罗马尼亚语 | +| ru | 俄语 | +| es | 西班牙语 | +| sv | 瑞典语 | +| tr | 土耳其语 | ### 排序算法 支持的排序结果算法: -| 算法 | 说明 | -| ------------- | --------------------------------------------- | -| 排名 | 使用全文查询的匹配质量 (0-1) 对结果进行排序。 | -| proximityRank | 与 rank 类似,但也包括匹配的接近程度。 | +| 算法 | 说明 | +| ------------- | -------------------------------------------------------------- | +| 排名 | 使用全文查询的匹配质量 (0-1) 对结果进行排序。 | +| proximityRank | 与 rank 类似,但也包括匹配的接近程度。 | diff --git a/website/src/pages/zh/subgraphs/developing/creating/starting-your-subgraph.mdx b/website/src/pages/zh/subgraphs/developing/creating/starting-your-subgraph.mdx index 60544fa53eaf..3f0f7f96c3cc 100644 --- a/website/src/pages/zh/subgraphs/developing/creating/starting-your-subgraph.mdx +++ b/website/src/pages/zh/subgraphs/developing/creating/starting-your-subgraph.mdx @@ -22,14 +22,14 @@ The Graph是数千个子图的所在地,这些子图已经可供查询,因 探索[API的其他资源](/subgraphs/developing/creating/graph-ts/README/),并使用[Matchstick](/subgraphs/developing/creating/unit-testing-framework/)进行本地测试。 -| 版本 | Release 说明 | -| :-: | --- | -| 1.2.0 | 添加了对[索引参数过滤器](/#indexed-argument-filters--topic-filters) 的支持,并声明了`eth_call`。 | -| 1.1.0 | 支持[时间序列和聚合](#timeseries-and-aggregations)。为`id`添加了对`Int8`类型的支持。 | -| 1.0.0 | 支持[`indexerHints`](/developing/creating-a-subgraph/#indexer-hints)功能以修剪子图。 | -| 0.0.9 | 支持`endBlock`功能。 | +| 版本 | Release 说明 | +| :---: | -------------------------------------------------------------------------------------------------------------------------- | +| 1.2.0 | 添加了对[索引参数过滤器](/#indexed-argument-filters--topic-filters) 的支持,并声明了`eth_call`。 | +| 1.1.0 | 支持[时间序列和聚合](#timeseries-and-aggregations)。为`id`添加了对`Int8`类型的支持。 | +| 1.0.0 | 支持[`indexerHints`](/developing/creating-a-subgraph/#indexer-hints)功能以修剪子图。 | +| 0.0.9 | 支持`endBlock`功能。 | | 0.0.8 | 添加了对轮询[块处理程序](/developing/creating-a-subgraph/#polling-filter)和[初始化处理程序](/developing/creating-a-subgraph/#once-filter)的支持。 | -| 0.0.7 | 添加了对[文件数据源](/developing/creating-a-subgraph/#file-data-sources)的支持。 | -| 0.0.6 | 支持快速的[索引证明](/indexing/overview/#what-is-a-proof-of-indexing-poi) 计算变体。 | -| 0.0.5 | 添加了对可以访问交易收据的事件处理程序的支持。 | -| 0.0.4 | 添加了对管理子图功能的支持。 | +| 0.0.7 | 添加了对[文件数据源](/developing/creating-a-subgraph/#file-data-sources)的支持。 | +| 0.0.6 | 支持快速的[索引证明](/indexing/overview/#what-is-a-proof-of-indexing-poi) 计算变体。 | +| 0.0.5 | 添加了对可以访问交易收据的事件处理程序的支持。 | +| 0.0.4 | 添加了对管理子图功能的支持。 | diff --git a/website/src/pages/zh/subgraphs/developing/creating/subgraph-manifest.mdx b/website/src/pages/zh/subgraphs/developing/creating/subgraph-manifest.mdx index 9aa577956956..bd2ae18508cc 100644 --- a/website/src/pages/zh/subgraphs/developing/creating/subgraph-manifest.mdx +++ b/website/src/pages/zh/subgraphs/developing/creating/subgraph-manifest.mdx @@ -93,7 +93,7 @@ dataSources: - `indexerHints.prune`:定义子图的历史区块数据的保留情况。请参见[indexerHints](#indexer-hints) 章节中的[prune](#prune)。 -- `dataSources.source`:智能合约子图源的地址,以及要使用的智能合约的ABI。 地址是可选的; 省略它允许索引来自所有合约的匹配事件。 +- `dataSources.source`: the address of the smart contract the Subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows you to index matching events from all contracts. - `dataSources.source.startBlock`:数据源开始索引的区块的可选编号。 在大多数情况下,我们建议使用创建合约的区块。 @@ -109,7 +109,7 @@ dataSources: - `dataSources.mapping.callHandlers`:列出此子图响应的智能合约函数以及映射中的处理程序,该映射将输入和输出转换为函数调用到存储中的实体。 -- `dataSources.mapping.blockHandlers`:列出此子图响应的区块以及映射中的处理程序,以便在将区块附加到链时运行。 如果没有过滤器,区块处理程序将在每个区块中运行。 可以通过向处理程序添加为以下类型字段提供可选的调用`filter`-`kind: call`。 如果区块包含至少一个对数据源合约的调用,则调用筛子将运行处理程序。 +- `dataSources.mapping.blockHandlers`: lists the blocks this Subgraph reacts to and handlers in the mapping to run when a block is appended to the chain. Without a filter, the block handler will be run on every block. An optional call-filter can be provided by adding a `filter` field with `kind: call` to the handler. This will only run the handler if the block contains at least one call to the data source contract. 通过为每个需要将数据索引到 `dataSources` 数组的合约添加一个条目,单个子图可以索引来自多个智能合约的数据。 @@ -153,7 +153,7 @@ dataSources: 调用处理程序只会在以下两种情况之一触发:当指定的函数被合约本身以外的账户调用时,或者当它在 Solidity 中被标记为外部,并作为同一合约中另一个函数的一部分被调用时。 -> **注意: **调用处理程序目前依赖于 Parity 跟踪 API。某些网络,如 BNB 链和 Arbitrum,不支持此 API。如果索引其中一个网络的子图包含一个或多个调用处理程序,它将不会开始同步。子图开发人员应该使用事件处理程序。它们比调用处理程序性能好得多,并且在每个 evm 网络上都受到支持。 +> **Note:** Call handlers currently depend on the Parity tracing API. Certain networks, such as BNB chain and Arbitrum, do not support this API. If a Subgraph indexing one of these networks contains one or more call handlers, it will not start syncing. Subgraph developers should instead use event handlers. These are far more performant than call handlers, and are supported on every evm network. ### 定义调用处理程序 @@ -218,7 +218,7 @@ filter: 对于每个包含对定义处理程序的合约(数据源)调用的区块,相应的处理程序都会被调用一次。 -> 注意: `调用`过滤器目前依赖于 Parity 跟踪 API。某些网络,如 BNB 链和 Arbitrum,不支持此 API。如果索引其中一个网络的子图包含一个或多个带过滤器的区块`调用`处理程序,它将不会开始同步。 +> **Note:** The `call` filter currently depends on the Parity tracing API. Certain networks, such as BNB chain, Arbitrum, Polygon, and Optimism do not support this API. If a Subgraph indexing one of these networks contains one or more block handlers with a `call` filter, it will not start syncing. 块处理程序没有过滤器将确保每个块都调用处理程序。对于每种过滤器类型,一个数据源只能包含一个块处理程序。 @@ -375,7 +375,7 @@ dataSources: ### 动态创建合约的数据源模板 -然后,将*data source templates* 添加到清单中。 它们与常规数据源相同,只是在 `source` 下缺少预先定义的合约地址。 通常,您需要为母合约管理或引用的每种类型的子合约定义一个模板。 +然后,将_data source templates_ 添加到清单中。 它们与常规数据源相同,只是在 `source` 下缺少预先定义的合约地址。 通常,您需要为母合约管理或引用的每种类型的子合约定义一个模板。 ```yaml dataSources: @@ -452,6 +452,8 @@ let tradingPair = context.getString('tradingPair') 对于所有的值类型,都有像 `setString` 和 `getString` 这样的 setter 和 getter。 +> Referencing an entity is done via ID in GraphQL. That ID can be passed into the instantiated data source by setting it in the context and then accessed within the mapping of the template. An example can be found in the [documentation of `graph-ts`](https://github.com/graphprotocol/graph-tooling/tree/main/packages/ts#api). + ## 起始区块 `startBlock` 是一个可选配置,允许您定义数据源从区块链中的哪个区块开始索引。 设置起始区块允许数据源跳过潜在的数百万个不相关的区块。 通常,子图开发人员会将 `startBlock` 设置为创建数据源智能合约的区块。 @@ -535,15 +537,15 @@ indexerHints: ## 视图版本发布 -| 版本 | Release 说明 | -| :-: | --- | -| 1.3.0 | 添加了对 [Subgraph 合成](/cookbook/subgraph-composition-three-sources) 的支持。 | -| 1.2.0 | 添加了对[索引参数过滤器](/developing/creating/advanced/#indexed-argument-filters--topic-filters) 的支持,并声明了`eth_call`。 | -| 1.1.0 | 支持[时间序列和聚合](/developing/creating/advanced/#timeseries-and-aggregations)。为`id`添加了对`Int8`类型的支持。 | -| 1.0.0 | 支持[`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints)功能以修剪子图。 | -| 0.0.9 | 支持`endBlock`功能。 | +| 版本 | Release 说明 | +| :---: | ---------------------------------------------------------------------------------------------------------------------------------------- | +| 1.3.0 | 添加了对 [Subgraph 合成](/cookbook/subgraph-composition-three-sources) 的支持。 | +| 1.2.0 | 添加了对[索引参数过滤器](/developing/creating/advanced/#indexed-argument-filters--topic-filters) 的支持,并声明了`eth_call`。 | +| 1.1.0 | 支持[时间序列和聚合](/developing/creating/advanced/#timeseries-and-aggregations)。为`id`添加了对`Int8`类型的支持。 | +| 1.0.0 | 支持[`indexerHints`](/developing/creating/subgraph-manifest/#indexer-hints)功能以修剪子图。 | +| 0.0.9 | 支持`endBlock`功能。 | | 0.0.8 | 添加了对轮询[块处理程序](/developing/creating/subgraph-manifest/#polling-filter)和[初始化处理程序](/developing/creating/subgraph-manifest/#once-filter)的支持。 | -| 0.0.7 | 添加了对[文件数据源](/developing/creating/advanced/#ipfsarweave-file-data-sources)的支持。 | -| 0.0.6 | 支持快速的[索引证明](/indexing/overview/#what-is-a-proof-of-indexing-poi) 计算变体。 | -| 0.0.5 | 添加了对可以访问交易收据的事件处理程序的支持。 | -| 0.0.4 | 添加了对管理子图功能的支持。 | +| 0.0.7 | 添加了对[文件数据源](/developing/creating/advanced/#ipfsarweave-file-data-sources)的支持。 | +| 0.0.6 | 支持快速的[索引证明](/indexing/overview/#what-is-a-proof-of-indexing-poi) 计算变体。 | +| 0.0.5 | 添加了对可以访问交易收据的事件处理程序的支持。 | +| 0.0.4 | 添加了对管理子图功能的支持。 | diff --git a/website/src/pages/zh/subgraphs/developing/creating/unit-testing-framework.mdx b/website/src/pages/zh/subgraphs/developing/creating/unit-testing-framework.mdx index 0bb085db72c6..21f0394ba75b 100644 --- a/website/src/pages/zh/subgraphs/developing/creating/unit-testing-framework.mdx +++ b/website/src/pages/zh/subgraphs/developing/creating/unit-testing-framework.mdx @@ -61,7 +61,7 @@ static BYTES = Symbol("Bytes") SyntaxError: Unexpected token = /node_modules/gluegun/build/index.js:13 throw up; ``` -请确保您是新版本的 Node.js graph-cli 不支持 **v10.19.0** ,这仍然是WSL上新的 Ubuntu 图像的默认版本。 例如,Matchstick被确认在 WSL 使用 **v18.1.0 **,您可以通过 **nvm** 切换到它,也可以更新您的全局Node.js。 别忘了在更新节点后删除 `node_modules` 并重新运行 `npm install` ! 然后,请确保您已经安装了 **libpq** ,您可以通过运行来做到这一点。 +Please make sure you're on a newer version of Node.js. `graph-cli` doesn't support **v10.19.0** anymore, and that is still the default version for new Ubuntu images on WSL. For instance, Matchstick is confirmed to be working on WSL with **v18.1.0**; you can switch to it either via **nvm** or if you update your global Node.js. Don't forget to delete `node_modules` and to run `npm install` again after updating Node.js. Then, make sure you have **libpq** installed. You can do that by running: ``` sudo apt-get install libpq-dev @@ -97,7 +97,7 @@ sudo apt-get install libpq-dev graph test ``` -这将运行名为gravity.test.ts的测试和/或名为gravity的文件夹中的所有测试: +This will run a test named `gravity.test.ts` and/or all tests inside of a folder named `gravity`: ```sh graph test Gravity @@ -565,7 +565,7 @@ assert.dataSourceExists( ## 编写一个单元测试 -让我们看看一个简单的单元测试,如何看起来像在 [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts)中使用 Gravatar 示例。 +Let's see what a simple unit test would look like using the Gravatar examples in the [Demo Subgraph](https://github.com/LimeChain/demo-subgraph/blob/main/src/gravity.ts). 假设我们有以下处理程序函数(以及两个帮助函数,以使我们的生活更轻松): @@ -618,7 +618,7 @@ export function createNewGravatarEvent( } ``` -我们首先必须在项目中创建一个测试文件。这是一个示例,说明它可能是什么样子的: +We first have to create a test file in our project. This is an example of what that might look like: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -657,7 +657,7 @@ test('Next test', () => { - 我们正在设置我们的初始状态并添加一个自定义的 Gravatar 实体。 - 我们使用 `createNewGravatarEvent()` 函数定义两个`NewGravatar`事件对象及其数据; - 我们正在调用这些事件的处理方法 - `handleNewGravatars()` 并在我们的自定义事件列表中传递; -- 我们断定存储的状态。那是怎么实现的呢?- 我们传递一个实体类型和 id 的唯一组合。然后我们检查该实体的一个特定字段,并断定它具有我们期望的值。我们为我们添加到存储的初始 Gravatar 实体,以及当处理函数被调用时被添加的两个 Gravatar 实体都做这个。 +- We assert the state of the store. How does that work? - We're passing a unique combination of Entity type and id. Then we check a specific field on that Entity and assert that it has the value we expect it to have. We're doing this both for the initial Gravatar Entity we added to the store, as well as the two Gravatar entities that get added when the handler function is called; - 最后——我们正在使用 `clearStore()` 来清理内存,以便我们的下一次测试能够以一个新的和空的储存对象开始。 我们可以定义我们想要的尽可能多的试验区块。 好了,我们创建了第一个测试!👏 @@ -857,7 +857,7 @@ gravatar.save() assert.fieldEquals('Gravatar', 'gravatarId0', 'id', 'gravatarId0') ``` -正在运行assert.fieldEquals() 函数将检查给定字段的均等性与给定的预期值。 测试将失败,如果值为 **NOT** 则输出错误消息。否则测试将成功通过。 +Running the assert.fieldEquals() function will check for equality of the given field against the given expected value. The test will fail and an error message will be output if the values are **NOT** equal. Otherwise the test will pass successfully. ### 与事件元数据交互 @@ -954,7 +954,7 @@ test('Blow everything up', () => { }) ``` -记录关键错误将停止测试的执行,并使一切崩溃。毕竟,我们希望确保您的代码在部署中没有关键日志,如果发生这种情况,您应该立即注意。 +Logging critical errors will stop the execution of the tests and blow everything up. After all - we want to make sure your code doesn't have critical logs in deployment, and you should notice right away if that were to happen. ### 测试派生字段 @@ -1291,7 +1291,7 @@ test('file/ipfs dataSource creation example', () => { 使用**Matchstick**,子图开发者可以运行一个脚本,计算编写的单元测试的测试覆盖率。 -测试覆盖工具接受已编译的测试 `wasm` 二进制并将它们转换为 `wat` 文件, 然后便于检查,看看是否`subgraph.yaml`中定义的处理程序已被调用。 因为代码覆盖面(和整个测试)在 AssemblyScript 和 WebAssembly 中处于早期阶段,**Matchstick** 无法检查分支覆盖面。 相反,我们依赖的是这样一种说法:如果一个处理程序被调用了,它的事件/功能就被恰当地仿效了。 +The test coverage tool takes the compiled test `wasm` binaries and converts them to `wat` files, which can then be easily inspected to see whether or not the handlers defined in `subgraph.yaml` have been called. Since code coverage (and testing as a whole) is in very early stages in AssemblyScript and WebAssembly, **Matchstick** cannot check for branch coverage. Instead we rely on the assertion that if a given handler has been called, the event/function for it have been properly mocked. ### 先决条件 @@ -1371,6 +1371,8 @@ Global test coverage: 22.2% (2/9 handlers). 日志输出包括测试运行持续时间。下面是一个示例: + + ## 常见编译器错误 > 关键:无法从具有背景的有效模块创建WasmInstance:未知导入:wasi_snapshot_preview1::尚未定义fd_write diff --git a/website/src/pages/zh/subgraphs/developing/deploying/multiple-networks.mdx b/website/src/pages/zh/subgraphs/developing/deploying/multiple-networks.mdx index 969ec7b95d03..a772d2e49204 100644 --- a/website/src/pages/zh/subgraphs/developing/deploying/multiple-networks.mdx +++ b/website/src/pages/zh/subgraphs/developing/deploying/multiple-networks.mdx @@ -212,7 +212,7 @@ Studio中的子图版本只有在满足以下条件时才会存档: 如果子图成功同步,这是一个好信号,表明它将永远运行良好。然而,网络上的新触发器可能会导致子图遇到未经测试的错误条件,或者由于性能问题或节点操作符的问题,子图开始落后。 -Graph Node公开了一个GraphQL端点,您可以查询该端点以检查子图的状态。在托管服务上,可以在`https://api.thegraph.com/index-node/graphql`使用。在本地节点的默认情况下,在`8030/graphql`端口上可用。此端点的完整架构可以在[此处](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql)找到。以下是一个检查子图当前版本状态的示例查询: +Graph Node exposes a GraphQL endpoint which you can query to check the status of your Subgraph: `https://indexer.upgrade.thegraph.com/status`. On a local node, it is available on port `8030/graphql` by default. The full schema for this endpoint can be found [here](https://github.com/graphprotocol/graph-node/blob/master/server/index-node/src/schema.graphql). Here is an example query that checks the status of the current version of a Subgraph: ```graphql { diff --git a/website/src/pages/zh/subgraphs/developing/deploying/using-subgraph-studio.mdx b/website/src/pages/zh/subgraphs/developing/deploying/using-subgraph-studio.mdx index 889dbf99a4a8..f0f956e93dea 100644 --- a/website/src/pages/zh/subgraphs/developing/deploying/using-subgraph-studio.mdx +++ b/website/src/pages/zh/subgraphs/developing/deploying/using-subgraph-studio.mdx @@ -88,6 +88,8 @@ graph auth 一旦你准备好了,你可以将你的子图部署到子图工作室。 > 部署一个 CLI 的子图,推送它到工作室,在那里你可以测试它并更新元数据。 此操作不会将你的子图发布到去中心化的网络。 +> +> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones. 使用下面的 CLI 命令来部署您的子图: @@ -104,6 +106,8 @@ graph deploy 部署后,你可以测试你的子图(在SubgraStudio或在你自己的应用中,使用部署查询 URL), 部署另一个版本,更新元数据,并在你准备就绪时发布到 [Graph Explorer](https://thegraph.com/explorer)。 +> **Note**: The development query URL is limited to 3,000 queries per day. + 使用子图工作室检查仪表板上的日志,并查找您的子图中的任何错误。 ## 发布子图 diff --git a/website/src/pages/zh/subgraphs/developing/publishing/publishing-a-subgraph.mdx b/website/src/pages/zh/subgraphs/developing/publishing/publishing-a-subgraph.mdx index f8a85bcfc0e7..97277b99a2ff 100644 --- a/website/src/pages/zh/subgraphs/developing/publishing/publishing-a-subgraph.mdx +++ b/website/src/pages/zh/subgraphs/developing/publishing/publishing-a-subgraph.mdx @@ -53,7 +53,7 @@ USAGE FLAGS -h, --help Show CLI help. - -i, --ipfs= [default: https://api.thegraph.com/ipfs/api/v0] Upload build results to an IPFS node. + -i, --ipfs= [default: https://ipfs.thegraph.com/api/v0] Upload build results to an IPFS node. --ipfs-hash= IPFS hash of the subgraph manifest to deploy. --protocol-network=