-
Notifications
You must be signed in to change notification settings - Fork 2
Description
User story
As a developer using the Centrifuge registry
I want RPC URL templates with variable substitution to be included in the registry chain configuration
So that apps can support new networks dynamically without requiring app releases, and can use any RPC provider that supports the network
Context
Currently, RPC URLs are hardcoded in the indexer's chains.ts file with specific providers (Alchemy and Quicknode). This creates a limitation where:
- Apps cannot dynamically support new networks based solely on registry data
- Support is restricted to a fixed set of RPC providers
- Adding new networks requires app releases
The registry cleanup removed an RPC URL field that was one of the original goals of the registry system. This field should be re-added with a templating approach to make it truly provider-independent.
Acceptance criteria
-
Given a chain configuration in the registry
When the registry includes RPC URL templates with variable placeholders (e.g.,https://{0}.bsc.quiknode.pro/{1}
Then the template format supports multiple variable substitution patterns -
Given an RPC URL template in the registry
When apps consume the registry data
Then they can substitute variables (like API names and keys) at runtime to construct valid RPC URLs -
Given the registry includes RPC URL templates
When a new network is added to the registry
Then apps can support that network without requiring a release, assuming one of the major RPC providers supports it -
Given the templating system supports variable arrays (e.g.,
[API_NAME, API_KEY])
When different providers use different variable naming conventions
Then consumers can map their own variable names to the template placeholders -
Given the registry structure is updated
When the indexer processes registry chains
Then it can extract and use the RPC URL templates from the registry instead of hardcoded values inchains.ts
Technical considerations
- Template format should support both positional placeholders (e.g.,
{0},{1}) - Consider backward compatibility with existing hardcoded RPC URLs during transition
- The templating engine should be simple enough for apps to implement without heavy dependencies
- Template variables should be passed as arrays or objects to allow flexible naming by consumers
Related files
src/chains.ts- Currently contains hardcoded RPC URLs in theendpointsobject (lines 90-124)generated/types.ts- Registry type definitions that may need to be updatedscripts/fetch-registry.mjs- Registry fetching script