Socket
Book a DemoInstallSign in
Socket

@openzeppelin/contracts-ui-builder-adapter-midnight

Package Overview
Dependencies
Maintainers
9
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openzeppelin/contracts-ui-builder-adapter-midnight

Midnight Adapter for Contracts UI Builder

0.8.0
latest
Source
npmnpm
Version published
Weekly downloads
236
-34.08%
Maintainers
9
Weekly downloads
 
Created
Source

Midnight Adapter (@openzeppelin/contracts-ui-builder-adapter-midnight)

This package provides the ContractAdapter implementation for the Midnight Network for the Contracts UI Builder.

Current Status: Wallet Connection Implemented

This adapter has a fully implemented wallet connection feature, allowing users to connect to the Lace (Midnight) browser extension. The core contract interaction methods (loadContract, formatTransactionData, signAndBroadcast, etc.) are currently placeholder stubs and will be implemented in future phases.

Key Implemented Features

  • Wallet Connection: Supports connecting to the mnLace wallet instance injected into the window object.
  • Auto-reconnection: Automatically reconnects to the user's wallet on page reload if they have not explicitly disconnected.
  • Robust Connection Logic: Implements a state-polling mechanism to handle the wallet's unconventional API, which resolves before user approval and has internal race conditions.
  • Explicit Disconnect Handling: Uses localStorage to respect user disconnections across sessions, which is the standard workaround for CIP-30 style wallets.
  • Custom UI Components: Provides custom, theme-consistent ConnectButton and AccountDisplay components.

Usage

The MidnightAdapter is consumed by the builder application's WalletStateProvider. It exposes a React context provider (MidnightWalletProvider) and a set of facade hooks that are automatically used by the main application UI.

// In the builder application's adapter factory:
import {
  MidnightAdapter,
  midnightTestnet,
} from '@openzeppelin/contracts-ui-builder-adapter-midnight';

const networkConfig = midnightTestnet;
const midnightAdapter = new MidnightAdapter(networkConfig);

Package Structure

adapter-midnight/
├── src/
│   ├── config/                  # Adapter-specific configuration
│   ├── contract/                # Contract interaction utilities (placeholder)
│   ├── mapping/                 # Type mapping utilities (placeholder)
│   ├── networks/                # Midnight network configurations
│   ├── transaction/             # Transaction execution system (placeholder)
│   ├── validation/              # Validation utilities (placeholder)
│   ├── wallet/                  # Wallet integration (implemented)
│   ├── adapter.ts               # Main MidnightAdapter class implementation
│   └── index.ts                 # Public package exports
├── package.json
├── tsconfig.json
├── tsup.config.ts
├── vitest.config.ts
└── README.md

Internal Structure

This adapter follows the standard module structure outlined in the main project Adapter Architecture Guide. All wallet-related logic can be found in the src/wallet/ directory.

Keywords

openzeppelin

FAQs

Package last updated on 01 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.