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 viatrace.web3.*.
Before (v1):
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 viagetTraceId() — 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):
3. addEvent() Date Parameter Removed
The legacy Date parameter for addEvent() has been removed. Use the timestamp option instead.
Before (v1):
4. provider Removed from ClientOptions/TraceOptions
The provider option has been removed from both ClientOptions and TraceOptions. Use Web3Plugin instead.
Before (v1):
5. Default Value Changes
| Option | v1 Default | v2 Default |
|---|---|---|
maxRetries | 3 | 2 |
retryBackoff | 1000ms | 500ms |
6. create() Method Removed
The deprecated create() method has been removed. Use flush() or rely on auto-flush.
Before (v1):
New Features
Plugin System
See Plugins for full documentation.Sampling
Control what percentage of traces are recorded:NoopTrace that silently discards all operations.
Event Severity
Convenience methods for common severity levels: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
Web3Pluginto thepluginsarray and moveproviderfromClientOptionstoWeb3Plugin({ provider }) - Namespace all Web3 method calls:
addTxHint→web3.evm.addTxHint,addSafeMsgHint→web3.safe.addMsgHint, etc. - Replace
setTraceId()withtraceIdinTraceOptions - Replace
addEvent(name, details, date)withaddEvent(name, details, { timestamp: date }) - Remove
setProvider()calls - Remove
create()calls — use auto-flush orflush() - Update retry expectations:
maxRetriesdefault is now 2,retryBackoffis now 500ms - Update CDN URLs from
@1.x.xto@2.0.0