Skip to content

SettlementBackend

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / SettlementBackend

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4358

Settlement Backend Interface

All settlement backends must implement this interface. This allows SIP to support multiple settlement layers (NEAR Intents, Zcash, THORChain, etc.)

class MySettlementBackend implements SettlementBackend {
name = 'my-backend'
supportedChains = ['ethereum', 'solana']
async getQuote(params: QuoteParams): Promise<Quote> {
// Implementation
}
async executeSwap(params: SwapParams): Promise<SwapResult> {
// Implementation
}
async getStatus(swapId: string): Promise<SwapStatusResponse> {
// Implementation
}
}

readonly name: string

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4362

Backend name (e.g., ‘near-intents’, ‘zcash’, ‘thorchain’)


readonly capabilities: BackendCapabilities

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4366

Backend capabilities

getQuote(params): Promise<SettlementQuote>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4375

Get a quote for a cross-chain swap

SettlementQuoteParams

Quote parameters

Promise<SettlementQuote>

Quote with pricing, fees, and deposit address

If parameters are invalid

If backend API is unavailable


executeSwap(params): Promise<SettlementSwapResult>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4387

Execute a swap using a quote

For most backends, this returns a deposit address and waits for user deposit. Some backends may require additional signing or approval.

SettlementSwapParams

Swap execution parameters

Promise<SettlementSwapResult>

Swap result with status and transaction details

If quote is invalid or expired

If backend API is unavailable


getStatus(swapId): Promise<SwapStatusResponse>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4396

Get current swap status

string

Swap identifier (typically the deposit address)

Promise<SwapStatusResponse>

Current swap status

If swap ID is invalid

If backend API is unavailable


optional cancel(swapId): Promise<void>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4408

Cancel a pending swap (optional)

Only supported by backends with cancellation capabilities. Check capabilities.supportsCancellation before calling.

string

Swap identifier to cancel

Promise<void>

If swap cannot be cancelled (already executed, etc.)

If backend API is unavailable

If cancellation is not supported


optional waitForCompletion(swapId, options?): Promise<SwapStatusResponse>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4421

Wait for swap completion (optional)

Polls swap status until completion or timeout. Backends may provide more efficient implementations (webhooks, subscriptions).

string

Swap identifier to monitor

Polling options

number

Polling interval in milliseconds (default: 5000)

number

Maximum wait time in milliseconds (default: 600000 = 10 minutes)

(status) => void

Status change callback

Promise<SwapStatusResponse>

Final swap status

If swap ID is invalid

If backend API is unavailable


optional getDryQuote(params): Promise<SettlementQuote>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4438

Get a dry quote (preview without creating deposit address)

Useful for showing estimates without committing to a swap. Not all backends support this (return same as getQuote if not).

SettlementQuoteParams

Quote parameters

Promise<SettlementQuote>

Quote preview


optional notifyDeposit(swapId, txHash, metadata?): Promise<void>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4449

Notify backend of deposit transaction (optional)

Some backends require explicit notification after user deposits. Check backend documentation for requirements.

string

Swap identifier (typically deposit address)

string

Deposit transaction hash

Record<string, unknown>

Additional backend-specific data

Promise<void>