Resolvers (How to become a resolver)
This guide explains how to become a resolver (Market Maker) in the Omniston protocol and integrate with its gRPC API.
Overview
A resolver is a service that provides token exchange rates and executes trades. To become a resolver, you need to:
Register by obtaining a Soul-Bound Token (SBT)
Connect to the gRPC API
Handle quote requests and trades
Registration Process
Step 1: Generate Keys
First, generate one or more Ed25519 key pairs that will be used for authentication:
For other languages, you can use any standard Ed25519 implementation library available in your preferred programming language
Step 2: Prepare Metadata
Create a JSON document containing:
Your resolver name
Your public key(s)
Example:
Step 3: Submit Registration
Your metadata will be stored in an SBT NFT collection
You'll receive your SBT stake address for API authentication
Connecting to the API
Authentication
Create a connection payload:
Sign the payload:
Serialize the
ConnectPayload
to bytesSign using your Ed25519 private key
Base64 encode the signature
Send a
ConnectRequest
:
Example connection request:
Message Flow
The resolver API uses a bidirectional gRPC stream. After connecting:
1. Incoming Events
You'll receive these events from the server:
Key events:
QuoteRequestedEvent
: New quote request from a traderQuoteRequestCancelledEvent
: Trader cancelled their requestQuoteAcceptedEvent
: Your quote was acceptedQuoteRejectedEvent
: Your quote was rejectedQuoteInvalidatedEvent
: Confirmation of quote invalidation
2. Outgoing Requests
You can send these requests to the server:
Key requests:
UpdateQuoteRequest
: Provide or update a quoteInvalidateQuoteRequest
: Cancel a previously provided quote
Quote Flow
1. Receiving Quote Requests
When you receive a QuoteRequestedEvent
:
2. Providing Quotes
Respond with an UpdateQuoteRequest
:
For swap settlement, include route information:
3. Quote Lifecycle
You receive
QuoteRequestedEvent
You send
UpdateQuoteRequest
The server validates your quote and responds with:
QuoteAcceptedEvent
: Your quote was validated and accepted, includesquote_id
.QuoteRejectedEvent
: Your quote was rejected. The event includes acode
field from theQuoteRejectedCode
enum. Possible reasons include:UNDEFINED
(0) - Uncategorized errorINVALID_PARAMETERS
(1) - Invalid value of a parameterINVALID_AMOUNTS
(2) - Asset amount restrictions don't pass RFQ requirementsROUTE_PROHIBITED
(3) - Route uses a prohibited intermediate assetPOOL_PROHIBITED
(4) - Route uses a unverified or prohibited liquidity poolEMULATION_RESULT_MISMATCH
(5) - Transaction emulation produced a result different from the quoteINTERNAL_ERROR
(101) - Server errors
At any time, you can:
Send new
UpdateQuoteRequest
to update the quoteSend
InvalidateQuoteRequest
to cancel the quote
Best Practices
Sequence Numbers
Use monotonically increasing
seqno
for your requestsMatch
reply_to
with eventseqno
when respondingTrack request/response correlation using
seqno
Quote Management
Honor your quotes until
trade_start_deadline
Invalidate quotes you can't fulfill
Include all fees in your quoted amounts
Error Handling
Reconnect on connection loss
Handle all event types
Log rejected quotes for monitoring
Performance
Maintain a single gRPC connection
Process events asynchronously
Buffer outgoing requests
API Endpoint
Connect to: https://omni-grpc.ston.fi
See Also
Last updated