Skip to content

Conversation

@pasevin
Copy link
Collaborator

@pasevin pasevin commented Oct 12, 2025

Wallet phase (US1) complete: add adapter-midnight wallet connection unit tests (T006–T008), enable Vitest config, fix adapter imports; update spec and tasks for stacked branch strategy; add changeset (patch).

pasevin added 13 commits October 9, 2025 12:57
- Enable Midnight in builder ecosystem registry
- Create shared MidnightIcon React component in ui package
- Remove duplicate MidnightLogo.svg assets from builder and ui packages
- Update NetworkStatusBadge, ChainSelector, and NetworkRow to use shared component
- Remove TypeScript compilation step from builder package build
- Restore DTS generation for all packages after resolving build dependencies

Fixes Midnight network badge display issue in contract load wizard and ensures
proper TypeScript support across the monorepo.
…ctor

# Conflicts:
#	packages/builder/src/components/UIBuilder/StepChainSelection/components/NetworkRow.tsx
#	packages/ui/src/components/ui/network-status-badge.tsx
- Add LaceWalletImplementation with polling-based event emulation
- Add singleton manager and facade connection API
- Add MidnightWalletUiRoot; remove redundant MidnightWalletProvider
- Prevent repeated popups; focus-based dismissal; 60s fallback
- Add README for wallet module; add changeset
@pasevin pasevin requested a review from a team as a code owner October 12, 2025 22:22
@pasevin pasevin added midnight Midnight Ecosystem Related Issues do not merge labels Oct 12, 2025
@pasevin pasevin requested a review from Copilot October 14, 2025 14:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR completes the Midnight v1 wallet phase by refactoring the wallet management architecture to an event-driven system with polling-based event emulation, adding comprehensive unit tests, and enabling Vitest configuration. The changes fix adapter imports, update specs and tasks for stacked branch strategy, and ensure wallet connection functionality is fully tested and documented.

Key Changes

  • Refactored wallet architecture to mirror Stellar adapter patterns with event-driven polling system
  • Added unit tests for wallet connection functionality and enabled Vitest configuration
  • Updated project specifications and task definitions for stacked branch implementation strategy

Reviewed Changes

Copilot reviewed 39 out of 42 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
specs/004-add-midnight-adapter/ Complete specification documentation for stacked branch strategy
packages/ui/src/ Added MidnightIcon component and updated network status components
packages/builder/src/ Enabled Midnight ecosystem by default and updated build configuration
packages/adapter-midnight/src/wallet/ Refactored to event-driven architecture with LaceWalletImplementation
packages/adapter-midnight/src/tests/ Added comprehensive wallet connection unit tests
packages/adapter-midnight/vitest.config.ts Enabled Vitest testing configuration
.changeset/ Added changesets documenting wallet architecture and testing improvements
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pasevin pasevin requested a review from Copilot October 14, 2025 16:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 48 out of 51 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

pasevin and others added 2 commits October 14, 2025 19:00
* feat(adapter-midnight): align export deps to manifest (FR-017)

Align runtime deps with export manifest for v1.

Keep only @midnight-ntwrk/dapp-connector-api.

Remove placeholder Midnight SDK deps from adapter config.

Ensures FR-017 dependency sync policy.

* docs(adapter-midnight): complete architecture/parity checklists and mark Phase 1-2

Mark T001, T002, T003, T005 as done for Phase 1-2.

* chore(config): add .eslintignore with monorepo defaults

Ignore node_modules, dist, build, coverage, exports, caches, and generated artifacts.

* chore(config): update .prettierignore patterns

Add standard ignores: node_modules, dist, build, coverage, exports, caches, CI dirs.

* feat(adapter-midnight): add contractDefinitionArtifacts and loader parity

* test(adapter-midnight): update artifacts tests to use contractDefinition

