SQS Query Client Configuration Options in Osmosis Agent Toolkit
The OsmosisSqsQueryClient accepts only one configuration option—the sqsUrl constructor argument—which defaults to the production Osmosis Sidecar Query Server endpoint at https://sqsprod.osmosis.zone.
The SQS query client configuration in the jonator/osmosis-agent-toolkit repository is intentionally minimal to ensure lightweight integration with the Osmosis Sidecar Query Server. The OsmosisSqsQueryClient class provides a streamlined interface for fetching swap quotes and price data, requiring only a single configuration parameter to customize the server endpoint.
Understanding the OsmosisSqsQueryClient
The OsmosisSqsQueryClient class serves as the primary interface for interacting with the Osmosis SQS API. Located in packages/core/src/queries/sqs/client.ts, this client handles HTTP request construction, query parameter injection, and response parsing for swap-related operations.
The class is designed with minimal configuration surface area, making it ideal for both production deployments and local development scenarios where endpoint customization is necessary.
Available SQS Query Client Configuration Options
The SQS query client configuration exposes only one adjustable parameter, keeping the implementation lightweight and predictable.
The sqsUrl Constructor Parameter
The sqsUrl parameter is the sole configuration option available when instantiating the client. It accepts a string representing the base URL of the Osmosis Sidecar Query Server.
- Default value:
https://sqsprod.osmosis.zone - Type:
string - Location: Constructor in
packages/core/src/queries/sqs/client.ts(lines 7-9)
You should provide a custom sqsUrl when connecting to testnet environments, staging servers, or self-hosted sidecar instances during local development.
Non-Configurable Internal Behavior
While not exposed as a configuration option, the client automatically appends humanDenoms=false to every request URL. This ensures denominations are returned in their minimal IBC form rather than human-readable symbols.
This behavior is hardcoded in the url() helper method at lines 50-55 of packages/core/src/queries/sqs/client.ts:
// Internal URL construction
url.searchParams.set('humanDenoms', 'false')
Practical Configuration Examples
The following examples demonstrate how to configure the SQS query client for different environments.
Using the Default Production Endpoint
To connect to the production Osmosis SQS without custom configuration, instantiate the client with no arguments:
import { OsmosisSqsQueryClient } from '@osmosis-toolkit/core/queries/sqs'
const sqs = new OsmosisSqsQueryClient()
// Uses default: https://sqsprod.osmosis.zone
Connecting to a Custom SQS Instance
For local development or testing against staging environments, pass your custom endpoint as the constructor argument:
import { OsmosisSqsQueryClient } from '@osmosis-toolkit/core/queries/sqs'
// Connect to local development server
const devSqs = new OsmosisSqsQueryClient('http://localhost:8000')
// Or connect to a staging environment
const stagingSqs = new OsmosisSqsQueryClient('https://sqs.staging.osmosis.zone')
Integration with OsmosisAgentToolkit
The OsmosisAgentToolkit class in packages/core/src/toolkit.ts demonstrates typical client instantiation within the broader toolkit architecture. While the toolkit may wrap the client, the configuration pattern remains identical—passing the sqsUrl through the constructor chain.
Core Query Methods
While configuration is minimal, the client provides three primary methods for interacting with the SQS API. These methods handle request construction internally and do not require additional configuration:
getOutGivenInQuote(tokenIn, tokenOutDenom)– Calculates the expected output amount given an input tokengetInGivenOutQuote(tokenOut, tokenInDenom)– Calculates the required input amount given a desired outputgetPrices(denoms)– Fetches current price data for specified denominations
All methods automatically inherit the sqsUrl and humanDenoms=false behavior configured at instantiation.
Summary
- The SQS query client configuration requires only the
sqsUrlconstructor parameter, defaulting tohttps://sqsprod.osmosis.zone - The
OsmosisSqsQueryClientclass is located inpackages/core/src/queries/sqs/client.ts - The client automatically sets
humanDenoms=falseon all requests to ensure IBC denomination formats - Custom endpoints support local development, testnets, and staging environments
- No additional configuration options exist for timeouts, retries, or request headers
Frequently Asked Questions
What is the default SQS endpoint used by OsmosisSqsQueryClient?
The default endpoint is https://sqsprod.osmosis.zone, which connects to the production Osmosis Sidecar Query Server. This value is hardcoded as the default constructor argument in packages/core/src/queries/sqs/client.ts.
Can I configure the humanDenoms parameter in SQS requests?
No, the humanDenoms parameter is not configurable. The client automatically sets humanDenoms=false on every request through the internal url() helper method. This ensures all token denominations are returned in their minimal IBC format rather than human-readable symbols.
How do I connect the SQS client to a local development server?
Pass your local server URL as the first argument to the constructor: new OsmosisSqsQueryClient('http://localhost:8000'). This overrides the default production endpoint and directs all queries to your specified local or staging environment.
Is there a way to configure timeout or retry behavior for SQS queries?
No, the OsmosisSqsQueryClient does not expose configuration options for request timeouts, retry logic, or HTTP headers. The client is intentionally lightweight, handling only the base URL configuration while relying on the underlying fetch implementation for network behavior.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →