Skip to main content

Method Signature

agent.getFees(wallet: Address): Promise<FeeResponse>

Description

Retrieves fee information for an agent, including the percentage fee and the current fee amount.

Parameters

wallet
Address
required
Smart account wallet address.

Return Value

percentage_fee
number
Fee percentage charged on profits. For example, 0.1 represents 10%.
fee
number
Current absolute fee amount owed.

Example

import { GizaAgent, Chain } from '@giza/agent-sdk';

const giza = new GizaAgent({ chainId: Chain.BASE });

// Get fee information
const fees = await giza.agent.getFees(smartAccountAddress);

console.log(`Fee percentage: ${fees.percentage_fee * 100}%`);
console.log(`Current fee owed: ${fees.fee}`);

Output

{
  percentage_fee: 0.1,  // 10%
  fee: 5.25             // Current fee amount
}

Error Handling

import { ValidationError, GizaAPIError } from '@giza/agent-sdk';

try {
  const fees = await giza.agent.getFees(smartAccountAddress);
} catch (error) {
  if (error instanceof ValidationError) {
    console.error('Invalid wallet address:', error.message);
  } else if (error instanceof GizaAPIError) {
    console.error('Failed to get fees:', error.message);
  }
}

Notes

Fees are typically charged as a percentage of realized profits. The exact fee structure may vary based on your agreement with Giza.

Next Steps