* Midnight v1 – 03 Auto Simple View Rendering (#207)

* fix(adapter-midnight): add pnpm patches for Midnight SDK browser compatibility

- Patch @midnight-ntwrk/compact-runtime for Node.js polyfills
- Patch @midnight-ntwrk/midnight-js-indexer-public-data-provider for
  Apollo Client ESM, cross-fetch, and Network ID module singleton
- Patch @midnight-ntwrk/midnight-js-network-id for peer dependency
- Patch @midnight-ntwrk/midnight-js-types for peer dependency
- Patch @midnight-ntwrk/midnight-js-utils for peer dependency
- Add tsup.config.ts external WASM packages configuration
- Add comprehensive documentation in MIDNIGHT-SDK-PATCHES.md

* feat(adapter-midnight): consolidate provider config and add view function validation

- Move getWalletConfigIfAvailable to configuration module for proper alignment
- Consolidate provider configuration logic in query handler
- Add view function validation (isViewFunction check) and early address validation
- Implement RPC endpoint precedence: user override > wallet config > network config
- Add network ID handling with numeric mapping support
- Add derivation logic for indexer URIs from RPC endpoints as fallback
- Update network config type to include networkId enum value
- Align query handler pattern with EVM and Stellar adapters

This completes Phase 5 (US3) for auto-rendering simple view functions with proper
validation and wallet privacy preference integration.

* test(adapter-midnight): add comprehensive Phase 5 unit tests for view functions

Add 56 unit tests covering Phase 5 (US3) - Auto Simple View Rendering:

- View Function Validation (12 tests)
  ✓ Identifies read-only vs state-modifying functions
  ✓ Handles parameter-less and parameterized views
  ✓ Detects edge cases (empty functions, complex types, options)

- Query Handler Input Validation (8 tests)
  ✓ Validates contract schema structure
  ✓ Verifies address format detection
  ✓ Tests function existence checks and view-only enforcement

- Output Formatter (36 tests)
  ✓ Primitives (numbers, strings, booleans) display without quotes
  ✓ BigInt values formatted correctly
  ✓ Null/undefined handling
  ✓ Complex types (arrays, objects, nested structures)
  ✓ Error handling and edge cases

All tests follow Vitest patterns and align with existing test infrastructure.
Addresses Phase 5 requirements for defense-in-depth validation,
view-function enforcement, and consistent output formatting.

* chore(deps): update pnpm lock file

* Update patches/@midnight-ntwrk__midnight-js-indexer-public-data-provider@2.0.2.patch

Co-authored-by: Copilot <[email protected]>

* Update patches/@midnight-ntwrk__midnight-js-indexer-public-data-provider@2.0.2.patch

Co-authored-by: Copilot <[email protected]>

* Update packages/adapter-midnight/src/query/handler.ts

Co-authored-by: Copilot <[email protected]>

* fix(adapter-midnight): validate contract module before eval and block dangerous globals

* Update packages/adapter-midnight/src/validation/address.ts

Co-authored-by: Copilot <[email protected]>

* Update packages/builder/vite.config.ts

Co-authored-by: Copilot <[email protected]>

* fix(adapter-midnight): add specific error handling for wallet config retrieval

* fix(adapter-midnight): address PR feedback for views, wallet config, formatting, validation

* Midnight v1 – 04 Write & Export (#208)

* fix(adapter-midnight): correct indexer-public-data-provider patch

- Remove invalid assertIsContractAddress import from @midnight-ntwrk/midnight-js-network-id
- Keep only correct import from @midnight-ntwrk/midnight-js-utils
- Maintain Apollo Client ESM import fixes
- Add sync-patches-to-adapters.js script for automated patch management
- Update adapter package.json with patchedDependencies for npm publishing
- Update .gitignore to exclude generated packages/*/patches/ directories
- Document expected pnpm warning in patches/README.md

* fix(adapter-midnight): revert patch

* fix(adapter-midnight): restore complete indexer patch with module singleton workarounds

* fix(adapter-midnight): remove escaped backticks from indexer patch

* feat(adapter-midnight): implement execution strategy pattern and export config

- Implement ExecutionStrategy interface and EoaExecutionStrategy class
  mirroring EVM adapter architecture
- Refactor signAndBroadcast to use strategy pattern for extensibility
- Rename MidnightCallContractParameters to WriteContractParameters
  for clarity
- Add runtime and dev dependencies to config for exported apps
  (React, Midnight SDK packages, types)
- Export execution strategy components via transaction/index.ts
- Update tasks.md: Phase 6 complete (T014-T016)

* fix(builder): suppress sourcemap warnings for patched Midnight SDK packages

- Add custom Vite logger to filter out sourcemap warnings
- Patched packages have sourcemaps referencing missing source files
- Warnings are harmless but create noise in dev console

* fix(builder): remove sourcemaps from patched Midnight packages

- Add postinstall script to remove .map files from patched packages
- Sourcemaps reference missing source files, causing Vite warnings
- Script removes 70+ .map files to clean up dev console
- Also add sourcemapIgnoreList to build config for completeness

* fix(adapter-midnight): fix failing test expectations

- Update output-formatter test to expect 'Invalid outputs definition' error message
- Update address validation test to use proper input with separator for bech32m decode error testing

* Update scripts/sync-patches-to-adapters.js

Co-authored-by: Copilot <[email protected]>

* refactor(adapter-midnight): remove duplicate parameter in parseMidnightInput

Simplified parseMidnightInput signature from 3 parameters to 2 by removing
the redundant fieldType parameter. The function now takes only the value
and parameterType, following the same pattern as the Stellar adapter.

Updated formatMidnightTransactionData to call with the new signature.

* fix(builder): memoize address validation to prevent re-render loops

- Add useMemo hooks in useUIBuilderState to cache address and validation result
- Update effect dependencies to use memoized values instead of raw address
- Add address validation caching in useContractLoader.canAttemptLoad
- Prevents excessive isValidAddress calls during rapid re-renders

* feat(ui): add FileUploadField component for file uploads

- Add new FileUploadField component with drag-and-drop support
- Implement file size validation and type filtering
- Add optional base64 conversion for storage
- Include visual feedback for upload status (success/error/processing)
- Support accessibility features (ARIA attributes, keyboard navigation)
- Add file-upload type to form field types
- Register FileUploadField in field registry
- Export component from ui package

Features:
- Drag-and-drop file upload with visual feedback
- File type validation (accept prop)
- File size validation with custom limits
- Optional base64 conversion for storage
- Clear visual states (idle, uploading, success, error)
- Keyboard accessible
- Responsive design
- Integration with React Hook Form
- Helper text with file requirements display

Usage: Designed for uploading contract artifacts (ZIP files) in Midnight adapter

* chore(release): add changeset for FileUploadField component

* refactor(adapter-midnight): remove dead fallback code from schema parser

- Remove unused fallback pattern for Contract class circuits
- Remove unused fallback pattern for ledger function
- Simplify extractCircuits to only match actual Midnight compiler output
- Simplify extractQueries to only match Ledger and Queries type patterns
- Improve comments to clarify what patterns are matched
- No behavior change: fallbacks never matched real Midnight contracts

Reduces code by ~30 lines and improves maintainability.

* refactor(adapter-midnight): improve schema parser robustness

**DRY Improvements:**
- Extract capitalizeFirst() helper to eliminate code duplication
- Use consistent naming across all function builders

**Semantic Clarity:**
- Rename extractQueries() → extractLedgerProperties() for accuracy
- Ledger properties are readonly state values, not query methods
- Update log messages to reflect 'ledger' instead of 'queries'

**Robustness:**
- Add try-catch error handling to main parser function
- Improve parameter parsing to handle complex TypeScript types
- Handle nested brackets/angles in type definitions (Record<K,V>, generics, etc.)
- Add fallback parsing with better error logging
- Add validation for malformed parameter definitions

**Testing:**
- Add test cases for complex parameter types
- Test Record<string, number> with nested colons
- Test object types with inline definitions
- Test multiple complex parameters
- Tests demonstrate improved parsing of real-world types

**Benefits:**
- More accurate semantic naming (ledger vs queries)
- Better error messages for debugging contract issues
- Handles complex TypeScript generic types correctly
- Graceful fallback for edge cases
- ~95 additional lines for robustness (+75 implementation, +20 tests)

* feat(tests): add local export testing script with Tailwind 4 support

- Add test-exported-app-local.sh script to test exported apps with local packages
- Script builds, packs, and replaces dependencies with local file: paths
- Automatically updates Tailwind 4 import to use local monorepo source
- Add pnpm test:export command for convenience
- Update export testing documentation with new command usage

* refactor(adapter-midnight): remove chain-specific wrapper and add comprehensive unit tests

- Remove midnightViteConfigLoader.ts wrapper utility
- Update builder vite.config.ts to directly import from adapter
- Fix vite-config.ts: remove network-id from include (only in exclude + dedupe)
- Add comprehensive unit tests for config.ts (32 tests)
- Add comprehensive unit tests for vite-config.ts (42 tests)
- Tests validate structure, dependencies, vite config, and consistency

* chore(config): add .pnpm-store and .packed-packages to .gitignore

These directories should not be committed to the repository:
- .pnpm-store: pnpm's content-addressable package cache
- .packed-packages: temporary tarballs created by local testing scripts

Also fix unused variable warnings in config.test.ts

* fix(adapter-midnight): add TypeScript null checks to config.test.ts

- Add expect(viteConfig).toBeDefined() assertions before accessing properties
- Use non-null assertion operator (!) after explicit checks
- Use optional chaining (?.) for nested potentially undefined properties
- Use nullish coalescing (??) for Object.entries to handle undefined values
- All 32 tests pass successfully

* fix(adapter-midnight): add TypeScript null checks to config.test.ts

- Add nullish coalescing (??) for Object.entries to handle undefined objects
- Prefix unused destructured parameters with underscore (_pkg)
- Add expect(viteConfig).toBeDefined() assertions before accessing properties
- Use non-null assertion operator (!) after explicit checks
- Use optional chaining (?.) for nested potentially undefined properties
- All 32 tests pass successfully

* fix(adapter-midnight): restore midnight-js-network-id to optimizeDeps include

The package was incorrectly moved to exclude list, causing runtime errors:
'Cannot read properties of undefined (reading TestNet)'

Despite having top-level await, this package MUST be pre-bundled because:
1. It's a singleton that needs deduplication
2. vite-plugin-top-level-await handles the top-level await
3. Without pre-bundling, the NetworkId enum is undefined at runtime

This reverts the change that broke UI builder transaction execution.

* test(adapter-midnight): update vite-config tests for midnight-js-network-id in include

Updated tests to reflect that midnight-js-network-id must be pre-bundled:
- Removed from wasmPackages list in exclude test
- Changed test expectation: now in dedupe + include (not exclude)
- Added explanatory comments about why it needs pre-bundling

The package requires pre-bundling despite having top-level await because
without it, the NetworkId enum is undefined at runtime. The
vite-plugin-top-level-await plugin handles the top-level await syntax.

* feat(types): add adapter export bootstrap interfaces and base method

* feat(export): inject adapter bootstrap via template markers and add Vite config generator

* feat(builder): persist adapter artifacts and original contract definition for export

* feat(adapter-midnight): add export bootstrap, artifact bundling and evaluators; update deps/patches

* test(adapter-midnight): add zip extractor tests and expand schema parsing cases

* docs(adapter-midnight): move transaction impl doc; update architecture and patches

* chore(adapter-midnight): sync adapter patch mappings

* chore(ui,docs): minor wallet connection UI and styles docs updates

* docs(builder): drop US5 status; renumber phases; RPC story to P5 @commitlint.config.js

* feat(adapter-midnight): support heavy artifacts with deferred persistence and trimming

Implements system for large Midnight contract artifact ZIPs (30MB+):

Core Features:
- Deferred persistence: ZIPs ≥15MB skip IndexedDB until function selected
- Per-function trimming: Strips artifacts to only include selected circuit keys
- Static binary exports: Writes trimmed ZIP as public asset instead of base64 in code
- Trimmed-only navigation: Blocks function switching, shows re-upload banner

Architecture (Adapter-Led):
- Added optional hooks to ContractAdapter interface
- All chain-specific logic in Midnight adapter; builder core remains agnostic

Export Pipeline:
- Extended ZipGenerator to accept binary files (Uint8Array/Blob)
- Midnight adapter generates public/midnight/contract.zip static asset
- Bootstrap references contractArtifactsUrl instead of embedding base64

Midnight Adapter:
- New utilities: zip-slimmer.ts, artifact-preparation.ts
- Artifacts validator supports file upload, trimmed reload, URL-based loading

Builder UI:
- Autosave gates heavy artifacts until function selected
- Function selection triggers trimming via adapter hook
- Trimmed-only records: land on Customize, block function switching
- TrimmedArtifactsBanner with 'View Saved Function' button
- Back navigation redirects to Load Contract when trimmed-only

Performance:
- IndexedDB: ~2MB (trimmed) vs 120MB (original) for large contracts
- Export bundle: ~15MB vs ~160MB with base64 embedding

Files Modified: 26 | Files Created: 7

* Update packages/builder/tsconfig.json

Co-authored-by: Copilot <[email protected]>

* fix(builder): address PR review comments for code quality

- Add data URL format validation in FileUploadField to prevent silent failures
- Add clarifying comment about pnpm patch file naming convention in sync script
- Document Buffer polyfill dependency in artifact-preparation.ts

* fix(adapter-midnight): improve type safety by removing unsafe type assertions

- Make EmbeddedZkConfigProvider properly extend SDK's abstract ZKConfigProvider class
- Implement all required abstract methods (getZKIR, getProverKey, getVerifierKey)
- Remove unsafe 'as any' and 'as unknown' casts throughout transaction code
- Simplify provider type assertion from 'as unknown as' to direct cast
- Reduce type assertions from 6 unsafe casts to only 2 necessary ones

This significantly improves type safety and maintainability by properly leveraging
the Midnight SDK's exported TypeScript types instead of bypassing them.

* fix(builder): use proper undefined check for sizeThresholdBytes

Previously used || operator which would incorrectly use the default value
even when sizeThresholdBytes was explicitly set to 0. Now uses ternary
operator with !== undefined check to properly handle all valid values.

* Update packages/adapter-midnight/src/browser-init.ts

Co-authored-by: Copilot <[email protected]>

* fix(adapter-midnight): add warning when re-export resolution hits safety cap

* refactor(adapter-midnight): extract circuit call logic into helper module

* feat(adapter-midnight): add organizer secret key seeding for private state

Add optional organizerSecretKeyHex field to enable organizer-only
circuit execution:
- Extended MidnightContractArtifacts and execution config types
- Added optional input field in getContractDefinitionInputs()
- Passed field through all artifact conversion paths
- Included in persistence and export
- Forward through transaction formatter and sender to execution
- Seed private state in eoa.ts when missing using hex key
- Enhanced error mapping for missing organizer key scenarios
- Added Buffer and crypto to witness evaluator sandbox

The organizer key is stored in IndexedDB and embedded in exported
apps for seamless standalone deployment.

* feat(types): move UI enhancement types and extend adapter API

- Move UI types to new adapters/ui-enhancements.ts
- Extend ContractAdapter.signAndBroadcast for dual credentials
- Add adapterBinding field to FormFieldType
- Update ESLint rule for interface changes

* feat(ui): add reusable Banner component

- Implement Banner component for notifications and warnings
- Support dismissible banners with variant, title, and children
- Export from ui package index

* feat(builder): runtime secret UX and field improvements

- Hide Field Type dropdown for runtimeSecret fields
- Hide Required toggle for runtimeSecret fields
- Expand Field Label width when Field Type hidden
- Add adapter-driven label support
- Extract field display logic into components
- Fix duplicate FunctionParameter import

* refactor(builder): extract StepFormCustomization into components/hooks

- Move function note fetching to useGetFunctionNote hook
- Move execution validation to useExecutionValidation hook
- Extract FunctionNoteSection and RuntimeSecretButton components
- Simplify main index.tsx, improve maintainability

* feat(renderer): extract runtime secret handling

- Extract runtime secret extraction into runtimeSecretExtractor utility
- Support user-provided and hardcoded readonly runtime secrets
- Register runtimeSecret field in field registry

* feat(adapter-midnight): function decorations service

- Add organizer-only circuit detection service
- Add function decorations service for UI enhancements
- Update adapter to pass runtimeSecret through transaction pipeline
- Extend execution strategy to accept runtimeSecret parameter
- Add comprehensive tests for organizer detection

* fix(adapter-midnight): runtime-only private state overlay

- Add try/catch in createPrivateStateOverlay to handle storage miss errors
- Gracefully handle IndexedDB 'Entry not found' errors as null state
- Allows runtime organizerSecretKey injection for organizer-only circuits
- Add comprehensive tests for private state overlay behavior

* fix(builder): type warnings and runtimeSecret pre-selection

- Update adapter-agnostic wording: 'Network' instead of 'Chain'
- Auto-preselect execution method for runtime secret fields
- Fix type conversion warning display for runtimeSecret fields
- Clean up field type utilities

* refactor(adapter-midnight): artifact utils and types cleanup

- Update artifact types for runtime secret support
- Refactor artifact utility functions
- Update transaction implementation documentation

* chore(release): add changeset for runtime secret feature

- Add changeset documenting runtime secret implementation
- Update all affected packages with runtime secret support

* docs(adapter-midnight): correct organizer secret UI docs

- Explain Builder auto-added runtimeSecret field (adapter-defined label/help)

- Clarify renderer extraction and non-persistence of secrets

- Keep export bootstrap example using contractArtifactsUrl

* fix(builder): improve organizer-only circuit notification banner

* feat(adapter-midnight): implement execution methods support

- Add getSupportedExecutionMethods() to return EOA execution method
- Add validateExecutionConfig() with proper EOA validation
- Update execution config validation to match EVM adapter pattern
- Fixes empty execution methods view in UI builder

* perf(builder): debounce execution method validation to improve input responsiveness

- Add 300ms debounce to execution config validation triggered by user input
- Prevents excessive re-renders and auto-save timer resets during typing
- Aligns execution method form behavior with other debounced inputs (title, description)
- Cleanup debounced function on component unmount

* refactor(adapter-midnight): remove unused @scure/base dependency

- Remove @scure/base from package.json dependencies
- Remove bech32m from runtime config
- Update config tests to reflect removal
- Official Midnight SDK now handles all address validation

* feat(renderer): add adapter-provided transaction status messages

- Extended TransactionStatusUpdate type with optional title and
  message fields for chain-specific UX
- Updated TransactionStatusDisplay to accept and prefer
  adapter-provided custom copy with sensible fallback defaults
- Improved default pendingSignature message to cover both
  signature and auto-confirmation
- TransactionForm now captures and forwards adapter-provided
  status details
- Midnight adapter provides custom messages explaining SDK
  limitation (internal polling prevents distinct submitted vs
  confirming transitions)
- Fixed deprecated Tailwind classes (break-words → wrap-break-word,
  flex-shrink-0 → shrink-0)
- Removed early status initialization in TransactionForm to
  eliminate message blink; adapters now control timing completely

* fix(adapter-midnight): update address validation tests for MidnightBech32m API

* fix(adapter-midnight): allow circuits without organizer key to execute

- Change private state overlay to return {} instead of null when no state exists
- Remove preemptive private state validation that blocked participant-only circuits
- Add error logging for better debugging of SDK errors
- Refine error mapping to be more specific about organizer-only errors
- Update tests to reflect new behavior (expect {} instead of null)

Fixes issue where circuits like updateTitle/updateDescription failed with
'Private state not initialized' error even though they don't require organizer keys.
The overlay now provides an empty object {} which circuits need to proceed.

* feat(adapter-midnight): add comprehensive error handling, validation, and type coverage

- Add error enhancement system to transform cryptic Midnight SDK errors into
  user-friendly messages with actionable suggestions
- Implement strict Bytes<N> size validation with clear error messages for
  fixed-size byte arrays
- Add strict Vector<N,T> size enforcement with exact element count validation
- Add comprehensive TYPE-COVERAGE.md documenting all Midnight types, their UI
  mappings, and Compact language limitations
- Enhance input parser with support for Uint<...>, Bytes<N>, nested Maybe types,
  and improved error handling
- Add getBytesSize utility to utils package for shared bytes size parsing across
  adapters
- Add extensive test coverage: error-enhancer (20 tests), input-parser (36 tests),
  type-helpers (22 tests)
- Update documentation and remove references to deleted COMPACT-LIMITATIONS.md file

* chore(deps): update pnpm-lock.yaml

* feat(adapter-midnight): add pure circuit local execution support

- Implement pure circuit executor for local execution without blockchain
- Add circuit-type-utils for centralized circuit detection and extraction
- Add unit tests for pure-circuit-executor
- Refactor function-decorations-service to use extractPureCircuits utility
- Fix isViewFunction logic to correctly exclude pure circuits from view functions
- Add local-execution-router to orchestrate local vs blockchain execution
- Update TransactionForm and TransactionExecuteButton to support local execution
- Extend transaction result types to include execution results

* fix(builder): css adjustment

* fix(builder): x button alignment

* fix(adapter-evm): update Sourcify explorer URL to repo.sourcify.dev format

* refactor(adapter): adapter-led network services

* Update packages/types/src/transactions/status.ts

Co-authored-by: Copilot <[email protected]>

* feat(builder): add manual reload on required input changes

- Add manual reload warning when adapter-required fields change after initial load
- Create requiredInputs utilities for snapshot comparison (utils package)
- Create addressNormalization utilities for consistent address comparison (utils package)
- Fix ContractStateWidget type error and prevent flickering during reloads
- Add comprehensive unit tests for new utilities

* fix(utils): format addressNormalization test and ensure export order

---------

Co-authored-by: Copilot <[email protected]>

* chore(deps): update pnpm lock

* fix(deps): add missing lodash dep

* fix(builder): make docker:dev work with Midnight adapter

- Resolve Buffer bundling by aliasing buffer to polyfill via absolute path
- Add Midnight runtime devDependencies to builder for Docker bundling resolution
- Run root build script in Docker to ensure patches sync before build
- Remove unused polyfill plugins and runtime globals
- Restore --frozen-lockfile for reproducibility

---------

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
@pasevin pasevin requested a review from Copilot November 4, 2025 05:47
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 154 out of 295 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

packages/builder/src/components/UIBuilder/StepContractDefinition/components/TrimmedArtifactsBanner.tsx:1

  • The import path '../hooks/uiBuilderStore' is incorrect. Based on the file structure, it should be '../../hooks/uiBuilderStore' to go up two directories.
import { AlertCircle, ArrowRight } from 'lucide-react';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pasevin pasevin merged commit 6ebbdc2 into main Nov 4, 2025
12 checks passed
@pasevin pasevin deleted the midnight/01-wallet branch November 4, 2025 10:03
@oz-release-app oz-release-app bot mentioned this pull request Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

midnight Midnight Ecosystem Related Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants