forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: injective plugin (elizaOS#1764)
* "plugin: init injective integration and skeleton" * "wip : skeleton partially done" * "wip: finished fetch" * "chore : fix format" * "chore : renamed files" * "wip: completed grpc endpoints for onchain queries" * "chore : removed unwanted files" * "wip : adding templates + integrating onchain functions" * "wip : added inital version of templates" * "wip : testing the plugin" * "wip : skeleton for actions, providers" * "chore: renamed and fixed relative imports" * "wip : added message broadcasting rpcs" * "feat : finished initial version of message parsing and querying" * "chore : refactor package.json" * "chore: added chain message broadcasters to the InjectiveGrpcBase" * "wip : restructure actions and providers" * "chore : fix conflicts on lockfile" * "chore: added readme.md to use injective-sdk-client-ts" * "chore : renamed the package to ensure consistency and updated the docs" * "chore : refactored function args to make it easy to define function schema" * "fix : missing imports for wasm" * "wip : refactor injective types and templates" * "chore : refactored the types into different files for maintainability" * "chore : fmt" * "wip : refactor the responses for standard message parsing" * "chore : refactored all modules to ouput same a common message type" * "wip : minimal tests" * "fix: the grpc init + bug in making request" * "wip : done with skeleton templates" * "chore : reorgranize files" * "wip : adding exchange templates" * "chore : added fmt and finished comprehensive template for exchange module" * "wip: refactored templates for auction and bank" * "wip : almost done refactoring all the templates to add both the request, response" * "chore : renamed to gov for consistency and added the explorer module" * "fix : removed minor import into exchange" * "wip : added the base action" * "feat: finished integrating actions, wip fix for templates and examples" * "chore : refactored all the request and response templates" * "chore : fmt templates" * "chore : added modules examples except exchange, fixed a few relative imports" * "chore: finished integrating exchange examples" * "feat: finished all integrations for injective-plugin" * "fix : revert fmt" * "chore : bump injective-ts sdk version" * "fix : dependency issues" * "fix : complex dependency issue from esm imports" * "chore : refactored the rpc to take either inj address or eth address" * "wip: fixed rpc initialization" * "fix: Refactored action template" * "chore : resolve lock file conflicts" * "chore : added config params in .env.examples" * "wip : improve response prompts from agent" * "chore : refactored similes, for better interpretation" * "wip: integrated mito's constant product market maker - amm" * "feat: added Initial Dex offering and action, for agents to autonomously raise funds" * "chore : revert defaultCharacter to LLAMA" --------- Co-authored-by: rikki <[email protected]> Co-authored-by: Odilitime <[email protected]>
- Loading branch information
1 parent
8ab8be5
commit f70c1cd
Showing
128 changed files
with
33,252 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
# @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 | ||
```typescript | ||
// 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 | ||
```typescript | ||
// 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 | ||
|
||
1. Add action to appropriate module file: | ||
```typescript | ||
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 | ||
|
||
1. Create new module file: | ||
```typescript | ||
// src/new-module.ts | ||
export const NewModuleActions = [...]; | ||
``` | ||
|
||
2. Add to main exports: | ||
```typescript | ||
// src/index.ts | ||
export * from './new-module'; | ||
``` | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install @elizaos/plugin-injective | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import { InjectiveActions } from '@elizaos/plugin-injective'; | ||
``` | ||
|
||
## Contributing | ||
Feel free to contribute to more similes, examples and refined templates - for a more robust action contorl. | ||
|
||
1. Fork the repository | ||
2. Create your feature branch | ||
3. Commit your changes | ||
4. Push to the branch | ||
5. Create a Pull Request | ||
|
||
## License | ||
|
||
ISC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import eslintGlobalConfig from "../../eslint.config.mjs"; | ||
|
||
export default [...eslintGlobalConfig]; |
3 changes: 3 additions & 0 deletions
3
packages/plugin-injective/injective-sdk-client-ts/.eslintignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
dist/ | ||
build/ |
23 changes: 23 additions & 0 deletions
23
packages/plugin-injective/injective-sdk-client-ts/.eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = { | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"rules": { | ||
// TypeScript-specific rules | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], | ||
|
||
// General ESLint rules | ||
"no-console": "warn", | ||
"eqeqeq": "error", | ||
"no-duplicate-imports": "error", | ||
"prefer-const": "warn" | ||
} | ||
} |
Oops, something went wrong.