Documentation Index Fetch the complete documentation index at: https://docs.gizatech.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Agent class provides methods for claiming accrued protocol rewards and browsing reward history. Reward queries return Paginator instances for efficient iteration over potentially large result sets.
claimRewards()
Claim all accrued rewards for the agent’s smart account. This triggers an on-chain claim of rewards accumulated from the protocols the agent is allocated to.
Signature
claimRewards (): Promise < ClaimedRewardsResponse >
Returns
Promise<ClaimedRewardsResponse>
Response Types
interface ClaimedRewardsResponse {
rewards : ClaimedReward [];
}
interface ClaimedReward {
token : string ;
amount : number ;
amount_float : number ;
current_price_in_underlying : number ;
}
Examples
import { Giza , Chain } from '@gizatech/agent-sdk' ;
const giza = new Giza ({ chain: Chain . BASE });
const agent = giza . agent ( '0xYourSmartAccountAddress' );
const claimed = await agent . claimRewards ();
for ( const reward of claimed . rewards ) {
console . log ( `Token: ${ reward . token } ` );
console . log ( ` Amount: ${ reward . amount_float } ` );
console . log ( ` Value in underlying: ${ reward . current_price_in_underlying } ` );
}
rewards()
Returns a paginator over the agent’s current reward records.
Signature
rewards ( options ?: PaginationOptions ): Paginator < RewardDTO >
Parameters
Optional pagination and sorting configuration. Items per page. Defaults to 20.
Sort order. Use SortOrder.DATE_ASC or SortOrder.DATE_DESC.
Returns
Paginator<RewardDTO>
RewardDTO Type
interface RewardDTO {
user_id : string ;
base_apr : number ;
extra_apr : number ;
ticker : string ;
reward_amount : number ;
group : string ;
transaction_hash : string ;
start_date : string ;
end_date : string ;
id : string ;
created_at : string ;
updated_at : string ;
}
Examples
Async iteration
First N items
Specific page
import { SortOrder } from '@gizatech/agent-sdk' ;
for await ( const reward of agent . rewards ({ sort: SortOrder . DATE_DESC })) {
console . log ( ` ${ reward . ticker } : ${ reward . reward_amount } ` );
console . log ( ` APR: ${ reward . base_apr } % + ${ reward . extra_apr } % extra` );
console . log ( ` Period: ${ reward . start_date } to ${ reward . end_date } ` );
}
rewardHistory()
Returns a paginator over the agent’s historical reward records. This includes past claimed and distributed rewards.
Signature
rewardHistory ( options ?: PaginationOptions ): Paginator < RewardDTO >
Parameters
Optional pagination and sorting configuration. Items per page. Defaults to 20.
Sort order. Use SortOrder.DATE_ASC or SortOrder.DATE_DESC.
Returns
Paginator<RewardDTO>
Examples
import { SortOrder } from '@gizatech/agent-sdk' ;
// Get the 10 most recent historical rewards
const history = await agent . rewardHistory ({
sort: SortOrder . DATE_DESC ,
}). first ( 10 );
for ( const reward of history ) {
console . log ( ` ${ reward . start_date } - ${ reward . end_date } ` );
console . log ( ` ${ reward . ticker } : ${ reward . reward_amount } ` );
console . log ( ` TX: ${ reward . transaction_hash } ` );
}