@elizaos/plugin-injective
A comprehensive plugin for interacting with the Injective chain through ElizaOS.
Project Structure​
src/
├── auction.ts # Auction module actions
├── auth.ts # Auth module actions
├── bank.ts # Bank module actions
├── distribution.ts # Distribution module actions
├── exchange.ts # Exchange module actions
├── explorer.ts # Explorer module actions
├── gov.ts # Governance module actions
├── ibc.ts # IBC module actions
├── insurance.ts # Insurance module actions
├── mint.ts # Mint module actions
├── mito.ts # Mito module actions
├── peggy.ts # Peggy module actions
├── permissions.ts # Permissions module actions
├── staking.ts # Staking module actions
├── token-factory.ts # Token Factory module actions
├── wasm.ts # WASM module actions
├── base.ts # Base action creation logic
└── index.ts # Main export file
Module Organization​
Each module file follows a consistent organization pattern:
1. File Structure​
// src/[module].ts
import { createGenericAction } from './base';
import * as ModuleTemplates from '@injective/template/[module]';
import * as ModuleExamples from '@injective/examples/[module]';
// Export individual actions
export const Action1 = createGenericAction({...});
export const Action2 = createGenericAction({...});
// Export all actions as a group
export const ModuleActions = [
Action1,
Action2,
// ...other actions
];
2. Main Export File​
// src/index.ts
export * from './auction';
export * from './auth';
// ...other module exports
export const InjectiveActions = [
...ExchangeActions,
...AuctionActions,
// ...other module actions
];
Module Descriptions​
auction.ts​
Handles auction-related functionality including module parameters, auction rounds, and bidding.
auth.ts​
Manages authentication, account details, and authorization grants.
bank.ts​
Handles account balances, token transfers, and supply queries.
distribution.ts​
Manages reward distribution and withdrawals.
exchange.ts​
Core exchange functionality including spot/derivative markets, orders, and positions.
explorer.ts​
Blockchain explorer functionality including transaction and block queries.
gov.ts​
Handles protocol governance including proposals and voting.
ibc.ts​
Inter-Blockchain Communication functionality.
insurance.ts​
Manages insurance funds and redemptions.
mint.ts​
Controls token minting and inflation parameters.
mito.ts​
Handles Mito-specific functionality.
peggy.ts​
Manages Ethereum bridge operations.
permissions.ts​
Controls role-based access and permissions.
staking.ts​
Manages validator operations and delegations.
token-factory.ts​
Handles token creation and management.
wasm.ts​
Smart contract functionality including deployment and execution.
Development​
Adding New Actions​
- Add action to appropriate module file:
export const NewAction = createGenericAction({
name: 'ACTION_NAME',
description: 'Action description',
template: Templates.template,
examples: Examples.example,
functionName: 'functionName',
validateContent: () => true,
});
export const ModuleActions = [...existingActions, NewAction];
Adding New Modules​
- Create new module file:
// src/new-module.ts
export const NewModuleActions = [...];
- Add to main exports:
// src/index.ts
export * from './new-module';
Installation​
npm install @elizaos/plugin-injective
Usage​
import { InjectiveActions } from '@elizaos/plugin-injective';
Contributing​
Feel free to contribute to more similes, examples and refined templates - for a more robust action contorl.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License​
ISC