Migrate example-bboard to Midnight Ledger v8#1350
Open
aagargoura wants to merge 19 commits intomidnightntwrk:mainfrom
Open
Migrate example-bboard to Midnight Ledger v8#1350aagargoura wants to merge 19 commits intomidnightntwrk:mainfrom
aagargoura wants to merge 19 commits intomidnightntwrk:mainfrom
Conversation
- @midnight-ntwrk/ledger-v7 7.0.0 → @midnight-ntwrk/ledger-v8 8.0.3 - @midnight-ntwrk/midnight-js-* 3.0.0 → 4.0.2 - @midnight-ntwrk/testkit-js 3.0.0 → 4.0.2 - @midnight-ntwrk/dapp-connector-api 4.0.0 → 4.0.1 - @midnight-ntwrk/wallet-sdk-facade 1.0.0 → 3.0.0 - @midnight-ntwrk/wallet-sdk-address-format 3.0.0 → 3.1.0
…2 to v3 Update all import paths from @midnight-ntwrk/ledger-v7 to @midnight-ntwrk/ledger-v8 and @midnight-ntwrk/onchain-runtime-v2 to @midnight-ntwrk/onchain-runtime-v3 across CLI, UI, and shared modules.
- dustAddress → address - walletBalance() → balance() - Remove UtxoWithMeta import from wallet-sdk-dust-wallet (no longer exported) - Map unshielded UtxoWithMeta (now Data.Class with utxo/meta) to flat format
- ShieldedWallet/UnshieldedWallet are now type aliases, not classes; use ShieldedWalletAPI/UnshieldedWalletAPI for function parameters - Remove unused getInitialState (relied on instanceof which no longer works) - ShieldedWalletState.address.coinPublicKeyString() → address.coinPublicKey.toHexString()
The Ledger v8 SDK now requires an accountId field for namespace isolation between different accounts/wallets using the same database.
Add setContractAddress and export/import stub methods required by the updated PrivateStateProvider interface in midnight-js-types 4.0.2. Export/import operations throw as they are not applicable to the in-memory browser provider.
The Ledger v8 PrivateStateProvider requires setContractAddress() before any get/set operations. For deploy, use fresh state directly since no contract address exists yet. For join, set the known address first.
Previously waitForUnshieldedFunds returned immediately after sync even with 0 balance, causing the CLI to exit. Now it continues listening for state changes until a non-zero balance appears (10 min timeout).
--experimental-specifier-resolution=node was removed in Node v24 and --loader is deprecated. Switch to tsx via --import for TypeScript execution. Also fix extensionless relative imports in the CLI.
…ssword complexity - Wrap post() and takeDown() calls in try/catch so errors are logged instead of crashing the CLI menu loop - Update private state provider password to meet new Ledger v8 complexity requirements (min 3 character categories)
Log elapsed time every 5 seconds and total duration for deploy, join, post, and takeDown operations to give users visibility while waiting.
Remove deprecated/unnecessary plugins and options: - Remove vite-plugin-top-level-await (native in Vite 8) - Remove commonjsOptions (deprecated, Rolldown handles CJS natively) - Remove esbuildOptions (deprecated, replaced by Rolldown) - Remove custom wasm-module-resolver plugin (no longer needed) - Convert manualChunks from object to function (Vite 8 requirement) Build time improved from 3s to 0.75s, bundle size reduced by 15%.
Add a shim that re-exports globalThis.WebSocket as both default and named export, fixing Rolldown IMPORT_IS_UNDEFINED warnings from the Midnight SDK's usage of isomorphic-ws.
- Update TypeScript badge to 5.9.3, Node.js to v24.14.0, Docker to 29.3.0 - Update Lace wallet instructions to support both Preprod and Preview - Fix Preview faucet link (was pointing to preprod) - Remove redundant npm install from sub-package build steps (workspaces) - Simplify install instructions to single root npm install
- Rename isomorphic-ws-shim.js to .ts so ESLint projectService can parse it - Configure no-unused-vars to ignore _-prefixed params/vars - Prefix unused currentContractAddress with underscore
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.
Summary
Migrate example-bboard to Midnight Ledger v8. Ledger v7 is no longer supported as of this release.
This PR updates all Midnight SDK dependencies, adapts to breaking API changes, recompiles the contract with the new Compact compiler, bumps Vite to the latest major version, and fixes runtime issues discovered during preprod/preview testing.
Dependency Updates
@midnight-ntwrk/ledgerv7(7.0.0)v8(8.0.3)@midnight-ntwrk/midnight-js-*@midnight-ntwrk/testkit-js@midnight-ntwrk/dapp-connector-api@midnight-ntwrk/wallet-sdk-facade@midnight-ntwrk/wallet-sdk-address-formatmidnightntwrk/proof-servertsxBreaking Changes Addressed
Ledger v7 to v8
@midnight-ntwrk/ledger-v7imports updated to@midnight-ntwrk/ledger-v8@midnight-ntwrk/onchain-runtime-v2references updated to@midnight-ntwrk/onchain-runtime-v3in Vite configDustWalletState API
dustState.dustAddressreplaced withdustState.addressdustState.walletBalance()replaced withdustState.balance()UtxoWithMetais no longer exported from@midnight-ntwrk/wallet-sdk-dust-wallet; unshielded UTXOs are now mapped from theData.Classformat (utxo/metanested properties) to the flat format expected by the dust walletWallet SDK Type Changes
ShieldedWalletandUnshieldedWalletare now type aliases (not classes), soinstanceofchecks no longer work; function parameter types updated toShieldedWalletAPI/UnshieldedWalletAPIShieldedWalletState.address.coinPublicKeyString()replaced withaddress.coinPublicKey.toHexString()getInitialStatefunction that relied oninstanceofLevelDB Private State Provider
levelPrivateStateProvidernow requires a mandatoryaccountIdfield for namespace isolation between accountsPrivateStateProvider Interface
setContractAddress()method required for scoping operationsexportPrivateStates()/importPrivateStates()stubs (not applicable to in-memory browser provider)exportSigningKeys()/importSigningKeys()stubs (not applicable to in-memory browser provider)Contract Address Scoping for Private State
PrivateStateProvidernow requiressetContractAddress()to be called before accessing statedeploy(): pass fresh private state directly instead of querying the provider (no contract address exists yet)join(): callsetContractAddress(contractAddress)before any private state operationsContract Recompilation
provableCircuitsrequired bycompact-runtime0.15.0Node.js Loader Compatibility
--experimental-specifier-resolution=node --loader ts-node/esmwithnode --import tsxin CLI launcher scripts (the old flags were removed/deprecated in Node.js v24).jsextensions to extensionless relative imports inbboard-cli/src/index.tsRuntime Fixes
waitForUnshieldedFundsreturning immediately with 0 balance after sync; now continues listening for incoming funds with a 600s timeoutsetContractAddress()before join--experimental-specifier-resolution=nodeand--loader ts-node/esmflags withtsxpost()andtakeDown()in try/catch so contract errors (e.g., posting to an occupied board) log the error and return to the menu instead of crashingImprovements
vite-plugin-top-level-await,commonjsOptions,esbuildOptions, and customwasm-module-resolverplugin — build time reduced from 3s to 0.75s (4x faster), bundle size reduced by 15%isomorphic-wsshim to resolve RolldownIMPORT_IS_UNDEFINEDWebSocket warnings in UI buildno-unused-varsto ignore_-prefixed params/varsOther Changes
Test Plan
contract:npm run cipasses (compile, typecheck, lint, build, 9/9 tests)api:npm run cipasses (typecheck, lint, build)bboard-cli:npm run cipasses (typecheck, lint, build)bboard-ui:npm run cipasses (typecheck, lint)bboard-ui:npm run cipasses (typecheck, lint, build for preprod and preview)References