From 60186750660b35150e9eb44542c8edea6d7daeb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Thu, 27 Jan 2022 20:33:24 -0500 Subject: [PATCH 01/47] New translations create-subgraph-hosted.mdx (Arabic) --- pages/ar/developer/create-subgraph-hosted.mdx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pages/ar/developer/create-subgraph-hosted.mdx b/pages/ar/developer/create-subgraph-hosted.mdx index 56aca0d2313e..7338fb1f1a6b 100644 --- a/pages/ar/developer/create-subgraph-hosted.mdx +++ b/pages/ar/developer/create-subgraph-hosted.mdx @@ -218,15 +218,15 @@ Null value resolved for non-null field 'name' ندعم المقاييس التالية في GraphQL API الخاصة بنا: -| النوع | الوصف | -| --- | --- | -| `Bytes` | مصفوفة Byte ، ممثلة كسلسلة سداسية عشرية. يشيع استخدامها في Ethereum hashes وعناوينه. | -| `ID` | يتم تخزينه كـ `string`. | -| `String` | لقيم `string`. لا يتم دعم اNull ويتم إزالتها تلقائيا. | -| `Boolean` | لقيم `boolean`. | -| `Int` | GraphQL spec تعرف `Int` بحجم 32 بايت. | -| `BigInt` | أعداد صحيحة كبيرة. يستخدم لأنواع Ethereum `uint32` ، `int64` ، `uint64` ، ... ، `uint256`. ملاحظة: كل شيء تحت `uint32` ، مثل `int32` أو `uint24` أو `int8` يتم تمثيله كـ `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a signficand and an exponent. يتراوح نطاق الأس من −6143 إلى +6144. مقربة إلى 34 رقما. | +| النوع | الوصف | +| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | مصفوفة Byte ، ممثلة كسلسلة سداسية عشرية. يشيع استخدامها في Ethereum hashes وعناوينه. | +| `ID` | يتم تخزينه كـ `string`. | +| `String` | لقيم `string`. لا يتم دعم اNull ويتم إزالتها تلقائيا. | +| `Boolean` | لقيم `boolean`. | +| `Int` | GraphQL spec تعرف `Int` بحجم 32 بايت. | +| `BigInt` | أعداد صحيحة كبيرة. يستخدم لأنواع Ethereum `uint32` ، `int64` ، `uint64` ، ... ، `uint256`. ملاحظة: كل شيء تحت `uint32` ، مثل `int32` أو `uint24` أو `int8` يتم تمثيله كـ `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a signficand and an exponent. يتراوح نطاق الأس من −6143 إلى +6144. مقربة إلى 34 رقما. | #### Enums @@ -627,7 +627,7 @@ export function handleNewExchange(event: NewExchange): void { ``` > ** ملاحظة: ** مصدر البيانات الجديد سيعالج فقط الاستدعاءات والأحداث للكتلة التي تم إنشاؤها فيه وجميع الكتل التالية ، ولكنه لن يعالج البيانات التاريخية ، أي البيانات الموجودة في الكتل السابقة. -> +> > إذا كانت الكتل السابقة تحتوي على بيانات ذات صلة بمصدر البيانات الجديد ، فمن الأفضل فهرسة تلك البيانات من خلال قراءة الحالة الحالية للعقد وإنشاء كيانات تمثل تلك الحالة في وقت إنشاء مصدر البيانات الجديد. ### سياق مصدر البيانات @@ -684,7 +684,7 @@ dataSources: ``` > ** ملاحظة: ** يمكن البحث عن كتلة إنشاء العقد بسرعة على Etherscan: -> +> > 1. ابحث عن العقد بإدخال عنوانه في شريط البحث. > 2. انقر فوق hash إجراء الإنشاء في قسم `Contract Creator`. > 3. قم بتحميل صفحة تفاصيل الإجراء حيث ستجد كتلة البدء لذلك العقد. From 90f580a4076d2a4483e453b7ebba8515fcf384a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Thu, 27 Jan 2022 20:33:31 -0500 Subject: [PATCH 02/47] New translations create-subgraph-hosted.mdx (Spanish) --- pages/es/developer/create-subgraph-hosted.mdx | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pages/es/developer/create-subgraph-hosted.mdx b/pages/es/developer/create-subgraph-hosted.mdx index bb9dc04a9df1..b6ab72e3db96 100644 --- a/pages/es/developer/create-subgraph-hosted.mdx +++ b/pages/es/developer/create-subgraph-hosted.mdx @@ -218,15 +218,15 @@ Cada entidad debe tener un campo `id`, que es de tipo `ID!` (string). El campo ` Admitimos los siguientes scalars en nuestra API GraphQL: -| Tipo | Descripción | -| --- | --- | -| `Bytes` | Byte array, representado como un string hexadecimal. Comúnmente utilizado para los hashes y addresses de Ethereum. | -| `ID` | Almacenado como un `string`. | -| `String` | Scalar para valores `string`. Los caracteres null no se admiten y se eliminan automáticamente. | -| `Boolean` | Scalar para valores `boolean`. | -| `Int` | The GraphQL spec define `Int` para tener un tamano de 32 bytes. | -| `BigInt` | Números enteros grandes. Usados para los tipos `uint32`, `int64`, `uint64`, ..., `uint256` de Ethereum. Nota: Todo debajo de `uint32`, como `int32`, `uint24` o `int8` es representado como `i32`. | -| `BigDecimal` | `BigDecimal` Decimales de alta precisión representados como un signo y un exponente. El rango de exponentes va de -6143 a +6144. Redondeado a 34 dígitos significativos. | +| Tipo | Descripción | +| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Bytes` | Byte array, representado como un string hexadecimal. Comúnmente utilizado para los hashes y addresses de Ethereum. | +| `ID` | Almacenado como un `string`. | +| `String` | Scalar para valores `string`. Los caracteres null no se admiten y se eliminan automáticamente. | +| `Boolean` | Scalar para valores `boolean`. | +| `Int` | The GraphQL spec define `Int` para tener un tamano de 32 bytes. | +| `BigInt` | Números enteros grandes. Usados para los tipos `uint32`, `int64`, `uint64`, ..., `uint256` de Ethereum. Nota: Todo debajo de `uint32`, como `int32`, `uint24` o `int8` es representado como `i32`. | +| `BigDecimal` | `BigDecimal` Decimales de alta precisión representados como un signo y un exponente. El rango de exponentes va de -6143 a +6144. Redondeado a 34 dígitos significativos. | #### Enums @@ -451,10 +451,10 @@ Diccionarios de idiomas admitidos: Algoritmos admitidos para ordenar los resultados: -| Algoritmos | Descripción | -| --- | --- | -| rango | Usa la calidad de coincidencia (0-1) de la consulta de texto completo para ordenar los resultados. | -| rango de Proximidad | Similar al rango, pero también incluye la proximidad de los matches. | +| Algoritmos | Descripción | +| ------------------- | -------------------------------------------------------------------------------------------------- | +| rango | Usa la calidad de coincidencia (0-1) de la consulta de texto completo para ordenar los resultados. | +| rango de Proximidad | Similar al rango, pero también incluye la proximidad de los matches. | ## Escribir Mapeos @@ -627,7 +627,7 @@ export function handleNewExchange(event: NewExchange): void { ``` > **Nota:** Un nuevo origen de datos sólo procesará las llamadas y los eventos del bloque en el que fue creado y todos los bloques siguientes, pero no procesará los datos históricos, es decir, los datos que están contenidos en bloques anteriores. -> +> > Si los bloques anteriores contienen datos relevantes para la nueva fuente de datos, lo mejor es indexar esos datos leyendo el estado actual del contrato y creando entidades que representen ese estado en el momento de crear la nueva fuente de datos. ### Contexto de la Fuente de Datos @@ -684,7 +684,7 @@ dataSources: ``` > **Nota:** El bloque de creación del contrato se puede buscar rápidamente en Etherscan: -> +> > 1. Busca el contrato introduciendo su dirección en la barra de búsqueda. > 2. Haz clic en el hash de la transacción de creación en la sección `Contract Creator`. > 3. Carga la página de detalles de la transacción, donde encontrarás el bloque inicial de ese contrato. From 0a93e2f8f8faa9f55ae70e62745c88647f0ec43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Thu, 27 Jan 2022 20:34:25 -0500 Subject: [PATCH 03/47] New translations indexing.mdx (Arabic) --- pages/ar/indexing.mdx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pages/ar/indexing.mdx b/pages/ar/indexing.mdx index e6ad889e20a5..37f35841a39b 100644 --- a/pages/ar/indexing.mdx +++ b/pages/ar/indexing.mdx @@ -115,7 +115,7 @@ query indexerAllocations { - **كبيرة** - مُعدة لفهرسة جميع ال subgraphs المستخدمة حاليا وأيضا لخدمة طلبات حركة مرور البيانات ذات الصلة. | Setup | (CPUs) | (memory in GB) | (disk in TBs) | (CPUs) | (memory in GB) | -| ----- | :----: | :------------: | :-----------: | :----: | :------------: | +| ----- |:------:|:--------------:|:-------------:|:------:|:--------------:| | صغير | 4 | 8 | 1 | 4 | 16 | | قياسي | 8 | 30 | 1 | 12 | 48 | | متوسط | 16 | 64 | 2 | 32 | 64 | @@ -149,20 +149,20 @@ query indexerAllocations { #### 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 | - | #### خدمة المفهرس -| 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 From b416cf6553d4087e405388b61e48df314ae5def6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Thu, 27 Jan 2022 20:34:29 -0500 Subject: [PATCH 04/47] New translations indexing.mdx (Japanese) --- pages/ja/indexing.mdx | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pages/ja/indexing.mdx b/pages/ja/indexing.mdx index dafa47e72922..212fc6c18b9a 100644 --- a/pages/ja/indexing.mdx +++ b/pages/ja/indexing.mdx @@ -114,12 +114,12 @@ Use Etherscan to call `getRewards()`: - **Medium** - 100 個のサブグラフと 1 秒あたり 200 ~ 500 のリクエストをサポートするプロダクションインデクサー - **Large** - 現在使用されているすべてのサブグラフのインデックスを作成し、関連するトラフィックのリクエストに対応します -| 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 | ### インデクサーが取るべきセキュリティ対策は? @@ -149,20 +149,20 @@ Use Etherscan to call `getRewards()`: #### グラフノード -| 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 From dd0684b98e45146b51146bfce2a5e2db3df81e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Thu, 27 Jan 2022 20:34:30 -0500 Subject: [PATCH 05/47] New translations indexing.mdx (Spanish) --- pages/es/indexing.mdx | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pages/es/indexing.mdx b/pages/es/indexing.mdx index 1e1c92633f0b..232a419b7148 100644 --- a/pages/es/indexing.mdx +++ b/pages/es/indexing.mdx @@ -115,11 +115,11 @@ Los indexadores pueden diferenciarse aplicando técnicas avanzadas para tomar de - **Grande**: Preparado para indexar todos los subgrafos utilizados actualmente y atender solicitudes para el tráfico relacionado. | Configuración | Postgres
(CPUs) | Postgres
(memory in GBs) | Postgres
(disk in TBs) | VMs
(CPUs) | VMs
(memory in GBs) | -| --- | :-: | :-: | :-: | :-: | :-: | -| Pequeño | 4 | 8 | 1 | 4 | 16 | -| Estándar | 8 | 30 | 1 | 12 | 48 | -| Medio | 16 | 64 | 2 | 32 | 64 | -| Grande | 72 | 468 | 3,5 | 48 | 184 | +| ------------- |:--------------------------:|:-----------------------------------:|:---------------------------------:|:---------------------:|:------------------------------:| +| Pequeño | 4 | 8 | 1 | 4 | 16 | +| Estándar | 8 | 30 | 1 | 12 | 48 | +| Medio | 16 | 64 | 2 | 32 | 64 | +| Grande | 72 | 468 | 3,5 | 48 | 184 | ### ¿Cuáles son algunas de las precauciones de seguridad básicas que debe tomar un indexador? @@ -149,24 +149,24 @@ Nota: Para admitir el escalado ágil, se recomienda que las inquietudes de consu #### Graph Node -| Puerto | Objeto | Rutas | Argumento CLI | Variable de Entorno | -| --- | --- | --- | --- | --- | -| 8000 | Servidor HTTP GraphQL
(para consultas de subgrafos) | /subgraphs/id/...
/subgraphs/name/.../... | --http-port | - | -| 8001 | GraphQL WS
(para suscripciones a subgrafos) | /subgraphs/id/...
/subgraphs/name/.../... | --ws-port | - | -| 8020 | JSON-RPC
(para administrar implementaciones) | / | --admin-port | - | -| 8030 | API de estado de indexación de subgrafos | /graphql | --index-node-port | - | -| 8040 | Métricas de Prometheus | /metrics | --metrics-port | - | +| Puerto | Objeto | Rutas | Argumento CLI | Variable de Entorno | +| ------ | ---------------------------------------------------------------- | ---------------------------------------------------- | ----------------- | ------------------- | +| 8000 | Servidor HTTP GraphQL
(para consultas de subgrafos) | /subgraphs/id/...
/subgraphs/name/.../... | --http-port | - | +| 8001 | GraphQL WS
(para suscripciones a subgrafos) | /subgraphs/id/...
/subgraphs/name/.../... | --ws-port | - | +| 8020 | JSON-RPC
(para administrar implementaciones) | / | --admin-port | - | +| 8030 | API de estado de indexación de subgrafos | /graphql | --index-node-port | - | +| 8040 | Métricas de Prometheus | /metrics | --metrics-port | - | #### Servicio de Indexador -| Puerto | Objeto | Rutas | Argumento CLI | Variable de Entorno | -| --- | --- | --- | --- | --- | -| 7600 | Servidor HTTP GraphQL
(para consultas de subgrafo pagadas) | /subgraphs/id/...
/status
/channel-messages-inbox | --port | `INDEXER_SERVICE_PORT` | -| 7300 | Métricas de Prometheus | /metrics | --metrics-port | - | +| Puerto | Objeto | Rutas | Argumento CLI | Variable de Entorno | +| ------ | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -------------- | ---------------------- | +| 7600 | Servidor HTTP GraphQL
(para consultas de subgrafo pagadas) | /subgraphs/id/...
/status
/channel-messages-inbox | --port | `INDEXER_SERVICE_PORT` | +| 7300 | Métricas de Prometheus | /metrics | --metrics-port | - | #### Agente Indexador -| Puerto | Objeto | Rutas | Argumento CLI | Variable de
Entorno | +| Puerto | Objeto | Rutas | Argumento CLI | Variable de
Entorno | | ------ | ----------------------------- | ----- | ------------------------- | --------------------------------------- | | 8000 | API de gestión de indexadores | / | --indexer-management-port | `INDEXER_AGENT_INDEXER_MANAGEMENT_PORT` | From ed96e56ddd0ac5179e3e074ad382ecfc9f34c5a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Thu, 27 Jan 2022 20:34:33 -0500 Subject: [PATCH 06/47] New translations curating.mdx (Chinese Simplified) --- pages/zh/curating.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/zh/curating.mdx b/pages/zh/curating.mdx index 774fac8c90ee..f53632ba91b8 100644 --- a/pages/zh/curating.mdx +++ b/pages/zh/curating.mdx @@ -100,5 +100,5 @@ Remember that curation is risky. 请做好你的工作,确保你在你信任 title="YouTube video player" frameBorder="0" allowFullScreen - > +> From 921b69cadd5e8b802348e44056c1eedefa144c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Thu, 27 Jan 2022 20:34:37 -0500 Subject: [PATCH 07/47] New translations explorer.mdx (Arabic) --- pages/ar/explorer.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/ar/explorer.mdx b/pages/ar/explorer.mdx index 7c9bb396474a..359c4767d952 100644 --- a/pages/ar/explorer.mdx +++ b/pages/ar/explorer.mdx @@ -11,7 +11,7 @@ title: مستكشف title="مشغل فيديو يوتيوب" frameBorder="0" allowFullScreen - > +> ## Subgraphs From e25662042b239ef7dd9d0df23323d852506a1b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:03 -0500 Subject: [PATCH 08/47] New translations create-subgraph-hosted.mdx (Chinese Simplified) --- pages/zh/developer/create-subgraph-hosted.mdx | 156 +++++++++--------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/pages/zh/developer/create-subgraph-hosted.mdx b/pages/zh/developer/create-subgraph-hosted.mdx index 1dee95ffac20..0640b9f1d675 100644 --- a/pages/zh/developer/create-subgraph-hosted.mdx +++ b/pages/zh/developer/create-subgraph-hosted.mdx @@ -1,18 +1,18 @@ --- -title: Create a Subgraph +title: 创建子图 --- -Before being able to use the Graph CLI, you need to create your subgraph in [Subgraph Studio](https://thegraph.com/studio). You will then be able to setup your subgraph project and deploy it to the platform of your choice. Note that **subgraphs that do not index Ethereum mainnet will not be published to The Graph Network**. +在能够使用 Graph CLI 之前,您需要在 [Subgraph Studio](https://thegraph.com/studio) 中创建您的子图。 然后,您将能够设置您的子图项目并将其部署到您选择的平台。 请注意,**不索引以太坊主网的子图将不会发布到 The Graph Network**。 -The `graph init` command can be used to set up a new subgraph project, either from an existing contract on any of the public Ethereum networks, or from an example subgraph. This command can be used to create a subgraph on the Subgraph Studio by passing in `graph init --product subgraph-studio`. If you already have a smart contract deployed to Ethereum mainnet or one of the testnets, bootstrapping a new subgraph from that contract can be a good way to get started. But first, a little about the networks The Graph supports. +`graph init` 命令可用于从任何公共以太坊网络上的现有合约或示例子图中设置新的子图项目。 此命令可用于通过 `graph init --product subgraph-studio` 命令在 Subgraph Studio 上创建子图。 如果您已经将智能合约部署到以太坊主网或其中一个测试网,那么从该合约中创建一个新的子图可能是一个很好的开始方式。 但我们首先介绍一下 The Graph 支持的网络。 ## 支持的网络 -The Graph Network supports subgraphs indexing mainnet Ethereum: +Graph Network 支持子图索引以太坊主网: - `mainnet` -**Additional Networks are supported in beta on the Hosted Service**: +**托管服务测试版支持的其他网络**: - `mainnet` - `kovan` @@ -44,13 +44,13 @@ The Graph Network supports subgraphs indexing mainnet Ethereum: - `aurora` - `aurora-testnet` -The Graph's Hosted Service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints. Newer networks will be marked as being in beta until the network has proven itself in terms of stability, reliability, and scalability. During this beta period, there is risk of downtime and unexpected behaviour. +Graph 的托管服务依赖于底层技术的稳定性和可靠性,即相应区块链网络提供的 JSON RPC 端点。 较新的区块链网络将被标记为处于测试阶段,直到这些网络在稳定性、可靠性和可扩展性方面证明了自己。 在此测试期间,存在停机和意外行为的风险。 -Remember that you will **not be able** to publish a subgraph that indexes a non-mainnet network to the decentralized Graph Network in [Subgraph Studio](/studio/subgraph-studio). +请记住,您将**无法**在 [Subgraph Studio](/studio/subgraph-studio)中发布将非主网网络索引到去中心化 Graph 网络的子图。 -## From An Existing Contract +## 基于现有合约 -The following command creates a subgraph that indexes all events of an existing contract. It attempts to fetch the contract ABI from Etherscan and falls back to requesting a local file path. If any of the optional arguments are missing, it takes you through an interactive form. +以下命令创建一个索引现有合约的所有事件的子图。 它尝试从 Etherscan 获取合约 ABI 并回退到请求本地文件路径。 如果缺少任何可选参数,它会带您进入交互式表单。 ```sh graph init \ @@ -61,23 +61,23 @@ graph init \ [] ``` -The `` is the ID of your subgraph in Subgraph Studio, it can be found on your subgraph details page. +`` 是您在 Subgraph Studio 中的子图 ID,可以在您的子图详细信息页面上找到。 -## From An Example Subgraph +## 基于子图示例 -The second mode `graph init` supports is creating a new project from an example subgraph. The following command does this: +`graph init` 支持的第二种模式是从示例子图创建一个新项目。 以下命令执行此操作: ``` graph init --studio ``` -The example subgraph is based on the Gravity contract by Dani Grant that manages user avatars and emits `NewGravatar` or `UpdateGravatar` events whenever avatars are created or updated. The subgraph handles these events by writing `Gravatar` entities to the Graph Node store and ensuring these are updated according to the events. The following sections will go over the files that make up the subgraph manifest for this example. +示例子图基于 Dani Grant 的 Gravity 合约,该合约管理用户头像并在创建或更新头像时发出 `NewGravatar` 或 `UpdateGravatar` 事件。 子图通过将 `Gravatar` 实体写入 Graph 节点存储并确保根据事件更新这些事件来处理这些事件。 以下部分将介绍构成此示例的子图清单的文件。 -## The Subgraph Manifest +## 子图清单文件 -The subgraph manifest `subgraph.yaml` defines the smart contracts your subgraph indexes, which events from these contracts to pay attention to, and how to map event data to entities that Graph Node stores and allows to query. The full specification for subgraph manifests can be found [here](https://github.com/graphprotocol/graph-node/blob/master/docs/subgraph-manifest.md). +子图清单 `subgraph.yaml` 定义了您的子图索引的智能合约,这些合约中需要关注的事件,以及如何将事件数据映射到 Graph节点存储并允许查询的实体。 子图清单的完整规范可以在[这里](https://github.com/graphprotocol/graph-node/blob/master/docs/subgraph-manifest.md)找到。 -For the example subgraph, `subgraph.yaml` is: +对于示例子图,`subgraph.yaml` 的内容是: ```yaml specVersion: 0.0.4 @@ -118,37 +118,37 @@ dataSources: file: ./src/mapping.ts ``` -The important entries to update for the manifest are: +清单中要更新的重要条目是: -- `description`: a human-readable description of what the subgraph is. This description is displayed by the Graph Explorer when the subgraph is deployed to the Hosted Service. +- `description`:关于子图是什么的人类可读的描述。 当子图部署到托管服务时,Graph Explorer会显示此描述。 -- `repository`: the URL of the repository where the subgraph manifest can be found. This is also displayed by the Graph Explorer. +- `repository`:可以找到子图清单的存储库的 URL。 这也由 Graph Explorer 显示。 -- `features`: a list of all used [feature](#experimental-features) names. +- `features`:所有使用的 [功能](#experimental-features) 名称的列表。 -- `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`:智能合约子图源的地址,以及要使用的智能合约的abi。 地址是可选的; 省略它允许索引来自所有合约的匹配事件。 -- `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. +- `dataSources.source.startBlock`:数据源开始索引的区块的可选编号。 在大多数情况下,我们建议使用创建合约的区块。 -- `dataSources.mapping.entities`: the entities that the data source writes to the store. The schema for each entity is defined in the the schema.graphql file. +- `dataSources.mapping.entities`:数据源写入存储的实体。 每个实体的模式在 schema.graphql 文件中定义。 -- `dataSources.mapping.abis`: one or more named ABI files for the source contract as well as any other smart contracts that you interact with from within the mappings. +- `dataSources.mapping.abis`:源合约以及您在映射中与之交互的任何其他智能合约的一个或多个命名 ABI 文件。 -- `dataSources.mapping.eventHandlers`: lists the smart contract events this subgraph reacts to and the handlers in the mapping—./src/mapping.ts in the example—that transform these events into entities in the store. +- `dataSources.mapping.eventHandlers`:列出此子图响应的智能合约事件,映射中的处理程序—示例中为./src/mapping.ts—也将这些事件转换为存储中的实体。 -- `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.callHandlers`:列出此子图响应的智能合约函数以及映射中的处理程序,该映射将输入和输出转换为函数调用到存储中的实体。 -- `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 filter can be provided with the following kinds: call`. A`call` filter will run the handler if the block contains at least one call to the data source contract. +- `dataSources.mapping.blockHandlers`:列出此子图响应的区块以及映射中的处理程序,以便在将区块附加到链时运行。 如果没有过滤器,区块处理程序将在每个块中运行。 可以为以下类型提供可选过滤器:call。 如果区块包含至少一个对数据源合约的调用,则调用过滤器将运行处理程序。 -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. +通过为每个需要将数据索引到 `dataSources` 数组的合约添加一个条目,单个子图可以索引来自多个智能合约的数据。 -The triggers for a data source within a block are ordered using the following process: +区块内数据源的触发器使用以下流程进行排序: -1. Event and call triggers are first ordered by transaction index within the block. -2. Event and call triggers with in the same transaction are ordered using a convention: event triggers first then call triggers, each type respecting the order they are defined in the manifest. -3. Block triggers are run after event and call triggers, in the order they are defined in the manifest. +1. 事件和调用触发器首先按区块内的事务索引排序。 +2. 同一事务中的事件和调用触发器使用约定进行排序:首先是事件触发器,然后是调用触发器,每种类型都遵循它们在清单中定义的顺序。 +3. 区块触发器按照它们在清单中定义的顺序,在事件和调用触发器之后运行。 -These ordering rules are subject to change. +这些排序规则可能会发生变化。 ### Getting The ABIs @@ -266,9 +266,9 @@ type TransactionReceipt @entity { } ``` -#### One-To-Many Relationships +#### 一对多关系 -Define a `TokenBalance` entity type with a required one-to-many relationship with a Token entity type: +定义一个 `TokenBalance` 实体类型,它与 Token 实体类型具有一对多关系: ```graphql type Token @entity { @@ -503,17 +503,17 @@ Every entity has to have an `id` that is unique among all entities of the same t We provide the [Graph Typescript Library](https://github.com/graphprotocol/graph-ts) which contains utilies for interacting with the Graph Node store and conveniences for handling smart contract data and entities. You can use this library in your mappings by importing `@graphprotocol/graph-ts` in `mapping.ts`. -## Code Generation +## 代码生成 -In order to make working smart contracts, events and entities easy and type-safe, the Graph CLI can generate AssemblyScript types from the subgraph's GraphQL schema and the contract ABIs included in the data sources. +为了使代码编写工作变得简单且类型安全,Graph CLI 可以从子图的 GraphQL 模式和数据源中包含的合约 ABI 生成 AssemblyScript 类型。 -This is done with +这可以通过以下命令实现 ```sh graph codegen [--output-dir ] [] ``` -but in most cases, subgraphs are already preconfigured via `package.json` to allow you to simply run one of the following to achieve the same: +但在大多数情况下,子图已经通过 `package.json` 进行了预配置,以允许您简单地运行以下命令之一来实现相同的目的: ```sh # Yarn @@ -523,7 +523,7 @@ yarn codegen npm run codegen ``` -This will generate an AssemblyScript class for every smart contract in the ABI files mentioned in `subgraph.yaml`, allowing you to bind these contracts to specific addresses in the mappings and call read-only contract methods against the block being processed. It will also generate a class for every contract event to provide easy access to event parameters as well as the block and transaction the event originated from. All of these types are written to `//.ts`. In the example subgraph, this would be `generated/Gravity/Gravity.ts`, allowing mappings to import these types with +这将为 `subgraph.yaml` 中提到的 ABI 文件中的每个智能合约生成一个 AssemblyScript 类,允许您将这些合约绑定到映射中的特定地址,并针对正在调用的块调用只读合约方法处理。 它还将为每个合约事件生成一个类,以提供对事件参数以及事件起源的块和交易的轻松访问。 所有这些类型都写入 `//.ts`。 在示例子图中,这将是 `generated/Gravity/Gravity.ts`,允许映射导入这些类型 ```javascript import { @@ -535,15 +535,15 @@ import { } from '../generated/Gravity/Gravity' ``` -In addition to this, one class is generated for each entity type in the subgraph's GraphQL schema. These classes provide type-safe entity loading, read and write access to entity fields as well as a `save()` method to write entities to store. All entity classes are written to `/schema.ts`, allowing mappings to import them with +除此之外,还会为子图的 GraphQL 模式中的每个实体类型生成一个类。 这些类提供类型安全的实体加载、对实体字段的读写访问以及一个 `save()` 方法来写入要存储的实体。 所有实体类都写入 `/schema.ts`,允许映射导入它们 ```javascript import { Gravatar } from '../generated/schema' ``` -> **Note:** The code generation must be performed again after every change to the GraphQL schema or the ABIs included in the manifest. It must also be performed at least once before building or deploying the subgraph. +> **注意:** 每次更改 GraphQL 模式文件或清单中包含的 ABI 后,都必须再次执行代码生成。 在构建或部署子图之前,它还必须至少执行一次。 -Code generation does not check your mapping code in `src/mapping.ts`. If you want to check that before trying to deploy your subgraph to the Graph Explorer, you can run `yarn build` and fix any syntax errors that the TypeScript compiler might find. +代码生成不会检查 `src/mapping.ts` 中的映射代码。 如果您想在尝试将子图部署到 Graph Explorer 之前进行检查,您可以运行 `yarn build`,并修复 TypeScript 编译器可能发现的任何语法错误。 ## Data Source Templates @@ -799,9 +799,9 @@ export function handleBlock(block: ethereum.Block): void { } ``` -## Anonymous Events +## 匿名事件 -If you need to process anonymous events in Solidity, that can be achieved by providing the topic 0 of the event, as in the example: +如果您需要在 Solidity 中处理匿名事件,可以通过提供事件的主题 0 来实现,如示例所示: ```yaml eventHandlers: @@ -810,20 +810,20 @@ eventHandlers: handler: handleGive ``` -An event will only be triggered when both the signature and topic 0 match. By default, `topic0` is equal to the hash of the event signature. +只有当签名和主题 0 都匹配时才会触发事件。 默认情况下,`topic0` 等于事件签名的哈希值。 -## Experimental features +## 实验功能 -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: +从 `specVersion` `0.0.4` 开始,子图特征必须使用它们的 < code>camelCase 名称,在清单文件顶层的 `features` 部分中显式声明,如下表所列: -| Feature | Name | +| 特征 | 名称 | | --------------------------------------------------------- | ------------------------- | | [Non-fatal errors](#non-fatal-errors) | `nonFatalErrors` | | [Full-text Search](#defining-fulltext-search-fields) | `fullTextSearch` | | [Grafting](#grafting-onto-existing-subgraphs) | `grafting` | | [IPFS on Ethereum Contracts](#ipfs-on-ethereum-contracts) | `ipfsOnEthereumContracts` | -For instance, if a subgraph uses the **Full-Text Search** and the **Non-fatal Errors** features, the `features` field in the manifest should be: +例如,如果子图使用 **Full-Text Search** 和 **Non-fatal Errors** 功能,则清单中的 `features` 字段应为: ```yaml specVersion: 0.0.4 @@ -834,27 +834,27 @@ features: dataSources: ... ``` -Note that using a feature without declaring it will incur in a **validation error** during subgraph deployment, but no errors will occur if a feature is declared but not used. +请注意,在子图部署期间使用未声明的特性会导致**验证错误**,但如果声明了特性未使用,则不会出现错误。 -### IPFS on Ethereum Contracts +### 以太坊合约上的 IPFS -A common use case for combining IPFS with Ethereum is to store data on IPFS that would be too expensive to maintain on chain, and reference the IPFS hash in Ethereum contracts. +如果将这些数据在链上维护,成本会太高,所以将 IPFS 与以太坊结合的一个常见用例是将数据存储在 IPFS 上,并在以太坊合约中引用 IPFS 哈希。 -Given such IPFS hashes, subgraphs can read the corresponding files from IPFS using `ipfs.cat` and `ipfs.map`. To do this reliably, however, it is required that these files are pinned on the IPFS node that the Graph Node indexing the subgraph connects to. In the case of the [hosted service](https://thegraph.com/hosted-service), this is [https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs/). +给定这样的 IPFS 哈希,子图可以使用 `ipfs.cat` 和 `ipfs.map` 从 IPFS 读取相应的文件。 但是,要可靠地执行此操作,需要将这些文件锚定在索引子图的Graph节点连接到的 IPFS 节点上。 对于 [托管服务](https://thegraph.com/hosted-service),这是 [https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs/)。 -> **Note:** The Graph Network does not yet support `ipfs.cat` and `ipfs.map`, and developers should not deploy subgraphs using that functionality to the network via the Studio. +> **注意:** Graph Network暂不支持`ipfs.cat`和`ipfs.map`,开发者请勿部署使用该功能的子图通过 Studio 连接到网络。 -In order to make this easy for subgraph developers, The Graph team wrote a tool for transfering files from one IPFS node to another, called [ipfs-sync](https://github.com/graphprotocol/ipfs-sync). +为了使子图开发人员更容易做到这一点,Graph 团队编写了一个工具,用于将文件从一个 IPFS 节点传输到另一个节点,称为 [ipfs-sync ](https://github.com/graphprotocol/ipfs-sync)。 -> **[Feature Management](#experimental-features):** `ipfsOnEthereumContracts` must be declared under `features` in the subgraph manifest. +> **[功能管理](#experimental-features):** `ipfsOnEthereumContracts` 必须在 图清单中`features` 下声明。 -### Non-fatal errors +### 非致命错误 -Indexing errors on already synced subgraphs will, by default, cause the subgraph to fail and stop syncing. Subgraphs can alternatively be configured to continue syncing in the presence of errors, by ignoring the changes made by the handler which provoked the error. This gives subgraph authors time to correct their subgraphs while queries continue to be served against the latest block, though the results will possibly be inconsistent due to the bug that caused the error. Note that some errors are still always fatal, to be non-fatal the error must be known to be deterministic. +默认情况下,已同步子图上的索引错误会导致子图失败并停止同步。 子图也可以配置为忽略引发错误的处理程序所做的更改, 在出现错误时继续同步。 这使子图作者有时间更正他们的子图,同时继续针对最新块提供查询,尽管由于导致错误的代码问题,结果可能会不一致。 请注意,某些错误仍然总是致命的,要成为非致命错误,首先需要确定相应的错误是确定性的错误。 -> **Note:** The Graph Network does not yet support non-fatal errors, and developers should not deploy subgraphs using that functionality to the network via the Studio. +> **注意:** Graph Network 尚不支持非致命错误,开发人员不应通过 Studio 将使用该功能的子图部署到网络。 -Enabling non-fatal errors requires setting the following feature flag on the subgraph manifest: +启用非致命错误需要在子图清单上设置以下功能标志: ```yaml specVersion: 0.0.4 @@ -864,7 +864,7 @@ features: ... ``` -The query must also opt-in to querying data with potential inconsistencies through the `subgraphError` argument. It is also recommended to query `_meta` to check if the subgraph has skipped over errors, as in the example: +查询还必须通过 `subgraphError` 参数选择查询可能存在不一致的数据。 还建议查询 `_meta` 以检查子图是否跳过错误,如示例: ```graphql foos(first: 100, subgraphError: allow) { @@ -876,7 +876,7 @@ _meta { } ``` -If the subgraph encounters an error that query will return both the data and a graphql error with the message `"indexing_error"`, as in this example response: +如果子图遇到错误,则查询将返回数据和带有消息 `"indexing_error"` 的 graphql 错误,如以下示例响应所示: ```graphql "data": { @@ -896,13 +896,13 @@ If the subgraph encounters an error that query will return both the data and a g ] ``` -### Grafting onto Existing Subgraphs +### 嫁接到现有子图 -When a subgraph is first deployed, it starts indexing events at the genesis block of the corresponding chain (or at the `startBlock` defined with each data source) In some circumstances, it is beneficial to reuse the data from an existing subgraph and start indexing at a much later block. This mode of indexing is called _Grafting_. Grafting is, for example, useful during development to get past simple errors in the mappings quickly, or to temporarily get an existing subgraph working again after it has failed. +首次部署子图时,它会在相应链的创世块(或每个数据源定义的 `startBlock` 处)开始索引事件。在某些情况下,可以使用现有的子图已经索引的数据并在更晚的区块上开始索引。 这种索引模式称为_嫁接_。 例如,嫁接在开发过程中非常有用,可以快速克服映射中的简单错误,或者在现有子图失败后暂时恢复工作。 -> **Note:** Grafting requires that the Indexer has indexed the base subgraph. It is not recommended on The Graph Network at this time, and developers should not deploy subgraphs using that functionality to the network via the Studio. +> **注意:** 嫁接需要索引器已经索引了基础子图。 目前不建议在 The Graph Network 上使用,开发人员不应通过 Studio 将使用该功能的子图部署到网络中。 -A subgraph is grafted onto a base subgraph when the subgraph manifest in `subgraph.yaml` contains a `graft` block at the toplevel: +当 `subgraph.yaml` 中的子图清单在顶层包含 `graft` 块时,子图被嫁接到基础子图: ```yaml description: ... @@ -911,18 +911,18 @@ graft: block: 7345624 # Block number ``` -When a subgraph whose manifest contains a `graft` block is deployed, Graph Node will copy the data of the `base` subgraph up to and including the given `block` and then continue indexing the new subgraph from that block on. The base subgraph must exist on the target Graph Node instance and must have indexed up to at least the given block. Because of this restriction, grafting should only be used during development or during an emergency to speed up producing an equivalent non-grafted subgraph. +当部署其清单包含 `graft` 块的子图时,Graph节点将复制 `base` 子图的数据,直到并包括给定的 `block`,然后继续从该块开始索引新子图。 基础子图必须存在于目标图节点实例上,并且必须至少索引到给定块。 由于这个限制,嫁接只能在开发期间或紧急情况下使用,以加快生成等效的非嫁接子图。 -Because grafting copies rather than indexes base data it is much quicker in getting the subgraph to the desired block than indexing from scratch, though the initial data copy can still take several hours for very large subgraphs. While the grafted subgraph is being initialized, the Graph Node will log information about the entity types that have already been copied. +因为嫁接是拷贝而不是索引基础数据,所以子图同步到所需块比从头开始索引要快得多,尽管对于非常大的子图,初始数据拷贝仍可能需要几个小时。 在初始化嫁接子图时,Graph节点将记录有关已复制的实体类型的信息。 -The grafted subgraph can use a GraphQL schema that is not identical to the one of the base subgraph, but merely compatible with it. It has to be a valid subgraph schema in its own right but may deviate from the base subgraph's schema in the following ways: +嫁接的子图可以使用与基础子图不同的 GraphQL 模式,但仅与之兼容。 它本身必须是一个有效的子图模式,但可能会以下列方式偏离基础子图的模式: -- It adds or removes entity types -- It removes attributes from entity types -- It adds nullable attributes to entity types -- It turns non-nullable attributes into nullable attributes -- It adds values to enums -- It adds or removes interfaces -- It changes for which entity types an interface is implemented +- 它添加或删除实体类型 +- 它从实体类型中删除属性 +- 它将可为空的属性添加到实体类型 +- 它将不可为空的属性转换为可空的属性 +- 它将值添加到枚举类型中 +- 它添加或删除接口 +- 它改变了实现接口的实体类型 -> **[Feature Management](#experimental-features):** `grafting` must be declared under `features` in the subgraph manifest. +> **[特征管理](#experimental-features):** `grafting`必须在子图清单中的`features`下声明。 From f23c9f556fb71a97d609afabfaf85053b718caca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:06 -0500 Subject: [PATCH 09/47] New translations define-subgraph-hosted.mdx (Arabic) --- pages/ar/developer/define-subgraph-hosted.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/ar/developer/define-subgraph-hosted.mdx b/pages/ar/developer/define-subgraph-hosted.mdx index 5b6e87beb774..495b7298e6b9 100644 --- a/pages/ar/developer/define-subgraph-hosted.mdx +++ b/pages/ar/developer/define-subgraph-hosted.mdx @@ -12,7 +12,7 @@ title: تعريف Subgraph - `schema.graphql`: مخطط GraphQL يحدد البيانات المخزنة في Subgraph وكيفية الاستعلام عنها عبر GraphQL -- `AssemblyScript Mappings`: [AssemblyScript](https://github.com/AssemblyScript/assemblyscript) code that translates from the event data to the entities defined in your schema (e.g. `mapping.ts` in this tutorial) +- `AssemblyScript Mappings`: [AssemblyScript](https://github.com/AssemblyScript/assemblyscript) كود يترجم من بيانات الحدث إلى الكيانات المعرفة في مخططك (مثل`mapping.ts` في هذا الدرس) قبل الخوض في التفاصيل حول محتويات ملف manifest ، تحتاج إلى تثبيت [Graph CLI](https://github.com/graphprotocol/graph-cli) والذي سوف تحتاجه لبناء ونشر Subgraph. From 75207d493b2d6b3c5c99928bf2ddab74ade1245c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:07 -0500 Subject: [PATCH 10/47] New translations define-subgraph-hosted.mdx (Japanese) --- pages/ja/developer/define-subgraph-hosted.mdx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pages/ja/developer/define-subgraph-hosted.mdx b/pages/ja/developer/define-subgraph-hosted.mdx index 92bf5bd8cd2f..7f996a3e46a6 100644 --- a/pages/ja/developer/define-subgraph-hosted.mdx +++ b/pages/ja/developer/define-subgraph-hosted.mdx @@ -1,26 +1,26 @@ --- -title: Define a Subgraph +title: サブグラフの定義 --- -A subgraph defines which data The Graph will index from Ethereum, and how it will store it. Once deployed, it will form a part of a global graph of blockchain data. +サブグラフとは、The GraphがEthereumからどのデータをインデックス化し、どのように保存するかを定義するものです。展開されると、ブロックチェーンデータのグローバルグラフの一部を形成することになります。 -![Define a Subgraph](/img/define-subgraph.png) +![サブグラフの定義](/img/define-subgraph.png) -The subgraph definition consists of a few files: +サブグラフの定義は、いくつかのファイルで構成されています。 -- `subgraph.yaml`: a YAML file containing the subgraph manifest +- `subgraph.yaml`:サブグラフのマニフェストを含むYAMLファイル -- `schema.graphql`: a GraphQL schema that defines what data is stored for your subgraph, and how to query it via GraphQL +- `schema.graphql`: サブグラフにどのようなデータが保存されているか、またGraphQLを使ってどのようにクエリを行うかを定義するGraphQLスキーマ -- `AssemblyScript Mappings`: [AssemblyScript](https://github.com/AssemblyScript/assemblyscript) code that translates from the event data to the entities defined in your schema (e.g. `mapping.ts` in this tutorial) +- `AssemblyScript Mappings`: イベントデータをスキーマで定義されたエンティティに変換する[AssemblyScript](https://github.com/AssemblyScript/assemblyscript)コード (例: このチュートリアルでは`mapping.ts`) -Before you go into detail about the contents of the manifest file, you need to install the [Graph CLI](https://github.com/graphprotocol/graph-cli) which you will need to build and deploy a subgraph. +マニフェスト・ファイルの内容を詳しく説明する前に、サブグラフを構築してデプロイするために必要な [Graph CLI](https://github.com/graphprotocol/graph-cli)をインストールする必要があります。 -## Install the Graph CLI +## Graph CLIのインストール -The Graph CLI is written in JavaScript, and you will need to install either `yarn` or `npm` to use it; it is assumed that you have yarn in what follows. +Graph CLIはJavaScriptで書かれており、使用するには`yarn`または `npm`のいずれかをインストールする必要があります。 -Once you have `yarn`, install the Graph CLI by running +`yarn`をインストールしたら、次のコマンドを実行してGraph CLIをインストールする。 **Install with yarn:** From 31eee5e5e3033644a67890c2bdae10a9b7d233da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:11 -0500 Subject: [PATCH 11/47] New translations deprecating-a-subgraph.mdx (Japanese) --- pages/ja/developer/deprecating-a-subgraph.mdx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pages/ja/developer/deprecating-a-subgraph.mdx b/pages/ja/developer/deprecating-a-subgraph.mdx index f8966e025c13..b40a43969b8b 100644 --- a/pages/ja/developer/deprecating-a-subgraph.mdx +++ b/pages/ja/developer/deprecating-a-subgraph.mdx @@ -1,17 +1,17 @@ --- -title: Deprecating a Subgraph +title: サブグラフの非推奨化 --- -So you'd like to deprecate your subgraph on The Graph Explorer. You've come to the right place! Follow the steps below: +The Graph Explorerのサブグラフを非推奨にしたい場合について。以下の手順に従ってください: -1. Visit the contract address [here](https://etherscan.io/address/0xadca0dd4729c8ba3acf3e99f3a9f471ef37b6825#writeProxyContract) -2. Call 'deprecateSubgraph' with your own address as the first parameter -3. In the 'subgraphNumber' field, list 0 if it's the first subgraph you're publishing, 1 if it's your second, 2 if it's your third, etc. -4. Inputs for #2 and #3 can be found in your `` which is composed of the `{graphAccount}-{subgraphNumber}`. For example, the [Sushi Subgraph's](https://thegraph.com/explorer/subgraph?id=0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0&version=0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0-0&view=Overview) ID is `<0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0>`, which is a combination of `graphAccount` = `<0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0>` and `subgraphNumber` = `<0>` -5. Voila! Your subgraph will no longer show up on searches on The Graph Explorer. Please note the following: +1. コントラクトアドレスは[こちら](https://etherscan.io/address/0xadca0dd4729c8ba3acf3e99f3a9f471ef37b6825#writeProxyContract) +2. 自分のアドレスを第一パラメータとして'deprecateSubgraph'を呼び出します。 +3. subgraphNumber'フィールドに、公開する最初のサブグラフであれば0、2番目であれば1、3番目であれば2、などと入力します。 +4. 2と3の入力は `{graphAccount}-{subgraphNumber}`で構成される``にあります。例えば、[Sushi Subgraph's](https://thegraph.com/explorer/subgraph?id=0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0&version=0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0-0&view=Overview) のIDは`<0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0>`で、`graphAccount` = `<0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0>`と`subgraphNumber` = `<0>`の組み合わせになります。 +5. これで完成です。The Graph Explorerの検索で、あなたのサブグラフが表示されなくなります。以下の点にご注意ください: -- Curators will not be able to signal on the subgraph anymore -- Curators that already signaled on the subgraph will be able to withdraw their signal at an average share price -- Deprecated subgraphs will be indicated with an error message. +- キュレーターは、サブグラフにシグナルを送ることができなくなります。 +- すでにサブグラフにシグナルを送っているキュレーターは、平均株価でシグナルを取り消すことができます。 +- 非推奨のサブグラフは、エラーメッセージで表示されます。 -If you interacted with the now deprecated subgraph, you'll be able to find it in your user profile under the "Subgraphs", "Indexing", or "Curating" tab respectively. +非推奨となったサブグラフを利用していた場合は、ユーザープロファイルの「サブグラフ」「インデックス」「キュレーション」タブでそれぞれ確認することができます。 From 8737d2e80ca4f80f415d65e7fe92386201bf3335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:16 -0500 Subject: [PATCH 12/47] New translations developer-faq.mdx (Arabic) --- pages/ar/developer/developer-faq.mdx | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pages/ar/developer/developer-faq.mdx b/pages/ar/developer/developer-faq.mdx index 670d557c121c..506a04f298b3 100644 --- a/pages/ar/developer/developer-faq.mdx +++ b/pages/ar/developer/developer-faq.mdx @@ -133,40 +133,40 @@ curl -X POST -d '{ "query": "{indexingStatusForCurrentVersion(subgraphName: \"or - Optimism - (Optimism Testnet (on Kovan -There is work in progress towards integrating other blockchains, you can read more in our repo: [RFC-0003: Multi-Blockchain Support](https://github.com/graphprotocol/rfcs/pull/8/files). +هناك عمل قيد التقدم من أجل دمج ال blockchain الأخرى ، يمكنك قراءة المزيد في repo الخاص بنا: [ RFC-0003: دعم Multi-Blockchain ](https://github.com/graphprotocol/rfcs/pull/8/files). -### 20. Is it possible to duplicate a subgraph to another account or endpoint without redeploying? +### 20. هل من الممكن نسخ الsubgraph إلى حساب آخر أو إلى endpoint دون إعادة التوزيع؟ -You have to redeploy the subgraph, but if the subgraph ID (IPFS hash) doesn't change, it won't have to sync from the beginning. +يجب عليك إعادة نشر ال Subgraph ، ولكن إذا لم يتغير (subgraph ID (IPFS hash ، فلن تضطر إلى المزامنة من البداية. -### 21. Is this possible to use Apollo Federation on top of graph-node? +### 21. هل من الممكن استخدام Apollo Federation أعلى graph-node؟ -Federation is not supported yet, although we do want to support it in the future. At the moment, something you can do is use schema stitching, either on the client or via a proxy service. +لم يتم دعم Federation بعد ، على الرغم من أننا نريد دعمه في المستقبل. في الوقت الحالي ، الذي يمكنك القيام به هو استخدام schema stitching ، إما على client أو عبر خدمة البروكسي. -### 22. Is there a limit to how many objects The Graph can return per query? +### 22. هل يوجد حد معين لعدد العناصر(objects) التي يمكن ل TheGraph إرجاعها لكل استعلام؟ -By default query responses are limited to 100 items per collection. If you want to receive more, you can go up to 1000 items per collection and beyond that you can paginate with: +بشكل افتراضي ، تقتصر ردود الاستعلام على 100 عنصر لكل مجموعة. فإذا كنت ترغب في تلقي المزيد ، فيمكنك زيادة ما يصل إلى 1000 عنصر لكل مجموعة وما بعد ذلك يمكنك ترقيم الصفحات باستخدام: ```graphql someCollection(first: 1000, skip: ) { ... } ``` -### 23. If my dapp frontend uses The Graph for querying, do I need to write my query key into the frontend directly? What if we pay query fees for users – will malicious users cause our query fees to be very high? +### 23. إذا كانت الواجهة الأمامية ل dapp الخاصة بي تستخدم TheGraph للاستعلام ، فهل أحتاج إلى كتابة مفتاح الاستعلام الخاص بي في الواجهة الأمامية مباشرةً؟ وماذا لو دفعنا رسوم الاستعلام للمستخدمين - هل سيتسبب المستخدمون الخبثاء في أن تكون رسوم الاستعلام عالية جدًا؟ -Currently, the recommended approach for a dapp is to add the key to the frontend and expose it to end users. That said, you can limit that key to a host name, like _yourdapp.io_ and subgraph. The gateway is currently being run by Edge & Node. Part of the responsibility of a gateway is to monitor for abusive behavior and block traffic from malicious clients. +في الوقت الحالي ، تتمثل الطريقة الموصى بها لتطبيق dapp في إضافة المفتاح إلى الواجهة الأمامية وكشفه للمستخدمين. ومع ذلك ، يمكنك تقييد هذا المفتاح باسم مضيف ، مثل_yourdapp.io_ و Subgraph. يتم تشغيل gateway حاليا بواسطة Edge&؛ Node. جزء من مسؤولية gateway هي مراقبة السلوك المسيء وحظر حركة البيانات من العملاء الضارين. -### 24. Where do I go to find my current subgraph on the Hosted Service? +### 24. كيف يمكنني للعثور على ال Subgraph الحالي الخاص بي في Hosted Service؟ -Head over to the Hosted Service in order to find subgraphs that you or others deployed to the Hosted Service. You can find it [here.](https://thegraph.com/hosted-service) +توجه إلى Hosted Service للعثور على ال Subgraphs التي نشرتها أنت أو الآخرين في ال Hosted Service. يمكنك العثور عليه [ هنا. ](https://thegraph.com/hosted-service) -### 25. Will the Hosted Service start charging query fees? +### 25. هل ستبدأ ال Hosted service في فرض رسوم الاستعلام؟ -The Graph will never charge for the Hosted Service. The Graph is a decentralized protocol, and charging for a centralized service is not aligned with The Graph’s values. The Hosted Service was always a temporary step to help get to the decentralized network. Developers will have a sufficient amount of time to migrate to the decentralized network as they are comfortable. +لن يقوم TheGraph بفرض رسوم على Hosted Service أبدًا. و TheGraph عبارة عن بروتوكول لامركزي ، ولا يتماشى فرض رسوم على خدمة مركزية مع قيم TheGraph. وال Hosted Service خطوة مؤقتة للمساعدة في الوصول إلى الشبكة اللامركزية. وسيكون لدى المطورين وقت كافٍ للانتقال إلى الشبكة اللامركزية. -### 26. When will the Hosted Service be shut down? +### 26. متى سيتم إيقاف تشغيل الخدمة المستضافة؟ -If and when there are plans to do this, the community will be notified well ahead of time with considerations made for any subgraphs built on the Hosted Service. +عندما نخطط لذلك ، فسيتم اعلامكم مسبقًا بوقت كافٍ مع مراعاة أي Subgraph مبنية على ال Hosted service. -### 27. How do I upgrade a subgraph on mainnet? +### 27. كيف يمكنني ترقية ال subgraph على mainnet؟ -If you’re a subgraph developer, you can upgrade a new version of your subgraph to the Studio using the CLI. It’ll be private at that point but if you’re happy with it, you can publish to the decentralized Graph Explorer. This will create a new version of your subgraph that Curators can start signaling on. +إذا كنت مطور ل Subgraph ، فيمكنك ترقية إصدار جديد من ال Subgraph إلى Studio وذلك باستخدام CLI. ستكون خاصة في تلك المرحلة ولكن إذا كنت راضيًا عنها ، يمكنك نشرها إلى Graph Explorer اللامركزي. وسيؤدي هذا إلى إنشاء نسخة جديدة من subgraph الخاص بك حيث يمكن للمنسقين بدء الإشارة إليه. From 515f99b811e11301385975667f67461d8f8aa740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:18 -0500 Subject: [PATCH 13/47] New translations developer-faq.mdx (Japanese) --- pages/ja/developer/developer-faq.mdx | 122 +++++++++++++-------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/pages/ja/developer/developer-faq.mdx b/pages/ja/developer/developer-faq.mdx index 41449c60e5ab..e467d956699f 100644 --- a/pages/ja/developer/developer-faq.mdx +++ b/pages/ja/developer/developer-faq.mdx @@ -1,70 +1,70 @@ --- -title: Developer FAQs +title: 開発者向けFAQ --- -### 1. Can I delete my subgraph? +### 1. 作成したサブグラフを削除できますか? -It is not possible to delete subgraphs once they are created. +一度作成したサブグラフの削除はできません。 -### 2. Can I change my subgraph name? +### 2. サブグラフの名前は変更できますか? -No. Once a subgraph is created, the name cannot be changed. Make sure to think of this carefully before you create your subgraph so it is easily searchable and identifiable by other dapps. +一度作成したサブグラフの名前を変更することはできません。サブグラフを作成する際には、他のdappsから検索しやすく、識別しやすい名前になるよう、よく考えてから作成してください。 -### 3. Can I change the GitHub account associated with my subgraph? +### 3. サブグラフに関連するGitHubアカウントは変更できますか? -No. Once a subgraph is created, the associated GitHub account cannot be changed. Make sure to think of this carefully before you create your subgraph. +一度作成したサブグラフに関連するGitHubのアカウントは変更できません。サブグラフを作成する前に、この点をよく考えてください。 -### 4. Am I still able to create a subgraph if my smart contracts don't have events? +### 4. スマートコントラクトにイベントがない場合でも、サブグラフを作成できますか? -It is highly recommended that you structure your smart contracts to have events associated with data you are interested in querying. Event handlers in the subgraph are triggered by contract events, and are by far the fastest way to retrieve useful data. +スマートコントラクトを構成して、クエリしたいデータに関連するイベントを持つことを強くお勧めします。サブグラフ内のイベントハンドラは、コントラクトのイベントによってトリガされ、有用なデータを取得するための圧倒的に速い方法です。 -If the contracts you are working with do not contain events, your subgraph can use call and block handlers to trigger indexing. Although this is not recommended as performance will be significantly slower. +使用しているコントラクトにイベントが含まれていない場合、サブグラフはコールハンドラとブロックハンドラを使用してインデックス作成をトリガすることができます。しかし、パフォーマンスが大幅に低下するため、これは推奨されません。 -### 5. Is it possible to deploy one subgraph with the same name for multiple networks? +### 5. 同じ名前のサブグラフを複数のネットワークに配置することは可能ですか? -You will need separate names for multiple networks. While you can't have different subgraphs under the same name, there are convenient ways of having a single codebase for multiple networks. Find more on this in our documentation: [Redeploying a Subgraph](/hosted-service/deploy-subgraph-hosted#redeploying-a-subgraph) +複数のネットワークには別々の名前が必要です。同じ名前で異なるサブグラフを持つことはできませんが、単一のコードベースで複数のネットワークに対応する便利な方法があります。詳しくはドキュメントをご覧ください: [Redeploying a Subgraph](/hosted-service/deploy-subgraph-hosted#redeploying-a-subgraph) -### 6. How are templates different from data sources? +### 6. テンプレートとデータソースはどう違うのですか? -Templates allow you to create data sources on the fly, while your subgraph is indexing. It might be the case that your contract will spawn new contracts as people interact with it, and since you know the shape of those contracts (ABI, events, etc) up front you can define how you want to index them in a template and when they are spawned your subgraph will create a dynamic data source by supplying the contract address. +テンプレートは、サブグラフがインデックスを作成している間に、その場でデータソースを作成することができます。また、コントラクトの形状(ABI、イベントなど)を前もって知っているので、テンプレートでどのようにインデックスを作成するかを定義することができ、コントラクトが作成されると、サブグラフはコントラクトのアドレスを供給することで動的なデータソースを作成します。 -Check out the "Instantiating a data source template" section on: [Data Source Templates](/developer/create-subgraph-hosted#data-source-templates). +データソース・テンプレートのインスタンス化」のセクションをご覧ください: [Data Source Templates](/developer/create-subgraph-hosted#data-source-templates) -### 7. How do I make sure I'm using the latest version of graph-node for my local deployments? +### 7. 最新版のgraph-nodeを使用していることを確認する方法はありますか? -You can run the following command: +以下のコマンドを実行してください: ```sh docker pull graphprotocol/graph-node:latest ``` -**NOTE:** docker / docker-compose will always use whatever graph-node version was pulled the first time you ran it, so it is important to do this to make sure you are up to date with the latest version of graph-node. +**注:** docker / docker-composeは、最初に実行したときにプルされたgraph-nodeのバージョンを常に使用しますので、最新版のgraph-nodeを使用していることを確認するために、このコマンドを実行することが重要です。 -### 8. How do I call a contract function or access a public state variable from my subgraph mappings? +### 8. サブグラフ・マッピングからコントラクト関数を呼び出したり、パブリック・ステート変数にアクセスするにはどうすればいいですか? -Take a look at `Access to smart contract` state inside the section [AssemblyScript API](/developer/assemblyscript-api). +[AssemblyScript API](/developer/assemblyscript-api)内の`Access to smart contract`セクションをご参照ください。 -### 9. Is it possible to set up a subgraph using `graph init` from `graph-cli` with two contracts? Or should I manually add another datasource in `subgraph.yaml` after running `graph init`? +### 9. 2つのコントラクトで`graph-cli`の`graph init` を使ってサブグラフをセットアップすることは可能ですか?それとも、`graph init`を実行した後、`subgraph.yaml`に別のデータソースを手動で追加する必要がありますか? -Unfortunately this is currently not possible. `graph init` is intended as a basic starting point, from which you can then add more data sources manually. +`graph init`は基本的な出発点として意図されており、そこから手動でデータソースを追加することができます。 -### 10. I want to contribute or add a GitHub issue, where can I find the open source repositories? +### 10. GitHubの課題に貢献したいのですが、オープンソースのリポジトリはどこにありますか? - [graph-node](https://github.com/graphprotocol/graph-node) - [graph-cli](https://github.com/graphprotocol/graph-cli) - [graph-ts](https://github.com/graphprotocol/graph-ts) -### 11. What is the recommended way to build "autogenerated" ids for an entity when handling events? +### 11. イベントを処理する際に、エンティティの "自動生成された "Idを構築する推奨される方法は何ですか? -If only one entity is created during the event and if there's nothing better available, then the transaction hash + log index would be unique. You can obfuscate these by converting that to Bytes and then piping it through `crypto.keccak256` but this won't make it more unique. +もし、イベント中に1つのエンティティしか作成されず、他に利用できるものがなければ、トランザクションハッシュ+ログインデックスがユニークになります。Bytesに変換して`crypto.keccak256`に通すことで難読化することができますが、これでは一意性は高まりません。 -### 12. When listening to multiple contracts, is it possible to select the contract order to listen to events? +### 12. 複数のコントラクトをリスニングする際、イベントをリスニングするコントラクトの順番を選択することは可能ですか? -Within a subgraph, the events are always processed in the order they appear in the blocks, regardless of whether that is across multiple contracts or not. +サブグラフ内では、複数のコントラクトにまたがっているかどうかにかかわらず、イベントは常にブロックに表示される順序で処理されます。 -### 13. Is it possible to differentiate between networks (mainnet, Kovan, Ropsten, local) from within event handlers? +### 13. イベントハンドラ内からネットワーク(mainnet, Kovan, Ropsten, local)を区別することは可能ですか? -Yes. You can do this by importing `graph-ts` as per the example below: +はい、以下の例のように`graph-ts`をインポートすることで可能です。 ```javascript import { dataSource } from '@graphprotocol/graph-ts' @@ -73,39 +73,39 @@ dataSource.network() dataSource.address() ``` -### 14. Do you support block and call handlers on Rinkeby? +### 14. Rinkebyでは、ブロックハンドラやコールハンドラをサポートしていますか? -On Rinkeby we support block handlers, but without `filter: call`. Call handlers are not supported for the time being. +Rinkebyではブロックハンドラーをサポートしていますが、`filter: call`はサポートしていません。コールハンドラーは当面サポートしていません。 -### 15. Can I import ethers.js or other JS libraries into my subgraph mappings? +### 15. サブグラフのマッピングにethers.jsや他のJSライブラリをインポートできますか? -Not currently, as mappings are written in AssemblyScript. One possible alternative solution to this is to store raw data in entities and perform logic that requires JS libraries on the client. +マッピングはAssemblyScriptで書かれているため、現在はできません。代替案としては、生データをエンティティに格納し、JSライブラリを必要とするロジックをクライアントで実行することが考えられます。 -### 16. Is it possible to specifying what block to start indexing on? +### 16. インデックス作成を開始するブロックを指定することはできますか? -Yes. `dataSources.source.startBlock` in the `subgraph.yaml` file specifies the 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: Start blocks +はい。`subgraph.yaml`ファイルの`dataSources.source.startBlock`は、データソースがインデックス作成を開始するブロックの番号を指定します。ほとんどの場合、コントラクトが作成されたブロックを使用することをお勧めします。開始ブロック -### 17. Are there some tips to increase performance of indexing? My subgraph is taking a very long time to sync. +### 17. インデックス作成のパフォーマンスを向上させるためのヒントはありますか? -Yes, you should take a look at the optional start block feature to start indexing from the block that the contract was deployed: [Start blocks](/developer/create-subgraph-hosted#start-blocks) +はい、コントラクトがデプロイされたブロックからインデックス作成を開始するオプションのスタートブロック機能をご利用ください: [Start blocks](/developer/create-subgraph-hosted#start-blocks) -### 18. Is there a way to query the subgraph directly to determine what the latest block number it has indexed? +### 18. サブグラフに直接クエリして、インデックスを作成した最新のブロック番号を確認する方法はありますか? -Yes! Try the following command, substituting "organization/subgraphName" with the organization under it is published and the name of your subgraph: +はい、あります。organization/subgraphName」を公開先の組織とサブグラフの名前に置き換えて、以下のコマンドを実行してみてください: ```sh curl -X POST -d '{ "query": "{indexingStatusForCurrentVersion(subgraphName: \"organization/subgraphName\") { chains { latestBlock { hash number }}}}"}' https://api.thegraph.com/index-node/graphql ``` -### 19. What networks are supported by The Graph? +### 19. the Graphがサポートするネットワークは? -The graph-node supports any EVM-compatible JSON RPC API chain. +グラフノードは、EVMと互換性のあるJSON RPC APIチェーンをサポートしています。 -The Graph Network supports subgraphs indexing mainnet Ethereum: +なた、グラフネットワークは、イーサリアム・メインネットをインデックス化したサブグラフをサポートしています。 -- `mainnet` +- `メインネット` -In the Hosted Service, the following networks are supported: +ホステッドサービスでは、以下のネットワークをサポートしています: - Ethereum mainnet - Kovan @@ -133,40 +133,40 @@ In the Hosted Service, the following networks are supported: - Optimism - Optimism Testnet (on Kovan) -There is work in progress towards integrating other blockchains, you can read more in our repo: [RFC-0003: Multi-Blockchain Support](https://github.com/graphprotocol/rfcs/pull/8/files). +他のブロックチェーンとの統合に向けた作業が進行中で、詳細はレポでご覧いただけます。RFC-0003を参照してください: [RFC-0003: Multi-Blockchain Support](https://github.com/graphprotocol/rfcs/pull/8/files) -### 20. Is it possible to duplicate a subgraph to another account or endpoint without redeploying? +### 20. 再デプロイせずに、サブグラフを別のアカウントやエンドポイントに複製することは可能ですか? -You have to redeploy the subgraph, but if the subgraph ID (IPFS hash) doesn't change, it won't have to sync from the beginning. +サブグラフを再デプロイする必要がありますが、サブグラフのID(IPFSハッシュ)が変わらなければ、最初から同期する必要はありません。 -### 21. Is this possible to use Apollo Federation on top of graph-node? +### 21. graph-nodeの上にApollo Federationを使用することは可能ですか? -Federation is not supported yet, although we do want to support it in the future. At the moment, something you can do is use schema stitching, either on the client or via a proxy service. +将来的にはサポートしたいと考えていますが、フェデレーションはまだサポートされていません。現時点でできることは、クライアント上またはプロキシサービス経由でスキーマステッチを使用することです。 -### 22. Is there a limit to how many objects The Graph can return per query? +### 22. The Graphが1回のクエリで返すオブジェクトの数に制限はありますか? -By default query responses are limited to 100 items per collection. If you want to receive more, you can go up to 1000 items per collection and beyond that you can paginate with: +デフォルトでは、クエリの応答は1つのコレクションにつき100アイテムに制限されています。それ以上の数を受け取りたい場合は、1コレクションあたり1000アイテムまで、それ以上は以下のようにページネーションすることができます: ```graphql someCollection(first: 1000, skip: ) { ... } ``` -### 23. If my dapp frontend uses The Graph for querying, do I need to write my query key into the frontend directly? What if we pay query fees for users – will malicious users cause our query fees to be very high? +### 23. dappのフロントエンドがThe Graphを使ってクエリを行う場合、クエリキーをフロントエンドに直接書き込む必要がありますか?また、ユーザーにクエリ料を支払う場合、悪意のあるユーザーがいるとクエリ料が非常に高くなってしまうのではないでしょうか? -Currently, the recommended approach for a dapp is to add the key to the frontend and expose it to end users. That said, you can limit that key to a host name, like _yourdapp.io_ and subgraph. The gateway is currently being run by Edge & Node. Part of the responsibility of a gateway is to monitor for abusive behavior and block traffic from malicious clients. +現時点では、フロントエンドにキーを追加し、それをエンドユーザーに公開することが、dappの推奨するアプローチです。とはいえ、 _yourdapp.io_やsubgraphのように、そのキーをホスト名に限定することもできます。ゲートウェイは現在、Edge&Nodeが運営しています。ゲートウェイの責任の一つは、不正な行為を監視し、悪意のあるクライアントからのトラフィックをブロックすることです。 -### 24. Where do I go to find my current subgraph on the Hosted Service? +### 24. ホステッドサービスの現在のサブグラフはどこで確認できますか? -Head over to the Hosted Service in order to find subgraphs that you or others deployed to the Hosted Service. You can find it [here.](https://thegraph.com/hosted-service) +あなたや他の人がホステッドサービスにデプロイしたサブグラフを見つけるために、ホステッドサービスに向かってください。[こちら](https://thegraph.com/hosted-service)で見つけることができます。 -### 25. Will the Hosted Service start charging query fees? +### 25. ホステッドサービスでは、クエリ料が発生しますか? -The Graph will never charge for the Hosted Service. The Graph is a decentralized protocol, and charging for a centralized service is not aligned with The Graph’s values. The Hosted Service was always a temporary step to help get to the decentralized network. Developers will have a sufficient amount of time to migrate to the decentralized network as they are comfortable. +The Graphは、ホステッドサービスに対して課金することはありません。The Graphは非中央集権的なプロトコルであり、中央集権的なサービスに課金することはThe Graphの価値観に合致しません。ホステッドサービスは常に、分散型ネットワークに移行するための一時的なステップでした。開発者には十分な時間があるので、安心して分散型ネットワークに移行することができます。 -### 26. When will the Hosted Service be shut down? +### 26. ホステッドサービスはいつ終了しますか? -If and when there are plans to do this, the community will be notified well ahead of time with considerations made for any subgraphs built on the Hosted Service. +そのような計画がある場合は、ホステッドサービス上に構築されたサブグラフを考慮して、十分に前もってコミュニティに通知されます。 -### 27. How do I upgrade a subgraph on mainnet? +### 27. メインネット上のサブグラフをアップグレードするには? -If you’re a subgraph developer, you can upgrade a new version of your subgraph to the Studio using the CLI. It’ll be private at that point but if you’re happy with it, you can publish to the decentralized Graph Explorer. This will create a new version of your subgraph that Curators can start signaling on. +サブグラフの開発者であれば、CLIを使ってサブグラフの新バージョンをスタジオにアップグレードすることができます。その時点では非公開ですが、満足できるものであれば、分散化されたGraph Explorerに公開することができます。これにより、キュレーターがシグナリングを開始できるサブグラフの新バージョンが作成されます。 From 8de4085d4060fcc3853e2376907c50038b76bf27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:20 -0500 Subject: [PATCH 14/47] New translations developer-faq.mdx (Chinese Simplified) --- pages/zh/developer/developer-faq.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/zh/developer/developer-faq.mdx b/pages/zh/developer/developer-faq.mdx index 41449c60e5ab..f6232721d50f 100644 --- a/pages/zh/developer/developer-faq.mdx +++ b/pages/zh/developer/developer-faq.mdx @@ -101,7 +101,7 @@ curl -X POST -d '{ "query": "{indexingStatusForCurrentVersion(subgraphName: \"or The graph-node supports any EVM-compatible JSON RPC API chain. -The Graph Network supports subgraphs indexing mainnet Ethereum: +Graph Network 支持子图索引以太坊主网: - `mainnet` From 958d70fff6dcf3b6cfd852550395a3a312ff5f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:24 -0500 Subject: [PATCH 15/47] New translations create-subgraph-hosted.mdx (Arabic) --- pages/ar/developer/create-subgraph-hosted.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/ar/developer/create-subgraph-hosted.mdx b/pages/ar/developer/create-subgraph-hosted.mdx index 7338fb1f1a6b..d9eb33524e35 100644 --- a/pages/ar/developer/create-subgraph-hosted.mdx +++ b/pages/ar/developer/create-subgraph-hosted.mdx @@ -8,7 +8,7 @@ title: إنشاء الـ Subgraph ## الشبكات المدعومة -The Graph Network supports subgraphs indexing mainnet Ethereum: +تدعم شبكة Graph الـ subgraphs لفهرسة mainnet Ethereum: - `mainnet` From 730b67375e6f98122691f3924c9a316388fe2fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:31 -0500 Subject: [PATCH 16/47] New translations network.mdx (Arabic) --- pages/ar/about/network.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/ar/about/network.mdx b/pages/ar/about/network.mdx index 7b0c538514ce..c381302f5c4b 100644 --- a/pages/ar/about/network.mdx +++ b/pages/ar/about/network.mdx @@ -10,6 +10,6 @@ title: نظرة عامة حول الشبكة شبكة TheGraph تتكون من مفهرسين (Indexers) ومنسقين (Curators) ومفوضين (Delegator) حيث يقدمون خدمات للشبكة ويقدمون البيانات لتطبيقات Web3. حيث يتم استخدام تلك التطبيقات والبيانات من قبل المستهلكين. -![Token Economics](/img/Network-roles@2x.png) +![اقتصاد الـ Token](/img/Network-roles@2x.png) لضمان الأمن الاقتصادي لشبكة The Graph وسلامة البيانات التي يتم الاستعلام عنها ، يقوم المشاركون بـ stake لـ Graph Tokens (GRT). GRT رمزه ERC-20 على Ethereum blockchain ، يستخدم لمحاصصة (allocate) الموارد في الشبكة. المفوضون والمنسقون والمفهرسون النشطون يقدمون الخدمات لذلك يمكنهم الحصول على عوائد من الشبكة ، بما يتناسب مع حجم العمل الذي يؤدونه وحصة GRT الخاصة بهم. From 0e910be0987b5386e59feebac27237738de954d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:35 -0500 Subject: [PATCH 17/47] New translations assemblyscript-api.mdx (Arabic) --- pages/ar/developer/assemblyscript-api.mdx | 134 +++++++++++----------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/pages/ar/developer/assemblyscript-api.mdx b/pages/ar/developer/assemblyscript-api.mdx index 535d905333f8..0e7b5427d278 100644 --- a/pages/ar/developer/assemblyscript-api.mdx +++ b/pages/ar/developer/assemblyscript-api.mdx @@ -27,7 +27,7 @@ yarn add --dev @graphprotocol/graph-ts # Yarn npm install --save-dev @graphprotocol/graph-ts # NPM ``` -## API Reference +## مرجع API توفر مكتبة `graphprotocol / graph-ts@` الـ APIs التالية: @@ -37,7 +37,7 @@ npm install --save-dev @graphprotocol/graph-ts # NPM - واجهة برمجة تطبيقات `ipfs` لتحميل الملفات من IPFS. - واجهة برمجة تطبيقات `json` لتحليل بيانات JSON. - واجهة برمجة تطبيقات `crypto` لاستخدام وظائف التشفير. -- Low-level primitives to translate between different type systems such as Ethereum, JSON, GraphQL and AssemblyScript. +- الأوليات منخفضة المستوى للترجمة بين أنظمة الأنواع المختلفة مثل Ethereum و JSON و GraphQL و AssemblyScript. ### إصدارات @@ -60,46 +60,46 @@ npm install --save-dev @graphprotocol/graph-ts # NPM #### ByteArray ```typescript -import { ByteArray } from '@graphprotocol/graph-ts' +'import { ByteArray } from '@graphprotocol/graph-ts ``` تمثل `ByteArray` مصفوفة `u8`. -_Construction_ +_البناء_ -- `fromI32(x: i32): ByteArray` - Decomposes `x` into bytes. -- `fromHexString(hex: string): ByteArray` - Input length must be even. البادئة بـ `0x` اختيارية. +- `fromI32(x: i32): ByteArray` - يحلل `x` إلى bytes. +- `fromHexString(hex: string): ByteArray` - طول الإدخال يجب أن يكون زوجي. البادئة بـ `0x` اختيارية. -_Type conversions_ +_تحويل الأنواع_ - `toHexString (): string` - تحول إلى سلسلة سداسية عشرية مسبوقة بـ `0x`. - `toString (): string` - تترجم البايت كسلسلة UTF-8. - `toBase58 (): string` - ترميز البايت لسلسلة base58. - `toU32 (): u32` - يترجم البايت كـ `u32` little-endian. Throws in case of overflow. -- `toI32(): i32` - Interprets the byte array as a little-endian `i32`. Throws in case of overflow. +- `toI32(): i32` - يترجم مصفوفة البايت كـ little-endian ` i32 `. يرمي في حالة تجاوز. -_Operators_ +_العوامل_ - `equals(y: ByteArray): bool` – يمكن كتابتها كـ `x == y`. #### BigDecimal ```typescript -import { BigDecimal } from '@graphprotocol/graph-ts' +'import { BigDecimal } from '@graphprotocol/graph-ts ``` يستخدم `BigDecimal` للتعبير عن الكسور العشرية. -_Construction_ +_البناء_ - `constructor(bigInt: BigInt)` – يُنشئ `BigDecimal` من `BigInt`. - `static fromString(s: string): BigDecimal` – يحلل من سلسلة عشرية. -_Type conversions_ +_تحويل الأنواع_ - `toString(): string` – يطبع سلسلة عشرية. -_Math_ +_رياضيات_ - `plus(y: BigDecimal): BigDecimal` – يمكن كتابتها كـ `x + y`. - `minus(y: BigDecimal): BigDecimal` – يمكن كتابتها كـ `x - y`. @@ -116,28 +116,28 @@ _Math_ #### BigInt ```typescript -import { BigInt } from '@graphprotocol/graph-ts' +'import { BigInt } from '@graphprotocol/graph-ts ``` يستخدم `BigInt` لتمثيل أعداد صحيحة كبيرة. يتضمن ذلك قيم Ethereum من النوع `uint32` إلى `uint256` و `int64` إلى `int256`. كل شيء أدناه `uint32` ، مثل `int32` أو `uint24` أو `int8` يتم تمثيله كـ `i32`. تحتوي فئة `BigInt` على API التالية: -_Construction_ +_البناء_ - `BigInt.fromI32 (x: i32): BigInt` - ينشئ `BigInt` من `i32`. - `BigInt.fromString(s: string): BigInt`– يحلل `BigInt` من سلسلة(string). - `BigInt.fromUnsignedBytes(x: Bytes): BigInt` – يترجم `bytes` باعتباره عددا صحيحا little-endian بدون إشارة. إذا كان الإدخال الخاص بك big-endian، فقم باستدعاء `.()reverse` أولا. - `BigInt.fromSignedBytes(x: Bytes): BigInt` – يترجم `bytes` باعتباره عددا صحيحا little-endian له إشارة. إذا كان الإدخال الخاص بك big-endian، فاستدعي `.()reverse` أولا. - _Type conversions_ + _تحويل الأنواع_ - `x.toHex(): string` – ترجع `BigInt` إلى سلسلة سداسية العشرية. -- `x.toString(): string` – turns `BigInt` into a decimal number string. +- `x.toString(): string` – يقوم بإرجاع `BigInt` إلى سلسلة عدد عشري. - `x.toI32 (): i32` - ترجع `BigInt` كـ `i32` ؛ تفشل إذا كانت القيمة لا تتناسب مع `i32`. إنها لفكرة جيدة أن تتحقق أولا من `()x.isI32`. - `x.toBigDecimal (): BigDecimal` - يحول إلى رقم عشري بدون جزء كسري. -_Math_ +_رياضيات_ - `x.plus(y: BigInt): BigInt` – يمكن كتابتها كـ `x + y`. - `x.minus(y: BigInt): BigInt` – يمكن كتابتها كـ `x - y`. @@ -164,7 +164,7 @@ _Math_ #### TypedMap ```typescript -import { TypedMap } from '@graphprotocol/graph-ts' +'import { TypedMap } from '@graphprotocol/graph-ts ``` يمكن استخدام `TypedMap` لتخزين أزواج key-value. انظر [هذا المثال ](https://github.com/graphprotocol/aragon-subgraph/blob/29dd38680c5e5104d9fdc2f90e740298c67e4a31/individual-dao-subgraph/mappings/constants.ts#L51). @@ -180,7 +180,7 @@ import { TypedMap } from '@graphprotocol/graph-ts' #### Bytes ```typescript -import { Bytes } from '@graphprotocol/graph-ts' +'import { Bytes } from '@graphprotocol/graph-ts ``` يتم استخدام `Bytes` لتمثيل مصفوفات طول عشوائية من البايتات. يتضمن ذلك قيم إيثريوم من النوع `bytes` و `bytes32` وما إلى ذلك. @@ -191,10 +191,10 @@ import { Bytes } from '@graphprotocol/graph-ts' - `b.toString()` – يحول الـ bytes في المصفوفة إلى سلسلة من unicode - `b.toBase58()` – يحول قيمة Ethereum Bytes إلى ترميز base58 (يستخدم لـ IPFS hashes) -#### Address +#### العنوان ```typescript -import { Address } from '@graphprotocol/graph-ts' +'import { Address } from '@graphprotocol/graph-ts ``` `Address` امتداد لـ`Bytes` لتمثيل قيم Ethereum `address`. @@ -203,10 +203,10 @@ import { Address } from '@graphprotocol/graph-ts' - `Address.fromString(s: string): Address` – ينشئ `Address` من سلسلة سداسية عشرية -### Store API +### مخزن API ```typescript -import { store } from '@graphprotocol/graph-ts' +'import { store } from '@graphprotocol/graph-ts ``` تسمح واجهة برمجة التطبيقات `store` بتحميل وحفظ وإزالة الكيانات من وإلى مخزن Graph Node. @@ -313,7 +313,7 @@ import { store } from '@graphprotocol/graph-ts' store.remove('Transfer', id) ``` -### Ethereum API +### API إيثيريوم يوفر Ethereum API الوصول إلى العقود الذكية ومتغيرات الحالة العامة ووظائف العقد والأحداث والإجراءات والكتل وتشفير / فك تشفير بيانات Ethereum. @@ -415,7 +415,7 @@ export function handleTransfer(event: Transfer) { أي عقد آخر يمثل جزءا من الـ subgraph يمكن استيراده من الكود الذي تم انشاؤه ويمكن ربطه بعنوان صالح. -#### Handling Reverted Calls +#### معالجة الاستدعاءات المعادة إذا كان من الممكن التراجع عن methods القراءة فقط لعقدك ، فيجب عليك التعامل مع ذلك عن طريق استدعاء method العقد التي تم انشاؤها والمسبوقة بـ على سبيل المثال ، يكشف عقد Gravity عن method `gravatarToOwner`. سيكون هذا الكود قادرا على معالجة التراجع في ذلك الـ method: @@ -431,7 +431,7 @@ if (callResult.reverted) { لاحظ أن Graph node المتصلة بعميل Geth أو Infura قد لا تكتشف جميع المرتجعات ، إذا كنت تعتمد على ذلك ، فإننا نوصي باستخدام Graph node المتصلة بعميل Parity. -#### Encoding/Decoding ABI +#### تشفير/فك تشفير ABI يمكن تشفير البيانات وفك تشفيرها وفقا لتنسيق تشفير ABI الـ Ethereum باستخدام دالتي `encode` و `decode` في الوحدة الـ `ethereum`. @@ -452,14 +452,14 @@ let decoded = ethereum.decode('(address,uint256)', encoded) لمزيد من المعلومات: -- [ABI Spec](https://docs.soliditylang.org/en/v0.7.4/abi-spec.html#types) +- [مواصفات ABI](https://docs.soliditylang.org/en/v0.7.4/abi-spec.html#types) - تشفير/فك تشفير [Rust library/CLI](https://github.com/rust-ethereum/ethabi) - [أمثلة معقدة](https://github.com/graphprotocol/graph-node/blob/6a7806cc465949ebb9e5b8269eeb763857797efc/tests/integration-tests/host-exports/src/mapping.ts#L72) أكثر. ### Logging API ```typescript -import { log } from '@graphprotocol/graph-ts' +import { log } from '@graphprotocol/graph-ts ``` تسمح واجهة برمجة التطبيقات `log` لـ subgraphs بتسجيل المعلومات إلى الخرج القياسي لـ Graph Node بالإضافة إلى Graph Explorer. يمكن تسجيل الرسائل باستخدام مستويات سجل مختلفة. بنية سلسلة التنسيق الأساسي يتم توفيرها لتكوين رسائل السجل من argument. @@ -478,9 +478,9 @@ import { log } from '@graphprotocol/graph-ts' log.info('Message to be displayed: {}, {}, {}', [value.toString(), anotherValue.toString(), 'already a string']) ``` -#### Logging one or more values +#### تسجيل قيمة واحدة أو أكثر -##### Logging a single value +##### تسجيل قيمة واحدة في المثال أدناه ، يتم تمرير قيمة السلسلة "A" إلى مصفوفة لتصبح `['A']` قبل تسجيلها: @@ -493,7 +493,7 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -##### Logging a single entry from an existing array +##### تسجيل إدخال واحد من مصفوفة موجودة في المثال أدناه ، يتم تسجيل القيمة الأولى فقط لـ argument المصفوفة، على الرغم من احتواء المصفوفة على ثلاث قيم. @@ -506,7 +506,7 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -#### Logging multiple entries from an existing array +#### تسجيل إدخالات متعددة من مصفوفة موجودة يتطلب كل إدخال في arguments المصفوفة placeholder خاص به `{}` في سلسلة رسالة السجل. يحتوي المثال أدناه على ثلاثة placeholders `{}` في رسالة السجل. لهذا السبب ، يتم تسجيل جميع القيم الثلاث في `myArray`. @@ -519,7 +519,7 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -##### Logging a specific entry from an existing array +##### تسجيل إدخال محدد من مصفوفة موجودة لعرض قيمة محددة في المصفوفة ، يجب توفير القيمة المفهرسة. @@ -530,7 +530,7 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -##### Logging event information +##### معلومات حدث التسجيل يسجل المثال أدناه رقم الكتلة و hash الكتلة و hash الإجراء من حدث: @@ -549,7 +549,7 @@ export function handleSomeEvent(event: SomeEvent): void { ### IPFS API ```typescript -import { ipfs } from '@graphprotocol/graph-ts' +'import { ipfs } from '@graphprotocol/graph-ts ``` تقوم العقود الذكية أحيانا بإرساء ملفات IPFS على السلسلة. يسمح هذا للـ mappings بالحصول على IPFS hashes من العقد وقراءة الملفات المقابلة من IPFS. سيتم إرجاع بيانات الملف كـ `Bytes` ، والتي تتطلب عادة مزيدا من المعالجة ، على سبيل المثال مع واجهة برمجة التطبيقات `json` الموثقة لاحقا في هذه الصفحة. @@ -606,7 +606,7 @@ ipfs.mapJSON('Qm...', 'processItem', Value.fromString('parentId')) ### Crypto API ```typescript -import { crypto } from '@graphprotocol/graph-ts' +'import { crypto } from '@graphprotocol/graph-ts ``` توفر واجهة برمجة تطبيقات `crypto` دوال التشفير للاستخدام في mappings. الآن ، يوجد واحد فقط: @@ -616,7 +616,7 @@ import { crypto } from '@graphprotocol/graph-ts' ### JSON API ```typescript -import { json, JSONValueKind } from '@graphprotocol/graph-ts' +'import { json, JSONValueKind } from '@graphprotocol/graph-ts ``` يمكن تحليل بيانات JSON باستخدام `json` API: @@ -648,47 +648,47 @@ if (value.kind == JSONValueKind.BOOL) { - `value.toString(): string` - `value.toArray(): Array` - (ثم قم بتحويل `JSONValue` بإحدى الـ methods الخمس المذكورة أعلاه) -### Type Conversions Reference +### مرجع تحويلات الأنواع | المصدر(المصادر) | الغاية | دالة التحويل | | -------------------- | -------------------- | ---------------------------- | -| Address | Bytes | none | -| Address | ID | s.toHexString() | -| 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 | +| Address | Bytes | لا يوجد | +| Address | ID | ()s.toHexString | +| 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 | لا يوجد | | 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 | 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 | +| int8 | i32 | لا يوجد | +| int32 | i32 | لا يوجد | | 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() | +| uint24 | i32 | لا يوجد | +| int64 - int256 | BigInt | لا يوجد | +| uint32 - uint256 | BigInt | لا يوجد | +| 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) | | String | BigDecimal | BigDecimal.fromString(s) | | String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | | String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | -### Data Source Metadata +### البيانات الوصفية لمصدر البيانات يمكنك فحص عنوان العقد والشبكة وسياق مصدر البيانات الذي استدعى المعالج من خلال `dataSource` namespace: @@ -696,7 +696,7 @@ if (value.kind == JSONValueKind.BOOL) { - `dataSource.network(): string` - `dataSource.context(): DataSourceContext` -### Entity and DataSourceContext +### الكيان و DataSourceContext تحتوي فئة `Entity` الأساسية والفئة الفرعية `DataSourceContext` على مساعدين لتعيين الحقول والحصول عليها ديناميكيا: From e16af4bed8ec157d48fa6a2e813b63be5ab1f617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:39 -0500 Subject: [PATCH 18/47] New translations assemblyscript-api.mdx (Korean) --- pages/ko/developer/assemblyscript-api.mdx | 98 +++++++++++------------ 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/pages/ko/developer/assemblyscript-api.mdx b/pages/ko/developer/assemblyscript-api.mdx index 1940e1e7f916..8f2e952d40bc 100644 --- a/pages/ko/developer/assemblyscript-api.mdx +++ b/pages/ko/developer/assemblyscript-api.mdx @@ -213,7 +213,7 @@ _Math_ 스토어에 작성된 엔티티는 서브그래프의 GraphQL 스키마에 정의된 `@entity` 유형에 일대일로 매핑됩니다. 이러한 엔터티 작업을 편리하게 하기 위해 [Graph CLI](https://github.com/graphprotocol/graph-cli)에서 제공하는 `graph codegen` 명령은 기본 제공 `Entity` 유형의 서브 클래스인 엔터티 클래스를 생성하며, 스키마의 필드에 대한 속성 getter 및 setter와 이러한 엔티티를 로드 및 저장하는 메서드를 사용합니다. -#### Creating entities +#### 엔티티 생성 다음은 이더리움 이벤트에서 엔티티를 생성하기 위한 일반적인 패턴입니다. @@ -390,11 +390,11 @@ class Transaction { } ``` -#### Access to Smart Contract State +#### 스마트 컨트렉트 상태에 대한 엑세스 -The code generated by `graph codegen` also includes classes for the smart contracts used in the subgraph. These can be used to access public state variables and call functions of the contract at the current block. +`graph codegen`에 의해 생성된 코드는 서브그래프에 사용되는 스마트 컨트렉트에 대한 클래스도 포함합니다. 이들은 퍼블릭 상태 변수에 접근하고 현재 블록에서 컨트렉트의 기능들을 호출하는 데 사용될 수 있습니다. -A common pattern is to access the contract from which an event originates. This is achieved with the following code: +일반적인 패턴은 이벤트가 발생한 곳에서 컨트렉트에 액세스하는 것입니다. 이 작업은 다음 코드를 사용하여 수행할 수 있습니다. ```typescript // Import the generated contract class @@ -411,13 +411,13 @@ export function handleTransfer(event: Transfer) { } ``` -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. +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. +서브그래프의 일부인 다른 컨트렉트는 생성된 코드에서 가져올 수 있으며 유효한 주소에 바인딩할 수 있습니다. #### Handling Reverted Calls -If the read-only methods of your contract may revert, then you should handle that by calling the generated contract method prefixed with `try_`. For example, the Gravity contract exposes the `gravatarToOwner` method. This code would be able to handle a revert in that method: +컨트렉트의 읽기 전용 메서드가 revert 될 경우, `try_` 접두사가 붙은 생성된 컨트렉트 메서드를 호출하여 이를 처리해야 합니다. 예를 들어, Gravity 컨트렉트는 `gravatarToOwner` 메서드를 노출합니다. 이 코드는 해당 메서드에서 revert를 처리할 수 있습니다. ```typescript let gravity = Gravity.bind(event.address) @@ -429,11 +429,11 @@ if (callResult.reverted) { } ``` -Note that a Graph node connected to a Geth or Infura client may not detect all reverts, if you rely on this we recommend using a Graph node connected to a Parity client. +Geth 또는 Infura 클라이언트에 연결된 Graph 노드가 모든 revert들을 탐지하지 못할 수 있으므로, 이 경우 패리티 클라이언트에 연결된 Graph 노드를 사용하는 것이 좋습니다. #### Encoding/Decoding ABI -Data can be encoded and decoded according to Ethereum's ABI encoding format using the `encode` and `decode` functions in the `ethereum` module. +`ethereum` 모듈의 `encode` 및 `decode` 기능을 이용해 이더리움의 ABI 인코딩 형식에 따라 데이터를 인코딩하고 디코딩할 수 있습니다. ```typescript import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts' @@ -450,39 +450,39 @@ let encoded = ethereum.encode(ethereum.Value.fromTuple(tuple))! let decoded = ethereum.decode('(address,uint256)', encoded) ``` -For more information: +추가 정보: - [ABI Spec](https://docs.soliditylang.org/en/v0.7.4/abi-spec.html#types) - Encoding/decoding [Rust library/CLI](https://github.com/rust-ethereum/ethabi) -- More [complex example](https://github.com/graphprotocol/graph-node/blob/6a7806cc465949ebb9e5b8269eeb763857797efc/tests/integration-tests/host-exports/src/mapping.ts#L72). +- 더 [복잡한 예시](https://github.com/graphprotocol/graph-node/blob/6a7806cc465949ebb9e5b8269eeb763857797efc/tests/integration-tests/host-exports/src/mapping.ts#L72). ### Logging API ```typescript -import { log } from '@graphprotocol/graph-ts' +'@graphprotocol/graph-ts'에서 { log }를 입력합니다. ``` -The `log` API allows subgraphs to log information to the Graph Node standard output as well as the Graph Explorer. Messages can be logged using different log levels. A basic format string syntax is provided to compose log messages from argument. +`log` API를 사용하면 서브그래프에서 그래프 탐색기뿐만 아니라 그래프 노드 표준 출력에 정보를 기록할 수 있습니다. 메시지는 다른 로그 레벨을 사용하여 기록할 수 있습니다. 인수의 로그 메시지를 구성하기 위한 기본 형식 문자열 구문이 제공됩니다. -The `log` API includes the following functions: +`log` API는 다음과 같은 기능들을 포함합니다. -- `log.debug(fmt: string, args: Array): void` - logs a debug message. -- `log.info(fmt: string, args: Array): void` - logs an informational message. -- `log.warning(fmt: string, args: Array): void` - logs a warning. -- `log.error(fmt: string, args: Array): void` - logs an error message. -- `log.critical(fmt: string, args: Array): void` – logs a critical message _and_ terminates the subgraph. +- `log.debug(fmt: string, args: Array): void` - 디버그 메세지를 기록합니다. +- `log.info(fmt: string, args: Array): void` - 정보 메세지를 기록합니다. +- `log.warning(fmt: string, args: Array): void` - 경고 메세지를 기록합니다. +- `log.error(fmt: string, args: Array): void` - 에러 메세지를 기록합니다. +- `log.critical(fmt: string, args: Array): void` – 중요한 메세지 기록 _및_ 서브그래프를 종료합니다. -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. +`log` API는 형식 문자열과 문자열 값의 배열을 사용합니다. 그런 다음 자리 표시자를 배열의 문자열 값으로 바꿉니다. 첫 번째 `{}` 자리 표시자는 어레이의 첫 번째 값으로 바뀌고 두 번째 `{}` 자리 표시자는 두 번째 값으로 바뀝니다. ```typescript log.info('Message to be displayed: {}, {}, {}', [value.toString(), anotherValue.toString(), 'already a string']) ``` -#### Logging one or more values +#### 하나 이상의 값 로깅 -##### Logging a single value +##### 단일 값 로깅 -In the example below, the string value "A" is passed into an array to become`['A']` before being logged: +아래 예에서 문자열 값 "A"는 기록되기 전에 `['A']`가 되도록 배열에 전달됩니다. ```typescript let myValue = 'A' @@ -493,9 +493,9 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -##### Logging a single entry from an existing array +##### 기존 배열에서 단일 항목 로깅 -In the example below, only the first value of the argument array is logged, despite the array containing three values. +아래 예에서는 배열에 세 개의 값이 포함되어 있음에도 불구하고 인수 배열의 첫 번째 값만 기록됩니다. ```typescript let myArray = ['A', 'B', 'C'] @@ -506,9 +506,9 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -#### Logging multiple entries from an existing array +#### 기존 배열에서 여러 항목 로깅 -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. +인수 배열의 각 항목에는 로그 메시지 문자열에 고유한 자리 표시자 `{}`가 필요합니다. 아래 예시는 로그 메시지에 세 개의 자리 표시자 `{}` 를 포함합니다. 이 때문에 `myArray`의 세 값이 모두 기록됩니다. ```typescript let myArray = ['A', 'B', 'C'] @@ -519,9 +519,9 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -##### Logging a specific entry from an existing array +##### 기존 배열에서 특정 항목 로깅 -To display a specific value in the array, the indexed value must be provided. +배열의 특정 값을 표시하려면 인덱싱된 값이 제공되어야만 합니다. ```typescript export function handleSomeEvent(event: SomeEvent): void { @@ -530,9 +530,9 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -##### Logging event information +##### 이벤트 정보 로깅 -The example below logs the block number, block hash and transaction hash from an event: +아래 예는 이벤트의 블록 번호, 블록 해시 및 트랜잭션 해시를 기록합니다: ```typescript import { log } from '@graphprotocol/graph-ts' @@ -549,12 +549,12 @@ export function handleSomeEvent(event: SomeEvent): void { ### IPFS API ```typescript -import { ipfs } from '@graphprotocol/graph-ts' +'@graphprotocol/graph-ts'에서 { ipfs }를 입력합니다. ``` -Smart contracts occasionally anchor IPFS files on chain. 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. +스마트컨트렉트는 때때로 체인에 IPFS 파일을 고정합니다. 이를 통해 매핑들은 컨트랙트에서 IPFS 해시를 얻고 IPFS에서 해당 파일을 읽을 수 있습니다. 파일 데이터는 일반적으로 추가 처리가 필요한 `Bytes`로 반환됩니다. 예를 들어, 이 페이지의 뒷부분에 설명된 `json` API를 사용합니다. -Given an IPFS hash or path, reading a file from IPFS is done as follows: +IPFS 해시 또는 경로가 주어지면 IPFS에서 파일을 읽는 것은 다음과 같이 이루어집니다: ```typescript // Put this inside an event handler in the mapping @@ -567,9 +567,9 @@ 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`. To ensure that files can be retrieved, they have to be pinned to the IPFS node that Graph Node connects to. On the [hosted service](https://thegraph.com/hosted-service), this is [https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs). See the [IPFS pinning](/developer/create-subgraph-hosted#ipfs-pinning) section for more information. +**Note:** `ipfs.cat`은 현재로서는 결정적이지 않습니다. 요청 시간이 초과되기 전에 IPFS 네트워크를 통해 파일을 검색할 수 없으면 `null`을 반환합니다. 이 때문에 `null`에 대한 결과를 확인하는 것은 항상 가치가 있습니다. 파일을 검색할 수 있도록 하려면 그래프 노드가 연결되는 IPFS 노드에 파일을 고정해야 합니다. [hosted service](https://thegraph.com/hosted-service)에서, 이는 [https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs)입니다. 자세한 내용은 [IPFS pinning](/developer/create-subgraph-hosted#ipfs-pinning) 섹션을 참조 하시기 바랍니다. -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: +`ipfs.map`으로 더 큰 파일을 스트리밍 방식으로 처리할 수도 있습니다. 이 함수는 IPFS 파일의 해시 또는 경로, 콜백 이름 및 동작을 수정하는 플래그를 예상합니다. ```typescript import { JSONValue, Value } from '@graphprotocol/graph-ts' @@ -599,34 +599,34 @@ ipfs.map('Qm...', 'processItem', Value.fromString('parentId'), ['json']) 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. +현재 지원되는 유일한 플래그는 `ipfs.map`에 전달되어야 하는 `json`입니다. `json` 플래그를 사용하면 IPFS 파일은 한 줄에 하나의 값으로 구성된 일련의 JSON 값으로 구성되어야 합니다. `ipfs.map`에 대한 호출은 파일의 각 줄을 읽고 `JSONValue`로 역직렬화하고 각각에 대한 콜백을 호출합니다. 그런 다음 콜백은 엔터티 작업을 사용하여 `JSONValue`의 데이터를 저장할 수 있습니다. 엔티티 변경 사항은 `ipfs.map`을 호출한 핸들러가 성공적으로 완료된 경우에만 저장됩니다. 그 동안에는 메모리에 보관되므로 `ipfs.map`이 처리할 수 있는 파일의 크기가 제한됩니다. -On success, `ipfs.map` returns `void`. If any invocation of the callback causes an error, the handler that invoked `ipfs.map` is aborted, and the subgraph is marked as failed. +성공하면 `ipfs.map`이 `void`를 반환합니다. 콜백 호출로 인해 오류가 발생하면 `ipfs.map`을 호출한 핸들러가 중단되고 서브그래프가 실패로 표시됩니다. ### Crypto API ```typescript -import { crypto } from '@graphprotocol/graph-ts' +'@graphprotocol/graph-ts'에서 { crypto }를 입력합니다. ``` -The `crypto` API makes a cryptographic functions available for use in mappings. Right now, there is only one: +`crypto` API는 매핑에서 사용할 수 있는 암호화 기능들을 만듭니다. 현재는 한가지만 존재합니다: - `crypto.keccak256(input: ByteArray): ByteArray` ### JSON API ```typescript -import { json, JSONValueKind } from '@graphprotocol/graph-ts' +'@graphprotocol/graph-ts'에서 { json, JSONValueKind }를 입력합니다. ``` -JSON data can be parsed using the `json` API: +JSON 데이터는 `json` API를 사용하여 구문 분석할 수 있습니다. -- `json.fromBytes(data: Bytes): JSONValue` – parses JSON data from a `Bytes` array -- `json.try_fromBytes(data: Bytes): Result` – safe version of `json.fromBytes`, it returns an error variant if the parsing failed -- `json.fromString(data: Bytes): JSONValue` – parses JSON data from a valid UTF-8 `String` -- `json.try_fromString(data: Bytes): Result` – safe version of `json.fromString`, it returns an error variant if the parsing failed +- `json.fromBytes(data: Bytes): JSONValue` – 유효한 UTF-8 시퀀스로 해석되는 `Bytes` 배열에서 JSON 데이터를 구문 분석합니다. +- `json.try_fromBytes(data: Bytes): Result` – 안전한 버전의 `json.fromBytes`, 구문 분석에 실패한 경우 오류 변형을 반환합니다. +- `json.fromString(data: string): JSONValue` – 유효한 UTF-8 `String`에서 JSON data를 구문분석합니다. +- `json.try_fromString(data: string): Result` – 안전한 버전의 `json.fromString`, 구문 분석에 실패한 경우 오류 변형을 반환합니다. -The `JSONValue` class provides a way to pull values out of an arbitrary JSON document. Since JSON values can be booleans, numbers, arrays and more, `JSONValue` comes with a `kind` property to check the type of a value: +`JSONValue` 클래스는 임의의 JSON 문서에서 값을 가져오는 방법을 제공합니다. JSON 값은 불 방식(booleans), 숫자, 배열 등일 수 있으므로 `JSONValue`에는 값 유형을 확인하는 `kind` 속성이 함께 제공됩니다. ```typescript let value = json.fromBytes(...) @@ -635,11 +635,11 @@ if (value.kind == JSONValueKind.BOOL) { } ``` -In addition, there is a method to check if the value is `null`: +또한 값이 `null`l인지 확인하는 방법이 존재합니다: - `value.isNull(): boolean` -When the type of a value is certain, it can be converted to a [built-in type](#built-in-types) using one of the following methods: +값의 유형이 확실한 경우 다음 방법 중 하나를 사용하여 [built-in type](#built-in-types)으로 변환할 수 있습니다. - `value.toBool(): boolean` - `value.toI64(): i64` From 47f3a2246cb08b1e88d7e5bbe012e1cde39fe9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:40 -0500 Subject: [PATCH 19/47] New translations assemblyscript-api.mdx (Chinese Simplified) --- pages/zh/developer/assemblyscript-api.mdx | 337 +++++++++++----------- 1 file changed, 168 insertions(+), 169 deletions(-) diff --git a/pages/zh/developer/assemblyscript-api.mdx b/pages/zh/developer/assemblyscript-api.mdx index b5066fab02f2..c73cf2ac9ee7 100644 --- a/pages/zh/developer/assemblyscript-api.mdx +++ b/pages/zh/developer/assemblyscript-api.mdx @@ -2,60 +2,60 @@ title: AssemblyScript API --- -> Note: if you created a subgraph prior to `graph-cli`/`graph-ts` version `0.22.0`, you're using an older version of AssemblyScript, we recommend taking a look at the [`Migration Guide`](/developer/assemblyscript-migration-guide) +> 注意:如果您在 `graph-cli`/`graph-ts` 版本 `0.22.0`之前创建了一个子图,那么您使用的是旧版本的AssemblyScript,我们建议您查看 [`迁移指南`](/developer/assemblyscript-migration-guide) -This page documents what built-in APIs can be used when writing subgraph mappings. Two kinds of APIs are available out of the box: +此页面记录了编写子图映射时可以使用的内置 API。有两种开箱即用的 API: -- the [Graph TypeScript library](https://github.com/graphprotocol/graph-ts) (`graph-ts`) and -- code generated from subgraph files by `graph codegen`. +- [Graph TypeScript库](https://github.com/graphprotocol/graph-ts) (`graph-ts`) +- 使用`graph codegen`从子图文件生成的代码。 -It is also possible to add other libraries as dependencies, as long as they are compatible with [AssemblyScript](https://github.com/AssemblyScript/assemblyscript). Since this is the language mappings are written in, the [AssemblyScript wiki](https://github.com/AssemblyScript/assemblyscript/wiki) is a good source for language and standard library features. +也可以添加其他库作为依赖项,只要它们与 [AssemblyScript](https://github.com/AssemblyScript/assemblyscript) 兼容。 由于这是编语言映射,因此可以参考 [AssemblyScript wiki](https://github.com/AssemblyScript/assemblyscript/wiki) 了解相应的语言和标准库功能。 -## Installation +## 安装 -Subgraphs created with [`graph init`](/developer/create-subgraph-hosted) come with preconfigured dependencies. All that is required to install these dependencies is to run one of the following commands: +使用 [`graph init`](/developer/create-subgraph-hosted) 创建的子图带有预配置的依赖项。 安装这些依赖项所需的只是运行以下命令之一: ```sh yarn install # Yarn npm install # NPM ``` -If the subgraph was created from scratch, one of the following two commands will install the Graph TypeScript library as a dependency: +如果子图是从头开始创建的,则以下两个命令之一将安装 Graph TypeScript 库作为依赖项: ```sh yarn add --dev @graphprotocol/graph-ts # Yarn npm install --save-dev @graphprotocol/graph-ts # NPM ``` -## API Reference +## API 参考 -The `@graphprotocol/graph-ts` library provides the following APIs: +`@graphprotocol/graph-ts` 库提供以下 API: -- An `ethereum` API for working with Ethereum smart contracts, events, blocks, transactions, and Ethereum values. -- A `store` API to load and save entities from and to the Graph Node store. -- A `log` API to log messages to the Graph Node output and the Graph Explorer. -- An `ipfs` API to load files from IPFS. -- A `json` API to parse JSON data. -- A `crypto` API to use cryptographic functions. -- Low-level primitives to translate between different type systems such as Ethereum, JSON, GraphQL and AssemblyScript. +- 用于处理以太坊智能合约、事件、区块、交易和以太坊价值的`ethereum` API。 +- 用于与Graph节点交互,存储和加载实体的 `store` API。 +- 用于将消息记录到 Graph 节点输出和 Graph Explorer 的`log` API。 +- 用于从 IPFS 加载文件的`ipfs` API。 +- 用于解析 JSON 数据的`json` API。 +- 使用加密功能的`crypto` API。 +- 用于在不同类型系统(例如 Ethereum、JSON、GraphQL 和 AssemblyScript)之间进行转换的低级原语。 -### Versions +### 版本 -The `apiVersion` in the subgraph manifest specifies the mapping API version which is run by Graph Node for a given subgraph. The current mapping API version is 0.0.6. +子图清单中的 `apiVersion` 指定了由Graph节点为给定子图运行的映射 API 版本。 当前的映射 API 版本是 0.0.6。 -| Version | Release notes | -|:-------:| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 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`](/developer/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
`etherem.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| 版本 | Release说明 | +|:-----:| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.0.6 | 向 Ethereum Transaction 对象添加 `nonce` 字段
向 Ethereum Block 对象添加 `baseFeePerGas` | +| 0.0.5 | AssemblyScript 升级到版本 0.19.10(这包括重大更改,参阅 [`迁移指南`](/developer/assemblyscript-migration-guide))
`ethereum.transaction.gasUsed` 重命名为 `ethereum.transaction.gasLimit` | +| 0.0.4 | 向 Ethereum SmartContractCall 对象添加 `functionSignature` 字段 | +| 0.0.3 | 将 `from` 字段添加到 Ethereum Call 对象
`etherem.call.address` 重命名为 `ethereum.call.to` | +| 0.0.2 | 向 Ethereum Transaction 对象添加 `input` 字段 | -### Built-in Types +### 内置类型 -Documentation on the base types built into AssemblyScript can be found in the [AssemblyScript wiki](https://github.com/AssemblyScript/assemblyscript/wiki/Types). +可以在 [AssemblyScript wiki](https://github.com/AssemblyScript/assemblyscript/wiki/Types) 中找到有关 AssemblyScript 中内置的基本类型的文档。 -The following additional types are provided by `@graphprotocol/graph-ts`. +`@graphprotocol/graph-ts` 提供了以下附加类型。 #### ByteArray @@ -63,14 +63,14 @@ The following additional types are provided by `@graphprotocol/graph-ts`. import { ByteArray } from '@graphprotocol/graph-ts' ``` -`ByteArray` represents an array of `u8`. +`ByteArray` 表示 `u8` 的数组。 -_Construction_ +_构造_ - `fromI32(x: i32): ByteArray` - Decomposes `x` into bytes. - `fromHexString(hex: string): ByteArray` - Input length must be even. Prefixing with `0x` is optional. -_Type conversions_ +_类型转换_ - `toHexString(): string` - Converts to a hex string prefixed with `0x`. - `toString(): string` - Interprets the bytes as a UTF-8 string. @@ -78,7 +78,7 @@ _Type conversions_ - `toU32(): u32` - Interprets the bytes as a little-endian `u32`. Throws in case of overflow. - `toI32(): i32` - Interprets the byte array as a little-endian `i32`. Throws in case of overflow. -_Operators_ +_运算符_ - `equals(y: ByteArray): bool` – can be written as `x == y`. @@ -88,14 +88,14 @@ _Operators_ import { BigDecimal } from '@graphprotocol/graph-ts' ``` -`BigDecimal` is used to represent arbitrary precision decimals. +`BigDecimal` 用于表示任意精度的小数。 -_Construction_ +_构造_ - `constructor(bigInt: BigInt)` – creates a `BigDecimal` from an `BigInt`. - `static fromString(s: string): BigDecimal` – parses from a decimal string. -_Type conversions_ +_类型转换_ - `toString(): string` – prints to a decimal string. @@ -119,18 +119,18 @@ _Math_ import { BigInt } from '@graphprotocol/graph-ts' ``` -`BigInt` is used to represent big integers. This includes Ethereum values of type `uint32` to `uint256` and `int64` to `int256`. Everything below `uint32`, such as `int32`, `uint24` or `int8` is represented as `i32`. +`BigInt` 用于表示大整数。 这包括 `uint32` 到 `uint256` 和 `int64` 到 `int256` 类型的以太坊值。 `uint32` 下的所有内容,例如 `int32`、`uint24` 或 `int8` 都表示为 `i32` 。 -The `BigInt` class has the following API: +`BigInt` 类具有以下 API: -_Construction_ +_构造_ - `BigInt.fromI32(x: i32): BigInt` – creates a `BigInt` from an `i32`. - `BigInt.fromString(s: string): BigInt`– Parses a `BigInt` from a string. - `BigInt.fromUnsignedBytes(x: Bytes): BigInt` – Interprets `bytes` as an unsigned, little-endian integer. If your input is big-endian, call `.reverse()` first. - `BigInt.fromSignedBytes(x: Bytes): BigInt` – Interprets `bytes` as a signed, little-endian integer. If your input is big-endian, call `.reverse()` first. - _Type conversions_ + _类型转换_ - `x.toHex(): string` – turns `BigInt` into a string of hexadecimal characters. - `x.toString(): string` – turns `BigInt` into a decimal number string. @@ -167,9 +167,9 @@ _Math_ import { TypedMap } from '@graphprotocol/graph-ts' ``` -`TypedMap` can be used to stored key-value pairs. See [this example](https://github.com/graphprotocol/aragon-subgraph/blob/29dd38680c5e5104d9fdc2f90e740298c67e4a31/individual-dao-subgraph/mappings/constants.ts#L51). +`TypedMap` 可用于存储键值对。 请参阅[此示例](https://github.com/graphprotocol/aragon-subgraph/blob/29dd38680c5e5104d9fdc2f90e740298c67e4a31/individual-dao-subgraph/mappings/constants.ts#L51)。 -The `TypedMap` class has the following API: +`TypedMap` 类具有以下 API: - `new TypedMap()` – creates an empty map with keys of type `K` and values of type `T` - `map.set(key: K, value: V): void` – sets the value of `key` to `value` @@ -183,9 +183,9 @@ The `TypedMap` class has the following API: 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. +`Bytes` 用于表示任意长度的字节数组。 这包括 `bytes`、`bytes32` 等类型的 Ethereum 值。 -The `Bytes` class extends AssemblyScript's [Uint8Array](https://github.com/AssemblyScript/assemblyscript/blob/3b1852bc376ae799d9ebca888e6413afac7b572f/std/assembly/typedarray.ts#L64) and this supports all the `Uint8Array` functionality, plus the following new methods: +`Bytes` 类扩展了 AssemblyScript 的 [Uint8Array](https://github.com/AssemblyScript/assemblyscript/blob/3b1852bc376ae799d9ebca888e6413afac7b572f/std/assembly/typedarray.ts#L64),它支持所有 `Uint8Array` 功能,以及以下新方法: - `b.toHex()` – returns a hexadecimal string representing the bytes in the array - `b.toString()` – converts the bytes in the array to a string of unicode characters @@ -197,9 +197,9 @@ The `Bytes` class extends AssemblyScript's [Uint8Array](https://github.com/Assem import { Address } from '@graphprotocol/graph-ts' ``` -`Address` extends `Bytes` to represent Ethereum `address` values. +`Address` 扩展了 `Bytes` 以表示 Ethereum `address` 值。 -It adds the following method on top of the `Bytes` API: +它在 `Bytes` API 之上添加了以下方法: - `Address.fromString(s: string): Address` – creates an `Address` from a hexadecimal string @@ -209,16 +209,15 @@ It adds the following method on top of the `Bytes` API: import { store } from '@graphprotocol/graph-ts' ``` -The `store` API allows to load, save and remove entities from and to the Graph Node store. +`store` API 允许从 Graph 节点存储中加载、保存和删除实体。 -Entities written to the store map one-to-one to the `@entity` types defined in the subgraph's GraphQL schema. To make working with these entities convenient, the `graph codegen` command provided by the [Graph CLI](https://github.com/graphprotocol/graph-cli) generates entity classes, which are subclasses of the built-in `Entity` type, with property getters and setters for the fields in the schema as well as methods to load and save these entities. +写入存储的实体与子图的 GraphQL 架构中定义的 `@entity` 类型一一对应。 为了方便使用这些实体,[Graph CLI](https://github.com/graphprotocol/graph-cli) 提供的 `graph codegen` 命令生成实体类,这些试题类是内置 `Entity 类型,具有模式中字段的属性获取器和设置器,以及加载和保存这些实体的方法。

-#### Creating entities +

创建实体

-The following is a common pattern for creating entities from Ethereum events. +

以下是从以太坊事件创建实体的常见模式。

-```typescript -// Import the Transfer event class generated from the ERC20 ABI +
// Import the Transfer event class generated from the ERC20 ABI
 import { Transfer as TransferEvent } from '../generated/ERC20/ERC20'
 
 // Import the Transfer entity type generated from the GraphQL schema
@@ -239,15 +238,15 @@ export function handleTransfer(event: TransferEvent): void {
   // Save the entity to the store
   transfer.save()
 }
-```
+`
-When a `Transfer` event is encountered while processing the chain, it is passed to the `handleTransfer` event handler using the generated `Transfer` type (aliased to `TransferEvent` here to avoid a naming conflict with the entity type). This type allows accessing data such as the event's parent transaction and its parameters. +如果在处理链时遇到 `Transfer` 事件,它会使用生成的 `Transfer` 类型(别名为 <0 >TransferEvent 以避免与实体类型的命名冲突) 传递给 `handleTransfer` 事件处理器。 此类型允许访问事件的父事务及其参数等数据。 -Each entity must have a unique ID to avoid collisions with other entities. It is fairly common for event parameters to include a unique identifier that can be used. Note: Using the transaction hash as the ID assumes that no other events in the same transaction create entities with this hash as the ID. +每个实体都必须有一个唯一的 ID 以避免与其他实体发生冲突。 事件参数包含可以使用的唯一标识符是相当常见的。 注意:使用事务哈希作为 ID时, 假定同一事务中没有其他事件创建以该哈希作为 ID 的实体。 -#### Loading entities from the store +#### 从存储中加载实体 -If an entity already exists, it can be loaded from the store with the following: +如果实体已经存在,则可以使用以下内容从存储中加载它: ```typescript let id = event.transaction.hash.toHex() // or however the ID is constructed @@ -259,18 +258,18 @@ if (transfer == null) { // Use the Transfer entity as before ``` -As the entity may not exist in the store yet, the `load` method returns a value of type `Transfer | null`. It may thus be necessary to check for the `null` case before using the value. +由于实体可能尚不存在于存储中,因此 `load` 方法返回一个 `Transfer | null`。 因此,在使用该值之前,需要检查值为 `null` 情况。 -> **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. +> **注意:** 仅当映射中所做的更改依赖于实体的先前数据时,才需要加载实体。 有关更新现有实体的两种方法,请参阅下一节。 -#### Updating existing entities +#### 更新现有实体 -There are two ways to update an existing entity: +有两种方法可以更新现有实体: -1. Load the entity with e.g. `Transfer.load(id)`, set properties on the entity, then `.save()` it back to the store. -2. Simply create the entity with e.g. `new Transfer(id)`, set properties on the entity, then `.save()` it to the store. If the entity already exists, the changes are merged into it. +1. 利用 `Transfer.load(id)`加载实体,在实体上设置属性,然后调用`.save()` 将其返回到存储。 +2. 使用 `new Transfer(id)`创建实体,在实体上设置属性,然后调用`.save()`将其保存到存储。 如果实体已经存在,则将更改合并到其中。 -Changing properties is straight forward in most cases, thanks to the generated property setters: +由于生成的属性设置器,在大多数情况下更改属性是直截了当的: ```typescript let transfer = new Transfer(id) @@ -279,16 +278,16 @@ transfer.to = ... transfer.amount = ... ``` -It is also possible to unset properties with one of the following two instructions: +也可以使用以下两条指令之一取消设置属性: ```typescript transfer.from.unset() transfer.from = null ``` -This only works with optional properties, i.e. properties that are declared without a `!` in GraphQL. Two examples would be `owner: Bytes` or `amount: BigInt`. +这仅适用于可选属性,即在 GraphQL 中没有 `!` 声明的属性。 例如 `owner: Bytes` 或 `amount: BigInt`。 -Updating array properties is a little more involved, as the getting an array from an entity creates a copy of that array. This means array properties have to be set again explicitly after changing the array. The following assumes `entity` has a `numbers: [BigInt!]!` field. +更新数组属性有点复杂,因为从实体获取数组会创建该数组的副本。 这意味着必须在更改数组后再次显式设置数组属性。 以下代码假设 `entity` 有一个 `numbers: [BigInt!]!` 字段。 ```typescript // This won't work @@ -302,9 +301,9 @@ entity.numbers = numbers entity.save() ``` -#### Removing entities from the store +#### 从存储中删除实体 -There is currently no way to remove an entity via the generated types. Instead, removing an entity requires passing the name of the entity type and the entity ID to `store.remove`: +目前无法通过生成的类型删除实体。 相反,删除实体需要将实体类型的名称和实体 ID 传递给 `store.remove`: ```typescript import { store } from '@graphprotocol/graph-ts' @@ -313,17 +312,17 @@ let id = event.transaction.hash.toHex() store.remove('Transfer', id) ``` -### Ethereum API +### 以太坊 API -The Ethereum API provides access to smart contracts, public state variables, contract functions, events, transactions, blocks and the encoding/decoding Ethereum data. +以太坊 API 提供对智能合约、公共状态变量、合约函数、事件、交易、区块和编码/解码以太坊数据的访问。 -#### Support for Ethereum Types +#### 对以太坊类型的支持 -As with entities, `graph codegen` generates classes for all smart contracts and events used in a subgraph. For this, the contract ABIs need to be part of the data source in the subgraph manifest. Typically, the ABI files are stored in an `abis/` folder. +与实体一样,`graph codegen` 为子图中使用的所有智能合约和事件生成类。 为此,合同 ABI 需要成为子图清单中数据源的一部分。 通常,ABI 文件存储在 `abis/` 文件夹中。 -With the generated classes, conversions between Ethereum types and the [built-in types](#built-in-types) take place behind the scenes so that subgraph authors do not have to worry about them. +通过生成的类,以太坊类型和[内置类型](#built-in-types)之间的转换发生在幕后,因此子图开发者不必担心。 -The following example illustrates this. Given a subgraph schema like +以下示例说明了这一点。 给定一个子图模式,如 ```graphql type Transfer @entity { @@ -333,7 +332,7 @@ 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: +以及以太坊上的 `Transfer(address,address,uint256)` 事件签名,`address` 和 `uint256` 类型的值`from`、`to` 和 `amount` 转换为 `Address` 和 `BigInt`,以便它们被传递到 `Transfer` 实体的 `Bytes!` 和 `BigInt!` 属性: ```typescript let id = event.transaction.hash.toHex() @@ -344,9 +343,9 @@ transfer.amount = event.params.amount transfer.save() ``` -#### Events and Block/Transaction Data +#### 事件和区块/交易数据 -Ethereum events passed to event handlers, such as the `Transfer` event in the previous examples, not only provide access to the event parameters but also to their parent transaction and the block they are part of. The following data can be obtained from `event` instances (these classes are a part of the `ethereum` module in `graph-ts`): +传递给事件处理程序的以太坊事件,例如前面示例中的 `Transfer` 事件,不仅提供对事件参数的访问,还提供对它们的父事务和它们所属的块的访问。 可以从 `event` 实例中获取以下数据(这些类是 `graph-ts` 中 `ethereum` 模块的一部分): ```typescript class Event { @@ -390,11 +389,11 @@ class Transaction { } ``` -#### Access to Smart Contract State +#### 访问智能合约状态 -The code generated by `graph codegen` also includes classes for the smart contracts used in the subgraph. These can be used to access public state variables and call functions of the contract at the current block. +`graph codegen` 生成的代码还包括子图中使用的智能合约的相关类。 这些可用于访问公共状态变量,并在当前区块调用合约的函数。 -A common pattern is to access the contract from which an event originates. This is achieved with the following code: +一种常见的模式是访问事件起源的合约。 这是通过以下代码实现的: ```typescript // Import the generated contract class @@ -411,13 +410,13 @@ export function handleTransfer(event: Transfer) { } ``` -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. +只要以太坊上的`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. +作为子图一部分的任何其他合约都可以从生成的代码中导入,并且可以绑定到一个有效地址。 -#### Handling Reverted Calls +#### 处理回滚调用 -If the read-only methods of your contract may revert, then you should handle that by calling the generated contract method prefixed with `try_`. For example, the Gravity contract exposes the `gravatarToOwner` method. This code would be able to handle a revert in that method: +如果您的合约的只读方法可能会回滚,那么您应该通过调用生成的以 `try_` 为前缀的合约方法来处理它。 例如,Gravity 合约公开了 `gravatarToOwner` 方法。 此代码将能够处理该方法中的回滚: ```typescript let gravity = Gravity.bind(event.address) @@ -429,11 +428,11 @@ if (callResult.reverted) { } ``` -Note that a Graph node connected to a Geth or Infura client may not detect all reverts, if you rely on this we recommend using a Graph node connected to a Parity client. +请注意,连接到 Geth 或 Infura 客户端的 Graph 节点可能无法检测到所有回滚,如果您依赖于此,我们建议使用连接到 Parity 客户端的 Graph 节点。 -#### Encoding/Decoding ABI +#### 编码/解码 ABI -Data can be encoded and decoded according to Ethereum's ABI encoding format using the `encode` and `decode` functions in the `ethereum` module. +使用`ethereum` 模块中的`encode` 和`decode` 函数,可以按照以太坊的ABI 编码格式对数据进行编码和解码。 ```typescript import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts' @@ -450,21 +449,21 @@ let encoded = ethereum.encode(ethereum.Value.fromTuple(tuple))! let decoded = ethereum.decode('(address,uint256)', encoded) ``` -For more information: +想要查询更多的信息: -- [ABI Spec](https://docs.soliditylang.org/en/v0.7.4/abi-spec.html#types) -- Encoding/decoding [Rust library/CLI](https://github.com/rust-ethereum/ethabi) -- More [complex example](https://github.com/graphprotocol/graph-node/blob/6a7806cc465949ebb9e5b8269eeb763857797efc/tests/integration-tests/host-exports/src/mapping.ts#L72). +- [ABI 规范](https://docs.soliditylang.org/en/v0.7.4/abi-spec.html#types) +- 编码/解码 [Rust 库/CLI](https://github.com/rust-ethereum/ethabi) +- 更多[复杂示例](https://github.com/graphprotocol/graph-node/blob/6a7806cc465949ebb9e5b8269eeb763857797efc/tests/integration-tests/host-exports/src/mapping.ts#L72)。 -### Logging API +### 日志记录 API ```typescript import { log } from '@graphprotocol/graph-ts' ``` -The `log` API allows subgraphs to log information to the Graph Node standard output as well as the Graph Explorer. Messages can be logged using different log levels. A basic format string syntax is provided to compose log messages from argument. +`log` API 允许子图将信息记录到 Graph节点标准输出以及 Graph Explorer。 可以使用不同的日志级别记录消息。有一个基本格式字符串语法可以用来编写带参数的日志消息。 -The `log` API includes the following functions: +`log` API 包括以下函数: - `log.debug(fmt: string, args: Array): void` - logs a debug message. - `log.info(fmt: string, args: Array): void` - logs an informational message. @@ -472,17 +471,17 @@ The `log` API includes the following functions: - `log.error(fmt: string, args: Array): void` - logs an error message. - `log.critical(fmt: string, args: Array): void` – logs a critical message _and_ terminates the subgraph. -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. +`log` API 采用格式字符串和字符串值数组,然后用数组中的字符串值替换占位符。 第一个 `{}` 占位符被数组中的第一个值替换,第二个 `{}` 占位符被第二个值替换,依此类推。 ```typescript log.info('Message to be displayed: {}, {}, {}', [value.toString(), anotherValue.toString(), 'already a string']) ``` -#### Logging one or more values +#### 记录一个或多个值 -##### Logging a single value +##### 记录单个值 -In the example below, the string value "A" is passed into an array to become`['A']` before being logged: +在下面的示例中,字符串值“A”在被记录之前被传递到一个数组中成为`['A']`: ```typescript let myValue = 'A' @@ -493,9 +492,9 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -##### Logging a single entry from an existing array +##### 从现有数组记录单个条目 -In the example below, only the first value of the argument array is logged, despite the array containing three values. +在下面的示例中,尽管参数数组包含三个值,只有该数组的第一个值被记录了。 ```typescript let myArray = ['A', 'B', 'C'] @@ -506,9 +505,9 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -#### Logging multiple entries from an existing array +#### 从现有数组记录多个条目 -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. +参数数组中的每个条目都需要在日志消息字符串中有自己的占位符 `{}`。 下面的示例在日志消息中包含三个占位符 `{}`。 因此,`myArray` 中的所有三个值都会被记录。 ```typescript let myArray = ['A', 'B', 'C'] @@ -519,9 +518,9 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -##### Logging a specific entry from an existing array +##### 从现有数组记录特定条目 -To display a specific value in the array, the indexed value must be provided. +要在数组中显示特定值,必须提供它的索引值。 ```typescript export function handleSomeEvent(event: SomeEvent): void { @@ -530,9 +529,9 @@ export function handleSomeEvent(event: SomeEvent): void { } ``` -##### Logging event information +##### 记录事件信息 -The example below logs the block number, block hash and transaction hash from an event: +下面的例子记录了一个事件的区块号、区块哈希和交易哈希: ```typescript import { log } from '@graphprotocol/graph-ts' @@ -552,9 +551,9 @@ export function handleSomeEvent(event: SomeEvent): void { import { ipfs } from '@graphprotocol/graph-ts' ``` -Smart contracts occasionally anchor IPFS files on chain. 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. +智能合约偶尔会在链上锚定 IPFS 文件。 这允许映射从合约中获取 IPFS 哈希并从 IPFS 读取相应的文件。 文件数据将以 `Bytes` 形式返回,这通常需要进一步处理,例如使用本页后面记录的 `json` API进行处理。 -Given an IPFS hash or path, reading a file from IPFS is done as follows: +给定一个 IPFS 哈希或路径,从 IPFS 读取文件的过程如下: ```typescript // Put this inside an event handler in the mapping @@ -567,9 +566,9 @@ 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`. To ensure that files can be retrieved, they have to be pinned to the IPFS node that Graph Node connects to. On the [hosted service](https://thegraph.com/hosted-service), this is [https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs). See the [IPFS pinning](/developer/create-subgraph-hosted#ipfs-pinning) section for more information. +**注意:** `ipfs.cat` 目前还不确定。 如果在请求超时之前无法通过 IPFS 网络检索文件,它将返回 `null`。 因此,检查 `null` 的结果总是值得的。 为了确保可以检索文件,必须将它们锚定到 Graph节点连接的 IPFS 节点。 在[托管服务](https://thegraph.com/hosted-service)上,这是[https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs)。 有关详细信息,请参阅 [IPFS 锚定](/developer/create-subgraph-hosted#ipfs-pinning) 部分。 -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: +还可以使用 `ipfs.map` 以流方式处理较大的文件。 该函数需要 IPFS 文件的哈希或路径、回调的名称以及修改其行为的标志: ```typescript import { JSONValue, Value } from '@graphprotocol/graph-ts' @@ -599,9 +598,9 @@ ipfs.map('Qm...', 'processItem', Value.fromString('parentId'), ['json']) 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. +当前支持的唯一标志是 `json`,它必须传递给 `ipfs.map`。 使用 `json` 标志,IPFS 文件必须包含一系列 JSON 值,每行一个值。 对 `ipfs.map` 的调用将读取文件中的每一行,将其反序列化为 `JSONValue` 并为每一行调用回调函数。 回调函数可以使用实体操作存储来自 `JSONValue` 的数据。 实体更改仅在调用 `ipfs.map` 的处理程序成功完成时存储; 同时,它们被保存在内存中,因此 `ipfs.map` 可以处理的文件的大小是有限的。 -On success, `ipfs.map` returns `void`. If any invocation of the callback causes an error, the handler that invoked `ipfs.map` is aborted, and the subgraph is marked as failed. +成功时,`ipfs.map` 返回 `void`。 如果回调函数的任何调用导致错误,则调用 `ipfs.map` 的处理程序将被中止,并且子图被标记为失败。 ### Crypto API @@ -609,7 +608,7 @@ On success, `ipfs.map` returns `void`. If any invocation of the callback causes import { crypto } from '@graphprotocol/graph-ts' ``` -The `crypto` API makes a cryptographic functions available for use in mappings. Right now, there is only one: +`crypto` API 使加密函数可用于映射。 目前,只有一个函数: - `crypto.keccak256(input: ByteArray): ByteArray` @@ -619,14 +618,14 @@ The `crypto` API makes a cryptographic functions available for use in mappings. import { json, JSONValueKind } from '@graphprotocol/graph-ts' ``` -JSON data can be parsed using the `json` API: +JSON 数据可以使用 `json` API 进行解析: -- `json.fromBytes(data: Bytes): JSONValue` – parses JSON data from a `Bytes` array -- `json.try_fromBytes(data: Bytes): Result` – safe version of `json.fromBytes`, it returns an error variant if the parsing failed -- `json.fromString(data: Bytes): JSONValue` – parses JSON data from a valid UTF-8 `String` -- `json.try_fromString(data: Bytes): Result` – safe version of `json.fromString`, it returns an error variant if the parsing failed +- `json.fromBytes(data: Bytes): JSONValue` – 解析来自 `Bytes` 数组的 JSON 数据,解释为有效的 UTF-8 序列 +- `json.try_fromBytes(data: Bytes): Result` – `json.fromBytes`的安全版本, 如果解析失败则返回错误变体 +- `json.fromString(data: string): JSONValue` – 从有效的 UTF-8 `String` 解析 JSON 数据 +- `json.try_fromString(data: Bytes): Result` – `json.fromString`的安全版本, 如果解析失败则返回错误变体 -The `JSONValue` class provides a way to pull values out of an arbitrary JSON document. Since JSON values can be booleans, numbers, arrays and more, `JSONValue` comes with a `kind` property to check the type of a value: +`JSONValue` 类提供了一种从任意 JSON 文档中提取值的方法。 由于 JSON 值可以是布尔值、数字、数组等,因此 `JSONValue` 带有一个 `kind` 属性来检查值的类型: ```typescript let value = json.fromBytes(...) @@ -635,70 +634,70 @@ if (value.kind == JSONValueKind.BOOL) { } ``` -In addition, there is a method to check if the value is `null`: +另外,还有一个方法可以检查该值是否为`null`: - `value.isNull(): boolean` -When the type of a value is certain, it can be converted to a [built-in type](#built-in-types) using one of the following methods: +当值的类型确定时,可以使用以下方法之一将其转换为[内置类型](#built-in-types): - `value.toBool(): boolean` - `value.toI64(): i64` - `value.toF64(): f64` - `value.toBigInt(): BigInt` - `value.toString(): string` -- `value.toArray(): Array` - (and then convert `JSONValue` with one of the 5 methods above) - -### Type Conversions Reference - -| Source(s) | Destination | Conversion function | -| -------------------- | -------------------- | ---------------------------- | -| Address | Bytes | none | -| Address | ID | s.toHexString() | -| 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) | -| String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | - -### Data Source Metadata - -You can inspect the contract address, network and context of the data source that invoked the handler through the `dataSource` namespace: +- `value.toArray(): Array` - (然后使用上述 5 种方法之一转换 `JSONValue`) + +### 类型转换参考 + +| 源 | 目标 | 转换函数 | +| -------------------- | -------------------- | --------------------------- | +| Address | Bytes | none | +| Address | ID | s.toHexString() | +| 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 | none | +| 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 | 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) | +| String | BigDecimal | BigDecimal.fromString(s) | +| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | +| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | + +### 数据源元数据 + +您可以通过 `dataSource` 命名空间检查调用处理程序的数据源的合约地址、网络和上下文: - `dataSource.address(): Address` - `dataSource.network(): string` - `dataSource.context(): DataSourceContext` -### Entity and DataSourceContext +### Entity 和 DataSourceContext -The base `Entity` class and the child `DataSourceContext` class have helpers to dynamically set and get fields: +基础 `Entity` 类和子 `DataSourceContext` 类可以帮助动态设置和获取字段: - `setString(key: string, value: string): void` - `setI32(key: string, value: i32): void` From c7974f1a72295a8834977cd371d38f2e958c8272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:43 -0500 Subject: [PATCH 20/47] New translations assemblyscript-migration-guide.mdx (Arabic) --- .../assemblyscript-migration-guide.mdx | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pages/ar/developer/assemblyscript-migration-guide.mdx b/pages/ar/developer/assemblyscript-migration-guide.mdx index 38ed98f0c53b..7de692369954 100644 --- a/pages/ar/developer/assemblyscript-migration-guide.mdx +++ b/pages/ar/developer/assemblyscript-migration-guide.mdx @@ -14,17 +14,17 @@ title: دليل ترحيل AssemblyScript ### وظائف جديدة -- `TypedArray`s can now be built from `ArrayBuffer`s by using the [new `wrap` static method](https://www.assemblyscript.org/stdlib/typedarray.html#static-members) ([v0.8.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.8.1)) +- يمكن الآن إنشاء `TypedArray` من ` ArrayBuffer ` باستخدام [new `wrap` static method](https://www.assemblyscript.org/stdlib/typedarray.html#static-members) ([v0.8.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.8.1)) جديد - وظائف المكتبة القياسية الجديدة`String#toUpperCase`, `String#toLowerCase`, `String#localeCompare`and `TypedArray#set` ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) - تمت إضافة دعم لـ x instanceof GenericClass ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2)) -- Added `StaticArray`, a more efficient array variant ([v0.9.3](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.3)) +- تمت إضافة `StaticArray` متغير مصفوفة أكثر كفاءة([v0.9.3](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.3)) - تمت إضافة`Array#flat` ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) - تم تنفيذ`radix` argument on `Number#toString` ([v0.10.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.1)) -- Added support for separators in floating point literals ([v0.13.7](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.13.7)) +- دعم إضافي للفواصل في floating point literals ([v0.13.7](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.13.7)) - دعم إضافي لوظائف الدرجة الأولى ([ v0.14.0 ](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.0)) - إضافة البناء: `i32/i64/f32/f64.add/sub/mul` ([v0.14.13](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.13)) - تنفيذ `Array/TypedArray/String#at` ([v0.18.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2)) -- Added support for template literal strings ([v0.18.17](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.17)) +- دعم إضافي لقوالب literal strings ([v0.18.17](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.17)) - أضف`encodeURI(Component)` و `decodeURI(Component)` ([v0.18.27](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.27)) - أضف`toString`, `toDateString` و `toTimeString` ل `Date` ([v0.18.29](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.29)) - أضف`toUTCString` ل `Date` ([v0.18.30](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.30)) @@ -34,7 +34,7 @@ title: دليل ترحيل AssemblyScript - `Math` دوال مثل `exp`, `exp2`, `log`, `log2` and `pow` تم استبدالها بمتغيرات أسرع ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) - أكثر تحسينا `Math.mod` ([v0.17.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.1)) -- Cache more field accesses in std Map and Set ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) +- تخزين المزيد من الوصول للحقول في std Map و Set ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) - قم بتحسين قدرات اثنين في `ipow32 / 64` ([ v0.18.2 ](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2)) ### آخر @@ -110,7 +110,7 @@ maybeValue.aMethod() ### Variable Shadowing -Before you could do [variable shadowing](https://en.wikipedia.org/wiki/Variable_shadowing) and code like this would work: +قبل أن تتمكن من إجراء [variable shadowing](https://en.wikipedia.org/wiki/Variable_shadowing) وتعمل تعليمات برمجية مثل هذه: ```typescript let a = 10 @@ -121,9 +121,9 @@ let a = a + b لكن هذا لم يعد ممكنًا الآن ، ويعيد المترجم هذا الخطأ: ```typescript -ERROR TS2451: Cannot redeclare block-scoped variable 'a' +'ERROR TS2451: Cannot redeclare block-scoped variable 'a - let a = a + b; +; let a = a + b ~~~~~~~~~~~~~ in assembly/index.ts(4,3) ``` @@ -161,7 +161,7 @@ let uint8Array = byteArray as Uint8Array // equivalent to: byteArray لكن هذا لا يعمل إلا في سيناريوهين: - Primitive casting (بين انواع مثل`u8`, `i32`, `bool`; eg: `let b: isize = 10; b as usize`); -- Upcasting on class inheritance (subclass → superclass) +- Upcasting على وراثة الفئة (subclass → superclass) أمثلة: @@ -181,7 +181,7 @@ let bytes = new Bytes(2) < Uint8Array > bytes // same as: bytes as Uint8Array هناك سيناريوهين قد ترغب في ال cast ، ولكن باستخدام`as`/`var` **ليس آمنا**: -- Downcasting on class inheritance (superclass → subclass) +- Downcasting وراثة الفئة (superclass → subclass) - بين نوعين يشتركان في فئة superclass ```typescript @@ -281,7 +281,7 @@ ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/s let somethingOrElse: string = container.data ؟ container.data : "else"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` -To fix this issue, you can create a variable for that property access so that the compiler can do the nullability check magic: +لإصلاح هذه المشكلة ، يمكنك إنشاء متغير للوصول إلى هذه الخاصية حتى يتمكن المترجم من القيام بعملية التحقق من الـ nullability: ```typescript class Container { @@ -298,7 +298,7 @@ let somethingOrElse: string = data ؟ data : 'else' // compiles just fine :) ### التحميل الزائد للمشغل مع الوصول للخاصية -If you try to sum (for example) a nullable type (from a property access) with a non nullable one, the AssemblyScript compiler instead of giving a compile time error warning that one of the values is nullable, it just compiles silently, giving chance for the code to break at runtime. +(على سبيل المثال) إذا حاولت جمع نوع nullable (من وصول خاصية) مع نوع nullable ، فإن محول AssemblyScript بدلاً من إعطاء خطأ في وقت التحويل يحذر من أن إحدى القيم nullable، إنه يقوم فقط بالترجمة بصمت ، مما يتيح الفرصة للكود للتوقف في وقت التشغيل. ```typescript class BigInt extends Uint8Array { @@ -475,10 +475,10 @@ type MyEntity @entity { ### آخر -- Aligned `Map#set` and `Set#add` with the spec, returning `this` ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2)) +- تم ضبط `Map#set` و`Set#add` مع المواصفات ، راجعا بـ `this` ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2)) - لم تعد المصفوفة ترث من ArrayBufferView ، لكنها أصبحت متميزة الآن ([ v0.10.0 ](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) -- Classes initialized from object literals can no longer define a constructor ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) +- لم يعد بإمكان الفئات التي تمت تهيئتها من قيم كائن تعريف باني لها ([ v0.10.0 ](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) - نتيجة العملية الثنائية `**` هي الآن العدد الصحيح للمقام المشترك إذا كان كلا المعاملين عددًا صحيحًا. Previously, the result was a float as if calling `Math/f.pow` ([v0.11.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.11.0)) - إجبار`NaN` إلى `false` عندما ال casting إلى`bool` ([v0.14.9](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.9)) - When shifting a small integer value of type `i8`/`u8` or `i16`/`u16`, only the 3 respectively 4 least significant bits of the RHS value affect the result, analogous to the result of an `i32.shl` only being affected by the 5 least significant bits of the RHS value. Example: `someI8 << 8` previously produced the value `0`, but now produces `someI8` due to masking the RHS as `8 & 7 = 0` (3 bits) ([v0.17.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.0)) -- Bug fix of relational string comparisons when sizes differ ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) +- إصلاح خلل مقارنات السلاسل العلائقية عندما تختلف الأحجام ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) From 02fc1f93c54b58576309a01190274fa22c3edc67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:47 -0500 Subject: [PATCH 21/47] New translations assemblyscript-migration-guide.mdx (Korean) --- .../assemblyscript-migration-guide.mdx | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/pages/ko/developer/assemblyscript-migration-guide.mdx b/pages/ko/developer/assemblyscript-migration-guide.mdx index 2db90a608110..0a2cb73f3c23 100644 --- a/pages/ko/developer/assemblyscript-migration-guide.mdx +++ b/pages/ko/developer/assemblyscript-migration-guide.mdx @@ -1,50 +1,50 @@ --- -title: AssemblyScript Migration Guide +title: AssemblyScript 마이그레이션 가이드 --- -Up until now, subgraphs have been using one of the [first versions of AssemblyScript](https://github.com/AssemblyScript/assemblyscript/tree/v0.6) (v0.6). Finally we've added support for the [newest one available](https://github.com/AssemblyScript/assemblyscript/tree/v0.19.10) (v0.19.10)! 🎉 +지금까지 서브그래프는 [초기 버전의 AssemblyScript](https://github.com/AssemblyScript/assemblyscript/tree/v0.6) 중 하나를 사용해 왔습니다. 마침내 [최신 버전](https://github.com/AssemblyScript/assemblyscript/tree/v0.19.10)(v0.19.10)에 대한 지원이 추가되었습니다! 🎉 -That will enable subgraph developers to use newer features of the AS language and standard library. +이를 통해 서브그래프 개발자들은 AS 언어와 표준 라이브러리의 새로운 기능들을 사용할 수 있습니다. -This guide is applicable for anyone using `graph-cli`/`graph-ts` below version `0.22.0`. If you're already at a higher than (or equal) version to that, you've already been using version `0.19.10` of AssemblyScript 🙂 +이 가이드는 `0.22.0` 버전 이하의 `graph-cli`/`graph-ts`를 사용하는 모든 사용자에게 적용됩니다. 만약 여러분들이 이 버전보다 높은(또는 같은) 버전에 해당하신다면, 여러분들은 이미 `0.19.10` AssemblyScript 🙂 버전을 사용하고 있는 것입니다. -> Note: As of `0.24.0`, `graph-node` can support both versions, depending on the `apiVersion` specified in the subgraph manifest. +> 참고: `0.24.0` 부터는 서브그래프 매니페스트에 지정된 `apiVersion`에 따라 `graph-node`가 두 버전을 모두 지원할 수 있습니다. -## Features +## 특징 -### New functionality +### 새로운 기능 -- `TypedArray`s can now be built from `ArrayBuffer`s by using the [new `wrap` static method](https://www.assemblyscript.org/stdlib/typedarray.html#static-members) ([v0.8.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.8.1)) -- New standard library functions: `String#toUpperCase`, `String#toLowerCase`, `String#localeCompare`and `TypedArray#set` ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) -- Added support for x instanceof GenericClass ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2)) -- Added `StaticArray`, a more efficient array variant ([v0.9.3](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.3)) -- Added `Array#flat` ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) -- Implemented `radix` argument on `Number#toString` ([v0.10.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.1)) -- Added support for separators in floating point literals ([v0.13.7](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.13.7)) -- Added support for first class functions ([v0.14.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.0)) -- Add builtins: `i32/i64/f32/f64.add/sub/mul` ([v0.14.13](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.13)) -- Implement `Array/TypedArray/String#at` ([v0.18.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2)) -- Added support for template literal strings ([v0.18.17](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.17)) -- Add `encodeURI(Component)` and `decodeURI(Component)` ([v0.18.27](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.27)) -- Add `toString`, `toDateString` and `toTimeString` to `Date` ([v0.18.29](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.29)) -- Add `toUTCString` for `Date` ([v0.18.30](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.30)) -- Add `nonnull/NonNullable` builtin type ([v0.19.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.19.2)) +- `TypedArray`는 이제 [new `wrap` static method](https://www.assemblyscript.org/stdlib/typedarray.html#static-members) ([v0.8.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.8.1))를 사용하여 `ArrayBuffer`에서 빌드할 수 있습니다. +- 새로운 표준 라이브러리 기능들: `String#toUpperCase`, `String#toLowerCase`, `String#localeCompare`and `TypedArray#set` ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) +- GenericClass의 x 인스턴스에 대한 지원이 추가되었습니다. ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2)) +- 보다 효율적인 배열 별어(variant)인 `StaticArray`가 추가되었습니다. ([v0.9.3](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.3)) +- `Array#flat`을 추가했습니다. ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) +- `Number#toString`에 대해 `radix` 인수를 구현했습니다.([v0.10.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.1)) +- 부동 소수점 리터럴에서 구분자에 대한 지원이 추가되었습니다. ([v0.13.7](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.13.7)) +- 첫번째 클래스 기능들을 위한 지원이 추가되었습니다. ([v0.14.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.0)) +- 기본 내장기능들이 추가되었습니다: `i32/i64/f32/f64.add/sub/mul` ([v0.14.13](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.13)) +- `Array/TypedArray/String#at` 구현 ([v0.18.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2)) +- 템플릿 리터럴 문자열에 대한 지원이 추가되었습니다. ([v0.18.17](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.17)) +- `encodeURI(Component)` 및 `decodeURI(Component)`을 추가합니다. ([v0.18.27](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.27)) +- `toString`, `toDateString` 및`toTimeString` to `Date`를 추가합니다. ([v0.18.29](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.29)) +- `Date`를 위한 `toUTCString`를 추가합니다. ([v0.18.30](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.30)) +- `nonnull/NonNullable` 내장 유형을 추가합니다. ([v0.19.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.19.2)) -### Optimizations +### 최적화 -- `Math` functions such as `exp`, `exp2`, `log`, `log2` and `pow` have been replaced by faster variants ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) -- Slightly optimize `Math.mod` ([v0.17.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.1)) -- Cache more field accesses in std Map and Set ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) -- Optimize for powers of two in `ipow32/64` ([v0.18.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2)) +- `exp`, `exp2`, `log`, `log2` and `pow` 와 같은 `Math` 함수들이 더 빠른 별어([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0))으로 대체되었습니다. +- `Math.mod`에 대한 간략한 최적화 작업이 진행되었습니다. ([v0.17.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.1)) +- Std Map and Set 내 더 많은 필드 엑세스 캐시([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) +- `ipow32/64`에서 2배수 최적화 ([v0.18.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2)) -### Other +### 기타사항 -- The type of an array literal can now be inferred from its contents ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) -- Updated stdlib to Unicode 13.0.0 ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) +- 이제 배열 리터럴의 형식을 콘텐츠에서 유추할 수 있습니다.([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) +- Stdlib가 유니코드 13.0.0으로 업데이트되었습니다. ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) -## How to upgrade? +## 어떻게 업그레이드 하나요? -1. Change your mappings `apiVersion` in `subgraph.yaml` to `0.0.6`: +1. `subgraph.yaml` 내의 mappings `apiVersion`을 `0.0.6`로 변경합니다. ```yaml ... @@ -56,7 +56,7 @@ dataSources: ... ``` -2. Update the `graph-cli` you're using to the `latest` version by running: +2. 다음을 실행하여 사용 중인 `graph-cli`를 `최신` 버전으로 업데이트합니다. ```bash # if you have it globally installed @@ -66,16 +66,16 @@ npm install --global @graphprotocol/graph-cli@latest npm install --save-dev @graphprotocol/graph-cli@latest ``` -3. Do the same for `graph-ts`, but instead of installing globally, save it in your main dependencies: +3. `graph-ts`에도 같은 작업을 수행합니다. 그러나 전역(Globally)으로 설치하는 대신 메인 의존성(Main dependencies)에 저장하십시길 바랍니다: ```bash npm install --save @graphprotocol/graph-ts@latest ``` -4. Follow the rest of the guide to fix the language breaking changes. -5. Run `codegen` and `deploy` again. +4. 가이드의 나머지 부분에 따라 언어 주요 변경 사항을 수정합니다. +5. `codegen`을 실행하고, 다시 `deploy`합니다. -## Breaking changes +## 주요 변경 사항 ### Nullability @@ -473,7 +473,7 @@ type MyEntity @entity { This changed because of nullability differences between AssemblyScript versions, and it's related to the `src/generated/schema.ts` file (default path, you might have changed this). -### Other +### 기타사항 - Aligned `Map#set` and `Set#add` with the spec, returning `this` ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2)) - Arrays no longer inherit from ArrayBufferView, but are now distinct ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) From 5af67a8e13c97212318f9478ab2431ec091f6d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:49 -0500 Subject: [PATCH 22/47] New translations assemblyscript-migration-guide.mdx (Chinese Simplified) --- .../assemblyscript-migration-guide.mdx | 188 +++++++++--------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/pages/zh/developer/assemblyscript-migration-guide.mdx b/pages/zh/developer/assemblyscript-migration-guide.mdx index 2db90a608110..1945ed786f01 100644 --- a/pages/zh/developer/assemblyscript-migration-guide.mdx +++ b/pages/zh/developer/assemblyscript-migration-guide.mdx @@ -1,50 +1,50 @@ --- -title: AssemblyScript Migration Guide +title: AssemblyScript 迁移指南 --- -Up until now, subgraphs have been using one of the [first versions of AssemblyScript](https://github.com/AssemblyScript/assemblyscript/tree/v0.6) (v0.6). Finally we've added support for the [newest one available](https://github.com/AssemblyScript/assemblyscript/tree/v0.19.10) (v0.19.10)! 🎉 +到目前为止,子图一直在使用 [AssemblyScript 的第一个版本](https://github.com/AssemblyScript/assemblyscript/tree/v0.6) (v0.6) 之一。 最终,我们添加了对[最新版本](https://github.com/AssemblyScript/assemblyscript/tree/v0.19.10) (v0.19.10) 的支持! 🎉 -That will enable subgraph developers to use newer features of the AS language and standard library. +这将使子图开发人员能够使用 AS 语言和标准库的更新功能。 -This guide is applicable for anyone using `graph-cli`/`graph-ts` below version `0.22.0`. If you're already at a higher than (or equal) version to that, you've already been using version `0.19.10` of AssemblyScript 🙂 +本指南适用于使用 `0.22.0` 版本以下的 `graph-cli`/`graph-ts` 的任何人。 如果您已经使用了高于(或等于)该版本号的版本,那么您已经在使用 AssemblyScript 的 `0.19.10` 版本🙂 -> Note: As of `0.24.0`, `graph-node` can support both versions, depending on the `apiVersion` specified in the subgraph manifest. +> 注意:从 `0.24.0` 开始,`graph-node` 可以支持这两个版本,具体取决于子图清单文件中指定的 `apiVersion`。 -## Features +## 功能 -### New functionality +### 新功能 -- `TypedArray`s can now be built from `ArrayBuffer`s by using the [new `wrap` static method](https://www.assemblyscript.org/stdlib/typedarray.html#static-members) ([v0.8.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.8.1)) -- New standard library functions: `String#toUpperCase`, `String#toLowerCase`, `String#localeCompare`and `TypedArray#set` ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) -- Added support for x instanceof GenericClass ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2)) -- Added `StaticArray`, a more efficient array variant ([v0.9.3](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.3)) -- Added `Array#flat` ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) -- Implemented `radix` argument on `Number#toString` ([v0.10.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.1)) -- Added support for separators in floating point literals ([v0.13.7](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.13.7)) -- Added support for first class functions ([v0.14.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.0)) -- Add builtins: `i32/i64/f32/f64.add/sub/mul` ([v0.14.13](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.13)) -- Implement `Array/TypedArray/String#at` ([v0.18.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2)) -- Added support for template literal strings ([v0.18.17](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.17)) -- Add `encodeURI(Component)` and `decodeURI(Component)` ([v0.18.27](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.27)) -- Add `toString`, `toDateString` and `toTimeString` to `Date` ([v0.18.29](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.29)) -- Add `toUTCString` for `Date` ([v0.18.30](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.30)) -- Add `nonnull/NonNullable` builtin type ([v0.19.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.19.2)) +- `TypedArray`s 现在可以使用[新的`wrap`静态方法](https://www.assemblyscript.org/stdlib/typedarray.html#static-members) ([v0.8.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.8.1))基于`ArrayBuffer`s 构建 +- 新的标准库函数: `String#toUpperCase`, `String#toLowerCase`, `String#localeCompare`和`TypedArray#set` ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) +- 增加了对 x instanceof GenericClass ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2))的支持 +- 添加了 `StaticArray`, 一种更高效的数组变体 ([v0.9.3](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.3)) +- 增加了 `Array#flat` ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) +- 在`Number#toString` ([v0.10.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.1))上实现了`radix` 参数 +- 添加了对浮点文字中的分隔符的支持 ([v0.13.7](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.13.7)) +- 添加了对一级函数的支持 ([v0.14.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.0)) +- 添加内置函数:`i32/i64/f32/f64.add/sub/mul` ([ v0.14.13](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.13)) +- 实现了`Array/TypedArray/String#at` ([v0.18.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2)) +- 添加了对模板文字字符串的支持([v0.18.17](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.17)) +- 添加了`encodeURI(Component)` 和 `decodeURI(Component)` ([v0.18.27](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.27)) +- 将 `toString`、`toDateString` 和 `toTimeString` 添加到 `Date` ([v0.18.29](https://github.com/ AssemblyScript/assemblyscript/releases/tag/v0.18.29)) +- 为`Date` 添加了`toUTCString`([v0.18.30](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.30)) +- 添加 `nonnull/NonNullable` 内置类型([v0.19.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.19.2)) -### Optimizations +### 优化 -- `Math` functions such as `exp`, `exp2`, `log`, `log2` and `pow` have been replaced by faster variants ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) -- Slightly optimize `Math.mod` ([v0.17.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.1)) -- Cache more field accesses in std Map and Set ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) -- Optimize for powers of two in `ipow32/64` ([v0.18.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2)) +- `Math` 函数,例如 `exp`、`exp2`、`log`、`log2` 和 ` pow` 已替换为更快的变体 ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) +- 些许优化了`Math.mod` ([v0.17.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.1)) +- 在 std Map 和 Set ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) 中缓存更多字段访问 +- 在 `ipow32/64` ([v0.18.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.18.2))中优化二的幂运算 -### Other +### 其他 -- The type of an array literal can now be inferred from its contents ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) -- Updated stdlib to Unicode 13.0.0 ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) +- 现在可以从数组内容中推断出数组文字的类型([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) +- 将 stdlib 更新为 Unicode 13.0.0 ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) -## How to upgrade? +## 如何升级? -1. Change your mappings `apiVersion` in `subgraph.yaml` to `0.0.6`: +1. 将 `subgraph.yaml` 中的映射 `apiVersion` 更改为 `0.0.6`: ```yaml ... @@ -56,7 +56,7 @@ dataSources: ... ``` -2. Update the `graph-cli` you're using to the `latest` version by running: +2. 通过运行以下命令,将您正在使用的 `graph-cli` 更新为 `latest` 版本: ```bash # if you have it globally installed @@ -66,20 +66,20 @@ npm install --global @graphprotocol/graph-cli@latest npm install --save-dev @graphprotocol/graph-cli@latest ``` -3. Do the same for `graph-ts`, but instead of installing globally, save it in your main dependencies: +3. 对 `graph-ts` 执行相同的操作,但不是全局安装,而是将其保存在您的主要依赖项中: ```bash npm install --save @graphprotocol/graph-ts@latest ``` -4. Follow the rest of the guide to fix the language breaking changes. -5. Run `codegen` and `deploy` again. +4. 参考指南的其余部分修复语言更改带来的问题。 +5. 再次运行 `codegen` 和 `deploy`。 -## Breaking changes +## 重大变化 -### Nullability +### 可空性 -On the older version of AssemblyScript, you could create code like this: +在旧版本的 AssemblyScript 上,您可以创建如下代码: ```typescript function load(): Value | null { ... } @@ -88,7 +88,7 @@ let maybeValue = load(); maybeValue.aMethod(); ``` -However on the newer version, because the value is nullable, it requires you to check, like this: +但是在较新的版本中,由于该值可以为空,因此需要您进行检查,如下所示: ```typescript let maybeValue = load() @@ -98,7 +98,7 @@ if (maybeValue) { } ``` -Or force it like this: +或者像这样编写代码: ```typescript let maybeValue = load()! // breaks in runtime if value is null @@ -106,11 +106,11 @@ let maybeValue = load()! // breaks in runtime if value is null maybeValue.aMethod() ``` -If you are unsure which to choose, we recommend always using the safe version. If the value doesn't exist you might want to just do an early if statement with a return in you subgraph handler. +如果您不确定选择哪个,我们建议始终使用安全的方式。 如果该值不存在,您可能只想在您的子图处理程序中,尽早执行一个带有 return 的if 语句进行检查。 -### Variable Shadowing +### 变量遮蔽 -Before you could do [variable shadowing](https://en.wikipedia.org/wiki/Variable_shadowing) and code like this would work: +在您可以进行 [变量遮蔽](https://en.wikipedia.org/wiki/Variable_shadowing) 之前,这样的代码可以工作: ```typescript let a = 10 @@ -118,7 +118,7 @@ let b = 20 let a = a + b ``` -However now this isn't possible anymore, and the compiler returns this error: +但是现在这不可能了,编译器会返回这个错误: ```typescript ERROR TS2451: Cannot redeclare block-scoped variable 'a' @@ -127,9 +127,9 @@ ERROR TS2451: Cannot redeclare block-scoped variable 'a' ~~~~~~~~~~~~~ in assembly/index.ts(4,3) ``` -You'll need to rename your duplicate variables if you had variable shadowing. -### Null Comparisons -By doing the upgrade on your subgraph, sometimes you might get errors like these: +如果您有变量遮蔽的情况,则需要重命名重名变量。 +### 空值比较 +对子图进行升级后,有时您可能会遇到如下错误: ```typescript ERROR TS2322: Type '~lib/@graphprotocol/graph-ts/common/numbers/BigInt | null' is not assignable to type '~lib/@graphprotocol/graph-ts/common/numbers/BigInt'. @@ -137,7 +137,7 @@ ERROR TS2322: Type '~lib/@graphprotocol/graph-ts/common/numbers/BigInt | null' i ~~~~ in src/mappings/file.ts(41,21) ``` -To solve you can simply change the `if` statement to something like this: +要解决此问题,您只需将 `if` 语句更改为如下所示代码: ```typescript if (!decimals) { @@ -147,23 +147,23 @@ To solve you can simply change the `if` statement to something like this: if (decimals === null) { ``` -The same applies if you're doing != instead of ==. +如果您使用 != 而不是 ==,这同样适用。 -### Casting +### 强制转换 -The common way to do casting before was to just use the `as` keyword, like this: +以前,进行强制转换的常用方法是使用 `as`关键字,如下所示: ```typescript let byteArray = new ByteArray(10) let uint8Array = byteArray as Uint8Array // equivalent to: byteArray ``` -However this only works in two scenarios: +但是,这只适用于两种情况: -- Primitive casting (between types such as `u8`, `i32`, `bool`; eg: `let b: isize = 10; b as usize`); -- Upcasting on class inheritance (subclass → superclass) +- 原始类型转换(在`u8`, `i32`, `bool`等类型之间; 例如: `let b: isize = 10; b as usize`); +- 在类继承时向上转换(子类→超类) -Examples: +例子: ```typescript // primitive casting @@ -179,10 +179,10 @@ class Bytes extends Uint8Array {} let bytes = new Bytes(2) < Uint8Array > bytes // same as: bytes as Uint8Array ``` -There are two scenarios where you may want to cast, but using `as`/`var` **isn't safe**: +在两种情况下,您可能希望进行类型转换,但使用 `as`/`var` **并不安全**: -- Downcasting on class inheritance (superclass → subclass) -- Between two types that share a superclass +- 在类继承时向下转换(超类→子类) +- 在共享超类的两种类型之间 ```typescript // downcasting on class inheritance @@ -199,7 +199,7 @@ class ByteArray extends Uint8Array {} let bytes = new Bytes(2) < ByteArray > bytes // breaks in runtime :( ``` -For those cases, you can use the `changetype` function: +对于这些情况,您可以使用 `changetype` 函数: ```typescript // downcasting on class inheritance @@ -218,7 +218,7 @@ let bytes = new Bytes(2) changetype(bytes) // works :) ``` -If you just want to remove nullability, you can keep using the `as` operator (or `variable`), but make sure you know that value can't be null, otherwise it will break. +如果您只想去掉可空性,您可以继续使用 `as` 运算符(或 `variable`),但请确保您知道该值不会为空, 否则程序会出现问题。 ```typescript // remove nullability @@ -231,18 +231,18 @@ if (previousBalance != null) { let newBalance = new AccountBalance(balanceId) ``` -For the nullability case we recommend taking a look at the [nullability check feature](https://www.assemblyscript.org/basics.html#nullability-checks), it will make your code cleaner 🙂 +对于可空性情况,我们建议查看[可空性检查功能](https://www.assemblyscript.org/basics.html#nullability-checks),它会让您的代码更简洁🙂 -Also we've added a few more static methods in some types to ease casting, they are: +我们还在某些类型中添加了一些静态方法来简化转换,它们是: - Bytes.fromByteArray - Bytes.fromUint8Array - BigInt.fromByteArray - ByteArray.fromBigInt -### Nullability check with property access +### 使用属性访问进行可空性检查 -To use the [nullability check feature](https://www.assemblyscript.org/basics.html#nullability-checks) you can use either `if` statements or the ternary operator (`?` and `:`) like this: +要使用 [可空性检查功能](https://www.assemblyscript.org/basics.html#nullability-checks),您可以使用 `if` 语句或三元运算符(`?` 和 `:`),如下所示: ```typescript let something: string | null = 'data' @@ -260,7 +260,7 @@ if (something) { } ``` -However that only works when you're doing the `if` / ternary on a variable, not on a property access, like this: +但是,这仅在您对变量执行 `if` / 三元组而不是属性访问时才有效,如下所示: ```typescript class Container { @@ -273,7 +273,7 @@ container.data = 'data' let somethingOrElse: string = container.data ? container.data : 'else' // doesn't compile ``` -Which outputs this error: +输出此错误: ```typescript ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/string/String'. @@ -281,7 +281,7 @@ ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/s let somethingOrElse: string = container.data ? container.data : "else"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` -To fix this issue, you can create a variable for that property access so that the compiler can do the nullability check magic: +要解决此问题,您可以为该属性访问创建一个变量,以便编译器可以执行可空性检查: ```typescript class Container { @@ -296,9 +296,9 @@ let data = container.data let somethingOrElse: string = data ? data : 'else' // compiles just fine :) ``` -### Operator overloading with property access +### 具有属性访问的运算符重载 -If you try to sum (for example) a nullable type (from a property access) with a non nullable one, the AssemblyScript compiler instead of giving a compile time error warning that one of the values is nullable, it just compiles silently, giving chance for the code to break at runtime. +如果您尝试将可空类型(来自属性访问)与不可空类型相加,AssemblyScript 编译器不会给出编译时错误警告其中一个值可以为空,它只是静默编译,这会导致代码在运行时可能出现问题。 ```typescript class BigInt extends Uint8Array { @@ -322,7 +322,7 @@ let wrapper = new Wrapper(y) wrapper.n = wrapper.n + x // doesn't give compile time errors as it should ``` -We've opened a issue on the AssemblyScript compiler for this, but for now if you do these kind of operations in your subgraph mappings, you should change them to do a null check before it. +我们为此在 AssemblyScript 编译器上提出了一个issue,但现在如果您在子图映射中执行此类操作,您应该在之前进行空值检查。 ```typescript let wrapper = new Wrapper(y) @@ -334,9 +334,9 @@ if (!wrapper.n) { wrapper.n = wrapper.n + x // now `n` is guaranteed to be a BigInt ``` -### Value initialization +### 值初始化 -If you have any code like this: +如果您有这样的代码: ```typescript var value: Type // null @@ -344,7 +344,7 @@ value.x = 10 value.y = 'content' ``` -It will compile but break at runtime, that happens because the value hasn't been initialized, so make sure your subgraph has initialized their values, like this: +代码将编译成功,但在运行时会出现问题,这是因为值尚未初始化,因此请确保您的子图已初始化变量的值,如下所示: ```typescript var value = new Type() // initialized @@ -352,7 +352,7 @@ value.x = 10 value.y = 'content' ``` -Also if you have nullable properties in a GraphQL entity, like this: +此外,如果您在 GraphQL 实体中有可为空的属性,如下所示: ```graphql type Total @entity { @@ -361,7 +361,7 @@ type Total @entity { } ``` -And you have code similar to this: +同时,您有类似这样的代码: ```typescript let total = Total.load('latest') @@ -373,7 +373,7 @@ if (total === null) { total.amount = total.amount + BigInt.fromI32(1) ``` -You'll need to make sure to initialize the `total.amount` value, because if you try to access like in the last line for the sum, it will crash. So you either initialize it first: +您需要确保初始化 `total.amount` 值,因为如果您尝试像最后一行代码一样求和,程序将崩溃。 所以你要么先初始化它: ```typescript let total = Total.load('latest') @@ -386,7 +386,7 @@ if (total === null) { total.tokens = total.tokens + BigInt.fromI32(1) ``` -Or you can just change your GraphQL schema to not use a nullable type for this property, then we'll initialize it as zero on the `codegen` step 😉 +或者您可以更改您的 GraphQL 模式,不给此属性赋予可为空的类型,然后您在 `codegen` 步骤中将其初始化为零😉 ```graphql type Total @entity { @@ -405,9 +405,9 @@ if (total === null) { total.amount = total.amount + BigInt.fromI32(1) ``` -### Class property initialization +### 类属性初始化 -If you export any classes with properties that are other classes (declared by you or by the standard library) like this: +如果您导出任何具有其他类(由您或标准库声明)的属性的类,如下所示: ```typescript class Thing {} @@ -417,7 +417,7 @@ export class Something { } ``` -The compiler will error because you either need to add an initializer for the properties that are classes, or add the `!` operator: +编译器会报错,因为您需要为类属性添加初始化程序,或者添加 `!` 运算符: ```typescript export class Something { @@ -441,11 +441,11 @@ export class Something { } ``` -### GraphQL schema +### GraphQL模式 -This is not a direct AssemblyScript change, but you may have to update your `schema.graphql` file. +这不是一个直接AssemblyScript 更改,但您可能需要更新 `schema.graphql` 文件。 -Now you no longer can define fields in your types that are Non-Nullable Lists. If you have a schema like this: +现在,您不再可以在您的类型中定义不可为空的列表的字段。 如果您有这样的模式: ```graphql type Something @entity { @@ -458,7 +458,7 @@ type MyEntity @entity { } ``` -You'll have to add an `!` to the member of the List type, like this: +您必须将 `!` 添加到 List 类型的成员,如下所示: ```graphql type Something @entity { @@ -471,14 +471,14 @@ type MyEntity @entity { } ``` -This changed because of nullability differences between AssemblyScript versions, and it's related to the `src/generated/schema.ts` file (default path, you might have changed this). +AssemblyScript 版本之间的可空性差异导致了这种改变, 并且这也与 `src/generated/schema.ts`文件(默认路径,您可能已更改)有关。 -### Other +### 其他 -- Aligned `Map#set` and `Set#add` with the spec, returning `this` ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2)) -- Arrays no longer inherit from ArrayBufferView, but are now distinct ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) -- Classes initialized from object literals can no longer define a constructor ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) -- The result of a `**` binary operation is now the common denominator integer if both operands are integers. Previously, the result was a float as if calling `Math/f.pow` ([v0.11.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.11.0)) -- Coerce `NaN` to `false` when casting to `bool` ([v0.14.9](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.14.9)) -- When shifting a small integer value of type `i8`/`u8` or `i16`/`u16`, only the 3 respectively 4 least significant bits of the RHS value affect the result, analogous to the result of an `i32.shl` only being affected by the 5 least significant bits of the RHS value. Example: `someI8 << 8` previously produced the value `0`, but now produces `someI8` due to masking the RHS as `8 & 7 = 0` (3 bits) ([v0.17.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.0)) -- Bug fix of relational string comparisons when sizes differ ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) +- 将 `Map#set` 和 `Set#add` 与规范对齐,返回 `this` ([v0.9.2](https://github.com/AssemblyScript /assemblyscript/releases/tag/v0.9.2)) +- 数组不再继承自 ArrayBufferView,并且现在是完全不同的 ([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) +- 从对象字面初始化的类不能再定义构造函数([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) +- 如果两个操作数都是整数,则 `**` 二元运算的结果现在是公分母整数。 以前,结果是一个浮点数,就像调用 `Math/f.pow` ([v0.11.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.11.0)) +- 在转换为 `bool` 时强制 `NaN` 为 `false` ([v0.14.9](https://github.com/AssemblyScript/assemblyscript/releases/tag /v0.14.9)) +- 当移动 `i8`/`u8` 或 `i16`/`u16` 类型的小整数值时,只有 4 个RHS 值的最低有效位中的3个会影响结果,类似于 `i32.shl` 的结果仅受 RHS 值的 5 个最低有效位影响。 示例:`someI8 << 8` 以前生成值 `0`,但现在由于将 RHS 屏蔽为`8 & 7 = 0` (3 比特), 而生成 `someI8`([v0.17.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.0)) +- 大小不同时关系字符串比较的错误修复 ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) From ee98085434ad6f6304cc79470e5681560c1d86eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:53 -0500 Subject: [PATCH 23/47] New translations querying-from-your-app.mdx (Arabic) --- pages/ar/developer/querying-from-your-app.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/ar/developer/querying-from-your-app.mdx b/pages/ar/developer/querying-from-your-app.mdx index 41970d4d6bc8..385a0c06b4af 100644 --- a/pages/ar/developer/querying-from-your-app.mdx +++ b/pages/ar/developer/querying-from-your-app.mdx @@ -20,9 +20,9 @@ https://gateway.thegraph.com/api//subgraphs/id/ باستخدام GraphQL endpoint ، يمكنك استخدام العديد من مكتبات GraphQL Client للاستعلام عن ال Subgraph وملء تطبيقك بالبيانات المفهرسة بواسطة ال Subgraph. -Here are a couple of the more popular GraphQL clients in the ecosystem and how to use them: +في ما يلي بعض عملاء GraphQL الأكثر شيوعا في النظام البيئي وكيفية استخدامها: -### Apollo client +### عميل Apollo [Apoolo client](https://www.apollographql.com/docs/)يدعم مشاريع الويب بما في ال framework مثل React و Vue ، بالإضافة إلى mobile clients مثل iOS و Android و React Native. From e043fbb29868f12d9b8a3169031e106d4709d4f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:56 -0500 Subject: [PATCH 24/47] New translations querying-from-your-app.mdx (Chinese Simplified) --- pages/zh/developer/querying-from-your-app.mdx | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pages/zh/developer/querying-from-your-app.mdx b/pages/zh/developer/querying-from-your-app.mdx index 949e915c8bfd..10f5de0747e1 100644 --- a/pages/zh/developer/querying-from-your-app.mdx +++ b/pages/zh/developer/querying-from-your-app.mdx @@ -1,10 +1,10 @@ --- -title: Querying from an Application +title: 从应用程序中进行查询 --- -Once a subgraph is deployed to the Subgraph Studio or to the Graph Explorer, you will be given the endpoint for your GraphQL API that should look something like this: +一旦子图被部署到子图工作室或Graph Explorer,你将得到GraphQL API的端点,它应该看起来像这样。 -**Subgraph Studio (testing endpoint)** +**子图工作室(测试端点)** ```sh Queries (HTTP) @@ -18,23 +18,23 @@ Queries (HTTP) https://gateway.thegraph.com/api//subgraphs/id/ ``` -Using the GraphQL endpoint, you can use various GraphQL Client libraries to query the subgraph and populate your app with the data indexed by the subgraph. +使用GraphQL端点,你可以使用各种GraphQL客户端库来查询子图,并用子图索引的数据来填充你的应用程序。 -Here are a couple of the more popular GraphQL clients in the ecosystem and how to use them: +下面是生态系统中几个比较流行的GraphQL客户端以及如何使用它们。 -### Apollo client +### Apollo 客户端 -[Apollo client](https://www.apollographql.com/docs/) supports web projects including frameworks like React and Vue, as well as mobile clients like iOS, Android, and React Native. +[Apollo客户端](https://www.apollographql.com/docs/) 支持网络项目,包括React和Vue等框架,以及iOS、Android和React Native等移动客户端。 -Let's look at how fetch data from a subgraph with Apollo client in a web project. +让我们看看如何在一个网络项目中用Apollo客户端从子图中获取数据。 -First, install `@apollo/client` and `graphql`: +首先,安装`@apollo/client` 和`graphql`: ```sh npm install @apollo/client graphql ``` -Then you can query the API with the following code: +然后你可以用以下代码查询API: ```javascript import { ApolloClient, InMemoryCache, gql } from '@apollo/client' @@ -67,7 +67,7 @@ client }) ``` -To use variables, you can pass in a `variables` argument to the query: +要使用变量,你可以在查询中传递一个`变量参数` 。 ```javascript const tokensQuery = ` @@ -100,17 +100,17 @@ client ### URQL -Another option is [URQL](https://formidable.com/open-source/urql/), a somewhat lighter weight GraphQL client library. +另一个选择是[URQL](https://formidable.com/open-source/urql/),一个有点轻量级的GraphQL客户端库。 -Let's look at how fetch data from a subgraph with URQL in a web project. +让我们看看如何在一个网络项目中用URQL从子图中获取数据。 -First, install `urql` and `graphql`: +首先,安装`urql`和 `graphql`: ```sh npm install urql graphql ``` -Then you can query the API with the following code: +然后你可以用以下代码查询API: ```javascript import { createClient } from 'urql' From 7507013eea1c1feb1180e7d628d98dcc49bf9bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:58 -0500 Subject: [PATCH 25/47] New translations quick-start.mdx (Arabic) --- pages/ar/developer/quick-start.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/ar/developer/quick-start.mdx b/pages/ar/developer/quick-start.mdx index 5a245d65141a..e95fc4fe7bc9 100644 --- a/pages/ar/developer/quick-start.mdx +++ b/pages/ar/developer/quick-start.mdx @@ -4,7 +4,7 @@ title: بداية سريعة سيأخذك هذا الدليل سريعا ويعلمك كيفية تهيئة وإنشاء ونشر Subgraph الخاص بك على: -- **Subgraph Studio** - used only for subgraphs that index **Ethereum mainnet** +- **Subgraph Studio** - تستخدم فقط الـ subgraphs التي تفهرس **Ethereum mainnet** - **Hosted Service** - يتم استخدامها ل Subgraphs التي تفهرس ** الشبكات الأخرى ** خارج Ethereum mainnet (مثل Binance و Matic والخ..) ## Subgraph Studio @@ -43,10 +43,10 @@ graph init --studio لمزيد من المعلومات حول كيفية كتابة Subgraph ، راجع [ إنشاء Subgraph ](/developer/create-subgraph-hosted). -### 4. Deploy to the Subgraph Studio +### النشر على Subgraph Studio - انتقل إلى Subgraph Studio [ https://thegraph.com/studio/ ](https://thegraph.com/studio/) وقم بتوصيل محفظتك. -- Click "Create" and enter the subgraph slug you used in step 2. +- انقر على "إنشاء" وأدخل subgraph slug الذي استخدمته في الخطوة 2. - قم بتشغيل هذه الأوامر في مجلد Subgraph ```sh @@ -137,10 +137,10 @@ $ graph init --product hosted-service --from-contract
- سيُطلب منك اسم Subgraph. التنسيق هو `/`. مثال: `graphprotocol/examplesubgraph` -- If you'd like to initialize from an example, run the command below: +- إذا كنت ترغب في البدء من مثال ، فقم بتشغيل الأمر أدناه: ```sh -$ graph init --product hosted-service --from-example + graph init --product hosted-service --from-example$ ``` - في حالة المثال ، يعتمد Subgraph على عقد Gravity بواسطة Dani Grant الذي يدير ال avatars للمستخدم ويصدر أحداث `NewGravatar` أو `UpdateGravatar` كلما تم إنشاء ال avatars أو تحديثها. From e1c97a31cbe3f104d8222f80ed9b5cc7c442b4cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:32:59 -0500 Subject: [PATCH 26/47] New translations quick-start.mdx (Japanese) --- pages/ja/developer/quick-start.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/pages/ja/developer/quick-start.mdx b/pages/ja/developer/quick-start.mdx index 023f229a1f39..3ccb3ec0a097 100644 --- a/pages/ja/developer/quick-start.mdx +++ b/pages/ja/developer/quick-start.mdx @@ -69,7 +69,6 @@ $ graph deploy --studio ```sh { - indexingStatuses(subgraphs: ["Qm..."]) { node synced health @@ -182,7 +181,6 @@ $ graph deploy --product hosted-service / ```sh { - indexingStatuses(subgraphs: ["Qm..."]) { node synced health From 47867bb887a8d707318e56b6c3e5236050cf43e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:33:01 -0500 Subject: [PATCH 27/47] New translations quick-start.mdx (Chinese Simplified) --- pages/zh/developer/quick-start.mdx | 90 +++++++++++++++--------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/pages/zh/developer/quick-start.mdx b/pages/zh/developer/quick-start.mdx index 1856aca08178..338680248189 100644 --- a/pages/zh/developer/quick-start.mdx +++ b/pages/zh/developer/quick-start.mdx @@ -1,17 +1,17 @@ --- -title: Quick Start +title: 快速开始 --- -This guide will quickly take you through how to initialize, create, and deploy your subgraph on: +本指南将快速带你了解如何初始化、创建和部署你的子图。 -- **Subgraph Studio** - used only for subgraphs that index **Ethereum mainnet** -- **Hosted Service** - used for subgraphs that index **other networks** outside of Ethereum mainnnet (e.g. Binance, Matic, etc) +- **子图工作室** - 仅用于索引**以太坊主网**的子图 +- **托管服务** - 用于索引以太坊主网之外的 **其他网络**的子图(如Binance、Matic等)。 ## 子图工作室 ### 1. 安装Graph CLI -The Graph CLI is written in JavaScript and you will need to have either `npm` or `yarn` installed to use it. +Graph CLI是用JavaScript编写的,你需要安装`npm` 或`yarn` 来使用它。 ```sh # NPM @@ -21,51 +21,51 @@ $ npm install -g @graphprotocol/graph-cli $ yarn global add @graphprotocol/graph-cli ``` -### 2. Initialize your Subgraph +### 2. 初始化你的子图 -- Initialize your subgraph from an existing contract. +- 从一个现有的合同初始化你的子图。 ```sh graph init --studio ``` -- Your subgraph slug is an identifier for your subgraph. The CLI tool will walk you through the steps for creating a subgraph, such as contract address, network, etc as you can see in the screenshot below. +- 你的子图slug是你的子图的一个标识符。CLI工具将引导你完成创建子图的步骤,如合同地址、网络等,你可以在下面的截图中看到。 ![Subgraph command](/img/Subgraph-Slug.png) -### 3. Write your Subgraph +### 3. 编写你的子图 -The previous commands creates a scaffold subgraph that you can use as a starting point for building your subgraph. When making changes to the subgraph, you will mainly work with three files: +前面的命令创建了一个脚手架子图,你可以将其作为构建子图的起点。在对子图进行修改时,你将主要处理三个文件。 -- Manifest (subgraph.yaml) - The manifest defines what datasources your subgraphs will index. -- Schema (schema.graphql) - The GraphQL schema defines what data you wish to retreive from the subgraph. -- AssemblyScript Mappings (mapping.ts) - This is the code that translates data from your datasources to the entities defined in the schema. +- 清单(subgraph.yaml)--清单定义了您的子图将索引哪些数据源。 +- 模式(schema.graphql)--GraphQL模式定义了你希望从子图中获取哪些数据。 +- AssemblyScript映射(mapping.ts)--这是将数据源中的数据转换为模式中定义的实体的代码。 -For more information on how to write your subgraph, see [Create a Subgraph](/developer/create-subgraph-hosted). +关于如何编写子图的更多信息,请参见 [创建子图](/developer/create-subgraph-hosted) -### 4. Deploy to the Subgraph Studio +### 4. 部署到子图工作室 -- Go to the Subgraph Studio [https://thegraph.com/studio/](https://thegraph.com/studio/) and connect your wallet. -- Click "Create" and enter the subgraph slug you used in step 2. -- Run these commands in the subgraph folder +- 进入子图工作室 [https://thegraph.com/studio/](https://thegraph.com/studio/) 并连接你的钱包。 +- 点击 "创建 "并输入你在第2步使用的子图slug。 +- 在子图文件夹中运行这些命令 ```sh $ graph codegen $ graph build ``` -- Authenticate and deploy your subgraph. The deploy key can be found on the Subgraph page in Subgraph Studio. +- 认证并部署你的子图。部署密钥可以在Subgraph Studio的Subgraph页面上找到。 ```sh $ graph auth --studio $ graph deploy --studio ``` -- You will be asked for a version label. It's strongly recommended to use the following conventions for naming your versions. Example: `0.0.1`, `v1`, `version1` +- 你将被要求提供一个版本标签。强烈建议使用以下惯例来命名你的版本。例如:`0.0.1`, `v1`, `version1` -### 5. Check your logs +### 5. 检查你的日志 -The logs should tell you if there are any errors. If your subgraph is failing, you can query the subgraph health by using the [GraphiQL Playground](https://graphiql-online.com/). Use [this endpoint](https://api.thegraph.com/index-node/graphql). Note that you can leverage the query below and input your deployment ID for your subgraph. In this case, `Qm...` is the deployment ID (which can be located on the Subgraph page under **Details**). The query below will tell you when a subgraph fails so you can debug accordingly: +日志应该告诉你是否有任何错误。如果你的子图失败了,你可以通过使用 [GraphiQL Playground](https://graphiql-online.com/)查询子图的健康状况。使用[这个端点](https://api.thegraph.com/index-node/graphql)。注意,你可以利用下面的查询,输入你的子图的部署ID。在这种情况下,`Qm...` 是部署ID(可以在子图页面的**详细信息**下找到)。下面的查询将告诉你,当一个子图失败时,你可以相应地进行调试。 ```sh { @@ -109,15 +109,15 @@ The logs should tell you if there are any errors. If your subgraph is failing, y } ``` -### 6. Query your Subgraph +### 6. 查询你的子图 -You can now query your subgraph by following [these instructions](/developer/query-the-graph). You can query from your dapp if you don't have your API key via the free, rate limited temporary query URL that can be used for development and staging. You can read the additional instructions for how to query a subgraph from a frontend application [here](/developer/querying-from-your-app). +你现在可以按照 [这些说明](/developer/query-the-graph)来查询你的子图。如果你没有你的API密钥,你可以通过免费的、速率有限的临时查询URL从你的dapp查询,该URL可用于开发和暂存。你可以在 [这里](/developer/querying-from-your-app)阅读关于如何从前端应用程序查询子图的附加说明。 ## 托管服务 ### 1. 安装Graph CLI -"The Graph CLI is an npm package and you will need `npm` or `yarn` installed to use it. +"Graph CLI是一个npm包,你需要安装 `npm`或 `yarn`来使用它。 ```sh # NPM @@ -127,39 +127,39 @@ $ npm install -g @graphprotocol/graph-cli $ yarn global add @graphprotocol/graph-cli ``` -### 2. Initialize your Subgraph +### 2. 初始化你的子图 -- Initialize your subgraph from an existing contract. +- 从一个现有的合同初始化你的子图。 ```sh $ graph init --product hosted-service --from-contract
``` -- You will be asked for a subgraph name. The format is `/`. Ex: `graphprotocol/examplesubgraph` +- 你会被要求提供一个子图的名称。其格式为 `/`. 例如: `graphprotocol/examplesubgraph` -- If you'd like to initialize from an example, run the command below: +- 如果你想从一个例子中进行初始化,请运行下面的命令。 ```sh $ graph init --product hosted-service --from-example ``` -- In the case of the example, the subgraph is based on the Gravity contract by Dani Grant that manages user avatars and emits `NewGravatar` or `UpdateGravatar` events whenever avatars are created or updated. +- 在这个例子中,子图是基于Dani Grant的Gravity合约,该合约管理用户的头像,并在头像创建或更新时发出`NewGravatar`或`UpdateGravatar`事件。 -### 3. Write your Subgraph +### 3. 编写你的子图 -The previous command will have created a scaffold from where you can build your subgraph. When making changes to the subgraph, you will mainly work with three files: +前面的命令将创建一个脚手架,你可以从那里建立你的子图。在对子图进行修改时,你将主要处理三个文件。 -- Manifest (subgraph.yaml) - The manifest defines what datasources your subgraph will index -- Schema (schema.graphql) - The GraphQL schema define what data you wish to retrieve from the subgraph -- AssemblyScript Mappings (mapping.ts) - This is the code that translates data from your datasources to the entities defined in the schema +- 清单(subgraph.yaml)--该清单定义了你的子图将索引哪些数据源 +- 模式(schema.graphql)--GraphQL模式定义了你希望从子图中检索到的数据。 +- AssemblyScript映射(mapping.ts)--这是将数据源中的数据转换为模式中定义的实体的代码。 -For more information on how to write your subgraph, see [Create a Subgraph](/developer/create-subgraph-hosted). +关于如何编写子图的更多信息,请参见 [创建子图](/developer/create-subgraph-hosted) -### 4. Deploy your Subgraph +### 4. 部署你的子图 -- Sign into the [Hosted Service](https://thegraph.com/hosted-service/) using your github account -- Click Add Subgraph and fill out the required information. Use the same subgraph name as in step 2. -- Run codegen in the subgraph folder +- 使用你的github账户登录 [托管服务](https://thegraph.com/hosted-service/) +- 点击添加子图,并填写所需信息。使用与第2步中相同的子图名称。 +- 在子图文件夹中运行codegen ```sh # NPM @@ -169,16 +169,16 @@ $ npm run codegen $ yarn codegen ``` -- Add your Access token and deploy your subgraph. The access token is found on your dashboard in the Hosted Service. +- 添加你的访问令牌并部署你的子图。访问令牌可以在你的仪表板上的托管服务中找到。 ```sh $ graph auth --product hosted-service $ graph deploy --product hosted-service / ``` -### 5. Check your logs +### 5. 检查你的日志 -The logs should tell you if there are any errors. If your subgraph is failing, you can query the subgraph health by using the [GraphiQL Playground](https://graphiql-online.com/). Use [this endpoint](https://api.thegraph.com/index-node/graphql). Note that you can leverage the query below and input your deployment ID for your subgraph. In this case, `Qm...` is the deployment ID (which can be located on the Subgraph page under **Details**). The query below will tell you when a subgraph fails so you can debug accordingly: +日志应该告诉你是否有任何错误。如果你的子图失败了,你可以通过使用 [GraphiQL Playground](https://graphiql-online.com/)查询子图的健康状况。使用[这个端点](https://api.thegraph.com/index-node/graphql)。注意,你可以利用下面的查询,输入你的子图的部署ID。在这种情况下,`Qm...` 是部署ID(可以在子图页面的**详细信息**下找到)。下面的查询将告诉你,当一个子图失败时,你可以相应地进行调试。 ```sh { @@ -222,6 +222,6 @@ The logs should tell you if there are any errors. If your subgraph is failing, y } ``` -### 6. Query your Subgraph +### 6. 查询你的子图 -Follow [these instructions](/hosted-service/query-hosted-service) to query your subgraph on the Hosted Service. +按照 [这些说明](/hosted-service/query-hosted-service),在托管服务上查询你的子图。 From 816251f2d149ee7d22ff1e949584c8814e79699c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:33:03 -0500 Subject: [PATCH 28/47] New translations query-the-graph.mdx (Chinese Simplified) --- pages/zh/developer/query-the-graph.mdx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pages/zh/developer/query-the-graph.mdx b/pages/zh/developer/query-the-graph.mdx index ae480b1e6883..1c1cbbc080be 100644 --- a/pages/zh/developer/query-the-graph.mdx +++ b/pages/zh/developer/query-the-graph.mdx @@ -1,14 +1,14 @@ --- -title: Query The Graph +title: 查询The Graph --- -With the subgraph deployed, visit the [Graph Explorer](https://thegraph.com/explorer) to open up a [GraphiQL](https://github.com/graphql/graphiql) interface where you can explore the deployed GraphQL API for the subgraph by issuing queries and viewing the schema. +随着子图的部署,访问[Graph 浏览器来](https://thegraph.com/explorer)打开[GraphiQL](https://github.com/graphql/graphiql) 界面,在那里你可以通过发出查询和查看模式来探索子图的GraphQL API。 -An example is provided below, but please see the [Query API](/developer/graphql-api) for a complete reference on how to query the subgraph's entities. +下面提供了一个示例,但请参阅 [查询 API](/developer/graphql-api) 以获取有关如何查询子图实体的完整参考。 -#### Example +#### 示例 -This query lists all the counters our mapping has created. Since we only create one, the result will only contain our one `default-counter`: +此查询列出了我们的映射创建的所有计数器。 由于我们只创建一个,结果将只包含我们的一个 `默认计数器`: ```graphql { @@ -19,14 +19,14 @@ This query lists all the counters our mapping has created. Since we only create } ``` -## Using The Graph Explorer +## 使用The Graph浏览器 -Each subgraph published to the decentralized Graph Explorer has a unique query URL that you can find by navigating to the subgraph details page and clicking on the "Query" button on the top right corner. This will open a side pane that will give you the unique query URL of the subgraph as well as some instructions about how to query it. +每个发布到去中心化Graph浏览器的子图都有一个独特的查询URL,你可以通过导航到子图的详细信息页面并点击右上角的 "查询 "按钮找到。这将打开一个侧窗格,给你提供该子图的唯一查询URL,以及一些关于如何查询的说明。 ![Query Subgraph Pane](/img/query-subgraph-pane.png) -As you can notice, this query URL must use a unique API key. You can create and manage your API keys in the [Subgraph Studio](https://thegraph.com/studio) in the "API Keys" section. Learn more about how to use Subgraph Studio [here](/studio/subgraph-studio). +正如你所注意到的,这个查询URL必须使用一个独特的API密钥。你可以在 [Subgraph Studio](https://thegraph.com/studio)的 "API密钥 "部分创建和管理你的API密钥。在[这里](/studio/subgraph-studio)了解更多关于如何使用Subgraph Studio的信息。 -Querying subgraphs using your API keys will generate query fees that will be paid in GRT. You can learn more about billing [here](/studio/billing). +使用你的API密钥查询子图将产生查询费用,这些费用将以GRT方式支付。你可以在[这里](/studio/billing)了解更多关于计费的信息 -You can also use the GraphQL playground in the "Playground" tab to query a subgraph within The Graph Explorer. +你也可以使用 "操作台 "选项卡中的GraphQL游乐场来查询The Graph Explorer中的一个子图。 From 589cf49000bf36ab5f0a019dfc775cd9a4f666d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:33:23 -0500 Subject: [PATCH 29/47] New translations matchstick.mdx (Arabic) --- pages/ar/developer/matchstick.mdx | 86 +++++++++++++++---------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/pages/ar/developer/matchstick.mdx b/pages/ar/developer/matchstick.mdx index 3cf1ec761bb9..dcdf7390b31d 100644 --- a/pages/ar/developer/matchstick.mdx +++ b/pages/ar/developer/matchstick.mdx @@ -1,16 +1,16 @@ --- -title: Unit Testing Framework +title: اختبار وحدة Framework --- -Matchstick is a unit testing framework, developed by [LimeChain](https://limechain.tech/), that enables subgraph developers to test their mapping logic in a sandboxed environment and deploy their subgraphs with confidence! +Matchstick هو اختبار وحدة framework ، تم تطويره بواسطة [ LimeChain ](https://limechain.tech/) ، والذي يسمح لمطوري الـ subgraph من اختبار منطق الـ mapping في بيئة sandboxed ونشر الـ subgraphs الخاصة بهم بثقة! -Follow the [Matchstick installation guide](https://github.com/LimeChain/matchstick/blob/main/README.md#quick-start-) to install. Now, you can move on to writing your first unit test. +اتبع [ دليل تثبيت Matchstick ](https://github.com/LimeChain/matchstick/blob/main/README.md#quick-start-) للتثبيت. الآن ، يمكنك الانتقال إلى كتابة أول اختبار وحدة خاصة بك. -## Write a Unit Test +## كتابة اختبار الوحدة -Let's see how a simple unit test would look like, using the Gravatar [Example Subgraph](https://github.com/graphprotocol/example-subgraph). +دعونا نرى كيف سيبدو اختبار وحدة بسيطة، باستخدام Gravatar [ مثال على الـ Subgraph ](https://github.com/graphprotocol/example-subgraph). -Assuming we have the following handler function (along with two helper functions to make our life easier): +بافتراض أن لدينا دالة المعالج التالية (جنبا إلى جنب مع دالتين مساعدتين لجعل حياتنا أسهل): ```javascript export function handleNewGravatar(event: NewGravatar): void { @@ -61,7 +61,7 @@ export function createNewGravatarEvent( } ``` -We first have to create a test file in our project. We have chosen the name `gravity.test.ts`. In the newly created file we need to define a function named `runTests()`. It is important that the function has that exact name. This is an example of how our tests might look like: +علينا أولا إنشاء ملف اختبار في مشروعنا. لقد اخترنا الاسم ` gravity.test.ts `. في الملف الذي تم إنشاؤه حديثا ، نحتاج إلى تعريف دالة باسم ` ()runTests `. من المهم أن يكون للدالة هذا الاسم بالضبط. هذا مثال على الشكل الذي قد يبدو عليه اختبارنا: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -95,27 +95,27 @@ export function runTests(): void { } ``` -That's a lot to unpack! First off, an important thing to notice is that we're importing things from `matchstick-as`, our AssemblyScript helper library (distributed as an npm module). You can find the repository [here](https://github.com/LimeChain/matchstick-as). `matchstick-as` provides us with useful testing methods and also defines the `test()` function which we will use to build our test blocks. The rest of it is pretty straightforward - here's what happens: +هذا كثير لفك الحزمة! أولاً ، من المهم ملاحظة أننا نستورد أشياء من ` matchstick-as ` ، ومكتبتنا المساعدة AssemblyScript (موزعة كوحدة npm). يمكنك العثور على repository [ هنا ](https://github.com/LimeChain/matchstick-as). ` matchstick-as ` يوفر لنا methods اختبار مفيدة ويعرف أيضا دالة` ()test ` التي سنستخدمها لبناء كتل الاختبار الخاصة بنا. الباقي واضح ومباشر - إليك ما يحدث: -- 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; -- 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. +- نقوم بإعداد حالتنا الأولية وإضافة كيان Gravatar مخصص ؛; +- نعرف كائني حدث ` NewGravatar ` بالإضافة لبياناتهم ، باستخدام دالة `() createNewGravatarEvent`; +- نحن نستدعي methods المعالج لتلك الأحداث - ` () handleNewGravatars ` ونمرر فيه قائمة أحداثنا المخصصة ؛; +- نؤكد حالة المخزن. كيف يعمل هذا؟ - نمرر مجموعة فريدة من نوع Entity و id. ثم نتحقق من حقل معين في ذلك الـ Entity ونؤكد أنه يحتوي على القيمة التي نتوقعها. نحن نقوم بذلك لكلا الـ Gravatar Entity الأولية الذي أضفناه إلى المخزن، بالإضافة إلى كيانين Gravatar اللذان تمت إضافتهما عند استدعاء دالة المعالج; +- وأخيرا - نقوم بتنظيف المخزن باستخدام ` () clearStore ` بحيث يمكن أن يبدأ اختبارنا التالي بكائن مخزن جديد وفارغ. يمكننا تعريف العديد من كتل الاختبار كما نريد. -There we go - we've created our first test! 👏 +ها نحن أنشأنا اختبارنا الأول! 👏 -❗ **IMPORTANT:** _In order for the tests to work, we need to export the `runTests()` function in our mappings file. It won't be used there, but the export statement has to be there so that it can get picked up by Rust later when running the tests._ +❗ **هام:** _ لكي تعمل الاختبارات ، نحتاج إلى تصدير دالة ` runTests () ` تعمل في ملف الـ mappings الخاص بنا. لن يتم استخدامه هناك ، ولكن يجب أن تكون عبارات التصدير موجودة حتى يتمكن Rust من التقاطه لاحقا عند تشغيل الاختبارات. _ -You can export the tests wrapper function in your mappings file like this: +يمكنك تصدير دالة غلاف الاختبارات في ملف الـ mappings كما يلي: ``` export { runTests } from "../tests/gravity.test.ts"; ``` -❗ **IMPORTANT:** _Currently there's an issue with using Matchstick when deploying your subgraph. Please only use Matchstick for local testing, and remove/comment out this line (`export { runTests } from "../tests/gravity.test.ts"`) once you're done. We expect to resolve this issue shortly, sorry for the inconvenience!_ +❗ **هام:** _ توجد حاليا مشكلة في استخدام Matchstick عند نشر الـ subgraph الخاص بك. الرجاء استخدام Matchstick للاختبار المحلي فقط وإزالة هذا السطر بمجرد الانتهاء. (`export { runTests } from "../tests/gravity.test.ts"`) نتوقع حل هذه المشكلة قريبا ، نأسف للإزعاج! _ -_If you don't remove that line, you will get the following error message when attempting to deploy your subgraph:_ +_إذا لم تقم بإزالة هذا السطر ، فستتلقى رسالة الخطأ التالية عند محاولة نشر الـ subgraph الخاص بك:_ ``` /... @@ -123,28 +123,28 @@ Mapping terminated before handling trigger: oneshot canceled .../ ``` -Now in order to run our tests you simply need to run the following in your subgraph root folder: +الآن لإجراء اختبارنا، تحتاج ببساطة إلى تشغيل التالي في مجلد جذر الـ subgraph: `graph test Gravity` -And if all goes well you should be greeted with the following: +وإذا سارت الأمور على ما يرام ، يجب أن يتم الترحيب بك بما يلي: -![Matchstick saying “All tests passed!”](/img/matchstick-tests-passed.png) +![Matchstick يقول "نجحت جميع الاختبارات!"](/img/matchstick-tests-passed.png) -## Common test scenarios +## سيناريوهات الاختبار الشائعة -### Hydrating the store with a certain state +### Hydrating المخزن بحالة معينة -Users are able to hydrate the store with a known set of entities. Here's an example to initialise the store with a Gravatar entity: +يمكن للمستخدمين عمل hydrate للمخزن بمجموعة معروفة من الكيانات. فيما يلي مثال لتهيئة المخزن بكيان Gravatar: ```typescript let gravatar = new Gravatar('entryId') gravatar.save() ``` -### Calling a mapping function with an event +### استدعاء دالة mapping مع حدث -A user can create a custom event and pass it to a mapping function that is bound to the store: +يمكن للمستخدم إنشاء حدث مخصص وتمريره إلى دالة mapping مرتبطة بالمخزن: ```typescript import { store } from 'matchstick-as/assembly/store' @@ -156,9 +156,9 @@ let newGravatarEvent = createNewGravatarEvent(12345, '0x89205A3A3b2A69De6Dbf7f01 handleNewGravatar(newGravatarEvent) ``` -### Calling all of the mappings with event fixtures +### استدعاء جميع الـ mappings مع تركيبات الأحداث -Users can call the mappings with test fixtures. +يمكن للمستخدمين استدعاء الـ mappings مع تركيبات الاختبار. ```typescript import { NewGravatar } from '../../generated/Gravity/Gravity' @@ -180,9 +180,9 @@ export function handleNewGravatars(events: NewGravatar[]): void { } ``` -### Mocking contract calls +### محاكاة استدعاء العقد -Users can mock contract calls: +يمكن للمستخدمين محاكاة استدعاء العقد: ```typescript import { addMetadata, assert, createMockedFunction, clearStore, test } from 'matchstick-as/assembly/index' @@ -202,9 +202,9 @@ let result = gravity.gravatarToOwner(bigIntParam) assert.equals(ethereum.Value.fromAddress(expectedResult), ethereum.Value.fromAddress(result)) ``` -As demonstrated, in order to mock a contract call and hardcore a return value, the user must provide a contract address, function name, function signature, an array of arguments, and of course - the return value. +كما هو موضح ، من أجل محاكاة استدعاء العقد والتشديد على قيمة الإرجاع ، يجب على المستخدم تقديم عنوان العقد واسم الدالة وتوقيع الدالة ومصفوفة من الوسائط ، وبالطبع - قيمة الإرجاع. -Users can also mock function reverts: +يمكن للمستخدمين أيضًا محاكاة رجوع الدالة: ```typescript let contractAddress = Address.fromString('0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7') @@ -213,9 +213,9 @@ createMockedFunction(contractAddress, 'getGravatar', 'getGravatar(address):(stri .reverts() ``` -### Asserting the state of the store +### تأكيد حالة المخزن -Users are able to assert the final (or midway) state of the store through asserting entities. In order to do this, the user has to supply an Entity type, the specific ID of an Entity, a name of a field on that Entity, and the expected value of the field. Here's a quick example: +يمكن للمستخدمين تأكيد الحالة النهائية (أو الوسطى) للمخزن من خلال تأكيد الكيانات. للقيام بذلك ، يجب على المستخدم توفير نوع Entity ، و Entity ID ، واسم حقل في هذا الكيان ، والقيمة المتوقعة للحقل. إليك مثال سريع: ```typescript import { assert } from 'matchstick-as/assembly/index' @@ -227,11 +227,11 @@ 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. +سيؤدي تشغيل الدالة ()assert.fieldEquals إلى التحقق من تساوي الحقل المحدد مع القيمة المتوقعة المحددة. سيفشل الاختبار وسيتم إخراج رسالة خطأ إذا كانت القيم **غير** متساوية. وإلا فإن الاختبار سوف ينجح. -### Interacting with Event metadata +### التفاعل مع البيانات الوصفية للحدث -Users can use default transaction metadata, which could be returned as an ethereum.Event by using the `newMockEvent()` function. The following example shows how you can read/write to those fields on the Event object: +يمكن للمستخدمين استخدام البيانات الوصفية الافتراضية للإجراءات ، والتي يمكن إرجاعها كـ ethereum.Event باستخدام الدالة `newMockEvent()` المثال التالي يوضح كيف يمكنك القراءة / الكتابة إلى تلك الحقول في كائن الحدث: ```typescript // Read @@ -242,26 +242,26 @@ let UPDATED_ADDRESS = '0xB16081F360e3847006dB660bae1c6d1b2e17eC2A' newGravatarEvent.address = Address.fromString(UPDATED_ADDRESS) ``` -### Asserting variable equality +### تأكيد مساواة المتغير ```typescript assert.equals(ethereum.Value.fromString("hello"); ethereum.Value.fromString("hello")); ``` -### Asserting that an Entity is **not** in the store +### التأكيد على أن الكيان **ليس** في المخزن -Users can assert that an entity does not exist in the store. The function takes an entity type and an id. If the entity is in fact in the store, the test will fail with a relevant error message. Here's a quick example of how to use this functionality: +يمكن للمستخدمين تأكيد عدم وجود كيان في المخزن. الدالة تأخذ نوع كيان وid. إذا كان الكيان موجودا بالفعل في المخزن، فسيفشل الاختبار مع ظهور رسالة خطأ. فيما يلي مثال سريع على كيفية استخدام هذه الدالة: ```typescript assert.notInStore('Gravatar', '23') ``` -### Test run time duration in the log output +### اختبار مدة وقت التشغيل في خرج السجل -The log output includes the test run duration. Here's an example: +يتضمن خرج السجل مدة تشغيل الاختبار. هذا مثال: `Jul 09 14:54:42.420 INFO Program execution time: 10.06022ms` ## Feedback -If you have any questions, feedback, feature requests or just want to reach out, the best place would be The Graph Discord where we have a dedicated channel for Matchstick, called 🔥| unit-testing. +إذا كانت لديك أي أسئلة أو تعليقات أو طلب ميزات أو كنت ترغب فقط في التواصل ، فإن أفضل مكان هو The Graph Discord حيث لدينا قناة مخصصة لـ Matchstick ، تسمى 🔥| unit-testing. From be8ccbbbf112bdcd3794aa511a9293074dfc82a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:33:30 -0500 Subject: [PATCH 30/47] New translations publish-subgraph.mdx (Chinese Simplified) --- pages/zh/developer/publish-subgraph.mdx | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pages/zh/developer/publish-subgraph.mdx b/pages/zh/developer/publish-subgraph.mdx index 2f35f5eb1bae..f0ca17995942 100644 --- a/pages/zh/developer/publish-subgraph.mdx +++ b/pages/zh/developer/publish-subgraph.mdx @@ -1,27 +1,27 @@ --- -title: Publish a Subgraph to the Decentralized Network +title: 向去中心化的网络发布子图 --- -Once your subgraph has been [deployed to the Subgraph Studio](/studio/deploy-subgraph-studio), you have tested it out, and are ready to put it into production, you can then publish it to the decentralized network. +一旦你的子图被部署到子图工作室,你已经测试了它,并准备把它投入生产,你就可以把它发布到去中心化的网络。 -Publishing a Subgraph to the decentralized network makes it available for [curators](/curating) to begin curating on it, and [indexers](/indexing) to begin indexing it. +将一个子图发布到去中心化的网络上,使其可以开始对其进行[策展](/curating),并开始对其进行[索引](/indexing) 。 -For a walkthrough of how to publish a subgraph to the decentralized network, see [this video](https://youtu.be/HfDgC2oNnwo?t=580). +关于如何将子图发布到去中心化网络的演示,请看[这个视频](https://youtu.be/HfDgC2oNnwo?t=580) -### Networks +### 网络 -The decentralized network currently supports both Rinkeby and Ethereum Mainnet. +这个去中心化的网络目前同时支持Rinkeby和以太坊主网。 -### Publishing a subgraph +### 发布一个子图 -Subgraphs can be published to the decentralized network directly from the Subgraph Studio dashboard by clicking on the **Publish** button. Once a subgraph is published, it will be available to view in the [Graph Explorer](https://thegraph.com/explorer/). +子图可以通过点击 **"发布 "** 按钮直接从Subgraph Studio仪表板上发布到去中心化网络。一旦一个子图被发布,它将可以在[Graph浏览器](https://thegraph.com/explorer/)中查看。 -- Subgraphs published to Rinkeby can index and query data from either the Rinkeby network or Ethereum Mainnet. +- 发布到Rinkeby的子图可以索引和查询Rinkeby网络或以太坊主网的数据。 -- Subgraphs published to Ethereum Mainnet can only index and query data from Ethereum Mainnet, meaning that you cannot publish subgraphs to the main decentralized network that index and query testnet data. +- 发布到以太坊主网的子图只能索引和查询以太坊主网的数据,也就是说,你不能把子图发布到主去中心化网络,索引和查询测试网的数据。 -- When publishing a new version for an existing subgraph the same rules apply as above. +- 当为一个现有的子图发布一个新的版本时,适用的规则与上述相同。 -### Updating metadata for a published subgraph +### 更新一个已发布的子图的元数据 -Once your subgraph has been published to the decentralized network, you can modify the metadata at any time by making the update in the Subgraph Studio dashboard of the subgraph. After saving the changes and publishing your updates to the network, they will be reflected in the Graph Explorer. This won’t create a new version, as your deployment hasn’t changed. +一旦你的子图被发布到去中心化的网络,你可以在任何时候通过在子图的子图工作室仪表板上进行更新来修改元数据。在保存更改并将你的更新发布到网络后,它们将反映在Graph浏览器中。这不会创建一个新的版本,因为你的部署并没有改变。 From b11644765ec4dca6cd4238439d776b995637922e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:33:37 -0500 Subject: [PATCH 31/47] New translations multisig.mdx (Chinese Simplified) --- pages/zh/studio/multisig.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/zh/studio/multisig.mdx b/pages/zh/studio/multisig.mdx index 164835bdb8a4..41aba4457698 100644 --- a/pages/zh/studio/multisig.mdx +++ b/pages/zh/studio/multisig.mdx @@ -4,7 +4,7 @@ title: Using a Multisig Wallet Subgraph Studio currently doesn't support signing with multisig wallets. Until then, you can follow this guide on how to publish your subgraph by invoking the [GNS contract](https://github.com/graphprotocol/contracts/blob/dev/contracts/discovery/GNS.sol) functions. -### Create a Subgraph +### 创建子图 Similary to using a regular wallet, you can create a subgraph by connecting your non-multisig wallet in Subgraph Studio. Once you connect the wallet, simply create a new subgraph. Make sure you fill out all the details, such as subgraph name, description, image, website, and source code url if applicable. From 394fd9d43d62e8737bd294530165f3a6498a6c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:33:56 -0500 Subject: [PATCH 32/47] New translations what-is-hosted-service.mdx (Chinese Simplified) --- pages/zh/hosted-service/what-is-hosted-service.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/zh/hosted-service/what-is-hosted-service.mdx b/pages/zh/hosted-service/what-is-hosted-service.mdx index 24d7068c1b44..d07bcc04c1c9 100644 --- a/pages/zh/hosted-service/what-is-hosted-service.mdx +++ b/pages/zh/hosted-service/what-is-hosted-service.mdx @@ -6,7 +6,7 @@ title: 什么是托管服务? If you don't have an account on the Hosted Service, you can signup with your Github account. Once you authenticate, you can start creating subgraphs through the UI and deploying them from your terminal. Graph Node supports a number of Ethereum testnets (Rinkeby, Ropsten, Kovan) in addition to mainnet. -## Create a Subgraph +## 创建子图 First follow the instructions [here](/developer/define-subgraph-hosted) to install the Graph CLI. Create a subgraph by passing in `graph init --product hosted service` @@ -34,7 +34,7 @@ The `` in this case is your github user or organization name, `/ [] From e359bbca7c46fc855f17872adfe75e36bcfe5006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:17 -0500 Subject: [PATCH 33/47] New translations indexing.mdx (Korean) --- pages/ko/indexing.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pages/ko/indexing.mdx b/pages/ko/indexing.mdx index 7485645acff9..687dcf5547f3 100644 --- a/pages/ko/indexing.mdx +++ b/pages/ko/indexing.mdx @@ -131,7 +131,7 @@ Disputes can be viewed in the UI in an Indexer's profile page under the `Dispute 인덱서 인프라의 중심에는 이더리움을 모니터링하고, 서브그래프 정의에 따라 데이터를 추출하고 로드하여 [GraphQL API](/about/introduction#how-the-graph-works)로 제공하는 그래프 노드가 있습니다. 더그래프 노드는 Ethereum EVM 노드 엔드포인트들과 IPFS 노드(데이터 소싱)에 연결되어야 합니다. 이는 해당 스토리지의 PostgreSQL 데이터베이스 및 네트워크와의 상호 작용을 용이하게 하는 인덱서 구성 요소들입니다. -- **PostgreSQLPostgreSQL database** - 더그래프 노드의 메인 스토어입니다. 이곳에 서브그래프의 데이터가 저장됩니다. 또한 인덱서서비스 및 에이전트는 데이터베이스를 사용하여 상태 채널 데이터, 비용 모델 및 인덱싱 규칙을 저장합니다. +- **PostgreSQL database** - 더그래프 노드의 메인 스토어입니다. 이곳에 서브그래프의 데이터가 저장됩니다. 또한 인덱서서비스 및 에이전트는 데이터베이스를 사용하여 상태 채널 데이터, 비용 모델 및 인덱싱 규칙을 저장합니다. - **이더리움 앤드포인트** - 이더리움JSON-RPC API를 노출하는 앤드포인트입니다. 이는 단일 이더리움 클라이언트의 형태를 취하거나 다중에 걸친 로드 밸런싱이 보다 복잡한 설정이 될 수 있습니다. 특정 서브그래프는 Achive mode 및 API 추적 등 특정 이더리움 클라이언트 기능을 필요로 할 것이라는 점을 유념하는 것이 중요합니다. @@ -139,7 +139,9 @@ Disputes can be viewed in the UI in an Indexer's profile page under the `Dispute - **인덱서 서비스** - 네트워크와의 모든 필수 외부 커뮤니케이션을 처리합니다. 비용 모델과 인덱싱 상태를 공유하고, 게이트웨이에서 그래프 노드로 쿼리 요청을 전달하며, 게이트웨이를 사용하여 상태 채널을 통해 쿼리 결제를 관리합니다. -- **인덱서 에이전트** - 네트워크에 등록, 그래프 노드에 대한 서브그래프 배포관리 및 할당 관리를 포함하여 체인에 상에서 인덱서 상호작용을 용이하게 합니다. Prometheus metrics 서버 – 더그래프 노드 및 인덱서 구성요소는 매트릭스 서버에 그들의 매트릭스를 기록합니다. +- **인덱서 에이전트** - 네트워크에 등록, 그래프 노드에 대한 서브그래프 배포관리 및 할당 관리를 포함하여 체인에 상에서 인덱서 상호작용을 용이하게 합니다. + +- **Prometheus metrics server** - The Graph Node and Indexer components log their metrics to the metrics server. 참고: 신속한 확장성을 지원하기 위해 쿼리 노드와 인덱스 노드 등 서로 다른 노드 세트간에쿼리 및 인덱싱 문제를 구분할 것을 권고합니다. From e91c4f931559f7ec956e1433f5bfcb48512108a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:18 -0500 Subject: [PATCH 34/47] New translations indexing.mdx (Chinese Simplified) --- pages/zh/indexing.mdx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pages/zh/indexing.mdx b/pages/zh/indexing.mdx index 8d398be89d41..fb3d2ac836f0 100644 --- a/pages/zh/indexing.mdx +++ b/pages/zh/indexing.mdx @@ -135,11 +135,13 @@ query indexerAllocations { - **Ethereum endpoint** -公开 Ethereum JSON-RPC API 的端点。 这可能采取单个 Ethereum 客户端的形式,也可能是一个更复杂的设置,在多个客户端之间进行负载平衡。 需要注意的是,某些子图将需要特定的 Ethereum 客户端功能,如存档模式和跟踪 API。 -- ** IPFS 节点(版本小于 5)** - 子图部署元数据存储在 IPFS 网络上。 The Graph节点在子图部署期间主要访问IPFS节点,以获取子图清单和所有链接文件。 网络索引人不需要托管自己的IPFS节点,网络的IPFS节点是托管在https://ipfs.network.thegraph.com。 +- **IPFS 节点(版本小于 5** - 子图部署元数据存储在 IPFS 网络上。 The Graph节点在子图部署期间主要访问IPFS节点,以获取子图清单和所有链接文件。 网络索引人不需要托管自己的IPFS节点,网络的IPFS节点是托管在https://ipfs.network.thegraph.com。 - **索引人服务** -处理与网络的所有必要的外部通信。 共享成本模型和索引状态,将来自网关的查询请求传递给一个 Graph 节点,并通过状态通道与网关管理查询支付。 -- **索引人代理** - 促进索引人在链上的交互,包括在网络上注册,管理子图部署到其 Graph 节点,以及管理分配。 Prometheus 指标服务器- Graph 节点 和 Indexer 组件将其指标记录到指标服务器。 +- **索引人代理** - 促进索引人在链上的交互,包括在网络上注册,管理子图部署到其 Graph 节点,以及管理分配。 + +- Prometheus 指标服务器- Graph 节点 和 Indexer 组件将其指标记录到指标服务器。 注意:为了支持敏捷扩展,建议在不同的节点集之间分开查询和索引问题:查询节点和索引节点。 @@ -659,7 +661,7 @@ setDelegationParameters(950000, 600000, 500) ### 分配的生命周期 -After being created by an indexer a healthy allocation goes through four states. +在被索引人创建之后,健康的分配会经历四个状态。 - **活跃** -一旦在链上创建分配([allocateFrom()](https://github.com/graphprotocol/contracts/blob/master/contracts/staking/Staking.sol#L873)) 它就被认为是**活跃**。 索引人自身和/或被委托的一部分权益被分配给子图部署,这使得他们可以要求索引奖励并为该子图部署提供查询。 索引人代理根据索引人规则管理创建分配。 From 2182d1eebe2f6763c2482424c4090cdc820aa187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:19 -0500 Subject: [PATCH 35/47] New translations indexing.mdx (Vietnamese) --- pages/vi/indexing.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pages/vi/indexing.mdx b/pages/vi/indexing.mdx index 11ddf485c8e6..c0d6fdd9a9dd 100644 --- a/pages/vi/indexing.mdx +++ b/pages/vi/indexing.mdx @@ -131,7 +131,7 @@ Indexer có thể tự phân biệt bản thân bằng cách áp dụng các k Tại trung tâm của cơ sở hạ tầng của indexer là Graph Node theo dõi Ethereum, trích xuất và tải dữ liệu theo định nghĩa subgraph và phục vụ nó như một [GraphQL API](/about/introduction#how-the-graph-works). Graph Node cần được kết nối với điểm cuối node Ethereum EVM và node IPFS để tìm nguồn cung cấp dữ liệu; một cơ sở dữ liệu PostgreSQL cho kho lưu trữ của nó; và các thành phần indexer tạo điều kiện cho các tương tác của nó với mạng. -- **Cơ sở dữ liệu PostgreSQLPostgreSQL** - Kho lưu trữ chính cho Graph Node, đây là nơi lưu trữ dữ liệu subgraph. Dịch vụ indexer và đại lý cũng sử dụng cơ sở dữ liệu để lưu trữ dữ liệu kênh trạng thái (state channel), mô hình chi phí và quy tắc indexing. +- **Cơ sở dữ liệu PostgreSQL** - Kho lưu trữ chính cho Graph Node, đây là nơi lưu trữ dữ liệu subgraph. Dịch vụ indexer và đại lý cũng sử dụng cơ sở dữ liệu để lưu trữ dữ liệu kênh trạng thái (state channel), mô hình chi phí và quy tắc indexing. - **Điểm cuối Ethereum** - Một điểm cuối cho thấy API Ethereum JSON-RPC. Điều này có thể ở dạng một ứng dụng khách Ethereum duy nhất hoặc nó có thể là một thiết lập phức tạp hơn để tải số dư trên nhiều máy khách. Điều quan trọng cần lưu ý là các subgraph nhất định sẽ yêu cầu các khả năng cụ thể của ứng dụng khách Ethereum như chế độ lưu trữ và API truy tìm. @@ -141,6 +141,8 @@ Tại trung tâm của cơ sở hạ tầng của indexer là Graph Node theo d - **Đại lý Indexer ** - Tạo điều kiện thuận lợi cho các tương tác của Indexer trên blockchain bao gồm những việc như đăng ký trên mạng lưới, quản lý triển khai subgraph đối với Node The Graph của nó và quản lý phân bổ. Máy chủ số liệu Prometheus - Các thành phần Node The Graph và Indexer ghi các số liệu của chúng vào máy chủ số liệu. +- **Prometheus metrics server** - The Graph Node and Indexer components log their metrics to the metrics server. + Lưu ý: Để hỗ trợ mở rộng quy mô nhanh, bạn nên tách các mối quan tâm về truy vấn và indexing giữa các nhóm node khác nhau: node truy vấn và node index. ### Tổng quan về các cổng From f4e292c87c87ddcfa5a8a38f07b707fd0670e4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:21 -0500 Subject: [PATCH 36/47] New translations global.json (Arabic) --- pages/ar/global.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pages/ar/global.json b/pages/ar/global.json index 3cf6737c97c2..98b9f29f374c 100644 --- a/pages/ar/global.json +++ b/pages/ar/global.json @@ -1,17 +1,17 @@ { - "language": "Language", + "language": "اللغة", "aboutTheGraph": "حول The Graph", "developer": "مطور", "supportedNetworks": "الشبكات المدعومة", - "collapse": "Collapse", - "expand": "Expand", - "previous": "Previous", - "next": "Next", - "editPage": "Edit page", - "pageSections": "Page Sections", - "linkToThisSection": "Link to this section", - "technicalLevelRequired": "Technical Level Required", - "notFoundTitle": "Oops! This page was lost in space...", - "notFoundSubtitle": "Check if you’re using the right address or explore our website by clicking on the link below.", - "goHome": "Go Home" + "collapse": "طي", + "expand": "توسيع", + "previous": "السابق", + "next": "التالي", + "editPage": "تعديل الصفحة", + "pageSections": "أقسام الصفحة", + "linkToThisSection": "رابط لهذا القسم", + "technicalLevelRequired": "المستوى التقني المطلوب", + "notFoundTitle": "عفوا! هذه الصفحة ضاعت في الفضاء...", + "notFoundSubtitle": "تحقق مما إذا كنت تستخدم العنوان الصحيح أو استكشف موقعنا على الويب من خلال النقر على الرابط أدناه.", + "goHome": "الذهاب للرئيسية" } From 71539e30f3d038eb7b948dd2a7e362e31019e54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:22 -0500 Subject: [PATCH 37/47] New translations global.json (Japanese) --- pages/ja/global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/ja/global.json b/pages/ja/global.json index d755ec739e6c..b61cf37cc383 100644 --- a/pages/ja/global.json +++ b/pages/ja/global.json @@ -12,6 +12,6 @@ "linkToThisSection": "Link to this section", "technicalLevelRequired": "Technical Level Required", "notFoundTitle": "Oops! This page was lost in space...", - "notFoundSubtitle": "Check if you’re using the right address or explore our website by clicking on the link below.", + "notFoundSubtitle": "以下のリンクをクリックして、正しいアドレスを使用しているかどうかを確認し、また、ウェブサイトをご覧ください。", "goHome": "Go Home" } From 61b89154d71ef8a96eda013361bb579d27bafc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:24 -0500 Subject: [PATCH 38/47] New translations indexing.mdx (Arabic) --- pages/ar/indexing.mdx | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/pages/ar/indexing.mdx b/pages/ar/indexing.mdx index 37f35841a39b..ea7e614ee932 100644 --- a/pages/ar/indexing.mdx +++ b/pages/ar/indexing.mdx @@ -2,7 +2,7 @@ title: فهرسة (indexing) --- -import { Difficulty } from '@/components' +'import { Difficulty } from '@/components المفهرسون ( Indexers) هم مشغلي العقد (node) في شبكة TheGraph ويقومون ب staking لتوكن (GRT) من أجل توفير خدمات الفهرسة ( indexing) والاستعلام. المفهرسون(Indexers) يحصلون على رسوم الاستعلام ومكافآت الفهرسة وذلك مقابل خدماتهم. وأيضا يكسبون من مجموعة الخصومات (Rebate Pool) والتي تتم مشاركتها مع جميع المساهمين في الشبكة بما يتناسب مع عملهم ، وفقا ل Cobbs-Douglas Rebate Function. @@ -133,13 +133,15 @@ query indexerAllocations { - **قاعدة بيانات PostgreSQL**-هو المخزن الرئيسي لGraph Node ، وفيه يتم تخزين بيانات ال subgraph. خدمة المفهرس والوكيل تستخدم أيضًا قاعدة البيانات لتخزين بيانات قناة الحالة ونماذج التكلفة وقواعد الفهرسة. -- ** Ethereum endpoint ** - هي نقطة نهاية تعرض Ethereum JSON-RPC API. قد يأخذ ذلك نموذج عميل Ethereum واحدا أو قد يكون ذو إعداد أكثر تعقيدا والذي يقوم بتحميل أرصدة عبر عدة نماذج. من المهم أن تدرك أن بعض ال subgraphs تتطلب قدرات معينة لعميل Ethereum مثل الأرشفة وتتبع API. +- **Ethereum endpoint** - هي نقطة نهاية تعرض Ethereum JSON-RPC API. قد يأخذ ذلك نموذج عميل Ethereum واحدا أو قد يكون ذو إعداد أكثر تعقيدا والذي يقوم بتحميل أرصدة عبر عدة نماذج. من المهم أن تدرك أن بعض ال subgraphs تتطلب قدرات معينة لعميل Ethereum مثل الأرشفة وتتبع API. - **(الإصدار أقل من 5) IPFS node** بيانات ال Subgraph تخزن على شبكة IPFS. يمكن لGraph Node بشكل أساسي الوصول إلى IPFS node أثناء نشر الsubgraph لجلب الsubgraph manifest وجميع الملفات المرتبطة. لا يحتاج مفهرسو الشبكة إلى استضافة IPFS node الخاصة بهم ، حيث يتم استضافة IPFS node للشبكة على https://ipfs.network.thegraph.com. - **خدمة المفهرس Indexer service**- يتعامل مع جميع الاتصالات الخارجية المطلوبة مع الشبكة. ويشارك نماذج التكلفة وحالات الفهرسة ، ويمرر طلبات الاستعلام من البوابات gateways إلى Graph Node ، ويدير مدفوعات الاستعلام عبر قنوات الحالة مع البوابة. -- **Indexer agent**- يسهل تفاعلات المفهرسين على السلسلة بما في ذلك التسجيل في الشبكة ، وإدارة عمليات نشر الsubgraph إلى Graph Node/s الخاصة بها ، وإدارة المخصصات. سيرفر مقاييس Prometheus - مكونات ال Graph Node والمفهرس تسجل قياساتها على سيرفر المقاييس. +- **Indexer agent**- يسهل تفاعلات المفهرسين على السلسلة بما في ذلك التسجيل في الشبكة ، وإدارة عمليات نشر الsubgraph إلى Graph Node/s الخاصة بها ، وإدارة المخصصات. سيرفر مقاييس + +- **Prometheus metrics server** - مكونات The Graph Node والمفهرس يسجلون مقاييسهم على سيرفر المقاييس. ملاحظة: لدعم القياس السريع ، يستحسن فصل الاستعلام والفهرسة بين مجموعات مختلفة من العقد Nodes: عقد الاستعلام وعقد الفهرس. @@ -149,26 +151,26 @@ query indexerAllocations { #### 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 | - | +| المنفذ | الغرض | المسار | CLI Argument | متغيرات البيئة | +| ------ | ------------------------------------------------------- | ------------------------------------------------------------------- | ----------------- | -------------- | +| 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 | -| ---- | ------------------------------------------------------------ | --------------------------------------------------------------------------- | -------------- | ---------------------- | -| 7600 | GraphQL HTTP server
(for paid subgraph queries) | /subgraphs/id/...
/status
/channel-messages-inbox | --port | `INDEXER_SERVICE_PORT` | -| 7300 | Prometheus metrics | /metrics | --metrics-port | - | +| المنفذ | الغرض | المسار | CLI Argument | متغيرات البيئة | +| ------ | ------------------------------------------------------------ | --------------------------------------------------------------------------- | -------------- | ---------------------- | +| 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 -| Port | Purpose | Routes | CLI Argument | Environment Variable | -| ---- | ---------------------- | ------ | ------------------------- | --------------------------------------- | -| 8000 | Indexer management API | / | --indexer-management-port | `INDEXER_AGENT_INDEXER_MANAGEMENT_PORT` | +| المنفذ | الغرض | المسار | CLI Argument | متغيرات البيئة | +| ------ | ---------------------- | ------ | ------------------------- | --------------------------------------- | +| 8000 | Indexer management API | / | --indexer-management-port | `INDEXER_AGENT_INDEXER_MANAGEMENT_PORT` | ### قم بإعداد البنية الأساسية للسيرفر باستخدام Terraform على Google Cloud From 3051563e5e235971326e8f9bdac208539aa32a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:26 -0500 Subject: [PATCH 39/47] New translations index.json (Arabic) --- pages/ar/index.json | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pages/ar/index.json b/pages/ar/index.json index 3e48ecb8a612..d34ab87234e3 100644 --- a/pages/ar/index.json +++ b/pages/ar/index.json @@ -1,6 +1,6 @@ { - "title": "Get Started", - "intro": "Learn about The Graph, a decentralized protocol for indexing and querying data from blockchains.", + "title": "البدء", + "intro": "تعرف على The Graph ، وهو بروتوكول لامركزي لفهرسة البيانات والاستعلام عنها من ال Blockchains.", "shortcuts": { "aboutTheGraph": { "title": "حول The Graph", @@ -8,32 +8,32 @@ }, "quickStart": { "title": "بداية سريعة", - "description": "Jump in and start with The Graph" + "description": "انضم إلينا وابدأ مع The Graph" }, "developerFaqs": { "title": "الأسئلة الشائعة للمطورين", - "description": "Frequently asked questions" + "description": "الأسئلة الشائعة" }, "queryFromAnApplication": { - "title": "Query from an Application", - "description": "Learn to query from an application" + "title": "الاستعلام من التطبيق", + "description": "تعلم كيفية الاستعلام من التطبيق" }, "createASubgraph": { "title": "إنشاء الـ Subgraph", - "description": "Use Studio to create subgraphs" + "description": "استخدم Studio لإنشاء subgraphs" }, "migrateFromHostedService": { - "title": "Migrate from Hosted Service", - "description": "Migrating subgraphs to The Graph Network" + "title": "الانتقال من Hosted Service", + "description": "ترحيل ال Subgraphs إلى شبكة TheGraph" } }, "networkRoles": { - "title": "Network Roles", - "description": "Learn about The Graph’s network roles.", + "title": "قواعد الشبكة", + "description": "تعرف على قوانين شبكة The Graph.", "roles": { "developer": { "title": "المطور", - "description": "Create a subgraph or use existing subgraphs in a dapp" + "description": "قم بإنشاء Subgraph أو استخدم ال Subgraphs الموجودة في ال dapp" }, "indexer": { "title": "فهرسة (indexing)", @@ -49,29 +49,29 @@ } } }, - "readMore": "Read more", + "readMore": "إقرأ المزيد", "products": { "title": "المنتجات", "products": { "subgraphStudio": { "title": "Subgraph Studio", - "description": "Create, manage and publish subgraphs and API keys" + "description": "قم بإنشاء وإدارة ونشر ال Subgraphs و API keys" }, "graphExplorer": { "title": "Graph Explorer", - "description": "Explore subgraphs and interact with the protocol" + "description": "استكشف ال Subgraphsوتفاعل مع البروتوكول" }, "hostedService": { - "title": "الخدمة المستضافة", - "description": "Create and explore subgraphs on the Hosted Service" + "title": "الخدمة المستضافة (Hosted Service)", + "description": "قم بإنشاء واستكشاف ال Subgraphs على ال Hosted service" } } }, "supportedNetworks": { "title": "الشبكات المدعومة", - "description": "The Graph supports the following networks on The Graph Network and the Hosted Service.", + "description": "يدعم TheGraph الشبكات التالية على شبكة TheGraph و Hosted Service.", "graphNetworkAndHostedService": "The Graph Network & Hosted Service", "hostedService": "الخدمة المستضافة", - "betaWarning": "Network is in beta. Use with caution." + "betaWarning": "الشبكة في مرحلة beta. استخدم بحذر." } } From 94315d4c818c352e42a21badfe96ba957b7d1a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:27 -0500 Subject: [PATCH 40/47] New translations index.json (Japanese) --- pages/ja/index.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pages/ja/index.json b/pages/ja/index.json index 86cb3354c441..4f23f6799c5f 100644 --- a/pages/ja/index.json +++ b/pages/ja/index.json @@ -1,6 +1,6 @@ { - "title": "Get Started", - "intro": "Learn about The Graph, a decentralized protocol for indexing and querying data from blockchains.", + "title": "開始する", + "intro": "ブロックチェーンのデータにインデックスを付けたり、クエリを実行するための分散型プロトコル「The Graph」についてご紹介します。", "shortcuts": { "aboutTheGraph": { "title": "The Graphについて", @@ -8,32 +8,32 @@ }, "quickStart": { "title": "クイックスタート", - "description": "Jump in and start with The Graph" + "description": "まずは「The Graph」から始める" }, "developerFaqs": { - "title": "Developer FAQs", - "description": "Frequently asked questions" + "title": "開発者 FAQ", + "description": "よくある質問と回答" }, "queryFromAnApplication": { - "title": "Query from an Application", - "description": "Learn to query from an application" + "title": "アプリケーションからのクエリ方法", + "description": "アプリケーションからのクエリ方法を学ぶ" }, "createASubgraph": { - "title": "Create a Subgraph", - "description": "Use Studio to create subgraphs" + "title": "サブグラフの作成", + "description": "スタジオを使ってサブグラフを作成" }, "migrateFromHostedService": { - "title": "Migrate from Hosted Service", - "description": "Migrating subgraphs to The Graph Network" + "title": "ホスティングサービスからの移行", + "description": "The Graph Networkへのサブグラフの移行" } }, "networkRoles": { - "title": "Network Roles", - "description": "Learn about The Graph’s network roles.", + "title": "ネットワークルール", + "description": "The Graphのネットワークルールを学ぶ", "roles": { "developer": { "title": "ディベロッパー", - "description": "Create a subgraph or use existing subgraphs in a dapp" + "description": "サブグラフの作成及び既存のサブグラフを利用したdappの作成" }, "indexer": { "title": "インデクシング", @@ -49,13 +49,13 @@ } } }, - "readMore": "Read more", + "readMore": "詳細", "products": { "title": "プロダクト", "products": { "subgraphStudio": { "title": "Subgraph Studio", - "description": "Create, manage and publish subgraphs and API keys" + "description": "サブグラフとAPIキーの作成、管理、公開" }, "graphExplorer": { "title": "グラフエクスプローラ", @@ -69,9 +69,9 @@ }, "supportedNetworks": { "title": "Supported Networks", - "description": "The Graph supports the following networks on The Graph Network and the Hosted Service.", + "description": "The Graphでは、The Graph NetworkおよびHosted Serviceにおいて、以下のネットワークをサポートしています。", "graphNetworkAndHostedService": "The Graph Network & Hosted Service", "hostedService": "Hosted Service", - "betaWarning": "Network is in beta. Use with caution." + "betaWarning": "ネットワークはベータ版ですので注意してお使いください。" } } From 842dcf7a1e9e85e04a50e9a31105d377bd2308c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:28 -0500 Subject: [PATCH 41/47] New translations index.json (Chinese Simplified) --- pages/zh/index.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/pages/zh/index.json b/pages/zh/index.json index 05802f75ba78..7d12eab6526d 100644 --- a/pages/zh/index.json +++ b/pages/zh/index.json @@ -1,39 +1,39 @@ { - "title": "Get Started", - "intro": "Learn about The Graph, a decentralized protocol for indexing and querying data from blockchains.", + "title": "开始", + "intro": "了解The Graph,一个用于索引和查询区块链数据的去中心化的协议。", "shortcuts": { "aboutTheGraph": { "title": "关于 The Graph", "description": "了解有关The Graph的更多信息" }, "quickStart": { - "title": "Quick Start", - "description": "Jump in and start with The Graph" + "title": "快速开始", + "description": "加入并从 The Graph 开始" }, "developerFaqs": { - "title": "Developer FAQs", - "description": "Frequently asked questions" + "title": "开发常见问题", + "description": "常见问题" }, "queryFromAnApplication": { - "title": "Query from an Application", - "description": "Learn to query from an application" + "title": "从应用程序查询", + "description": "学习从应用程序中查询" }, "createASubgraph": { - "title": "Create a Subgraph", - "description": "Use Studio to create subgraphs" + "title": "创建子图", + "description": "使用工作室来创建子图" }, "migrateFromHostedService": { - "title": "Migrate from Hosted Service", - "description": "Migrating subgraphs to The Graph Network" + "title": "从托管服务中迁移", + "description": "将子图迁移到The Graph网络上" } }, "networkRoles": { - "title": "Network Roles", - "description": "Learn about The Graph’s network roles.", + "title": "网络角色", + "description": "了解The Graph的网络角色。", "roles": { "developer": { "title": "开发者", - "description": "Create a subgraph or use existing subgraphs in a dapp" + "description": "创建一个子图或在一个去中心化应用中使用现有的子图" }, "indexer": { "title": "索引", @@ -49,13 +49,13 @@ } } }, - "readMore": "Read more", + "readMore": "了解更多", "products": { "title": "产品", "products": { "subgraphStudio": { "title": "子图工作室", - "description": "Create, manage and publish subgraphs and API keys" + "description": "创建、管理和发布子图和API密钥" }, "graphExplorer": { "title": "Graph 浏览器", @@ -69,9 +69,9 @@ }, "supportedNetworks": { "title": "支持的网络", - "description": "The Graph supports the following networks on The Graph Network and the Hosted Service.", - "graphNetworkAndHostedService": "The Graph Network & Hosted Service", + "description": "The Graph支持The Graph网络和托管服务的以下网络。", + "graphNetworkAndHostedService": "The Graph网络和托管服务", "hostedService": "托管服务", - "betaWarning": "Network is in beta. Use with caution." + "betaWarning": "网络正处于测试阶段。请谨慎使用。" } } From 0112d360209c74123fa441855b7ad3fa9d29f6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:29 -0500 Subject: [PATCH 42/47] New translations indexing.mdx (Japanese) --- pages/ja/indexing.mdx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pages/ja/indexing.mdx b/pages/ja/indexing.mdx index 212fc6c18b9a..e51e2cb53deb 100644 --- a/pages/ja/indexing.mdx +++ b/pages/ja/indexing.mdx @@ -131,7 +131,7 @@ Use Etherscan to call `getRewards()`: インデクサーのインフラの中心となるのは、イーサリアムを監視し、サブグラフの定義に従ってデータを抽出・ロードし、[GraphQL API](/about/introduction#how-the-graph-works)として提供するグラフノードです。 グラフノードには、イーサリアムの EVM ノードのエンドポイントと、データを取得するための IPFS ノード、ストア用の PostgreSQL データベース、ネットワークとのやりとりを促進するインデクサーのコンポーネントが接続されている必要があります。 -- **PostgreSQLPostgreSQL データベース** - グラフノードのメインストアで、サブグラフのデータが格納されています。 また、インデクササービスとエージェントは、データベースを使用して、ステートチャネルデータ、コストモデル、およびインデクシングルールを保存します。 +- **PostgreSQL データベース** - グラフノードのメインストアで、サブグラフのデータが格納されています。 また、インデクササービスとエージェントは、データベースを使用して、ステートチャネルデータ、コストモデル、およびインデクシングルールを保存します。 - **イーサリアムエンドポイント** - Ethereum JSON-RPC API を公開するエンドポイントです。 これは単一のイーサリアムクライアントの形をとっているかもしれませんし、複数のイーサリアムクライアント間でロードバランスをとるような複雑なセットアップになっているかもしれません。 特定のサブグラフには、アーカイブモードやトレース API など、特定のイーサリアムクライアント機能が必要になることを認識しておくことが重要です。 @@ -139,7 +139,9 @@ Use Etherscan to call `getRewards()`: - **Indexer service** - ネットワークとの必要な外部通信を全て処理します。 コストモデルとインデキシングのステータスを共有し、ゲートウェイからのクエリ要求をグラフノードに渡し、ゲートウェイとのステートチャンネルを介してクエリの支払いを管理します。 -- **Indexer agent** - ネットワークへの登録、グラフノードへのサブグラフのデプロイ管理、割り当ての管理など、チェーン上のインデクサーのインタラクションを容易にします。 Prometheus メトリクス・サーバー - グラフノードとインデクサー・コンポーネントは、それぞれのメトリクスをメトリクス・サーバーに記録します。 +- **Indexer agent** - ネットワークへの登録、グラフノードへのサブグラフのデプロイ管理、割り当ての管理など、チェーン上のインデクサーのインタラクションを容易にします。 + +- **Prometheus metrics server** - Graph NodeとIndexerコンポーネントは、自分のメトリクスをメトリクス・サーバーにログします。 コマンドを実行する前に、[variables.tf](https://github.com/graphprotocol/indexer/blob/main/terraform/variables.tf)に目を通し、このディレクトリに`terraform.tfvars` というファイルを作成します(または、前のステップで作成したものを修正します) デフォルトを上書きしたい変数や、値を設定したい変数ごとに、`terraform.tfvars`に設定を入力します。 @@ -339,7 +341,7 @@ cargo run -p graph-node --release -- \ - **イーサリアムノード** - デフォルトでは、docker compose setup は mainnet: [http://host.docker.internal:8545](http://host.docker.internal:8545)を使ってホストマシン上のイーサリアムノードに接続します。 このネットワーク名と URL は、`docker-compose.yaml`を更新することで置き換えることができます。 -#### Setup +#### セットアップ 1. Graph Node をクローンし、Docker ディレクトリに移動します。 From 6fc92eebebdea23eb3c79c302fd2b8d1c70599da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:31 -0500 Subject: [PATCH 43/47] New translations indexing.mdx (Spanish) --- pages/es/indexing.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pages/es/indexing.mdx b/pages/es/indexing.mdx index 232a419b7148..3402e1dc502f 100644 --- a/pages/es/indexing.mdx +++ b/pages/es/indexing.mdx @@ -139,7 +139,9 @@ En el centro de la infraestructura de un indexador está el Graph Node que monit - **Servicio de indexador**: Gestiona todas las comunicaciones externas necesarias con la red. Comparte modelos de costos y estados de indexación, transfiere solicitudes de consulta desde la puerta de acceso (gateway) a Graph Node y administra los pagos de consultas a través de canales de estado con la puerta de acceso. -- **Agente indexador**: Facilita las interacciones de los indexadores en cadena, incluido el registro en la red, la gestión de implementaciones de subgrafos en sus Graph Node y la gestión de asignaciones. Servidor de métricas de Prometheus: los componentes Graph Node y el Indexer registran sus métricas en el servidor de métricas. +- **Agente indexador**: Facilita las interacciones de los indexadores en cadena, incluido el registro en la red, la gestión de implementaciones de subgrafos en sus Graph Node y la gestión de asignaciones. + +- **Prometheus metrics server** - The Graph Node and Indexer components log their metrics to the metrics server. Nota: Para admitir el escalado ágil, se recomienda que las inquietudes de consulta e indexación se separen entre diferentes conjuntos de nodos: nodos de consulta y nodos de índice. From 23e397f625102e33497975938d2452950d91d00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:37 -0500 Subject: [PATCH 44/47] New translations delegating.mdx (Arabic) --- pages/ar/delegating.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/ar/delegating.mdx b/pages/ar/delegating.mdx index 207be3e2a948..a8d1bbc1e0d2 100644 --- a/pages/ar/delegating.mdx +++ b/pages/ar/delegating.mdx @@ -2,11 +2,11 @@ title: تفويض --- -Delegators cannot be slashed for bad behavior, but there is a deposit tax on Delegators to disincentivize poor decision making that could harm the integrity of the network. +لا يمكن شطب المفوضين بسبب السلوك السيئ ، ولكن هناك ضريبة ودائع على المفوضين لتثبيط اتخاذ القرار السيئ الذي قد يضر بسلامة الشبكة. ## دليل المفوض -This guide will explain how to be an effective delegator in the Graph Network. Delegators share earnings of the protocol alongside all indexers on their delegated stake. A Delegator must use their best judgement to choose Indexers based on multiple factors. Please note this guide will not go over steps such as setting up Metamask properly, as that information is widely available on the internet. There are three sections in this guide: +سيشرح هذا الدليل كيف تكون مفوضا فعالا في Graph Network. يشارك المفوضون أرباح حصتهم المفوضة مع المفهرسين. يجب أن يستخدم المفوض أفضل حكم لديه لاختيار المفهرسين بناء على عوامل متعددة. يرجى ملاحظة أن هذا الدليل لن يتطرق لخطوات مثل إعداد Metamask ، حيث أن هذه المعلومات متاحة على نطاق واسع على الإنترنت. يوجد ثلاثة أقسام في هذا الدليل: - مخاطر تفويض التوكن tokens في شبكة The Graph - كيفية حساب العوائد المتوقعة كمفوض @@ -65,7 +65,7 @@ This guide will explain how to be an effective delegator in the Graph Network. D ![شارك الصيغة](/img/Share-Forumla.png) -Using this formula, we can see that it is actually possible for an indexer who is offering only 20% to delegators, to actually be giving delegators an even better reward than an Indexer who is giving 90% to delegators. +باستخدام هذه الصيغة ، يمكننا أن نرى أنه من الممكن فعليا للمفهرس الذي يعرض 20٪ فقط للمفوضين ، أن يمنح المفوضين عائدا أفضل من المفهرس الذي يعطي 90٪ للمفوضين. لذلك يمكن للمفوض أن يقوم بالحسابات لتحديد أن المفهرس الذي يقدم 20٪ للمفوضين يقدم عائدا أفضل. From 8350846baf48d21752f174a112600b23ace07a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Fri, 28 Jan 2022 08:34:42 -0500 Subject: [PATCH 45/47] New translations explorer.mdx (Arabic) --- pages/ar/explorer.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/ar/explorer.mdx b/pages/ar/explorer.mdx index 359c4767d952..652e914fe353 100644 --- a/pages/ar/explorer.mdx +++ b/pages/ar/explorer.mdx @@ -62,7 +62,7 @@ Let’s start with the Indexers. دعونا نبدأ مع المفهرسين ا لمعرفة المزيد حول كيفية أن تصبح مفوضا كل ما عليك فعله هو التوجه إلى [الوثائق الرسمية](/delegating) أو [ أكاديمية The Graph ](https://docs.thegraph.academy/network/delegators). -![Indexing details pane](/img/Indexing-Details-Pane.png) +![نافذة تفاصيل الفهرسة](/img/Indexing-Details-Pane.png) ### 3. المفوضون Delegators @@ -178,7 +178,7 @@ If you want to learn more about how to become a Delegator, look no further! لم في النصف الثاني من الصفحة ، لديك جدول التفويضات. هنا يمكنك رؤية المفهرسين الذين فوضتهم ، بالإضافة إلى تفاصيلهم (مثل المكافآت المقتطعة rewards cuts، و cooldown ، الخ). -With the buttons on the right side of the table, you can manage your delegation - delegate more, undelegate, or withdraw your delegation after the thawing period. +باستخدام الأزرار الموجودة على الجانب الأيمن من الجدول ، يمكنك إدارة التفويض - تفويض المزيد أو إلغاء التفويض أو سحب التفويض بعد فترة الإذابة. باستخدام الأزرار الموجودة على الجانب الأيمن من الجدول ، يمكنك إدارة تفويضاتك أو تفويض المزيد أو إلغاء التفويض أو سحب التفويض بعد فترة الذوبان thawing. @@ -193,7 +193,7 @@ With the buttons on the right side of the table, you can manage your delegation - جميع ال subgraphs التي تقوم بتنسيقها مع تفاصيل الإشارة - إجمالي الحصة لكل subgraph - مكافآت الاستعلام لكل subgraph -- Updated at date details +- تحديث في تفاصيل التاريخ ![صورة المستكشف 14](/img/Curation-Stats.png) From cc699046f4f1e13c8a8deb1f58328a535d629243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoi=CC=82t=20Rouleau?= Date: Fri, 28 Jan 2022 11:54:00 -0500 Subject: [PATCH 46/47] Fix build errors --- pages/ar/indexing.mdx | 28 ++--- pages/zh/developer/assemblyscript-api.mdx | 113 +++++++++--------- pages/zh/developer/create-subgraph-hosted.mdx | 42 +++---- 3 files changed, 92 insertions(+), 91 deletions(-) diff --git a/pages/ar/indexing.mdx b/pages/ar/indexing.mdx index 7b88ab4b8eae..4b9516280474 100644 --- a/pages/ar/indexing.mdx +++ b/pages/ar/indexing.mdx @@ -2,7 +2,7 @@ title: فهرسة (indexing) --- -'import { Difficulty } from '@/components +import { Difficulty } from '@/components' المفهرسون ( Indexers) هم مشغلي العقد (node) في شبكة TheGraph ويقومون ب staking لتوكن (GRT) من أجل توفير خدمات الفهرسة ( indexing) والاستعلام. المفهرسون(Indexers) يحصلون على رسوم الاستعلام ومكافآت الفهرسة وذلك مقابل خدماتهم. وأيضا يكسبون من مجموعة الخصومات (Rebate Pool) والتي تتم مشاركتها مع جميع المساهمين في الشبكة بما يتناسب مع عملهم ، وفقا ل Cobbs-Douglas Rebate Function. @@ -115,7 +115,7 @@ query indexerAllocations { - **كبيرة** - مُعدة لفهرسة جميع ال subgraphs المستخدمة حاليا وأيضا لخدمة طلبات حركة مرور البيانات ذات الصلة. | Setup | (CPUs) | (memory in GB) | (disk in TBs) | (CPUs) | (memory in GB) | -| ----- |:------:|:--------------:|:-------------:|:------:|:--------------:| +| ----- | :----: | :------------: | :-----------: | :----: | :------------: | | صغير | 4 | 8 | 1 | 4 | 16 | | قياسي | 8 | 30 | 1 | 12 | 48 | | متوسط | 16 | 64 | 2 | 32 | 64 | @@ -139,7 +139,7 @@ query indexerAllocations { - **خدمة المفهرس Indexer service**- يتعامل مع جميع الاتصالات الخارجية المطلوبة مع الشبكة. ويشارك نماذج التكلفة وحالات الفهرسة ، ويمرر طلبات الاستعلام من البوابات gateways إلى Graph Node ، ويدير مدفوعات الاستعلام عبر قنوات الحالة مع البوابة. -- **Indexer agent**- يسهل تفاعلات المفهرسين على السلسلة بما في ذلك التسجيل في الشبكة ، وإدارة عمليات نشر الsubgraph إلى Graph Node/s الخاصة بها ، وإدارة المخصصات. سيرفر مقاييس +- **Indexer agent**- يسهل تفاعلات المفهرسين على السلسلة بما في ذلك التسجيل في الشبكة ، وإدارة عمليات نشر الsubgraph إلى Graph Node/s الخاصة بها ، وإدارة المخصصات. سيرفر مقاييس - **Prometheus** - مكونات ال Graph Node والمفهرس تسجل قياساتها على سيرفر المقاييس. @@ -151,20 +151,20 @@ query indexerAllocations { #### Graph Node -| المنفذ | الغرض | المسار | CLI Argument | متغيرات البيئة | -| ------ | ------------------------------------------------------- | ------------------------------------------------------------------- | ----------------- | -------------- | -| 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-- | - | +| المنفذ | الغرض | المسار | CLI Argument | متغيرات البيئة | +| --- | --- | --- | --- | --- | +| 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-- | - | #### خدمة المفهرس -| المنفذ | الغرض | المسار | CLI Argument | متغيرات البيئة | -| ------ | ------------------------------------------------------------ | --------------------------------------------------------------------------- | -------------- | ---------------------- | -| 7600 | GraphQL HTTP server
(for paid subgraph queries) | /subgraphs/id/...
/status
/channel-messages-inbox | port-- | `INDEXER_SERVICE_PORT` | -| 7300 | Prometheus metrics | /metrics | metrics-port-- | - | +| المنفذ | الغرض | المسار | CLI Argument | متغيرات البيئة | +| --- | --- | --- | --- | --- | +| 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 diff --git a/pages/zh/developer/assemblyscript-api.mdx b/pages/zh/developer/assemblyscript-api.mdx index c73cf2ac9ee7..e41df78c5737 100644 --- a/pages/zh/developer/assemblyscript-api.mdx +++ b/pages/zh/developer/assemblyscript-api.mdx @@ -2,11 +2,11 @@ title: AssemblyScript API --- -> 注意:如果您在 `graph-cli`/`graph-ts` 版本 `0.22.0`之前创建了一个子图,那么您使用的是旧版本的AssemblyScript,我们建议您查看 [`迁移指南`](/developer/assemblyscript-migration-guide) +> 注意:如果您在 `graph-cli`/`graph-ts` 版本 `0.22.0`之前创建了一个子图,那么您使用的是旧版本的 AssemblyScript,我们建议您查看 [`迁移指南`](/developer/assemblyscript-migration-guide) 此页面记录了编写子图映射时可以使用的内置 API。有两种开箱即用的 API: -- [Graph TypeScript库](https://github.com/graphprotocol/graph-ts) (`graph-ts`) +- [Graph TypeScript 库](https://github.com/graphprotocol/graph-ts) (`graph-ts`) - 使用`graph codegen`从子图文件生成的代码。 也可以添加其他库作为依赖项,只要它们与 [AssemblyScript](https://github.com/AssemblyScript/assemblyscript) 兼容。 由于这是编语言映射,因此可以参考 [AssemblyScript wiki](https://github.com/AssemblyScript/assemblyscript/wiki) 了解相应的语言和标准库功能。 @@ -32,7 +32,7 @@ npm install --save-dev @graphprotocol/graph-ts # NPM `@graphprotocol/graph-ts` 库提供以下 API: - 用于处理以太坊智能合约、事件、区块、交易和以太坊价值的`ethereum` API。 -- 用于与Graph节点交互,存储和加载实体的 `store` API。 +- 用于与 Graph 节点交互,存储和加载实体的 `store` API。 - 用于将消息记录到 Graph 节点输出和 Graph Explorer 的`log` API。 - 用于从 IPFS 加载文件的`ipfs` API。 - 用于解析 JSON 数据的`json` API。 @@ -41,15 +41,15 @@ npm install --save-dev @graphprotocol/graph-ts # NPM ### 版本 -子图清单中的 `apiVersion` 指定了由Graph节点为给定子图运行的映射 API 版本。 当前的映射 API 版本是 0.0.6。 +子图清单中的 `apiVersion` 指定了由 Graph 节点为给定子图运行的映射 API 版本。 当前的映射 API 版本是 0.0.6。 -| 版本 | Release说明 | -|:-----:| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 0.0.6 | 向 Ethereum Transaction 对象添加 `nonce` 字段
向 Ethereum Block 对象添加 `baseFeePerGas` | +| 版本 | Release 说明 | +| :-: | --- | +| 0.0.6 | 向 Ethereum Transaction 对象添加 `nonce` 字段
向 Ethereum Block 对象添加 `baseFeePerGas` | | 0.0.5 | AssemblyScript 升级到版本 0.19.10(这包括重大更改,参阅 [`迁移指南`](/developer/assemblyscript-migration-guide))
`ethereum.transaction.gasUsed` 重命名为 `ethereum.transaction.gasLimit` | -| 0.0.4 | 向 Ethereum SmartContractCall 对象添加 `functionSignature` 字段 | -| 0.0.3 | 将 `from` 字段添加到 Ethereum Call 对象
`etherem.call.address` 重命名为 `ethereum.call.to` | -| 0.0.2 | 向 Ethereum Transaction 对象添加 `input` 字段 | +| 0.0.4 | 向 Ethereum SmartContractCall 对象添加 `functionSignature` 字段 | +| 0.0.3 | 将 `from` 字段添加到 Ethereum Call 对象
`etherem.call.address` 重命名为 `ethereum.call.to` | +| 0.0.2 | 向 Ethereum Transaction 对象添加 `input` 字段 | ### 内置类型 @@ -211,13 +211,14 @@ import { store } from '@graphprotocol/graph-ts' `store` API 允许从 Graph 节点存储中加载、保存和删除实体。 -写入存储的实体与子图的 GraphQL 架构中定义的 `@entity` 类型一一对应。 为了方便使用这些实体,[Graph CLI](https://github.com/graphprotocol/graph-cli) 提供的 `graph codegen` 命令生成实体类,这些试题类是内置 `Entity 类型,具有模式中字段的属性获取器和设置器,以及加载和保存这些实体的方法。

+写入存储的实体与子图的 GraphQL 架构中定义的 `@entity` 类型一一对应。 为了方便使用这些实体,[Graph CLI](https://github.com/graphprotocol/graph-cli) 提供的 `graph codegen` 命令生成实体类,这些试题类是内置 `Entity` 的子类 类型,具有模式中字段的属性获取器和设置器,以及加载和保存这些实体的方法。 -

创建实体

+#### 创建实体 -

以下是从以太坊事件创建实体的常见模式。

+以下是从以太坊事件创建实体的常见模式。 -
// Import the Transfer event class generated from the ERC20 ABI
+```typescript
+// Import the Transfer event class generated from the ERC20 ABI
 import { Transfer as TransferEvent } from '../generated/ERC20/ERC20'
 
 // Import the Transfer entity type generated from the GraphQL schema
@@ -238,11 +239,11 @@ export function handleTransfer(event: TransferEvent): void {
   // Save the entity to the store
   transfer.save()
 }
-`
+``` -如果在处理链时遇到 `Transfer` 事件,它会使用生成的 `Transfer` 类型(别名为 <0 >TransferEvent 以避免与实体类型的命名冲突) 传递给 `handleTransfer` 事件处理器。 此类型允许访问事件的父事务及其参数等数据。 +如果在处理链时遇到 `Transfer` 事件,它会使用生成的 `Transfer` 类型(别名为 `TransferEvent` 以避免与实体类型的命名冲突) 传递给 `handleTransfer` 事件处理器。 此类型允许访问事件的父事务及其参数等数据。 -每个实体都必须有一个唯一的 ID 以避免与其他实体发生冲突。 事件参数包含可以使用的唯一标识符是相当常见的。 注意:使用事务哈希作为 ID时, 假定同一事务中没有其他事件创建以该哈希作为 ID 的实体。 +每个实体都必须有一个唯一的 ID 以避免与其他实体发生冲突。 事件参数包含可以使用的唯一标识符是相当常见的。 注意:使用事务哈希作为 ID 时, 假定同一事务中没有其他事件创建以该哈希作为 ID 的实体。 #### 从存储中加载实体 @@ -432,7 +433,7 @@ if (callResult.reverted) { #### 编码/解码 ABI -使用`ethereum` 模块中的`encode` 和`decode` 函数,可以按照以太坊的ABI 编码格式对数据进行编码和解码。 +使用`ethereum` 模块中的`encode` 和`decode` 函数,可以按照以太坊的 ABI 编码格式对数据进行编码和解码。 ```typescript import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts' @@ -461,7 +462,7 @@ let decoded = ethereum.decode('(address,uint256)', encoded) import { log } from '@graphprotocol/graph-ts' ``` -`log` API 允许子图将信息记录到 Graph节点标准输出以及 Graph Explorer。 可以使用不同的日志级别记录消息。有一个基本格式字符串语法可以用来编写带参数的日志消息。 +`log` API 允许子图将信息记录到 Graph 节点标准输出以及 Graph Explorer。 可以使用不同的日志级别记录消息。有一个基本格式字符串语法可以用来编写带参数的日志消息。 `log` API 包括以下函数: @@ -551,7 +552,7 @@ export function handleSomeEvent(event: SomeEvent): void { import { ipfs } from '@graphprotocol/graph-ts' ``` -智能合约偶尔会在链上锚定 IPFS 文件。 这允许映射从合约中获取 IPFS 哈希并从 IPFS 读取相应的文件。 文件数据将以 `Bytes` 形式返回,这通常需要进一步处理,例如使用本页后面记录的 `json` API进行处理。 +智能合约偶尔会在链上锚定 IPFS 文件。 这允许映射从合约中获取 IPFS 哈希并从 IPFS 读取相应的文件。 文件数据将以 `Bytes` 形式返回,这通常需要进一步处理,例如使用本页后面记录的 `json` API 进行处理。 给定一个 IPFS 哈希或路径,从 IPFS 读取文件的过程如下: @@ -566,7 +567,7 @@ let path = 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D/Makefile' let data = ipfs.cat(path) ``` -**注意:** `ipfs.cat` 目前还不确定。 如果在请求超时之前无法通过 IPFS 网络检索文件,它将返回 `null`。 因此,检查 `null` 的结果总是值得的。 为了确保可以检索文件,必须将它们锚定到 Graph节点连接的 IPFS 节点。 在[托管服务](https://thegraph.com/hosted-service)上,这是[https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs)。 有关详细信息,请参阅 [IPFS 锚定](/developer/create-subgraph-hosted#ipfs-pinning) 部分。 +**注意:** `ipfs.cat` 目前还不确定。 如果在请求超时之前无法通过 IPFS 网络检索文件,它将返回 `null`。 因此,检查 `null` 的结果总是值得的。 为了确保可以检索文件,必须将它们锚定到 Graph 节点连接的 IPFS 节点。 在[托管服务](https://thegraph.com/hosted-service)上,这是[https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs)。 有关详细信息,请参阅 [IPFS 锚定](/developer/create-subgraph-hosted#ipfs-pinning) 部分。 还可以使用 `ipfs.map` 以流方式处理较大的文件。 该函数需要 IPFS 文件的哈希或路径、回调的名称以及修改其行为的标志: @@ -649,43 +650,43 @@ if (value.kind == JSONValueKind.BOOL) { ### 类型转换参考 -| 源 | 目标 | 转换函数 | -| -------------------- | -------------------- | --------------------------- | -| Address | Bytes | none | -| Address | ID | s.toHexString() | -| Address | String | s.toHexString() | -| BigDecimal | String | s.toString() | -| BigInt | BigDecimal | s.toBigDecimal() | +| 源 | 目标 | 转换函数 | +| -------------------- | -------------------- | ---------------------------- | +| Address | Bytes | none | +| Address | ID | s.toHexString() | +| 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 | none | -| Bytes (signed) | BigInt | BigInt.fromSignedBytes(s) | -| Bytes (unsigned) | BigInt | BigInt.fromUnsignedBytes(s) | +| 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() 或 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) | -| String | BigDecimal | BigDecimal.fromString(s) | -| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | -| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | +| 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) | +| String | BigDecimal | BigDecimal.fromString(s) | +| String (hexadecimal) | Bytes | ByteArray.fromHexString(s) | +| String (UTF-8) | Bytes | ByteArray.fromUTF8(s) | ### 数据源元数据 diff --git a/pages/zh/developer/create-subgraph-hosted.mdx b/pages/zh/developer/create-subgraph-hosted.mdx index 0640b9f1d675..893067799593 100644 --- a/pages/zh/developer/create-subgraph-hosted.mdx +++ b/pages/zh/developer/create-subgraph-hosted.mdx @@ -75,7 +75,7 @@ graph init --studio ## 子图清单文件 -子图清单 `subgraph.yaml` 定义了您的子图索引的智能合约,这些合约中需要关注的事件,以及如何将事件数据映射到 Graph节点存储并允许查询的实体。 子图清单的完整规范可以在[这里](https://github.com/graphprotocol/graph-node/blob/master/docs/subgraph-manifest.md)找到。 +子图清单 `subgraph.yaml` 定义了您的子图索引的智能合约,这些合约中需要关注的事件,以及如何将事件数据映射到 Graph 节点存储并允许查询的实体。 子图清单的完整规范可以在[这里](https://github.com/graphprotocol/graph-node/blob/master/docs/subgraph-manifest.md)找到。 对于示例子图,`subgraph.yaml` 的内容是: @@ -120,13 +120,13 @@ dataSources: 清单中要更新的重要条目是: -- `description`:关于子图是什么的人类可读的描述。 当子图部署到托管服务时,Graph Explorer会显示此描述。 +- `description`:关于子图是什么的人类可读的描述。 当子图部署到托管服务时,Graph Explorer 会显示此描述。 - `repository`:可以找到子图清单的存储库的 URL。 这也由 Graph Explorer 显示。 - `features`:所有使用的 [功能](#experimental-features) 名称的列表。 -- `dataSources.source`:智能合约子图源的地址,以及要使用的智能合约的abi。 地址是可选的; 省略它允许索引来自所有合约的匹配事件。 +- `dataSources.source`:智能合约子图源的地址,以及要使用的智能合约的 abi。 地址是可选的; 省略它允许索引来自所有合约的匹配事件。 - `dataSources.source.startBlock`:数据源开始索引的区块的可选编号。 在大多数情况下,我们建议使用创建合约的区块。 @@ -218,15 +218,15 @@ Each entity must have an `id` field, which is of type `ID!` (string). The `id` f We support the following scalars in our GraphQL API: -| Type | Description | -| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `ID` | Stored as a `string`. | -| `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 have size of 32 bytes. | -| `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 signficand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| Type | Description | +| --- | --- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `ID` | Stored as a `string`. | +| `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 have size of 32 bytes. | +| `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 signficand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | #### Enums @@ -627,7 +627,7 @@ export function handleNewExchange(event: NewExchange): void { ``` > **Note:** A new data source will only process the calls and events for the block in which it was created and all following blocks, but will not process historical data, i.e., data that is contained in prior blocks. -> +> > If prior blocks contain data relevant to the new data source, it is best to index that data by reading the current state of the contract and creating entities representing that state at the time the new data source is created. ### Data Source Context @@ -684,7 +684,7 @@ dataSources: ``` > **Note:** The contract creation block can be quickly looked up on Etherscan: -> +> > 1. Search for the contract by entering its address in the search bar. > 2. Click on the creation transaction hash in the `Contract Creator` section. > 3. Load the transaction details page where you'll find the start block for that contract. @@ -814,9 +814,9 @@ eventHandlers: ## 实验功能 -从 `specVersion` `0.0.4` 开始,子图特征必须使用它们的 < code>camelCase 名称,在清单文件顶层的 `features` 部分中显式声明,如下表所列: +从 `specVersion` `0.0.4` 开始,子图特征必须使用它们的 `camelCase` 名称,在清单文件顶层的 `features` 部分中显式声明,如下表所列: -| 特征 | 名称 | +| 特征 | 名称 | | --------------------------------------------------------- | ------------------------- | | [Non-fatal errors](#non-fatal-errors) | `nonFatalErrors` | | [Full-text Search](#defining-fulltext-search-fields) | `fullTextSearch` | @@ -840,9 +840,9 @@ dataSources: ... 如果将这些数据在链上维护,成本会太高,所以将 IPFS 与以太坊结合的一个常见用例是将数据存储在 IPFS 上,并在以太坊合约中引用 IPFS 哈希。 -给定这样的 IPFS 哈希,子图可以使用 `ipfs.cat` 和 `ipfs.map` 从 IPFS 读取相应的文件。 但是,要可靠地执行此操作,需要将这些文件锚定在索引子图的Graph节点连接到的 IPFS 节点上。 对于 [托管服务](https://thegraph.com/hosted-service),这是 [https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs/)。 +给定这样的 IPFS 哈希,子图可以使用 `ipfs.cat` 和 `ipfs.map` 从 IPFS 读取相应的文件。 但是,要可靠地执行此操作,需要将这些文件锚定在索引子图的 Graph 节点连接到的 IPFS 节点上。 对于 [托管服务](https://thegraph.com/hosted-service),这是 [https://api.thegraph.com/ipfs/](https://api.thegraph.com/ipfs/)。 -> **注意:** Graph Network暂不支持`ipfs.cat`和`ipfs.map`,开发者请勿部署使用该功能的子图通过 Studio 连接到网络。 +> **注意:** Graph Network 暂不支持`ipfs.cat`和`ipfs.map`,开发者请勿部署使用该功能的子图通过 Studio 连接到网络。 为了使子图开发人员更容易做到这一点,Graph 团队编写了一个工具,用于将文件从一个 IPFS 节点传输到另一个节点,称为 [ipfs-sync ](https://github.com/graphprotocol/ipfs-sync)。 @@ -898,7 +898,7 @@ _meta { ### 嫁接到现有子图 -首次部署子图时,它会在相应链的创世块(或每个数据源定义的 `startBlock` 处)开始索引事件。在某些情况下,可以使用现有的子图已经索引的数据并在更晚的区块上开始索引。 这种索引模式称为_嫁接_。 例如,嫁接在开发过程中非常有用,可以快速克服映射中的简单错误,或者在现有子图失败后暂时恢复工作。 +首次部署子图时,它会在相应链的创世块(或每个数据源定义的 `startBlock` 处)开始索引事件。在某些情况下,可以使用现有的子图已经索引的数据并在更晚的区块上开始索引。 这种索引模式称为*嫁接*。 例如,嫁接在开发过程中非常有用,可以快速克服映射中的简单错误,或者在现有子图失败后暂时恢复工作。 > **注意:** 嫁接需要索引器已经索引了基础子图。 目前不建议在 The Graph Network 上使用,开发人员不应通过 Studio 将使用该功能的子图部署到网络中。 @@ -911,9 +911,9 @@ graft: block: 7345624 # Block number ``` -当部署其清单包含 `graft` 块的子图时,Graph节点将复制 `base` 子图的数据,直到并包括给定的 `block`,然后继续从该块开始索引新子图。 基础子图必须存在于目标图节点实例上,并且必须至少索引到给定块。 由于这个限制,嫁接只能在开发期间或紧急情况下使用,以加快生成等效的非嫁接子图。 +当部署其清单包含 `graft` 块的子图时,Graph 节点将复制 `base` 子图的数据,直到并包括给定的 `block`,然后继续从该块开始索引新子图。 基础子图必须存在于目标图节点实例上,并且必须至少索引到给定块。 由于这个限制,嫁接只能在开发期间或紧急情况下使用,以加快生成等效的非嫁接子图。 -因为嫁接是拷贝而不是索引基础数据,所以子图同步到所需块比从头开始索引要快得多,尽管对于非常大的子图,初始数据拷贝仍可能需要几个小时。 在初始化嫁接子图时,Graph节点将记录有关已复制的实体类型的信息。 +因为嫁接是拷贝而不是索引基础数据,所以子图同步到所需块比从头开始索引要快得多,尽管对于非常大的子图,初始数据拷贝仍可能需要几个小时。 在初始化嫁接子图时,Graph 节点将记录有关已复制的实体类型的信息。 嫁接的子图可以使用与基础子图不同的 GraphQL 模式,但仅与之兼容。 它本身必须是一个有效的子图模式,但可能会以下列方式偏离基础子图的模式: From 65d20c074ecddb18dc90d674b90c6abbf80f01f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoi=CC=82t=20Rouleau?= Date: Fri, 28 Jan 2022 11:55:29 -0500 Subject: [PATCH 47/47] Run Prettier --- pages/ar/curating.mdx | 2 +- pages/ar/delegating.mdx | 6 +-- pages/ar/developer/assemblyscript-api.mdx | 16 +++--- .../assemblyscript-migration-guide.mdx | 7 ++- pages/ar/developer/create-subgraph-hosted.mdx | 22 ++++---- pages/ar/developer/developer-faq.mdx | 2 +- pages/ar/developer/graphql-api.mdx | 12 ++--- pages/ar/developer/matchstick.mdx | 12 ++--- pages/ar/explorer.mdx | 2 +- .../ar/hosted-service/migrating-subgraph.mdx | 2 +- pages/ar/studio/billing.mdx | 2 +- pages/ar/studio/subgraph-studio.mdx | 2 +- pages/en/indexing.mdx | 2 +- pages/es/curating.mdx | 2 +- pages/es/delegating.mdx | 2 +- pages/es/developer/assemblyscript-api.mdx | 14 ++--- .../assemblyscript-migration-guide.mdx | 5 ++ pages/es/developer/create-subgraph-hosted.mdx | 30 +++++------ pages/es/developer/graphql-api.mdx | 12 ++--- pages/es/explorer.mdx | 2 +- .../es/hosted-service/migrating-subgraph.mdx | 2 +- pages/es/indexing.mdx | 34 ++++++------ pages/es/studio/billing.mdx | 2 +- pages/es/studio/subgraph-studio.mdx | 2 +- pages/ja/about/network.mdx | 6 +-- pages/ja/curating.mdx | 6 +-- pages/ja/delegating.mdx | 10 ++-- pages/ja/developer/assemblyscript-api.mdx | 12 ++--- .../assemblyscript-migration-guide.mdx | 53 ++++++++++--------- pages/ja/developer/create-subgraph-hosted.mdx | 22 ++++---- pages/ja/developer/define-subgraph-hosted.mdx | 12 ++--- pages/ja/developer/deprecating-a-subgraph.mdx | 8 +-- pages/ja/developer/developer-faq.mdx | 48 ++++++++--------- pages/ja/developer/graphql-api.mdx | 12 ++--- pages/ja/developer/publish-subgraph.mdx | 12 ++--- pages/ja/developer/querying-from-your-app.mdx | 22 ++++---- pages/ja/developer/quick-start.mdx | 40 +++++++------- pages/ja/explorer.mdx | 6 +-- .../ja/hosted-service/migrating-subgraph.mdx | 2 +- pages/ja/indexing.mdx | 34 ++++++------ pages/ja/studio/billing.mdx | 2 +- pages/ja/studio/subgraph-studio.mdx | 2 +- pages/ko/about/introduction.mdx | 6 +-- pages/ko/curating.mdx | 2 +- pages/ko/delegating.mdx | 6 +-- pages/ko/developer/assemblyscript-api.mdx | 12 ++--- .../assemblyscript-migration-guide.mdx | 5 ++ pages/ko/developer/create-subgraph-hosted.mdx | 22 ++++---- pages/ko/developer/graphql-api.mdx | 12 ++--- pages/ko/explorer.mdx | 2 +- .../ko/hosted-service/migrating-subgraph.mdx | 2 +- pages/ko/indexing.mdx | 34 ++++++------ pages/ko/studio/billing.mdx | 2 +- pages/ko/studio/subgraph-studio.mdx | 2 +- pages/vi/curating.mdx | 2 +- pages/vi/delegating.mdx | 2 +- pages/vi/developer/assemblyscript-api.mdx | 14 ++--- .../assemblyscript-migration-guide.mdx | 5 ++ pages/vi/developer/create-subgraph-hosted.mdx | 22 ++++---- pages/vi/developer/graphql-api.mdx | 12 ++--- pages/vi/explorer.mdx | 2 +- .../vi/hosted-service/migrating-subgraph.mdx | 2 +- pages/vi/indexing.mdx | 34 ++++++------ pages/vi/studio/billing.mdx | 2 +- pages/vi/studio/subgraph-studio.mdx | 2 +- pages/zh/about/network.mdx | 8 +-- pages/zh/curating.mdx | 2 +- pages/zh/delegating.mdx | 8 ++- .../assemblyscript-migration-guide.mdx | 25 +++++---- pages/zh/developer/define-subgraph-hosted.mdx | 10 ++-- pages/zh/developer/graphql-api.mdx | 12 ++--- pages/zh/developer/publish-subgraph.mdx | 8 +-- pages/zh/developer/query-the-graph.mdx | 12 ++--- pages/zh/developer/querying-from-your-app.mdx | 18 +++---- pages/zh/developer/quick-start.mdx | 38 ++++++------- pages/zh/explorer.mdx | 2 +- .../hosted-service/deploy-subgraph-hosted.mdx | 16 +++--- .../zh/hosted-service/migrating-subgraph.mdx | 2 +- pages/zh/indexing.mdx | 48 ++++++++--------- pages/zh/studio/billing.mdx | 46 ++++++++-------- pages/zh/studio/deploy-subgraph-studio.mdx | 30 +++++------ pages/zh/studio/subgraph-studio.mdx | 2 +- pages/zh/supported-networks/near.mdx | 20 +++---- 83 files changed, 521 insertions(+), 497 deletions(-) diff --git a/pages/ar/curating.mdx b/pages/ar/curating.mdx index 6e37a8776a6f..b13e20525f2f 100644 --- a/pages/ar/curating.mdx +++ b/pages/ar/curating.mdx @@ -100,5 +100,5 @@ title: (التنسيق) curating title="مشغل فيديو يوتيوب" frameBorder="0" allowFullScreen -> + > diff --git a/pages/ar/delegating.mdx b/pages/ar/delegating.mdx index a8d1bbc1e0d2..dd093c11dd94 100644 --- a/pages/ar/delegating.mdx +++ b/pages/ar/delegating.mdx @@ -28,9 +28,7 @@ title: تفويض يجب اختيار المفهرس بحكمة. إذا اخترت مفهرسا ليس جديرا بالثقة ، أو لا يقوم بعمل جيد ، فستحتاج إلى إلغاء التفويض ، مما يعني أنك ستفقد الكثير من الفرص لكسب المكافآت والتي يمكن أن تكون سيئة مثل حرق GRT. -
- لاحظ 0.5٪ رسوم التفويض ، بالإضافة إلى فترة 28 يوما لإلغاء التفويض. -
+
لاحظ 0.5٪ رسوم التفويض ، بالإضافة إلى فترة 28 يوما لإلغاء التفويض.
### اختيار مفهرس جدير بالثقة مع عائد جيد للمفوضين @@ -88,5 +86,5 @@ title: تفويض title="مشغل فيديو يوتيوب" frameBorder="0" allowFullScreen -> + > diff --git a/pages/ar/developer/assemblyscript-api.mdx b/pages/ar/developer/assemblyscript-api.mdx index 0e7b5427d278..cc1e4ff32df5 100644 --- a/pages/ar/developer/assemblyscript-api.mdx +++ b/pages/ar/developer/assemblyscript-api.mdx @@ -43,13 +43,13 @@ npm install --save-dev @graphprotocol/graph-ts # NPM الـ `apiVersion` في الـ subgraph manifest تحدد إصدار الـ mapping API الذي يتم تشغيله بواسطة Graph Node للـ subgraph المحدد. الاصدار الحالي لـ mapping API هو 0.0.6. -| الاصدار | ملاحظات الإصدار | -|:-------:| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 0.0.6 | تمت إضافة حقل `nonce` إلى كائن إجراء الـ Ethereum
تمت إضافة `baseFeePerGas` إلى كائن Ethereum Block | -| 0.0.5 | تمت ترقية AssemblyScript إلى الإصدار 0.19.10 (يرجى الاطلاع على [ `دليل الترحيل` ](/developer/assemblyscript-migration-guide))
`ethereum.transaction.gasUsed` أعيد تسميته إلى `ethereum.transaction.gasLimit` | -| 0.0.4 | تمت إضافة حقل `functionSignature` إلى كائن Ethereum SmartContractCall | -| 0.0.3 | تمت إضافةحقل `from` إلى كائن Ethereum Call
`etherem.call.address` تمت إعادة تسميته إلى `ethereum.call.to` | -| 0.0.2 | تمت إضافة حقل `input` إلى كائن إجراء Ethereum | +| الاصدار | ملاحظات الإصدار | +| :-: | --- | +| 0.0.6 | تمت إضافة حقل `nonce` إلى كائن إجراء الـ Ethereum
تمت إضافة `baseFeePerGas` إلى كائن Ethereum Block | +| 0.0.5 | تمت ترقية AssemblyScript إلى الإصدار 0.19.10 (يرجى الاطلاع على [ `دليل الترحيل` ](/developer/assemblyscript-migration-guide))
`ethereum.transaction.gasUsed` أعيد تسميته إلى `ethereum.transaction.gasLimit` | +| 0.0.4 | تمت إضافة حقل `functionSignature` إلى كائن Ethereum SmartContractCall | +| 0.0.3 | تمت إضافةحقل `from` إلى كائن Ethereum Call
`etherem.call.address` تمت إعادة تسميته إلى `ethereum.call.to` | +| 0.0.2 | تمت إضافة حقل `input` إلى كائن إجراء Ethereum | ### الأنواع المضمنة Built-in @@ -76,7 +76,7 @@ _تحويل الأنواع_ - `toString (): string` - تترجم البايت كسلسلة UTF-8. - `toBase58 (): string` - ترميز البايت لسلسلة base58. - `toU32 (): u32` - يترجم البايت كـ `u32` little-endian. Throws in case of overflow. -- `toI32(): i32` - يترجم مصفوفة البايت كـ little-endian ` i32 `. يرمي في حالة تجاوز. +- `toI32(): i32` - يترجم مصفوفة البايت كـ little-endian `i32`. يرمي في حالة تجاوز. _العوامل_ diff --git a/pages/ar/developer/assemblyscript-migration-guide.mdx b/pages/ar/developer/assemblyscript-migration-guide.mdx index 7de692369954..983d34ce1727 100644 --- a/pages/ar/developer/assemblyscript-migration-guide.mdx +++ b/pages/ar/developer/assemblyscript-migration-guide.mdx @@ -14,7 +14,7 @@ title: دليل ترحيل AssemblyScript ### وظائف جديدة -- يمكن الآن إنشاء `TypedArray` من ` ArrayBuffer ` باستخدام [new `wrap` static method](https://www.assemblyscript.org/stdlib/typedarray.html#static-members) ([v0.8.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.8.1)) جديد +- يمكن الآن إنشاء `TypedArray` من `ArrayBuffer` باستخدام [new `wrap` static method](https://www.assemblyscript.org/stdlib/typedarray.html#static-members) ([v0.8.1](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.8.1)) جديد - وظائف المكتبة القياسية الجديدة`String#toUpperCase`, `String#toLowerCase`, `String#localeCompare`and `TypedArray#set` ([v0.9.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.0)) - تمت إضافة دعم لـ x instanceof GenericClass ([v0.9.2](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.2)) - تمت إضافة `StaticArray` متغير مصفوفة أكثر كفاءة([v0.9.3](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.9.3)) @@ -127,8 +127,11 @@ let a = a + b ~~~~~~~~~~~~~ in assembly/index.ts(4,3) ``` + ستحتاج إلى إعادة تسمية المتغيرات المكررة إذا كان لديك variable shadowing. + ### مقارنات ملغية(Null Comparisons) + من خلال إجراء الترقية على ال Subgraph الخاص بك ، قد تحصل أحيانًا على أخطاء مثل هذه: ```typescript @@ -137,6 +140,7 @@ ERROR TS2322: Type '~lib/@graphprotocol/graph-ts/common/numbers/BigInt | null' i ~~~~ in src/mappings/file.ts(41,21) ``` + لحل المشكلة يمكنك ببساطة تغيير عبارة `if` إلى شيء مثل هذا: ```typescript @@ -281,6 +285,7 @@ ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/s let somethingOrElse: string = container.data ؟ container.data : "else"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` + لإصلاح هذه المشكلة ، يمكنك إنشاء متغير للوصول إلى هذه الخاصية حتى يتمكن المترجم من القيام بعملية التحقق من الـ nullability: ```typescript diff --git a/pages/ar/developer/create-subgraph-hosted.mdx b/pages/ar/developer/create-subgraph-hosted.mdx index d9eb33524e35..b38f5c655207 100644 --- a/pages/ar/developer/create-subgraph-hosted.mdx +++ b/pages/ar/developer/create-subgraph-hosted.mdx @@ -218,15 +218,15 @@ Null value resolved for non-null field 'name' ندعم المقاييس التالية في GraphQL API الخاصة بنا: -| النوع | الوصف | -| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Bytes` | مصفوفة Byte ، ممثلة كسلسلة سداسية عشرية. يشيع استخدامها في Ethereum hashes وعناوينه. | -| `ID` | يتم تخزينه كـ `string`. | -| `String` | لقيم `string`. لا يتم دعم اNull ويتم إزالتها تلقائيا. | -| `Boolean` | لقيم `boolean`. | -| `Int` | GraphQL spec تعرف `Int` بحجم 32 بايت. | -| `BigInt` | أعداد صحيحة كبيرة. يستخدم لأنواع Ethereum `uint32` ، `int64` ، `uint64` ، ... ، `uint256`. ملاحظة: كل شيء تحت `uint32` ، مثل `int32` أو `uint24` أو `int8` يتم تمثيله كـ `i32`. | -| `BigDecimal` | `BigDecimal` High precision decimals represented as a signficand and an exponent. يتراوح نطاق الأس من −6143 إلى +6144. مقربة إلى 34 رقما. | +| النوع | الوصف | +| --- | --- | +| `Bytes` | مصفوفة Byte ، ممثلة كسلسلة سداسية عشرية. يشيع استخدامها في Ethereum hashes وعناوينه. | +| `ID` | يتم تخزينه كـ `string`. | +| `String` | لقيم `string`. لا يتم دعم اNull ويتم إزالتها تلقائيا. | +| `Boolean` | لقيم `boolean`. | +| `Int` | GraphQL spec تعرف `Int` بحجم 32 بايت. | +| `BigInt` | أعداد صحيحة كبيرة. يستخدم لأنواع Ethereum `uint32` ، `int64` ، `uint64` ، ... ، `uint256`. ملاحظة: كل شيء تحت `uint32` ، مثل `int32` أو `uint24` أو `int8` يتم تمثيله كـ `i32`. | +| `BigDecimal` | `BigDecimal` High precision decimals represented as a signficand and an exponent. يتراوح نطاق الأس من −6143 إلى +6144. مقربة إلى 34 رقما. | #### Enums @@ -627,7 +627,7 @@ export function handleNewExchange(event: NewExchange): void { ``` > ** ملاحظة: ** مصدر البيانات الجديد سيعالج فقط الاستدعاءات والأحداث للكتلة التي تم إنشاؤها فيه وجميع الكتل التالية ، ولكنه لن يعالج البيانات التاريخية ، أي البيانات الموجودة في الكتل السابقة. -> +> > إذا كانت الكتل السابقة تحتوي على بيانات ذات صلة بمصدر البيانات الجديد ، فمن الأفضل فهرسة تلك البيانات من خلال قراءة الحالة الحالية للعقد وإنشاء كيانات تمثل تلك الحالة في وقت إنشاء مصدر البيانات الجديد. ### سياق مصدر البيانات @@ -684,7 +684,7 @@ dataSources: ``` > ** ملاحظة: ** يمكن البحث عن كتلة إنشاء العقد بسرعة على Etherscan: -> +> > 1. ابحث عن العقد بإدخال عنوانه في شريط البحث. > 2. انقر فوق hash إجراء الإنشاء في قسم `Contract Creator`. > 3. قم بتحميل صفحة تفاصيل الإجراء حيث ستجد كتلة البدء لذلك العقد. diff --git a/pages/ar/developer/developer-faq.mdx b/pages/ar/developer/developer-faq.mdx index 506a04f298b3..08bd1648b937 100644 --- a/pages/ar/developer/developer-faq.mdx +++ b/pages/ar/developer/developer-faq.mdx @@ -153,7 +153,7 @@ someCollection(first: 1000, skip: ) { ... } ### 23. إذا كانت الواجهة الأمامية ل dapp الخاصة بي تستخدم TheGraph للاستعلام ، فهل أحتاج إلى كتابة مفتاح الاستعلام الخاص بي في الواجهة الأمامية مباشرةً؟ وماذا لو دفعنا رسوم الاستعلام للمستخدمين - هل سيتسبب المستخدمون الخبثاء في أن تكون رسوم الاستعلام عالية جدًا؟ -في الوقت الحالي ، تتمثل الطريقة الموصى بها لتطبيق dapp في إضافة المفتاح إلى الواجهة الأمامية وكشفه للمستخدمين. ومع ذلك ، يمكنك تقييد هذا المفتاح باسم مضيف ، مثل_yourdapp.io_ و Subgraph. يتم تشغيل gateway حاليا بواسطة Edge&؛ Node. جزء من مسؤولية gateway هي مراقبة السلوك المسيء وحظر حركة البيانات من العملاء الضارين. +في الوقت الحالي ، تتمثل الطريقة الموصى بها لتطبيق dapp في إضافة المفتاح إلى الواجهة الأمامية وكشفه للمستخدمين. ومع ذلك ، يمكنك تقييد هذا المفتاح باسم مضيف ، مثل*yourdapp.io* و Subgraph. يتم تشغيل gateway حاليا بواسطة Edge&؛ Node. جزء من مسؤولية gateway هي مراقبة السلوك المسيء وحظر حركة البيانات من العملاء الضارين. ### 24. كيف يمكنني للعثور على ال Subgraph الحالي الخاص بي في Hosted Service؟ diff --git a/pages/ar/developer/graphql-api.mdx b/pages/ar/developer/graphql-api.mdx index d6771fd72547..8f6f13b86861 100644 --- a/pages/ar/developer/graphql-api.mdx +++ b/pages/ar/developer/graphql-api.mdx @@ -204,12 +204,12 @@ _not_ends_with عوامل تشغيل البحث عن النص الكامل: -| رمز | عامل التشغيل | الوصف | -| ----------- | ------------ | --------------------------------------------------------------------------------------------------------------------------- | -| `&` | `And` | لدمج عبارات بحث متعددة في فلتر للكيانات التي تتضمن جميع العبارات المتوفرة | -| | | `Or` | الاستعلامات التي تحتوي على عبارات بحث متعددة مفصولة بواسطة عامل التشغيل or ستعيد جميع الكيانات المتطابقة من أي عبارة متوفرة | -| `<->` | `Follow by` | يحدد المسافة بين كلمتين. | -| `:*` | `Prefix` | يستخدم عبارة البحث prefix للعثور على الكلمات التي تتطابق بادئتها (مطلوب حرفان.) | +| رمز | عامل التشغيل | الوصف | +| --- | --- | --- | +| `&` | `And` | لدمج عبارات بحث متعددة في فلتر للكيانات التي تتضمن جميع العبارات المتوفرة | +| | | `Or` | الاستعلامات التي تحتوي على عبارات بحث متعددة مفصولة بواسطة عامل التشغيل or ستعيد جميع الكيانات المتطابقة من أي عبارة متوفرة | +| `<->` | `Follow by` | يحدد المسافة بين كلمتين. | +| `:*` | `Prefix` | يستخدم عبارة البحث prefix للعثور على الكلمات التي تتطابق بادئتها (مطلوب حرفان.) | #### أمثلة diff --git a/pages/ar/developer/matchstick.mdx b/pages/ar/developer/matchstick.mdx index dcdf7390b31d..d9e387a31b2a 100644 --- a/pages/ar/developer/matchstick.mdx +++ b/pages/ar/developer/matchstick.mdx @@ -61,7 +61,7 @@ export function createNewGravatarEvent( } ``` -علينا أولا إنشاء ملف اختبار في مشروعنا. لقد اخترنا الاسم ` gravity.test.ts `. في الملف الذي تم إنشاؤه حديثا ، نحتاج إلى تعريف دالة باسم ` ()runTests `. من المهم أن يكون للدالة هذا الاسم بالضبط. هذا مثال على الشكل الذي قد يبدو عليه اختبارنا: +علينا أولا إنشاء ملف اختبار في مشروعنا. لقد اخترنا الاسم `gravity.test.ts`. في الملف الذي تم إنشاؤه حديثا ، نحتاج إلى تعريف دالة باسم `()runTests`. من المهم أن يكون للدالة هذا الاسم بالضبط. هذا مثال على الشكل الذي قد يبدو عليه اختبارنا: ```typescript import { clearStore, test, assert } from 'matchstick-as/assembly/index' @@ -95,17 +95,17 @@ export function runTests(): void { } ``` -هذا كثير لفك الحزمة! أولاً ، من المهم ملاحظة أننا نستورد أشياء من ` matchstick-as ` ، ومكتبتنا المساعدة AssemblyScript (موزعة كوحدة npm). يمكنك العثور على repository [ هنا ](https://github.com/LimeChain/matchstick-as). ` matchstick-as ` يوفر لنا methods اختبار مفيدة ويعرف أيضا دالة` ()test ` التي سنستخدمها لبناء كتل الاختبار الخاصة بنا. الباقي واضح ومباشر - إليك ما يحدث: +هذا كثير لفك الحزمة! أولاً ، من المهم ملاحظة أننا نستورد أشياء من `matchstick-as` ، ومكتبتنا المساعدة AssemblyScript (موزعة كوحدة npm). يمكنك العثور على repository [ هنا ](https://github.com/LimeChain/matchstick-as). `matchstick-as` يوفر لنا methods اختبار مفيدة ويعرف أيضا دالة`()test` التي سنستخدمها لبناء كتل الاختبار الخاصة بنا. الباقي واضح ومباشر - إليك ما يحدث: - نقوم بإعداد حالتنا الأولية وإضافة كيان Gravatar مخصص ؛; -- نعرف كائني حدث ` NewGravatar ` بالإضافة لبياناتهم ، باستخدام دالة `() createNewGravatarEvent`; -- نحن نستدعي methods المعالج لتلك الأحداث - ` () handleNewGravatars ` ونمرر فيه قائمة أحداثنا المخصصة ؛; +- نعرف كائني حدث `NewGravatar` بالإضافة لبياناتهم ، باستخدام دالة `() createNewGravatarEvent`; +- نحن نستدعي methods المعالج لتلك الأحداث - `() handleNewGravatars` ونمرر فيه قائمة أحداثنا المخصصة ؛; - نؤكد حالة المخزن. كيف يعمل هذا؟ - نمرر مجموعة فريدة من نوع Entity و id. ثم نتحقق من حقل معين في ذلك الـ Entity ونؤكد أنه يحتوي على القيمة التي نتوقعها. نحن نقوم بذلك لكلا الـ Gravatar Entity الأولية الذي أضفناه إلى المخزن، بالإضافة إلى كيانين Gravatar اللذان تمت إضافتهما عند استدعاء دالة المعالج; -- وأخيرا - نقوم بتنظيف المخزن باستخدام ` () clearStore ` بحيث يمكن أن يبدأ اختبارنا التالي بكائن مخزن جديد وفارغ. يمكننا تعريف العديد من كتل الاختبار كما نريد. +- وأخيرا - نقوم بتنظيف المخزن باستخدام `() clearStore` بحيث يمكن أن يبدأ اختبارنا التالي بكائن مخزن جديد وفارغ. يمكننا تعريف العديد من كتل الاختبار كما نريد. ها نحن أنشأنا اختبارنا الأول! 👏 -❗ **هام:** _ لكي تعمل الاختبارات ، نحتاج إلى تصدير دالة ` runTests () ` تعمل في ملف الـ mappings الخاص بنا. لن يتم استخدامه هناك ، ولكن يجب أن تكون عبارات التصدير موجودة حتى يتمكن Rust من التقاطه لاحقا عند تشغيل الاختبارات. _ +❗ **هام:** _ لكي تعمل الاختبارات ، نحتاج إلى تصدير دالة `runTests ()` تعمل في ملف الـ mappings الخاص بنا. لن يتم استخدامه هناك ، ولكن يجب أن تكون عبارات التصدير موجودة حتى يتمكن Rust من التقاطه لاحقا عند تشغيل الاختبارات. _ يمكنك تصدير دالة غلاف الاختبارات في ملف الـ mappings كما يلي: diff --git a/pages/ar/explorer.mdx b/pages/ar/explorer.mdx index 652e914fe353..26b05bf307a6 100644 --- a/pages/ar/explorer.mdx +++ b/pages/ar/explorer.mdx @@ -11,7 +11,7 @@ title: مستكشف title="مشغل فيديو يوتيوب" frameBorder="0" allowFullScreen -> + > ## Subgraphs diff --git a/pages/ar/hosted-service/migrating-subgraph.mdx b/pages/ar/hosted-service/migrating-subgraph.mdx index 9f314e8e9034..2270b723d526 100644 --- a/pages/ar/hosted-service/migrating-subgraph.mdx +++ b/pages/ar/hosted-service/migrating-subgraph.mdx @@ -142,7 +142,7 @@ If you're still confused, fear not! Check out the following resources or watch o title="مشغل فيديو يوتيوب" frameBorder="0" allowFullScreen -> + > - [The Graph Network Contracts](https://github.com/graphprotocol/contracts) diff --git a/pages/ar/studio/billing.mdx b/pages/ar/studio/billing.mdx index 67a5a8c1420e..47506457af79 100644 --- a/pages/ar/studio/billing.mdx +++ b/pages/ar/studio/billing.mdx @@ -46,7 +46,7 @@ For a quick demo of how billing works on the Subgraph Studio, check out the vide title="مشغل فيديو يوتيوب" frameBorder="0" allowFullScreen -> + > ### Multisig Users diff --git a/pages/ar/studio/subgraph-studio.mdx b/pages/ar/studio/subgraph-studio.mdx index d4e82eeef02e..998828234022 100644 --- a/pages/ar/studio/subgraph-studio.mdx +++ b/pages/ar/studio/subgraph-studio.mdx @@ -73,7 +73,7 @@ You’ve made it this far - congrats! Publishing your subgraph means that an IPF title="مشغل فيديو يوتيوب" frameBorder="0" allowFullScreen -> + > Remember, while you’re going through your publishing flow, you’ll be able to push to either mainnet or Rinkeby, the testnet we support. If you’re a first time subgraph developer, we highly suggest you start with publishing to Rinkeby, which is free to do. This will allow you to see how the subgraph will work in The Graph Explorer and will allow you to test curation elements. diff --git a/pages/en/indexing.mdx b/pages/en/indexing.mdx index 241f371686a7..2635e94330ca 100644 --- a/pages/en/indexing.mdx +++ b/pages/en/indexing.mdx @@ -139,7 +139,7 @@ At the center of an indexer's infrastructure is the Graph Node which monitors Et - **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. -- **Indexer agent** - Facilitates the indexers interactions on chain including registering on the network, managing subgraph deployments to its Graph Node/s, and managing allocations. +- **Indexer agent** - Facilitates the indexers interactions on chain including registering on the network, managing subgraph deployments to its Graph Node/s, and managing allocations. - **Prometheus metrics server** - The Graph Node and Indexer components log their metrics to the metrics server. diff --git a/pages/es/curating.mdx b/pages/es/curating.mdx index 425cb5608b6f..a3d986829e1d 100644 --- a/pages/es/curating.mdx +++ b/pages/es/curating.mdx @@ -100,5 +100,5 @@ Las participaciones de un curador no se pueden "comprar" o "vender" como otros t title="Reproductor de video de YouTube" frameBorder="0" allowFullScreen -> + > diff --git a/pages/es/delegating.mdx b/pages/es/delegating.mdx index 30e6905758a4..c0d69eb0b72d 100644 --- a/pages/es/delegating.mdx +++ b/pages/es/delegating.mdx @@ -90,5 +90,5 @@ Utilizando está formula, podemos discernir qué un Indexer el cual está ofreci title="Reproductor de video de YouTube" frameBorder="0" allowFullScreen -> + > diff --git a/pages/es/developer/assemblyscript-api.mdx b/pages/es/developer/assemblyscript-api.mdx index 889990ea5f63..98e4e1fbdb06 100644 --- a/pages/es/developer/assemblyscript-api.mdx +++ b/pages/es/developer/assemblyscript-api.mdx @@ -43,13 +43,13 @@ La librería de `@graphprotocol/graph-ts` proporciona las siguientes APIs: La `apiVersion` en el manifiesto del subgrafo especifica la versión de la API correspondiente al mapeo que está siendo ejecutado en el Graph Node de un subgrafo en específico. La versión actual para la APÍ de mapeo es la 0.0.6. -| Version | Notas del lanzamiento | -|:-------:| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 0.0.6 | Se agregó la casilla `nonce` a las Transacciones de Ethereum, se
añadió `baseFeePerGas` para los bloques de Ethereum | -| 0.0.5 | Se actualizó la versión del AssemblyScript a la v0.19.10 (esta incluye cambios importantes, recomendamos leer la [`guía de migración`](/developer/assemblyscript-migration-guide))
`ethereum.transaction.gasUsed` actualizada a `ethereum.transaction.gasLimit` | -| 0.0.4 | Añadido la casilla de `functionSignature` para la función de Ethereum SmartContractCall | -| 0.0.3 | Añadida la casilla `from` para la función de Ethereum Call
`ethereum.call.address` actualizada a `ethereum.call.to` | -| 0.0.2 | Añadida la casilla de `input` para la función de Ethereum Transaction | +| Version | Notas del lanzamiento | +| :-: | --- | +| 0.0.6 | Se agregó la casilla `nonce` a las Transacciones de Ethereum, se
añadió `baseFeePerGas` para los bloques de Ethereum | +| 0.0.5 | Se actualizó la versión del AssemblyScript a la v0.19.10 (esta incluye cambios importantes, recomendamos leer la [`guía de migración`](/developer/assemblyscript-migration-guide))
`ethereum.transaction.gasUsed` actualizada a `ethereum.transaction.gasLimit` | +| 0.0.4 | Añadido la casilla de `functionSignature` para la función de Ethereum SmartContractCall | +| 0.0.3 | Añadida la casilla `from` para la función de Ethereum Call
`ethereum.call.address` actualizada a `ethereum.call.to` | +| 0.0.2 | Añadida la casilla de `input` para la función de Ethereum Transaction | ### Built-in Types diff --git a/pages/es/developer/assemblyscript-migration-guide.mdx b/pages/es/developer/assemblyscript-migration-guide.mdx index acdc2366df9b..c0cc93026028 100644 --- a/pages/es/developer/assemblyscript-migration-guide.mdx +++ b/pages/es/developer/assemblyscript-migration-guide.mdx @@ -127,8 +127,11 @@ ERROR TS2451: Cannot redeclare block-scoped variable 'a' ~~~~~~~~~~~~~ in assembly/index.ts(4,3) ``` + Tendrás que cambiar el nombre de las variables duplicadas si tienes una variable shadowing. + ### Comparaciones Nulas + Al hacer la actualización en ut subgrafo, a veces pueden aparecer errores como estos: ```typescript @@ -137,6 +140,7 @@ ERROR TS2322: Type '~lib/@graphprotocol/graph-ts/common/numbers/BigInt | null' i ~~~~ in src/mappings/file.ts(41,21) ``` + Para solucionarlo puedes simplemente cambiar la declaracion `if` por algo así: ```typescript @@ -281,6 +285,7 @@ ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/s let somethingOrElse: string = container.data ? container.data : "else"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` + Para solucionar este problema, puedes crear una variable para ese acceso a la propiedad de manera que el compilador pueda hacer la magia de la comprobación de nulidad: ```typescript diff --git a/pages/es/developer/create-subgraph-hosted.mdx b/pages/es/developer/create-subgraph-hosted.mdx index b6ab72e3db96..bb9dc04a9df1 100644 --- a/pages/es/developer/create-subgraph-hosted.mdx +++ b/pages/es/developer/create-subgraph-hosted.mdx @@ -218,15 +218,15 @@ Cada entidad debe tener un campo `id`, que es de tipo `ID!` (string). El campo ` Admitimos los siguientes scalars en nuestra API GraphQL: -| Tipo | Descripción | -| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Bytes` | Byte array, representado como un string hexadecimal. Comúnmente utilizado para los hashes y addresses de Ethereum. | -| `ID` | Almacenado como un `string`. | -| `String` | Scalar para valores `string`. Los caracteres null no se admiten y se eliminan automáticamente. | -| `Boolean` | Scalar para valores `boolean`. | -| `Int` | The GraphQL spec define `Int` para tener un tamano de 32 bytes. | -| `BigInt` | Números enteros grandes. Usados para los tipos `uint32`, `int64`, `uint64`, ..., `uint256` de Ethereum. Nota: Todo debajo de `uint32`, como `int32`, `uint24` o `int8` es representado como `i32`. | -| `BigDecimal` | `BigDecimal` Decimales de alta precisión representados como un signo y un exponente. El rango de exponentes va de -6143 a +6144. Redondeado a 34 dígitos significativos. | +| Tipo | Descripción | +| --- | --- | +| `Bytes` | Byte array, representado como un string hexadecimal. Comúnmente utilizado para los hashes y addresses de Ethereum. | +| `ID` | Almacenado como un `string`. | +| `String` | Scalar para valores `string`. Los caracteres null no se admiten y se eliminan automáticamente. | +| `Boolean` | Scalar para valores `boolean`. | +| `Int` | The GraphQL spec define `Int` para tener un tamano de 32 bytes. | +| `BigInt` | Números enteros grandes. Usados para los tipos `uint32`, `int64`, `uint64`, ..., `uint256` de Ethereum. Nota: Todo debajo de `uint32`, como `int32`, `uint24` o `int8` es representado como `i32`. | +| `BigDecimal` | `BigDecimal` Decimales de alta precisión representados como un signo y un exponente. El rango de exponentes va de -6143 a +6144. Redondeado a 34 dígitos significativos. | #### Enums @@ -451,10 +451,10 @@ Diccionarios de idiomas admitidos: Algoritmos admitidos para ordenar los resultados: -| Algoritmos | Descripción | -| ------------------- | -------------------------------------------------------------------------------------------------- | -| rango | Usa la calidad de coincidencia (0-1) de la consulta de texto completo para ordenar los resultados. | -| rango de Proximidad | Similar al rango, pero también incluye la proximidad de los matches. | +| Algoritmos | Descripción | +| --- | --- | +| rango | Usa la calidad de coincidencia (0-1) de la consulta de texto completo para ordenar los resultados. | +| rango de Proximidad | Similar al rango, pero también incluye la proximidad de los matches. | ## Escribir Mapeos @@ -627,7 +627,7 @@ export function handleNewExchange(event: NewExchange): void { ``` > **Nota:** Un nuevo origen de datos sólo procesará las llamadas y los eventos del bloque en el que fue creado y todos los bloques siguientes, pero no procesará los datos históricos, es decir, los datos que están contenidos en bloques anteriores. -> +> > Si los bloques anteriores contienen datos relevantes para la nueva fuente de datos, lo mejor es indexar esos datos leyendo el estado actual del contrato y creando entidades que representen ese estado en el momento de crear la nueva fuente de datos. ### Contexto de la Fuente de Datos @@ -684,7 +684,7 @@ dataSources: ``` > **Nota:** El bloque de creación del contrato se puede buscar rápidamente en Etherscan: -> +> > 1. Busca el contrato introduciendo su dirección en la barra de búsqueda. > 2. Haz clic en el hash de la transacción de creación en la sección `Contract Creator`. > 3. Carga la página de detalles de la transacción, donde encontrarás el bloque inicial de ese contrato. diff --git a/pages/es/developer/graphql-api.mdx b/pages/es/developer/graphql-api.mdx index 4513e9f5c724..0c085f01e628 100644 --- a/pages/es/developer/graphql-api.mdx +++ b/pages/es/developer/graphql-api.mdx @@ -204,12 +204,12 @@ Las consultas de búsqueda de texto completo tienen un campo obligatorio, `text` Operadores de búsqueda de texto completo: -| Símbolo | Operador | Descripción | -| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `&` | `And` | Para combinar varios términos de búsqueda en un filtro para entidades que incluyen todos los términos proporcionados | -| | | `Or` | Las consultas con varios términos de búsqueda separados por o el operador devolverá todas las entidades que coincidan con cualquiera de los términos proporcionados | -| `<->` | `Follow by` | Especifica la distancia entre dos palabras. | -| `:*` | `Prefix` | Utilice el término de búsqueda del prefijo para encontrar palabras cuyo prefijo coincida (se requieren 2 caracteres.) | +| Símbolo | Operador | Descripción | +| --- | --- | --- | +| `&` | `And` | Para combinar varios términos de búsqueda en un filtro para entidades que incluyen todos los términos proporcionados | +| | | `Or` | Las consultas con varios términos de búsqueda separados por o el operador devolverá todas las entidades que coincidan con cualquiera de los términos proporcionados | +| `<->` | `Follow by` | Especifica la distancia entre dos palabras. | +| `:*` | `Prefix` | Utilice el término de búsqueda del prefijo para encontrar palabras cuyo prefijo coincida (se requieren 2 caracteres.) | #### Ejemplos diff --git a/pages/es/explorer.mdx b/pages/es/explorer.mdx index 6ede1f9592e3..676a3ad54e39 100644 --- a/pages/es/explorer.mdx +++ b/pages/es/explorer.mdx @@ -11,7 +11,7 @@ Bienvenido al explorador de The Graph, o como nos gusta llamarlo, tu portal desc title="Reproductor de video de YouTube" frameBorder="0" allowFullScreen -> + > ## Subgrafos diff --git a/pages/es/hosted-service/migrating-subgraph.mdx b/pages/es/hosted-service/migrating-subgraph.mdx index eda54d1931ed..d515d7b7a5b5 100644 --- a/pages/es/hosted-service/migrating-subgraph.mdx +++ b/pages/es/hosted-service/migrating-subgraph.mdx @@ -142,7 +142,7 @@ If you're still confused, fear not! Check out the following resources or watch o title="Reproductor de video de YouTube" frameBorder="0" allowFullScreen -> + > - [The Graph Network Contracts](https://github.com/graphprotocol/contracts) diff --git a/pages/es/indexing.mdx b/pages/es/indexing.mdx index 9ac00c23c57e..723557954463 100644 --- a/pages/es/indexing.mdx +++ b/pages/es/indexing.mdx @@ -115,11 +115,11 @@ Los indexadores pueden diferenciarse aplicando técnicas avanzadas para tomar de - **Grande**: Preparado para indexar todos los subgrafos utilizados actualmente y atender solicitudes para el tráfico relacionado. | Configuración | Postgres
(CPUs) | Postgres
(memory in GBs) | Postgres
(disk in TBs) | VMs
(CPUs) | VMs
(memory in GBs) | -| ------------- |:--------------------------:|:-----------------------------------:|:---------------------------------:|:---------------------:|:------------------------------:| -| Pequeño | 4 | 8 | 1 | 4 | 16 | -| Estándar | 8 | 30 | 1 | 12 | 48 | -| Medio | 16 | 64 | 2 | 32 | 64 | -| Grande | 72 | 468 | 3,5 | 48 | 184 | +| --- | :-: | :-: | :-: | :-: | :-: | +| Pequeño | 4 | 8 | 1 | 4 | 16 | +| Estándar | 8 | 30 | 1 | 12 | 48 | +| Medio | 16 | 64 | 2 | 32 | 64 | +| Grande | 72 | 468 | 3,5 | 48 | 184 | ### ¿Cuáles son algunas de las precauciones de seguridad básicas que debe tomar un indexador? @@ -151,24 +151,24 @@ Nota: Para admitir el escalado ágil, se recomienda que las inquietudes de consu #### Graph Node -| Puerto | Objeto | Rutas | Argumento CLI | Variable de Entorno | -| ------ | ---------------------------------------------------------------- | ---------------------------------------------------- | ----------------- | ------------------- | -| 8000 | Servidor HTTP GraphQL
(para consultas de subgrafos) | /subgraphs/id/...
/subgraphs/name/.../... | --http-port | - | -| 8001 | GraphQL WS
(para suscripciones a subgrafos) | /subgraphs/id/...
/subgraphs/name/.../... | --ws-port | - | -| 8020 | JSON-RPC
(para administrar implementaciones) | / | --admin-port | - | -| 8030 | API de estado de indexación de subgrafos | /graphql | --index-node-port | - | -| 8040 | Métricas de Prometheus | /metrics | --metrics-port | - | +| Puerto | Objeto | Rutas | Argumento CLI | Variable de Entorno | +| --- | --- | --- | --- | --- | +| 8000 | Servidor HTTP GraphQL
(para consultas de subgrafos) | /subgraphs/id/...
/subgraphs/name/.../... | --http-port | - | +| 8001 | GraphQL WS
(para suscripciones a subgrafos) | /subgraphs/id/...
/subgraphs/name/.../... | --ws-port | - | +| 8020 | JSON-RPC
(para administrar implementaciones) | / | --admin-port | - | +| 8030 | API de estado de indexación de subgrafos | /graphql | --index-node-port | - | +| 8040 | Métricas de Prometheus | /metrics | --metrics-port | - | #### Servicio de Indexador -| Puerto | Objeto | Rutas | Argumento CLI | Variable de Entorno | -| ------ | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -------------- | ---------------------- | -| 7600 | Servidor HTTP GraphQL
(para consultas de subgrafo pagadas) | /subgraphs/id/...
/status
/channel-messages-inbox | --port | `INDEXER_SERVICE_PORT` | -| 7300 | Métricas de Prometheus | /metrics | --metrics-port | - | +| Puerto | Objeto | Rutas | Argumento CLI | Variable de Entorno | +| --- | --- | --- | --- | --- | +| 7600 | Servidor HTTP GraphQL
(para consultas de subgrafo pagadas) | /subgraphs/id/...
/status
/channel-messages-inbox | --port | `INDEXER_SERVICE_PORT` | +| 7300 | Métricas de Prometheus | /metrics | --metrics-port | - | #### Agente Indexador -| Puerto | Objeto | Rutas | Argumento CLI | Variable de
Entorno | +| Puerto | Objeto | Rutas | Argumento CLI | Variable de
Entorno | | ------ | ----------------------------- | ----- | ------------------------- | --------------------------------------- | | 8000 | API de gestión de indexadores | / | --indexer-management-port | `INDEXER_AGENT_INDEXER_MANAGEMENT_PORT` | diff --git a/pages/es/studio/billing.mdx b/pages/es/studio/billing.mdx index 9a9d4593cced..fec638ae5c9f 100644 --- a/pages/es/studio/billing.mdx +++ b/pages/es/studio/billing.mdx @@ -46,7 +46,7 @@ For a quick demo of how billing works on the Subgraph Studio, check out the vide title="Reproductor de video de YouTube" frameBorder="0" allowFullScreen -> + > ### Multisig Users diff --git a/pages/es/studio/subgraph-studio.mdx b/pages/es/studio/subgraph-studio.mdx index 28cfadea4edc..966b30ba2bac 100644 --- a/pages/es/studio/subgraph-studio.mdx +++ b/pages/es/studio/subgraph-studio.mdx @@ -73,7 +73,7 @@ You’ve made it this far - congrats! Publishing your subgraph means that an IPF title="Reproductor de video de YouTube" frameBorder="0" allowFullScreen -> + > Remember, while you’re going through your publishing flow, you’ll be able to push to either mainnet or Rinkeby, the testnet we support. If you’re a first time subgraph developer, we highly suggest you start with publishing to Rinkeby, which is free to do. This will allow you to see how the subgraph will work in The Graph Explorer and will allow you to test curation elements. diff --git a/pages/ja/about/network.mdx b/pages/ja/about/network.mdx index 83f01727e162..bae97ab84d06 100644 --- a/pages/ja/about/network.mdx +++ b/pages/ja/about/network.mdx @@ -2,14 +2,14 @@ title: ネットワークの概要 --- -グラフネットワークは、ブロックチェーンデータを整理するための分散型インデックスプロトコルです。 アプリケーションはGraphQLを使ってサブグラフと呼ばれるオープンなAPIにクエリし、ネットワーク上にインデックスされているデータを取得します。 The Graphを使うことで、開発者は公共のインフラ上で実行されるサーバーレスアプリケーションを構築することができます。 +グラフネットワークは、ブロックチェーンデータを整理するための分散型インデックスプロトコルです。 アプリケーションは GraphQL を使ってサブグラフと呼ばれるオープンな API にクエリし、ネットワーク上にインデックスされているデータを取得します。 The Graph を使うことで、開発者は公共のインフラ上で実行されるサーバーレスアプリケーションを構築することができます。 > GRT Token Address: [0xc944e90c64b2c07662a292be6244bdf05cda44a7](https://etherscan.io/token/0xc944e90c64b2c07662a292be6244bdf05cda44a7) ## 概要 -グラフネットワークは、インデクサー、キュレーター、デリゲーターにより構成され、ネットワークにサービスを提供し、Web3アプリケーションにデータを提供します。 消費者は、アプリケーションを利用し、データを消費します。 +グラフネットワークは、インデクサー、キュレーター、デリゲーターにより構成され、ネットワークにサービスを提供し、Web3 アプリケーションにデータを提供します。 消費者は、アプリケーションを利用し、データを消費します。 ![トークンエコノミクス](/img/Network-roles@2x.png) -グラフネットワークの経済的な安全性と、クエリデータの完全性を確保するために、参加者はグラフトークン(GRT)をステークします。 GRTは、Ethereumブロックチェーン上でERC-20となっているワークトークンで、ネットワーク内のリソースを割り当てるために使用されます。 アクティブなインデクサー、キュレーター、デリゲーターはサービスを提供し、その作業量とGRTのステークに比例して、ネットワークから収入を得ることができます。 +グラフネットワークの経済的な安全性と、クエリデータの完全性を確保するために、参加者はグラフトークン(GRT)をステークします。 GRT は、Ethereum ブロックチェーン上で ERC-20 となっているワークトークンで、ネットワーク内のリソースを割り当てるために使用されます。 アクティブなインデクサー、キュレーター、デリゲーターはサービスを提供し、その作業量と GRT のステークに比例して、ネットワークから収入を得ることができます。 diff --git a/pages/ja/curating.mdx b/pages/ja/curating.mdx index d4e44811fbcf..03a6c67b0b57 100644 --- a/pages/ja/curating.mdx +++ b/pages/ja/curating.mdx @@ -63,7 +63,7 @@ The Graph の場合は、 [Bancor が実装しているボンディングカー 2. キュレーション料 - キュレーターがサブグラフ上で GRT をシグナルすると、1%のキュレーション税が発生します。 この手数料はバーンされ、残りはボンディングカーブのリザーブサプライに預けられます。 3. キュレーターが GRT を引き出すためにシェアをバーンすると、残りのシェアの GRT 評価額が下がります。 場合によっては、キュレーターが自分のシェアを一度にバーンすることを決めることがあるので注意が必要です。 このような状況は、dapp 開発者がサブグラフのバージョン管理や改良、クエリをやめた場合や、サブグラフが故障した場合によく見られます。 その結果、残ったキュレーターは当初の GRT の何分の一かしか引き出せないかもしれません。 リスクプロファイルの低いネットワークロールについては、\[Delegators\](https://thegraph.com/docs/delegating)を参照してください。 4. サブグラフはバグで失敗することがあります。 失敗したサブグラフは、クエリフィーが発生しません。 結果的に、開発者がバグを修正して新しいバージョンを展開するまで待たなければならなくなります。 - - サブグラフの最新バージョンに加入している場合、シェアはその新バージョンに自動移行します。 これには0.5%のキュレーション税がかかります。 + - サブグラフの最新バージョンに加入している場合、シェアはその新バージョンに自動移行します。 これには 0.5%のキュレーション税がかかります。 - 特定のサブグラフのバージョンでシグナリングしていて、それが失敗した場合は、手動でキュレーションシャイアをバーンする必要があります。 キュレーション・カーブに最初に預けた金額よりも多く、または少なく GRT を受け取る可能性があることに注意してください。 これはキュレーターとしてのリスクです。 そして、新しいサブグラフのバージョンにシグナルを送ることができ、1%のキュレーション税が発生します。 ## キューレーション FAQ @@ -81,7 +81,7 @@ The Graph の場合は、 [Bancor が実装しているボンディングカー ### 3. サブグラフのアップグレードにかかるコストは? -キュレーション株式を新しいサブグラフのバージョンに移行すると、1%のキュレーション税が発生します。 キュレーターは、サブグラフの最新バージョンへの登録を選択することができます。 キュレーターのシェアが新しいバージョンに自動移行されると、キュレーターはキュレーション税の半分、つまり0.5%を支払うことになります。これは、サブグラフのアップグレードがガスを消費するオンチェーンアクションであるためです。 +キュレーション株式を新しいサブグラフのバージョンに移行すると、1%のキュレーション税が発生します。 キュレーターは、サブグラフの最新バージョンへの登録を選択することができます。 キュレーターのシェアが新しいバージョンに自動移行されると、キュレーターはキュレーション税の半分、つまり 0.5%を支払うことになります。これは、サブグラフのアップグレードがガスを消費するオンチェーンアクションであるためです。 ### 4. どのくらいの頻度でサブグラフをアップグレードできますか? @@ -100,5 +100,5 @@ The Graph の場合は、 [Bancor が実装しているボンディングカー title="YouTubeビデオプレーヤー" frameBorder="0" allowFullScreen -> + > diff --git a/pages/ja/delegating.mdx b/pages/ja/delegating.mdx index 06c1297a5a4a..2f4a4e101cb4 100644 --- a/pages/ja/delegating.mdx +++ b/pages/ja/delegating.mdx @@ -6,7 +6,7 @@ title: デリゲーティング ## デリゲーターガイド -このガイドでは、グラフネットワークで効果的なデリゲーターになるための方法を説明します。 デリゲーターは、デリゲートされたステークのすべてのインデクサーとともにプロトコルの収益を共有します。 デリゲーターは、複数の要素を考慮した上で、最善の判断でインデクサーを選ばなければなりません。 このガイドでは、メタマスクの適切な設定方法などについては説明しません。このガイドには3つのセクションがあります。 There are three sections in this guide: +このガイドでは、グラフネットワークで効果的なデリゲーターになるための方法を説明します。 デリゲーターは、デリゲートされたステークのすべてのインデクサーとともにプロトコルの収益を共有します。 デリゲーターは、複数の要素を考慮した上で、最善の判断でインデクサーを選ばなければなりません。 このガイドでは、メタマスクの適切な設定方法などについては説明しません。このガイドには 3 つのセクションがあります。 There are three sections in this guide: - グラフネットワークでトークンをデリゲートすることのリスク - デリゲーターとしての期待リターンの計算方法 @@ -39,8 +39,8 @@ title: デリゲーティング インデキシング報酬カット - インデキシング報酬カットは、インデクサーが自分のために保持する報酬の部分です。 つまり、これが 100%に設定されていると、デリゲーターであるあなたは 0 のインデキシング報酬を得ることになります。 UI に 80%と表示されている場合は、デリゲーターとして 20%を受け取ることになります。 重要な注意点として、ネットワークの初期段階では、インデキシング報酬が報酬の大半を占めます。
- トップのインデクサーは、デリゲーターに90%の報酬を与えています。 The - middle one is giving delegators 20%. The bottom one is giving delegators ~83%.* + トップのインデクサーは、デリゲーターに90%の報酬を与えています。 The middle one is giving delegators 20%. The bottom + one is giving delegators ~83%.*
- クエリーフィーカット - これはインデキシングリワードカットと全く同じ働きをします。 しかし、これは特に、インデクサーが収集したクエリフィーに対するリターンを対象としています。 ネットワークの初期段階では、クエリフィーからのリターンは、インデキシング報酬に比べて非常に小さいことに注意する必要があります。 ネットワーク内のクエリフィーがいつから大きくなり始めるのかを判断するために、ネットワークに注意を払うことをお勧めします。 @@ -68,7 +68,7 @@ title: デリゲーティング したがって、デリゲーターは計算して、デリゲーターに 20%を提供しているインデクサーの方が、より良いリターンを提供していると判断することができます。 -そのため、デリゲーターは、デリゲーターに20%を提供しているインデクサーの方が、より良いリターンを提供していると判断して計算することができます。 +そのため、デリゲーターは、デリゲーターに 20%を提供しているインデクサーの方が、より良いリターンを提供していると判断して計算することができます。 ### デリゲーション能力を考慮する @@ -89,5 +89,5 @@ title: デリゲーティング title="YouTubeビデオプレーヤー" frameBorder="0" allowFullScreen -> + > diff --git a/pages/ja/developer/assemblyscript-api.mdx b/pages/ja/developer/assemblyscript-api.mdx index 4826602d3457..0069310090ce 100644 --- a/pages/ja/developer/assemblyscript-api.mdx +++ b/pages/ja/developer/assemblyscript-api.mdx @@ -43,13 +43,13 @@ npm install -save-dev @graphprotocol/graph-ts # NPM サブグラフマニフェストの`apiVersion` は、指定されたサブグラフに対してグラフノードが実行するマッピング API のバージョンを指定します。 現在のマッピング API のバージョンは 0.0.6 です。 -| バージョン | リリースノート | -|:-----:| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 0.0.6 | Ethereum Transaction オブジェクトに`nonce`フィールドを追加 イーサリアムブロックオブジェクトに
Added `baseFeePerGas`を追加 | +| バージョン | リリースノート | +| :-: | --- | +| 0.0.6 | Ethereum Transaction オブジェクトに`nonce`フィールドを追加 イーサリアムブロックオブジェクトに
Added `baseFeePerGas`を追加 | | 0.0.5 | AssemblyScript がバージョン 0.19.10 にアップグレード(変更点がありますので[`Migration Guide`](/developer/assemblyscript-migration-guide))をご覧ください)。
`ethereum.transaction.gasUsed`の名前が`ethereum.transaction.gasLimit`に変更 | -| 0.0.4 | Ethereum SmartContractCall オブジェクトに`functionSignature`フィールドを追加 | -| 0.0.3 | Ethereum Call オブジェクトに`from`フィールドを追加
`etherem.call.address`の名前を `ethereum.call.to`に変更 | -| 0.0.2 | Ethereum Transaction オブジェクトに `input`フィールドを追加 | +| 0.0.4 | Ethereum SmartContractCall オブジェクトに`functionSignature`フィールドを追加 | +| 0.0.3 | Ethereum Call オブジェクトに`from`フィールドを追加
`etherem.call.address`の名前を `ethereum.call.to`に変更 | +| 0.0.2 | Ethereum Transaction オブジェクトに `input`フィールドを追加 | ### 組み込み型 diff --git a/pages/ja/developer/assemblyscript-migration-guide.mdx b/pages/ja/developer/assemblyscript-migration-guide.mdx index 951158bf610b..84e259cbb5d9 100644 --- a/pages/ja/developer/assemblyscript-migration-guide.mdx +++ b/pages/ja/developer/assemblyscript-migration-guide.mdx @@ -2,9 +2,9 @@ title: AssemblyScript マイグレーションガイド --- -これまでサブグラフは、[AssemblyScriptの最初のバージョン](https://github.com/AssemblyScript/assemblyscript/tree/v0.6) (v0.6)を使用していました。 ついに[最新のバージョン](https://github.com/AssemblyScript/assemblyscript/tree/v0.19.10)(v0.19.10) のサポートを追加しました! 🎉 +これまでサブグラフは、[AssemblyScript の最初のバージョン](https://github.com/AssemblyScript/assemblyscript/tree/v0.6) (v0.6)を使用していました。 ついに[最新のバージョン](https://github.com/AssemblyScript/assemblyscript/tree/v0.19.10)(v0.19.10) のサポートを追加しました! 🎉 -これにより、サブグラフの開発者は、AS言語と標準ライブラリの新しい機能を使用できるようになります。 +これにより、サブグラフの開発者は、AS 言語と標準ライブラリの新しい機能を使用できるようになります。 このガイドは、バージョン`0.22.0`以下の`graph-cli`/`graph-ts` をお使いの方に適用されます。 もしあなたがすでにそれ以上のバージョンにいるなら、あなたはすでに AssemblyScript のバージョン`0.19.10` を使っています。 @@ -79,7 +79,7 @@ npm install --save @graphprotocol/graph-ts@latest ### Nullability -古いバージョンのAssemblyScriptでは、以下のようなコードを作ることができました: +古いバージョンの AssemblyScript では、以下のようなコードを作ることができました: ```typescript function load(): Value | null { ... } @@ -88,7 +88,7 @@ let maybeValue = load(); maybeValue.aMethod(); ``` -しかし、新しいバージョンでは、値がnullableであるため、次のようにチェックする必要があります: +しかし、新しいバージョンでは、値が nullable であるため、次のようにチェックする必要があります: ```typescript let maybeValue = load() @@ -106,7 +106,7 @@ let maybeValue = load()! // breaks in runtime if value is null maybeValue.aMethod() ``` -どちらを選択すべきか迷った場合は、常に安全なバージョンを使用することをお勧めします。 値が存在しない場合は、サブグラフハンドラの中でreturnを伴う初期のif文を実行するとよいでしょう。 +どちらを選択すべきか迷った場合は、常に安全なバージョンを使用することをお勧めします。 値が存在しない場合は、サブグラフハンドラの中で return を伴う初期の if 文を実行するとよいでしょう。 ### 変数シャドウイング @@ -127,8 +127,11 @@ ERROR TS2451: Cannot redeclare block-scoped variable 'a' ~~~~~~~~~~~~~ in assembly/index.ts(4,3) ``` + 変数シャドウイングを行っていた場合は、重複する変数の名前を変更する必要があります。 -### Null比較 + +### Null 比較 + サブグラフのアップグレードを行うと、時々以下のようなエラーが発生することがあります。 ```typescript @@ -137,6 +140,7 @@ ERROR TS2322: Type '~lib/@graphprotocol/graph-ts/common/numbers/BigInt | null' i ~~~~ in src/mappings/file.ts(41,21) ``` + 解決するには、 `if` 文を以下のように変更するだけです。 ```typescript @@ -158,10 +162,10 @@ let byteArray = new ByteArray(10) let uint8Array = byteArray as Uint8Array // equivalent to: byteArray ``` -しかし、これは2つのシナリオでしか機能しません。 +しかし、これは 2 つのシナリオでしか機能しません。 - プリミティブなキャスト(between types such as `u8`, `i32`, `bool`; eg: `let b: isize = 10; b as usize`); -- クラス継承のアップキャスティング(サブクラス→スーパークラス) +- クラス継承のアップキャスティング(サブクラス → スーパークラス) 例 @@ -179,10 +183,10 @@ class Bytes extends Uint8Array {} let bytes = new Bytes(2) < Uint8Array > bytes // same as: bytes as Uint8Array ``` -キャストしたくても、`as`/`var`を使うと**安全ではない**というシナリオが2つあります。 +キャストしたくても、`as`/`var`を使うと**安全ではない**というシナリオが 2 つあります。 - クラス継承のダウンキャスト(スーパークラス → サブクラス) -- スーパークラスを共有する2つの型の間 +- スーパークラスを共有する 2 つの型の間 ```typescript // downcasting on class inheritance @@ -218,7 +222,7 @@ let bytes = new Bytes(2) changetype(bytes) // works :) ``` -単にnull性を除去したいだけなら、`as` オペレーター(or `variable`)を使い続けることができますが、値がnullではないことを確認しておかないと壊れてしまいます。 +単に null 性を除去したいだけなら、`as` オペレーター(or `variable`)を使い続けることができますが、値が null ではないことを確認しておかないと壊れてしまいます。 ```typescript // remove nullability @@ -231,7 +235,7 @@ if (previousBalance != null) { let newBalance = new AccountBalance(balanceId) ``` -Nullabilityについては、[nullability check feature](https://www.assemblyscript.org/basics.html#nullability-checks)を利用することをお勧めします。 +Nullability については、[nullability check feature](https://www.assemblyscript.org/basics.html#nullability-checks)を利用することをお勧めします。 また、キャストを容易にするために、いくつかの型にスタティックメソッドを追加しました。 @@ -240,7 +244,7 @@ Nullabilityについては、[nullability check feature](https://www.assemblyscr - BigInt.fromByteArray - ByteArray.fromBigInt -### プロパティアクセスによるNullabilityチェック +### プロパティアクセスによる Nullability チェック [nullability check feature](https://www.assemblyscript.org/basics.html#nullability-checks)を使用するには、次のように`if`文や三項演算子(`?` and `:`) を使用します。 @@ -260,7 +264,7 @@ if (something) { } ``` -しかし、これは、以下のように、プロパティのアクセスではなく、変数に対して`if`/ternaryを行っている場合にのみ機能します。 +しかし、これは、以下のように、プロパティのアクセスではなく、変数に対して`if`/ternary を行っている場合にのみ機能します。 ```typescript class Container { @@ -281,7 +285,8 @@ ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/s let somethingOrElse: string = container.data ? container.data : "else"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` -この問題を解決するには、そのプロパティアクセスのための変数を作成して、コンパイラがnullability checkのマジックを行うようにします。 + +この問題を解決するには、そのプロパティアクセスのための変数を作成して、コンパイラが nullability check のマジックを行うようにします。 ```typescript class Container { @@ -298,7 +303,7 @@ let somethingOrElse: string = data ? data : 'else' // compiles just fine :) ### プロパティアクセスによるオペレーターオーバーロード -アセンブリスクリプトのコンパイラは、値の片方がnullableであることを警告するコンパイル時のエラーを出さずに、ただ黙ってコンパイルするので、実行時にコードが壊れる可能性があります。 +アセンブリスクリプトのコンパイラは、値の片方が nullable であることを警告するコンパイル時のエラーを出さずに、ただ黙ってコンパイルするので、実行時にコードが壊れる可能性があります。 ```typescript class BigInt extends Uint8Array { @@ -322,7 +327,7 @@ let wrapper = new Wrapper(y) wrapper.n = wrapper.n + x // doesn't give compile time errors as it should ``` -この件に関して、アセンブリ・スクリプト・コンパイラーに問題を提起しましたが、 今のところ、もしサブグラフ・マッピングでこの種の操作を行う場合には、 その前にNULLチェックを行うように変更してください。 +この件に関して、アセンブリ・スクリプト・コンパイラーに問題を提起しましたが、 今のところ、もしサブグラフ・マッピングでこの種の操作を行う場合には、 その前に NULL チェックを行うように変更してください。 ```typescript let wrapper = new Wrapper(y) @@ -352,7 +357,7 @@ value.x = 10 value.y = 'content' ``` -また、以下のようにGraphQLのエンティティにNullableなプロパティがある場合も同様です。 +また、以下のように GraphQL のエンティティに Nullable なプロパティがある場合も同様です。 ```graphql type Total @entity { @@ -373,7 +378,7 @@ if (total === null) { total.amount = total.amount + BigInt.fromI32(1) ``` -`total.amount`の値を確実に初期化する必要があります。なぜなら、最後の行のsumのようにアクセスしようとすると、クラッシュしてしまうからです。 そのため、最初に初期化する必要があります。 +`total.amount`の値を確実に初期化する必要があります。なぜなら、最後の行の sum のようにアクセスしようとすると、クラッシュしてしまうからです。 そのため、最初に初期化する必要があります。 ```typescript let total = Total.load('latest') @@ -441,11 +446,11 @@ export class Something { } ``` -### GraphQLスキーマ +### GraphQL スキーマ -これはAssemblyScriptの直接的な変更ではありませんが、`schema.graphql`ファイルを更新する必要があるかもしれません。 +これは AssemblyScript の直接的な変更ではありませんが、`schema.graphql`ファイルを更新する必要があるかもしれません。 -タイプの中にNon-Nullable Listのフィールドを定義することができなくなりました。 次のようなスキーマを持っているとします。 +タイプの中に Non-Nullable List のフィールドを定義することができなくなりました。 次のようなスキーマを持っているとします。 ```graphql type Something @entity { @@ -458,7 +463,7 @@ type MyEntity @entity { } ``` -Listタイプのメンバーには、以下のように`!` を付ける必要があります。 +List タイプのメンバーには、以下のように`!` を付ける必要があります。 ```graphql type Something @entity { @@ -471,7 +476,7 @@ type MyEntity @entity { } ``` -これはAssemblyScriptのバージョンによるnullabilityの違いから変更されたもので、`src/generated/schema.ts`ファイル(デフォルトのパス、あなたはこれを変更したかもしれません)に関連しています。 +これは AssemblyScript のバージョンによる nullability の違いから変更されたもので、`src/generated/schema.ts`ファイル(デフォルトのパス、あなたはこれを変更したかもしれません)に関連しています。 ### その他 diff --git a/pages/ja/developer/create-subgraph-hosted.mdx b/pages/ja/developer/create-subgraph-hosted.mdx index 6b235e379634..3b05b2548456 100644 --- a/pages/ja/developer/create-subgraph-hosted.mdx +++ b/pages/ja/developer/create-subgraph-hosted.mdx @@ -218,15 +218,15 @@ Each entity must have an `id` field, which is of type `ID!` (string). The `id` f We support the following scalars in our GraphQL API: -| Type | Description | -| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `ID` | Stored as a `string`. | -| `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 have size of 32 bytes. | -| `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 signficand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| Type | Description | +| --- | --- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `ID` | Stored as a `string`. | +| `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 have size of 32 bytes. | +| `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 signficand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | #### Enums @@ -627,7 +627,7 @@ export function handleNewExchange(event: NewExchange): void { ``` > **Note:** A new data source will only process the calls and events for the block in which it was created and all following blocks, but will not process historical data, i.e., data that is contained in prior blocks. -> +> > If prior blocks contain data relevant to the new data source, it is best to index that data by reading the current state of the contract and creating entities representing that state at the time the new data source is created. ### Data Source Context @@ -684,7 +684,7 @@ dataSources: ``` > **Note:** The contract creation block can be quickly looked up on Etherscan: -> +> > 1. Search for the contract by entering its address in the search bar. > 2. Click on the creation transaction hash in the `Contract Creator` section. > 3. Load the transaction details page where you'll find the start block for that contract. diff --git a/pages/ja/developer/define-subgraph-hosted.mdx b/pages/ja/developer/define-subgraph-hosted.mdx index 7f996a3e46a6..0d4b6a144dc8 100644 --- a/pages/ja/developer/define-subgraph-hosted.mdx +++ b/pages/ja/developer/define-subgraph-hosted.mdx @@ -2,25 +2,25 @@ title: サブグラフの定義 --- -サブグラフとは、The GraphがEthereumからどのデータをインデックス化し、どのように保存するかを定義するものです。展開されると、ブロックチェーンデータのグローバルグラフの一部を形成することになります。 +サブグラフとは、The Graph が Ethereum からどのデータをインデックス化し、どのように保存するかを定義するものです。展開されると、ブロックチェーンデータのグローバルグラフの一部を形成することになります。 ![サブグラフの定義](/img/define-subgraph.png) サブグラフの定義は、いくつかのファイルで構成されています。 -- `subgraph.yaml`:サブグラフのマニフェストを含むYAMLファイル +- `subgraph.yaml`:サブグラフのマニフェストを含む YAML ファイル -- `schema.graphql`: サブグラフにどのようなデータが保存されているか、またGraphQLを使ってどのようにクエリを行うかを定義するGraphQLスキーマ +- `schema.graphql`: サブグラフにどのようなデータが保存されているか、また GraphQL を使ってどのようにクエリを行うかを定義する GraphQL スキーマ - `AssemblyScript Mappings`: イベントデータをスキーマで定義されたエンティティに変換する[AssemblyScript](https://github.com/AssemblyScript/assemblyscript)コード (例: このチュートリアルでは`mapping.ts`) マニフェスト・ファイルの内容を詳しく説明する前に、サブグラフを構築してデプロイするために必要な [Graph CLI](https://github.com/graphprotocol/graph-cli)をインストールする必要があります。 -## Graph CLIのインストール +## Graph CLI のインストール -Graph CLIはJavaScriptで書かれており、使用するには`yarn`または `npm`のいずれかをインストールする必要があります。 +Graph CLI は JavaScript で書かれており、使用するには`yarn`または `npm`のいずれかをインストールする必要があります。 -`yarn`をインストールしたら、次のコマンドを実行してGraph CLIをインストールする。 +`yarn`をインストールしたら、次のコマンドを実行して Graph CLI をインストールする。 **Install with yarn:** diff --git a/pages/ja/developer/deprecating-a-subgraph.mdx b/pages/ja/developer/deprecating-a-subgraph.mdx index b40a43969b8b..15dcac0ccb30 100644 --- a/pages/ja/developer/deprecating-a-subgraph.mdx +++ b/pages/ja/developer/deprecating-a-subgraph.mdx @@ -2,13 +2,13 @@ title: サブグラフの非推奨化 --- -The Graph Explorerのサブグラフを非推奨にしたい場合について。以下の手順に従ってください: +The Graph Explorer のサブグラフを非推奨にしたい場合について。以下の手順に従ってください: 1. コントラクトアドレスは[こちら](https://etherscan.io/address/0xadca0dd4729c8ba3acf3e99f3a9f471ef37b6825#writeProxyContract) 2. 自分のアドレスを第一パラメータとして'deprecateSubgraph'を呼び出します。 -3. subgraphNumber'フィールドに、公開する最初のサブグラフであれば0、2番目であれば1、3番目であれば2、などと入力します。 -4. 2と3の入力は `{graphAccount}-{subgraphNumber}`で構成される``にあります。例えば、[Sushi Subgraph's](https://thegraph.com/explorer/subgraph?id=0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0&version=0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0-0&view=Overview) のIDは`<0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0>`で、`graphAccount` = `<0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0>`と`subgraphNumber` = `<0>`の組み合わせになります。 -5. これで完成です。The Graph Explorerの検索で、あなたのサブグラフが表示されなくなります。以下の点にご注意ください: +3. subgraphNumber'フィールドに、公開する最初のサブグラフであれば 0、2 番目であれば 1、3 番目であれば 2、などと入力します。 +4. 2 と 3 の入力は `{graphAccount}-{subgraphNumber}`で構成される``にあります。例えば、[Sushi Subgraph's](https://thegraph.com/explorer/subgraph?id=0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0&version=0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0-0&view=Overview) の ID は`<0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0-0>`で、`graphAccount` = `<0x4bb4c1b0745ef7b4642feeccd0740dec417ca0a0>`と`subgraphNumber` = `<0>`の組み合わせになります。 +5. これで完成です。The Graph Explorer の検索で、あなたのサブグラフが表示されなくなります。以下の点にご注意ください: - キュレーターは、サブグラフにシグナルを送ることができなくなります。 - すでにサブグラフにシグナルを送っているキュレーターは、平均株価でシグナルを取り消すことができます。 diff --git a/pages/ja/developer/developer-faq.mdx b/pages/ja/developer/developer-faq.mdx index e467d956699f..75093c155f4a 100644 --- a/pages/ja/developer/developer-faq.mdx +++ b/pages/ja/developer/developer-faq.mdx @@ -8,11 +8,11 @@ title: 開発者向けFAQ ### 2. サブグラフの名前は変更できますか? -一度作成したサブグラフの名前を変更することはできません。サブグラフを作成する際には、他のdappsから検索しやすく、識別しやすい名前になるよう、よく考えてから作成してください。 +一度作成したサブグラフの名前を変更することはできません。サブグラフを作成する際には、他の dapps から検索しやすく、識別しやすい名前になるよう、よく考えてから作成してください。 -### 3. サブグラフに関連するGitHubアカウントは変更できますか? +### 3. サブグラフに関連する GitHub アカウントは変更できますか? -一度作成したサブグラフに関連するGitHubのアカウントは変更できません。サブグラフを作成する前に、この点をよく考えてください。 +一度作成したサブグラフに関連する GitHub のアカウントは変更できません。サブグラフを作成する前に、この点をよく考えてください。 ### 4. スマートコントラクトにイベントがない場合でも、サブグラフを作成できますか? @@ -30,7 +30,7 @@ title: 開発者向けFAQ データソース・テンプレートのインスタンス化」のセクションをご覧ください: [Data Source Templates](/developer/create-subgraph-hosted#data-source-templates) -### 7. 最新版のgraph-nodeを使用していることを確認する方法はありますか? +### 7. 最新版の graph-node を使用していることを確認する方法はありますか? 以下のコマンドを実行してください: @@ -38,25 +38,25 @@ title: 開発者向けFAQ docker pull graphprotocol/graph-node:latest ``` -**注:** docker / docker-composeは、最初に実行したときにプルされたgraph-nodeのバージョンを常に使用しますので、最新版のgraph-nodeを使用していることを確認するために、このコマンドを実行することが重要です。 +**注:** docker / docker-compose は、最初に実行したときにプルされた graph-node のバージョンを常に使用しますので、最新版の graph-node を使用していることを確認するために、このコマンドを実行することが重要です。 ### 8. サブグラフ・マッピングからコントラクト関数を呼び出したり、パブリック・ステート変数にアクセスするにはどうすればいいですか? [AssemblyScript API](/developer/assemblyscript-api)内の`Access to smart contract`セクションをご参照ください。 -### 9. 2つのコントラクトで`graph-cli`の`graph init` を使ってサブグラフをセットアップすることは可能ですか?それとも、`graph init`を実行した後、`subgraph.yaml`に別のデータソースを手動で追加する必要がありますか? +### 9. 2 つのコントラクトで`graph-cli`の`graph init` を使ってサブグラフをセットアップすることは可能ですか?それとも、`graph init`を実行した後、`subgraph.yaml`に別のデータソースを手動で追加する必要がありますか? `graph init`は基本的な出発点として意図されており、そこから手動でデータソースを追加することができます。 -### 10. GitHubの課題に貢献したいのですが、オープンソースのリポジトリはどこにありますか? +### 10. GitHub の課題に貢献したいのですが、オープンソースのリポジトリはどこにありますか? - [graph-node](https://github.com/graphprotocol/graph-node) - [graph-cli](https://github.com/graphprotocol/graph-cli) - [graph-ts](https://github.com/graphprotocol/graph-ts) -### 11. イベントを処理する際に、エンティティの "自動生成された "Idを構築する推奨される方法は何ですか? +### 11. イベントを処理する際に、エンティティの "自動生成された "Id を構築する推奨される方法は何ですか? -もし、イベント中に1つのエンティティしか作成されず、他に利用できるものがなければ、トランザクションハッシュ+ログインデックスがユニークになります。Bytesに変換して`crypto.keccak256`に通すことで難読化することができますが、これでは一意性は高まりません。 +もし、イベント中に 1 つのエンティティしか作成されず、他に利用できるものがなければ、トランザクションハッシュ+ログインデックスがユニークになります。Bytes に変換して`crypto.keccak256`に通すことで難読化することができますが、これでは一意性は高まりません。 ### 12. 複数のコントラクトをリスニングする際、イベントをリスニングするコントラクトの順番を選択することは可能ですか? @@ -73,13 +73,13 @@ dataSource.network() dataSource.address() ``` -### 14. Rinkebyでは、ブロックハンドラやコールハンドラをサポートしていますか? +### 14. Rinkeby では、ブロックハンドラやコールハンドラをサポートしていますか? -Rinkebyではブロックハンドラーをサポートしていますが、`filter: call`はサポートしていません。コールハンドラーは当面サポートしていません。 +Rinkeby ではブロックハンドラーをサポートしていますが、`filter: call`はサポートしていません。コールハンドラーは当面サポートしていません。 -### 15. サブグラフのマッピングにethers.jsや他のJSライブラリをインポートできますか? +### 15. サブグラフのマッピングに ethers.js や他の JS ライブラリをインポートできますか? -マッピングはAssemblyScriptで書かれているため、現在はできません。代替案としては、生データをエンティティに格納し、JSライブラリを必要とするロジックをクライアントで実行することが考えられます。 +マッピングは AssemblyScript で書かれているため、現在はできません。代替案としては、生データをエンティティに格納し、JS ライブラリを必要とするロジックをクライアントで実行することが考えられます。 ### 16. インデックス作成を開始するブロックを指定することはできますか? @@ -97,9 +97,9 @@ Rinkebyではブロックハンドラーをサポートしていますが、`fil curl -X POST -d '{ "query": "{indexingStatusForCurrentVersion(subgraphName: \"organization/subgraphName\") { chains { latestBlock { hash number }}}}"}' https://api.thegraph.com/index-node/graphql ``` -### 19. the Graphがサポートするネットワークは? +### 19. the Graph がサポートするネットワークは? -グラフノードは、EVMと互換性のあるJSON RPC APIチェーンをサポートしています。 +グラフノードは、EVM と互換性のある JSON RPC API チェーンをサポートしています。 なた、グラフネットワークは、イーサリアム・メインネットをインデックス化したサブグラフをサポートしています。 @@ -133,27 +133,27 @@ curl -X POST -d '{ "query": "{indexingStatusForCurrentVersion(subgraphName: \"or - Optimism - Optimism Testnet (on Kovan) -他のブロックチェーンとの統合に向けた作業が進行中で、詳細はレポでご覧いただけます。RFC-0003を参照してください: [RFC-0003: Multi-Blockchain Support](https://github.com/graphprotocol/rfcs/pull/8/files) +他のブロックチェーンとの統合に向けた作業が進行中で、詳細はレポでご覧いただけます。RFC-0003 を参照してください: [RFC-0003: Multi-Blockchain Support](https://github.com/graphprotocol/rfcs/pull/8/files) ### 20. 再デプロイせずに、サブグラフを別のアカウントやエンドポイントに複製することは可能ですか? -サブグラフを再デプロイする必要がありますが、サブグラフのID(IPFSハッシュ)が変わらなければ、最初から同期する必要はありません。 +サブグラフを再デプロイする必要がありますが、サブグラフの ID(IPFS ハッシュ)が変わらなければ、最初から同期する必要はありません。 -### 21. graph-nodeの上にApollo Federationを使用することは可能ですか? +### 21. graph-node の上に Apollo Federation を使用することは可能ですか? 将来的にはサポートしたいと考えていますが、フェデレーションはまだサポートされていません。現時点でできることは、クライアント上またはプロキシサービス経由でスキーマステッチを使用することです。 -### 22. The Graphが1回のクエリで返すオブジェクトの数に制限はありますか? +### 22. The Graph が 1 回のクエリで返すオブジェクトの数に制限はありますか? -デフォルトでは、クエリの応答は1つのコレクションにつき100アイテムに制限されています。それ以上の数を受け取りたい場合は、1コレクションあたり1000アイテムまで、それ以上は以下のようにページネーションすることができます: +デフォルトでは、クエリの応答は 1 つのコレクションにつき 100 アイテムに制限されています。それ以上の数を受け取りたい場合は、1 コレクションあたり 1000 アイテムまで、それ以上は以下のようにページネーションすることができます: ```graphql someCollection(first: 1000, skip: ) { ... } ``` -### 23. dappのフロントエンドがThe Graphを使ってクエリを行う場合、クエリキーをフロントエンドに直接書き込む必要がありますか?また、ユーザーにクエリ料を支払う場合、悪意のあるユーザーがいるとクエリ料が非常に高くなってしまうのではないでしょうか? +### 23. dapp のフロントエンドが The Graph を使ってクエリを行う場合、クエリキーをフロントエンドに直接書き込む必要がありますか?また、ユーザーにクエリ料を支払う場合、悪意のあるユーザーがいるとクエリ料が非常に高くなってしまうのではないでしょうか? -現時点では、フロントエンドにキーを追加し、それをエンドユーザーに公開することが、dappの推奨するアプローチです。とはいえ、 _yourdapp.io_やsubgraphのように、そのキーをホスト名に限定することもできます。ゲートウェイは現在、Edge&Nodeが運営しています。ゲートウェイの責任の一つは、不正な行為を監視し、悪意のあるクライアントからのトラフィックをブロックすることです。 +現時点では、フロントエンドにキーを追加し、それをエンドユーザーに公開することが、dapp の推奨するアプローチです。とはいえ、 *yourdapp.io*や subgraph のように、そのキーをホスト名に限定することもできます。ゲートウェイは現在、Edge&Node が運営しています。ゲートウェイの責任の一つは、不正な行為を監視し、悪意のあるクライアントからのトラフィックをブロックすることです。 ### 24. ホステッドサービスの現在のサブグラフはどこで確認できますか? @@ -161,7 +161,7 @@ someCollection(first: 1000, skip: ) { ... } ### 25. ホステッドサービスでは、クエリ料が発生しますか? -The Graphは、ホステッドサービスに対して課金することはありません。The Graphは非中央集権的なプロトコルであり、中央集権的なサービスに課金することはThe Graphの価値観に合致しません。ホステッドサービスは常に、分散型ネットワークに移行するための一時的なステップでした。開発者には十分な時間があるので、安心して分散型ネットワークに移行することができます。 +The Graph は、ホステッドサービスに対して課金することはありません。The Graph は非中央集権的なプロトコルであり、中央集権的なサービスに課金することは The Graph の価値観に合致しません。ホステッドサービスは常に、分散型ネットワークに移行するための一時的なステップでした。開発者には十分な時間があるので、安心して分散型ネットワークに移行することができます。 ### 26. ホステッドサービスはいつ終了しますか? @@ -169,4 +169,4 @@ The Graphは、ホステッドサービスに対して課金することはあ ### 27. メインネット上のサブグラフをアップグレードするには? -サブグラフの開発者であれば、CLIを使ってサブグラフの新バージョンをスタジオにアップグレードすることができます。その時点では非公開ですが、満足できるものであれば、分散化されたGraph Explorerに公開することができます。これにより、キュレーターがシグナリングを開始できるサブグラフの新バージョンが作成されます。 +サブグラフの開発者であれば、CLI を使ってサブグラフの新バージョンをスタジオにアップグレードすることができます。その時点では非公開ですが、満足できるものであれば、分散化された Graph Explorer に公開することができます。これにより、キュレーターがシグナリングを開始できるサブグラフの新バージョンが作成されます。 diff --git a/pages/ja/developer/graphql-api.mdx b/pages/ja/developer/graphql-api.mdx index f9cb6214fcd9..65928d8734e0 100644 --- a/pages/ja/developer/graphql-api.mdx +++ b/pages/ja/developer/graphql-api.mdx @@ -204,12 +204,12 @@ Fulltext search queries have one required field, `text`, for supplying search te Fulltext search operators: -| Symbol | Operator | Description | -| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| `&` | `And` | For combining multiple search terms into a filter for entities that include all of the provided terms | -| | | `Or` | Queries with multiple search terms separated by the or operator will return all entities with a match from any of the provided terms | -| `<->` | `Follow by` | Specify the distance between two words. | -| `:*` | `Prefix` | Use the prefix search term to find words whose prefix match (2 characters required.) | +| Symbol | Operator | Description | +| --- | --- | --- | +| `&` | `And` | For combining multiple search terms into a filter for entities that include all of the provided terms | +| | | `Or` | Queries with multiple search terms separated by the or operator will return all entities with a match from any of the provided terms | +| `<->` | `Follow by` | Specify the distance between two words. | +| `:*` | `Prefix` | Use the prefix search term to find words whose prefix match (2 characters required.) | #### Examples diff --git a/pages/ja/developer/publish-subgraph.mdx b/pages/ja/developer/publish-subgraph.mdx index e2458c5412d8..bb6fb2040420 100644 --- a/pages/ja/developer/publish-subgraph.mdx +++ b/pages/ja/developer/publish-subgraph.mdx @@ -2,7 +2,7 @@ title: 分散型ネットワークへのサブグラフの公開 --- -サブグラフが [Subgraph Studioにデプロイ](/studio/deploy-subgraph-studio)され、それをテストし、本番の準備ができたら、分散型ネットワークにパブリッシュすることができます。 +サブグラフが [Subgraph Studio にデプロイ](/studio/deploy-subgraph-studio)され、それをテストし、本番の準備ができたら、分散型ネットワークにパブリッシュすることができます。 サブグラフを分散型ネットワークに公開すると、[キュレーター](/curating)がキュレーションを開始したり、[インデクサー](/indexing)がインデックスを作成したりできるようになります。 @@ -10,18 +10,18 @@ title: 分散型ネットワークへのサブグラフの公開 ### ネットワーク -分散型ネットワークは現在、RinkebyとEthereum Mainnetの両方をサポートしています。 +分散型ネットワークは現在、Rinkeby と Ethereum Mainnet の両方をサポートしています。 ### サブグラフの公開 -サブグラフは、Subgraph Studioのダッシュボードから**Publish** ボタンをクリックすることで、直接分散型ネットワークに公開することができます。 サブグラフが公開されると、[Graph Explorer](https://thegraph.com/explorer/)で閲覧できるようになります。 +サブグラフは、Subgraph Studio のダッシュボードから**Publish** ボタンをクリックすることで、直接分散型ネットワークに公開することができます。 サブグラフが公開されると、[Graph Explorer](https://thegraph.com/explorer/)で閲覧できるようになります。 -- Rinkebyに公開されたサブグラフは、RinkebyネットワークまたはEthereum Mainnetのいずれかからデータをインデックス化してクエリすることができます。 +- Rinkeby に公開されたサブグラフは、Rinkeby ネットワークまたは Ethereum Mainnet のいずれかからデータをインデックス化してクエリすることができます。 -- Ethereum Mainnetに公開されたサブグラフは、Ethereum Mainnetのデータのみをインデックス化してクエリすることができます。つまり、テストネットのデータをインデックス化して照会するサブグラフをメインの分散型ネットワークに公開することはできません。 +- Ethereum Mainnet に公開されたサブグラフは、Ethereum Mainnet のデータのみをインデックス化してクエリすることができます。つまり、テストネットのデータをインデックス化して照会するサブグラフをメインの分散型ネットワークに公開することはできません。 - 既存のサブグラフの新バージョンを公開する場合は、上記と同じルールが適用されます。 ### 公開されたサブグラフのメタデータの更新 -サブグラフが分散型ネットワークに公開されると、サブグラフのSubgraph Studioダッシュボードで更新を行うことにより、いつでもメタデータを変更することができます。 変更を保存し、更新内容をネットワークに公開すると、グラフエクスプローラーに反映されます。 デプロイメントが変更されていないため、新しいバージョンは作成されません。 +サブグラフが分散型ネットワークに公開されると、サブグラフの Subgraph Studio ダッシュボードで更新を行うことにより、いつでもメタデータを変更することができます。 変更を保存し、更新内容をネットワークに公開すると、グラフエクスプローラーに反映されます。 デプロイメントが変更されていないため、新しいバージョンは作成されません。 diff --git a/pages/ja/developer/querying-from-your-app.mdx b/pages/ja/developer/querying-from-your-app.mdx index e94a6f50046e..507ba4d02ad6 100644 --- a/pages/ja/developer/querying-from-your-app.mdx +++ b/pages/ja/developer/querying-from-your-app.mdx @@ -2,7 +2,7 @@ title: アプリケーションからのクエリ --- -サブグラフがSubgraph StudioまたはGraph Explorerにデプロイされると、GraphQL APIのエンドポイントが与えられ、以下のような形になります。 +サブグラフが Subgraph Studio または Graph Explorer にデプロイされると、GraphQL API のエンドポイントが与えられ、以下のような形になります。 **Subgraph Studio (テスト用エンドポイント)** @@ -18,15 +18,15 @@ Queries (HTTP) https://gateway.thegraph.com/api//subgraphs/id/ ``` -GraphQLエンドポイントを使用すると、さまざまなGraphQLクライアントライブラリを使用してサブグラフをクエリし、サブグラフによってインデックス化されたデータをアプリに入力することができます。 +GraphQL エンドポイントを使用すると、さまざまな GraphQL クライアントライブラリを使用してサブグラフをクエリし、サブグラフによってインデックス化されたデータをアプリに入力することができます。 -ここでは、エコシステムで人気のあるGraphQLクライアントをいくつか紹介し、その使い方を説明します: +ここでは、エコシステムで人気のある GraphQL クライアントをいくつか紹介し、その使い方を説明します: -### Apolloクライアント +### Apollo クライアント -[Apolloクライアント](https://www.apollographql.com/docs/)は、ReactやVueなどのフレームワークを含むWebプロジェクトや、iOS、Android、React Nativeなどのモバイルクライアントをサポートしています。 +[Apollo クライアント](https://www.apollographql.com/docs/)は、React や Vue などのフレームワークを含む Web プロジェクトや、iOS、Android、React Native などのモバイルクライアントをサポートしています。 -WebプロジェクトでApolloクライアントを使ってサブグラフからデータを取得する方法を見てみましょう。 +Web プロジェクトで Apollo クライアントを使ってサブグラフからデータを取得する方法を見てみましょう。 まず、`@apollo/client`と`graphql`をインストールします: @@ -34,7 +34,7 @@ WebプロジェクトでApolloクライアントを使ってサブグラフか npm install @apollo/client graphql ``` -その後、以下のコードでAPIをクエリできます: +その後、以下のコードで API をクエリできます: ```javascript import { ApolloClient, InMemoryCache, gql } from '@apollo/client' @@ -100,17 +100,17 @@ client ### URQL -もう一つの選択肢は[URQL](https://formidable.com/open-source/urql/)で、URQLは、やや軽量なGraphQLクライアントライブラリです。 +もう一つの選択肢は[URQL](https://formidable.com/open-source/urql/)で、URQL は、やや軽量な GraphQL クライアントライブラリです。 -URQLは、やや軽量なGraphQLクライアントライブラリです。 +URQL は、やや軽量な GraphQL クライアントライブラリです。 -WebプロジェクトでURQLを使ってサブグラフからデータを取得する方法を見てみましょう。 まず、`urql`と`graphql`をインストールします。 +Web プロジェクトで URQL を使ってサブグラフからデータを取得する方法を見てみましょう。 まず、`urql`と`graphql`をインストールします。 ```sh npm install urql graphql ``` -その後、以下のコードでAPIをクエリできます: +その後、以下のコードで API をクエリできます: ```javascript import { createClient } from 'urql' diff --git a/pages/ja/developer/quick-start.mdx b/pages/ja/developer/quick-start.mdx index 3ccb3ec0a097..3205fa7adea8 100644 --- a/pages/ja/developer/quick-start.mdx +++ b/pages/ja/developer/quick-start.mdx @@ -5,13 +5,13 @@ title: クイックスタート このガイドでは、サブグラフの初期化、作成、デプロイの方法を素早く説明します: - **Subgraph Studio** - **Ethereum mainnet**をインデックスするサブグラフにのみ使用されます。 -- **Hosted Service** - Ethereumメインネット以外の **他のネットワーク**(Binance、Maticなど)にインデックスを付けるサブグラフに使用されます。 +- **Hosted Service** - Ethereum メインネット以外の **他のネットワーク**(Binance、Matic など)にインデックスを付けるサブグラフに使用されます。 ## Subgraph Studio -### 1. Graph CLIのインストール +### 1. Graph CLI のインストール -Graph CLIはJavaScriptで書かれており、使用するには `npm` または `yarn` のいずれかをインストールする必要があります。 +Graph CLI は JavaScript で書かれており、使用するには `npm` または `yarn` のいずれかをインストールする必要があります。 ```sh # NPM @@ -29,24 +29,24 @@ $ yarn global add @graphprotocol/graph-cli graph init --studio ``` -- サブグラフのスラッグは、サブグラフの識別子です。 CLIツールでは、以下のスクリーンショットに見られるように、コントラクトアドレス、ネットワークなど、サブグラフを作成するための手順を説明します。 +- サブグラフのスラッグは、サブグラフの識別子です。 CLI ツールでは、以下のスクリーンショットに見られるように、コントラクトアドレス、ネットワークなど、サブグラフを作成するための手順を説明します。 ![Subgraph command](/img/Subgraph-Slug.png) ### 3. サブグラフの作成 -前述のコマンドでは、サブグラフを作成するための出発点として使用できるscaffoldサブグラフを作成します。 サブグラフに変更を加える際には、主に3つのファイルを使用します: +前述のコマンドでは、サブグラフを作成するための出発点として使用できる scaffold サブグラフを作成します。 サブグラフに変更を加える際には、主に 3 つのファイルを使用します: - マニフェスト (subgraph.yaml) - マニフェストは、サブグラフがインデックスするデータソースを定義します。 -- スキーマ (schema.graphql) - GraphQLスキーマは、サブグラフから取得したいデータを定義します。 +- スキーマ (schema.graphql) - GraphQL スキーマは、サブグラフから取得したいデータを定義します。 - AssemblyScript Mappings (mapping.ts) - データソースからのデータを、スキーマで定義されたエンティティに変換するコードです。 サブグラフの書き方の詳細については、 [Create a Subgraph](/developer/create-subgraph-hosted) を参照してください。 -### 4. Subgraph Studioへのデプロイ +### 4. Subgraph Studio へのデプロイ - [https://thegraph.com/studio/](https://thegraph.com/studio/) にアクセスし、ウォレットを接続します。 -- 「Create」をクリックし、ステップ2で使用したサブグラフのスラッグを入力します。 +- 「Create」をクリックし、ステップ 2 で使用したサブグラフのスラッグを入力します。 - サブグラフのフォルダで以下のコマンドを実行します。 ```sh @@ -54,7 +54,7 @@ $ graph codegen $ graph build ``` -- サブグラフの認証とデプロイを行います。 デプロイキーは、Subgraph StudioのSubgraphページにあります。 +- サブグラフの認証とデプロイを行います。 デプロイキーは、Subgraph Studio の Subgraph ページにあります。 ```sh $ graph auth --studio @@ -65,7 +65,7 @@ $ graph deploy --studio ### 5. ログの確認 -エラーが発生した場合は、ログを確認してください。 サブグラフが失敗している場合は、 [GraphiQL Playground](https://graphiql-online.com/) を使ってサブグラフの健全性をクエリすることができます。 [このエンドポイント](https://api.thegraph.com/index-node/graphql) を使用します。 なお、以下のクエリを活用して、サブグラフのデプロイメントIDを入力することができます。 この場合、 `Qm...` がデプロイメントIDです(これはSubgraphページの**Details**に記載されています)。 以下のクエリは、サブグラフが失敗したときに教えてくれるので、適宜デバッグすることができます: +エラーが発生した場合は、ログを確認してください。 サブグラフが失敗している場合は、 [GraphiQL Playground](https://graphiql-online.com/) を使ってサブグラフの健全性をクエリすることができます。 [このエンドポイント](https://api.thegraph.com/index-node/graphql) を使用します。 なお、以下のクエリを活用して、サブグラフのデプロイメント ID を入力することができます。 この場合、 `Qm...` がデプロイメント ID です(これは Subgraph ページの**Details**に記載されています)。 以下のクエリは、サブグラフが失敗したときに教えてくれるので、適宜デバッグすることができます: ```sh { @@ -110,13 +110,13 @@ $ graph deploy --studio ### 6. サブグラフのクエリ -[以下の手順](/developer/query-the-graph)でサブグラフのクエリを実行できます。 APIキーを持っていない場合は、開発やステージングに使用できる無料の一時的なクエリURLを使って、自分のdappからクエリを実行できます。 フロントエンドアプリケーションからサブグラフを照会する方法については、[こちら](/developer/querying-from-your-app)の説明をご覧ください。 +[以下の手順](/developer/query-the-graph)でサブグラフのクエリを実行できます。 API キーを持っていない場合は、開発やステージングに使用できる無料の一時的なクエリ URL を使って、自分の dapp からクエリを実行できます。 フロントエンドアプリケーションからサブグラフを照会する方法については、[こちら](/developer/querying-from-your-app)の説明をご覧ください。 ## ホスティングサービス -### 1. Graph CLIのインストール +### 1. Graph CLI のインストール -"Graph CLI "はnpmパッケージなので、使用するには`npm`または `yarn`がインストールされていなければなりません。 +"Graph CLI "は npm パッケージなので、使用するには`npm`または `yarn`がインストールされていなければなりません。 ```sh # NPM @@ -142,14 +142,14 @@ $ graph init --product hosted-service --from-contract
$ graph init --product hosted-service --from-example ``` -- 例の場合、サブグラフはDani GrantによるGravityコントラクトに基づいており、ユーザーのアバターを管理し、アバターが作成または更新されるたびに`NewGravatar`または`UpdateGravatar`イベントを発行します。 +- 例の場合、サブグラフは Dani Grant による Gravity コントラクトに基づいており、ユーザーのアバターを管理し、アバターが作成または更新されるたびに`NewGravatar`または`UpdateGravatar`イベントを発行します。 ### 3. サブグラフの作成 -先ほどのコマンドで、サブグラフを作成するための足場ができました。 サブグラフに変更を加える際には、主に3つのファイルを使用します: +先ほどのコマンドで、サブグラフを作成するための足場ができました。 サブグラフに変更を加える際には、主に 3 つのファイルを使用します: - マニフェスト (subgraph.yaml) - マニフェストは、サブグラフがインデックスするデータソースを定義します。 -- スキーマ (schema.graphql) - GraphQLスキーマは、サブグラフから取得したいデータを定義します。 +- スキーマ (schema.graphql) - GraphQL スキーマは、サブグラフから取得したいデータを定義します。 - AssemblyScript Mappings (mapping.ts) - データソースからのデータを、スキーマで定義されたエンティティに変換するコードです。 サブグラフの書き方の詳細については、 [Create a Subgraph](/developer/create-subgraph-hosted) を参照してください。 @@ -157,8 +157,8 @@ $ graph init --product hosted-service --from-example ### 4. サブグラフのデプロイ - Github アカウントを使用して[Hosted Service](https://thegraph.com/hosted-service/) にサインインします。 -- 「Add Subgraph」をクリックし、必要な情報を入力します。 手順2と同じサブグラフ名を使用します。 -- サブグラフのフォルダでcodegenを実行します。 +- 「Add Subgraph」をクリックし、必要な情報を入力します。 手順 2 と同じサブグラフ名を使用します。 +- サブグラフのフォルダで codegen を実行します。 ```sh # NPM @@ -168,7 +168,7 @@ $ npm run codegen $ yarn codegen ``` -- アクセストークンを追加して、サブグラフをデプロイします。 アクセストークンは、ダッシュボードのHosted Serviceにあります。 +- アクセストークンを追加して、サブグラフをデプロイします。 アクセストークンは、ダッシュボードの Hosted Service にあります。 ```sh $ graph auth --product hosted-service @@ -177,7 +177,7 @@ $ graph deploy --product hosted-service / ### 5. ログの確認 -エラーが発生した場合は、ログを確認してください。 サブグラフが失敗している場合は、 [GraphiQL Playground](https://graphiql-online.com/) を使ってサブグラフの健全性をクエリすることができます。 [このエンドポイント](https://api.thegraph.com/index-node/graphql) を使用します。 なお、以下のクエリを活用して、サブグラフのデプロイメントIDを入力することができます。 この場合、 `Qm...` がデプロイメントIDです(これはSubgraphページの**Details**に記載されています)。 以下のクエリは、サブグラフが失敗したときに教えてくれるので、適宜デバッグすることができます: +エラーが発生した場合は、ログを確認してください。 サブグラフが失敗している場合は、 [GraphiQL Playground](https://graphiql-online.com/) を使ってサブグラフの健全性をクエリすることができます。 [このエンドポイント](https://api.thegraph.com/index-node/graphql) を使用します。 なお、以下のクエリを活用して、サブグラフのデプロイメント ID を入力することができます。 この場合、 `Qm...` がデプロイメント ID です(これは Subgraph ページの**Details**に記載されています)。 以下のクエリは、サブグラフが失敗したときに教えてくれるので、適宜デバッグすることができます: ```sh { diff --git a/pages/ja/explorer.mdx b/pages/ja/explorer.mdx index c0ed9a036920..5494043c66f5 100644 --- a/pages/ja/explorer.mdx +++ b/pages/ja/explorer.mdx @@ -2,7 +2,7 @@ title: エクスプローラー --- -グラフエクスプローラーは、サブグラフとネットワークデータの世界への分散型ポータルです。 👩🏽‍🚀 グラフエクスプローラーは、他のサブグラフ開発者、dapp開発者、キュレーター、インデクサー、デリゲーターと交流できる複数のパートで構成されています。 グラフエクスプローラーの概要については、以下のビデオをご覧ください。 +グラフエクスプローラーは、サブグラフとネットワークデータの世界への分散型ポータルです。 👩🏽‍🚀 グラフエクスプローラーは、他のサブグラフ開発者、dapp 開発者、キュレーター、インデクサー、デリゲーターと交流できる複数のパートで構成されています。 グラフエクスプローラーの概要については、以下のビデオをご覧ください。
+ >
## サブグラフ @@ -115,7 +115,7 @@ title: エクスプローラー 特筆すべき重要な詳細をいくつか挙げます: - **クエリフィーは消費者によって生成された報酬を表し**、サブグラフへの割り当てが終了し、提供したデータが消費者によって検証された後、少なくとも 7 エポック(下記参照)の期間後にインデクサが請求することができます(または請求しないこともできます)。 -- **Iインデックス報酬は、エポック期間中にインデクサーがネットワーク発行から請求した報酬の量を表しています。**プロトコルの発行は固定されていますが、報酬はインデクサーがインデックスを作成したサブグラフへの割り当てを終了して初めてミントされます。 そのため、エポックごとの報酬数は変動します(例えば、あるエポックでは、インデクサーが何日も前から開いていた割り当てをまとめて閉じたかもしれません)。 +- **I インデックス報酬は、エポック期間中にインデクサーがネットワーク発行から請求した報酬の量を表しています。**プロトコルの発行は固定されていますが、報酬はインデクサーがインデックスを作成したサブグラフへの割り当てを終了して初めてミントされます。 そのため、エポックごとの報酬数は変動します(例えば、あるエポックでは、インデクサーが何日も前から開いていた割り当てをまとめて閉じたかもしれません)。 ![エクスプローラーイメージ 8](/img/Network-Stats.png) diff --git a/pages/ja/hosted-service/migrating-subgraph.mdx b/pages/ja/hosted-service/migrating-subgraph.mdx index 8d556f5644db..8e4d0b4630da 100644 --- a/pages/ja/hosted-service/migrating-subgraph.mdx +++ b/pages/ja/hosted-service/migrating-subgraph.mdx @@ -142,7 +142,7 @@ If you're still confused, fear not! Check out the following resources or watch o title="YouTube ビデオプレイヤー" frameBorder="0" allowFullScreen -> + > - [The Graph Network Contracts](https://github.com/graphprotocol/contracts) diff --git a/pages/ja/indexing.mdx b/pages/ja/indexing.mdx index 3b4b72a83997..c47a79da3757 100644 --- a/pages/ja/indexing.mdx +++ b/pages/ja/indexing.mdx @@ -114,12 +114,12 @@ Use Etherscan to call `getRewards()`: - **Medium** - 100 個のサブグラフと 1 秒あたり 200 ~ 500 のリクエストをサポートするプロダクションインデクサー - **Large** - 現在使用されているすべてのサブグラフのインデックスを作成し、関連するトラフィックのリクエストに対応します -| 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 | ### インデクサーが取るべきセキュリティ対策は? @@ -151,20 +151,20 @@ Use Etherscan to call `getRewards()`: #### グラフノード -| 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 diff --git a/pages/ja/studio/billing.mdx b/pages/ja/studio/billing.mdx index 7f23343baa17..f53bbdc1223d 100644 --- a/pages/ja/studio/billing.mdx +++ b/pages/ja/studio/billing.mdx @@ -46,7 +46,7 @@ For a quick demo of how billing works on the Subgraph Studio, check out the vide title="YouTube ビデオプレイヤー" frameBorder="0" allowFullScreen -> + > ### Multisig Users diff --git a/pages/ja/studio/subgraph-studio.mdx b/pages/ja/studio/subgraph-studio.mdx index 1f5ecf6a7011..5e2cf18ce86e 100644 --- a/pages/ja/studio/subgraph-studio.mdx +++ b/pages/ja/studio/subgraph-studio.mdx @@ -73,7 +73,7 @@ You’ve made it this far - congrats! Publishing your subgraph means that an IPF title="YouTube ビデオプレイヤー" frameBorder="0" allowFullScreen -> + > Remember, while you’re going through your publishing flow, you’ll be able to push to either mainnet or Rinkeby, the testnet we support. If you’re a first time subgraph developer, we highly suggest you start with publishing to Rinkeby, which is free to do. This will allow you to see how the subgraph will work in The Graph Explorer and will allow you to test curation elements. diff --git a/pages/ko/about/introduction.mdx b/pages/ko/about/introduction.mdx index f401d4070f1f..06d212a827ef 100644 --- a/pages/ko/about/introduction.mdx +++ b/pages/ko/about/introduction.mdx @@ -12,7 +12,7 @@ title: 소개 Bored Ape Yacht Club의 경우에 우리는 [해당 컨트렉트](https://etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d#code) 에서 특정 유인원의 주인을 확인하거나, 그들의 ID를 기반으로 Ape의 콘텐츠 URI를 확인하거나, 혹은 총 공급량을 확인하는 등의 기본적인 읽기 작업을 수행할 수 있습니다. 이는 이러한 읽기 작업이 스마트 컨트렉트에 직접적으로 프로그래밍 되었기 때문에 가능하지만, 집계, 검색, 관계 및 단순하지 않은 필터링과 같은 더 고급 적인 실생활 쿼리 및 작업은 불가능합니다. 예를 들어 여러분들이 특정 주소가 소유한 유인원을 쿼리하고, 그 특성 중 하나로 필터링하고자 하는 경우, 우리는 해당 컨트렉트 자체와 직접 상호 작용하여 해당 정보를 얻을 수 없습니다. -이러한 데이터를 얻기 위해서, 여러분들은 아마 그동안 발생한 모든 단일 [`transfer`](https://etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d#code#L1746) 이벤트 들을 모두 처리하고, 토큰 ID와 IPFS 해시를 사용하여 IPFS로부터 메타데이터를 읽은 후 이들을 집계해야 합니다. 이러한 유형의 비교적 간단한 쿼리에 대해서도, 아마 브라우저에서 실행되는 탈중앙화 애필리케이션(dapp)은 답을 얻기 위해 **몇 시간 혹은 며칠**이 걸릴 수도 있습니다. +이러한 데이터를 얻기 위해서, 여러분들은 아마 그동안 발생한 모든 단일 [`transfer`](https://etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d#code#L1746) 이벤트 들을 모두 처리하고, 토큰 ID와 IPFS 해시를 사용하여 IPFS로부터 메타데이터를 읽은 후 이들을 집계해야 합니다. 이러한 유형의 비교적 간단한 쿼리에 대해서도, 아마 브라우저에서 실행되는 탈중앙화 애필리케이션(dapp)은 답을 얻기 위해 **몇 시간 혹은 며칠**이 걸릴 수도 있습니다. 또한 여러분들은 데이터를 쿼리하기 위해 자체 서버를 구축하고, 그곳에서 트랜잭션을 처리하고, 데이터베이스에 저장하고, 그 위에 API 엔드포인트를 구축할 수도 있습니다. 하지만 이 옵션은 많은 리소스를 사용하고, 유지 관리가 필요하며, 단일 실패 지점을 제공하고 또한 탈중앙화에 필수적인 중요한 보안 속성을 손상시킵니다. @@ -26,7 +26,7 @@ Bored Ape Yacht Club의 경우에 우리는 [해당 컨트렉트](https://ethers 더 그래프는 서브 매니페스트라고 하는 서브그래프 설명을 기반으로 이더리움 데이터를 인덱싱하는 항목과 방법을 학습합니다. 서브그래프 설명은 서브그래프에 대한 스마트 컨트렉트, 주의를 기울여야 할 컨트렉트들의 이벤트 및 더 그래프가 데이터베이스에 저장할 데이터에 이벤트 데이터를 매핑하는 방법을 정의합니다. -여러분들이 `subgraph manifest`를 작성한 후에 , Graph CLI를 사용하여 IPFS에 정의를 저장하고 인덱서에게 해당 서브그래프에 대한 데이터 인덱싱을 시작하도록 지시합니다. +여러분들이 `subgraph manifest`를 작성한 후에 , Graph CLI를 사용하여 IPFS에 정의를 저장하고 인덱서에게 해당 서브그래프에 대한 데이터 인덱싱을 시작하도록 지시합니다. 이 다이어그램은 이더리움 트랜잭션을 처리하는 서브그래프 매니페스트가 배포된 후 데이터 흐름에 대한 자세한 정보를 제공합니다. @@ -44,4 +44,4 @@ Bored Ape Yacht Club의 경우에 우리는 [해당 컨트렉트](https://ethers 다음 섹션에서 우리는 서브그래프를 정의하는 방법, 배포하는 방법 및 그래프 노드가 구축하는 인덱스들로부터 데이터를 쿼리하는 방법에 대해 더 자세히 알아볼 것입니다. -자체 서브그래프를 작성하기 전에, 여러분들은 그래프 탐색기를 살펴보고 이미 배포된 일부 서브 그래프들에 대해 알아보길 희망하실 수 있습니다. 각 서브 그래프 페이지에는 여러분들이 GraphQL로 서브그래프의 데이터를 쿼리할 수 있는 영역이 포함되어 있습니다. +자체 서브그래프를 작성하기 전에, 여러분들은 그래프 탐색기를 살펴보고 이미 배포된 일부 서브 그래프들에 대해 알아보길 희망하실 수 있습니다. 각 서브 그래프 페이지에는 여러분들이 GraphQL로 서브그래프의 데이터를 쿼리할 수 있는 영역이 포함되어 있습니다. diff --git a/pages/ko/curating.mdx b/pages/ko/curating.mdx index 456deec666f7..dcb329288947 100644 --- a/pages/ko/curating.mdx +++ b/pages/ko/curating.mdx @@ -100,5 +100,5 @@ title: 큐레이팅 title="YouTubeビデオプレーヤー" frameBorder="0" allowFullScreen -> + > diff --git a/pages/ko/delegating.mdx b/pages/ko/delegating.mdx index 20cd2496fa04..22b1e8c5bfd4 100644 --- a/pages/ko/delegating.mdx +++ b/pages/ko/delegating.mdx @@ -28,9 +28,7 @@ This guide will explain how to be an effective delegator in the Graph Network. D 또한 고려해야 할 한 가지는 위임을 위한 인덱서를 현명하게 선택하는 것입니다. 만약 여러분들이 신뢰할 수 없거나 작업을 제대로 수행하지 않는 인덱서를 선택하면 여러분들은 해당 위임의 취소를 원할 것입니다. 이 경우, 보상을 받는 기회를 잃음과 더불어, 단지 여러분의 GRT를 소각하기만 한 결과를 초래할 것입니다. -
- 위임 UI에는 0.5%의 수수료 및 28일의 위임 해지 기간이 명시되어있습니다. -
+
위임 UI에는 0.5%의 수수료 및 28일의 위임 해지 기간이 명시되어있습니다.
### 위임자들에 대한 공정한 보상 지급 규칙을 지닌 신뢰할 수 있는 인덱서 선택 @@ -89,5 +87,5 @@ A delegator can therefore do the math to determine that the Indexer offering 20% title="YouTubeビデオプレーヤー" frameBorder="0" allowFullScreen -> + > diff --git a/pages/ko/developer/assemblyscript-api.mdx b/pages/ko/developer/assemblyscript-api.mdx index 8f2e952d40bc..f7ddd88c06cb 100644 --- a/pages/ko/developer/assemblyscript-api.mdx +++ b/pages/ko/developer/assemblyscript-api.mdx @@ -43,13 +43,13 @@ npm install --save-dev @graphprotocol/graph-ts # NPM 서브그래프 매니페스트의 `apiVersion`은 주어진 서브그래프에 대해 그래프 노드가 실행하는 매핑 API 버전을 지정합니다. 현재 맵핑 API 버전은 0.0.6 입니다. -| 버전 | 릴리스 노트 | -|:-----:| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 0.0.6 | 이더리움 트랜잭션 개체에 `nonce` 필드를 추가했습니다.
`baseFeePerGas`가 이더리움 블록 개체에 추가되었습니다. | +| 버전 | 릴리스 노트 | +| :-: | --- | +| 0.0.6 | 이더리움 트랜잭션 개체에 `nonce` 필드를 추가했습니다.
`baseFeePerGas`가 이더리움 블록 개체에 추가되었습니다. | | 0.0.5 | AssemblyScript를 버전 0.19.10으로 업그레이드했습니다(변경 내용 깨짐 포함. [`Migration Guide`](/developer/assemblyscript-migration-guide) 참조)
`ethereum.transaction.gasUsed`의 이름이 `ethereum.transaction.gasLimit`로 변경되었습니다. | -| 0.0.4 | Ethereum SmartContractCall 개체에 `functionSignature` 필드를 추가했습니다. | -| 0.0.3 | Ethereum Call 개체에 `from` 필드를 추가했습니다.
`etherem.call.address`의 이름이 `ethereum.call.to`로 변경되었습니다. | -| 0.0.2 | Ethereum Transaction 개체에 `input` 필드를 추가했습니다. | +| 0.0.4 | Ethereum SmartContractCall 개체에 `functionSignature` 필드를 추가했습니다. | +| 0.0.3 | Ethereum Call 개체에 `from` 필드를 추가했습니다.
`etherem.call.address`의 이름이 `ethereum.call.to`로 변경되었습니다. | +| 0.0.2 | Ethereum Transaction 개체에 `input` 필드를 추가했습니다. | ### 기본 제공 유형 diff --git a/pages/ko/developer/assemblyscript-migration-guide.mdx b/pages/ko/developer/assemblyscript-migration-guide.mdx index 0a2cb73f3c23..553460d72272 100644 --- a/pages/ko/developer/assemblyscript-migration-guide.mdx +++ b/pages/ko/developer/assemblyscript-migration-guide.mdx @@ -127,8 +127,11 @@ ERROR TS2451: Cannot redeclare block-scoped variable 'a' ~~~~~~~~~~~~~ in assembly/index.ts(4,3) ``` + You'll need to rename your duplicate variables if you had variable shadowing. + ### Null Comparisons + By doing the upgrade on your subgraph, sometimes you might get errors like these: ```typescript @@ -137,6 +140,7 @@ ERROR TS2322: Type '~lib/@graphprotocol/graph-ts/common/numbers/BigInt | null' i ~~~~ in src/mappings/file.ts(41,21) ``` + To solve you can simply change the `if` statement to something like this: ```typescript @@ -281,6 +285,7 @@ ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/s let somethingOrElse: string = container.data ? container.data : "else"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` + To fix this issue, you can create a variable for that property access so that the compiler can do the nullability check magic: ```typescript diff --git a/pages/ko/developer/create-subgraph-hosted.mdx b/pages/ko/developer/create-subgraph-hosted.mdx index 6b235e379634..3b05b2548456 100644 --- a/pages/ko/developer/create-subgraph-hosted.mdx +++ b/pages/ko/developer/create-subgraph-hosted.mdx @@ -218,15 +218,15 @@ Each entity must have an `id` field, which is of type `ID!` (string). The `id` f We support the following scalars in our GraphQL API: -| Type | Description | -| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `ID` | Stored as a `string`. | -| `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 have size of 32 bytes. | -| `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 signficand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| Type | Description | +| --- | --- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `ID` | Stored as a `string`. | +| `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 have size of 32 bytes. | +| `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 signficand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | #### Enums @@ -627,7 +627,7 @@ export function handleNewExchange(event: NewExchange): void { ``` > **Note:** A new data source will only process the calls and events for the block in which it was created and all following blocks, but will not process historical data, i.e., data that is contained in prior blocks. -> +> > If prior blocks contain data relevant to the new data source, it is best to index that data by reading the current state of the contract and creating entities representing that state at the time the new data source is created. ### Data Source Context @@ -684,7 +684,7 @@ dataSources: ``` > **Note:** The contract creation block can be quickly looked up on Etherscan: -> +> > 1. Search for the contract by entering its address in the search bar. > 2. Click on the creation transaction hash in the `Contract Creator` section. > 3. Load the transaction details page where you'll find the start block for that contract. diff --git a/pages/ko/developer/graphql-api.mdx b/pages/ko/developer/graphql-api.mdx index f9cb6214fcd9..65928d8734e0 100644 --- a/pages/ko/developer/graphql-api.mdx +++ b/pages/ko/developer/graphql-api.mdx @@ -204,12 +204,12 @@ Fulltext search queries have one required field, `text`, for supplying search te Fulltext search operators: -| Symbol | Operator | Description | -| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| `&` | `And` | For combining multiple search terms into a filter for entities that include all of the provided terms | -| | | `Or` | Queries with multiple search terms separated by the or operator will return all entities with a match from any of the provided terms | -| `<->` | `Follow by` | Specify the distance between two words. | -| `:*` | `Prefix` | Use the prefix search term to find words whose prefix match (2 characters required.) | +| Symbol | Operator | Description | +| --- | --- | --- | +| `&` | `And` | For combining multiple search terms into a filter for entities that include all of the provided terms | +| | | `Or` | Queries with multiple search terms separated by the or operator will return all entities with a match from any of the provided terms | +| `<->` | `Follow by` | Specify the distance between two words. | +| `:*` | `Prefix` | Use the prefix search term to find words whose prefix match (2 characters required.) | #### Examples diff --git a/pages/ko/explorer.mdx b/pages/ko/explorer.mdx index 816139ae9a58..7132fa01731d 100644 --- a/pages/ko/explorer.mdx +++ b/pages/ko/explorer.mdx @@ -11,7 +11,7 @@ title: 탐색기 title="YouTubeビデオプレーヤー" frameBorder="0" allowFullScreen -> + > ## 서브그래프 diff --git a/pages/ko/hosted-service/migrating-subgraph.mdx b/pages/ko/hosted-service/migrating-subgraph.mdx index 260f084c0e7d..c7d55f54f297 100644 --- a/pages/ko/hosted-service/migrating-subgraph.mdx +++ b/pages/ko/hosted-service/migrating-subgraph.mdx @@ -142,7 +142,7 @@ If you're still confused, fear not! Check out the following resources or watch o title="YouTubeビデオプレーヤー" frameBorder="0" allowFullScreen -> + > - [The Graph Network Contracts](https://github.com/graphprotocol/contracts) diff --git a/pages/ko/indexing.mdx b/pages/ko/indexing.mdx index 67a24f449ada..fc9c92f5c72f 100644 --- a/pages/ko/indexing.mdx +++ b/pages/ko/indexing.mdx @@ -114,12 +114,12 @@ Disputes can be viewed in the UI in an Indexer's profile page under the `Dispute - **Medium** - 100개의 Subgraph 및 초당 200 - 500개의 요청을 서포트 할 수 있는 프로덕션 인덱서입니다. - **Large** - 현재 사용되는 모든 서브그래프들 및 관련 트레픽 요청의 처리에 대한 요건을 충족합니다. -| 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 | ### 인덱서가 취해야 할 기본적인 보안 예방 조치는 무엇인가요? @@ -151,20 +151,20 @@ Disputes can be viewed in the UI in an Indexer's profile page under the `Dispute #### 그래프 노드 -| 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 diff --git a/pages/ko/studio/billing.mdx b/pages/ko/studio/billing.mdx index 4788124913d9..693e13b23cc9 100644 --- a/pages/ko/studio/billing.mdx +++ b/pages/ko/studio/billing.mdx @@ -46,7 +46,7 @@ For a quick demo of how billing works on the Subgraph Studio, check out the vide title="YouTubeビデオプレーヤー" frameBorder="0" allowFullScreen -> + > ### Multisig Users diff --git a/pages/ko/studio/subgraph-studio.mdx b/pages/ko/studio/subgraph-studio.mdx index 562d588ef26d..492bb376c44b 100644 --- a/pages/ko/studio/subgraph-studio.mdx +++ b/pages/ko/studio/subgraph-studio.mdx @@ -73,7 +73,7 @@ You’ve made it this far - congrats! Publishing your subgraph means that an IPF title="YouTubeビデオプレーヤー" frameBorder="0" allowFullScreen -> + > Remember, while you’re going through your publishing flow, you’ll be able to push to either mainnet or Rinkeby, the testnet we support. If you’re a first time subgraph developer, we highly suggest you start with publishing to Rinkeby, which is free to do. This will allow you to see how the subgraph will work in The Graph Explorer and will allow you to test curation elements. diff --git a/pages/vi/curating.mdx b/pages/vi/curating.mdx index 1affd60eaf9d..32018f0aa360 100644 --- a/pages/vi/curating.mdx +++ b/pages/vi/curating.mdx @@ -100,5 +100,5 @@ Vẫn còn thắc mắc? Xem video hướng dẫn Curation của chúng tôi bê title="Trình phát video YouTube" frameBorder="0" allowFullScreen -> + > diff --git a/pages/vi/delegating.mdx b/pages/vi/delegating.mdx index 92e6a6e492c1..caa911c5c7ad 100644 --- a/pages/vi/delegating.mdx +++ b/pages/vi/delegating.mdx @@ -90,5 +90,5 @@ Hướng dẫn này cung cấp đánh giá đầy đủ về tài liệu này v title="Trình phát video YouTube" frameBorder="0" allowFullScreen -> + > diff --git a/pages/vi/developer/assemblyscript-api.mdx b/pages/vi/developer/assemblyscript-api.mdx index b5066fab02f2..2b6aa855c4a3 100644 --- a/pages/vi/developer/assemblyscript-api.mdx +++ b/pages/vi/developer/assemblyscript-api.mdx @@ -43,13 +43,13 @@ 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. The current mapping API version is 0.0.6. -| Version | Release notes | -|:-------:| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 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`](/developer/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
`etherem.call.address` renamed to `ethereum.call.to` | -| 0.0.2 | Added `input` field to the Ethereum Transaction object | +| Version | Release notes | +| :-: | --- | +| 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`](/developer/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
`etherem.call.address` renamed to `ethereum.call.to` | +| 0.0.2 | Added `input` field to the Ethereum Transaction object | ### Built-in Types diff --git a/pages/vi/developer/assemblyscript-migration-guide.mdx b/pages/vi/developer/assemblyscript-migration-guide.mdx index 2db90a608110..c63a1af95d7b 100644 --- a/pages/vi/developer/assemblyscript-migration-guide.mdx +++ b/pages/vi/developer/assemblyscript-migration-guide.mdx @@ -127,8 +127,11 @@ ERROR TS2451: Cannot redeclare block-scoped variable 'a' ~~~~~~~~~~~~~ in assembly/index.ts(4,3) ``` + You'll need to rename your duplicate variables if you had variable shadowing. + ### Null Comparisons + By doing the upgrade on your subgraph, sometimes you might get errors like these: ```typescript @@ -137,6 +140,7 @@ ERROR TS2322: Type '~lib/@graphprotocol/graph-ts/common/numbers/BigInt | null' i ~~~~ in src/mappings/file.ts(41,21) ``` + To solve you can simply change the `if` statement to something like this: ```typescript @@ -281,6 +285,7 @@ ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/s let somethingOrElse: string = container.data ? container.data : "else"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` + To fix this issue, you can create a variable for that property access so that the compiler can do the nullability check magic: ```typescript diff --git a/pages/vi/developer/create-subgraph-hosted.mdx b/pages/vi/developer/create-subgraph-hosted.mdx index 43c18e98693c..a0780d9c0abf 100644 --- a/pages/vi/developer/create-subgraph-hosted.mdx +++ b/pages/vi/developer/create-subgraph-hosted.mdx @@ -218,15 +218,15 @@ Each entity must have an `id` field, which is of type `ID!` (string). The `id` f We support the following scalars in our GraphQL API: -| Type | Description | -| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | -| `ID` | Stored as a `string`. | -| `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 have size of 32 bytes. | -| `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 signficand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | +| Type | Description | +| --- | --- | +| `Bytes` | Byte array, represented as a hexadecimal string. Commonly used for Ethereum hashes and addresses. | +| `ID` | Stored as a `string`. | +| `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 have size of 32 bytes. | +| `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 signficand and an exponent. The exponent range is from −6143 to +6144. Rounded to 34 significant digits. | #### Enums @@ -627,7 +627,7 @@ export function handleNewExchange(event: NewExchange): void { ``` > **Note:** A new data source will only process the calls and events for the block in which it was created and all following blocks, but will not process historical data, i.e., data that is contained in prior blocks. -> +> > If prior blocks contain data relevant to the new data source, it is best to index that data by reading the current state of the contract and creating entities representing that state at the time the new data source is created. ### Data Source Context @@ -684,7 +684,7 @@ dataSources: ``` > **Note:** The contract creation block can be quickly looked up on Etherscan: -> +> > 1. Search for the contract by entering its address in the search bar. > 2. Click on the creation transaction hash in the `Contract Creator` section. > 3. Load the transaction details page where you'll find the start block for that contract. diff --git a/pages/vi/developer/graphql-api.mdx b/pages/vi/developer/graphql-api.mdx index f9cb6214fcd9..65928d8734e0 100644 --- a/pages/vi/developer/graphql-api.mdx +++ b/pages/vi/developer/graphql-api.mdx @@ -204,12 +204,12 @@ Fulltext search queries have one required field, `text`, for supplying search te Fulltext search operators: -| Symbol | Operator | Description | -| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| `&` | `And` | For combining multiple search terms into a filter for entities that include all of the provided terms | -| | | `Or` | Queries with multiple search terms separated by the or operator will return all entities with a match from any of the provided terms | -| `<->` | `Follow by` | Specify the distance between two words. | -| `:*` | `Prefix` | Use the prefix search term to find words whose prefix match (2 characters required.) | +| Symbol | Operator | Description | +| --- | --- | --- | +| `&` | `And` | For combining multiple search terms into a filter for entities that include all of the provided terms | +| | | `Or` | Queries with multiple search terms separated by the or operator will return all entities with a match from any of the provided terms | +| `<->` | `Follow by` | Specify the distance between two words. | +| `:*` | `Prefix` | Use the prefix search term to find words whose prefix match (2 characters required.) | #### Examples diff --git a/pages/vi/explorer.mdx b/pages/vi/explorer.mdx index fef6a2b6a34b..559853047cc7 100644 --- a/pages/vi/explorer.mdx +++ b/pages/vi/explorer.mdx @@ -11,7 +11,7 @@ Chào mừng bạn đến với Graph Explorer, hay như chúng tôi thường g title="Trình phát video YouTube" frameBorder="0" allowFullScreen -> + > ## Subgraphs diff --git a/pages/vi/hosted-service/migrating-subgraph.mdx b/pages/vi/hosted-service/migrating-subgraph.mdx index e81d98dd5e2a..03182e7bc9d3 100644 --- a/pages/vi/hosted-service/migrating-subgraph.mdx +++ b/pages/vi/hosted-service/migrating-subgraph.mdx @@ -142,7 +142,7 @@ If you're still confused, fear not! Check out the following resources or watch o title="Trình phát video YouTube" frameBorder="0" allowFullScreen -> + > - [The Graph Network Contracts](https://github.com/graphprotocol/contracts) diff --git a/pages/vi/indexing.mdx b/pages/vi/indexing.mdx index c0d6fdd9a9dd..657a7fdf225e 100644 --- a/pages/vi/indexing.mdx +++ b/pages/vi/indexing.mdx @@ -114,12 +114,12 @@ Indexer có thể tự phân biệt bản thân bằng cách áp dụng các k - **Trung bình** - Công cụ indexing production hỗ trợ 100 đồ subgraph và 200-500 yêu cầu mỗi giây. - **Lớn** - Được chuẩn bị để index tất cả các subgraph hiện đang được sử dụng và phục vụ các yêu cầu cho lưu lượng truy cập liên quan. -| 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 | ### Một số biện pháp phòng ngừa bảo mật cơ bản mà indexer nên thực hiện là gì? @@ -151,20 +151,20 @@ Lưu ý: Để hỗ trợ mở rộng quy mô nhanh, bạn nên tách các mối #### 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 | - | #### Dịch vụ Indexer -| 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 | - | #### Đại lý Indexer diff --git a/pages/vi/studio/billing.mdx b/pages/vi/studio/billing.mdx index fae13d468b27..9968fc4364c8 100644 --- a/pages/vi/studio/billing.mdx +++ b/pages/vi/studio/billing.mdx @@ -46,7 +46,7 @@ For a quick demo of how billing works on the Subgraph Studio, check out the vide title="Trình phát video YouTube" frameBorder="0" allowFullScreen -> + > ### Multisig Users diff --git a/pages/vi/studio/subgraph-studio.mdx b/pages/vi/studio/subgraph-studio.mdx index 3bb38004be5a..e591a7c79bec 100644 --- a/pages/vi/studio/subgraph-studio.mdx +++ b/pages/vi/studio/subgraph-studio.mdx @@ -73,7 +73,7 @@ You’ve made it this far - congrats! Publishing your subgraph means that an IPF title="Trình phát video YouTube" frameBorder="0" allowFullScreen -> + > Remember, while you’re going through your publishing flow, you’ll be able to push to either mainnet or Rinkeby, the testnet we support. If you’re a first time subgraph developer, we highly suggest you start with publishing to Rinkeby, which is free to do. This will allow you to see how the subgraph will work in The Graph Explorer and will allow you to test curation elements. diff --git a/pages/zh/about/network.mdx b/pages/zh/about/network.mdx index 7cdb059d6279..f4acf744ef85 100644 --- a/pages/zh/about/network.mdx +++ b/pages/zh/about/network.mdx @@ -2,14 +2,14 @@ title: 网络概述 --- -The Graph网络是一个去中心化的索引协议,用于组织区块链数据。 应用程序使用GraphQL查询称为子图的开放API,以检索网络上的索引数据。 通过The Graph,开发者可以建立完全在公共基础设施上运行的无服务器应用程序。 +The Graph 网络是一个去中心化的索引协议,用于组织区块链数据。 应用程序使用 GraphQL 查询称为子图的开放 API,以检索网络上的索引数据。 通过 The Graph,开发者可以建立完全在公共基础设施上运行的无服务器应用程序。 -> Grt合约地址:[0xc944e90c64b2c07662a292be6244bdf05cda44a7](https://etherscan.io/token/0xc944e90c64b2c07662a292be6244bdf05cda44a7) +> Grt 合约地址:[0xc944e90c64b2c07662a292be6244bdf05cda44a7](https://etherscan.io/token/0xc944e90c64b2c07662a292be6244bdf05cda44a7) ## 概述 -The Graph网络由索引人、策展人和委托人组成,为网络提供服务,并为Web3应用程序提供数据。 消费者使用应用程序并消费数据。 +The Graph 网络由索引人、策展人和委托人组成,为网络提供服务,并为 Web3 应用程序提供数据。 消费者使用应用程序并消费数据。 ![代币经济学](/img/Network-roles@2x.png) -为了确保The Graph 网络的经济安全和被查询数据的完整性,参与者将Graph 令牌(GRT)质押并使用。 GRT是一种工作代币,是以太坊区块链上的ERC-20,用于分配网络中的资源。 活跃的索引人、策展人和委托人可以提供服务,并从网络中获得收入,与他们的工作量和他们的GRT委托量成正比。 +为了确保 The Graph 网络的经济安全和被查询数据的完整性,参与者将 Graph 令牌(GRT)质押并使用。 GRT 是一种工作代币,是以太坊区块链上的 ERC-20,用于分配网络中的资源。 活跃的索引人、策展人和委托人可以提供服务,并从网络中获得收入,与他们的工作量和他们的 GRT 委托量成正比。 diff --git a/pages/zh/curating.mdx b/pages/zh/curating.mdx index f53632ba91b8..774fac8c90ee 100644 --- a/pages/zh/curating.mdx +++ b/pages/zh/curating.mdx @@ -100,5 +100,5 @@ Remember that curation is risky. 请做好你的工作,确保你在你信任 title="YouTube video player" frameBorder="0" allowFullScreen -> + > diff --git a/pages/zh/delegating.mdx b/pages/zh/delegating.mdx index 8ba0e39c9035..402dff170e48 100644 --- a/pages/zh/delegating.mdx +++ b/pages/zh/delegating.mdx @@ -6,7 +6,7 @@ title: 委托 ## 委托人指南 -本指南将解释如何在Graph网络中成为一个有效的委托人。 委托人与所有索引人一起分享其委托股权的协议收益。 委托人必须根据多种因素,运用他们的最佳判断力来选择索引人。 请注意,本指南将不涉及正确设置Metamask等步骤,因为这些信息在互联网上广泛存在。 本指南有三个部分: +本指南将解释如何在 Graph 网络中成为一个有效的委托人。 委托人与所有索引人一起分享其委托股权的协议收益。 委托人必须根据多种因素,运用他们的最佳判断力来选择索引人。 请注意,本指南将不涉及正确设置 Metamask 等步骤,因为这些信息在互联网上广泛存在。 本指南有三个部分: - 在 The Graph 网络中委托代币的风险 - 如何计算作为委托人的预期回报 @@ -28,9 +28,7 @@ title: 委托 还需要考虑的一件事是明智地选择索引人。 如果您选择了一个不值得信赖的 索引人,或者没有做好工作,您将想要取消委托,这意味着您将失去很多获得奖励的机会,这可能与燃烧 GRT 一样糟糕。 -
- 请注意委托用户界面中的0.5%费用,以及28天的解约期。 -
+
请注意委托用户界面中的0.5%费用,以及28天的解约期。
### 选择一个为委托人提供公平的奖励分配的值得信赖的索引人 @@ -88,5 +86,5 @@ title: 委托 title="YouTube video player" frameBorder="0" allowFullScreen -> + > diff --git a/pages/zh/developer/assemblyscript-migration-guide.mdx b/pages/zh/developer/assemblyscript-migration-guide.mdx index 1945ed786f01..4e6a2f8682cc 100644 --- a/pages/zh/developer/assemblyscript-migration-guide.mdx +++ b/pages/zh/developer/assemblyscript-migration-guide.mdx @@ -6,7 +6,7 @@ title: AssemblyScript 迁移指南 这将使子图开发人员能够使用 AS 语言和标准库的更新功能。 -本指南适用于使用 `0.22.0` 版本以下的 `graph-cli`/`graph-ts` 的任何人。 如果您已经使用了高于(或等于)该版本号的版本,那么您已经在使用 AssemblyScript 的 `0.19.10` 版本🙂 +本指南适用于使用 `0.22.0` 版本以下的 `graph-cli`/`graph-ts` 的任何人。 如果您已经使用了高于(或等于)该版本号的版本,那么您已经在使用 AssemblyScript 的 `0.19.10` 版本 🙂 > 注意:从 `0.24.0` 开始,`graph-node` 可以支持这两个版本,具体取决于子图清单文件中指定的 `apiVersion`。 @@ -106,7 +106,7 @@ let maybeValue = load()! // breaks in runtime if value is null maybeValue.aMethod() ``` -如果您不确定选择哪个,我们建议始终使用安全的方式。 如果该值不存在,您可能只想在您的子图处理程序中,尽早执行一个带有 return 的if 语句进行检查。 +如果您不确定选择哪个,我们建议始终使用安全的方式。 如果该值不存在,您可能只想在您的子图处理程序中,尽早执行一个带有 return 的 if 语句进行检查。 ### 变量遮蔽 @@ -127,8 +127,11 @@ ERROR TS2451: Cannot redeclare block-scoped variable 'a' ~~~~~~~~~~~~~ in assembly/index.ts(4,3) ``` + 如果您有变量遮蔽的情况,则需要重命名重名变量。 + ### 空值比较 + 对子图进行升级后,有时您可能会遇到如下错误: ```typescript @@ -137,6 +140,7 @@ ERROR TS2322: Type '~lib/@graphprotocol/graph-ts/common/numbers/BigInt | null' i ~~~~ in src/mappings/file.ts(41,21) ``` + 要解决此问题,您只需将 `if` 语句更改为如下所示代码: ```typescript @@ -161,7 +165,7 @@ let uint8Array = byteArray as Uint8Array // equivalent to: byteArray 但是,这只适用于两种情况: - 原始类型转换(在`u8`, `i32`, `bool`等类型之间; 例如: `let b: isize = 10; b as usize`); -- 在类继承时向上转换(子类→超类) +- 在类继承时向上转换(子类 → 超类) 例子: @@ -181,7 +185,7 @@ let bytes = new Bytes(2) < Uint8Array > bytes // same as: bytes as Uint8Array 在两种情况下,您可能希望进行类型转换,但使用 `as`/`var` **并不安全**: -- 在类继承时向下转换(超类→子类) +- 在类继承时向下转换(超类 → 子类) - 在共享超类的两种类型之间 ```typescript @@ -231,7 +235,7 @@ if (previousBalance != null) { let newBalance = new AccountBalance(balanceId) ``` -对于可空性情况,我们建议查看[可空性检查功能](https://www.assemblyscript.org/basics.html#nullability-checks),它会让您的代码更简洁🙂 +对于可空性情况,我们建议查看[可空性检查功能](https://www.assemblyscript.org/basics.html#nullability-checks),它会让您的代码更简洁 🙂 我们还在某些类型中添加了一些静态方法来简化转换,它们是: @@ -281,6 +285,7 @@ ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/s let somethingOrElse: string = container.data ? container.data : "else"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` + 要解决此问题,您可以为该属性访问创建一个变量,以便编译器可以执行可空性检查: ```typescript @@ -322,7 +327,7 @@ let wrapper = new Wrapper(y) wrapper.n = wrapper.n + x // doesn't give compile time errors as it should ``` -我们为此在 AssemblyScript 编译器上提出了一个issue,但现在如果您在子图映射中执行此类操作,您应该在之前进行空值检查。 +我们为此在 AssemblyScript 编译器上提出了一个 issue,但现在如果您在子图映射中执行此类操作,您应该在之前进行空值检查。 ```typescript let wrapper = new Wrapper(y) @@ -386,7 +391,7 @@ if (total === null) { total.tokens = total.tokens + BigInt.fromI32(1) ``` -或者您可以更改您的 GraphQL 模式,不给此属性赋予可为空的类型,然后您在 `codegen` 步骤中将其初始化为零😉 +或者您可以更改您的 GraphQL 模式,不给此属性赋予可为空的类型,然后您在 `codegen` 步骤中将其初始化为零 😉 ```graphql type Total @entity { @@ -441,9 +446,9 @@ export class Something { } ``` -### GraphQL模式 +### GraphQL 模式 -这不是一个直接AssemblyScript 更改,但您可能需要更新 `schema.graphql` 文件。 +这不是一个直接 AssemblyScript 更改,但您可能需要更新 `schema.graphql` 文件。 现在,您不再可以在您的类型中定义不可为空的列表的字段。 如果您有这样的模式: @@ -480,5 +485,5 @@ AssemblyScript 版本之间的可空性差异导致了这种改变, 并且这也 - 从对象字面初始化的类不能再定义构造函数([v0.10.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.10.0)) - 如果两个操作数都是整数,则 `**` 二元运算的结果现在是公分母整数。 以前,结果是一个浮点数,就像调用 `Math/f.pow` ([v0.11.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.11.0)) - 在转换为 `bool` 时强制 `NaN` 为 `false` ([v0.14.9](https://github.com/AssemblyScript/assemblyscript/releases/tag /v0.14.9)) -- 当移动 `i8`/`u8` 或 `i16`/`u16` 类型的小整数值时,只有 4 个RHS 值的最低有效位中的3个会影响结果,类似于 `i32.shl` 的结果仅受 RHS 值的 5 个最低有效位影响。 示例:`someI8 << 8` 以前生成值 `0`,但现在由于将 RHS 屏蔽为`8 & 7 = 0` (3 比特), 而生成 `someI8`([v0.17.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.0)) +- 当移动 `i8`/`u8` 或 `i16`/`u16` 类型的小整数值时,只有 4 个 RHS 值的最低有效位中的 3 个会影响结果,类似于 `i32.shl` 的结果仅受 RHS 值的 5 个最低有效位影响。 示例:`someI8 << 8` 以前生成值 `0`,但现在由于将 RHS 屏蔽为`8 & 7 = 0` (3 比特), 而生成 `someI8`([v0.17.0](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.0)) - 大小不同时关系字符串比较的错误修复 ([v0.17.8](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.17.8)) diff --git a/pages/zh/developer/define-subgraph-hosted.mdx b/pages/zh/developer/define-subgraph-hosted.mdx index 17484f0deb7a..19751d21fba4 100644 --- a/pages/zh/developer/define-subgraph-hosted.mdx +++ b/pages/zh/developer/define-subgraph-hosted.mdx @@ -2,7 +2,7 @@ title: 定义子图 --- -子图定义了Graph从以太坊索引哪些数据,以及如何存储这些数据。 子图一旦部署,就成为区块链数据全局图的一部分。 +子图定义了 Graph 从以太坊索引哪些数据,以及如何存储这些数据。 子图一旦部署,就成为区块链数据全局图的一部分。 ![定义子图](/img/define-subgraph.png) @@ -16,19 +16,19 @@ title: 定义子图 在详细了解清单文件的内容之前,您需要安装[Graph CLI](https://github.com/graphprotocol/graph-cli),以构建和部署子图。 -## 安装Graph CLI +## 安装 Graph CLI -Graph CLI是使用 JavaScript 编写的,您需要安装`yarn`或 `npm`才能使用它;以下教程中假设您已经安装了yarn。 +Graph CLI 是使用 JavaScript 编写的,您需要安装`yarn`或 `npm`才能使用它;以下教程中假设您已经安装了 yarn。 一旦您安装了`yarn`,可以通过运行以下命令安装 Graph CLI -**使用yarn安装:** +**使用 yarn 安装:** ```bash yarn global add @graphprotocol/graph-cli ``` -**使用npm安装:** +**使用 npm 安装:** ```bash npm install -g @graphprotocol/graph-cli diff --git a/pages/zh/developer/graphql-api.mdx b/pages/zh/developer/graphql-api.mdx index f9cb6214fcd9..65928d8734e0 100644 --- a/pages/zh/developer/graphql-api.mdx +++ b/pages/zh/developer/graphql-api.mdx @@ -204,12 +204,12 @@ Fulltext search queries have one required field, `text`, for supplying search te Fulltext search operators: -| Symbol | Operator | Description | -| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| `&` | `And` | For combining multiple search terms into a filter for entities that include all of the provided terms | -| | | `Or` | Queries with multiple search terms separated by the or operator will return all entities with a match from any of the provided terms | -| `<->` | `Follow by` | Specify the distance between two words. | -| `:*` | `Prefix` | Use the prefix search term to find words whose prefix match (2 characters required.) | +| Symbol | Operator | Description | +| --- | --- | --- | +| `&` | `And` | For combining multiple search terms into a filter for entities that include all of the provided terms | +| | | `Or` | Queries with multiple search terms separated by the or operator will return all entities with a match from any of the provided terms | +| `<->` | `Follow by` | Specify the distance between two words. | +| `:*` | `Prefix` | Use the prefix search term to find words whose prefix match (2 characters required.) | #### Examples diff --git a/pages/zh/developer/publish-subgraph.mdx b/pages/zh/developer/publish-subgraph.mdx index f0ca17995942..c25e5cfee2cd 100644 --- a/pages/zh/developer/publish-subgraph.mdx +++ b/pages/zh/developer/publish-subgraph.mdx @@ -10,13 +10,13 @@ title: 向去中心化的网络发布子图 ### 网络 -这个去中心化的网络目前同时支持Rinkeby和以太坊主网。 +这个去中心化的网络目前同时支持 Rinkeby 和以太坊主网。 ### 发布一个子图 -子图可以通过点击 **"发布 "** 按钮直接从Subgraph Studio仪表板上发布到去中心化网络。一旦一个子图被发布,它将可以在[Graph浏览器](https://thegraph.com/explorer/)中查看。 +子图可以通过点击 **"发布 "** 按钮直接从 Subgraph Studio 仪表板上发布到去中心化网络。一旦一个子图被发布,它将可以在[Graph 浏览器](https://thegraph.com/explorer/)中查看。 -- 发布到Rinkeby的子图可以索引和查询Rinkeby网络或以太坊主网的数据。 +- 发布到 Rinkeby 的子图可以索引和查询 Rinkeby 网络或以太坊主网的数据。 - 发布到以太坊主网的子图只能索引和查询以太坊主网的数据,也就是说,你不能把子图发布到主去中心化网络,索引和查询测试网的数据。 @@ -24,4 +24,4 @@ title: 向去中心化的网络发布子图 ### 更新一个已发布的子图的元数据 -一旦你的子图被发布到去中心化的网络,你可以在任何时候通过在子图的子图工作室仪表板上进行更新来修改元数据。在保存更改并将你的更新发布到网络后,它们将反映在Graph浏览器中。这不会创建一个新的版本,因为你的部署并没有改变。 +一旦你的子图被发布到去中心化的网络,你可以在任何时候通过在子图的子图工作室仪表板上进行更新来修改元数据。在保存更改并将你的更新发布到网络后,它们将反映在 Graph 浏览器中。这不会创建一个新的版本,因为你的部署并没有改变。 diff --git a/pages/zh/developer/query-the-graph.mdx b/pages/zh/developer/query-the-graph.mdx index 1c1cbbc080be..905048e741a3 100644 --- a/pages/zh/developer/query-the-graph.mdx +++ b/pages/zh/developer/query-the-graph.mdx @@ -2,7 +2,7 @@ title: 查询The Graph --- -随着子图的部署,访问[Graph 浏览器来](https://thegraph.com/explorer)打开[GraphiQL](https://github.com/graphql/graphiql) 界面,在那里你可以通过发出查询和查看模式来探索子图的GraphQL API。 +随着子图的部署,访问[Graph 浏览器来](https://thegraph.com/explorer)打开[GraphiQL](https://github.com/graphql/graphiql) 界面,在那里你可以通过发出查询和查看模式来探索子图的 GraphQL API。 下面提供了一个示例,但请参阅 [查询 API](/developer/graphql-api) 以获取有关如何查询子图实体的完整参考。 @@ -19,14 +19,14 @@ title: 查询The Graph } ``` -## 使用The Graph浏览器 +## 使用 The Graph 浏览器 -每个发布到去中心化Graph浏览器的子图都有一个独特的查询URL,你可以通过导航到子图的详细信息页面并点击右上角的 "查询 "按钮找到。这将打开一个侧窗格,给你提供该子图的唯一查询URL,以及一些关于如何查询的说明。 +每个发布到去中心化 Graph 浏览器的子图都有一个独特的查询 URL,你可以通过导航到子图的详细信息页面并点击右上角的 "查询 "按钮找到。这将打开一个侧窗格,给你提供该子图的唯一查询 URL,以及一些关于如何查询的说明。 ![Query Subgraph Pane](/img/query-subgraph-pane.png) -正如你所注意到的,这个查询URL必须使用一个独特的API密钥。你可以在 [Subgraph Studio](https://thegraph.com/studio)的 "API密钥 "部分创建和管理你的API密钥。在[这里](/studio/subgraph-studio)了解更多关于如何使用Subgraph Studio的信息。 +正如你所注意到的,这个查询 URL 必须使用一个独特的 API 密钥。你可以在 [Subgraph Studio](https://thegraph.com/studio)的 "API 密钥 "部分创建和管理你的 API 密钥。在[这里](/studio/subgraph-studio)了解更多关于如何使用 Subgraph Studio 的信息。 -使用你的API密钥查询子图将产生查询费用,这些费用将以GRT方式支付。你可以在[这里](/studio/billing)了解更多关于计费的信息 +使用你的 API 密钥查询子图将产生查询费用,这些费用将以 GRT 方式支付。你可以在[这里](/studio/billing)了解更多关于计费的信息 -你也可以使用 "操作台 "选项卡中的GraphQL游乐场来查询The Graph Explorer中的一个子图。 +你也可以使用 "操作台 "选项卡中的 GraphQL 游乐场来查询 The Graph Explorer 中的一个子图。 diff --git a/pages/zh/developer/querying-from-your-app.mdx b/pages/zh/developer/querying-from-your-app.mdx index 10f5de0747e1..0cd65bcc84c8 100644 --- a/pages/zh/developer/querying-from-your-app.mdx +++ b/pages/zh/developer/querying-from-your-app.mdx @@ -2,7 +2,7 @@ title: 从应用程序中进行查询 --- -一旦子图被部署到子图工作室或Graph Explorer,你将得到GraphQL API的端点,它应该看起来像这样。 +一旦子图被部署到子图工作室或 Graph Explorer,你将得到 GraphQL API 的端点,它应该看起来像这样。 **子图工作室(测试端点)** @@ -18,15 +18,15 @@ Queries (HTTP) https://gateway.thegraph.com/api//subgraphs/id/ ``` -使用GraphQL端点,你可以使用各种GraphQL客户端库来查询子图,并用子图索引的数据来填充你的应用程序。 +使用 GraphQL 端点,你可以使用各种 GraphQL 客户端库来查询子图,并用子图索引的数据来填充你的应用程序。 -下面是生态系统中几个比较流行的GraphQL客户端以及如何使用它们。 +下面是生态系统中几个比较流行的 GraphQL 客户端以及如何使用它们。 ### Apollo 客户端 -[Apollo客户端](https://www.apollographql.com/docs/) 支持网络项目,包括React和Vue等框架,以及iOS、Android和React Native等移动客户端。 +[Apollo 客户端](https://www.apollographql.com/docs/) 支持网络项目,包括 React 和 Vue 等框架,以及 iOS、Android 和 React Native 等移动客户端。 -让我们看看如何在一个网络项目中用Apollo客户端从子图中获取数据。 +让我们看看如何在一个网络项目中用 Apollo 客户端从子图中获取数据。 首先,安装`@apollo/client` 和`graphql`: @@ -34,7 +34,7 @@ https://gateway.thegraph.com/api//subgraphs/id/ npm install @apollo/client graphql ``` -然后你可以用以下代码查询API: +然后你可以用以下代码查询 API: ```javascript import { ApolloClient, InMemoryCache, gql } from '@apollo/client' @@ -100,9 +100,9 @@ client ### URQL -另一个选择是[URQL](https://formidable.com/open-source/urql/),一个有点轻量级的GraphQL客户端库。 +另一个选择是[URQL](https://formidable.com/open-source/urql/),一个有点轻量级的 GraphQL 客户端库。 -让我们看看如何在一个网络项目中用URQL从子图中获取数据。 +让我们看看如何在一个网络项目中用 URQL 从子图中获取数据。 首先,安装`urql`和 `graphql`: @@ -110,7 +110,7 @@ client npm install urql graphql ``` -然后你可以用以下代码查询API: +然后你可以用以下代码查询 API: ```javascript import { createClient } from 'urql' diff --git a/pages/zh/developer/quick-start.mdx b/pages/zh/developer/quick-start.mdx index 338680248189..f0d0ba401a93 100644 --- a/pages/zh/developer/quick-start.mdx +++ b/pages/zh/developer/quick-start.mdx @@ -5,13 +5,13 @@ title: 快速开始 本指南将快速带你了解如何初始化、创建和部署你的子图。 - **子图工作室** - 仅用于索引**以太坊主网**的子图 -- **托管服务** - 用于索引以太坊主网之外的 **其他网络**的子图(如Binance、Matic等)。 +- **托管服务** - 用于索引以太坊主网之外的 **其他网络**的子图(如 Binance、Matic 等)。 ## 子图工作室 -### 1. 安装Graph CLI +### 1. 安装 Graph CLI -Graph CLI是用JavaScript编写的,你需要安装`npm` 或`yarn` 来使用它。 +Graph CLI 是用 JavaScript 编写的,你需要安装`npm` 或`yarn` 来使用它。 ```sh # NPM @@ -29,7 +29,7 @@ $ yarn global add @graphprotocol/graph-cli graph init --studio ``` -- 你的子图slug是你的子图的一个标识符。CLI工具将引导你完成创建子图的步骤,如合同地址、网络等,你可以在下面的截图中看到。 +- 你的子图 slug 是你的子图的一个标识符。CLI 工具将引导你完成创建子图的步骤,如合同地址、网络等,你可以在下面的截图中看到。 ![Subgraph command](/img/Subgraph-Slug.png) @@ -38,15 +38,15 @@ graph init --studio 前面的命令创建了一个脚手架子图,你可以将其作为构建子图的起点。在对子图进行修改时,你将主要处理三个文件。 - 清单(subgraph.yaml)--清单定义了您的子图将索引哪些数据源。 -- 模式(schema.graphql)--GraphQL模式定义了你希望从子图中获取哪些数据。 -- AssemblyScript映射(mapping.ts)--这是将数据源中的数据转换为模式中定义的实体的代码。 +- 模式(schema.graphql)--GraphQL 模式定义了你希望从子图中获取哪些数据。 +- AssemblyScript 映射(mapping.ts)--这是将数据源中的数据转换为模式中定义的实体的代码。 关于如何编写子图的更多信息,请参见 [创建子图](/developer/create-subgraph-hosted) ### 4. 部署到子图工作室 - 进入子图工作室 [https://thegraph.com/studio/](https://thegraph.com/studio/) 并连接你的钱包。 -- 点击 "创建 "并输入你在第2步使用的子图slug。 +- 点击 "创建 "并输入你在第 2 步使用的子图 slug。 - 在子图文件夹中运行这些命令 ```sh @@ -54,7 +54,7 @@ $ graph codegen $ graph build ``` -- 认证并部署你的子图。部署密钥可以在Subgraph Studio的Subgraph页面上找到。 +- 认证并部署你的子图。部署密钥可以在 Subgraph Studio 的 Subgraph 页面上找到。 ```sh $ graph auth --studio @@ -65,7 +65,7 @@ $ graph deploy --studio ### 5. 检查你的日志 -日志应该告诉你是否有任何错误。如果你的子图失败了,你可以通过使用 [GraphiQL Playground](https://graphiql-online.com/)查询子图的健康状况。使用[这个端点](https://api.thegraph.com/index-node/graphql)。注意,你可以利用下面的查询,输入你的子图的部署ID。在这种情况下,`Qm...` 是部署ID(可以在子图页面的**详细信息**下找到)。下面的查询将告诉你,当一个子图失败时,你可以相应地进行调试。 +日志应该告诉你是否有任何错误。如果你的子图失败了,你可以通过使用 [GraphiQL Playground](https://graphiql-online.com/)查询子图的健康状况。使用[这个端点](https://api.thegraph.com/index-node/graphql)。注意,你可以利用下面的查询,输入你的子图的部署 ID。在这种情况下,`Qm...` 是部署 ID(可以在子图页面的**详细信息**下找到)。下面的查询将告诉你,当一个子图失败时,你可以相应地进行调试。 ```sh { @@ -111,13 +111,13 @@ $ graph deploy --studio ### 6. 查询你的子图 -你现在可以按照 [这些说明](/developer/query-the-graph)来查询你的子图。如果你没有你的API密钥,你可以通过免费的、速率有限的临时查询URL从你的dapp查询,该URL可用于开发和暂存。你可以在 [这里](/developer/querying-from-your-app)阅读关于如何从前端应用程序查询子图的附加说明。 +你现在可以按照 [这些说明](/developer/query-the-graph)来查询你的子图。如果你没有你的 API 密钥,你可以通过免费的、速率有限的临时查询 URL 从你的 dapp 查询,该 URL 可用于开发和暂存。你可以在 [这里](/developer/querying-from-your-app)阅读关于如何从前端应用程序查询子图的附加说明。 ## 托管服务 -### 1. 安装Graph CLI +### 1. 安装 Graph CLI -"Graph CLI是一个npm包,你需要安装 `npm`或 `yarn`来使用它。 +"Graph CLI 是一个 npm 包,你需要安装 `npm`或 `yarn`来使用它。 ```sh # NPM @@ -143,23 +143,23 @@ $ graph init --product hosted-service --from-contract
$ graph init --product hosted-service --from-example ``` -- 在这个例子中,子图是基于Dani Grant的Gravity合约,该合约管理用户的头像,并在头像创建或更新时发出`NewGravatar`或`UpdateGravatar`事件。 +- 在这个例子中,子图是基于 Dani Grant 的 Gravity 合约,该合约管理用户的头像,并在头像创建或更新时发出`NewGravatar`或`UpdateGravatar`事件。 ### 3. 编写你的子图 前面的命令将创建一个脚手架,你可以从那里建立你的子图。在对子图进行修改时,你将主要处理三个文件。 - 清单(subgraph.yaml)--该清单定义了你的子图将索引哪些数据源 -- 模式(schema.graphql)--GraphQL模式定义了你希望从子图中检索到的数据。 -- AssemblyScript映射(mapping.ts)--这是将数据源中的数据转换为模式中定义的实体的代码。 +- 模式(schema.graphql)--GraphQL 模式定义了你希望从子图中检索到的数据。 +- AssemblyScript 映射(mapping.ts)--这是将数据源中的数据转换为模式中定义的实体的代码。 关于如何编写子图的更多信息,请参见 [创建子图](/developer/create-subgraph-hosted) ### 4. 部署你的子图 -- 使用你的github账户登录 [托管服务](https://thegraph.com/hosted-service/) -- 点击添加子图,并填写所需信息。使用与第2步中相同的子图名称。 -- 在子图文件夹中运行codegen +- 使用你的 github 账户登录 [托管服务](https://thegraph.com/hosted-service/) +- 点击添加子图,并填写所需信息。使用与第 2 步中相同的子图名称。 +- 在子图文件夹中运行 codegen ```sh # NPM @@ -178,7 +178,7 @@ $ graph deploy --product hosted-service / ### 5. 检查你的日志 -日志应该告诉你是否有任何错误。如果你的子图失败了,你可以通过使用 [GraphiQL Playground](https://graphiql-online.com/)查询子图的健康状况。使用[这个端点](https://api.thegraph.com/index-node/graphql)。注意,你可以利用下面的查询,输入你的子图的部署ID。在这种情况下,`Qm...` 是部署ID(可以在子图页面的**详细信息**下找到)。下面的查询将告诉你,当一个子图失败时,你可以相应地进行调试。 +日志应该告诉你是否有任何错误。如果你的子图失败了,你可以通过使用 [GraphiQL Playground](https://graphiql-online.com/)查询子图的健康状况。使用[这个端点](https://api.thegraph.com/index-node/graphql)。注意,你可以利用下面的查询,输入你的子图的部署 ID。在这种情况下,`Qm...` 是部署 ID(可以在子图页面的**详细信息**下找到)。下面的查询将告诉你,当一个子图失败时,你可以相应地进行调试。 ```sh { diff --git a/pages/zh/explorer.mdx b/pages/zh/explorer.mdx index 85698d600f9e..af72c5557ff9 100644 --- a/pages/zh/explorer.mdx +++ b/pages/zh/explorer.mdx @@ -11,7 +11,7 @@ title: 浏览器 title="YouTube video player" frameBorder="0" allowFullScreen -> + > ## 子图 diff --git a/pages/zh/hosted-service/deploy-subgraph-hosted.mdx b/pages/zh/hosted-service/deploy-subgraph-hosted.mdx index 5fe5ccacae0e..a96ba8932172 100644 --- a/pages/zh/hosted-service/deploy-subgraph-hosted.mdx +++ b/pages/zh/hosted-service/deploy-subgraph-hosted.mdx @@ -26,9 +26,9 @@ title: 将子图部署到托管服务上 **描述** - 子图的描述,在子图详细信息页面上可见。 -**GitHub URL** - 存储在GitHub 上的子图代码的链接。 +**GitHub URL** - 存储在 GitHub 上的子图代码的链接。 -**隐藏** - 打开此选项可隐藏Graph Explorer中的子图。 +**隐藏** - 打开此选项可隐藏 Graph Explorer 中的子图。 保存新子图后,您会看到一个屏幕,其中包含有关如何安装 Graph CLI、如何为新子图生成脚手架以及如何部署子图的帮助信息。 前面两部分在[定义子图](/developer/define-subgraph-hosted)中进行了介绍。 @@ -38,19 +38,19 @@ title: 将子图部署到托管服务上 您可以通过运行 `yarn deploy`来部署子图。 -部署子图后,Graph Explorer将切换到显示子图的同步状态。 根据需要从历史以太坊区块中提取的数据量和事件数量的不同,从创世区块开始,同步操作可能需要几分钟到几个小时。 一旦 Graph节点从历史区块中提取了所有数据,子图状态就会切换到`Synced`。 当新的以太坊区块出现时,Graph节点将继续按照子图的要求检查这些区块的信息。 +部署子图后,Graph Explorer 将切换到显示子图的同步状态。 根据需要从历史以太坊区块中提取的数据量和事件数量的不同,从创世区块开始,同步操作可能需要几分钟到几个小时。 一旦 Graph 节点从历史区块中提取了所有数据,子图状态就会切换到`Synced`。 当新的以太坊区块出现时,Graph 节点将继续按照子图的要求检查这些区块的信息。 ## 重新部署子图 -更改子图定义后,例如:修复实体映射中的一个问题,再次运行上面的 `yarn deploy` 命令可以部署新版本的子图。 子图的任何更新都需要Graph节点再次从创世块开始重新索引您的整个子图。 +更改子图定义后,例如:修复实体映射中的一个问题,再次运行上面的 `yarn deploy` 命令可以部署新版本的子图。 子图的任何更新都需要 Graph 节点再次从创世块开始重新索引您的整个子图。 -如果您之前部署的子图仍处于`Syncing`状态,系统则会立即将其替换为新部署的版本。 如果之前部署的子图已经完全同步,Graph节点会将新部署的版本标记为`Pending Version`,在后台进行同步,只有在新版本同步完成后,才会用新的版本替换当前部署的版本。 这样做可以确保在新版本同步时您仍然有子图可以使用。 +如果您之前部署的子图仍处于`Syncing`状态,系统则会立即将其替换为新部署的版本。 如果之前部署的子图已经完全同步,Graph 节点会将新部署的版本标记为`Pending Version`,在后台进行同步,只有在新版本同步完成后,才会用新的版本替换当前部署的版本。 这样做可以确保在新版本同步时您仍然有子图可以使用。 ### 将子图部署到多个以太坊网络 在某些情况下,您可能希望将相同的子图部署到多个以太坊网络,而无需复制其所有代码。 这样做的主要挑战是这些网络上的合约地址不同。 允许参数化合约地址等配置的一种解决方案是使用 [Mustache](https://mustache.github.io/)或 [Handlebars](https://handlebarsjs.com/)等模板系统。 -为了说明这种方法,我们假设使用不同的合约地址将子图部署到主网和 Ropsten上。 您可以定义两个配置文件,为每个网络提供相应的地址: +为了说明这种方法,我们假设使用不同的合约地址将子图部署到主网和 Ropsten 上。 您可以定义两个配置文件,为每个网络提供相应的地址: ```json { @@ -151,10 +151,10 @@ Graph 节点公开了一个 graphql 端点,您可以通过查询该端点来 ## 子图归档策略 -托管服务是一个免费的Graph节点索引器。 开发人员可以部署索引一系列网络的子图,这些网络将被索引,并可以通过 graphQL 进行查询。 +托管服务是一个免费的 Graph 节点索引器。 开发人员可以部署索引一系列网络的子图,这些网络将被索引,并可以通过 graphQL 进行查询。 为了提高活跃子图的服务性能,托管服务将归档不活跃的子图。 **如果一个子图在 45 天前部署到托管服务,并且在过去 30 天内收到 0 个查询,则将其定义为“不活跃”。** -如果开发人员的一个子图被标记为不活跃,并将 7 天后被删除,托管服务会通过电子邮件通知开发者。 如果他们希望“激活”他们的子图,他们可以通过在其子图的托管服务 graphQL playground中发起查询来实现。 如果再次需要使用这个子图,开发人员也可以随时重新部署存档的子图。 +如果开发人员的一个子图被标记为不活跃,并将 7 天后被删除,托管服务会通过电子邮件通知开发者。 如果他们希望“激活”他们的子图,他们可以通过在其子图的托管服务 graphQL playground 中发起查询来实现。 如果再次需要使用这个子图,开发人员也可以随时重新部署存档的子图。 diff --git a/pages/zh/hosted-service/migrating-subgraph.mdx b/pages/zh/hosted-service/migrating-subgraph.mdx index 979d684faeed..771d7f46f7af 100644 --- a/pages/zh/hosted-service/migrating-subgraph.mdx +++ b/pages/zh/hosted-service/migrating-subgraph.mdx @@ -142,7 +142,7 @@ If you're still confused, fear not! Check out the following resources or watch o title="YouTube video player" frameBorder="0" allowFullScreen -> + > - [The Graph Network Contracts](https://github.com/graphprotocol/contracts) diff --git a/pages/zh/indexing.mdx b/pages/zh/indexing.mdx index 75f434302a48..1a08e70528e3 100644 --- a/pages/zh/indexing.mdx +++ b/pages/zh/indexing.mdx @@ -60,7 +60,7 @@ query indexerAllocations { } ``` -使用Etherscan调用 `getRewards()`: +使用 Etherscan 调用 `getRewards()`: - 导航到[奖励合约的 Etherscan 界面](https://etherscan.io/address/0x9Ac758AB77733b4150A901ebd659cbF8cB93ED66#readProxyContract) @@ -115,11 +115,11 @@ query indexerAllocations { - **大型** -准备对当前使用的所有子图进行索引,并为相关流量的请求提供服务 | 类型 | (CPU 数量) | (内存 GB) | (硬盘 TB) | (CPU 数量) | (内存 GB) | -| -- |:--------:|:-------:|:-------:|:--------:|:-------:| -| 小型 | 4 | 8 | 1 | 4 | 16 | -| 标准 | 8 | 30 | 1 | 12 | 48 | -| 中型 | 16 | 64 | 2 | 32 | 64 | -| 大型 | 72 | 468 | 3.5 | 48 | 184 | +| ---- | :--------: | :-------: | :-------: | :--------: | :-------: | +| 小型 | 4 | 8 | 1 | 4 | 16 | +| 标准 | 8 | 30 | 1 | 12 | 48 | +| 中型 | 16 | 64 | 2 | 32 | 64 | +| 大型 | 72 | 468 | 3.5 | 48 | 184 | ### 索引人应该采取哪些基本的安全防范措施? @@ -129,13 +129,13 @@ query indexerAllocations { ## 基础设施 -索引人基础设施的中心是Graph节点,它监控以太坊,根据子图定义提取和加载数据,并将其作为[GraphQL API](/about/introduction#how-the-graph-works)提供。 The Graph节点需要连接到以太坊EVM节点端点,以及用于获取数据的IPFS节点;一个用于存储的PostgreSQL数据库;以及促进其与网络互动的索引人组件。 +索引人基础设施的中心是 Graph 节点,它监控以太坊,根据子图定义提取和加载数据,并将其作为[GraphQL API](/about/introduction#how-the-graph-works)提供。 The Graph 节点需要连接到以太坊 EVM 节点端点,以及用于获取数据的 IPFS 节点;一个用于存储的 PostgreSQL 数据库;以及促进其与网络互动的索引人组件。 - **PostgreSQL 数据库** - Graph 节点的主要存储,这是存储子图数据的地方。 索引人服务和代理也使用数据库来存储状态通道数据、成本模型和索引规则。 - **Ethereum endpoint** -公开 Ethereum JSON-RPC API 的端点。 这可能采取单个 Ethereum 客户端的形式,也可能是一个更复杂的设置,在多个客户端之间进行负载平衡。 需要注意的是,某些子图将需要特定的 Ethereum 客户端功能,如存档模式和跟踪 API。 -- **IPFS 节点(版本小于 5** - 子图部署元数据存储在 IPFS 网络上。 The Graph节点在子图部署期间主要访问IPFS节点,以获取子图清单和所有链接文件。 网络索引人不需要托管自己的IPFS节点,网络的IPFS节点是托管在https://ipfs.network.thegraph.com。 +- **IPFS 节点(版本小于 5** - 子图部署元数据存储在 IPFS 网络上。 The Graph 节点在子图部署期间主要访问 IPFS 节点,以获取子图清单和所有链接文件。 网络索引人不需要托管自己的 IPFS 节点,网络的 IPFS 节点是托管在https://ipfs.network.thegraph.com。 - **索引人服务** -处理与网络的所有必要的外部通信。 共享成本模型和索引状态,将来自网关的查询请求传递给一个 Graph 节点,并通过状态通道与网关管理查询支付。 @@ -151,26 +151,26 @@ query indexerAllocations { #### Graph 节点 -| 端口 | 用途 | 路径 | CLI参数 | 环境 变量 | -| ---- | ------------------------------------ | ------------------------------------------------------------------- | ----------------- | ----- | -| 8000 | GraphQL HTTP 服务
(用于子图查询) | /subgraphs/id/...

/subgraphs/name/.../... | --http-port | - | -| 8001 | GraphQL WS
(用于子图订阅) | /subgraphs/id/...

/subgraphs/name/.../... | --ws-port | - | -| 8020 | JSON-RPC
(用于管理部署) | / | --admin-port | - | -| 8030 | 子图索引状态 API | /graphql | --index-node-port | - | -| 8040 | Prometheus 指标 | /metrics | --metrics-port | - | +| 端口 | 用途 | 路径 | CLI 参数 | 环境 变量 | +| --- | --- | --- | --- | --- | +| 8000 | GraphQL HTTP 服务
(用于子图查询) | /subgraphs/id/...

/subgraphs/name/.../... | --http-port | - | +| 8001 | GraphQL WS
(用于子图订阅) | /subgraphs/id/...

/subgraphs/name/.../... | --ws-port | - | +| 8020 | JSON-RPC
(用于管理部署) | / | --admin-port | - | +| 8030 | 子图索引状态 API | /graphql | --index-node-port | - | +| 8040 | Prometheus 指标 | /metrics | --metrics-port | - | #### 索引人服务 -| 端口 | 用途 | 路径 | CLI参数 | 环境 变量 | -| ---- | -------------------------------------- | --------------------------------------------------------------------------- | -------------- | ---------------------- | -| 7600 | GraphQL HTTP 服务
(用于付费子图查询) | /subgraphs/id/...
/status
/channel-messages-inbox | --port | `INDEXER_SERVICE_PORT` | -| 7300 | Prometheus 指标 | /metrics | --metrics-port | - | +| 端口 | 用途 | 路径 | CLI 参数 | 环境 变量 | +| --- | --- | --- | --- | --- | +| 7600 | GraphQL HTTP 服务
(用于付费子图查询) | /subgraphs/id/...
/status
/channel-messages-inbox | --port | `INDEXER_SERVICE_PORT` | +| 7300 | Prometheus 指标 | /metrics | --metrics-port | - | #### 索引人代理 -| 端口 | 用途 | 路径 | CLI参数 | 环境
变量 | -| ---- | --------- | -- | ------------------------- | --------------------------------------- | -| 8000 | 索引人管理 API | / | --indexer-management-port | `INDEXER_AGENT_INDEXER_MANAGEMENT_PORT` | +| 端口 | 用途 | 路径 | CLI 参数 | 环境
变量 | +| ---- | -------------- | ---- | ------------------------- | --------------------------------------- | +| 8000 | 索引人管理 API | / | --indexer-management-port | `INDEXER_AGENT_INDEXER_MANAGEMENT_PORT` | ### Google Cloud 上使用 Terraform 建立基础架构 @@ -517,7 +517,7 @@ graph-indexer-service start \ #### 索引人 CLI -Indexer CLI是一个可以在终端访问`graph indexer`的插件,地址是[`@graphprotocol/graph-cli`](https://www.npmjs.com/package/@graphprotocol/graph-cli)。 +Indexer CLI 是一个可以在终端访问`graph indexer`的插件,地址是[`@graphprotocol/graph-cli`](https://www.npmjs.com/package/@graphprotocol/graph-cli)。 ```sh graph indexer connect http://localhost:18000 @@ -600,7 +600,7 @@ default => 0.1 * $SYSTEM_LOAD; 成本模型示例: -| 询问 | 价格 | +| 询问 | 价格 | | ---------------------------------------------------------------------------- | ------- | | { pairs(skip: 5000) { id } } | 0.5 GRT | | { tokens { symbol } } | 0.1 GRT | diff --git a/pages/zh/studio/billing.mdx b/pages/zh/studio/billing.mdx index ce99acd65775..cd0a7ff142e0 100644 --- a/pages/zh/studio/billing.mdx +++ b/pages/zh/studio/billing.mdx @@ -4,40 +4,40 @@ title: 子图工作室的计费 ### 概述 -发票是客户所欠付款金额的报表,通常在系统中每周生成一次。 你需要根据你使用API密钥产生的查询费用来支付费用。 账单合同在[Polygon](https://polygon.technology/)网络上。 它将允许你: +发票是客户所欠付款金额的报表,通常在系统中每周生成一次。 你需要根据你使用 API 密钥产生的查询费用来支付费用。 账单合同在[Polygon](https://polygon.technology/)网络上。 它将允许你: -- 添加和移除GRT -- 根据你向你的账户添加了多少GRT,你移除了多少,以及你的发票来跟踪你的余额。 +- 添加和移除 GRT +- 根据你向你的账户添加了多少 GRT,你移除了多少,以及你的发票来跟踪你的余额。 - 根据产生的查询费用自动结算付款 -为了将GRT添加到你的账户中,你将需要通过以下步骤: +为了将 GRT 添加到你的账户中,你将需要通过以下步骤: -1. 在您选择的交易所购买GRT和ETH -2. 将GRT和ETH发送到你的钱包里 -3. 使用用户界面桥接GRT到Polygon +1. 在您选择的交易所购买 GRT 和 ETH +2. 将 GRT 和 ETH 发送到你的钱包里 +3. 使用用户界面桥接 GRT 到 Polygon - a) 在你向Polygon桥发送任何数量的GRT后,你将在几分钟内收到0.001 Matic。 你可以在搜索栏中输入你的地址,在 [Polygonscan](https://polygonscan.com/)上跟踪交易情况。 + a) 在你向 Polygon 桥发送任何数量的 GRT 后,你将在几分钟内收到 0.001 Matic。 你可以在搜索栏中输入你的地址,在 [Polygonscan](https://polygonscan.com/)上跟踪交易情况。 -4. 在Polygon的计费合同中加入桥接的GRT。 计费合同地址是:[0x10829DB618E6F520Fa3A01c75bC6dDf8722fA9fE](https://polygonscan.com/address/0x10829DB618E6F520Fa3A01c75bC6dDf8722fA9fE). +4. 在 Polygon 的计费合同中加入桥接的 GRT。 计费合同地址是:[0x10829DB618E6F520Fa3A01c75bC6dDf8722fA9fE](https://polygonscan.com/address/0x10829DB618E6F520Fa3A01c75bC6dDf8722fA9fE). - a) 为了完成第4步,你需要将钱包中的网络切换到Polygon。 你可以通过连接你的钱包并点击[这里](https://chainlist.org/) 的 "选择Matic(Polygon)主网 "来添加Polygon的网络。一旦你添加了网络,在你的钱包里通过导航到右上角的网络图标来切换它。 在Metamask中,该网络被称为 **Matic Mainnnet.** + a) 为了完成第 4 步,你需要将钱包中的网络切换到 Polygon。 你可以通过连接你的钱包并点击[这里](https://chainlist.org/) 的 "选择 Matic(Polygon)主网 "来添加 Polygon 的网络。一旦你添加了网络,在你的钱包里通过导航到右上角的网络图标来切换它。 在 Metamask 中,该网络被称为 **Matic Mainnnet.** -在每个周末,如果你使用了你的API密钥,你将会收到一张基于你在这期间产生的查询费用的发票。 这张发票将用你余额中的GRT来支付。 查询量是由你拥有的API密钥来评估的。 你的余额将在费用提取后被更新。 +在每个周末,如果你使用了你的 API 密钥,你将会收到一张基于你在这期间产生的查询费用的发票。 这张发票将用你余额中的 GRT 来支付。 查询量是由你拥有的 API 密钥来评估的。 你的余额将在费用提取后被更新。 #### 下面是你如何进行开票的过程: -你的发票可以有4种状态: +你的发票可以有 4 种状态: 1. 创建--你的发票刚刚创建,还没有被支付 2. 已付 - 你的发票已成功支付 -3. 未支付 - 账单合同上你的余额中没有足够的GRT +3. 未支付 - 账单合同上你的余额中没有足够的 GRT 4. 错误 - 处理付款时出现了错误 **更多信息见下图:** ![Billing Flow](/img/billing-flow.png) -关于在Subgraph Studio上如何进行计费的快速演示,请看下面的视频。 +关于在 Subgraph Studio 上如何进行计费的快速演示,请看下面的视频。
+ >
### 多重签名用户 -多重合约是只能存在于它们所创建的网络上的智能合约,所以如果你在以太坊主网上创建了一个--它将只存在于主网上。 由于我们的账单使用Polygon,如果你将GRT桥接到Polygon的多符号地址上,资金就会丢失。 +多重合约是只能存在于它们所创建的网络上的智能合约,所以如果你在以太坊主网上创建了一个--它将只存在于主网上。 由于我们的账单使用 Polygon,如果你将 GRT 桥接到 Polygon 的多符号地址上,资金就会丢失。 -为了克服这个问题,我们创建了 [一个专门的工具](https://multisig-billing.thegraph.com/),它将帮助你用一个标准的钱包/EOA(一个由私钥控制的账户)在我们的计费合同上存入GRT(代表multisig)。 +为了克服这个问题,我们创建了 [一个专门的工具](https://multisig-billing.thegraph.com/),它将帮助你用一个标准的钱包/EOA(一个由私钥控制的账户)在我们的计费合同上存入 GRT(代表 multisig)。 -你可以在这里访问我们的Multisig计费工具:https://multisig-billing.thegraph.com/ +你可以在这里访问我们的 Multisig 计费工具:https://multisig-billing.thegraph.com/ 这个工具将指导你完成以下步骤: -1. 连接你的标准钱包/EOA(这个钱包需要拥有一些ETH以及你要存入的GRT)。 -2. 桥GRT到Polygon。 在交易完成后,你需要等待7-8分钟,以便最终完成桥梁转移。 -3. 一旦你的GRT在你的Polygon余额中可用,你就可以把它们存入账单合同,同时在`Multisig地址栏` 中指定你要资助的multisig地址。 +1. 连接你的标准钱包/EOA(这个钱包需要拥有一些 ETH 以及你要存入的 GRT)。 +2. 桥 GRT 到 Polygon。 在交易完成后,你需要等待 7-8 分钟,以便最终完成桥梁转移。 +3. 一旦你的 GRT 在你的 Polygon 余额中可用,你就可以把它们存入账单合同,同时在`Multisig地址栏` 中指定你要资助的 multisig 地址。 -一旦存款交易得到确认,你就可以回到 [Subgraph Studio](https://thegraph.com/studio/),并与你的Gnosis Safe Multisig连接,以创建API密钥并使用它们来生成查询。 +一旦存款交易得到确认,你就可以回到 [Subgraph Studio](https://thegraph.com/studio/),并与你的 Gnosis Safe Multisig 连接,以创建 API 密钥并使用它们来生成查询。 -这些查询将产生发票,这些发票将使用multisig的账单余额自动支付。 +这些查询将产生发票,这些发票将使用 multisig 的账单余额自动支付。 diff --git a/pages/zh/studio/deploy-subgraph-studio.mdx b/pages/zh/studio/deploy-subgraph-studio.mdx index 62f614ab7d15..a891904b2d05 100644 --- a/pages/zh/studio/deploy-subgraph-studio.mdx +++ b/pages/zh/studio/deploy-subgraph-studio.mdx @@ -4,22 +4,22 @@ title: 将一个子图部署到子图工作室 将一个子图部署到子图工作室是非常简单的。 你可以通过以下步骤完成: -- 安装Graph CLI(同时使用yarn和npm)。 +- 安装 Graph CLI(同时使用 yarn 和 npm)。 - 在子图工作室中创建你的子图 -- 从CLI认证你的账户 +- 从 CLI 认证你的账户 - 将一个子图部署到子图工作室 -## 安装Graph CLI +## 安装 Graph CLI -我们使用相同的CLI将子图部署到我们的 [托管服务](https://thegraph.com/hosted-service/) 和[Subgraph Studio](https://thegraph.com/studio/)中。 以下是安装graph-cli的命令。 这可以用npm或yarn来完成。 +我们使用相同的 CLI 将子图部署到我们的 [托管服务](https://thegraph.com/hosted-service/) 和[Subgraph Studio](https://thegraph.com/studio/)中。 以下是安装 graph-cli 的命令。 这可以用 npm 或 yarn 来完成。 -**用yarn安装:** +**用 yarn 安装:** ```bash yarn global add @graphprotocol/graph-cli ``` -**用npm安装:** +**用 npm 安装:** ```bash npm install -g @graphprotocol/graph-cli @@ -27,7 +27,7 @@ npm install -g @graphprotocol/graph-cli ## 在子图工作室中创建你的子图 -在部署你的实际子图之前,你需要在 [子图工作室](https://thegraph.com/studio/)中创建一个子图。 我们建议你阅读我们的[Studio文档](/studio/subgraph-studio)以了解更多这方面的信息。 +在部署你的实际子图之前,你需要在 [子图工作室](https://thegraph.com/studio/)中创建一个子图。 我们建议你阅读我们的[Studio 文档](/studio/subgraph-studio)以了解更多这方面的信息。 ## 初始化你的子图 @@ -37,17 +37,17 @@ npm install -g @graphprotocol/graph-cli graph init --studio ``` -``值可以在Subgraph Studio中你的子图详情页上找到。 +``值可以在 Subgraph Studio 中你的子图详情页上找到。 ![Subgraph Studio - Slug](/img/doc-subgraph-slug.png) -运行`graph init`后,你会被要求输入你想查询的合同地址、网络和abi。 这样做将在你的本地机器上生成一个新的文件夹,里面有一些基本代码,可以开始在你的子图上工作。 然后,你可以最终确定你的子图,以确保它按预期工作。 +运行`graph init`后,你会被要求输入你想查询的合同地址、网络和 abi。 这样做将在你的本地机器上生成一个新的文件夹,里面有一些基本代码,可以开始在你的子图上工作。 然后,你可以最终确定你的子图,以确保它按预期工作。 ## Graph 认证 -在能够将你的子图部署到子图工作室之前,你需要在CLI中登录到你的账户。 要做到这一点,你将需要你的部署密钥,你可以在你的 "我的子图 "页面或子图的详细信息页面上找到。 +在能够将你的子图部署到子图工作室之前,你需要在 CLI 中登录到你的账户。 要做到这一点,你将需要你的部署密钥,你可以在你的 "我的子图 "页面或子图的详细信息页面上找到。 -以下是你需要使用的命令,以从CLI进行认证: +以下是你需要使用的命令,以从 CLI 进行认证: ```bash graph auth --studio @@ -55,14 +55,14 @@ graph auth --studio ## 将一个子图部署到子图工作室 -一旦你准备好了,你可以将你的子图部署到子图工作室。 这样做不会将你的子图发布到去中心化的网络中,它只会将它部署到你的Studio账户中,在那里你将能够测试它并更新元数据。 +一旦你准备好了,你可以将你的子图部署到子图工作室。 这样做不会将你的子图发布到去中心化的网络中,它只会将它部署到你的 Studio 账户中,在那里你将能够测试它并更新元数据。 -这里是你需要使用的CLI命令,以部署你的子图。 +这里是你需要使用的 CLI 命令,以部署你的子图。 ```bash graph deploy --studio ``` -运行这个命令后,CLI会要求提供一个版本标签,你可以随意命名,你可以使用 `0.1`和 `0.2`这样的标签,或者也可以使用字母,如 `uniswap-v2-0.1` . 这些标签将在Graph Explorer中可见,并可由策展人用来决定是否要在这个版本上发出信号,所以要明智地选择它们。 +运行这个命令后,CLI 会要求提供一个版本标签,你可以随意命名,你可以使用 `0.1`和 `0.2`这样的标签,或者也可以使用字母,如 `uniswap-v2-0.1` . 这些标签将在 Graph Explorer 中可见,并可由策展人用来决定是否要在这个版本上发出信号,所以要明智地选择它们。 -一旦部署完毕,你可以在子图工作室中使用控制面板测试你的子图,如果需要的话,可以部署另一个版本,更新元数据,当你准备好后,将你的子图发布到Graph Explorer。 +一旦部署完毕,你可以在子图工作室中使用控制面板测试你的子图,如果需要的话,可以部署另一个版本,更新元数据,当你准备好后,将你的子图发布到 Graph Explorer。 diff --git a/pages/zh/studio/subgraph-studio.mdx b/pages/zh/studio/subgraph-studio.mdx index 9af3926db3df..e01de9f15305 100644 --- a/pages/zh/studio/subgraph-studio.mdx +++ b/pages/zh/studio/subgraph-studio.mdx @@ -73,7 +73,7 @@ You’ve made it this far - congrats! Publishing your subgraph means that an IPF title="YouTube video player" frameBorder="0" allowFullScreen -> + > Remember, while you’re going through your publishing flow, you’ll be able to push to either mainnet or Rinkeby, the testnet we support. If you’re a first time subgraph developer, we highly suggest you start with publishing to Rinkeby, which is free to do. This will allow you to see how the subgraph will work in The Graph Explorer and will allow you to test curation elements. diff --git a/pages/zh/supported-networks/near.mdx b/pages/zh/supported-networks/near.mdx index e5980fba4e95..352a54c0b3c4 100644 --- a/pages/zh/supported-networks/near.mdx +++ b/pages/zh/supported-networks/near.mdx @@ -2,17 +2,17 @@ title: 在 NEAR 上构建子图 --- -> Graph节点和托管服务中对NEAR 的支持目前处于测试阶段:任何有关构建 NEAR 子图的任何问题,请联系 near@thegraph.com! +> Graph 节点和托管服务中对 NEAR 的支持目前处于测试阶段:任何有关构建 NEAR 子图的任何问题,请联系 near@thegraph.com! -本指南介绍了如何在[NEAR区块链](https://docs.near.org/)上构建索引智能合约的子图。 +本指南介绍了如何在[NEAR 区块链](https://docs.near.org/)上构建索引智能合约的子图。 -## NEAR是什么? +## NEAR 是什么? [NEAR](https://near.org/) 是一个用于构建去中心化应用程序的智能合约平台。 请访问 [官方文档](https://docs.near.org/docs/concepts/new-to-near) 了解更多信息。 -## NEAR子图是什么? +## NEAR 子图是什么? -Graph 为开发人员提供了一种被称为子图的工具,利用这个工具,开发人员能够处理区块链事件,并通过 GraphQL API提供结果数据。 [Graph节点](https://github.com/graphprotocol/graph-node)现在能够处理 NEAR 事件,这意味着 NEAR 开发人员现在可以构建子图来索引他们的智能合约。 +Graph 为开发人员提供了一种被称为子图的工具,利用这个工具,开发人员能够处理区块链事件,并通过 GraphQL API 提供结果数据。 [Graph 节点](https://github.com/graphprotocol/graph-node)现在能够处理 NEAR 事件,这意味着 NEAR 开发人员现在可以构建子图来索引他们的智能合约。 子图是基于事件的,这意味着子图可以侦听并处理链上事件。 NEAR 子图目前支持两种类型的处理程序: @@ -21,15 +21,15 @@ Graph 为开发人员提供了一种被称为子图的工具,利用这个工 [NEAR 文档中](https://docs.near.org/docs/concepts/transaction#receipt): -> Receipt是系统中唯一可操作的对象。 当我们在 NEAR 平台上谈论“处理交易”时,这最终意味着在某个时候“应用收据”。 +> Receipt 是系统中唯一可操作的对象。 当我们在 NEAR 平台上谈论“处理交易”时,这最终意味着在某个时候“应用收据”。 -## 构建NEAR子图 +## 构建 NEAR 子图 `@graphprotocol/graph-cli`是一个用于构建和部署子图的命令行工具。 `@graphprotocol/graph-ts` 是子图特定类型的库。 -NEAR子图开发需要`0.23.0`以上版本的`graph-cli`,以及 `0.23.0`以上版本的`graph-ts`。 +NEAR 子图开发需要`0.23.0`以上版本的`graph-cli`,以及 `0.23.0`以上版本的`graph-ts`。 > 构建 NEAR 子图与构建索引以太坊的子图非常相似。 @@ -39,7 +39,7 @@ NEAR子图开发需要`0.23.0`以上版本的`graph-cli`,以及 `0.23.0`以上 **schema.graphql:** 一个模式文件,它定义为您的子图存储哪些数据,以及如何通过 GraphQL 查询它。 NEAR 子图的要求包含在 [现有文档](/developer/create-subgraph-hosted#the-graphql-schema)中。 -**AssemblyScript 映射:**将事件数据转换为模式文件中定义的实体的[AssemblyScript 代码](/developer/assemblyscript-api)。 NEAR 支持引入了 NEAR 特定的数据类型和新的JSON 解析功能。 +**AssemblyScript 映射:**将事件数据转换为模式文件中定义的实体的[AssemblyScript 代码](/developer/assemblyscript-api)。 NEAR 支持引入了 NEAR 特定的数据类型和新的 JSON 解析功能。 在子图开发过程中,有两个关键命令: @@ -50,7 +50,7 @@ $ graph build # 从 AssemblyScript 文件生成 Web Assembly,并在 /build 文 ### 子图清单定义 -子图清单(`subgraph.yaml`)标识子图的数据源、感兴趣的触发器以及响应这些触发器而运行的函数。 以下是一个NEAR 的子图清单的例子: +子图清单(`subgraph.yaml`)标识子图的数据源、感兴趣的触发器以及响应这些触发器而运行的函数。 以下是一个 NEAR 的子图清单的例子: ```yaml specVersion: 0.0.2