portal.api

The api property contains an instance of the PortalApi class, which has a number of helper methods to facilitate the retrieval of relevant application data from the Portal REST API.

portal.api.buildTransaction

Creates an unsigned eip155/solana transaction for transferring assets to another address on a specific chain. You can then use this unsigned eip155/solana transaction to sign and submit the eip155/solana transaction.
const txDetails = await portal.api.buildTransaction(
  '0xDestinationAddress',
  'USDC', // Friendly token name, or token address (mint address for Solana)
  '1', // Sends 1 USDC
  'sepolia', // Friendly chain or CAIP-2 chainId
)

portal.api.getNFTs

Fetches a list of non-fungible tokens (NFTs). The response is an array of objects where each object represents a unique NFT.
const nfts = await portal.api.getNFTs()

portal.api.getTransactions

Fetches a list of the client’s transaction history ordered by blockTimestamp descending (latest transactions will come first). This includes both inbound and outbound transactions.
const transactions = await portal.api.getTransactions()
Optional arguments can also be provided:
  • limit: (Optional) The maximum number of transactions to return.
  • offset: (Optional) The number of transactions to skip before starting to return.
  • order: (Optional) Order in which to return the transactions. Either "asc" or "desc".
  • chainId: (Optional) ID of the chain to retrieve transactions from. Defaults to your Portal instance’s chainId if not provided.

portal.api.getBalances

Fetches a list of the client’s ERC20 token balances.
const tokenBalances = await portal.api.getBalances()

portal.api.getBackupShareMetadata

Fetches a list of the client’s backup shares’ metadata, such as the backup method, when it was created, and the backup share’s id.
const backupSharePairs = await portal.api.getBackupShareMetadata()