Skip to main content
Portal provides Stablecoin Infrastructure for organizations and their users.

To integrate Portal, an organization adds a client library to their mobile app and a few server API endpoints.

Installation

Add the portal_flutter package to your Flutter project.

Setup

Add the following to your pubspec.yaml:
dependencies:
  portal_flutter: ^LATEST_VERSION
Then run:
flutter pub get
The Portal Flutter SDK is a federated plugin with separate Android and iOS implementations.

Platform Configuration

Android

Add the following to your android/app/build.gradle:
android {
    defaultConfig {
        minSdk = 26
    }
}

iOS

Add the following to your ios/Podfile:
platform :ios, '15.0'

# Add the PortalSwift dependency
pod 'PortalSwift', '~> 6.7', :git => 'https://github.com/portal-hq/PortalSwift.git'

Initializing Portal

To initialize Portal in your application, call the initialize method with your Client API Key. The rpcConfig parameter is a map of CAIP-2 Chain IDs to their respective RPC URLs.
import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

await portal.initialize(
  apiKey: 'YOUR_CLIENT_API_KEY',
  rpcConfig: {
    'eip155:1': 'https://api.portalhq.io/rpc/v1/eip155/1',
    'eip155:10143': 'https://api.portalhq.io/rpc/v1/eip155/10143',
    'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': 'https://api.mainnet-beta.solana.com',
    'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1': 'https://api.devnet.solana.com',
  },
);

Optional Configuration

The initialize method accepts additional optional parameters:
await portal.initialize(
  apiKey: 'YOUR_CLIENT_API_KEY',
  rpcConfig: { /* ... */ },
  autoApprove: true,  // Auto-approve transactions without user confirmation
  apiHost: 'api.portalhq.dev',  // Custom API host for staging
  mpcHost: 'mpc.portalhq.dev',  // Custom MPC host for staging
);
Now that we have our Portal instance, the next step is to generate wallets for your user. Let’s create them!
If you are using Client Session Tokens (CSTs), this hint is for you.When your user’s CST expires, all Portal SDKs will throw an error on the next MPC Operation the user makes (e.g. creating a wallet, backing up a wallet, recovering a wallet, or signing). That error will include a code SESSION_EXPIRED in the SDK methods, which you can use as an indicator to refresh your CST.