- Preselect default chain
- Preselect the source and destination token
- Preselect the appearance
- Prefill the amount of the source token
- Prefill the amount of the destination token
- Prefill the slippage configuration
- Allow or deny surplus feature
- Allow or deny specific liquidity sources
- Allow or deny specific chains
- Allow or deny specific tokens
- Specify the receiving address
- Specify the type of order -
BUY
orSELL
- Specify the partner fee
SDK configuration
The GlueX widget is built on top of our robust SDK, utilizing its core functionality to provide seamless integration and optimal performance. Thesdk
option allows you to configure various aspects of the underlying SDK directly within the widget configuration, ensuring that all SDK-level settings align with your application requirements.
User
TheuserId
field allows you to attach a unique user identifier to each request, enabling comprehensive tracking and analytics capabilities. This identifier helps you monitor user behavior, analyze transaction patterns, and provide personalized experiences. The user ID should be a consistent, unique string that identifies individual users across sessions
- Use consistent identifiers that persist across user sessions
- Ensure user IDs are unique and don’t contain sensitive information
- Consider using UUIDs or hashed values for enhanced privacy
- Implement proper user consent mechanisms for tracking where required by regulations
Referrer
The referrer field specifies the referrer address of the user for tracking and attribution purposes. This is particularly important for affiliate programs, partner integrations and revenue sharing models. The referrer address should be a valid addressReferral fee system is coming soon with advanced attribution and reward
mechanisms
- Ensure the referrer address is properly formatted and validated
- Use consistent referrer addresses for accurate attribution tracking
- Consider implementing dynamic referrer assignment based on user acquisition channels
- Document referrer relationships for transparent revenue sharing
RPC endpoints
Configure custom RPC endpoints for different blockchain networks to ensure reliable connectivity, optimal performance and reduced dependency on public infrastructure. Custom RPC configurations help maintain consistent service quality and avoid rate limiting issues that commonly affect public endpointsFor production deployments, always use your own authenticated RPC provider
(such as Alchemy, Infura, QuickNode, or Ankr). If custom RPC endpoints are not
specified, the widget defaults to public RPC endpoints, which may experience
rate limiting and cause issues like incorrect balance displays, failed
transactions, or degraded performance during high traffic periods
- Redundancy: Configure multiple RPC endpoints per chain for failover protection
- Monitoring: Implement RPC endpoint health monitoring and automatic failover
- Authentication: Use authenticated endpoints with proper API key management
- Geographic Distribution: Consider RPC provider locations relative to your user base for optimal latency
Explorer URLs
.. TBD ..Partner Fees
The partner fee system enables revenue generation through transaction based commissions. Thefees.partner
parameter allows you to configure partner fees for each transaction processed through the widget. The partner
field expects a value in basis points (bps), where 100 bps equals 1% of the transaction volume. The maximum allowed fee is 10% (1000 bps) to ensure reasonable cost structures for end users
To ensure partner fees are correctly collected and distributed, you must
specify the
payoutAddress
in your configuration. This address will receive
the accumulated fees for each transaction. Alternatively, you can configure
this address via the developer portal for
centralized management across multiple integrations- Fee Calculation: Fees are calculated as a percentage of the total transaction volume
- Fee Collection: Fees are automatically deducted during the swap process and distributed to the specified payout address within each transaction
- Transparency: Clearly communicate fee structures to end users for transparency and trust
Form Values
The widget provides comprehensive and flexible options for preconfiguring default values and dynamically updating parameters for chains, tokens, amounts, and addresses. This functionality makes it easy to set up and maintain desired swap parameters, creating seamless user experiences that can adapt to changing requirements and user preferencesConfiguration
The most straightforward approach is to preconfigure values directly in the widget configuration object during initialization. This method ensures consistent default values across all widget instances and provides a stable foundation for your application’s swap functionalityThe widget currently supports only swap operations. Therefore, you should
specify either fromChain or toChain, or set both to the same value
- Chain IDs: Use standard chain identifiers (1 for Ethereum, 137 for Polygon, etc.)
- Token Addresses: Must be valid ERC20 contract addresses with proper checksum formatting
- Amounts: Specify in token’s native decimal format (eg: for USDC with 6 decimals, 1000000 = 1 USDC)
- Addresses: All addresses must be valid Ethereum format with proper checksum encoding
Configuration Updates
The widget supports dynamic configuration updates after initialization, enabling real-time form value changes based on user interactions, market conditions or application state changes. This functionality is particularly valuable for applications using state management libraries like Redux, Zustand or React Context, allowing seamless integration with existing application architectures FormUpdateKey Mechanism TheformUpdateKey
is a critical component of the state management update system that triggers form re-rendering when configuration changes occur:
Redux Toolkit
Redux Toolkit
Zustand
Zustand
React Context
React Context
URL search params
To initialize form values in the widget using URL search parameters, you must ensure thatbuildUrl
is set to true
in the widget configuration. This feature enables deep linking, shareable swap configurations, and easy integration with web analytics and tracking systems
Parameter | Type | Description | Example |
---|---|---|---|
fromAmount | string | Source token amount in token’s decimal format | 1000000 (1 USDC) |
fromChain | string | Source blockchain ID | 1 (Ethereum) |
fromToken | string | Source token contract address | 0xA0b86a33... |
toAddress | string | Destination wallet address | 0x742d35Cc... |
toChain | string | Destination blockchain ID | 137 (Polygon) |
toToken | string | Destination token contract address | 0x2791Bca1... |
Configuration values take precedence over URL search parameters. If you want
URL parameters to control initial form values, ensure that
fromAmount
,
fromChain
, fromToken
, toAddress
, toChain
, toToken
, and other
relevant parameters are not defined in the widget configuration object. If
both configuration values and URL parameters are present, the widget will
overwrite URL parameters with configuration values and update the URL
accordingly- State Synchronization: Implement bidirectional sync between URL params and application state
- Parameter Validation: Validate all URL parameters before applying them to prevent invalid states
- Fallback Values: Provide sensible defaults for missing or invalid URL parameters
- SEO Optimization: Use descriptive URL structures for better search engine indexing
- Analytics Integration: Track URL parameter usage for user behavior analysis
Form Ref
The Form Reference method provides the most flexibility and granular control for programmatic manipulation of widget form values after initialization. This approach is ideal for building custom interfaces, creating advanced user experiences, or responding to complex user interactions and external system eventsExample.tsx
Allow and Deny Lists
The widget provides comprehensiveallow
and deny
configuration options to give you precise control over which chains, tokens and liquidity sources can be utilized within your application. These filtering mechanisms enable you to create curated experiences that align with your business requirements, regulatory constraints, and user safety considerations
Chains
Chain filtering allows you to restrict which blockchain networks are available to users, helping you focus on supported networksTokens
Token filtering provides granular control over which tokens are available for trading, enabling you to create curated token lists that match your platform’s focusFeatured Tokens
Create curated lists of featured tokens to guide users toward high quality, liquid trading pairs and improve the overall trading experienceLiquidity Sources
Control which liquidity sources and protocols are utilized for trade execution using themodulesFilter
parameter, enabling you to optimize for specific characteristics like gas efficiency, slippage, or execution speed
To get the most current list of supported modules and their identifiers, you
can visit the liquidity modules documentation
page or check the live module
registry
- Diversification: Use multiple sources to ensure route availability and competitive pricing
- Regular Updates: Keep module lists updated as new protocols launch and others become deprecated
- Reliability Focus: Prioritize well-established protocols with proven track records
Destination address
Developers can use thetoAddress
option to configure the destination address. The address property is required, while the name and logoURI properties are optional