Skip to content

MockSolver

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / MockSolver

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

Mock implementation of SIPSolver for testing

This solver demonstrates the privacy-preserving interaction pattern:

  • Only accesses visible fields of intents
  • Cannot see sender identity or exact input amounts
  • Generates valid quotes based on output requirements
const solver = new MockSolver({ name: 'Test Solver' })
// Check if solver can handle intent
if (await solver.canHandle(visibleIntent)) {
const quote = await solver.generateQuote(visibleIntent)
if (quote) {
const result = await solver.fulfill(intent, quote)
}
}

new MockSolver(config?): MockSolver

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

MockSolverConfig

MockSolver

readonly info: Solver

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

Solver information

SIPSolver.info


readonly capabilities: SolverCapabilities

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

Solver capabilities

SIPSolver.capabilities

canHandle(intent): Promise<boolean>

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

Check if this solver can handle the given intent

Privacy-preserving: Only accesses visible fields

SolverVisibleIntent

Promise<boolean>

SIPSolver.canHandle


generateQuote(intent): Promise<SolverQuote | null>

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

Generate a quote for the intent

Privacy-preserving:

  • Does NOT access sender identity (only senderCommitment visible)
  • Does NOT know exact input amount (only inputCommitment visible)
  • Quotes based solely on output requirements

SolverVisibleIntent

Promise<SolverQuote | null>

SIPSolver.generateQuote


fulfill(intent, quote): Promise<FulfillmentResult>

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

Fulfill an intent with the given quote

In production, this would:

  1. Lock collateral
  2. Execute the swap on destination chain
  3. Generate fulfillment proof
  4. Release collateral after verification

Privacy preserved:

  • Funds go to stealth address (unlinkable)
  • Solver never learns recipient’s real identity

ShieldedIntent

SolverQuote

Promise<FulfillmentResult>

SIPSolver.fulfill


cancel(intentId): Promise<boolean>

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

Cancel a pending fulfillment

string

Promise<boolean>

SIPSolver.cancel


getStatus(intentId): Promise<FulfillmentStatus | null>

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

Get fulfillment status

string

Promise<FulfillmentStatus | null>

SIPSolver.getStatus


reset(): void

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

Reset solver state (for testing)

void