Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughThis PR introduces a comprehensive logging system to the StarkZap SDK. A new logger module exports Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/bridge/ethereum/EthereumBridge.ts (1)
58-63:⚠️ Potential issue | 🟠 MajorConstructor parameter order introduces a backward-compatibility break.
At Line 62,
loggerwas inserted beforebridgeAbi(Line 63). Existing positional callers that passed a custom ABI as the 4th argument will now be misinterpreted.Proposed compatibility-safe adjustment
constructor( protected readonly bridgeToken: EthereumBridgeToken, protected readonly config: EthereumWalletConfig, readonly starknetWallet: WalletInterface, - protected readonly logger: StarkZapLogger = NOOP_LOGGER, - bridgeAbi: InterfaceAbi = CANONICAL_BRIDGE_ABI + bridgeAbi: InterfaceAbi = CANONICAL_BRIDGE_ABI, + protected readonly logger: StarkZapLogger = NOOP_LOGGER ) {As per coding guidelines, for
src/**this is a public SDK and changes must prioritize backwards compatibility and clear typed APIs.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/bridge/ethereum/EthereumBridge.ts` around lines 58 - 63, The constructor parameter order change breaks positional callers: move the bridgeAbi parameter back to the 4th position and keep logger as the 5th to restore backward compatibility (i.e., signature should be constructor(protected readonly bridgeToken: EthereumBridgeToken, protected readonly config: EthereumWalletConfig, readonly starknetWallet: WalletInterface, bridgeAbi: InterfaceAbi = CANONICAL_BRIDGE_ABI, protected readonly logger: StarkZapLogger = NOOP_LOGGER)), update any internal references to the constructor accordingly, and keep the default values for CANONICAL_BRIDGE_ABI and NOOP_LOGGER so existing callers passing a custom ABI as the fourth argument continue to work.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@examples/web/main.ts`:
- Around line 4447-4451: The code unsafely casts
document.getElementById("sdk-logs-toggle") to HTMLInputElement without a null
guard; update the block that declares sdkLogsToggle so you first obtain it as
HTMLInputElement | null (or let sdkLogsToggle = document.getElementById(...) as
HTMLInputElement | null) and then check for null before using it—e.g., if
sdkLogsToggle is null, skip wiring the listener or log/throw an error; otherwise
set sdkLogsVisible inside the sdkLogsToggle.addEventListener callback. Ensure
you only call addEventListener on the non-null sdkLogsToggle and keep the
sdkLogsVisible identifier as before.
In `@src/bridge/ethereum/cctp/CCTPFees.ts`:
- Around line 31-35: getInstance currently ignores subsequent logger arguments
because CCTPFees.instance is created once with the first logger; fix by removing
the long-lived singleton behavior so each call respects the provided logger:
update CCTPFees.getInstance to not return/reuse CCTPFees.instance (or implement
an instance-per-logger map keyed by logger identity) and ensure new
CCTPFees(logger) is constructed when a different logger is requested; adjust or
remove the static CCTPFees.instance field and any caller assumptions about a
global singleton so logger ownership is deterministic.
In `@src/bridge/monitor/hyperlane/SolanaHyperlaneMonitor.ts`:
- Around line 23-29: The interface HyperlaneSolanaMonitorOptions currently makes
logger required; revert it to optional to preserve backward compatibility by
changing the logger property on HyperlaneSolanaMonitorOptions back to an
optional type (e.g., logger?: StarkZapLogger) and ensure any consumer code in
the same file that reads logger (e.g., the SolanaHyperlaneMonitor constructor or
methods referenced around the later block at lines ~60-63) handles undefined by
using the existing silent/default logger fallback; update any typings or
parameter de-structuring that assumed logger is present so they use the optional
value or fallback logger.
In `@src/bridge/monitor/utils.ts`:
- Around line 26-27: The code logs routine monitoring states with logger.error
when returning BridgeTransferStatus.NOT_SUBMITTED_ON_STARKNET (and the similar
return at the other site), causing false-positive errors; change the severity of
those logs from logger.error(...) to a non-error level (e.g., logger.info(...)
or logger.debug(...)) for the cases that return
BridgeTransferStatus.NOT_SUBMITTED_ON_STARKNET and the other non-success status,
keeping error-level logging only for actual exceptions. Locate the
logger.error(...) calls that accompany the return of
BridgeTransferStatus.NOT_SUBMITTED_ON_STARKNET (and the analogous call at the
other return) and replace them with a lower-severity logger method while
preserving the message and txHash context.
In `@src/logger/index.ts`:
- Around line 152-155: The isLevelEnabled method returns true for level "silent"
when minPriority is lower than LEVEL_PRIORITY["silent"], which is misleading
because "silent" should always disable logging; update isLevelEnabled (in the
isLevelEnabled(level: LogLevel) method) to explicitly guard against the "silent"
level by returning false if level === "silent" (or equivalent value) before
comparing LEVEL_PRIORITY, so any call to isLevelEnabled("silent") always returns
false; reference LEVEL_PRIORITY and this.minPriority in the updated logic and
add a short comment explaining the guard.
- Around line 115-117: Update the JSDoc above the exported class StarkZapLogger
to clarify it's an internal implementation rather than part of the SDK public
API: change the comment to state that although StarkZapLogger is
module-exported, it is not re-exported from the SDK entry point and is intended
for internal use only (e.g., "Internal implementation. Exported from this module
but not re-exported from the public SDK entry point (src/index.ts)."). Ensure
the new comment mentions both the module-level export and the distinction from
the public API to avoid confusion.
In `@src/sdk.ts`:
- Around line 548-550: Add unit tests verifying SDK logging propagation for
getBridgingTokens(): write one test that constructs StarkZap (or the SDK class)
without a logging field in its config and asserts that calling
getBridgingTokens() produces no logger output (i.e., operates silently or uses a
no-op logger), and another test that constructs StarkZap with a custom logger in
config, calls getBridgingTokens(), and asserts the BridgeTokenRepository
created/used (BridgeTokenRepository instance stored as
this.bridgeTokenRepository) received that logger (or that createLogger was
called with the SDK config and BridgeTokenRepository calls went through the
provided logger). Use spies/mocks on createLogger and/or BridgeTokenRepository
methods to observe logger propagation from the SDK config into
getBridgingTokens().
---
Outside diff comments:
In `@src/bridge/ethereum/EthereumBridge.ts`:
- Around line 58-63: The constructor parameter order change breaks positional
callers: move the bridgeAbi parameter back to the 4th position and keep logger
as the 5th to restore backward compatibility (i.e., signature should be
constructor(protected readonly bridgeToken: EthereumBridgeToken, protected
readonly config: EthereumWalletConfig, readonly starknetWallet: WalletInterface,
bridgeAbi: InterfaceAbi = CANONICAL_BRIDGE_ABI, protected readonly logger:
StarkZapLogger = NOOP_LOGGER)), update any internal references to the
constructor accordingly, and keep the default values for CANONICAL_BRIDGE_ABI
and NOOP_LOGGER so existing callers passing a custom ABI as the fourth argument
continue to work.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: ed2f40ad-9ebf-447b-bbd0-941b99c821fe
📒 Files selected for processing (25)
examples/web/index.htmlexamples/web/main.tspackages/native/src/sdk.tspackages/native/src/wallet/cartridge.tssrc/bridge/ethereum/EthereumBridge.tssrc/bridge/ethereum/canonical/CanonicalEthereumBridge.tssrc/bridge/ethereum/cctp/CCTPBridge.tssrc/bridge/ethereum/cctp/CCTPFees.tssrc/bridge/ethereum/lords/LordsBridge.tssrc/bridge/ethereum/oft/OftBridge.tssrc/bridge/monitor/cctp/CctpMonitor.tssrc/bridge/monitor/hyperlane/SolanaHyperlaneMonitor.tssrc/bridge/monitor/oft/OftMonitor.tssrc/bridge/monitor/utils.tssrc/bridge/operator/BridgeOperator.tssrc/bridge/tokens/repository.tssrc/erc20/token/index.tssrc/index.tssrc/logger/index.tssrc/sdk.tssrc/types/config.tssrc/wallet/base.tssrc/wallet/cartridge.tssrc/wallet/index.tstests/bridge-token-repository.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Use@/path alias for internal imports in TypeScript source files
Use strict TypeScript compiler settings:strict,noUncheckedIndexedAccess,exactOptionalPropertyTypesenabled
Files:
src/wallet/cartridge.tssrc/types/config.tspackages/native/src/wallet/cartridge.tssrc/index.tstests/bridge-token-repository.test.tspackages/native/src/sdk.tssrc/bridge/ethereum/oft/OftBridge.tssrc/bridge/tokens/repository.tssrc/bridge/ethereum/cctp/CCTPBridge.tssrc/bridge/monitor/oft/OftMonitor.tssrc/bridge/ethereum/EthereumBridge.tssrc/bridge/monitor/hyperlane/SolanaHyperlaneMonitor.tssrc/bridge/ethereum/cctp/CCTPFees.tssrc/wallet/base.tssrc/erc20/token/index.tssrc/wallet/index.tssrc/sdk.tssrc/bridge/monitor/utils.tssrc/bridge/ethereum/lords/LordsBridge.tssrc/bridge/monitor/cctp/CctpMonitor.tssrc/bridge/operator/BridgeOperator.tsexamples/web/main.tssrc/bridge/ethereum/canonical/CanonicalEthereumBridge.tssrc/logger/index.ts
src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Preserve strict TypeScript typing; prefer explicit domain types (Address, Amount, ChainId) over primitives
Files:
src/wallet/cartridge.tssrc/types/config.tssrc/index.tssrc/bridge/ethereum/oft/OftBridge.tssrc/bridge/tokens/repository.tssrc/bridge/ethereum/cctp/CCTPBridge.tssrc/bridge/monitor/oft/OftMonitor.tssrc/bridge/ethereum/EthereumBridge.tssrc/bridge/monitor/hyperlane/SolanaHyperlaneMonitor.tssrc/bridge/ethereum/cctp/CCTPFees.tssrc/wallet/base.tssrc/erc20/token/index.tssrc/wallet/index.tssrc/sdk.tssrc/bridge/monitor/utils.tssrc/bridge/ethereum/lords/LordsBridge.tssrc/bridge/monitor/cctp/CctpMonitor.tssrc/bridge/operator/BridgeOperator.tssrc/bridge/ethereum/canonical/CanonicalEthereumBridge.tssrc/logger/index.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not introduce CommonJS patterns; use ESM only
Files:
src/wallet/cartridge.tssrc/types/config.tspackages/native/src/wallet/cartridge.tssrc/index.tstests/bridge-token-repository.test.tspackages/native/src/sdk.tssrc/bridge/ethereum/oft/OftBridge.tssrc/bridge/tokens/repository.tssrc/bridge/ethereum/cctp/CCTPBridge.tssrc/bridge/monitor/oft/OftMonitor.tssrc/bridge/ethereum/EthereumBridge.tssrc/bridge/monitor/hyperlane/SolanaHyperlaneMonitor.tssrc/bridge/ethereum/cctp/CCTPFees.tssrc/wallet/base.tssrc/erc20/token/index.tssrc/wallet/index.tssrc/sdk.tssrc/bridge/monitor/utils.tssrc/bridge/ethereum/lords/LordsBridge.tssrc/bridge/monitor/cctp/CctpMonitor.tssrc/bridge/operator/BridgeOperator.tsexamples/web/main.tssrc/bridge/ethereum/canonical/CanonicalEthereumBridge.tssrc/logger/index.ts
{src/sdk.ts,src/wallet/**,src/types/**}
📄 CodeRabbit inference engine (AGENTS.md)
Must serialize: Concurrent edits in
src/sdk.ts,src/wallet/*, or sharedsrc/types/*
Files:
src/wallet/cartridge.tssrc/types/config.tssrc/wallet/base.tssrc/wallet/index.tssrc/sdk.ts
src/**
⚙️ CodeRabbit configuration file
src/**: This is a public SDK. Prioritize:
- Backwards compatibility and clear, typed public APIs
- Deterministic behavior across mainnet/sepolia presets
- Tests for behavior changes (prefer unit tests)
Files:
src/wallet/cartridge.tssrc/types/config.tssrc/index.tssrc/bridge/ethereum/oft/OftBridge.tssrc/bridge/tokens/repository.tssrc/bridge/ethereum/cctp/CCTPBridge.tssrc/bridge/monitor/oft/OftMonitor.tssrc/bridge/ethereum/EthereumBridge.tssrc/bridge/monitor/hyperlane/SolanaHyperlaneMonitor.tssrc/bridge/ethereum/cctp/CCTPFees.tssrc/wallet/base.tssrc/erc20/token/index.tssrc/wallet/index.tssrc/sdk.tssrc/bridge/monitor/utils.tssrc/bridge/ethereum/lords/LordsBridge.tssrc/bridge/monitor/cctp/CctpMonitor.tssrc/bridge/operator/BridgeOperator.tssrc/bridge/ethereum/canonical/CanonicalEthereumBridge.tssrc/logger/index.ts
src/index.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Keep public API changes intentional and export them via
src/index.tsMust serialize: Any work touching
src/index.ts(public API export surface)
Files:
src/index.ts
tests/**
⚙️ CodeRabbit configuration file
tests/**: Integration tests can be flaky depending on devnet/RPC assumptions.
Prefer stable unit tests unless an integration test is strictly necessary.
Files:
tests/bridge-token-repository.test.ts
🧠 Learnings (8)
📚 Learning: 2026-03-09T13:39:32.603Z
Learnt from: adrienlacombe
Repo: keep-starknet-strange/starkzap PR: 62
File: src/tx/builder.ts:449-539
Timestamp: 2026-03-09T13:39:32.603Z
Learning: Guideline for confidential transaction handling in StarkZap: In src/tx/builder.ts and src/confidential/types.ts, the sender field for confidential/tongo operations (ConfidentialFundDetails, ConfidentialTransferDetails, ConfidentialWithdrawDetails, ConfidentialRagequitDetails, ConfidentialRolloverDetails) represents the Starknet account submitting the transaction (often a relayer), not necessarily the wallet owner. The optional feeTo field is for relayed transactions where sender differs from the wallet.
Actionable checks for code reviews:
- Do not override details.sender with this.wallet.address in TxBuilder confidential methods; doing so breaks the relayer pattern.
- Ensure staking methods continue to bind this.wallet.address to reflect the pool member’s own address (no relayer concept there).
- If using a relayer, verify feeTo is set when appropriate and that sender remains the relayer address.
- Update or add tests to reflect the correct sender semantics for confidential operations...
Applied to files:
src/wallet/cartridge.tssrc/types/config.tspackages/native/src/wallet/cartridge.tssrc/index.tspackages/native/src/sdk.tssrc/bridge/ethereum/oft/OftBridge.tssrc/bridge/tokens/repository.tssrc/bridge/ethereum/cctp/CCTPBridge.tssrc/bridge/monitor/oft/OftMonitor.tssrc/bridge/ethereum/EthereumBridge.tssrc/bridge/monitor/hyperlane/SolanaHyperlaneMonitor.tssrc/bridge/ethereum/cctp/CCTPFees.tssrc/wallet/base.tssrc/erc20/token/index.tssrc/wallet/index.tssrc/sdk.tssrc/bridge/monitor/utils.tssrc/bridge/ethereum/lords/LordsBridge.tssrc/bridge/monitor/cctp/CctpMonitor.tssrc/bridge/operator/BridgeOperator.tssrc/bridge/ethereum/canonical/CanonicalEthereumBridge.tssrc/logger/index.ts
📚 Learning: 2026-03-06T10:04:13.920Z
Learnt from: CR
Repo: keep-starknet-strange/starkzap PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-06T10:04:13.920Z
Learning: Applies to src/index.ts : Keep public API changes intentional and export them via `src/index.ts`
Applied to files:
src/index.tssrc/logger/index.ts
📚 Learning: 2026-03-06T10:04:28.285Z
Learnt from: CR
Repo: keep-starknet-strange/starkzap PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-06T10:04:28.285Z
Learning: Applies to src/index.ts : Must serialize: Any work touching `src/index.ts` (public API export surface)
Applied to files:
src/index.ts
📚 Learning: 2026-03-09T13:42:08.400Z
Learnt from: adrienlacombe
Repo: keep-starknet-strange/starkzap PR: 62
File: tests/integration/confidential.test.ts:44-87
Timestamp: 2026-03-09T13:42:08.400Z
Learning: In `tests/integration/confidential.test.ts` (StarkZap, TypeScript/Vitest), the Confidential integration test suite intentionally spawns its own dedicated devnet (port 5110, loading `tongo-state/devnet.state`) instead of using the shared globalSetup devnet. This is because it requires a pre-built state dump with an already-deployed Tongo contract whose artifacts come from a separate repo and are baked in via `regenerate.mjs`. The shared devnet starts fresh (--seed 0, no contracts). The graceful warn+skip on devnet startup failure is intentional: if starknet-devnet is not installed or the state dump is missing, other tests should still pass. This is the accepted pattern for optional integration suites depending on external tooling in this project.
Applied to files:
tests/bridge-token-repository.test.ts
📚 Learning: 2026-03-17T08:43:15.273Z
Learnt from: ZackAttax
Repo: keep-starknet-strange/starkzap PR: 86
File: packages/native/src/cartridge/ts/outside_execution_v3.ts:36-38
Timestamp: 2026-03-17T08:43:15.273Z
Learning: In `packages/native/src/cartridge/ts/outside_execution_v3.ts`, the `SESSION_TYPE_HASH` encodes only 4 fields ("Expires At", "Allowed Methods", "Metadata", "Session Key") while `hashSessionStruct` serializes 5 fields (adding `guardianKeyGuid`). This mismatch is intentional and inherited from the upstream Cartridge protocol (controller-rs / controller.c session token shape), where the same 4-field type-hash / 5-field payload pattern exists. Changing starkzap alone would break protocol parity and invalidate outside-execution signatures against live Cartridge contracts. This should only be fixed upstream as a coordinated/versioned protocol change.
Applied to files:
packages/native/src/sdk.ts
📚 Learning: 2026-03-06T10:04:13.920Z
Learnt from: CR
Repo: keep-starknet-strange/starkzap PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-06T10:04:13.920Z
Learning: Applies to src/**/*.ts : Preserve strict TypeScript typing; prefer explicit domain types (Address, Amount, ChainId) over primitives
Applied to files:
src/bridge/ethereum/cctp/CCTPFees.ts
📚 Learning: 2026-03-06T10:04:28.285Z
Learnt from: CR
Repo: keep-starknet-strange/starkzap PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-06T10:04:28.285Z
Learning: Applies to {src/sdk.ts,src/wallet/**,src/types/**} : Must serialize: Concurrent edits in `src/sdk.ts`, `src/wallet/*`, or shared `src/types/*`
Applied to files:
src/wallet/base.tsexamples/web/main.ts
📚 Learning: 2026-03-06T10:04:13.920Z
Learnt from: CR
Repo: keep-starknet-strange/starkzap PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-06T10:04:13.920Z
Learning: Applies to src/erc20/token/presets*.ts : Do not hand-edit auto-generated preset files: `src/erc20/token/presets.ts`, `src/erc20/token/presets.sepolia.ts`, `src/staking/validator/presets.ts`, `src/staking/validator/presets.sepolia.ts`
Applied to files:
src/wallet/index.ts
🪛 HTMLHint (1.9.2)
examples/web/index.html
[warning] 1746-1746: No matching [ label ] tag found.
(input-requires-label)
🔇 Additional comments (34)
src/wallet/cartridge.ts (3)
32-32: LGTM!Import correctly uses the
@/path alias for internal imports as per coding guidelines.
105-105: LGTM!The optional
loggingproperty maintains backwards compatibility - existing callers are unaffected.
156-156: LGTM!The conditional spread pattern is consistent with the existing approach used elsewhere in the constructor (e.g., for other optional configs) and correctly forwards the logging configuration to
BaseWallet.src/index.ts (1)
48-50: LGTM!Type-only exports correctly expose the logging API surface. The grouping with a comment follows the established pattern in this file. As per coding guidelines, public API changes are intentional and exported via
src/index.ts.tests/bridge-token-repository.test.ts (3)
13-27: LGTM!The mock logger helper is well-structured. It creates a
StarkZapLoggerwith a no-op base logger and provides spies for assertion. Theinstall()method pattern allows controlled setup and returnsthisfor chaining.
253-268: LGTM!Test correctly verifies that
BridgeTokenRepositorylogs warnings through the injected logger when Solana runtime is unavailable. The assertion onmockLogger.spies.warnreplaces the previousconsole.warnspy pattern.
283-296: LGTM!Mirrors the pattern from the Solana test case, correctly verifying logger-based warning output when ethers is unavailable.
packages/native/src/wallet/cartridge.ts (3)
10-10: LGTM!Import correctly references the main
starkzappackage's type export, which is appropriate for the native package.
251-251: LGTM!Optional
loggingproperty maintains backwards compatibility with existing callers.
272-272: LGTM!Conditional spread pattern is consistent with
src/wallet/cartridge.tsand correctly forwards logging configuration toBaseWallet.src/types/config.ts (2)
8-8: LGTM!Import uses the
@/path alias correctly.
248-270: LGTM!Excellent documentation with clear examples showing both quick debugging (
console) and production usage (pinowith level filter). The JSDoc accurately describes the default silent behavior and aligns with the PR objectives.packages/native/src/sdk.ts (2)
52-53: LGTM!Correctly destructures
loggingfromgetResolvedConfig(). The context snippet confirms thatlogging?: LoggerConfigis part of the resolved config shape returned by the parent class.
84-84: LGTM!Conditional spread pattern is consistent with how
bridgingandstakingare forwarded (lines 82-83), correctly propagating the logging configuration to the native wallet.src/bridge/ethereum/oft/OftBridge.ts (2)
36-36: LGTM!Import correctly uses the
@/path alias.
51-58: LGTM!Constructor correctly accepts and forwards the logger to the
EthereumBridgesuperclass. This follows the same pattern used in other bridge implementations (e.g.,CanonicalEthereumBridge,LordsBridge).src/bridge/monitor/oft/OftMonitor.ts (4)
21-21: LGTM!Import correctly uses the
@/path alias.
45-45: LGTM!The
loggeris correctly added as a required field inOftMonitorOptions. This is appropriate since monitors are instantiated byBridgeOperator, which always provides a logger instance.
54-54: LGTM!Logger is properly stored as a private readonly field and assigned from constructor options.
Also applies to: 62-62
236-236: LGTM!Correctly replaces
console.debugwiththis.logger.debug, maintaining the same error-handling behavior (returnsnullon failure). This aligns with the PR's goal of replacing internal console calls with the pluggable logger.src/bridge/ethereum/cctp/CCTPBridge.ts (2)
68-68: Downstream of existing singleton logger-capture issue.Line 68 correctly passes
this.logger, but it cannot take effect after first initialization becauseCCTPFees.getInstance(...)caches the initial logger. Root cause is insrc/bridge/ethereum/cctp/CCTPFees.tsLines 31-35.
138-141: Fee-estimation fallback logging migration looks good.
this.logger.debug(...)keeps behavior while aligning with the logger abstraction.Also applies to: 195-198, 294-297
src/erc20/token/index.ts (1)
79-82: Logger propagation is clean and preserves silent-default behavior.Optional logger threading is consistent, and Line 117 correctly guards emission when no logger is configured.
Also applies to: 117-122, 127-130, 152-152
src/bridge/tokens/repository.ts (1)
28-28: Good logger plumbing in repository warnings.The NOOP default and
this.logger.warn(...)substitutions are consistent and non-breaking for callers that omit logging config.Also applies to: 253-253, 270-270, 353-356, 372-375, 407-407
examples/web/index.html (1)
616-637: Activity Log toggle integration is solid.The
sdk-logs-togglecontrol and associated styles are correctly structured for the existing web example log plumbing.Also applies to: 1743-1749
src/wallet/base.ts (1)
138-143: Logger propagation inBaseWalletis correctly wired.
createLogger(options.logging)+ passingthis.loggerintoBridgeOperatoris consistent and type-safe.src/bridge/ethereum/lords/LordsBridge.ts (1)
19-33:LordsBridgeconstructor update is clean and consistent.
loggeris threaded toCanonicalEthereumBridgein the correct position.src/bridge/monitor/cctp/CctpMonitor.ts (1)
26-34: CCTP monitor logging migration looks correct.Required logger injection and catch-path logging replacement are coherent with the new logging model.
Also applies to: 72-85, 291-292, 339-340, 371-372
src/wallet/index.ts (1)
142-149:Walletlogging passthrough is correctly integrated.The optional
loggingconfig is forwarded toBaseWalletwithout affecting existing call paths.Also applies to: 233-234
examples/web/main.ts (1)
216-221: Nice opt-in SDK trace integration for the playground.The injected
sdkLoggerand hidden-by-default rendering behavior align well with the PR objective.Also applies to: 223-242, 248-248
src/bridge/ethereum/canonical/CanonicalEthereumBridge.ts (1)
41-45: Canonical bridge logger migration is correctly implemented.Constructor wiring and catch-path logging replacement are consistent across fee-estimation/error branches.
Also applies to: 189-192, 209-212, 283-286, 304-307
src/bridge/operator/BridgeOperator.ts (1)
55-59: BridgeOperator logger threading is complete and consistent.All updated monitor/bridge instantiations receive
this.loggerin the expected positions.Also applies to: 275-276, 313-314, 332-333, 404-406, 417-419, 424-424, 436-442
src/logger/index.ts (2)
1-33: Well-designed public API surface.The
Loggerinterface is minimal and compatible withconsole, pino, winston, and other popular loggers. The JSDoc examples are helpful for SDK consumers. Good use of lazy message evaluation viaLogMessagetype to avoid unnecessary serialization costs.
165-178: LGTM!The
NOOP_LOGGERsingleton andcreateLoggerfactory correctly implement the documented resolution rules: silent when no config, all levels when config without logLevel, filtered when logLevel is provided.
Summary
Adds a pluggable, logger-agnostic logging system to the SDK. Internal
console.debug/console.warncalls are replaced with a level-gated logger that is silent by default and only active when the client opts in.Usage
The SDK accepts any object with
debug,info,warn, anderrormethods —consoleworks out of the box, as do libraries like pino, winston, and react-native-logs (no adapters needed).When
loggingis omitted the SDK produces zero output. When provided withoutlogLevel, all severity levels are forwarded to the logger.The web example's Activity Log now includes an opt-in "Show SDK traces" checkbox that pipes all SDK log output into the UI.
Made with Cursor