Skip to content

Commit

Permalink
feat(new-plugin): Eliza OmniFlix Plugin (elizaOS#2693)
Browse files Browse the repository at this point in the history
* added OmniFlix-Plugin

* added characters in gitignore

* added variable of OmniFlix in env example

* Update .env.example

---------

Co-authored-by: vinay-maggidi <[email protected]>
  • Loading branch information
BlockEater96 and vinay-maggidi authored Jan 23, 2025
1 parent ec07774 commit 0497c71
Show file tree
Hide file tree
Showing 38 changed files with 3,688 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,13 @@ EMAIL_INCOMING_PORT=993 # Default port for secure IMAP
EMAIL_INCOMING_USER=
EMAIL_INCOMING_PASS=


# Omniflix
OMNIFLIX_API_URL= # https://rest.omniflix.network
OMNIFLIX_MNEMONIC= # your mnemonic 12 words or 24 words
OMNIFLIX_RPC_ENDPOINT= # https://rpc.omniflix.network
OMNIFLIX_PRIVATE_KEY= # your private key

# Suno AI Music Generation
SUNO_API_KEY=

Expand Down
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"@elizaos/plugin-chainbase": "workspace:*",
"@elizaos/plugin-dkg": "workspace:*",
"@elizaos/plugin-email": "workspace:*",
"@elizaos/plugin-omniflix": "workspace:*",
"@elizaos/plugin-suno": "workspace:*",
"@elizaos/plugin-udio": "workspace:*",
"readline": "1.3.0",
Expand Down
5 changes: 5 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { SlackClientInterface } from "@elizaos/client-slack";
import { TelegramClientInterface } from "@elizaos/client-telegram";
import { TwitterClientInterface } from "@elizaos/client-twitter";
import { FarcasterClientInterface } from "@elizaos/client-farcaster";
import { OmniflixPlugin } from "@elizaos/plugin-omniflix";
import { JeeterClientInterface } from "@elizaos/client-simsai";

import { DirectClient } from "@elizaos/client-direct";
Expand Down Expand Up @@ -1033,6 +1034,10 @@ export async function createAgent(
getSecret(character, "SGX"))
? teeLogPlugin
: null,
getSecret(character, "OMNIFLIX_API_URL") &&
getSecret(character, "OMNIFLIX_MNEMONIC")
? OmniflixPlugin
: null,
getSecret(character, "COINBASE_API_KEY") &&
getSecret(character, "COINBASE_PRIVATE_KEY") &&
getSecret(character, "COINBASE_NOTIFICATION_URI")
Expand Down
49 changes: 49 additions & 0 deletions characters/omniflix.character.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "Omniflix",
"clients": ["telegram"],
"modelProvider": "akash_chat_api",
"settings": {
"secrets": {},
"voice": {
"model": "en_US-male-medium"
}
},
"plugins": ["@elizaos/plugin-omniflix"],
"bio": [
"I am an Omniflix assistant designed to interact directly with your connected wallet for blockchain operations.",
"I perform actions such as sending tokens, voting on proposals, and managing staking directly using your wallet once connected.",
"I request only the necessary details to execute actions and do not require the wallet address separately."
],
"lore": [],
"knowledge": [
"I can execute token transfers, staking, unstaking, and governance actions directly with the connected wallet.",
"I ensure all actions are verified and secure before execution.",
"I support creating new denominations (denoms) directly through your wallet."
],
"messageExamples": [],
"postExamples": [],
"topics": [
"Direct wallet operations",
"Token management",
"Secure transaction execution"
],
"style": {
"all": [
"Direct",
"Precise",
"Factual",
"Data-driven"
],
"chat": [
"Clear",
"Verification-focused",
"Data-driven"
],
"post": []
},
"adjectives": [
"Accurate",
"Methodical",
"Wallet-integrated"
]
}
6 changes: 6 additions & 0 deletions packages/plugin-omniflix/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*

