portal.getNFTAssets

Fetches the asset balances (native and token balances) for a specified blockchain. It provides detailed information on the native balance and token balances held by a given address on the specified chain.
Task {
  do {
    let nfts = try await portal.getNftAssets(chainId)
  } catch {
    // Handle any errors.
  }
}
Parameters
  • chainId: The chain identifier in CAIP-2 format (e.g., “eip155:1” for Ethereum mainnet, “solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp” for Solana mainnet)

portal.getAssets

Retrieves a collection of assets (tokens and NFTs) for the specified blockchain. This method fetches all available assets associated with the wallet on the specified blockchain network, including both fungible tokens and NFTs.
Task {
  do {
    let nfts = try await portal.getAssets(chainId)
  } catch {
    // Handle any errors.
  }
}
Parameters
  • chainId: The chain identifier in CAIP-2 format (e.g., “eip155:1” for Ethereum mainnet, “solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp” for Solana mainnet)

portal.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.
Task {
  do {
    let transactions = try await portal.getTransactions(chainId)
  } catch {
    // Handle any errors.
  }
}
Parameters
  • chainId: The chain identifier in CAIP-2 format (e.g., “eip155:1” for Ethereum mainnet, “solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp” for Solana mainnet)
  • limit: Optional maximum number of transactions to return. If nil, returns all transactions.
  • offset: Optional number of transactions to skip for pagination. If nil, starts from the beginning.
  • order: Optional TransactionOrder to specify the sort order of transactions: ASC or DESC.

portal.getBalances

Fetches a list of the client’s ERC20 token balances.
Task {
  do {
    let erc20Balances = try await portal.getBalances(chainId)
  } catch {
    // Handle any errors.
  }
}
Parameters
  • chainId: The chain identifier in CAIP-2 format (e.g., “eip155:1” for Ethereum mainnet, “solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp” for Solana mainnet)

portal.buildEip155Transaction

Creates an unsigned eip155 transaction for transferring assets to another address on a specific chain. You can then use this unsigned eip155 transaction to sign and submit the eip155 transaction.
Task {
  do {
    let buildTransactionParam = BuildTransactionParam(
        to: "eip155 address",
        token: "ETH",
        amount: "1.0"
      )
    let eip155Transaction = try await portal.buildEip155Transaction(chainId: chainId, params: buildTransactionParam)
  } catch {
    // Handle any errors.
  }
}
Parameters
  1. chainId: The chain identifier in CAIP-2 format (e.g., “eip155:1” for Ethereum mainnet)
  2. params: A BuildTransactionParam object containing:
    • to: Recipient’s address
    • token: Token identifier or contract address
    • amount: Amount to transfer as a string

portal.buildSolanaTransaction

Creates an unsigned Solana transaction for transferring assets to another address on a specific chain. You can then use this unsigned Solana transaction to sign and submit the Solana transaction.
Task {
  do {
    let buildTransactionParam = BuildTransactionParam(
        to: "solana address",
        token: "SOL",
        amount: "1.0"
      )
    let solanaTransaction = try await portal.buildSolanaTransaction(chainId: chainId, params: buildTransactionParam)
  } catch {
    // Handle any errors.
  }
}
Parameters
  • chainId: The chain identifier in CAIP-2 format (e.g., “solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp” for Solana mainnet)
  • params: A BuildTransactionParam object containing:
    • to: Recipient’s Solana address
    • token: Token identifier (“SOL” for native transfers, mint address for SPL tokens)
    • amount: Amount to transfer as a string (in lamports for SOL, raw amount for SPL tokens)

portal.getWalletCapabilities

Retrieves the capabilities of the current wallet. This method fetches information about what features and operations are supported by the wallet, including supported chains and operations.
Task {
  do {
    let capabilities = try await portal.getWalletCapabilities()
  } catch {
    // Handle any errors.
  }
}

portal.evaluateTransaction

Evaluates a transaction for security and risk assessment, providing both validation and simulation results. This method can be used to assess the safety and potential risks of a transaction before execution.
Task {
  do {
    let evaluationResult = try await portal.evaluateTransaction(
      chainId: chainId,
      transaction: transaction,
      operationType: operationType
    )
  } catch {
    // Handle any errors.
  }
}
Parameters
  • chainId: The chain identifier in CAIP-2 format (e.g., "eip155:1" for Ethereum mainnet).
  • transaction: An EvaluateTransactionParam object containing the transaction details:
    • to: (Required) The destination address.
    • value: (Optional) The transaction value in wei.
    • data: (Optional) The transaction data for contract interactions.
    • maxFeePerGas: (Optional) The maximum total fee per gas unit.
    • maxPriorityFeePerGas: (Optional) The maximum priority fee per gas unit.
    • gas: (Optional) The gas limit.
    • gasPrice: (Optional) The gas price for legacy transactions.
  • operationType: Optional EvaluateTransactionOperationType to specify the type of evaluation:
    • .validation: Perform security validation only.
    • .simulation: Perform transaction simulation only.
    • .all: Perform both validation and simulation.
Related Documentation