The iAgent SDK is a comprehensive framework for building applications on the Injective Chain, offering:
- Full coverage of Injective modules (Exchange, Staking, Governance, Bank)
- Pre-built actions for trading, staking, and governance
- Template-based system with built-in validation
- Standardized patterns for queries and transactions
- Automated error handling
- Native gRPC client integration
- Multi-network support (Mainnet/Testnet)
- Streamlined key management
- TypeScript definitions
- Example implementations
- Modular action creation system
This SDK enables rapid development of secure, reliable applications within Injective's DeFi ecosystem.
Note: Requires Node.js version 23 or higher
- Clone the repository:
git clone https://github.com/InjectiveLabs/iagent-ts
- Install dependencies and build:
cd iagent-ts
pnpm i --no-frozen-lockfile && pnpm build
- Create your environment file:
cp .env.example .env
- Configure your
.env
file:
# Injective Keys and Environment
INJECTIVE_PUBIC_KEY="XXXX"
INJECTIVE_PRIVATE_KEY="XXXX"
EVM_PUBLIC_KEY="XXXX"
INJECTIVE_NETWORK="Mainnet"
OPENAI_API_KEY="sks-x"
# Other application environment variables go here
Note: Get your OpenAI API key from: https://platform.openai.com/api-keys
- Start the agent server:
pnpm start
- In a separate terminal, start the client:
pnpm start:client
To modify the default character, edit src/character.ts
Load custom character configurations:
pnpm start --characters="path/to/your/character.json"
Note: Multiple character files can be loaded simultaneously
You can configure clients in two ways:
- In
character.ts
:
clients: [Clients.TWITTER, Clients.DISCORD],
plugins: [injectivePlugin]
- In
character.json
:
{
"clients": ["twitter", "discord"]
}
- Always use TypeScript for type safety
- Follow the template patterns for new actions
- Implement proper error handling
- Test on testnet before deploying to mainnet
-
Connection Issues
- Verify network configuration
- Check API key validity
- Ensure proper endpoint URLs
-
Transaction Failures
- Verify account balance
- Check gas settings
- Validate transaction parameters
- Explore the example implementations
- Review the API documentation
- Join the developer community
- Build your first application
For more detailed information, refer to:
- Official Documentation
- API Reference
- Community Forums
- Developer Discord
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
- Follow the code style guidelines
For support:
- GitHub Issues
- Developer Discord
- Community Forums
- Documentation Wiki