Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: injective plugin #1764

Merged
merged 69 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
d765994
"plugin: init injective integration and skeleton"
enigmarikki Jan 2, 2025
e97e8a5
"wip : skeleton partially done"
enigmarikki Jan 3, 2025
18e45d9
"wip: finished fetch"
enigmarikki Jan 3, 2025
c843f1a
"chore : fix format"
enigmarikki Jan 3, 2025
2b7be64
"chore : renamed files"
enigmarikki Jan 3, 2025
aceb000
"wip: completed grpc endpoints for onchain queries"
enigmarikki Jan 3, 2025
b681954
"chore : removed unwanted files"
enigmarikki Jan 3, 2025
e7350c3
"wip : adding templates + integrating onchain functions"
enigmarikki Jan 3, 2025
5c188f7
"wip : added inital version of templates"
enigmarikki Jan 3, 2025
f010cc4
"wip : testing the plugin"
enigmarikki Jan 3, 2025
75d0245
"wip : skeleton for actions, providers"
enigmarikki Jan 3, 2025
91dd9f7
"chore: renamed and fixed relative imports"
enigmarikki Jan 3, 2025
4176832
"wip : added message broadcasting rpcs"
enigmarikki Jan 6, 2025
e75da23
"feat : finished initial version of message parsing and querying"
enigmarikki Jan 6, 2025
901897b
"chore : refactor package.json"
enigmarikki Jan 6, 2025
8fc1b83
"chore: added chain message broadcasters to the InjectiveGrpcBase"
enigmarikki Jan 6, 2025
84e0fc0
"wip : restructure actions and providers"
enigmarikki Jan 7, 2025
ffc49af
"chore : fix conflicts on lockfile"
enigmarikki Jan 7, 2025
cb70101
"chore: added readme.md to use injective-sdk-client-ts"
enigmarikki Jan 7, 2025
25dc90a
"chore : renamed the package to ensure consistency and updated the docs"
enigmarikki Jan 7, 2025
3ceb205
"chore : refactored function args to make it easy to define function …
enigmarikki Jan 7, 2025
21f7371
"fix : missing imports for wasm"
enigmarikki Jan 7, 2025
7902da2
"wip : refactor injective types and templates"
enigmarikki Jan 7, 2025
18cda84
"chore : refactored the types into different files for maintainability"
enigmarikki Jan 8, 2025
67b9b6e
"chore : fmt"
enigmarikki Jan 8, 2025
81130e2
"wip : refactor the responses for standard message parsing"
enigmarikki Jan 8, 2025
c4a7472
Merge pull request #1 from enigmarikki/chore/refactor-templates
enigmarikki Jan 8, 2025
e3155bd
"chore : refactored all modules to ouput same a common message type"
enigmarikki Jan 8, 2025
d332a07
"wip : minimal tests"
enigmarikki Jan 9, 2025
f81b640
"fix: the grpc init + bug in making request"
enigmarikki Jan 9, 2025
30b9957
"wip : done with skeleton templates"
enigmarikki Jan 9, 2025
9d6a8d8
"chore : reorgranize files"
enigmarikki Jan 9, 2025
bc0b4c7
"wip : adding exchange templates"
enigmarikki Jan 9, 2025
91dc9fd
"chore : added fmt and finished comprehensive template for exchange m…
enigmarikki Jan 9, 2025
b5c5567
"wip: refactored templates for auction and bank"
enigmarikki Jan 9, 2025
8b133b7
"wip : almost done refactoring all the templates to add both the requ…
enigmarikki Jan 10, 2025
6bc3a79
"chore : renamed to gov for consistency and added the explorer module"
enigmarikki Jan 10, 2025
317b3d3
"fix : removed minor import into exchange"
enigmarikki Jan 10, 2025
bee1a3d
"wip : added the base action"
enigmarikki Jan 10, 2025
d9a4b4e
"feat: finished integrating actions, wip fix for templates and examples"
enigmarikki Jan 12, 2025
4104116
"chore : refactored all the request and response templates"
enigmarikki Jan 12, 2025
9dd5e33
"chore : fmt templates"
enigmarikki Jan 12, 2025
f89e4a5
"chore : added modules examples except exchange, fixed a few relative…
enigmarikki Jan 12, 2025
cd2099c
"chore: finished integrating exchange examples"
enigmarikki Jan 12, 2025
cacc72d
"feat: finished all integrations for injective-plugin"
enigmarikki Jan 12, 2025
c619885
chore : resolved pnpm-lock.yaml conflicts
Jan 12, 2025
69c1d80
Merge branch 'develop' into feat/injective-plugin
odilitime Jan 12, 2025
9cc04e8
"fix : revert fmt"
enigmarikki Jan 12, 2025
8002c18
"chore : bump injective-ts sdk version"
enigmarikki Jan 13, 2025
18bb01b
Merge remote-tracking branch 'origin2/develop' into feat/injective-pl…
enigmarikki Jan 13, 2025
25e468a
"fix : dependency issues"
enigmarikki Jan 13, 2025
1600aac
"fix : complex dependency issue from esm imports"
enigmarikki Jan 13, 2025
7d8823d
Merge branch 'elizaOS:develop' into feat/injective-plugin
enigmarikki Jan 13, 2025
e03b93d
Merge branch 'elizaOS:develop' into feat/injective-plugin
enigmarikki Jan 13, 2025
3062891
"chore : refactored the rpc to take either inj address or eth address"
enigmarikki Jan 13, 2025
99b29a0
"wip: fixed rpc initialization"
enigmarikki Jan 14, 2025
8ab9150
"fix: Refactored action template"
Jan 14, 2025
1eff661
Merge branch 'elizaOS:develop' into feat/injective-plugin
enigmarikki Jan 14, 2025
33c6769
"chore : resolve lock file conflicts"
enigmarikki Jan 14, 2025
7b46fcf
"chore : added config params in .env.examples"
enigmarikki Jan 14, 2025
ce93a0b
Merge branch 'develop' into feat/injective-plugin
enigmarikki Jan 14, 2025
c46db8f
Merge branch 'elizaOS:develop' into feat/injective-plugin
enigmarikki Jan 14, 2025
7fb3900
Merge branch 'elizaOS:develop' into feat/injective-plugin
enigmarikki Jan 14, 2025
7fb5786
"wip : improve response prompts from agent"
enigmarikki Jan 14, 2025
f5d9ec4
"chore : refactored similes, for better interpretation"
enigmarikki Jan 15, 2025
3902c46
"wip: integrated mito's constant product market maker - amm"
enigmarikki Jan 15, 2025
e7c2292
"feat: added Initial Dex offering and action, for agents to autonomou…
enigmarikki Jan 16, 2025
ad44bd1
"chore : revert defaultCharacter to LLAMA"
enigmarikki Jan 16, 2025
d3fdf3d
Merge remote-tracking branch 'origin2/develop' into feat/injective-pl…
enigmarikki Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ SOLANA_ADMIN_PRIVATE_KEY= # This wallet is used to verify NFTs
SOLANA_ADMIN_PUBLIC_KEY= # This wallet is used to verify NFTs
SOLANA_VERIFY_TOKEN= # Authentication token for calling the verification API

