Overview
TheGiza class is the primary entry point of the SDK. It manages authentication, HTTP transport, and chain-scoped configuration. Use it to create Agent handles, query protocol data, run the optimizer, and check system health.
Constructor
GizaConfig
required
Configuration object specifying the target chain and credentials.
ValidationError if any required credential is missing or if the chain ID is invalid.
Environment Variable Fallback
When a credential is omitted from the constructor config, the SDK reads the corresponding environment variable:
If neither the config field nor the environment variable is set, the constructor throws a
ValidationError with a message indicating which value is missing.
Agent Factory Methods
These methods create or retrieveAgent handles bound to a specific smart-account wallet address.
agent(wallet)
Agent handle for a known smart-account address without making any API call. Use this when you already have the smart-account address stored (for example, from a previous createAgent call).
Address
required
The smart-account wallet address (
0x-prefixed hex string).Agent
createAgent(eoa)
Agent bound to the new smart-account address.
Address
required
The user’s externally-owned account address.
Promise<Agent> — the Agent is bound to the newly created smart-account address.
getAgent(eoa)
Agent bound to it. Use this when the smart account was created previously and you need to recover the handle.
Address
required
The user’s externally-owned account address.
Promise<Agent>
getSmartAccount(eoa)
Agent handle. Useful when you need the raw account data.
Address
required
The user’s externally-owned account address.
Promise<SmartAccountInfo>
Chain-Level Queries
These methods query data scoped to the chain configured on theGiza client.
protocols(token)
Address
required
The token contract address.
Promise<ProtocolsResponse> — { protocols: string[] }
protocolSupply(token)
Address
required
The token contract address.
Promise<ProtocolsSupplyResponse>
tokens()
Promise<TokensResponse> — { tokens: TokenInfo[] }
stats()
Promise<Statistics>
tvl()
Promise<TVLResponse> — { tvl: number }
Optimizer
The optimizer provides capital allocation recommendations. See the Optimizer reference for full documentation.optimize(options)
System
health()
getApiConfig()
chains()
Accessors
getChain()
Chain enum value configured on this client.
getApiUrl()
Next Steps
Agent Class
Wallet-scoped lifecycle, monitoring, and operations
Optimizer
Capital allocation optimization
Overview
SDK architecture and configuration reference
Quickstart
End-to-end integration tutorial