From 2c670a76c5388fd5542883ada02514cc3a56ccfc Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Jan 2026 11:24:49 +0000 Subject: [PATCH 1/4] Update Node.js HyperSync examples to current syntax - Use `new HypersyncClient()` constructor instead of `HypersyncClient.new()` - Use `apiToken` parameter instead of `bearerToken` - Use `https://` URLs instead of `http://` - Use string field names (e.g., "Data", "Address") instead of enum references https://claude.ai/code/session_01JAAsE6JFJf2ZzESAetVVgk --- docs/HyperSync-LLM/hypersync-complete.mdx | 65 +++++++++++------------ docs/HyperSync/api-tokens.mdx | 2 +- docs/HyperSync/quickstart.md | 58 +++++++++----------- 3 files changed, 57 insertions(+), 68 deletions(-) diff --git a/docs/HyperSync-LLM/hypersync-complete.mdx b/docs/HyperSync-LLM/hypersync-complete.mdx index a303ae2c..cc3d9467 100644 --- a/docs/HyperSync-LLM/hypersync-complete.mdx +++ b/docs/HyperSync-LLM/hypersync-complete.mdx @@ -169,10 +169,11 @@ Let's look at the core concepts in the example code: ### 1. Initialize the Client ```javascript +import { HypersyncClient } from "@envio-dev/hypersync-client"; // Initialize Hypersync client -const client = HypersyncClient.new({ - url: "http://eth.hypersync.xyz", // Change this URL for different networks +const client = new HypersyncClient({ + url: "https://eth.hypersync.xyz", // Change this URL for different networks }); ``` @@ -194,15 +195,14 @@ let query = { fieldSelection: { // Only return fields we need log: [ - LogField.Data, - LogField.Address, - LogField.Topic0, - LogField.Topic1, - LogField.Topic2, - LogField.Topic3, + "Data", + "Address", + "Topic0", + "Topic1", + "Topic2", + "Topic3", ], }, - joinMode: JoinMode.JoinTransactions, // How to join related data }; ``` @@ -246,13 +246,13 @@ One of HyperSync's most powerful features is the ability to retrieve only the fi ```javascript fieldSelection: { // Block fields - block: [BlockField.Number, BlockField.Timestamp], + block: ["Number", "Timestamp"], // Log fields - log: [LogField.Address, LogField.Topic0, LogField.Data], + log: ["Address", "Topic0", "Data"], // Transaction fields - transaction: [TransactionField.From, TransactionField.To, TransactionField.Value], + transaction: ["From", "To", "Value"], } ``` @@ -274,12 +274,8 @@ HyperSync allows you to control how related data is joined: This example (from the quickstart repo) streams all Uniswap V3 events from the beginning of Ethereum: ```javascript - -import { - HypersyncClient, - LogField, - JoinMode, -} from "@envio-dev/hypersync-client"; +import { keccak256, toHex } from "viem"; +import { HypersyncClient } from "@envio-dev/hypersync-client"; // Define Uniswap V3 event signatures const event_signatures = [ @@ -294,8 +290,8 @@ const event_signatures = [ const topic0_list = event_signatures.map((sig) => keccak256(toHex(sig))); // Initialize Hypersync client -const client = HypersyncClient.new({ - url: "http://eth.hypersync.xyz", +const client = new HypersyncClient({ + url: "https://eth.hypersync.xyz", }); // Define query for Uniswap V3 events @@ -308,15 +304,14 @@ let query = { ], fieldSelection: { log: [ - LogField.Data, - LogField.Address, - LogField.Topic0, - LogField.Topic1, - LogField.Topic2, - LogField.Topic3, + "Data", + "Address", + "Topic0", + "Topic1", + "Topic2", + "Topic3", ], }, - joinMode: JoinMode.JoinTransactions, }; const main = async () => { @@ -335,13 +330,13 @@ HyperSync supports 70+ EVM-compatible networks. You can change networks by simpl ```javascript // Ethereum Mainnet -const client = HypersyncClient.new({ url: "http://eth.hypersync.xyz" }); +const client = new HypersyncClient({ url: "https://eth.hypersync.xyz" }); // Arbitrum -const client = HypersyncClient.new({ url: "http://arbitrum.hypersync.xyz" }); +const client = new HypersyncClient({ url: "https://arbitrum.hypersync.xyz" }); // Base -const client = HypersyncClient.new({ url: "http://base.hypersync.xyz" }); +const client = new HypersyncClient({ url: "https://base.hypersync.xyz" }); ``` See the Supported Networks page for a complete list. @@ -380,9 +375,9 @@ You're now ready to build with HyperSync! Here are some resources for diving dee For development, you can use HyperSync without an API token. For production applications, you'll need to get an API token and update your client initialization: ```javascript -const client = HypersyncClient.new({ - url: "http://eth.hypersync.xyz", - bearerToken: "your-api-token-here", +const client = new HypersyncClient({ + url: "https://eth.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, }); ``` @@ -1931,9 +1926,9 @@ To use an API token, pass it as a `bearer_token` when creating a HyperSync clien ```typescript -const client = HypersyncClient.new({ +const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", - bearerToken: process.env.HYPERSYNC_BEARER_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN, }); ``` diff --git a/docs/HyperSync/api-tokens.mdx b/docs/HyperSync/api-tokens.mdx index 091c4675..6137ae14 100644 --- a/docs/HyperSync/api-tokens.mdx +++ b/docs/HyperSync/api-tokens.mdx @@ -40,7 +40,7 @@ To use an API token, pass it as a `bearer_token` when creating a HyperSync clien ```typescript -const client = HypersyncClient.new({ +const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", apiToken: process.env.ENVIO_API_TOKEN!, }); diff --git a/docs/HyperSync/quickstart.md b/docs/HyperSync/quickstart.md index 547bd05d..fbfbf2a5 100644 --- a/docs/HyperSync/quickstart.md +++ b/docs/HyperSync/quickstart.md @@ -64,8 +64,8 @@ Let's look at the core concepts in the example code: import { HypersyncClient } from "@envio-dev/hypersync-client"; // Initialize Hypersync client -const client = HypersyncClient.new({ - url: "http://eth.hypersync.xyz", // Change this URL for different networks +const client = new HypersyncClient({ + url: "https://eth.hypersync.xyz", // Change this URL for different networks }); ``` @@ -87,15 +87,14 @@ let query = { fieldSelection: { // Only return fields we need log: [ - LogField.Data, - LogField.Address, - LogField.Topic0, - LogField.Topic1, - LogField.Topic2, - LogField.Topic3, + "Data", + "Address", + "Topic0", + "Topic1", + "Topic2", + "Topic3", ], }, - joinMode: JoinMode.JoinTransactions, // How to join related data }; ``` @@ -139,13 +138,13 @@ One of HyperSync's most powerful features is the ability to retrieve only the fi ```javascript fieldSelection: { // Block fields - block: [BlockField.Number, BlockField.Timestamp], + block: ["Number", "Timestamp"], // Log fields - log: [LogField.Address, LogField.Topic0, LogField.Data], + log: ["Address", "Topic0", "Data"], // Transaction fields - transaction: [TransactionField.From, TransactionField.To, TransactionField.Value], + transaction: ["From", "To", "Value"], } ``` @@ -168,11 +167,7 @@ This example (from the quickstart repo) streams all Uniswap V3 events from the b ```javascript import { keccak256, toHex } from "viem"; -import { - HypersyncClient, - LogField, - JoinMode, -} from "@envio-dev/hypersync-client"; +import { HypersyncClient } from "@envio-dev/hypersync-client"; // Define Uniswap V3 event signatures const event_signatures = [ @@ -187,8 +182,8 @@ const event_signatures = [ const topic0_list = event_signatures.map((sig) => keccak256(toHex(sig))); // Initialize Hypersync client -const client = HypersyncClient.new({ - url: "http://eth.hypersync.xyz", +const client = new HypersyncClient({ + url: "https://eth.hypersync.xyz", }); // Define query for Uniswap V3 events @@ -201,15 +196,14 @@ let query = { ], fieldSelection: { log: [ - LogField.Data, - LogField.Address, - LogField.Topic0, - LogField.Topic1, - LogField.Topic2, - LogField.Topic3, + "Data", + "Address", + "Topic0", + "Topic1", + "Topic2", + "Topic3", ], }, - joinMode: JoinMode.JoinTransactions, }; const main = async () => { @@ -228,13 +222,13 @@ HyperSync supports 70+ EVM-compatible networks. You can change networks by simpl ```javascript // Ethereum Mainnet -const client = HypersyncClient.new({ url: "http://eth.hypersync.xyz" }); +const client = new HypersyncClient({ url: "https://eth.hypersync.xyz" }); // Arbitrum -const client = HypersyncClient.new({ url: "http://arbitrum.hypersync.xyz" }); +const client = new HypersyncClient({ url: "https://arbitrum.hypersync.xyz" }); // Base -const client = HypersyncClient.new({ url: "http://base.hypersync.xyz" }); +const client = new HypersyncClient({ url: "https://base.hypersync.xyz" }); ``` See the [Supported Networks](/docs/HyperSync/hypersync-supported-networks) page for a complete list. @@ -273,9 +267,9 @@ You're now ready to build with HyperSync! Here are some resources for diving dee For development, you can use HyperSync without an API token. For production applications, you'll need to [get an API token](/docs/HyperSync/api-tokens) and update your client initialization: ```javascript -const client = HypersyncClient.new({ - url: "http://eth.hypersync.xyz", - bearerToken: "your-api-token-here", +const client = new HypersyncClient({ + url: "https://eth.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, }); ``` From 326908ee22280e27ac4ffaafc3a7210c591f0d35 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Jan 2026 12:25:41 +0000 Subject: [PATCH 2/4] Add required apiToken to all Node.js HyperSync client examples - apiToken is now required for all HyperSync client initializations - Updated all examples to include apiToken: process.env.ENVIO_API_TOKEN - Updated "API Token for Production Use" sections to reflect token is required https://claude.ai/code/session_01JAAsE6JFJf2ZzESAetVVgk --- docs/HyperSync-LLM/hypersync-complete.mdx | 28 +++++++++++++++-------- docs/HyperSync/quickstart.md | 28 +++++++++++++++-------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/docs/HyperSync-LLM/hypersync-complete.mdx b/docs/HyperSync-LLM/hypersync-complete.mdx index cc3d9467..63d9caff 100644 --- a/docs/HyperSync-LLM/hypersync-complete.mdx +++ b/docs/HyperSync-LLM/hypersync-complete.mdx @@ -174,6 +174,7 @@ import { HypersyncClient } from "@envio-dev/hypersync-client"; // Initialize Hypersync client const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", // Change this URL for different networks + apiToken: process.env.ENVIO_API_TOKEN, }); ``` @@ -292,6 +293,7 @@ const topic0_list = event_signatures.map((sig) => keccak256(toHex(sig))); // Initialize Hypersync client const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, }); // Define query for Uniswap V3 events @@ -330,13 +332,22 @@ HyperSync supports 70+ EVM-compatible networks. You can change networks by simpl ```javascript // Ethereum Mainnet -const client = new HypersyncClient({ url: "https://eth.hypersync.xyz" }); +const client = new HypersyncClient({ + url: "https://eth.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, +}); // Arbitrum -const client = new HypersyncClient({ url: "https://arbitrum.hypersync.xyz" }); +const client = new HypersyncClient({ + url: "https://arbitrum.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, +}); // Base -const client = new HypersyncClient({ url: "https://base.hypersync.xyz" }); +const client = new HypersyncClient({ + url: "https://base.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, +}); ``` See the Supported Networks page for a complete list. @@ -370,15 +381,12 @@ You're now ready to build with HyperSync! Here are some resources for diving dee - curl Examples - Test queries directly in your terminal - Complete Getting Started Guide - More comprehensive guidance -## API Token for Production Use +## API Token -For development, you can use HyperSync without an API token. For production applications, you'll need to get an API token and update your client initialization: +An API token is required to use HyperSync. Get an API token and set it as an environment variable: -```javascript -const client = new HypersyncClient({ - url: "https://eth.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, -}); +```bash +export ENVIO_API_TOKEN="your-api-token-here" ``` Congratulations! You've taken your first steps with HyperSync, bringing ultra-fast blockchain data access to your applications. Happy building! diff --git a/docs/HyperSync/quickstart.md b/docs/HyperSync/quickstart.md index fbfbf2a5..6ab1d200 100644 --- a/docs/HyperSync/quickstart.md +++ b/docs/HyperSync/quickstart.md @@ -66,6 +66,7 @@ import { HypersyncClient } from "@envio-dev/hypersync-client"; // Initialize Hypersync client const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", // Change this URL for different networks + apiToken: process.env.ENVIO_API_TOKEN, }); ``` @@ -184,6 +185,7 @@ const topic0_list = event_signatures.map((sig) => keccak256(toHex(sig))); // Initialize Hypersync client const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, }); // Define query for Uniswap V3 events @@ -222,13 +224,22 @@ HyperSync supports 70+ EVM-compatible networks. You can change networks by simpl ```javascript // Ethereum Mainnet -const client = new HypersyncClient({ url: "https://eth.hypersync.xyz" }); +const client = new HypersyncClient({ + url: "https://eth.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, +}); // Arbitrum -const client = new HypersyncClient({ url: "https://arbitrum.hypersync.xyz" }); +const client = new HypersyncClient({ + url: "https://arbitrum.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, +}); // Base -const client = new HypersyncClient({ url: "https://base.hypersync.xyz" }); +const client = new HypersyncClient({ + url: "https://base.hypersync.xyz", + apiToken: process.env.ENVIO_API_TOKEN, +}); ``` See the [Supported Networks](/docs/HyperSync/hypersync-supported-networks) page for a complete list. @@ -262,15 +273,12 @@ You're now ready to build with HyperSync! Here are some resources for diving dee - [curl Examples](/docs/HyperSync/hypersync-curl-examples) - Test queries directly in your terminal - [Complete Getting Started Guide](/docs/HyperSync/hypersync-usage) - More comprehensive guidance -## API Token for Production Use +## API Token -For development, you can use HyperSync without an API token. For production applications, you'll need to [get an API token](/docs/HyperSync/api-tokens) and update your client initialization: +An API token is required to use HyperSync. [Get an API token](/docs/HyperSync/api-tokens) and set it as an environment variable: -```javascript -const client = new HypersyncClient({ - url: "https://eth.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, -}); +```bash +export ENVIO_API_TOKEN="your-api-token-here" ``` Congratulations! You've taken your first steps with HyperSync, bringing ultra-fast blockchain data access to your applications. Happy building! From 9946ee5659e5da0923437fc8c73e759c53ea0ba2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Jan 2026 12:42:28 +0000 Subject: [PATCH 3/4] Add non-null assertion to apiToken in TypeScript example https://claude.ai/code/session_01JAAsE6JFJf2ZzESAetVVgk --- docs/HyperSync-LLM/hypersync-complete.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/HyperSync-LLM/hypersync-complete.mdx b/docs/HyperSync-LLM/hypersync-complete.mdx index 63d9caff..29df7746 100644 --- a/docs/HyperSync-LLM/hypersync-complete.mdx +++ b/docs/HyperSync-LLM/hypersync-complete.mdx @@ -1936,11 +1936,11 @@ To use an API token, pass it as a `bearer_token` when creating a HyperSync clien ```typescript const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); ``` - + ```python From c0daf242b3483608932411f90a6ee526c5456625 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Jan 2026 12:48:39 +0000 Subject: [PATCH 4/4] Add non-null assertion to all apiToken usages in TypeScript examples https://claude.ai/code/session_01JAAsE6JFJf2ZzESAetVVgk --- docs/HyperSync-LLM/hypersync-complete.mdx | 10 +++++----- docs/HyperSync/quickstart.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/HyperSync-LLM/hypersync-complete.mdx b/docs/HyperSync-LLM/hypersync-complete.mdx index 29df7746..2fec7122 100644 --- a/docs/HyperSync-LLM/hypersync-complete.mdx +++ b/docs/HyperSync-LLM/hypersync-complete.mdx @@ -174,7 +174,7 @@ import { HypersyncClient } from "@envio-dev/hypersync-client"; // Initialize Hypersync client const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", // Change this URL for different networks - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); ``` @@ -293,7 +293,7 @@ const topic0_list = event_signatures.map((sig) => keccak256(toHex(sig))); // Initialize Hypersync client const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); // Define query for Uniswap V3 events @@ -334,19 +334,19 @@ HyperSync supports 70+ EVM-compatible networks. You can change networks by simpl // Ethereum Mainnet const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); // Arbitrum const client = new HypersyncClient({ url: "https://arbitrum.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); // Base const client = new HypersyncClient({ url: "https://base.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); ``` diff --git a/docs/HyperSync/quickstart.md b/docs/HyperSync/quickstart.md index 6ab1d200..e59d936d 100644 --- a/docs/HyperSync/quickstart.md +++ b/docs/HyperSync/quickstart.md @@ -66,7 +66,7 @@ import { HypersyncClient } from "@envio-dev/hypersync-client"; // Initialize Hypersync client const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", // Change this URL for different networks - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); ``` @@ -185,7 +185,7 @@ const topic0_list = event_signatures.map((sig) => keccak256(toHex(sig))); // Initialize Hypersync client const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); // Define query for Uniswap V3 events @@ -226,19 +226,19 @@ HyperSync supports 70+ EVM-compatible networks. You can change networks by simpl // Ethereum Mainnet const client = new HypersyncClient({ url: "https://eth.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); // Arbitrum const client = new HypersyncClient({ url: "https://arbitrum.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); // Base const client = new HypersyncClient({ url: "https://base.hypersync.xyz", - apiToken: process.env.ENVIO_API_TOKEN, + apiToken: process.env.ENVIO_API_TOKEN!, }); ```