Bako Safe SDK
Predicates
Wallet Types

Wallet Type Support

Different predicate versions support different wallet types for signing transactions.

Supported Wallet Types

TypeCodeDescription
FuelfuelNative Fuel blockchain wallets
WebAuthnwebauthnPasskey/biometric authentication
EVMevmEthereum-compatible wallets
SVMsvmSolana-compatible wallets

Compatibility Matrix

Predicate VersionFuelWebAuthnEVMSVM
Bako v1YesYesNoNo
Bako v2YesYesNoNo
Bako v3YesYesYesNo
Fuel SVMNoNoNoYes
Fuel EVMNoNoYesNo

Finding Compatible Versions

For Specific Wallet Type

import { getCompatiblePredicateVersions } from 'bakosafe';
 
// Get versions that support EVM wallets
const evmVersions = getCompatiblePredicateVersions('evm');
 
// Get versions that support Fuel wallets
const fuelVersions = getCompatiblePredicateVersions('fuel');
 
// Get versions that support WebAuthn
const webauthnVersions = getCompatiblePredicateVersions('webauthn');

Get Latest for Wallet Type

import { getLatestPredicateVersion } from 'bakosafe';
 
const latestForFuel = await getLatestPredicateVersion('fuel');
const latestForEvm = await getLatestPredicateVersion('evm');

Mixed Wallet Vaults

Create vaults with signers using different wallet types:

import { Vault, getCompatiblePredicateVersions } from 'bakosafe';
 
// Find version that supports both Fuel and EVM
const versions = getCompatiblePredicateVersions('evm');
const fuelVersions = getCompatiblePredicateVersions('fuel');
 
const compatibleVersion = versions.find(v => fuelVersions.includes(v));
 
// Create vault with mixed signers
const vault = Vault.createBakoVault(
  provider,
  {
    SIGNATURES_COUNT: 2,
    SIGNERS: [
      'fuel1native-wallet...',    // Fuel wallet
      '0x742d35Cc6634...',        // EVM wallet (MetaMask)
    ]
  },
  compatibleVersion
);

Signature Types by Wallet

Each wallet type uses a different signature encoding:

import { SignatureType } from 'bakosafe';
 
enum SignatureType {
  WebAuthn = 0,      // Passkey signatures
  Fuel = 1,          // Fuel wallet signatures
  Evm = 2,           // EVM wallet signatures
  RawNoPrefix = 9    // Raw signatures (special cases)
}

Address Formats

Wallet TypeAddress FormatExample
FuelBech32fuel1qz...
EVMHex (0x)0x742d35Cc6634...
WebAuthnBech32 (passkey prefix)pkau1qz...

Address Utilities

import { AddressUtils } from 'bakosafe';
 
// Check address type
const isFuel = address.startsWith('fuel1');
const isEvm = AddressUtils.isEvm(address);
const isPasskey = AddressUtils.isPasskey(address);
 
// Convert formats
const evmAddress = AddressUtils.parseFuelAddressToEth(fuelAddress);
const bech32 = AddressUtils.toBech32(hexAddress, 'fuel');

Choosing the Right Version

For Maximum Compatibility

Use a version that supports all wallet types your signers use:

function findCompatibleVersion(signerTypes: string[]): string {
  const allVersions = getAllPredicateVersions();
 
  for (const version of allVersions) {
    const details = getVersionDetails(version);
    const supportsAll = signerTypes.every(
      type => details.walletOrigins.includes(type)
    );
 
    if (supportsAll && details.active) {
      return version;
    }
  }
 
  throw new Error('No compatible version found');
}
 
// Usage
const version = findCompatibleVersion(['fuel', 'evm']);

For Specific Features

// Need EVM support
const version = await getLatestPredicateVersion('evm');
 
// Need WebAuthn for passwordless
const version = await getLatestPredicateVersion('webauthn');

Best Practices

  1. Use latest versions: They have the most features and security fixes
  2. Check compatibility first: Ensure version supports all your signers' wallet types
  3. Plan for upgrades: New versions may add features you need
  4. Test on testnet: Verify compatibility before mainnet deployment

Next Steps