@portal-hq/core package is the main entry point for integrating Portal’s MPC wallet infrastructure into your React Native application. It includes the Portal class, React Context utilities (PortalContextProvider, usePortal), and exports for types, enums, and error handling.
Installation
The Portal Class
ThePortal class is the primary interface for interacting with Portal’s MPC wallet infrastructure.
Properties
| Property | Type | Description |
|---|---|---|
api | IPortalApi | Portal API client for REST API interactions |
apiKey | string | Your Portal Client API Key |
backup | BackupOptions | Configured backup storage adapters |
chainId | number | Deprecated. |
featureFlags | FeatureFlags | Feature flag configuration |
gatewayConfig | GatewayLike | Gateway/RPC configuration |
mpc | PortalMpc | MPC operations client |
provider | IPortalProvider | EIP-1193 compliant provider |
Getters
| Getter | Type | Description |
|---|---|---|
address | Promise<string | undefined> | The primary wallet address (EIP-155) |
addresses | Promise<AddressesByNamespace | undefined> | All wallet addresses by namespace |
autoApprove | boolean | Whether auto-approve is enabled |
Constructor
PortalOptions
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey | string | Yes | - | Portal Client API Key |
backup | BackupOptions | Yes | - | Backup storage adapters keyed by BackupMethods |
gatewayConfig | GatewayLike | Yes | - | RPC URL string or chain-specific config object |
chainId | number | No | - | Deprecated. |
isSimulator | boolean | No | false | Running in simulator/emulator |
autoApprove | boolean | No | false | Auto-approve signing requests |
keychain | KeychainAdapter | No | new Keychain() | Keychain storage adapter |
apiHost | string | No | 'api.portalhq.io' | Portal API host |
mpcHost | string | No | 'mpc.portalhq.io' | MPC server host |
featureFlags | FeatureFlags | No | {} | Feature flags |
Wallet Management Methods
createWallet
Creates a new MPC wallet with both SECP256K1 (EVM) and ED25519 (Solana) key pairs.
| Parameter | Type | Required | Description |
|---|---|---|---|
progress | ProgressCallback | No | Callback for progress updates |
backupWallet
Creates encrypted backup shares for the wallet.
| Parameter | Type | Required | Description |
|---|---|---|---|
method | BackupMethods | Yes | Backup storage method |
progress | ProgressCallback | No | Progress callback |
backupConfig | BackupConfigs | No | Additional config (e.g., password) |
recoverWallet
Recovers a wallet from backup shares.
| Parameter | Type | Required | Description |
|---|---|---|---|
cipherText | string | No | Encrypted backup (if not using Portal backup) |
method | BackupMethods | Yes | Backup method used |
progress | ProgressCallback | No | Progress callback |
backupConfig | BackupConfigs | No | Additional config |
provisionWallet
Alias for recoverWallet. Provisions a wallet on a new device.
Wallet State Methods
doesWalletExist
Checks if a wallet exists on the Portal backend.
isWalletOnDevice
Checks if wallet signing shares exist on the current device.
isWalletBackedUp
Checks if the wallet has a completed backup.
isWalletRecoverable
Checks if the wallet can be recovered (has at least one backup method).
availableRecoveryMethods
Returns the list of backup methods available for recovery.
Signing Methods
personalSign
Signs a message using personal_sign.
ethSign
Signs a message using eth_sign.
ethSignTypedData
Signs typed data (EIP-712) using eth_signTypedData_v4.
rawSign
Signs raw data without any prefix.
Transaction Methods
ethSendTransaction
Sends a signed transaction to the network.
ethSignTransaction
Signs a transaction without broadcasting.
sendAsset
High-level method to send tokens or native assets.
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient address |
token | string | Yes | Token symbol or contract address |
amount | string | Yes | Amount to send |
chain | string | No | Chain name or CAIP-2 ID |
ethereum, sepolia, base, polygon, solana, optimism, arbitrum, avalanche
Example:
evaluateTransaction
Evaluates a transaction for security risks using Blockaid.
Provider Methods
request
Generic method to make JSON-RPC requests.
ethGetBalance
Gets the native token balance.
ethGasPrice
Gets the current gas price.
ethEstimateGas
Estimates gas for a transaction.
getBalanceAsNumber
Gets the native token balance as a number (in ETH, not wei).
updateChain (Deprecated)
Updates the current chain ID.
Event Methods
on
Subscribes to provider events.
emit
Emits a provider event.
removeEventListener
Removes an event listener.
Keychain Methods
deleteAddress
Deletes the stored address from keychain.
deleteSigningShare
Deletes the signing share from keychain.
deleteShares
Deletes all shares from keychain.
Share Metadata Methods
getSigningSharesMetadata
Gets metadata about signing share pairs.
getBackupSharesMetadata
Gets metadata about backup share pairs.
Testnet Methods
receiveTestnetAsset
Requests testnet tokens from the Portal faucet.
Portal Connect
createPortalConnectInstance
Creates a Portal Connect instance for WalletConnect integration.
The portal.api Object
The api property provides access to Portal’s REST API.
getClient
Gets the current client information.
getNFTs
Fetches NFTs owned by the wallet.
getBalances
Fetches ERC20 token balances.
getTransactions
Fetches transaction history.
getNetworks
Gets supported networks.
getEnabledDapps
Gets enabled dApps for the client.
simulateTransaction
Simulates a transaction.
getQuote
Gets a swap quote.
getSources
Gets available swap sources.
The portal.mpc Object
The mpc property handles MPC wallet operations directly.
generate
Generates new MPC signing shares.
backup
Creates backup shares.
recover
Recovers signing shares from backup.
ejectPrivateKey
Ejects the SECP256K1 private key (for migration).
ejectPrivateKeys
Ejects both SECP256K1 and ED25519 private keys.
reset
Resets local wallet data.
isReady
Checks if the MPC client is ready.
The portal.provider Object
The provider property is an EIP-1193 compliant provider.