@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
Getters
Constructor
PortalOptions
Wallet Management Methods
createWallet
Creates a new MPC wallet with both SECP256K1 (EVM) and ED25519 (Solana) key pairs.
Example:
backupWallet
Creates encrypted backup shares for the wallet.
Example:
recoverWallet
Recovers a wallet from backup shares.
Example:
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.
getAssets
Fetches the wallet assets for a given chain, including native balance, ERC20 token balances, and NFTs (if available).
Note: The nfts field will only be included if the request is made with the includeNfts=true query parameter. Otherwise, it may be undefined or omitted, even on chains that support NFTs.
Returns:
nfts field may be undefined depending on the chain and whether NFTs are supported.
Example:
Signing Methods
personalSign (Deprecated)
Signs a message using personal_sign.
Deprecated: Userequest(PortalRequestMethod.PersonalSign, [message, address], chainId, options)instead.
You can pass{ signatureApprovalMemo: 'your memo' }in the options.
ethSign (Deprecated)
Signs a message using eth_sign.
Deprecated: This method still supports the signatureethSign(message, chainId?, signatureApprovalMemo?), wheresignatureApprovalMemois an optional memo shown in the signing UI.
The recommended approach is to userequest(PortalRequestMethod.EthSign, [address, message], chainId, { signatureApprovalMemo: 'your memo' })instead.
ethSignTypedData (Deprecated)
Signs typed data (EIP-712) using eth_signTypedData_v4.
Deprecated: Userequest(PortalRequestMethod.EthSignTypedDataV4, [address, typedData], chainId, options)instead.
You can pass{ signatureApprovalMemo: 'your memo' }in the options.
rawSign
Signs raw data without any prefix.
Transaction Methods
ethSendTransaction (Deprecated)
Sends a signed transaction to the network.
Deprecated: Userequest(PortalRequestMethod.EthSendTransaction, [transaction], chainId, options)instead.
You can pass{ sponsorGas: boolean, signatureApprovalMemo: 'your memo' }in the options.
ethSignTransaction (Deprecated)
Signs a transaction without broadcasting.
Deprecated: Userequest(PortalRequestMethod.EthSignTransaction, [transaction], chainId, options)instead.
You can pass{ signatureApprovalMemo: 'your memo' }in the options.
sendAsset
High-level method to send tokens or native assets.
Recommended Signature:
Note: The positional parameters signaturesendAsset(to, token, amount, chain)is deprecated. Use the object-based signaturesendAsset({ to, token, amount, sponsorGas, signatureApprovalMemo }, chain)instead.
SendAssetParams
Supported chain values:
-
Friendly names:
'ethereum','sepolia','base','base-sepolia''polygon','polygon-mumbai','polygon-amoy''solana','solana-devnet''optimism','arbitrum','avalanche''bitcoin-p2wpkh','bitcoin-p2wpkh-testnet'
-
CAIP-2 format:
- EVM chains:
'eip155:1','eip155:11155111', etc. - Solana:
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', etc. - Bitcoin (bip122 namespace):
'bip122:000000000019d6689c085ae165831e93-p2wpkh''bip122:000000000933ea01ad0ee984209779ba-p2wpkh'
- EVM chains:
-
If omitted and no default
chainIdis set, an error will be thrown
waitForConfirmation
Waits until a transaction is confirmed on the blockchain using strict confirmation semantics. Only a true return value indicates confirmed success.
Behavior by chain type:
- EVM chains (
eip155:*): Pollseth_getTransactionReceiptand (when applicable)eth_getUserOperationReceiptagainst your configuredgatewayConfigURL - Solana chains (
solana:*): PollsgetSignatureStatuseswithconfirmedcommitment level against your configuredgatewayConfigURL - Unsupported/other chains: Returns
false(not supported)
portal.yield.yieldxyz.deposit(), portal.yield.yieldxyz.withdraw(), and portal.trading methods.
Returns:
true— Transaction confirmed successfully on-chainfalse— Timeout, transaction failed on-chain, or unsupported network
- Poll interval: 4 seconds (
4_000ms) - Timeout: 15 minutes (
900_000ms) - On timeout or failure: Returns
false(does not throw)
waitForConfirmation(...) === true should be treated as success. Any other value (false, timeout, unsupported network) indicates failure. When used by Portal SDK methods (Yield, LiFi, 0x), this strict contract determines whether execution continues or stops.
Example:
evaluateTransaction
Evaluates a transaction for security risks using Blockaid.
Provider Methods
request
Generic method to make JSON-RPC requests.
Preferred Signature:
Note: Using raw string methods is deprecated. Use the PortalRequestMethod enum instead for type safety and better IDE support.
Parameters:
RequestOptions:
sponsorGas(boolean, optional): Whether Portal should sponsor gas. Only applies when the client has Account Abstraction (AA) enabled and the chain is supported. Omitting this field maintains default behavior.signatureApprovalMemo(string, optional): Optional memo displayed to the user during the signature approval flow.
ethGetBalance (Deprecated)
Gets the native token balance.
Deprecated: Use request(PortalRequestMethod.EthGetBalance, [address], chainId) instead.
ethGasPrice (Deprecated)
Gets the current gas price.
Deprecated: Use request(PortalRequestMethod.EthGasPrice, [], chainId) instead.
ethEstimateGas (Deprecated)
Estimates gas for a transaction.
Deprecated: Use request(PortalRequestMethod.EthEstimateGas, [transaction], chainId) instead.
getBalanceAsNumber
Gets the native token balance as a number (in ETH, not wei).
updateChain (Deprecated)
Updates the current chain ID for the provider.
Example:
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.
getAssets
Fetches native balance, token balances, and NFTs for the wallet on a specific chain.
getNFTs
Fetches NFTs owned by the wallet.
getBalances
Fetches ERC20 token balances.
getNftAssets
Gets NFT assets held by the wallet.
Returns
Promise<NFTAsset[]> - Array of NFT assets
Example Usage
getTransactionHistory
Returns the transaction history for a wallet across supported chains.
Replaces the legacy getTransactions method with pagination and extended support for modern transaction types (including ERC-4337 UserOperations on EVM chains). EVM responses use the normalized format documented below, while Solana currently returns its legacy response shape and will be unified in a future update.
Default behavior (
userOperations)
- EVM (
eip155:*) — If the authenticated client has Account Abstraction enabled (isAccountAbstracted), the SDK automatically sendsuserOperations=only. If the client is an EOA, the SDK does not send the parameter. - Non-EVM chains (e.g.
solana:*, Bitcoin, Tron, Stellar) — The SDK never injectsuserOperations; the filter does not apply to those namespaces.
userOperations is provided, it always overrides this behavior.
Returns
Promise<GetTransactionHistoryResponse>
For Solana chains (solana:*):
- RegularTransaction:
type: 'transaction'with optional token metadata (asset,tokenAddress,tokenDecimals) - UserOperationTransaction:
type: 'userOperation'with UserOp fields (userOpHash,entryPoint,actualGasCost,actualGasUsed)
getTransactions
Fetches transaction history.
getNetworks
Gets supported networks.
getEnabledDapps
Gets enabled dApps for the client.
simulateTransaction
Simulates a transaction.
getQuote (Deprecated)
Deprecated: Use portal.trading.zeroX.getQuote() instead.
Gets a swap quote.
getSources (Deprecated)
Deprecated: Use portal.trading.zeroX.getSources() instead.
Gets available swap sources.
The portal.ramps object
The ramps property exposes fiat on- and off-ramp integrations.
portal.ramps (Ramps)
The Ramps class groups fiat on- and off-ramp integrations.
Properties
See the Noah React Native SDK guide and the Meld React Native SDK guide for end-to-end flows and prerequisites.
portal.ramps.noah (Noah)
Noah methods issue HTTP requests through portal.api to /api/v3/clients/me/integrations/noah/... with the Portal client API key. Responses follow the { data, metadata? } envelope used across Client API integrations.
initiateKyc
Returns —
Promise<NoahInitiateKycResponse> with data.hostedUrl for hosted onboarding.
initiatePayin
Returns —
Promise<NoahInitiatePayinResponse> with data.payinId and structured data.bankDetails: BankDetails.
simulatePayin
Returns —
Promise<NoahSimulatePayinResponse> with data.fiatDepositId.
getPayoutCountries
Promise<NoahGetPayoutCountriesResponse> with data.countries: Record<string, string[]>.
getPayoutChannels
Returns —
Promise<NoahGetPayoutChannelsResponse> with data.items: Channel[] and optional data.pageToken.
getPayoutChannelForm
Returns —
Promise<NoahGetPayoutChannelFormResponse> with data.formSchema and optional data.formMetadata.
getPayoutQuote
Returns —
Promise<NoahGetPayoutQuoteResponse> including payoutId, formSessionId, cryptoAmountEstimate, totalFee.
initiatePayout
Returns —
Promise<NoahInitiatePayoutResponse> with data.destinationAddress: string | null and data.conditions: DepositSourceTriggerCondition[].
getPaymentMethods
Promise<NoahGetPaymentMethodsResponse> with data.paymentMethods: PaymentMethod[] and optional data.pageToken: string.
portal.ramps.meld (Meld)
Meld methods issue HTTP requests through portal.api to /api/v3/clients/me/integrations/meld/... with the Portal client API key. Responses follow the { data, metadata? } envelope used across Client API integrations.
See the Meld React Native SDK guide for end-to-end flows with full examples.
createCustomer
Returns —
Promise<MeldCreateCustomerResponse> with data: MeldCustomer (id, externalId, accountId, name?, email?, phone?, dateOfBirth?, type?, status?, addresses?, serviceProviders?).
searchCustomer
Promise<MeldSearchCustomerResponse> with data: { customers: MeldCustomer[]; count: number; remaining: number }.
getRetailQuote
Returns —
Promise<MeldGetRetailQuoteResponse> with data: { quotes: MeldQuote[]; message?: string; error?: string; timestamp?: string | null }. Each MeldQuote includes required fields serviceProvider, transactionType, sourceAmount, sourceCurrencyCode, destinationAmount, destinationCurrencyCode, exchangeRate, transactionFee, totalFee, paymentMethodType; and optional fields sourceAmountWithoutFees, destinationAmountWithoutFees, networkFee, partnerFee, fiatAmountWithoutFees, countryCode, customerScore, institutionName, isNativeAvailable, rampIntelligence.
createRetailWidget
Returns —
Promise<MeldCreateRetailWidgetResponse> with data: { id, token, widgetUrl, customerId, externalCustomerId, externalSessionId }.
searchRetailTransactions
Returns —
Promise<MeldSearchRetailTransactionsResponse> with data: { transactions: MeldTransaction[]; count: number; remaining: number; totalCount: number }.
getRetailTransaction
Returns —
Promise<MeldGetRetailTransactionResponse> with data: { transaction: MeldTransaction }.
getRetailTransactionBySession
Returns —
Promise<MeldGetRetailTransactionResponse> with data: { transaction: MeldTransaction }.
getServiceProviders
Promise<MeldGetServiceProvidersResponse> with data: MeldServiceProvider[] (serviceProvider, name, status?, categories?, categoryStatuses?, websiteUrl?, customerSupportUrl?, logos? with dark?, light?, darkShort?, lightShort?).
getCountries
Promise<MeldGetCountriesResponse> with data: MeldCountry[].
getFiatCurrencies
Promise<MeldGetFiatCurrenciesResponse> with data: MeldFiatCurrency[].
getCryptoCurrencies
Promise<MeldGetCryptoCurrenciesResponse> with data: MeldCryptoCurrency[].
getPaymentMethods
Promise<MeldGetPaymentMethodsResponse> with data: MeldPaymentMethod[].
getDefaults
Promise<MeldGetDefaultsResponse> with data: MeldCountryDefault[] (countryCode, defaultCurrencyCode, defaultPaymentMethods).
getBuyLimits
Promise<MeldGetBuyLimitsResponse> with data: MeldFiatCurrencyPurchaseLimit[] (currencyCode, minimumAmount, maximumAmount, defaultAmount).
getSellLimits
Promise<MeldGetSellLimitsResponse> with data: MeldCryptoCurrencySellLimit[] (currencyCode, chainCode, minimumAmount, maximumAmount, defaultAmount).
getKycLimits
Promise<MeldGetKycLimitsResponse> with data: MeldKycFiatLevel[]. Each entry includes currencyCode and optional level1, level2, level3 of type MeldKycLimitTier with dailyLimit, weeklyLimit, monthlyLimit, yearlyLimit, transactionLimit.
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.
Returns:
isReady
Checks if the MPC client is ready.
The portal.provider Object
The provider property is an EIP-1193 compliant provider.
request
Makes JSON-RPC requests.
React Context
PortalContextProvider
Provides the Portal instance to child components.
usePortal
Hook to access the Portal instance.
Enums
BackupMethods
PortalRequestMethod
PortalNamespace
PortalCurve
PortalSharePairStatus
MpcErrorCodes
EvaluateTransactionOperationType
Error Classes
MpcError
Custom error class for MPC operations.
Types
PortalOptions
BackupOptions
FeatureFlags
AddressesByNamespace
GatewayConfig
gatewayConfig is optional. When omitted (or set to {}), the SDK automatically builds a default config that routes RPC traffic through Portal’s managed gateway for 10 built-in chains:
Default URLs follow the pattern
https://{apiHost}/rpc/v1/{namespace}/{reference} (e.g. https://api.portalhq.io/rpc/v1/eip155/1).
When gatewayConfig is a non-empty object or a string, it is used exactly as supplied — the SDK does not merge defaults into a custom config.
Requests to Portal’s managed gateway automatically include your apiKey as a Bearer token — no extra configuration needed. Requests to a custom RPC URL (e.g. Infura, Alchemy) are sent without it, since third-party providers require their own credentials.