Skip to main content

Overview

SDK v2 brings a plugin system, client-side trace IDs, event severity, sampling, and lifecycle callbacks. This guide covers all breaking changes and how to update your code.

Breaking Changes

1. Web3 Methods Moved to Web3Plugin

In v2, all blockchain-related methods are namespaced under a plugin. You must enable the Web3Plugin and access methods via trace.web3.*. Before (v1):
After (v2):

2. Client-Side Trace ID Generation

Trace IDs are now generated client-side at creation time as W3C Tracing Context compatible 32-character hex strings. They are available immediately via getTraceId() — no need to wait for the server response. setTraceId() has been removed. If you were using it to set an ID after creation, pass traceId in TraceOptions instead. Before (v1):
After (v2):

3. addEvent() Date Parameter Removed

The legacy Date parameter for addEvent() has been removed. Use the timestamp option instead. Before (v1):
After (v2):

4. provider Removed from ClientOptions/TraceOptions

The provider option has been removed from both ClientOptions and TraceOptions. Use Web3Plugin instead. Before (v1):
After (v2):

5. Default Value Changes

6. create() Method Removed

The deprecated create() method has been removed. Use flush() or rely on auto-flush. Before (v1):
After (v2):

New Features

Plugin System

See Plugins for full documentation.

Sampling

Control what percentage of traces are recorded:
Unsampled traces return a NoopTrace that silently discards all operations.

Event Severity

Convenience methods for common severity levels:
These are shortcuts for addEvent() with a severity field.

Lifecycle Callbacks

Queue Management

Migration Checklist

  • Update SDK packages to v2.0: npm install @miradorlabs/web-sdk@2 @miradorlabs/nodejs-sdk@2
  • Add Web3Plugin to the plugins array and move provider from ClientOptions to Web3Plugin({ provider })
  • Namespace all Web3 method calls: addTxHintweb3.evm.addTxHint, addSafeMsgHintweb3.safe.addMsgHint, etc.
  • Replace setTraceId() with traceId in TraceOptions
  • Replace addEvent(name, details, date) with addEvent(name, details, { timestamp: date })
  • Remove setProvider() calls
  • Remove create() calls — use auto-flush or flush()
  • Update retry expectations: maxRetries default is now 2, retryBackoff is now 500ms
  • Update CDN URLs from @1.x.x to @2.0.0