From e7ed489e30731050a914ab55cbae48d8e59002c0 Mon Sep 17 00:00:00 2001 From: Karim <98668332+khadni@users.noreply.github.com> Date: Mon, 26 Jan 2026 19:21:11 -0500 Subject: [PATCH 1/3] encoding requirements and timeout field --- src/content/cre/llms-full-go.txt | 177 ++++++++++++++---- src/content/cre/llms-full-ts.txt | 144 ++++++++++---- .../cre/reference/sdk/http-client-go.mdx | 99 +++++++++- .../cre/reference/sdk/http-client-ts.mdx | 64 ++++++- 4 files changed, 389 insertions(+), 95 deletions(-) diff --git a/src/content/cre/llms-full-go.txt b/src/content/cre/llms-full-go.txt index eb4c1d565cd..55644e4d2c2 100644 --- a/src/content/cre/llms-full-go.txt +++ b/src/content/cre/llms-full-go.txt @@ -446,6 +446,12 @@ Last Updated: 2026-01-21 This page provides detailed release notes for CRE. It includes information on new features, significant changes, and known limitations. +## ZKSync Era Support - January 26, 2026 + +CRE now supports **ZKSync Era mainnet and testnet** for workflow simulation and production deployment. You can now build and test workflows that interact with ZKSync Era chains. + +See the [Supported Networks](/cre/guides/workflow/using-evm-client/supported-networks) page for chain names and forwarder addresses. + ## CLI v1.0.6 - January 21, 2026 **CRE CLI version 1.0.6 is now available.** @@ -6750,6 +6756,11 @@ The CLI will submit an onchain transaction to remove the address from the Workfl If you need to unlink a key but no longer have access to the original private key (for example, the key owner left your organization), you can still complete the unlinking process using a different wallet. + + + ### How it works When you run `cre account unlink-key --unsigned` while logged into your CRE organization, the CLI generates: @@ -6814,19 +6825,22 @@ When you run `cre account unlink-key --unsigned` while logged into your CRE orga Unlinked successfully ``` -3. **Submit the transaction** using any wallet that supports sending transactions with custom data. Here's an example using MetaMask: +3. **Submit the transaction** using any wallet that supports sending transactions with custom data. + + + + + Here's an example using MetaMask: + 1. In MetaMask, go to **Settings → Advanced** and enable **"Show hex data"** 2. Click **Send** and enter the contract address as the recipient 0x4Ac54353FA4Fa961AfcC5ec4B118596d3305E7e5 3. Set the amount to **0 ETH** 4. Paste the transaction data in the **Hex data** field (add `0x` prefix) 5. Review and confirm the transaction -The unlink operation completes once the transaction is confirmed onchain. All workflows registered under that address will be permanently deleted. - - - + The unlink operation completes once the transaction is confirmed onchain. All workflows registered under that address will be permanently deleted. ## Non-interactive mode @@ -11050,7 +11064,7 @@ This approach gives you IDE autocompletion, compile-time type checking, and elim # Supported Networks Source: https://docs.chain.link/cre/guides/workflow/using-evm-client/supported-networks-go -Last Updated: 2025-11-20 +Last Updated: 2026-01-22 This page lists the EVM-compatible networks supported by CRE workflows, along with their chain names (for configuration) and forwarder contract addresses (for consumer contract validation). @@ -11064,9 +11078,11 @@ This reference provides three key pieces of information for each network: ## Understanding Forwarder Addresses -Forwarder addresses are relevant **only if you want to add security validation to your consumer contracts**. Your workflow code does not interact with forwarders directly—the EVM capability handles report delivery automatically. Learn more: [Onchain Write Overview](/cre/guides/workflow/using-evm-client/onchain-write/overview-go). +Forwarder addresses identify the trusted Chainlink Forwarder contract that delivers verified workflow reports to your consumer contract. Your workflow code does not interact with forwarders directly—the EVM capability handles report delivery automatically. Learn more: [Onchain Write Overview](/cre/guides/workflow/using-evm-client/onchain-write/overview-go). -**Optional security layer**: You can configure your consumer contract's `onReport()` function to accept calls only from the trusted forwarder address. See [Configuring Permissions](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts#34-configuring-permissions) for implementation details. +**Using the [ReceiverTemplate](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts#3-using-receivertemplate) (recommended)**: If you use the [`ReceiverTemplate`](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts#receivertemplate), the forwarder address is **required** in the constructor. This ensures your contract only accepts reports from the trusted Chainlink Forwarder. + +**Custom implementations**: If you implement the `IReceiver` interface directly without using `ReceiverTemplate`, you control your own security checks. See [Building Consumer Contracts](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts) for details. ### Simulation vs Production Addresses @@ -11094,18 +11110,20 @@ These `MockKeystoneForwarder` addresses are used when running `cre workflow simu | Ethereum Mainnet | ethereum-mainnet | 0xa3d1ad4ac559a6575a114998affb2fb2ec97a7d9 | | OP Mainnet | ethereum-mainnet-optimism-1 | 0x9119a1501550ed94a3f2794038ed9258337afa18 | | Polygon | polygon-mainnet | 0xf458d621885e29a5003ea9bbba5280d54e19b1ce | +| ZKSync Era | ethereum-mainnet-zksync-1 | 0x6E9EE680ef59ef64Aa8C7371279c27E496b5eDc1 | ### Simulation Testnets -| Network | Chain Name | Mock Forwarder Address | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------ | -| Arbitrum Sepolia | ethereum-testnet-sepolia-arbitrum-1 | 0xd41263567ddfead91504199b8c6c87371e83ca5d | -| Avalanche Fuji | avalanche-testnet-fuji | 0x2e7371a5d032489e4f60216d8d898a4c10805963 | -| Base Sepolia | ethereum-testnet-sepolia-base-1 | 0x82300bd7c3958625581cc2f77bc6464dcecdf3e5 | -| BNB Chain Testnet | binance_smart_chain-testnet | 0xa238e42cb8782808dbb2f37e19859244ec4779b0 | -| Ethereum Sepolia | ethereum-testnet-sepolia | 0x15fC6ae953E024d975e77382eEeC56A9101f9F88 | -| OP Sepolia | ethereum-testnet-sepolia-optimism-1 | 0xa2888380dff3704a8ab6d1cd1a8f69c15fea5ee3 | -| Polygon Amoy | polygon-testnet-amoy | 0x3675a5eb2286a3f87e8278fc66edf458a2e3bb74 | +| Network | Chain Name | Mock Forwarder Address | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------ | +| Arbitrum Sepolia | ethereum-testnet-sepolia-arbitrum-1 | 0xd41263567ddfead91504199b8c6c87371e83ca5d | +| Avalanche Fuji | avalanche-testnet-fuji | 0x2e7371a5d032489e4f60216d8d898a4c10805963 | +| Base Sepolia | ethereum-testnet-sepolia-base-1 | 0x82300bd7c3958625581cc2f77bc6464dcecdf3e5 | +| BNB Chain Testnet | binance_smart_chain-testnet | 0xa238e42cb8782808dbb2f37e19859244ec4779b0 | +| Ethereum Sepolia | ethereum-testnet-sepolia | 0x15fC6ae953E024d975e77382eEeC56A9101f9F88 | +| OP Sepolia | ethereum-testnet-sepolia-optimism-1 | 0xa2888380dff3704a8ab6d1cd1a8f69c15fea5ee3 | +| Polygon Amoy | polygon-testnet-amoy | 0x3675a5eb2286a3f87e8278fc66edf458a2e3bb74 | +| ZKSync Era Sepolia | ethereum-testnet-sepolia-zksync-1 | 0x6E9EE680ef59ef64Aa8C7371279c27E496b5eDc1 | ## Production Forwarders @@ -11122,18 +11140,20 @@ These `KeystoneForwarder` addresses are used by deployed workflows. Use these ad | Ethereum Mainnet | ethereum-mainnet | 0x0b93082D9b3C7C97fAcd250082899BAcf3af3885 | | OP Mainnet | ethereum-mainnet-optimism-1 | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | | Polygon | polygon-mainnet | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| ZKSync Era | ethereum-mainnet-zksync-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | ### Testnets -| Network | Chain Name | Forwarder Address | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------ | -| Arbitrum Sepolia | ethereum-testnet-sepolia-arbitrum-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | -| Avalanche Fuji | avalanche-testnet-fuji | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | -| Base Sepolia | ethereum-testnet-sepolia-base-1 | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | -| BNB Chain Testnet | binance_smart_chain-testnet | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | -| Ethereum Sepolia | ethereum-testnet-sepolia | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | -| OP Sepolia | ethereum-testnet-sepolia-optimism-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | -| Polygon Amoy | polygon-testnet-amoy | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Network | Chain Name | Forwarder Address | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------ | +| Arbitrum Sepolia | ethereum-testnet-sepolia-arbitrum-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Avalanche Fuji | avalanche-testnet-fuji | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Base Sepolia | ethereum-testnet-sepolia-base-1 | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | +| BNB Chain Testnet | binance_smart_chain-testnet | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Ethereum Sepolia | ethereum-testnet-sepolia | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | +| OP Sepolia | ethereum-testnet-sepolia-optimism-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Polygon Amoy | polygon-testnet-amoy | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| ZKSync Era Sepolia | ethereum-testnet-sepolia-zksync-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | --- @@ -14334,7 +14354,7 @@ if err != nil { # SDK Reference: HTTP Client Source: https://docs.chain.link/cre/reference/sdk/http-client-go -Last Updated: 2025-12-16 +Last Updated: 2026-01-26 The HTTP Client lets you make requests to external APIs from your workflow. Each node in the DON executes the request independently, and the SDK uses consensus to provide a single, reliable result. @@ -14364,14 +14384,95 @@ Defines the parameters for an outgoing HTTP request. HTTP requests to URLs that return redirects (3xx status codes) will fail. Ensure the URL you provide is the final destination and does not redirect to another URL. -| Field | Type | Description | -| --------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| `Url` | `string` | The URL of the API endpoint. | -| `Method` | `string` | The HTTP method (e.g., `"GET"`, `"POST"`). | -| `Headers` | `map[string]string` | Optional HTTP headers. | -| `Body` | `[]byte` | Optional raw request body. | -| `Timeout` | `*durationpb.Duration` | Optional request timeout duration. Set using `durationpb.New()`, e.g., `durationpb.New(30 * time.Second)` for 30 seconds. | -| `CacheSettings` | `*CacheSettings` | Optional caching behavior for the request. | +| Field | Type | Description | +| --------------- | ---------------------- | -------------------------------------------------------------------------------------------------------- | +| `Url` | `string` | The URL of the API endpoint. | +| `Method` | `string` | The HTTP method (e.g., `"GET"`, `"POST"`). | +| `Headers` | `map[string]string` | Optional HTTP headers. | +| `Body` | `[]byte` | Optional raw request body. | +| `Timeout` | `*durationpb.Duration` | Optional request timeout. See [Request Timeout](#request-timeout) below for usage, defaults, and limits. | +| `CacheSettings` | `*CacheSettings` | Optional caching behavior for the request. | + +### Request Timeout + +The `Timeout` field specifies how long to wait for an HTTP request to complete before cancelling it. + +**Format:** + +- Use `*durationpb.Duration` from the [`google.golang.org/protobuf/types/known/durationpb` package](google.golang.org/protobuf/types/known/durationpb) +- Create using `durationpb.New()` with a `time.Duration` value +- Or manually construct with `&durationpb.Duration{Seconds: int64}` + +**Default and Limits:** + +- **Default**: If not specified, a default timeout of **5 seconds** is applied. +- **Maximum**: Default maximum is **10 seconds**. Requests exceeding this limit will error. + +**Pattern 1: Using `durationpb.New()`:** + +```go +import ( + "time" + "google.golang.org/protobuf/types/known/durationpb" +) + +resp, err := sendRequester.SendRequest(&http.Request{ + Url: config.ApiUrl, + Method: "GET", + Timeout: durationpb.New(8 * time.Second), // 8 second timeout +}).Await() +``` + +**Pattern 2: Parsing from config:** + +```go +import ( + "time" + "fmt" + "google.golang.org/protobuf/types/known/durationpb" +) + +type Config struct { + ApiUrl string `yaml:"apiUrl"` + TimeoutMs string `yaml:"timeout"` // e.g., "5s", "10s" +} + +func fetchData(config *Config, logger *slog.Logger, sendRequester *http.SendRequester) (string, error) { + // Parse duration string from config + t, err := time.ParseDuration(config.TimeoutMs) + if err != nil { + return "", fmt.Errorf("failed to parse duration (%s): %w", config.TimeoutMs, err) + } + + logger.Info("parsed timeout", "seconds", t.Seconds(), "raw", config.TimeoutMs) + + // Create Duration from parsed time + timeout := &durationpb.Duration{ + Seconds: int64(t.Seconds()), + } + + resp, err := sendRequester.SendRequest(&http.Request{ + Url: config.ApiUrl, + Method: "GET", + Timeout: timeout, + }).Await() + + if err != nil { + logger.Info("http request failed", "error", err) + return "", err + } + + return string(resp.Body), nil +} +``` + +**Example configuration:** + +```yaml +# config.yaml +apiUrl: "https://api.example.com/data" +timeout: "8s" # Go's time.ParseDuration format (max: 10s) +``` ### `http.Response` @@ -15217,4 +15318,4 @@ You have successfully run the Custom Data Feed demo workflow. To understand how - **How are the Cron and EVM Log events handled?** Learn how to use different event sources to start your workflow in the **[Using Triggers](/cre/guides/workflow/using-triggers/overview)** guides. - **How does it fetch API data?** The demo uses the `http.Client` to fetch offchain reserve data. Learn more in the **[API Interactions](/cre/guides/workflow/using-http-client)** guide. - **How does it read from or write to the blockchain?** It uses the `evm.Client` for all onchain interactions. See the [**EVM Chain Interactions**](/cre/guides/workflow/using-evm-client/overview) guides for details. -- **How does it use a contract binding?** The demo uses pre-built bindings to interact with the contracts safely. Learn how to create your own in the **[Generating Bindings](/cre/guides/workflow/using-evm-client/generating-bindings)** guide. \ No newline at end of file +- **How does it use a contract binding?** The demo uses pre-built bindings to interact with the contracts safely. Learn how to create your own in the **[Generating Bindings](/cre/guides/workflow/using-evm-client/generating-bindings)** guide. diff --git a/src/content/cre/llms-full-ts.txt b/src/content/cre/llms-full-ts.txt index 112a02d2357..8b73a0ed263 100644 --- a/src/content/cre/llms-full-ts.txt +++ b/src/content/cre/llms-full-ts.txt @@ -446,6 +446,12 @@ Last Updated: 2026-01-21 This page provides detailed release notes for CRE. It includes information on new features, significant changes, and known limitations. +## ZKSync Era Support - January 26, 2026 + +CRE now supports **ZKSync Era mainnet and testnet** for workflow simulation and production deployment. You can now build and test workflows that interact with ZKSync Era chains. + +See the [Supported Networks](/cre/guides/workflow/using-evm-client/supported-networks) page for chain names and forwarder addresses. + ## CLI v1.0.6 - January 21, 2026 **CRE CLI version 1.0.6 is now available.** @@ -5673,6 +5679,11 @@ The CLI will submit an onchain transaction to remove the address from the Workfl If you need to unlink a key but no longer have access to the original private key (for example, the key owner left your organization), you can still complete the unlinking process using a different wallet. + + + ### How it works When you run `cre account unlink-key --unsigned` while logged into your CRE organization, the CLI generates: @@ -5737,19 +5748,22 @@ When you run `cre account unlink-key --unsigned` while logged into your CRE orga Unlinked successfully ``` -3. **Submit the transaction** using any wallet that supports sending transactions with custom data. Here's an example using MetaMask: +3. **Submit the transaction** using any wallet that supports sending transactions with custom data. + + + + + Here's an example using MetaMask: + 1. In MetaMask, go to **Settings → Advanced** and enable **"Show hex data"** 2. Click **Send** and enter the contract address as the recipient 0x4Ac54353FA4Fa961AfcC5ec4B118596d3305E7e5 3. Set the amount to **0 ETH** 4. Paste the transaction data in the **Hex data** field (add `0x` prefix) 5. Review and confirm the transaction -The unlink operation completes once the transaction is confirmed onchain. All workflows registered under that address will be permanently deleted. - - - + The unlink operation completes once the transaction is confirmed onchain. All workflows registered under that address will be permanently deleted. ## Non-interactive mode @@ -9813,7 +9827,7 @@ This approach gives you the flexibility of direct ABI handling with the type saf # Supported Networks Source: https://docs.chain.link/cre/guides/workflow/using-evm-client/supported-networks-ts -Last Updated: 2025-11-20 +Last Updated: 2026-01-22 This page lists the EVM-compatible networks supported by CRE workflows, along with their chain names (for configuration) and forwarder contract addresses (for consumer contract validation). @@ -9823,13 +9837,15 @@ This reference provides three key pieces of information for each network: 1. **Network Name**: The human-readable network identifier (click to view the forwarder contract on the block explorer) 2. **Chain Name**: The value to use in your [`project.yaml`](/cre/reference/project-configuration-ts#31-global-configuration-projectyaml) configuration and [EVM Client code](/cre/reference/sdk/evm-client-ts#chain-selectors) -3. **Forwarder Address**: The contract address for optional consumer contract validation (click to copy) +3. **Forwarder Address**: The contract address for optional consumer contract validation ## Understanding Forwarder Addresses -Forwarder addresses are relevant **only if you want to add security validation to your consumer contracts**. Your workflow code does not interact with forwarders directly—the EVM capability handles report delivery automatically. Learn more: [Onchain Write Overview](/cre/guides/workflow/using-evm-client/onchain-write/overview-ts). +Forwarder addresses identify the trusted Chainlink Forwarder contract that delivers verified workflow reports to your consumer contract. Your workflow code does not interact with forwarders directly—the EVM capability handles report delivery automatically. Learn more: [Onchain Write Overview](/cre/guides/workflow/using-evm-client/onchain-write/overview-ts). -**Optional security layer**: You can configure your consumer contract's `onReport()` function to accept calls only from the trusted forwarder address. See [Configuring Permissions](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts#34-configuring-permissions) for implementation details. +**Using the [ReceiverTemplate](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts#3-using-receivertemplate) (recommended)**: If you use the [`ReceiverTemplate`](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts#receivertemplate), the forwarder address is **required** in the constructor. This ensures your contract only accepts reports from the trusted Chainlink Forwarder. + +**Custom implementations**: If you implement the `IReceiver` interface directly without using `ReceiverTemplate`, you control your own security checks. See [Building Consumer Contracts](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts) for details. ### Simulation vs Production Addresses @@ -9857,18 +9873,20 @@ These `MockKeystoneForwarder` addresses are used when running `cre workflow simu | Ethereum Mainnet | ethereum-mainnet | 0xa3d1ad4ac559a6575a114998affb2fb2ec97a7d9 | | OP Mainnet | ethereum-mainnet-optimism-1 | 0x9119a1501550ed94a3f2794038ed9258337afa18 | | Polygon | polygon-mainnet | 0xf458d621885e29a5003ea9bbba5280d54e19b1ce | +| ZKSync Era | ethereum-mainnet-zksync-1 | 0x6E9EE680ef59ef64Aa8C7371279c27E496b5eDc1 | ### Simulation Testnets -| Network | Chain Name | Mock Forwarder Address | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------ | -| Arbitrum Sepolia | ethereum-testnet-sepolia-arbitrum-1 | 0xd41263567ddfead91504199b8c6c87371e83ca5d | -| Avalanche Fuji | avalanche-testnet-fuji | 0x2e7371a5d032489e4f60216d8d898a4c10805963 | -| Base Sepolia | ethereum-testnet-sepolia-base-1 | 0x82300bd7c3958625581cc2f77bc6464dcecdf3e5 | -| BSC Testnet | binance_smart_chain-testnet | 0xa238e42cb8782808dbb2f37e19859244ec4779b0 | -| Ethereum Sepolia | ethereum-testnet-sepolia | 0x15fC6ae953E024d975e77382eEeC56A9101f9F88 | -| OP Sepolia | ethereum-testnet-sepolia-optimism-1 | 0xa2888380dff3704a8ab6d1cd1a8f69c15fea5ee3 | -| Polygon Amoy | polygon-testnet-amoy | 0x3675a5eb2286a3f87e8278fc66edf458a2e3bb74 | +| Network | Chain Name | Mock Forwarder Address | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------ | +| Arbitrum Sepolia | ethereum-testnet-sepolia-arbitrum-1 | 0xd41263567ddfead91504199b8c6c87371e83ca5d | +| Avalanche Fuji | avalanche-testnet-fuji | 0x2e7371a5d032489e4f60216d8d898a4c10805963 | +| Base Sepolia | ethereum-testnet-sepolia-base-1 | 0x82300bd7c3958625581cc2f77bc6464dcecdf3e5 | +| BSC Testnet | binance_smart_chain-testnet | 0xa238e42cb8782808dbb2f37e19859244ec4779b0 | +| Ethereum Sepolia | ethereum-testnet-sepolia | 0x15fC6ae953E024d975e77382eEeC56A9101f9F88 | +| OP Sepolia | ethereum-testnet-sepolia-optimism-1 | 0xa2888380dff3704a8ab6d1cd1a8f69c15fea5ee3 | +| Polygon Amoy | polygon-testnet-amoy | 0x3675a5eb2286a3f87e8278fc66edf458a2e3bb74 | +| ZKSync Era Sepolia | ethereum-testnet-sepolia-zksync-1 | 0x6E9EE680ef59ef64Aa8C7371279c27E496b5eDc1 | ## Production Forwarders @@ -9885,18 +9903,20 @@ These `KeystoneForwarder` addresses are used by deployed workflows. Use these ad | Ethereum Mainnet | ethereum-mainnet | 0x0b93082D9b3C7C97fAcd250082899BAcf3af3885 | | OP Mainnet | ethereum-mainnet-optimism-1 | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | | Polygon | polygon-mainnet | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| ZKSync Era | ethereum-mainnet-zksync-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | ### Testnets -| Network | Chain Name | Forwarder Address | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------ | -| Arbitrum Sepolia | ethereum-testnet-sepolia-arbitrum-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | -| Avalanche Fuji | avalanche-testnet-fuji | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | -| Base Sepolia | ethereum-testnet-sepolia-base-1 | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | -| BSC Testnet | binance_smart_chain-testnet | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | -| Ethereum Sepolia | ethereum-testnet-sepolia | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | -| OP Sepolia | ethereum-testnet-sepolia-optimism-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | -| Polygon Amoy | polygon-testnet-amoy | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Network | Chain Name | Forwarder Address | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------ | +| Arbitrum Sepolia | ethereum-testnet-sepolia-arbitrum-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Avalanche Fuji | avalanche-testnet-fuji | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Base Sepolia | ethereum-testnet-sepolia-base-1 | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | +| BSC Testnet | binance_smart_chain-testnet | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Ethereum Sepolia | ethereum-testnet-sepolia | 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 | +| OP Sepolia | ethereum-testnet-sepolia-optimism-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| Polygon Amoy | polygon-testnet-amoy | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | +| ZKSync Era Sepolia | ethereum-testnet-sepolia-zksync-1 | 0x76c9cf548b4179F8901cda1f8623568b58215E62 | --- @@ -14176,7 +14196,7 @@ const evmClient = new EVMClient(network.chainSelector.selector) # SDK Reference: HTTP Client Source: https://docs.chain.link/cre/reference/sdk/http-client-ts -Last Updated: 2026-01-20 +Last Updated: 2026-01-26 This page provides a reference for making offchain HTTP requests using the `HTTPClient`. This is a "node-level" action capability, meaning it executes on each individual node in the DON. @@ -14560,14 +14580,60 @@ Defines the parameters for an outgoing HTTP request. HTTP requests to URLs that return redirects (3xx status codes) will fail. Ensure the URL you provide is the final destination and does not redirect to another URL. -| Field | Type | Description | -| --------------- | ------------------------------------------------- | --------------------------------------------------------------- | -| `url` | `string` | The URL of the API endpoint. | -| `method` | `string` (optional) | The HTTP method (e.g., `"GET"`, `"POST"`). Defaults to `"GET"`. | -| `headers` | `{ [key: string]: string }` (optional) | Optional HTTP headers. | -| `body` | `string` (base64-encoded) (optional) | Optional raw request body (must be base64-encoded). | -| `timeoutMs` | `number` (optional) | Optional request timeout in milliseconds. | -| `cacheSettings` | `CacheSettings` \| `CacheSettingsJson` (optional) | Optional caching behavior for the request. | +| Field | Type | Description | +| --------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| `url` | `string` | The URL of the API endpoint. | +| `method` | `string` (optional) | The HTTP method (e.g., `"GET"`, `"POST"`). Defaults to `"GET"`. | +| `headers` | `{ [key: string]: string }` (optional) | Optional HTTP headers. | +| `body` | `string` (base64-encoded) (optional) | Optional raw request body (must be base64-encoded). | +| `timeout` | `string` (optional) | Request timeout as a duration string (e.g., `"30s"`, `"5s"`). See [Request Timeout](#request-timeout) below for details. | +| `cacheSettings` | `CacheSettings` \| `CacheSettingsJson` (optional) | Optional caching behavior for the request. | + +### Request Timeout + +The `timeout` field specifies how long to wait for an HTTP request to complete before cancelling it. + +**Format:** + +- Specify timeout as a string ending with `"s"` (seconds) +- Examples: `"5s"` (5 seconds), `"8s"` (8 seconds), `"3.5s"` (3.5 seconds) + + + + +**Default and Limits:** + +- **Default**: If not specified, a default timeout of **5 seconds** is applied +- **Maximum**: Default maximum is **10 seconds**. Requests exceeding this limit will error + +**Example:** + +```typescript +type Config = { + apiUrl: string + requestTimeout: string +} + +const httpClient = new HTTPClient() + +const req = { + method: "GET", + url: config.apiUrl, + timeout: config.requestTimeout, // e.g., "8s" +} + +const response = httpClient.sendRequest(nodeRuntime, req).result() +``` + +**Example configuration:** + +```yaml +# config.yaml +apiUrl: "https://api.example.com/data" +requestTimeout: "8s" # Max: 10s +``` ### `CacheSettings` / `CacheSettingsJson` @@ -15799,4 +15865,4 @@ You have successfully run the Custom Data Feed demo workflow. To understand how - **How are the Cron and EVM Log events handled?** Learn how to use different event sources to start your workflow in the **[Using Triggers](/cre/guides/workflow/using-triggers/overview)** guides. - **How does it fetch API data?** The demo uses the `HTTPClient` to fetch offchain reserve data. Learn more in the **[API Interactions](/cre/guides/workflow/using-http-client)** guide. - **How does it read from or write to the blockchain?** It uses the `EVMClient` for all onchain interactions. See the [**EVM Chain Interactions**](/cre/guides/workflow/using-evm-client/overview) guides for details. -- **How does it work with contract ABIs?** The demo uses pre-defined TypeScript ABI files with viem. Learn more in the **[Onchain Read](/cre/guides/workflow/using-evm-client/onchain-read)** guide. \ No newline at end of file +- **How does it work with contract ABIs?** The demo uses pre-defined TypeScript ABI files with viem. Learn more in the **[Onchain Read](/cre/guides/workflow/using-evm-client/onchain-read)** guide. diff --git a/src/content/cre/reference/sdk/http-client-go.mdx b/src/content/cre/reference/sdk/http-client-go.mdx index 1206717a54e..bc465158613 100644 --- a/src/content/cre/reference/sdk/http-client-go.mdx +++ b/src/content/cre/reference/sdk/http-client-go.mdx @@ -7,7 +7,7 @@ pageId: "reference-sdk-http-client" metadata: description: "Reference for Go HTTP Client: complete API for GET/POST requests, headers, authentication, and consensus aggregation methods." datePublished: "2025-11-04" - lastModified: "2025-12-16" + lastModified: "2026-01-26" --- import { Aside } from "@components" @@ -40,14 +40,95 @@ Defines the parameters for an outgoing HTTP request. HTTP requests to URLs that return redirects (3xx status codes) will fail. Ensure the URL you provide is the final destination and does not redirect to another URL. -|
Field
|
Type
| Description | -| -------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| `Url` | `string` | The URL of the API endpoint. | -| `Method` | `string` | The HTTP method (e.g., `"GET"`, `"POST"`). | -| `Headers` | `map[string]string` | Optional HTTP headers. | -| `Body` | `[]byte` | Optional raw request body. | -| `Timeout` | `*durationpb.Duration` | Optional request timeout duration. Set using `durationpb.New()`, e.g., `durationpb.New(30 * time.Second)` for 30 seconds. | -| `CacheSettings` | `*CacheSettings` | Optional caching behavior for the request. | +|
Field
|
Type
| Description | +| -------------------------------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `Url` | `string` | The URL of the API endpoint. | +| `Method` | `string` | The HTTP method (e.g., `"GET"`, `"POST"`). | +| `Headers` | `map[string]string` | Optional HTTP headers. | +| `Body` | `[]byte` | Optional raw request body. | +| `Timeout` | `*durationpb.Duration` | Optional request timeout. See [Request Timeout](#request-timeout) below for usage, defaults, and limits. | +| `CacheSettings` | `*CacheSettings` | Optional caching behavior for the request. | + +### Request Timeout + +The `Timeout` field specifies how long to wait for an HTTP request to complete before cancelling it. + +**Format:** + +- Use `*durationpb.Duration` from the [`google.golang.org/protobuf/types/known/durationpb` package](google.golang.org/protobuf/types/known/durationpb) +- Create using `durationpb.New()` with a `time.Duration` value +- Or manually construct with `&durationpb.Duration{Seconds: int64}` + +**Default and Limits:** + +- **Default**: If not specified, a default timeout of **5 seconds** is applied. +- **Maximum**: Default maximum is **10 seconds**. Requests exceeding this limit will error. + +**Pattern 1: Using `durationpb.New()`:** + +```go +import ( + "time" + "google.golang.org/protobuf/types/known/durationpb" +) + +resp, err := sendRequester.SendRequest(&http.Request{ + Url: config.ApiUrl, + Method: "GET", + Timeout: durationpb.New(8 * time.Second), // 8 second timeout +}).Await() +``` + +**Pattern 2: Parsing from config:** + +```go +import ( + "time" + "fmt" + "google.golang.org/protobuf/types/known/durationpb" +) + +type Config struct { + ApiUrl string `yaml:"apiUrl"` + TimeoutMs string `yaml:"timeout"` // e.g., "5s", "10s" +} + +func fetchData(config *Config, logger *slog.Logger, sendRequester *http.SendRequester) (string, error) { + // Parse duration string from config + t, err := time.ParseDuration(config.TimeoutMs) + if err != nil { + return "", fmt.Errorf("failed to parse duration (%s): %w", config.TimeoutMs, err) + } + + logger.Info("parsed timeout", "seconds", t.Seconds(), "raw", config.TimeoutMs) + + // Create Duration from parsed time + timeout := &durationpb.Duration{ + Seconds: int64(t.Seconds()), + } + + resp, err := sendRequester.SendRequest(&http.Request{ + Url: config.ApiUrl, + Method: "GET", + Timeout: timeout, + }).Await() + + if err != nil { + logger.Info("http request failed", "error", err) + return "", err + } + + return string(resp.Body), nil +} +``` + +**Example configuration:** + +```yaml +# config.yaml +apiUrl: "https://api.example.com/data" +timeout: "8s" # Go's time.ParseDuration format (max: 10s) +``` ### `http.Response` diff --git a/src/content/cre/reference/sdk/http-client-ts.mdx b/src/content/cre/reference/sdk/http-client-ts.mdx index f81d90ad6cb..282d86ac12e 100644 --- a/src/content/cre/reference/sdk/http-client-ts.mdx +++ b/src/content/cre/reference/sdk/http-client-ts.mdx @@ -7,7 +7,7 @@ pageId: "reference-sdk-http-client" metadata: description: "Reference for TypeScript HTTP Client: complete API for GET/POST requests, headers, authentication, and consensus aggregation." datePublished: "2025-11-04" - lastModified: "2026-01-20" + lastModified: "2026-01-26" --- import { Aside } from "@components" @@ -394,14 +394,60 @@ Defines the parameters for an outgoing HTTP request. HTTP requests to URLs that return redirects (3xx status codes) will fail. Ensure the URL you provide is the final destination and does not redirect to another URL. -| Field | Type | Description | -| --------------- | ------------------------------------------------- | --------------------------------------------------------------- | -| `url` | `string` | The URL of the API endpoint. | -| `method` | `string` (optional) | The HTTP method (e.g., `"GET"`, `"POST"`). Defaults to `"GET"`. | -| `headers` | `{ [key: string]: string }` (optional) | Optional HTTP headers. | -| `body` | `string` (base64-encoded) (optional) | Optional raw request body (must be base64-encoded). | -| `timeoutMs` | `number` (optional) | Optional request timeout in milliseconds. | -| `cacheSettings` | `CacheSettings` \| `CacheSettingsJson` (optional) | Optional caching behavior for the request. | +| Field | Type | Description | +| --------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| `url` | `string` | The URL of the API endpoint. | +| `method` | `string` (optional) | The HTTP method (e.g., `"GET"`, `"POST"`). Defaults to `"GET"`. | +| `headers` | `{ [key: string]: string }` (optional) | Optional HTTP headers. | +| `body` | `string` (base64-encoded) (optional) | Optional raw request body (must be base64-encoded). | +| `timeout` | `string` (optional) | Request timeout as a duration string (e.g., `"30s"`, `"5s"`). See [Request Timeout](#request-timeout) below for details. | +| `cacheSettings` | `CacheSettings` \| `CacheSettingsJson` (optional) | Optional caching behavior for the request. | + +### Request Timeout + +The `timeout` field specifies how long to wait for an HTTP request to complete before cancelling it. + +**Format:** + +- Specify timeout as a string ending with `"s"` (seconds) +- Examples: `"5s"` (5 seconds), `"8s"` (8 seconds), `"3.5s"` (3.5 seconds) + +{/* prettier-ignore */} + + +**Default and Limits:** + +- **Default**: If not specified, a default timeout of **5 seconds** is applied +- **Maximum**: Default maximum is **10 seconds**. Requests exceeding this limit will error + +**Example:** + +```typescript +type Config = { + apiUrl: string + requestTimeout: string +} + +const httpClient = new HTTPClient() + +const req = { + method: "GET", + url: config.apiUrl, + timeout: config.requestTimeout, // e.g., "8s" +} + +const response = httpClient.sendRequest(nodeRuntime, req).result() +``` + +**Example configuration:** + +```yaml +# config.yaml +apiUrl: "https://api.example.com/data" +requestTimeout: "8s" # Max: 10s +``` ### `CacheSettings` / `CacheSettingsJson` From 80a34d396efa15b6fdb9e3d46c4ecc2c6acf2a51 Mon Sep 17 00:00:00 2001 From: Karim <98668332+khadni@users.noreply.github.com> Date: Mon, 26 Jan 2026 19:29:31 -0500 Subject: [PATCH 2/3] encoding requirements and timeout field --- src/content/cre/llms-full-ts.txt | 16 ++++++++-------- src/content/cre/reference/sdk/http-client-ts.mdx | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/content/cre/llms-full-ts.txt b/src/content/cre/llms-full-ts.txt index 8b73a0ed263..7988b255793 100644 --- a/src/content/cre/llms-full-ts.txt +++ b/src/content/cre/llms-full-ts.txt @@ -14580,14 +14580,14 @@ Defines the parameters for an outgoing HTTP request. HTTP requests to URLs that return redirects (3xx status codes) will fail. Ensure the URL you provide is the final destination and does not redirect to another URL. -| Field | Type | Description | -| --------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | -| `url` | `string` | The URL of the API endpoint. | -| `method` | `string` (optional) | The HTTP method (e.g., `"GET"`, `"POST"`). Defaults to `"GET"`. | -| `headers` | `{ [key: string]: string }` (optional) | Optional HTTP headers. | -| `body` | `string` (base64-encoded) (optional) | Optional raw request body (must be base64-encoded). | -| `timeout` | `string` (optional) | Request timeout as a duration string (e.g., `"30s"`, `"5s"`). See [Request Timeout](#request-timeout) below for details. | -| `cacheSettings` | `CacheSettings` \| `CacheSettingsJson` (optional) | Optional caching behavior for the request. | +| Field | Type | Description | +| --------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `url` | `string` | The URL of the API endpoint. | +| `method` | `string` (optional) | The HTTP method (e.g., `"GET"`, `"POST"`). Defaults to `"GET"`. | +| `headers` | `{ [key: string]: string }` (optional) | Optional HTTP headers. | +| `body` | `string` (base64-encoded) (optional) | Optional raw request body (must be base64-encoded). | +| `timeout` | `string` (optional) | Request timeout as a duration string (e.g., `"5s"`, `"8s"`). See [Request Timeout](#request-timeout) below for details. | +| `cacheSettings` | `CacheSettings` \| `CacheSettingsJson` (optional) | Optional caching behavior for the request. | ### Request Timeout diff --git a/src/content/cre/reference/sdk/http-client-ts.mdx b/src/content/cre/reference/sdk/http-client-ts.mdx index 282d86ac12e..1506ca5bfe9 100644 --- a/src/content/cre/reference/sdk/http-client-ts.mdx +++ b/src/content/cre/reference/sdk/http-client-ts.mdx @@ -394,14 +394,14 @@ Defines the parameters for an outgoing HTTP request. HTTP requests to URLs that return redirects (3xx status codes) will fail. Ensure the URL you provide is the final destination and does not redirect to another URL. -| Field | Type | Description | -| --------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | -| `url` | `string` | The URL of the API endpoint. | -| `method` | `string` (optional) | The HTTP method (e.g., `"GET"`, `"POST"`). Defaults to `"GET"`. | -| `headers` | `{ [key: string]: string }` (optional) | Optional HTTP headers. | -| `body` | `string` (base64-encoded) (optional) | Optional raw request body (must be base64-encoded). | -| `timeout` | `string` (optional) | Request timeout as a duration string (e.g., `"30s"`, `"5s"`). See [Request Timeout](#request-timeout) below for details. | -| `cacheSettings` | `CacheSettings` \| `CacheSettingsJson` (optional) | Optional caching behavior for the request. | +| Field | Type | Description | +| --------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `url` | `string` | The URL of the API endpoint. | +| `method` | `string` (optional) | The HTTP method (e.g., `"GET"`, `"POST"`). Defaults to `"GET"`. | +| `headers` | `{ [key: string]: string }` (optional) | Optional HTTP headers. | +| `body` | `string` (base64-encoded) (optional) | Optional raw request body (must be base64-encoded). | +| `timeout` | `string` (optional) | Request timeout as a duration string (e.g., `"5s"`, `"8s"`). See [Request Timeout](#request-timeout) below for details. | +| `cacheSettings` | `CacheSettings` \| `CacheSettingsJson` (optional) | Optional caching behavior for the request. | ### Request Timeout From e6bf9cd2494ef19c8fda9779060ca9af1ddfa8ce Mon Sep 17 00:00:00 2001 From: Karim <98668332+khadni@users.noreply.github.com> Date: Mon, 26 Jan 2026 19:36:37 -0500 Subject: [PATCH 3/3] fix link --- src/content/cre/reference/sdk/http-client-go.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/cre/reference/sdk/http-client-go.mdx b/src/content/cre/reference/sdk/http-client-go.mdx index bc465158613..2db1b44cf90 100644 --- a/src/content/cre/reference/sdk/http-client-go.mdx +++ b/src/content/cre/reference/sdk/http-client-go.mdx @@ -55,7 +55,7 @@ The `Timeout` field specifies how long to wait for an HTTP request to complete b **Format:** -- Use `*durationpb.Duration` from the [`google.golang.org/protobuf/types/known/durationpb` package](google.golang.org/protobuf/types/known/durationpb) +- Use `*durationpb.Duration` from the [`google.golang.org/protobuf/types/known/durationpb` package](https://pkg.go.dev/google.golang.org/protobuf/types/known/durationpb) - Create using `durationpb.New()` with a `time.Duration` value - Or manually construct with `&durationpb.Duration{Seconds: int64}`