Documentation Index
Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
Use this file to discover all available pages before exploring further.
Function Signature
Future<DelegationTransferFromResponse> transferFrom({
required String chain,
required String token,
required String fromAddress,
required String toAddress,
required String amount,
})
Description
Execute a transfer using previously approved delegated authority. The caller must have been granted delegation approval by the fromAddress owner.
Parameters
| Parameter | Type | Required | Description |
|---|
chain | String | Yes | CAIP-2 chain ID (e.g., "eip155:11155111" for Sepolia) |
token | String | Yes | Token symbol or address (e.g., "USDC") |
fromAddress | String | Yes | The owner’s address (who approved the delegation) |
toAddress | String | Yes | The recipient’s address |
amount | String | Yes | The amount to transfer (e.g., "50.0") |
Returns
DelegationTransferFromResponse - An object containing:
| Property | Type | Description |
|---|
transactions | List<DelegationConstructedTransaction?>? | Array of constructed transactions (for EVM chains) |
encodedTransactions | List<String?>? | Array of encoded transaction strings (for Solana) |
metadata | DelegationTransferFromMetadata | Transfer metadata with chain ID, delegate address, amount, etc. |
Example
EVM
import 'package:portal_flutter/portal_flutter.dart';
final portal = Portal();
final response = await portal.delegations.transferFrom(
chain: 'eip155:11155111',
token: 'USDC',
fromAddress: '0xowner...',
toAddress: '0xrecipient...',
amount: '50.0',
);
// Sign and send the transaction
final tx = response.transactions!.first!;
final txResponse = await portal.request(
chainId: 'eip155:11155111',
method: 'eth_sendTransaction',
params: [
{'from': tx.from, 'to': tx.to, 'data': tx.data, 'value': tx.value}
],
);
print('Tx hash: ${txResponse.result}');
Solana
final response = await portal.delegations.transferFrom(
chain: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
token: 'USDC',
fromAddress: 'ARttPLesu9RiX6H111Pfdc9Y2DhGy1B8P8jyyrD8Cj5b',
toAddress: 'GPsPXxoQA51aTJJkNHtFDFYui5hN5UxcFPnheJEHa5Du',
amount: '50.0',
);
// Sign and send the transaction
final encodedTx = response.encodedTransactions!.first!;
final txResponse = await portal.request(
chainId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
method: 'sol_signAndSendTransaction',
params: [encodedTx],
);
print('Tx hash: ${txResponse.result}');
Errors
| Code | Description |
|---|
NOT_INITIALIZED | Portal was not initialized |
DELEGATION_FAILED | The delegated transfer failed |
INSUFFICIENT_ALLOWANCE | The delegation allowance is insufficient |