feat: advanced chart core implementation - #10521
Merged
Merged
Conversation
sahar-fehri
added this pull request to stack #10522
September 28, 2026 13:28
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
sahar-fehri
force-pushed
the
feat/advanced-chart-core-implementation
branch
from
September 28, 2026 14:47
452564c to
45c2cd5
Compare
Base automatically changed from
chore/bootstrap-advanced-chart-core
to
main
September 28, 2026 16:00
sahar-fehri
force-pushed
the
feat/advanced-chart-core-implementation
branch
from
September 28, 2026 16:00
45c2cd5 to
f9dcb55
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
There are 5 total unresolved issues (including 3 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f9dcb55. Configure here.
sahar-fehri
force-pushed
the
feat/advanced-chart-core-implementation
branch
from
September 29, 2026 06:44
f9dcb55 to
d518059
Compare
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
salimtb
approved these changes
Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
Add the full implementation of
@metamask/advanced-chart-core— the platform-agnostic TradingView Advanced Charts WebView engine, ported frommetamask-mobile.Stacked on #10520 (bootstrap/scaffold PR).
What this PR adds
Core engine (
src/core/)bootstrap.ts— WebView initialization, state seeding, Phase 1 handler registrationbridge.ts— JSON framing/parsing for host communication, delegates transport to the active hosthost.ts— InjectableChartHostTransportinterface withsetHostTransport/getHostTransportstate.ts— Centralized chart state managementdataLifecycle.ts,loadLibrary.ts,resolution.ts,timeUtils.ts,timezone.ts— Data lifecycle, TradingView library loading, resolution helpersPlatform adapters (
src/platform/)reactNativeHost.ts— React Native WebView transport (default, preserves existing mobile behavior)iframeHost.ts— Browser/extension iframe transport with origin allowlistingFeatures (
src/features/)indicators/— Technical indicator overlays, legend, resize, studies, sub-pane managementvolume/— Volume chart overlayWidget (
src/widget/)initChart.ts,datafeed.ts,chartType.ts— TradingView widget initialization and data feedtheme.ts,visualOverrides.ts,scaleLayout.ts— Theming and layoutohlcvIngestion.ts— OHLCV candle data ingestionpriceFormatter.ts,tvDomHelpers.ts,externalLinkBridge.ts— UtilitiesOverlays (
src/overlays/)tradeMarkers/— Trade execution marker rendering with hit-testing and animationpositionLines/— Open position line overlayssocialLeaderboard/— Social leaderboard overlayfocusTime/— Focus time overlayMessages (
src/messages/)handler.ts,contract.ts— Inbound message handling and message contract typesPagination (
src/pagination/)priceApi.ts,rnBacked.ts— Historical price data paginationEntry points
src/index.ts— Mobile RN WebView IIFE entry (auto-boots withcreateReactNativeHost)src/host-entry.ts— Side-effect-free entry for non-mobile hosts (extension iframe)Monorepo changes
oxlint.config.ts— Addsenv: { browser: true }override forpackages/advanced-chart-core/**oxlint-suppressions.json— Adds suppression entries for vendored mobile codepackage.json— Addsjest-environment-jsdomand./hostsubpath exportTest coverage
References
Checklist
Note
Medium Risk
Large new chart/WebView surface area tied to RN messaging and TradingView behavior; regressions would affect in-app charts, though risk is tempered by extensive tests and largely ported logic.
Overview
Delivers the full
@metamask/advanced-chart-coreWebView engine (ported from mobilechartLogic.js), replacing the package placeholder/greeter test with a modular bootstrap, RN↔WebView messaging, centralized state, and TradingView widget lifecycle.Bootstrap and wiring:
bootstrap()reads config via injectableChartHostTransport(React Native default inindex.ts;./hostexport for iframe/extension hosts), registers inbound handlers (OHLCV, theme, indicators, volume, overlays, pagination), preloads the TV library, and creates the widget on first OHLCV data—including initial visible-range timeframe and chart-ready hooks (crosshair, legend, trade markers, etc.).Tooling: Jest runs in
jsdompackage-wide; oxlint gets a browser env override for this package plus suppressions for vendored/test patterns.package.jsonaddsjest-environment-jsdom, a./hostsubpath export, and drops unused messenger/typedoc dev scripts.Tests: Replaces the smoke test with broad unit coverage (core, bridge, bootstrap dispatch paths, indicators/legend, and related modules) using test reset hooks and mocked DOM/RN bridge.
Reviewed by Cursor Bugbot for commit d518059. Bugbot is set up for automated code reviews on this repo. Configure here.