What's New in v2.0.0

ZapChain v2.0.0 brings 8 major improvements addressing real user pain points and making the library production-ready for lakhs of users.


🔧 Core Bug Fixes

1. Ghost Wallet Fix

Problem: Users received "No wallet connected" errors despite having an active Web3 instance.

Solution: Robust identity resolution now uses a fallback chain:

  1. metadata.createdBy (if provided)
  2. web3.eth.defaultAccount
  3. eth_accounts RPC call

2. Native ETH Transfers

Problem: Users had to provide dummy ABIs for simple ETH transfers.

Solution: New native_transfer action type:

{
  type: 'native_transfer',
  to: '0xRecipientAddress',
  value: web3.utils.toWei('0.5', 'ether')
}

3. Immediate State Sync

Problem: Rules like "trigger if balance > 1 ETH" did nothing if balance was already 2 ETH at startup.

Solution: Rules now check conditions immediately on startup, not just on state changes.


📊 Enhanced Observability

4. Verbose Execution Logging

Problem: Rules showed "Running" but actions never triggered, with no explanation.

Solution: ExecutionLog now includes:

  • status: SUCCESS | FAILED | SKIPPED
  • skipReason: KILL_SWITCH_ACTIVE | COOLDOWN_ACTIVE | SIGNATURE_INVALID | etc.

⚡ Smarter Execution

5. EOA Detection

Problem: Simulation failed with false "revert" errors when sending ETH to wallets.

Solution: Simulator now checks if target code size is 0 (EOA) and useseth_estimateGas instead of eth_call.

6. Per-Rule Polling

Problem: All rules used the same global polling interval.

Solution: Add pollInterval to individual rule config:

config: {
  pollInterval: 1000,  // Gas-price monitoring every 1s
  // ...other config
}

🚀 Real-Time & Security

7. WebSocket Integration

Problem: 12-second polling delay was too slow for time-critical automation.

Solution: New WebSocketMonitor subscribes to newHeadsfor sub-second block notifications with automatic polling fallback.

8. EIP-712 Typed Signing

Problem: Users signed random hex hashes without knowing what they authorized.

Solution: MetaMask now shows human-readable rule details:

  • Rule name and ID
  • Target chain
  • Maximum ETH value
  • Actions and conditions hashes

⚠️ Breaking Changes

  • ExecutionLog.status is now required
  • EIP-712 signatures are not backward-compatible with v1.x
  • Rules with requireSignature: true need re-signing

📖 Migration Guide

  1. Update to v2.0.0: npm install zapchain@2.0.0
  2. Update any code reading ExecutionLog to handle new status field
  3. Re-sign any rules that have requireSignature: true
  4. Optionally enable WebSocket: { useWebSocket: true }