Skip to content

Commit 6ebbdc2

Browse files
pasevinCopilot
andauthored
Midnight v1 – 01 Wallet (#205)
* feat(builder): enable Midnight ecosystem in UI and feature flags * feat(ui): centralize Midnight icon and restore TypeScript declarations - 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. * fix(builder): typo * feat(adapter-midnight): event-driven wallet with Lace implementation - 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 * docs(common): finalize Midnight adapter spec, plan, checklists, and tasks * docs(common): update stacked branch plan in spec header * test(adapter-midnight): add wallet connection tests, enable vitest config, fix imports * chore(adapter-midnight): add changeset for wallet tests and vitest config * docs(common): update branch strategy in plan/tasks * chore(deps): refresh pnpm-lock.yaml after adapter-midnight devDeps update * test(builder): update ecosystem feature flag tests to include Midnight by default * chore(builder): set Midnight enabled by default in ecosystem registry * Update packages/adapter-midnight/src/wallet/utils/SafeMidnightComponent.tsx Co-authored-by: Copilot <[email protected]> * Update packages/adapter-midnight/src/wallet/hooks/useMidnightWallet.ts Co-authored-by: Copilot <[email protected]> * chore(adapter-midnight): formatting * chore(builder): reinstate type-check in build script * docs(adapter-midnight): replace MidnightWalletProvider with MidnightWalletUiRoot in README * build(builder): add scoped typecheck script and keep build vite-only * build(common): standardize on typecheck script; remove duplicate type-check aliases * fix(adapter-midnight): address PR feedback — extract constants, remove cast, use vi.mocked * Midnight v1 – 02 Ingestion: contract artifacts + loader (#206) * 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]> * fix(deps): override ua-parser-js to v1.0.41 to avoid AGPL license --------- Co-authored-by: Copilot <[email protected]>
1 parent b235a69 commit 6ebbdc2

File tree

295 files changed

+30596
-5221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+30596
-5221
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@openzeppelin/ui-builder-ui': minor
3+
'@openzeppelin/ui-builder-types': patch
4+
'@openzeppelin/ui-builder-renderer': patch
5+
---
6+
7+
Add FileUploadField component with drag-and-drop support
8+
9+
- Add new FileUploadField component to UI package with comprehensive file upload functionality
10+
- Implement drag-and-drop file upload with visual feedback states
11+
- Add file size validation with customizable limits
12+
- Add file type validation via accept prop
13+
- Include optional base64 conversion for storage
14+
- Provide visual feedback for upload states (idle, processing, success, error)
15+
- Full accessibility support with ARIA attributes and keyboard navigation
16+
- Integration with React Hook Form for validation
17+
- Add file-upload field type to types package
18+
- Register FileUploadField in renderer field registry
19+
20+
Usage: Designed primarily for uploading contract artifacts (ZIP files) in Midnight adapter, but suitable for any file upload needs across the application.
21+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@openzeppelin/ui-builder-adapter-midnight': minor
3+
'@openzeppelin/ui-builder-app': patch
4+
'@openzeppelin/ui-builder-storage': patch
5+
'@openzeppelin/ui-builder-utils': patch
6+
'@openzeppelin/ui-builder-ui': patch
7+
---
8+
9+
Midnight adapter contract ingestion and shared gating
10+
11+
- Midnight: move loading to contract/loader; return contractDefinitionArtifacts; keep adapter thin.
12+
- Builder: replace local required-field gating with shared utils (getMissingRequiredContractInputs); remove redundant helper.
13+
- Utils: add contractInputs shared helpers and tests.
14+
- Storage/App/UI: persist and rehydrate contractDefinitionArtifacts; auto-save triggers on artifact changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openzeppelin/ui-builder-adapter-midnight': patch
3+
---
4+
5+
Refactor to use shared `getBytesSize` function from `@openzeppelin/ui-builder-utils` instead of local implementation. This ensures consistent bytes size parsing across all adapters and reduces code duplication.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
'@openzeppelin/ui-builder-adapter-midnight': minor
3+
---
4+
5+
# Refactor Midnight wallet management to event-driven architecture with polling-based event emulation
6+
7+
**Architecture Changes:**
8+
9+
- Refactored wallet implementation to mirror Stellar adapter structure
10+
- Introduced `LaceWalletImplementation` class for core wallet logic
11+
- Added `midnightWalletImplementationManager` singleton pattern
12+
- Created `MidnightWalletUiRoot` as the primary provider component
13+
- Removed unnecessary `MidnightWalletProvider` wrapper for consistency
14+
- Implemented facade functions in `connection.ts` for high-level wallet operations
15+
16+
**Event Emulation:**
17+
18+
- Lace Midnight DAppConnectorWalletAPI lacks native `onAccountChange` events
19+
- Implemented polling-based event emulation via `api.state()` with exponential backoff
20+
- Adaptive polling intervals: 2s initial, 5s when connected, up to 15s on errors
21+
- Polling pauses when document is hidden (tab inactive) to reduce intrusive popups
22+
- Polling starts only when listeners subscribe, stops when all unsubscribe
23+
24+
**UX Improvements:**
25+
26+
- Fixed repeated wallet popup issue by preventing multiple `enable()` calls
27+
- Added `connectInFlight` guard against React Strict Mode double-effects and rapid clicks
28+
- Implemented focus/blur heuristics to detect user dismissal of unlock popup
29+
- 60s fallback timeout prevents infinite loading state in edge cases
30+
- Auto-reconnect on page load for seamless UX with already-enabled wallets
31+
32+
**Documentation:**
33+
34+
- Added comprehensive inline comments explaining design decisions and limitations
35+
- Created wallet module README documenting architecture and implementation details
36+
- Documented all workarounds needed due to Lace API limitations
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openzeppelin/ui-builder-adapter-midnight': patch
3+
---
4+
5+
Add wallet connection unit tests and Vitest configuration; fix adapter imports to use local configuration barrel. Remove temporary test seam to align with other adapters.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
'@openzeppelin/ui-builder-types': minor
3+
'@openzeppelin/ui-builder-ui': minor
4+
'@openzeppelin/ui-builder-builder': minor
5+
'@openzeppelin/ui-builder-renderer': minor
6+
'@openzeppelin/ui-builder-adapter-midnight': minor
7+
---
8+
9+
Implement runtime-only secret field support with dual-credential execution
10+
11+
- Add FunctionBadge, FunctionDecoration, and FunctionDecorationsMap types to types/adapters/ui-enhancements.ts
12+
- Extend ContractAdapter.signAndBroadcast to accept optional runtimeApiKey and runtimeSecret parameters
13+
- Add adapterBinding field to FormFieldType for adapter-specific credential binding
14+
- Implement Banner component for reusable notification/warning display in ui package
15+
- Add runtimeSecret field type with adapter-driven UI rendering in builder:
16+
- Hide "Field Type" dropdown for runtime secret fields
17+
- Hide "Required Field" toggle for runtime secret fields
18+
- Make "Field Label" span full width when Field Type is hidden
19+
- Add security warning banner when hardcoded values are used
20+
- Extract runtime secret display logic into separate components (RuntimeSecretFieldDisplay, ParameterFieldDisplay)
21+
- Extract field header (icon, label, delete button) into FieldHeader component
22+
- Implement reusable hooks for function notes (useGetFunctionNote) and execution validation (useExecutionValidation)
23+
- Create FunctionNoteSection and RuntimeSecretButton components for modular form customization
24+
- Add runtimeSecretExtractor utility for clean credential handling during transaction execution
25+
- Support hardcoded readonly runtime secrets with proper field extraction
26+
- Implement FunctionDecorationsService in adapter-midnight for organizer-only circuit detection
27+
- Fix private state overlay to handle provider storage misses gracefully
28+
- Update transaction execution flow to pass both relayer API keys and adapter-specific secrets
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openzeppelin/ui-builder-utils': minor
3+
---
4+
5+
Add `getBytesSize` utility function to extract size from `Bytes<N>` type strings. This function parses type strings like "Bytes<32>" and returns the size as a number, or undefined for dynamic types like "Uint8Array". Useful for validating fixed-size byte arrays in adapters.

.eslint/rules/no-extra-adapter-methods.cjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ module.exports = {
3737
const interfaceMethods = [
3838
'networkConfig',
3939
'initialAppServiceKitName',
40+
'getNetworkServiceForms',
41+
'validateNetworkServiceConfig',
42+
'testNetworkServiceConnection',
4043
'loadContract',
4144
'loadContractWithMetadata',
4245
'getWritableFunctions',
@@ -70,6 +73,8 @@ module.exports = {
7073
'getExportableWalletConfigFiles',
7174
'getSupportedContractDefinitionProviders',
7275
'getContractDefinitionInputs',
76+
'getRuntimeFieldBinding',
77+
'getFunctionDecorations',
7378
'getRelayers',
7479
'getRelayer',
7580
'getRelayerOptionsComponent',
@@ -80,6 +85,9 @@ module.exports = {
8085
'compareContractDefinitions',
8186
'validateContractDefinition',
8287
'hashContractDefinition',
88+
'getExportBootstrapFiles',
89+
'getArtifactPersistencePolicy',
90+
'prepareArtifactsForFunction',
8391
];
8492

8593
// Common standard methods and properties that are allowed

.eslintignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
node_modules/
2+
dist/
3+
build/
4+
out/
5+
coverage/
6+
*.min.js
7+
.next/
8+
.nuxt/
9+
.output/
10+
.cache/
11+
.turbo/
12+
.vercel/
13+
.netlify/
14+
exports/
15+
packages/builder/test-results/
16+

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ yarn.lock
1010
# pnpm-lock.yaml - uncomment if using npm or yarn instead of pnpm
1111
# pnpm-lock.yaml
1212
.pnpm-debug.log*
13+
.pnpm-store/
14+
.packed-packages/
1315

1416
# Build outputs
1517
dist/
@@ -27,6 +29,11 @@ packages/builder/test-results/
2729
# Test exports
2830
exports/
2931

32+
# Generated patches in packages
33+
# Source of truth is root patches/ directory
34+
# These are generated by scripts/sync-patches-to-adapters.js
35+
packages/*/patches/
36+
3037
# Environment variables
3138
.env
3239
.env.local

0 commit comments

Comments
 (0)