!dist/**
!package.json
!readme.md
!tsup.config.ts
223 changes: 223 additions & 0 deletions packages/plugin-omniflix/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
# @elizaos/plugin-omniflix

A plugin for ElizaOS that enables interaction with the OmniFlix Network blockchain.

## Table of Contents

- [Installation](#installation)
- [Configuration](#configuration)
- [Features](#features)
- [Integration](#integration)
- [Technical Details](#technical-details)

## Installation

```bash
npm install @elizaos/plugin-omniflix
```

## Configuration

### Environment Variables

```env
# Required: RPC endpoint for OmniFlix Network
OMNIFLIX_RPC_ENDPOINT="https://rpc.omniflix.network:443"

# Required: API endpoint for OmniFlix Network
OMNIFLIX_API_URL="https://rest.omniflix.network"

# Required: Either mnemonic or private key (one is required)
OMNIFLIX_MNEMONIC="your mnemonic"
# OR
OMNIFLIX_PRIVATE_KEY="your hex private key"
```

### Network Configuration

You can configure different networks by updating the endpoints:

#### Mainnet (Default)

```env
OMNIFLIX_RPC_ENDPOINT="https://rpc.omniflix.network"
OMNIFLIX_API_URL="https://rest.omniflix.network"
```

#### Testnet

```env
OMNIFLIX_RPC_ENDPOINT="https://rpc.testnet.omniflix.network"
OMNIFLIX_API_URL="https://api.testnet.omniflix.network"
```

Note: Make sure to use the appropriate network endpoints based on your requirements. The mainnet endpoints should be used for production environments, while testnet are suitable for testing.

## Features

### 1. Bank Operations

#### Check Balance

```
Commands:
- What is my balance?
- How many FLIX do I have?
- Check my wallet balance
```

#### Send Tokens

```
Commands:
- Send 100 FLIX to omniflix1abc123...
- Transfer 50 FLIX to omniflix1xyz789...
```

#### Check Staked Balance

```
Commands:
- What is my staked balance?
- Show my delegated FLIX
- Check my staking balance
```

### 2. Staking Operations

#### Delegate Tokens

```
Commands:
- Delegate 100 FLIX to omniflixvaloper1abc123...
- Stake 50 FLIX with validator omniflixvaloper1xyz789...
```

#### Undelegate Tokens

```
Commands:
- Undelegate 100 FLIX from omniflixvaloper1abc123...
- Unstake 50 FLIX from validator omniflixvaloper1xyz789...
```

#### Redelegate Tokens

```
Commands:
- Redelegate 100 FLIX from omniflixvaloper1abc123... to omniflixvaloper1def456...
- Move 50 FLIX stake from validator1 to validator2
```

#### Cancel Unbonding

```
Commands:
- Cancel unbonding of 100 FLIX from omniflixvaloper1abc123... at creation height 123456
- Stop unbonding 50 FLIX from validator omniflixvaloper1xyz789... at creation height 789012
- Cancel unbonding delegation with:
- Amount: 100 FLIX
- Validator: omniflixvaloper1abc123...
- Creation Height: 123456
```

Note: Creation height is required for canceling unbonding operations. You can find the creation height:

- In the unbonding delegation response
- Through the chain explorer
- From the original unbonding transaction

### 3. Governance Operations

#### Vote on Proposals

```
Commands:
- Vote yes on proposal 1
- Vote no on proposal 2
- Vote abstain on proposal 3
- Vote no_with_veto on proposal 4


Valid Options:
- yes
- no
- abstain
- no_with_veto

Note: proposal Id and vote option is required for voting on proposals or it will take unspecified vote option. You can find the proposal ID:

- In the proposal response
- Through the chain explorer
- From the original proposal transaction
```

## Integration

### Basic Setup

1. Import the plugin:

```typescript
import { OmniflixPlugin } from "@elizaos/plugin-omniflix";
```

2. Register with ElizaOS:

```typescript
import { Eliza } from "@elizaos/core";

const eliza = new Eliza();
eliza.registerPlugin(OmniflixPlugin);
```

### Example Usage

```typescript
import { voteOnProposal } from "@elizaos/plugin-omniflix";

// Vote on a proposal
const voteOnProposal = await voteOnProposal(
{
proposalId: "1",
vote: "YES",
},
{
apiEndpoint: "https://rest.omniflix.network",
rpcEndpoint: "https://rpc.omniflix.network:443",
}
);
```

## Technical Details

### Token Denominations

- Display denomination: FLIX
- Base denomination: uflix (auto-converted by plugin)

### Address Formats

- Wallet addresses: Start with `omniflix`
- Validator addresses: Start with `omniflixvaloper`

### Staking Parameters

- Unbonding period: 28 days
- Redelegation: Has cooldown period
- Delegation: Minimum amount may apply
- Unbonding cancellation requires:
- Validator address
- Amount
- Creation height (block height when unbonding started)
- Must be within unbonding period

### Governance Rules

- Voting eligibility: Proposals must be in voting period
- Voting frequency: One vote per address per proposal
- Voting power: Proportional to staked amount

## License

This plugin is part of the ElizaOS project. See LICENSE file for details.
3 changes: 3 additions & 0 deletions packages/plugin-omniflix/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];
32 changes: 32 additions & 0 deletions packages/plugin-omniflix/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@elizaos/plugin-omniflix",
"version": "0.1.7-alpha.2",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"dependencies": {
"@coral-xyz/anchor": "0.30.1",
"@cosmjs/proto-signing": "^0.32.4",
"@cosmjs/stargate": "^0.32.4",
"@cosmjs/encoding": "^0.32.4",
"@elizaos/core": "workspace:*",
"@elizaos/plugin-tee": "workspace:*",
"@elizaos/plugin-trustdb": "workspace:*",
"bs58": "6.0.0",
"bech32": "2.0.0",
"cosmjs-types": "^0.8.0",
"node-cache": "5.1.2",
"tsup": "8.3.5",
"vitest": "2.1.4"
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint --fix --cache .",
"test": "vitest run"
},
"peerDependencies": {
"form-data": "4.0.1",
"whatwg-url": "7.1.0"
}
}
Loading

0 comments on commit 0497c71

Please sign in to comment.