Skip to content

SettlementRegistry

SIP Protocol API Reference v0.15.1


SIP Protocol API Reference / SettlementRegistry

Defined in: @sip-protocol/sdk/dist/index-GLbkPPho.d.ts:7703

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-GLbkPPho.d.ts:7716

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-GLbkPPho.d.ts:7729

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-GLbkPPho.d.ts:7741

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-GLbkPPho.d.ts:7761

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-GLbkPPho.d.ts:7778

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-GLbkPPho.d.ts:7792

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-GLbkPPho.d.ts:7804

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-GLbkPPho.d.ts:7813

Clear all registered backends

void

registry.clear()

size(): number

Defined in: @sip-protocol/sdk/dist/index-GLbkPPho.d.ts:7824

Get number of registered backends

number

Number of registered backends

const count = registry.size()