MockSolver
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / MockSolver
Class: MockSolver
Section titled “Class: 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
Example
Section titled “Example”const solver = new MockSolver({ name: 'Test Solver' })
// Check if solver can handle intentif (await solver.canHandle(visibleIntent)) { const quote = await solver.generateQuote(visibleIntent) if (quote) { const result = await solver.fulfill(intent, quote) }}Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MockSolver(
config?):MockSolver
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4068
Parameters
Section titled “Parameters”config?
Section titled “config?”Returns
Section titled “Returns”MockSolver
Properties
Section titled “Properties”
readonlyinfo:Solver
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4061
Solver information
Implementation of
Section titled “Implementation of”capabilities
Section titled “capabilities”
readonlycapabilities:SolverCapabilities
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4062
Solver capabilities
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”canHandle()
Section titled “canHandle()”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
Parameters
Section titled “Parameters”intent
Section titled “intent”Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”generateQuote()
Section titled “generateQuote()”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
Parameters
Section titled “Parameters”intent
Section titled “intent”Returns
Section titled “Returns”Promise<SolverQuote | null>
Implementation of
Section titled “Implementation of”fulfill()
Section titled “fulfill()”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:
- Lock collateral
- Execute the swap on destination chain
- Generate fulfillment proof
- Release collateral after verification
Privacy preserved:
- Funds go to stealth address (unlinkable)
- Solver never learns recipient’s real identity
Parameters
Section titled “Parameters”intent
Section titled “intent”Returns
Section titled “Returns”Promise<FulfillmentResult>
Implementation of
Section titled “Implementation of”cancel()
Section titled “cancel()”cancel(
intentId):Promise<boolean>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4101
Cancel a pending fulfillment
Parameters
Section titled “Parameters”intentId
Section titled “intentId”string
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”getStatus()
Section titled “getStatus()”getStatus(
intentId):Promise<FulfillmentStatus|null>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4105
Get fulfillment status
Parameters
Section titled “Parameters”intentId
Section titled “intentId”string
Returns
Section titled “Returns”Promise<FulfillmentStatus | null>
Implementation of
Section titled “Implementation of”reset()
Section titled “reset()”reset():
void
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:4109
Reset solver state (for testing)
Returns
Section titled “Returns”void