portal_flutter 0.1.0-alpha.1 copy "portal_flutter: ^0.1.0-alpha.1" to clipboard
portal_flutter: ^0.1.0-alpha.1 copied to clipboard

Flutter SDK for Portal - Stablecoin wallet infrastructure

portal_flutter #

Flutter SDK for Portal - Secure MPC wallet infrastructure for Web3 applications.

Overview #

Portal provides a complete MPC (Multi-Party Computation) wallet solution that enables secure, user-friendly Web3 experiences. With Portal, private keys are split across multiple parties and never exist in full on any single device, providing security without compromising user experience.

Features #

  • MPC Wallet Generation: Create secure wallets using Multi-Party Computation
  • Multiple Backup Methods: Support for password, Google Drive (Android), iCloud (iOS), and Passkey backups
  • Multi-Chain Support: Built-in support for Ethereum, Solana, and other EVM-compatible chains
  • Transaction Signing: Sign and send transactions across supported blockchains
  • Wallet Recovery: Recover wallets from backups using various methods
  • Type-Safe API: Built with Pigeon for compile-time type safety across Flutter, Android, and iOS

Installation #

Add portal_flutter to your pubspec.yaml:

dependencies:
  portal_flutter: ^0.0.1

Then run:

flutter pub get

Quick Start #

1. Initialize Portal #

import 'package:portal_flutter/portal_flutter.dart';

final portal = PortalFlutter();

await portal.initialize(
  apiKey: 'your_portal_api_key',
  autoApprove: true,
);

2. Create a Wallet #

try {
  final addresses = await portal.createWallet();
  print('Ethereum address: ${addresses.ethereum}');
  print('Solana address: ${addresses.solana}');
} catch (e) {
  print('Error creating wallet: $e');
}

3. Backup the Wallet #

// Using password backup
await portal.backupWallet(
  method: PortalBackupMethod.password,
  password: 'secure_password_123',
);

// Or using Google Drive (Android only)
await portal.configureGoogleStorage(clientId: 'your_google_client_id');
await portal.backupWallet(method: PortalBackupMethod.googleDrive);

// Or using iCloud (iOS only)
await portal.backupWallet(method: PortalBackupMethod.iCloud);

4. Recover a Wallet #

final addresses = await portal.recoverWallet(
  method: PortalBackupMethod.password,
  password: 'secure_password_123',
);
print('Recovered wallet: ${addresses.ethereum}');

5. Send Assets #

final txHash = await portal.sendAsset(
  chainId: 'eip155:1', // Ethereum mainnet
  to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
  token: 'ETH',
  amount: '0.001',
);
print('Transaction hash: $txHash');

Advanced Usage #

Wallet State Queries #

// Check if wallet exists
bool exists = await portal.doesWalletExist();

// Check if wallet is backed up
bool backedUp = await portal.isWalletBackedUp();

// Check if wallet is on device
bool onDevice = await portal.isWalletOnDevice();

// Check if wallet is recoverable
bool recoverable = await portal.isWalletRecoverable();

Get Wallet Address #

// Get Ethereum address
String? ethAddress = await portal.getAddress('eip155:1');

// Get Solana address
String? solAddress = await portal.getAddress('solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp');

Generic Provider Requests #

// Make any JSON-RPC request
final response = await portal.request(
  chainId: 'eip155:1',
  method: 'eth_getBalance',
  params: ['0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', 'latest'],
);

if (response.error != null) {
  print('Error: ${response.error}');
} else {
  print('Balance: ${response.result}');
}

Eject Private Keys #

⚠️ Warning: This exposes the full private keys. Use with extreme caution.

final privateKeys = await portal.ejectPrivateKeys(
  method: PortalBackupMethod.password,
  password: 'secure_password_123',
);

print('Ethereum private key: ${privateKeys['EIP155']}');
print('Solana private key: ${privateKeys['SOLANA']}');

Configuration #

RPC Configuration #

You can provide custom RPC endpoints for different chains:

await portal.initialize(
  apiKey: 'your_api_key',
  rpcConfig: {
    'eip155:1': 'https://mainnet.infura.io/v3/YOUR_KEY',
    'eip155:137': 'https://polygon-rpc.com',
    'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': 'https://api.mainnet-beta.solana.com',
  },
);

Passkey Configuration #

await portal.configurePasskeyStorage(
  relyingPartyId: 'your-app.com',
  relyingPartyOrigins: ['https://your-app.com'],
  webAuthnHost: 'https://backup.web.portalhq.io',
);

await portal.backupWallet(method: PortalBackupMethod.passkey);

Error Handling #

All Portal methods can throw PortalException:

try {
  await portal.createWallet();
} on PortalException catch (e) {
  print('Portal error [${e.code}]: ${e.message}');
  print('Details: ${e.details}');
}

Platform Support #

Feature Android iOS
Wallet Creation
Password Backup
Google Drive Backup
iCloud Backup
Passkey Backup
Transaction Signing
Multi-chain Support

Resources #

License #

See LICENSE file for details.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

0
likes
0
points
298
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter SDK for Portal - Stablecoin wallet infrastructure

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface, portal_flutter_android, portal_flutter_ios

More

Packages that depend on portal_flutter

Packages that implement portal_flutter