Skip to content

refactor(wallet): resolve wallet key via @blockrun/core#2

Open
KillerQueen-Z wants to merge 2 commits into
masterfrom
feat/adopt-core
Open

refactor(wallet): resolve wallet key via @blockrun/core#2
KillerQueen-Z wants to merge 2 commits into
masterfrom
feat/adopt-core

Conversation

@KillerQueen-Z

Copy link
Copy Markdown
Collaborator

What

Delegates resolveWalletKey() in src/direct.js to the newly published @blockrun/core — the shared kernel that owns BlockRun's canonical wallet resolution order:

env BLOCKRUN_WALLET_KEY | BASE_CHAIN_WALLET_KEY → ~/.blockrun/.session → legacy wallet.key

Why

First step of the product-family convergence: every BlockRun tool (SDK, umbrella blockrun CLI, this bridge) should read the wallet through one source of truth instead of each re-implementing the scan. Kills drift by construction.

Diff

  • package.json / lockfile: + @blockrun/core ^0.0.2
  • src/direct.js: resolveWalletKey() body → resolvePrivateKey()?.privateKey (net −11 lines)

Verification

  • 19/19 unit tests pass (before and after)
  • Wallet parity: same address resolved via core (0x3491…402E)
  • End-to-end on the new code: direct-mode bridge started fresh; /health?full=true reports the same wallet + balance through the new path; a real /v1/responses request on a free model streams to response.completed

Delegate resolveWalletKey() to @blockrun/core's resolvePrivateKey() so the
resolution order (env BLOCKRUN_WALLET_KEY|BASE_CHAIN_WALLET_KEY ->
~/.blockrun/.session -> legacy wallet.key) is the single source of truth
shared with the SDK and the umbrella blockrun CLI.

Verified: 19/19 unit tests; direct-mode bridge end-to-end (health reports
the same wallet/balance, real /v1/responses request completes on a free
model).
- blockrun-codex bin alias so gh-style prefix discovery resolves
  `blockrun codex <cmd>` directly
- wallet/doctor --json now emit the @blockrun/core output contract
  ({ok,data}/{ok,error}) — same envelope as every BlockRun product
- fold remaining self-built pieces into core 0.0.3: address derivation
  (addressFromKey), cost-log path (paths().costLog — BLOCKRUN_HOME now
  applies), and the canonical .session path in start.mjs

Verified: 19/19 tests against registry core@0.0.3; direct-mode bridge
serves /v1/stats from the core-resolved ledger; `blockrun codex wallet
--json` end-to-end through the umbrella.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant