SettlementBackend
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / SettlementBackend
Interface: SettlementBackend
Section titled “Interface: 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.)
Example
Section titled “Example”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 }}Properties
Section titled “Properties”
readonlyname:string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4362
Backend name (e.g., ‘near-intents’, ‘zcash’, ‘thorchain’)
capabilities
Section titled “capabilities”
readonlycapabilities:BackendCapabilities
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4366
Backend capabilities
Methods
Section titled “Methods”getQuote()
Section titled “getQuote()”getQuote(
params):Promise<SettlementQuote>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4375
Get a quote for a cross-chain swap
Parameters
Section titled “Parameters”params
Section titled “params”Quote parameters
Returns
Section titled “Returns”Promise<SettlementQuote>
Quote with pricing, fees, and deposit address
Throws
Section titled “Throws”If parameters are invalid
Throws
Section titled “Throws”If backend API is unavailable
executeSwap()
Section titled “executeSwap()”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.
Parameters
Section titled “Parameters”params
Section titled “params”Swap execution parameters
Returns
Section titled “Returns”Promise<SettlementSwapResult>
Swap result with status and transaction details
Throws
Section titled “Throws”If quote is invalid or expired
Throws
Section titled “Throws”If backend API is unavailable
getStatus()
Section titled “getStatus()”getStatus(
swapId):Promise<SwapStatusResponse>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4396
Get current swap status
Parameters
Section titled “Parameters”swapId
Section titled “swapId”string
Swap identifier (typically the deposit address)
Returns
Section titled “Returns”Promise<SwapStatusResponse>
Current swap status
Throws
Section titled “Throws”If swap ID is invalid
Throws
Section titled “Throws”If backend API is unavailable
cancel()?
Section titled “cancel()?”
optionalcancel(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.
Parameters
Section titled “Parameters”swapId
Section titled “swapId”string
Swap identifier to cancel
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”If swap cannot be cancelled (already executed, etc.)
Throws
Section titled “Throws”If backend API is unavailable
Throws
Section titled “Throws”If cancellation is not supported
waitForCompletion()?
Section titled “waitForCompletion()?”
optionalwaitForCompletion(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).
Parameters
Section titled “Parameters”swapId
Section titled “swapId”string
Swap identifier to monitor
options?
Section titled “options?”Polling options
interval?
Section titled “interval?”number
Polling interval in milliseconds (default: 5000)
timeout?
Section titled “timeout?”number
Maximum wait time in milliseconds (default: 600000 = 10 minutes)
onStatusChange?
Section titled “onStatusChange?”(status) => void
Status change callback
Returns
Section titled “Returns”Promise<SwapStatusResponse>
Final swap status
Throws
Section titled “Throws”If swap ID is invalid
Throws
Section titled “Throws”If backend API is unavailable
getDryQuote()?
Section titled “getDryQuote()?”
optionalgetDryQuote(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).
Parameters
Section titled “Parameters”params
Section titled “params”Quote parameters
Returns
Section titled “Returns”Promise<SettlementQuote>
Quote preview
notifyDeposit()?
Section titled “notifyDeposit()?”
optionalnotifyDeposit(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.
Parameters
Section titled “Parameters”swapId
Section titled “swapId”string
Swap identifier (typically deposit address)
txHash
Section titled “txHash”string
Deposit transaction hash
metadata?
Section titled “metadata?”Record<string, unknown>
Additional backend-specific data
Returns
Section titled “Returns”Promise<void>