A browser extension (Chrome, Manifest V3) that watches your Steam trade offers and verifies P2P trades against your DMarket deals. It bundles the DMarket P2P trade-tracker core (compiled from Kotlin Multiplatform) and drives it from a Manifest V3 service worker.
Nothing runs until you turn it on. Installing the extension starts no tracking: until you activate it, from the banner it adds to your Steam Trade Offers page, it does not contact DMarket, report you as online, or create any Steam trade offer. Turning it back off stops all three again.
The trade-tracker business logic lives in a separate library — dmarket/p2p-tracker-core — consumed as the published npm package
@dmarket/p2p-tracker-corebehind a single import seam (src/core/tracker.ts). This repository owns the extension shell: the service worker, the popup, the on-page onboarding UI, and the page bridge.
- Node.js 22+ (WXT's own floor)
- npm 10+
- A Chromium-based browser for loading the unpacked build
npm install # installs deps and runs `wxt prepare`
npm run dev # dev build with hot reload (Chrome); includes the debug console
npm run build:debug # loadable debug build → .output/chrome-mv3-dev (debug console included)
npm run build # production build → .output/chrome-mv3 (debug tooling excluded)
npm run zip # packaged production zip
npm run zip:debug # packaged debug zip (same build as build:debug, zipped)
npm run check # the full gate: compile (tsc + guards) + lint + unit tests
npm run compile # type-check and guard scripts only
npm test # unit tests only (Vitest)
npm run lint # ESLint onlyLoad the unpacked extension via chrome://extensions (Developer mode → Load unpacked): use
.output/chrome-mv3-dev for a debug build or .output/chrome-mv3 for a production build. A packaged
production build of each release is attached to its
GitHub Release.
npm run check is the gate, and it is exactly what CI runs. Formatting is deliberately not
enforced — there is no Prettier configuration, so running Prettier here reformats whole files with
its own defaults.
Chrome is the shipping target. A Firefox build exists and is code-complete but has not been
live-validated, so treat it as unreleased: npm run build:firefox, npm run build:debug:firefox,
npm run zip:firefox → .output/firefox-mv3*. Same sources; the manifest gains webRequest (the
anti-CSRF path there is blocking webRequest rather than declarativeNetRequest) and a
browser_specific_settings.gecko block. Load it via about:debugging. Host permissions are opt-in
on Firefox MV3, so a development build needs them granted by hand in about:addons.
Copy .env.example to .env and fill in the values you need. Error reporting stays inactive until
its variable is present, so the extension builds and runs with an empty .env. Only WXT_-prefixed
variables are exposed to the bundle.
A single JSON document on the DMarket CDN overlays the compiled-in defaults, so a Steam or DMarket
change (a path, a regex, a cookie name, a timing) can be fixed without a store release. Production
builds read https://cdn-main.dmarket.com/p2p/extension-config.json; development builds read
WXT_DEV_REMOTE_CONFIG_URL when it is set. The extension revalidates the document with its ETag
at most once per web.remoteConfigFetchIntervalMs (1 h by default), backs off for 15 min after a
failed fetch, and keeps the last good document when anything goes wrong. With no document at all it
runs on the compiled defaults. The document is data only and every field is validated; a field that
fails validation is ignored rather than applied.
The document lives in the repo, in buckets/<env>/p2p/extension-config.json, and lists every
publishable field with the value in effect. src/config/bucketConfig.test.ts keeps both files
complete and valid, and pins every value that differs from a compiled default, so a core update that
changes a default cannot be silently overridden by a stale published value.
npm run config:download # pull the published documents into buckets/
npm run config:upload:stage # validate, show the diff against what is live, publish
npm run config:upload:prod # the same, and asks before publishing to production
npm run config:stage-to-prod # copy the stage document over the local prod one, to reviewThe scripts touch that one object only: the buckets are shared with other DMarket clients. Uploads use a generation precondition, so a change someone else published after the diff is never overwritten.
web.minExtensionVersion is the oldest version allowed to keep working (numeric, e.g. 1.0.6). An
install below it asks Chrome for the update once, reloads onto it when Chrome has it, and reports its
progress to dmarket.com in the presence pong as update: { required, minVersion, state } — the page
renders that and compares nothing itself. Paused: the published documents carry no minimum, so no
install is asked to update, and CI does not raise one (see below).
Two things are compiled in rather than configured, because their absence is silent and expensive: the
DMarket API and FE origins, and the production notary URL. So a production build arms the real TLSN
prover with no configuration at all; remote config can redirect the notary but can no longer switch it
off. The WXT_DEV_* variables override these in development builds only, and are dead code in a
production one.
The extension ships a debug console — a developer-only dashboard for inspecting the tracker at
runtime. It is compiled into development builds only and is stripped entirely from production builds
(npm run build / npm run zip).
Build a loadable debug build and load .output/chrome-mv3-dev unpacked:
npm run build:debugOpen it from the popup's “debug console” link (dev builds only), or navigate to the extension's
debug.html. It provides:
- a live network log of the core's HTTP traffic — each request as a copy-pasteable
curl, with the decoded response, and the core's lifecycle frames interleaved in causal order. Credentials are redacted at capture time; identifiers (steamids, deal ids,deviceId) are deliberately kept, since they are what the log exists to correlate; - session status: extension + core version, next-heartbeat countdown, Steam/DMarket sign-in indicators, the
mirrored
block:reason, which prover the core resolved (prover:), and the outcome of the last proof (proof:) — a prover being configured and a proof being attempted are different facts, so they get separate pills; - an endpoint switcher for the FE, API and notary URLs, with Prod / Stage / Dev prefill buttons for the first two (debug builds default to Stage, else Dev). FE and API restart the tracker in place; the notary URL is applied independently;
- force tick (an immediate heartbeat), retry proof (restart the tracker so a proof the core has latched off as refused is attempted again) and refresh config (fetch remote config now, bypassing the refetch interval and the failure backoff). Each writes its outcome to the session log rather than to a transient pill, so it is timestamped against the traffic it caused;
- a blocking-state simulator: reproduce any state in the chain — no DMarket session, no Steam
session, wrong Steam account, onboarding not completed, DMarket error — by its real cause (the
core is pointed at a cookie name nothing holds, or a heartbeat reply is synthesised), not by
overwriting the mirrored reason. Rails refuse the Steam session-transfer and DMarket
refresh-tokenendpoints while armed, so simulating a signed-out state cannot rotate a live credential. This is also where the activation flag is toggled — which starts and stops the core, so the un-activated state can be walked end to end from here; - a freshness-mark injector for demand-driven proving, pinned to the storage row that holds the core's answer;
- simulate suspicious offer: makes the trade-offer guard warn about an outgoing Steam offer (yellow
give-only or red impersonation) without any trade. It feeds the same
SuspiciousOutgoingOffersevent the core emits, so the toolbar badge, the popup line and the banner on/tradeoffers/sent/all react; an offer id Steam does not list gets a stand-in block on that page; - a
chrome.storage.localinspector/editor to view, edit, add and remove persisted keys. JSON-in-string values are expanded for reading whileeditstill shows the raw stored value, and credentials are rendered through the redactor (so a row'ssteam_idand expiry are readable without exposing the token).
Steam's hosts are hard-coded in the tracker core, so the Steam-coupled flows (session refresh, trade
send, cancel) normally need a live Steam account. Set WXT_DEV_STEAM_URL to a local origin and a
non-production build sends every Steam request the core makes there instead — in an ordinary browser
window, with no launch flags. Only fetch is redirected: the Steam session cookie is still read from
the real steamcommunity.com origin, so set that cookie by hand for Steam to read as connected.
Unset (the default) means real Steam, and production builds ignore the variable entirely.
CircleCI (.circleci/config.yml). Every push runs:
| Job | Waits for | What it does |
|---|---|---|
check |
— | npm run compile (tsc + the guard scripts), npm run lint, npm test |
build-prod |
check |
production zip → the job's Artifacts tab |
build-debug |
check |
development zip (debug console, internal endpoints) → Artifacts |
publish_debug_build |
build-debug |
main only: uploads that zip over the QA autotests' latest.zip in a stage Cloud Storage bucket |
verify_store |
— | never automatic; started by hand once a release is live (see below) |
The two builds run in parallel with each other, but neither starts until the checks pass — an installable artifact should never come from a pipeline whose own checks are red.
A push to release/vX.Y.Z adds the release chain to that same pipeline, so one release is one
pipeline: hold_release (approval) → release (tag + GitHub Release with the zip) → pack_crx →
store_preflight → upload_to_store → delete_release_branch. Those six exist only on a release
branch, and hold_release is the only approval among them; a push anywhere else runs the three jobs above and nothing more.
GITHUB_TOKEN comes from the org-wide org-global context, listed on release, pack_crx and
delete_release_branch. Everything else is a project-level environment variable:
| Variables | Used by |
|---|---|
WXT_* build configuration |
build-prod, build-debug, verify_store |
CRX_SIGNING_KEY_B64 (the CRX signing key) |
pack_crx |
CHROME_EXTENSION_ID, CHROME_PUBLISHER_ID, CHROME_SERVICE_ACCOUNT_* |
store_preflight, upload_to_store |
P2P_EXTENSION_DEPLOY_SA_KEY |
publish_debug_build; raise_min_version and approve_force_update (paused) |
DEBUG_BUILD_GCS_URI |
publish_debug_build |
CircleCI hands project variables to every job on every branch, and check and the builds run
dependency code on every push, so nothing here keeps the signing key and the store credentials apart.
check, the builds and verify_store unset the store, signing and bucket variables in their first
step; that is a mitigation, not a boundary. The fix is one context per group of secrets, restricted to
this project, which needs CircleCI organization rights. Keep the project's "Build forked pull requests"
and "Pass secrets to builds from forked pull requests" settings off.
Both zips are meant to be installed by hand: download, unzip, then chrome://extensions →
Developer mode → Load unpacked. Each build is verified by scripts/verify-build.mjs, which
checks the manifest version and version_name, the production permission/host surface, the absence
of debug tooling and of a wrapped fetch from a production bundle, that the production notary URL is
present (without it the core silently runs the no-op prover and every proofRequired deal stalls),
and that the TLSN prover was copied in. It also asserts the inverse for a development build, since
wxt build without --mode development produces a directory that looks fine and has no debug
console in it.
Steps 1–3 land on main through a normal pull request. The release branch is cut from main only
after that PR is merged, and it is deleted once the release is done — it is never merged back, so
anything that exists only on it is lost from main.
- Pin
@dmarket/p2p-tracker-coreto an exact stable version (npm install, commit the lockfile) — currently1.0.3-beta. A build made against a-SNAPSHOTcore is never released: a snapshot can be unpublished from npm, which would make the published build unreproducible. Note thatnpm run core:latestdeliberately moves the pin onto the newest snapshot for development work, so put it back before releasing. - Bump
versioninpackage.json. This is the single source of truth: WXT derives the manifest version from it, the zips are named from it, and the tag isv+ it. A SemVer prerelease suffix is fine — Chrome accepts only 1–4 dot-separated integers, so WXT puts the numeric prefix inmanifest.versionand the full string inversion_name(which is what Chrome shows on the extension card).1.0.0-beta.1ships as version1.0.0/ version_name1.0.0-beta.1. - Add the matching
## [x.y.z]section to CHANGELOG.md — it becomes the release notes, and the release fails without it. - Branch off the merged
mainasrelease/vX.Y.Z(e.g.release/v1.0.1), with no commits of its own. The release jobs run only on branches matching that pattern, and the version in the name must equal step 2's —releasefails before tagging if they disagree. - Push the branch, then approve
hold_releasein CircleCI. That is the only click: the build is then tagged, published, signed and submitted to the Chrome Web Store, anddelete_release_branchremoves the branch at the end. A push that released nothing (tag already there,[skip release], snapshot core) keeps its branch.
Only then does CI tag v<version> and publish a GitHub Release with the production zip, a sourcemaps
archive (for symbolicating crash reports), the production manifest and SHA256SUMS. Only a 0.x
version — never released at all — is marked Pre-release on GitHub. A -beta is not: betas are
ordinary public releases that ship to every store user, so the beta is the latest release, and the
badge would only point people at an older stable build than the one actually in the store.
The debug build is deliberately not published — it is not what ships, and it inlines the internal
WXT_DEV_*/WXT_STAGE_* endpoints. Download it from the build-debug job's Artifacts tab in
CircleCI, on any push. From main it also goes to a private stage bucket, where the UI autotests pick
it up (scripts/ci/publish-debug-build.mjs): the object is always overwritten, so it is the build of
the last green main pipeline, and its metadata (gsutil stat) names the version, commit and build.
The target is DEBUG_BUILD_GCS_URI (gs://<bucket>/<object>), a project environment variable.
verify_store answers "is the package in the Chrome Web Store the one we built from this tag?". It asks the
public update server what it serves (scripts/ci/cws-served-version.sh), downloads that CRX, rebuilds the
tag and compares the two (scripts/ci/verify-crx.sh): file hashes (ignoring the store's _metadata/,
sourcemaps and the update_url it adds to the manifest), the manifest's privilege surface and the hosts
named in the bundle. It exits non-zero on any difference, and with code 3 when the store does not serve the
tag's version yet.
It is not part of the release pipeline: store review takes hours to weeks, and a second approval would
leave every release "On Hold". Start it once the release is live, from main:
circleci pipeline run --project gh/dmarket/p2p-extension --branch main --param verify_store_tag=v1.0.6-beta
Paused. None of this runs today: the
ciworkflow does not includewatch_store_release,hold_force_updateorapprove_force_update, so a release creates no schedule and never parks "On Hold". The.circleci/config.ymlheader says what to restore to turn it back on. The rest of this section describes how it works once re-enabled.
Every release that reaches upload_to_store gets a CircleCI schedule, store-release-<version>, created
through the API and polling Chrome's update server every 30 min on main. Once the store actually serves
the version, it starts one store_release pipeline and deletes itself. That pipeline posts
":rocket: p2p-extension … is live in the Chrome Web Store" to the release channel (org context
dm-release-notify) and, in parallel, raises web.minExtensionVersion in the live prod document if the
release was forced. A release still unserved after 45 days gets a warning instead. Nothing runs between
releases, and nothing waits on store review inline.
Forcing is decided in the release pipeline and nowhere else: approve hold_force_update only for a
release every seller must move to. The deferred pipelines only read that approval. The minimum is raised
once the version is served and the approval is given, by whichever comes second, so approving after the
store was faster still works. Leaving the approval alone is the normal answer: the pipeline then stays
"On Hold". Waiting for the update server is also what makes the extension's single update check find the
build instead of being throttled for hours.
A push whose version is already tagged releases nothing, so re-pushing a release branch is safe;
[skip release] in the commit message skips it explicitly. main still runs check and both builds
on every push — it just cannot release.
Publishing to the Chrome Web Store continues in the same pipeline, with no further approval:
release → pack_crx → store_preflight → upload_to_store → delete_release_branch
pack_crx re-verifies the released zip and wraps it unchanged in a CRX3 signed with our own key (the
store item uses Verified CRX Uploads, so a plain zip is rejected). store_preflight then rehearses
the upload against the live store — read-only, it cannot send anything — so a wrong id, a missing
service account or a version the store would refuse fails before any write. Only upload_to_store
writes. A failed store step is retried by re-running the workflow from failed; the branch is still
there, because it is deleted only after the upload succeeds.
Every release consumes one numeric version, beta or not:
1.0.1-beta → 1.0.2-beta → 1.0.3 → 1.1.0-beta → 1.1.1
Betas are ordinary public releases that ship to every store user — the -beta suffix is a label so
users hold the right expectations, not a channel (the store has none: API v2 exposes only staged
rollout by percentage, which needs 10k+ weekly users). Chrome shows the full string, suffix included,
as version_name on the extension card.
So the usual SemVer habit of 1.1.0-beta.1 → 1.1.0-beta.2 → 1.1.0 does not work here: the
store compares manifest.version, from which WXT has already dropped the suffix, so all three are
manifest 1.1.0 and only the first could be uploaded. Bumping a suffix is not a version bump as far
as the store is concerned — which also makes a counter inside the suffix (-beta.2) misleading, since
the numbers already count the releases. upload_to_store's preflight refuses a non-increasing version
before uploading anything.
src/
entrypoints/ # service worker, popup, content scripts, offscreen document, debug page
background/ # service-worker glue: core lifecycle, anti-CSRF, toolbar icon, cookie watch, bridge router
config/ # compiled-in defaults, the remote-config overlay, core parameter order
core/ # single import seam for the tracker core, plus the notary proof delegate
messaging/ # typed message contracts + the dmarket.com page bridge
state/ # activation flag (gates the core), mirrored blocking reason, and the surface resolver
infra/ # error reporting, remote-config fetch
debug/ # developer-only debug console service-worker glue (dev builds only)
ui/ # popup, on-page UI, and debug-console components
util/ # redaction, storage-event registrar, match patterns
assets/ # icons used by the popup and on-page UI
testing/ # shared test stubs
buckets/ # the remote-config documents per environment, and the scripts that publish them
scripts/ci/ holds the shell and Node behind the CircleCI jobs. scripts/ itself holds four guards that mechanise invariants a unit test cannot reach. Three run as part of
npm run compile: the core's positional configuration order against the installed package
(check-core-params), the blocking-state priority table against the core's own resolver
(check-surface-priority), and the create-trade cause mapping (check-create-trade-cause). The
fourth, verify-build, needs a built output and runs in CI's build jobs (npm run verify:build).
- WXT — Manifest V3 build framework
- Preact — UI
- TypeScript
- Vitest — unit tests, with WXT's fake-browser extension APIs
- ESLint — type-aware linting (
typescript-eslint); no formatter @dmarket/p2p-tracker-core— the trade-tracker business logic, compiled from Kotlin Multiplatform
See LICENSE.