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
This page lists every type exported from @gizatech/agent-sdk. Types are grouped by category. All types can be imported directly:
import {
Giza, Agent, Chain, Paginator,
type Address, type Transaction, type OptimizeOptions,
} from '@gizatech/agent-sdk';
Configuration
GizaConfig
Options passed to the Giza constructor. Credentials fall back to environment variables when omitted.
interface GizaConfig {
chain: Chain;
apiKey?: string;
partner?: string;
apiUrl?: string;
timeout?: number;
enableRetry?: boolean;
}
ResolvedGizaConfig
Internal configuration after defaults and environment variables are resolved.
interface ResolvedGizaConfig {
chain: Chain;
apiKey: string;
partner: string;
apiUrl: string;
agentId: string;
timeout: number;
enableRetry: boolean;
}
Common
Address
Ethereum address type. A 0x-prefixed hex string.
type Address = `0x${string}`;
Chain
Supported blockchain networks.
enum Chain {
DEVNET = -1,
ETHEREUM = 1,
POLYGON = 137,
CHAIN_999 = 999,
BASE = 8453,
CHAIN_9745 = 9745,
SEPOLIA = 11155111,
ARBITRUM = 42161,
BASE_SEPOLIA = 84532,
}
GizaError
Base error class for all SDK errors.
class GizaError extends Error {
constructor(message: string);
}
ValidationError
Thrown when input validation fails (invalid address, missing required fields, etc.).
class ValidationError extends GizaError {
constructor(message: string);
}
NotImplementedError
Thrown when a feature is not yet implemented.
class NotImplementedError extends GizaError {
constructor(message: string);
}
Agent Options
ActivateOptions
interface ActivateOptions {
owner: Address;
token: Address;
protocols: string[];
txHash: string;
constraints?: ConstraintConfig[];
}
AprOptions
interface AprOptions {
startDate?: string;
endDate?: string;
useExactEndDate?: boolean;
}
DeactivateOptions
interface DeactivateOptions {
transfer?: boolean;
}
interface PaginationOptions {
limit?: number;
sort?: string;
}
interface PerformanceOptions {
from?: string;
}
WaitForDeactivationOptions
interface WaitForDeactivationOptions {
interval?: number;
timeout?: number;
onUpdate?: (status: AgentStatus) => void;
}
Agent Responses
SmartAccountInfo
interface SmartAccountInfo {
smartAccountAddress: Address;
backendWallet: Address;
origin_wallet: Address;
chain: Chain;
}
ActivateResponse
interface ActivateResponse {
message: string;
wallet: string;
}
DeactivateResponse
interface DeactivateResponse {
message: string;
}
TopUpResponse
interface TopUpResponse {
message: string;
}
RunResponse
interface RunResponse {
status: string;
}
AgentInfo
interface AgentInfo {
wallet: Address;
deposits: Deposit[];
withdraws?: Withdraw[];
status: AgentStatus;
activation_date: string;
last_deactivation_date?: string;
last_reactivation_date?: string;
selected_protocols: string[];
current_protocols?: string[];
current_token?: string;
eoa?: Address;
}
interface PerformanceChartResponse {
performance: PerformanceData[];
}
interface PerformanceData {
date: string;
value: number;
value_in_usd?: number;
accrued_rewards?: AccruedRewardsBySymbol;
portfolio?: Portfolio;
agent_token_amount?: number;
}
WalletAprResponse
interface WalletAprResponse {
apr: number;
sub_periods?: WalletAprSubPeriod[];
}
WalletAprSubPeriod
interface WalletAprSubPeriod {
start_date: string;
end_date: string;
return_: number;
initial_value: number;
}
AprByTokenResponse
type AprByTokenResponse = AllocatedValue[];
AllocatedValue
interface AllocatedValue {
value: number;
value_in_usd: number;
base_apr?: number;
total_apr?: number;
}
Portfolio
type Portfolio = Record<string, AllocatedValue>;
AccruedRewardsWithValue
interface AccruedRewardsWithValue {
locked: number;
unlocked: number;
locked_value: number;
locked_value_usd: number;
unlocked_value: number;
unlocked_value_usd: number;
claimed?: number;
claimed_value?: number;
claimed_value_usd?: number;
}
AccruedRewardsBySymbol
type AccruedRewardsBySymbol = Record<string, AccruedRewardsWithValue>;
Transaction
interface Transaction {
action: TxAction;
date: string;
amount: number;
amount_out?: number;
token_type: string;
status: TxStatus;
transaction_hash?: string;
protocol?: string;
new_token?: string;
correlation_id?: string;
apr?: number;
block_number?: number;
}
TransactionHistoryResponse
interface TransactionHistoryResponse {
transactions: Transaction[];
pagination: PaginationInfo;
}
interface PaginationInfo {
page: number;
items_per_page: number;
total_pages: number;
total_items: number;
}
WithdrawResponse
type WithdrawResponse =
| FullWithdrawResponse
| PartialWithdrawResponse;
FullWithdrawResponse
interface FullWithdrawResponse {
message: string;
}
PartialWithdrawResponse
interface PartialWithdrawResponse {
date: string;
amount: number;
value: number;
withdraw_details: WithdrawDetail[];
}
WithdrawDetail
interface WithdrawDetail {
token: string;
amount: string;
value: number;
value_in_usd: number;
principal_amount?: number;
yield_amount?: number;
fee_amount?: number;
tx_hash?: string;
block_number?: number;
}
WithdrawalStatusResponse
interface WithdrawalStatusResponse {
status: AgentStatus;
wallet: Address;
activation_date: string;
last_deactivation_date?: string;
last_reactivation_date?: string;
}
FeeResponse
interface FeeResponse {
percentage_fee: number;
fee: number;
}
LimitResponse
interface LimitResponse {
limit: number;
}
ClaimedReward
interface ClaimedReward {
token: string;
amount: number;
amount_float: number;
current_price_in_underlying: number;
}
ClaimedRewardsResponse
interface ClaimedRewardsResponse {
rewards: ClaimedReward[];
}
DepositListResponse
interface DepositListResponse {
deposits: Deposit[];
}
Deposit
interface Deposit {
amount: number;
token_type: string;
date?: string;
tx_hash?: string;
block_number?: number;
}
Withdraw
interface Withdraw {
date: string;
amount: number;
value: number;
withdraw_details: WithdrawDetail[];
}
ExecutionWithTransactionsDTO
interface ExecutionWithTransactionsDTO {
id: string;
execution_plan: unknown;
execution_type: string;
status: ExecutionStatus;
created_at: string;
transactions: Transaction[];
}
PaginatedExecutionDTO
interface PaginatedExecutionDTO {
items: ExecutionWithTransactionsDTO[];
total: number;
}
LogDTO
interface LogDTO {
type: string;
data: unknown;
}
PaginatedLogDTO
interface PaginatedLogDTO {
items: LogDTO[];
total: number;
}
RewardDTO
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;
}
PaginatedRewardDTO
interface PaginatedRewardDTO {
items: RewardDTO[];
total: number;
}
Protocol
interface Protocol {
name: string;
is_active: boolean;
description: string;
tvl: number;
apr: number | null;
pools: ProtocolPool[] | null;
created_at: string;
updated_at: string | null;
chain_id: number;
parent_protocol: string;
link: string;
address: string | null;
agent_token: string | null;
title: string | null;
}
ProtocolPool
interface ProtocolPool {
name: string;
apy: number;
}
ProtocolsResponse
interface ProtocolsResponse {
protocols: string[];
}
ProtocolsRawResponse
interface ProtocolsRawResponse {
protocols: Protocol[];
}
ProtocolSupply
interface ProtocolSupply {
protocol: string;
supply: number;
tokens: string[];
}
ProtocolsSupplyResponse
interface ProtocolsSupplyResponse {
protocols: ProtocolSupply[];
}
ConstraintConfig (Agent)
interface ConstraintConfig {
kind: string;
params: Record<string, unknown>;
}
ConstraintConfigResponse
interface ConstraintConfigResponse {
[key: string]: unknown;
}
ChainConfigResponse
interface ChainConfigResponse {
[key: string]: unknown;
}
GlobalConfigResponse
interface GlobalConfigResponse {
min_withdraw_usd: number;
optimizer_threshold_usd: number;
max_protocol_liquidity_percentage: number;
constraints: ConstraintConfigResponse;
chains: Record<string, ChainConfigResponse>;
}
HealthcheckResponse
interface HealthcheckResponse {
message: string;
version: string;
time: string;
}
ChainsResponse
interface ChainsResponse {
chain_ids: number[];
}
TokenDistributionItem
interface TokenDistributionItem {
token: string;
amount: number;
percentage: number;
}
ProtocolDistribution
interface ProtocolDistribution {
protocol: string;
amount: number;
percentage: number;
}
LiquidityDistribution
interface LiquidityDistribution {
initial_deposits: TokenDistributionItem[];
current_tokens: TokenDistributionItem[];
protocols: ProtocolDistribution[];
}
Statistics
interface Statistics {
total_balance: number;
total_deposits: number;
total_users: number;
total_transactions: number;
total_apr: number;
liquidity_distribution: LiquidityDistribution;
}
TVLResponse
interface TVLResponse {
tvl: number;
}
TokenInfo
interface TokenInfo {
address: string;
symbol: string;
decimals: number;
balance: number;
current_price: number;
}
TokensResponse
interface TokensResponse {
tokens: TokenInfo[];
}
Agent Enums
AgentStatus
enum AgentStatus {
UNKNOWN = 'unknown',
ACTIVATING = 'activating',
ACTIVATION_FAILED = 'activation_failed',
ACTIVATED = 'activated',
RUNNING = 'running',
RUN_FAILED = 'run_failed',
BLOCKED = 'blocked',
DEACTIVATING = 'deactivating',
DEACTIVATION_FAILED = 'deactivation_failed',
DEACTIVATED = 'deactivated',
EMERGENCY = 'emergency',
DEACTIVATED_FEE_NOT_PAID = 'deactivated_fee_not_paid',
BRIDGING = 'bridging',
}
TxAction
enum TxAction {
UNKNOWN = 'unknown',
APPROVE = 'approve',
DEPOSIT = 'deposit',
TRANSFER = 'transfer',
BRIDGE = 'bridge',
WITHDRAW = 'withdraw',
SWAP = 'swap',
REFILL_GAS_TANK = 'refill_gas_tank',
WRAP = 'wrap',
UNWRAP = 'unwrap',
FEE_TRANSFER = 'fee_transfer',
}
TxStatus
enum TxStatus {
UNKNOWN = 'unknown',
PENDING = 'pending',
APPROVED = 'approved',
CANCELLED = 'cancelled',
FAILED = 'failed',
}
SortOrder
enum SortOrder {
DATE_ASC = 'date_asc',
DATE_DESC = 'date_desc',
}
Order
enum Order {
ASC = 'asc',
DESC = 'desc',
}
Period
enum Period {
ALL = 'all',
DAY = 'day',
}
ExecutionStatus
enum ExecutionStatus {
RUNNING = 'running',
FAILED = 'failed',
SUCCESS = 'success',
}
Optimizer Types
OptimizeOptions
interface OptimizeOptions {
chain?: Chain;
token: Address;
capital: string;
currentAllocations: Record<string, string>;
protocols: string[];
constraints?: ConstraintConfig[];
wallet?: Address;
}
OptimizeResponse
interface OptimizeResponse {
optimization_result: OptimizationResult;
action_plan: ActionDetail[];
calldata: CalldataInfo[];
}
OptimizationResult
interface OptimizationResult {
allocations: ProtocolAllocation[];
total_costs: number;
weighted_apr_initial: number;
weighted_apr_final: number;
apr_improvement: number;
gas_estimate_usd?: number;
break_even_days?: number;
}
ProtocolAllocation
interface ProtocolAllocation {
protocol: string;
allocation: string;
apr: number;
}
ActionDetail
interface ActionDetail {
action_type: 'deposit' | 'withdraw';
protocol: string;
amount: string;
underlying_amount?: string;
}
CalldataInfo
interface CalldataInfo {
contract_address: string;
function_name: string;
parameters: string[];
value: string;
protocol: string;
description: string;
}
WalletConstraints
enum WalletConstraints {
MIN_PROTOCOLS = 'min_protocols',
MAX_ALLOCATION_AMOUNT_PER_PROTOCOL = 'max_allocation_amount_per_protocol',
MAX_AMOUNT_PER_PROTOCOL = 'max_amount_per_protocol',
MIN_AMOUNT = 'min_amount',
EXCLUDE_PROTOCOL = 'exclude_protocol',
MIN_ALLOCATION_AMOUNT_PER_PROTOCOL = 'min_allocation_amount_per_protocol',
}
ConstraintConfig (Optimizer)
Imported as OptimizerConstraintConfig to distinguish from the agent variant.
interface ConstraintConfig {
kind: WalletConstraints;
params: Record<string, unknown>;
}
Paginator Types
Paginator<T>
Async-iterable paginator returned by collection methods. See Paginator reference.
class Paginator<T> implements AsyncIterable<T> {
async *[Symbol.asyncIterator](): AsyncIterableIterator<T>;
async page(num: number, opts?: { limit?: number }): Promise<PaginatedResponse<T>>;
async first(count?: number): Promise<T[]>;
}
PaginatedResponse<T>
interface PaginatedResponse<T> {
items: T[];
total: number;
page: number;
limit: number;
hasMore: boolean;
}
PageFetcher<T>
Internal type used by the Paginator constructor.
type PageFetcher<T> = (
page: number,
limit: number,
) => Promise<PaginatedResponse<T>>;
Error Classes
GizaError
Base class for all SDK errors. Extends Error.
class GizaError extends Error {
constructor(message: string);
}
ValidationError
Thrown on invalid input (bad addresses, missing fields, invalid values).
class ValidationError extends GizaError {
constructor(message: string);
}
NotImplementedError
Thrown when calling a feature that is not yet implemented.
class NotImplementedError extends GizaError {
constructor(message: string);
}
GizaAPIError
Thrown when the Giza API returns a non-2xx response.
class GizaAPIError extends GizaError {
readonly statusCode: number;
readonly responseData: unknown;
readonly requestUrl?: string;
readonly requestMethod?: string;
readonly friendlyMessage: string;
constructor(
message: string,
statusCode: number,
responseData?: unknown,
requestUrl?: string,
requestMethod?: string,
);
static fromResponse(
statusCode: number,
responseData: unknown,
requestUrl?: string,
requestMethod?: string,
): GizaAPIError;
toJSON(): object;
}
TimeoutError
Thrown when a request or polling operation exceeds its timeout.
class TimeoutError extends GizaError {
constructor(timeout: number, message?: string);
}
NetworkError
Thrown on network connectivity failures (DNS resolution, connection refused, etc.).
class NetworkError extends GizaError {
constructor(message: string);
}
Constants
DEFAULT_AGENT_ID
Default agent identifier used for smart account creation.
const DEFAULT_AGENT_ID = 'giza-app';
DEFAULT_TIMEOUT
Default HTTP request timeout in milliseconds.
const DEFAULT_TIMEOUT = 45000;
CHAIN_NAMES
Map of chain IDs to human-readable names.
const CHAIN_NAMES: Record<Chain, string> = {
[-1]: 'Devnet',
[1]: 'Ethereum',
[137]: 'Polygon',
[999]: 'Chain 999',
[8453]: 'Base',
[9745]: 'Chain 9745',
[11155111]: 'Sepolia',
[42161]: 'Arbitrum',
[84532]: 'Base Sepolia',
};