Skip to main content

Overview

Relay is an intent-based cross-chain protocol: the user signs an intent at quote time, a solver fulfils it on the destination chain, and the bridge resolves asynchronously. Because deposit and fill happen on different chains — minutes apart, sometimes — instrumenting the flow with raw tx hashes alone misses the structure between them. Mirador’s web3.relay.addQuoteHint() ties a Relay intent (by requestId) to a trace at quote time. From there the backend relayhint processor resolves the full quote from the requestId and emits the lifecycle onto the trace:
  • RelayHintAddedRelayQuoteFound
  • RelayDepositAdded (with the source-chain tx hint co-emitted)
  • RelaySolverCommitted (with the destination-chain tx hint co-emitted)
  • RelayFillAdded or RelayRefunded / RelayFailed / RelayNotFound
  • RelayTrackingFinished (terminal)
You record the hint once. The lifecycle is filled in for you.
Relay methods require the Web3Plugin. See Plugins for setup.

Recording a Quote Hint

Call web3.relay.addQuoteHint() once Relay has returned a requestId for the user’s intent — before they deposit.
trace.web3.relay.addQuoteHint('rly_request_123');
That’s it. The requestId is the only thing the SDK needs to ship — the platform resolves chain IDs, currencies, amounts, and the rest from Relay’s status feed server-side.

With an Optional Message

You can attach a free-form note for debugging context. The string rides on the proto RelayHint.details field.
trace.web3.relay.addQuoteHint('rly_request_123', 'queued from swap modal');

Method Signature

trace.web3.relay.addQuoteHint(requestId: string, message?: string): Trace
ParameterTypeRequiredDescription
requestIdstringYesRelay’s API correlation key
messagestringNoFree-form note attached to the hint for debugging context
The relayhint processor resolves the full quote (chain IDs, currencies, addresses, amounts) server-side from requestId using bridge-api and Relay’s status feed. The SDK doesn’t ship any of that metadata.

End-to-End Example

import { Client, Web3Plugin } from '@miradorlabs/web-sdk';

const client = new Client('your-api-key', {
  plugins: [Web3Plugin({ provider: window.ethereum })],
});

// 1. User starts a cross-chain swap
const trace = client.trace({ name: 'RelaySwap' })
  .addAttribute('user', userAddress)
  .addTag('bridge:relay');

// 2. Fetch a quote from Relay
const quote = await fetchRelayQuote({ from: 'ethereum', to: 'base', amount });

// 3. Tie the intent to the trace — *before* deposit
trace.web3.relay.addQuoteHint(quote.requestId);

// 4. Execute the deposit. Mirador-side, you don't need to do anything more —
//    the relayhint processor will emit deposit, solver-committed, and fill
//    events onto this trace as Relay reports them.
await depositOnRelay(quote);

Combining With Other Hints

Relay hints compose freely with EVM transaction hints, Safe hints, and the rest of the SDK. The processor itself co-emits source and destination addTxHints for the deposit and fill, so the underlying receipts also surface in the waterfall — you usually don’t need to add those by hand.
trace
  .web3.relay.addQuoteHint(quote.requestId)
  .addAttribute('amount_usd', quote.originAmount)
  .addTag('cross-chain');

Next Steps

Transaction Hints

EVM transaction hints and correlation

Safe Multisig

Track Safe multisig flows

Plugins

Web3Plugin setup and configuration