Skip to main content

Function Signature

Future<PortalFundResult> receiveTestnetAsset({
  required String chainId,
  required String amount,
  required String token,
})

Description

Requests testnet assets for development and testing. This method only works on supported testnet networks.

Parameters

ParameterTypeRequiredDescription
chainIdStringYesThe testnet chain ID in CAIP-2 format
amountStringYesThe amount to request
tokenStringYesToken symbol (e.g., "NATIVE", "ETH")

Returns

PortalFundResult - An object containing:
PropertyTypeDescription
successboolWhether the request was successful
transactionHashString?The transaction hash
errorString?Error message if the request failed

Example

import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

// Request testnet ETH on Sepolia
final result = await portal.receiveTestnetAsset(
  chainId: 'eip155:11155111', // Sepolia
  amount: '0.01',
  token: 'NATIVE',
);

if (result.success) {
  print('Funded! TX: ${result.transactionHash}');
} else {
  print('Failed: ${result.error}');
}

Monad Testnet

final result = await portal.receiveTestnetAsset(
  chainId: 'eip155:10143', // Monad Testnet
  amount: '0.01',
  token: 'NATIVE',
);

Supported Networks

NetworkChain ID
Sepoliaeip155:11155111
Monad Testneteip155:10143
For other testnet tokens or networks, check the testnet faucets page.

Errors

CodeDescription
NOT_INITIALIZEDPortal was not initialized
FAUCET_ERRORFailed to request testnet assets
UNSUPPORTED_NETWORKThe network is not supported