# Injective
INJECTIVE_PRIVATE_KEY= #
INJECTIVE_PUBLIC_KEY= #
INJECTIVE_NETWORK= #
# Fallback Wallet Configuration (deprecated)
WALLET_PRIVATE_KEY=
WALLET_PUBLIC_KEY=
Expand Down
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@elizaos/plugin-nft-generation": "workspace:*",
"@elizaos/plugin-node": "workspace:*",
"@elizaos/plugin-solana": "workspace:*",
"@elizaos/plugin-injective": "workspace:*",
"@elizaos/plugin-solana-agentkit": "workspace:*",
"@elizaos/plugin-squid-router": "workspace:*",
"@elizaos/plugin-autonome": "workspace:*",
Expand Down
13 changes: 9 additions & 4 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,9 @@ import { evmPlugin } from "@elizaos/plugin-evm";
import { flowPlugin } from "@elizaos/plugin-flow";
import { fuelPlugin } from "@elizaos/plugin-fuel";
import { genLayerPlugin } from "@elizaos/plugin-genlayer";
import { giphyPlugin } from "@elizaos/plugin-giphy";
import { gitcoinPassportPlugin } from "@elizaos/plugin-gitcoin-passport";
import { hyperliquidPlugin } from "@elizaos/plugin-hyperliquid";
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
import { lensPlugin } from "@elizaos/plugin-lensNetwork";
import { letzAIPlugin } from "@elizaos/plugin-letzai";
import { multiversxPlugin } from "@elizaos/plugin-multiversx";
import { nearPlugin } from "@elizaos/plugin-near";
import createNFTCollectionsPlugin from "@elizaos/plugin-nft-collections";
Expand All @@ -94,10 +91,14 @@ import { TEEMode, teePlugin } from "@elizaos/plugin-tee";
import { teeLogPlugin } from "@elizaos/plugin-tee-log";
import { teeMarlinPlugin } from "@elizaos/plugin-tee-marlin";
import { verifiableLogPlugin } from "@elizaos/plugin-tee-verifiable-log";
import { thirdwebPlugin } from "@elizaos/plugin-thirdweb";
import { tonPlugin } from "@elizaos/plugin-ton";
import { squidRouterPlugin } from "@elizaos/plugin-squid-router";
import { webSearchPlugin } from "@elizaos/plugin-web-search";
import { injectivePlugin } from "@elizaos/plugin-injective";
import { giphyPlugin } from "@elizaos/plugin-giphy";
import { letzAIPlugin } from "@elizaos/plugin-letzai";
import { thirdwebPlugin } from "@elizaos/plugin-thirdweb";
import { hyperliquidPlugin } from "@elizaos/plugin-hyperliquid";
import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
import Database from "better-sqlite3";
import fs from "fs";
Expand Down Expand Up @@ -762,6 +763,10 @@ export async function createAgent(
getSecret(character, "WALLET_PUBLIC_KEY")?.startsWith("0x"))
? evmPlugin
: null,
((getSecret(character, "EVM_PUBLIC_KEY") || getSecret(character, "INJECTIVE_PUBLIC_KEY")) &&
getSecret(character, "INJECTIVE_PRIVATE_KEY"))
? injectivePlugin
: null,
getSecret(character, "COSMOS_RECOVERY_PHRASE") &&
getSecret(character, "COSMOS_AVAILABLE_CHAINS") &&
createCosmosPlugin(),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@0glabs/0g-ts-sdk": "0.2.1",
"@coinbase/coinbase-sdk": "0.10.0",
"@deepgram/sdk": "^3.9.0",
"@injectivelabs/sdk-ts": "^1.14.33",
"@vitest/eslint-plugin": "1.0.1",
"amqplib": "0.10.5",
"csv-parse": "5.6.0",
Expand Down
176 changes: 176 additions & 0 deletions packages/plugin-injective/Readme.md
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
3 changes: 3 additions & 0 deletions packages/plugin-injective/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import eslintGlobalConfig from "../../eslint.config.mjs";

export default [...eslintGlobalConfig];
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
build/
23 changes: 23 additions & 0 deletions packages/plugin-injective/injective-sdk-client-ts/.eslintrc.js
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"
}
}
Loading
Loading