SettlementRegistry
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / SettlementRegistry
Class: SettlementRegistry
Section titled “Class: SettlementRegistry”Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4521
Settlement Backend Registry
Manages multiple settlement backends and provides route-based selection.
Example
Section titled “Example”const registry = new SettlementRegistry()
// Register backendsregistry.register(nearIntentsBackend)registry.register(zcashBackend)
// Get backend by nameconst backend = registry.get('near-intents')
// Find best backend for a routeconst bestBackend = registry.getBestForRoute('ethereum', 'solana')
// List all supported routesconst routes = registry.getSupportedRoutes()Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SettlementRegistry():
SettlementRegistry
Returns
Section titled “Returns”SettlementRegistry
Methods
Section titled “Methods”register()
Section titled “register()”register(
backend):void
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4534
Register a settlement backend
Parameters
Section titled “Parameters”backend
Section titled “backend”Settlement backend to register
Returns
Section titled “Returns”void
Throws
Section titled “Throws”If backend with same name already exists
Example
Section titled “Example”registry.register(nearIntentsBackend)get(
name):SettlementBackend
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4547
Get a settlement backend by name
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”Settlement backend
Throws
Section titled “Throws”If backend is not found
Example
Section titled “Example”const backend = registry.get('near-intents')list()
Section titled “list()”list():
string[]
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4559
List all registered backend names
Returns
Section titled “Returns”string[]
Array of backend names
Example
Section titled “Example”const names = registry.list()// ['near-intents', 'zcash', 'thorchain']getBestForRoute()
Section titled “getBestForRoute()”getBestForRoute(
fromChain,toChain):SettlementBackend
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4579
Get the best backend for a specific route
Selection criteria (in order of priority):
- Backends that support both source and destination chains
- Backends with faster average execution time
- First registered backend (if no execution time info)
Parameters
Section titled “Parameters”fromChain
Section titled “fromChain”Source chain
toChain
Section titled “toChain”Destination chain
Returns
Section titled “Returns”Best settlement backend for the route
Throws
Section titled “Throws”If no backend supports the route
Example
Section titled “Example”const backend = registry.getBestForRoute('ethereum', 'solana')const quote = await backend.getQuote({ ... })getSupportedRoutes()
Section titled “getSupportedRoutes()”getSupportedRoutes():
Route[]
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4596
Get all supported routes across all registered backends
Returns
Section titled “Returns”Route[]
Array of supported routes
Example
Section titled “Example”const routes = registry.getSupportedRoutes()// [// { fromChain: 'ethereum', toChain: 'solana', backend: 'near-intents' },// { fromChain: 'solana', toChain: 'ethereum', backend: 'near-intents' },// { fromChain: 'ethereum', toChain: 'zcash', backend: 'zcash' },// ...// ]has(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4610
Check if a backend is registered
Parameters
Section titled “Parameters”string
Backend name
Returns
Section titled “Returns”boolean
True if backend is registered
Example
Section titled “Example”if (registry.has('near-intents')) { const backend = registry.get('near-intents')}unregister()
Section titled “unregister()”unregister(
name):boolean
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4622
Unregister a settlement backend
Parameters
Section titled “Parameters”string
Backend name to unregister
Returns
Section titled “Returns”boolean
True if backend was unregistered, false if not found
Example
Section titled “Example”registry.unregister('near-intents')clear()
Section titled “clear()”clear():
void
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4631
Clear all registered backends
Returns
Section titled “Returns”void
Example
Section titled “Example”registry.clear()size()
Section titled “size()”size():
number
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4642
Get number of registered backends
Returns
Section titled “Returns”number
Number of registered backends
Example
Section titled “Example”const count = registry.size()