Skip to content

feat: Add Bako predicates to EVM wallet connector#556

Draft
guimroque wants to merge 187 commits into
FuelLabs:mainfrom
infinitybase:p2/feat/bako-predicate-connector
Draft

feat: Add Bako predicates to EVM wallet connector#556
guimroque wants to merge 187 commits into
FuelLabs:mainfrom
infinitybase:p2/feat/bako-predicate-connector

Conversation

@guimroque

@guimroque guimroque commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Release notes

This PR introduces Bako predicate integration for EVM wallet connectors and adds a new Social Login connector.

Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                              FuelConnector                                  │
│                            (from fuels SDK)                                 │
└─────────────────────────────────────────────────────────────────────────────┘
                                      │
                                      │ extends
                                      ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│                           PredicateConnector                                │
│                    (@fuel-connectors/bako-predicate-connector)              │
├─────────────────────────────────────────────────────────────────────────────┤
│  • Predicate version management                                             │
│  • Bako server communication (SocketClient)                                 │
│  • Session & storage management (StoreManager)                              │
│  • Backward compatibility for legacy predicates                             │
│  • Transaction signing via Bako                                             │
└─────────────────────────────────────────────────────────────────────────────┘
                                      │
                    ┌─────────────────┴─────────────────┐
                    │ extends                           │ extends
                    ▼                                   ▼
┌───────────────────────────────────┐  ┌───────────────────────────────────┐
│      WalletConnectConnector       │  │         SocialConnector           │
│ (@fuel-connectors/walletconnect)  │  │  (@fuel-connectors/social)        │
├───────────────────────────────────┤  ├───────────────────────────────────┤
│  • MetaMask, Ledger, Coinbase     │  │  • Email OTP login (Privy)        │
│  • WalletConnect protocol         │  │  • Embedded wallet support        │
│  • EVM signature handling         │  │  • Headless authentication        │
└───────────────────────────────────┘  └───────────────────────────────────┘
                    │                                   │
                    └─────────────────┬─────────────────┘
                                      │
                                      ▼
                    ┌─────────────────────────────────────┐
                    │           Bako Safe API             │
                    ├─────────────────────────────────────┤
                    │  • Predicate wallet management      │
                    │  • Transaction broadcasting         │
                    │  • Multi-version predicate support  │
                    └─────────────────────────────────────┘

Predicate Version Flow

┌──────────────┐    ┌──────────────┐    ┌──────────────┐
│   Legacy     │    │   Version    │    │   Latest     │
│  Predicate   │    │     N-1      │    │   Version    │
│  (Fuel Labs) │    │    (Bako)    │    │    (Bako)    │
└──────┬───────┘    └──────┬───────┘    └──────┬───────┘
       │                   │                   │
       └───────────────────┼───────────────────┘
                           │
                           ▼
              ┌────────────────────────┐
              │  PredicateConnector    │
              │  (Version Selection)   │
              └────────────────────────┘
                           │
                           ▼
              ┌────────────────────────┐
              │   User selects or      │
              │   auto-detects version │
              └────────────────────────┘

New Packages

@fuel-connectors/bako-predicate-connector

Base package that provides:

  • PredicateConnector abstract class for predicate-based wallet connectors
  • Predicate version management and backward compatibility for legacy predicates
  • Communication with Bako servers via SocketClient
  • Session and storage management via StoreManager
  • Support for multiple predicate versions with automatic migration

@fuel-connectors/social-connector

Social authentication connector featuring:

  • Email login with OTP (headless flow)
  • Integration with Privy for embedded wallets
  • Extends PredicateConnector for Bako Safe integration
  • Automatic predicate creation for social accounts

Updated Packages

@fuel-connectors/walletconnect-connector

  • Now extends PredicateConnector instead of FuelConnector
  • Preserves responsibility for EVM client communication (MetaMask, Ledger, etc.)
  • EVM wallets are now accessible through the Bako interface

@fuels/connectors

  • Added privyAuth parameter to defaultConnectors() for Social Login
  • Exports SocialConnector and related types

@fuels/react

  • Added EmailLogin component for headless email authentication
  • Updated Connectors modal to display Social Login option

Key Features

  • Backward compatibility: Legacy predicates from Fuel Labs are preserved and accessible
  • Version selection: Users can switch between predicate versions while maintaining access to funds
  • Bako interface access: All EVM connector wallets can now be managed through Bako Safe UI
  • Session handling: Improved session persistence for email switching scenarios

Demo

Summary

A new base predicate package (bako-predicate-connector) abstracts the communication logic with Bako wallets. The walletconnect-connector was updated to extend from this new base, while a new social-connector package enables social authentication via Privy.

Checklist

  • I've added error handling for all actions/requests, and verified how this error will show on UI. (or there was no error handling)
  • I've reviewed all the copy changed/added in this PR, using AI if needed. (or there was no copy changes)
  • I checked the resulting UI both in Light and Dark mode (or no UI changes were made)
  • I reviewed the entire PR myself (preferably, on GH UI)

guimroque and others added 30 commits July 25, 2025 17:07
…nnector using the minimum necessary packages
guimroque and others added 30 commits January 12, 2026 15:21
The localStorage cleanup for Bako connector keys is essential to maintain
state synchronization between Privy and the connector. Without it, stale
data causes authentication conflicts when reconnecting.

Also updates the Social Login icon to a modern email envelope design.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Override accounts() and isConnected() to wait for Privy to be ready
before checking stored account. This prevents the race condition where
SDK queries these methods before Privy session is restored from iframe.

Also adds logout before sendCode() to prevent cannot_link_more_of_type
error when switching email accounts.
…ctor

FIX: clear session state to enforce EVM signature on login
…login-integration

refactor: simplify social login integration
…ion-error

fix: create vault with unique name if not founded
fix: prevents to show actions disabled after disconnect
…-when-social-login-is-disabled

fix: hides login with email when social login is disabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants