• Create an ObservabilityHooks implementation backed by an OpenTelemetry Tracer.

    Each mutating SDK method becomes a span with:

    • bridge.method — the SDK method name.
    • bridge.tx.hash — the transaction hash on success.
    • bridge.tx.status'pending', 'success', or 'failed'.
    • bridge.duration_ms — wall-clock duration.

    RPC calls (when traceRpcCalls is true, the default) produce spans with:

    • rpc.method — the RPC method label.
    • rpc.duration_ms — round-trip duration.

    Parameters

    • tracer: OtelTracer

      An OpenTelemetry Tracer instance obtained from trace.getTracer('bridge-sdk', '0.1.0').

    • options: OpenTelemetryHooksOptions = {}

      Optional configuration.

    Returns ObservabilityHooks

    An ObservabilityHooks object ready to pass to BridgeConfig.hooks.

    import { trace } from '@opentelemetry/api';
    import { OnboardingBridgeSDK, createOpenTelemetryHooks } from '...';

    const tracer = trace.getTracer('my-service', '1.0.0');

    const sdk = new OnboardingBridgeSDK({
    contractId: 'CA...',
    rpcUrl: 'https://soroban-testnet.stellar.org',
    networkPassphrase: Networks.TESTNET,
    hooks: createOpenTelemetryHooks(tracer),
    });