Skip to content

LiorAgnin/permissionless.dart

Repository files navigation

Permissionless Dart SDK

A Dart/Flutter SDK for building ERC-4337 (Account Abstraction) applications. This monorepo contains packages for smart account creation, user operation bundling, and WebAuthn/Passkey authentication.

Packages

Package Description pub.dev
permissionless Core ERC-4337 SDK for smart accounts and bundler interactions pub
permissionless_passkeys WebAuthn/Passkeys support for biometric smart account authentication pub

Quick Start

Installation

Add the packages you need to your pubspec.yaml:

dependencies:
  # Core ERC-4337 functionality
  permissionless: ^0.1.2

  # Optional: WebAuthn/Passkeys support
  permissionless_passkeys: ^0.1.0

Basic Usage

import 'package:permissionless/permissionless.dart';

// Create a bundler client
final bundlerClient = BundlerClient(
  chain: Chain.sepolia,
  bundlerUrl: 'https://api.pimlico.io/v2/sepolia/rpc?apikey=YOUR_KEY',
);

// Create a simple smart account
final account = SimpleSmartAccount(
  SimpleSmartAccountConfig(
    owner: privateKeyToAccount(privateKey),
    chainId: Chain.sepolia.id,
    publicClient: publicClient,
  ),
);

// Send a user operation
final hash = await bundlerClient.sendUserOperation(
  account: account,
  calls: [
    Call(
      to: recipientAddress,
      value: BigInt.from(1000000000000000), // 0.001 ETH
    ),
  ],
);

With Passkeys

import 'package:permissionless_passkeys/permissionless_passkeys.dart';

// Register a passkey
final signer = PassKeySigner(options: PassKeysOptions(
  namespace: 'myapp.com',
  name: 'My App',
  sharedWebauthnSigner: SafeWebAuthnSigners.sharedSigner,
));
final passkey = await signer.register('user@example.com', 'User Name');
final credential = WebAuthnCredential.fromPassKeyPair(passkey);

// Create a WebAuthn-authenticated smart account
final account = WebAuthnSafeSmartAccount(
  WebAuthnSafeSmartAccountConfig(
    owner: WebAuthnOwner(credential: credential, rpId: 'myapp.com'),
    credential: credential,
    chainId: Chain.sepolia.id,
    publicClient: publicClient,
  ),
);

Development

This project uses Melos 6.x for monorepo management. I use Melos 6.x rather than 7.x due to known conflicts between Melos 7's pub workspaces and path dependencies.

Setup

# Install dependencies (Melos is a dev dependency)
dart pub get

# Bootstrap the workspace (links local packages via pubspec_overrides.yaml)
dart run melos bootstrap

Common Commands

# Run tests across all packages
dart run melos test

# Run static analysis
dart run melos analyze

# Format code
dart run melos format

# Clean build artifacts
dart run melos clean

Installing Melos Globally (Optional)

For convenience, you can install Melos globally:

dart pub global activate melos

# Then use without "dart run"
melos bootstrap
melos test

Package Structure

permissionless-dart/
├── packages/
│   ├── permissionless/           # Core ERC-4337 package
│   │   ├── lib/
│   │   ├── test/
│   │   └── example/
│   └── permissionless_passkeys/  # WebAuthn extension
│       ├── lib/
│       ├── test/
│       └── example/
├── melos.yaml                    # Monorepo configuration
└── README.md

Supported Account Types

Core Package (permissionless)

  • SimpleSmartAccount - Minimal ERC-4337 account
  • SafeSmartAccount - Safe (Gnosis Safe) smart account
  • KernelSmartAccount - ZeroDev Kernel smart account

Passkeys Package (permissionless_passkeys)

  • WebAuthnSafeSmartAccount - Safe with WebAuthn shared signer
  • WebAuthnKernelSmartAccount - Kernel with WebAuthn validator (v0.3.x)

Supported Chains

The SDK supports any EVM chain with ERC-4337 infrastructure:

  • Ethereum Mainnet & Sepolia
  • Polygon, Arbitrum, Optimism, Base
  • And many more...

See the permissionless package for the full chain list.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes using conventional commits
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see LICENSE for details.

About

A Dart implementation of permissionless.js for ERC-4337 smart accounts. Supports Safe, Simple, Kernel, and more accounts with bundler and paymaster clients.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors