Back to list
FractionEstate

dapp-integration

by FractionEstate

0🍴 0📅 Jan 5, 2026

SKILL.md


name: dapp-integration description: Build Midnight dApps with TypeScript integration, wallet connectivity, and contract deployment. Use when connecting wallets, deploying contracts, or building dApp frontends. Triggers on wallet, provider, Next.js, deployment, or TypeScript integration questions.

Midnight dApp Integration

Build privacy-preserving dApps with TypeScript, React/Next.js, and Midnight Network integration.

Quick Start

// Connect to Lace wallet
const connector = window.midnight?.mnLace;
if (connector) {
  const api = await connector.enable();
  const state = await api.state();
  console.log('Connected:', state.address);
}

Core Concepts

ComponentPurpose
DApp ConnectorWallet detection & connection
ProvidersContract interaction infrastructure
Contract APIType-safe circuit calls
Proof ServerZK proof generation

Reference Files

TopicResource
Wallet Connectionreferences/wallet-connection.md
Provider Setupreferences/providers.md
Contract Deploymentreferences/deployment.md
Next.js Setupreferences/nextjs-setup.md

Assets

AssetDescription
assets/wallet-hook.mdReact hook for wallet
assets/providers.mdProvider configuration
assets/deploy.mdDeployment template

Installation

npm install @midnight-ntwrk/dapp-connector-api \
  @midnight-ntwrk/midnight-js-contracts \
  @midnight-ntwrk/midnight-js-types \
  @midnight-ntwrk/midnight-js-network-id

Note: The @midnight-ntwrk/dapp-connector-api npm page currently warns that its source repo "hasn't been fully migrated" and points to https://github.com/input-output-hk/midnight-dapp-connector-api. Use the Network Support Matrix for version compatibility.

Wallet Detection

// Check if Lace wallet is installed
function isWalletInstalled(): boolean {
  return typeof window !== 'undefined' && !!window.midnight?.mnLace;
}

// Type definition
import '@midnight-ntwrk/dapp-connector-api';
// Types are augmented on window.midnight.mnLace

Provider Stack

┌─────────────────────────────────────┐
│         Contract Instance           │
├─────────────────────────────────────┤
│      midnightProvider (wallet)      │
├─────────────────────────────────────┤
│    zkConfigProvider (circuit cfg)   │
├─────────────────────────────────────┤
│   publicDataProvider (indexer)      │
├─────────────────────────────────────┤
│  privateStateProvider (local state) │
└─────────────────────────────────────┘

Basic Flow

  1. Detect wallet - Check window.midnight
  2. Connect - Call connector.enable()
  3. Setup providers - Configure state, indexer, ZK
  4. Deploy/Connect - Deploy new or connect to existing
  5. Call circuits - Type-safe contract interaction

Network Configuration

// Testnet endpoints
const TESTNET = {
  indexer: 'https://indexer.testnet-02.midnight.network/api/v1/graphql',
  indexerWS: 'wss://indexer.testnet-02.midnight.network/api/v1/graphql/ws',
  proofServer: 'http://localhost:6300',
  node: 'https://rpc.testnet-02.midnight.network',
};

Best Practices

  • ✅ Always check wallet availability before operations
  • ✅ Handle connection errors gracefully
  • ✅ Use typed providers for all Midnight APIs
  • ✅ Cache provider instances
  • ❌ Don't expose private state
  • ❌ Don't skip transaction confirmation

Resources

Score

Total Score

45/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon