Skip to content

SettlementRegistry

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / SettlementRegistry

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:7630

Settlement Backend Registry

Manages multiple settlement backends and provides route-based selection.

const registry = new SettlementRegistry()
// Register backends
registry.register(nearIntentsBackend)
registry.register(zcashBackend)
// Get backend by name
const backend = registry.get('near-intents')
// Find best backend for a route
const bestBackend = registry.getBestForRoute('ethereum', 'solana')
// List all supported routes
const routes = registry.getSupportedRoutes()

new SettlementRegistry(): SettlementRegistry

SettlementRegistry

register(backend): void

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:7643

Register a settlement backend

SettlementBackend

Settlement backend to register

void

If backend with same name already exists

registry.register(nearIntentsBackend)

get(name): SettlementBackend

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:7656

Get a settlement backend by name

string

Backend name

SettlementBackend

Settlement backend

If backend is not found

const backend = registry.get('near-intents')

list(): string[]

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:7668

List all registered backend names

string[]

Array of backend names

const names = registry.list()
// ['near-intents', 'zcash', 'thorchain']

getBestForRoute(fromChain, toChain): SettlementBackend

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:7688

Get the best backend for a specific route

Selection criteria (in order of priority):

  1. Backends that support both source and destination chains
  2. Backends with faster average execution time
  3. First registered backend (if no execution time info)

ChainId

Source chain

ChainId

Destination chain

SettlementBackend

Best settlement backend for the route

If no backend supports the route

const backend = registry.getBestForRoute('ethereum', 'solana')
const quote = await backend.getQuote({ ... })

getSupportedRoutes(): Route[]

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:7705

Get all supported routes across all registered backends

Route[]

Array of supported routes

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-DXh2IGkz.d.ts:7719

Check if a backend is registered

string

Backend name

boolean

True if backend is registered

if (registry.has('near-intents')) {
const backend = registry.get('near-intents')
}

unregister(name): boolean

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:7731

Unregister a settlement backend

string

Backend name to unregister

boolean

True if backend was unregistered, false if not found

registry.unregister('near-intents')

clear(): void

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:7740

Clear all registered backends

void

registry.clear()

size(): number

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:7751

Get number of registered backends

number

Number of registered backends

const count = registry.size()