Skip to main content

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

ParameterTypeRequiredDescription
chainStringYesCAIP-2 chain ID (e.g., "eip155:11155111" for Sepolia)
tokenStringYesToken symbol or address (e.g., "USDC")
delegateAddressStringYesThe address to revoke delegation from

Returns

DelegationRevokeResponse - An object containing:
PropertyTypeDescription
transactionsList<DelegationConstructedTransaction?>?Array of constructed transactions (for EVM chains)
encodedTransactionsList<String?>?Array of encoded transaction strings (for Solana)
metadataDelegationRevokeMetadata?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

CodeDescription
NOT_INITIALIZEDPortal was not initialized
DELEGATION_FAILEDThe delegation revocation failed