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<DelegationRevokeResponse> revoke({
required String chain,
required String token,
required String delegateAddress,
})
Description
Remove a delegate’s permission to transfer tokens on your behalf. Works across EVM and Solana chains.
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") |
delegateAddress | String | Yes | The address to revoke delegation from |
Returns
DelegationRevokeResponse - 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 | DelegationRevokeMetadata? | Revocation metadata with chain ID, revoked address, token symbol |
Example
EVM
import 'package:portal_flutter/portal_flutter.dart';
final portal = Portal();
final response = await portal.delegations.revoke(
chain: 'eip155:11155111',
token: 'USDC',
delegateAddress: '0x1234...',
);
// 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.revoke(
chain: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
token: 'USDC',
delegateAddress: '7smgSuU5mjP7QY5yWGdaTfgKn8hUWwvQgfvgcZB3HmJi',
);
// 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 delegation revocation failed |