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

chore(update-plugin-initialization): btcfun & trikon plugin #2643

Merged
merged 9 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -908,3 +908,15 @@ QUICKINTEL_API_KEY= # Your QuickIntel API key for token security an

# News API Key
NEWS_API_KEY= # News API KEY from https://newsapi.org/

# BTCFUN Plugin Configuration
BTCFUN_API_URL= # Default: https://api-testnet-new.btc.fun
BTC_PRIVATE_KEY_WIF= # Your BTC private key in WIF format
BTC_ADDRESS= # Your BTC address
BTC_MINT_CAP=10000 # Maximum amount that can be minted
BTC_MINT_DEADLINE=864000 # Deadline for minting in seconds
BTC_FUNDRAISING_CAP=100 # Maximum amount for fundraising

# Trikon Plugin Configuration
TRIKON_WALLET_ADDRESS= # Your Trikon wallet address (must be a valid 64-character hex string starting with '0x')
TRIKON_INITIAL_BALANCE= # (Optional) The initial balance for the wallet. Defaults to "0" if not provided.
2 changes: 2 additions & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@
"@elizaos/plugin-form": "workspace:*",
"@elizaos/plugin-ankr": "workspace:*",
"@elizaos/client-xmtp": "workspace:*",
"@elizaos/plugin-btcfun": "workspace:*",
"@elizaos/plugin-trikon": "workspace:*",
"readline": "1.3.0",
"ws": "8.18.0",
"yargs": "17.7.2"
Expand Down
5 changes: 4 additions & 1 deletion agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ import { ankrPlugin } from "@elizaos/plugin-ankr";
import { formPlugin } from "@elizaos/plugin-form";
import { MongoClient } from "mongodb";
import { quickIntelPlugin } from "@elizaos/plugin-quick-intel"

import { btcfunPlugin } from "@elizaos/plugin-btcfun"
import { trikonPlugin } from "@elizaos/plugin-trikon"
const __filename = fileURLToPath(import.meta.url) // get the resolved path to the file
const __dirname = path.dirname(__filename) // get the name of the directory

Expand Down Expand Up @@ -911,6 +912,8 @@ export async function createAgent(character: Character, db: IDatabaseAdapter, ca
getSecret(character, "DCAP_EVM_PRIVATE_KEY") && getSecret(character, "DCAP_MODE") ? dcapPlugin : null,
getSecret(character, "QUICKINTEL_API_KEY") ? quickIntelPlugin : null,
getSecret(character, "GELATO_RELAY_API_KEY") ? gelatoPlugin : null,
getSecret(character, "BTC_PRIVATE_KEY_WIF") && getSecret(character, "BTC_FUN_API_URL") ? btcfunPlugin : null,
getSecret(character, "TRIKON_WALLET_ADDRESS") ? trikonPlugin : null,
].flat().filter(Boolean),
providers: [],
managers: [],
Expand Down
168 changes: 82 additions & 86 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,87 +1,83 @@
{
"name": "eliza",
"scripts": {
"format": "biome format --write .",
"lint": "biome lint .",
"check": "biome check --apply .",
"preinstall": "npx only-allow pnpm",
"build": "turbo run build --filter=!eliza-docs",
"build-docker": "turbo run build",
"cleanstart": "if [ -f agent/data/db.sqlite ]; then rm agent/data/db.sqlite; fi && pnpm --filter \"@elizaos/agent\" start --isRoot",
"cleanstart:debug": "if [ -f agent/data/db.sqlite ]; then rm agent/data/db.sqlite; fi && cross-env NODE_ENV=development VERBOSE=true DEFAULT_LOG_LEVEL=debug DEBUG=eliza:* pnpm --filter \"@elizaos/agent\" start --isRoot",
"start": "pnpm --filter \"@elizaos/agent\" start --isRoot",
"start:client": "pnpm --dir client dev",
"start:debug": "cross-env NODE_ENV=development VERBOSE=true DEFAULT_LOG_LEVEL=debug DEBUG=eliza:* pnpm --filter \"@elizaos/agent\" start --isRoot",
"dev": "bash ./scripts/dev.sh",
"release": "pnpm build && pnpm format && npx lerna publish --no-private --force-publish",
"clean": "bash ./scripts/clean.sh",
"docker:build": "bash ./scripts/docker.sh build",
"docker:run": "bash ./scripts/docker.sh run",
"docker:bash": "bash ./scripts/docker.sh bash",
"docker:start": "bash ./scripts/docker.sh start",
"docker": "pnpm docker:build && pnpm docker:run && pnpm docker:bash",
"test": "bash ./scripts/test.sh",
"smokeTests": "bash ./scripts/smokeTests.sh",
"integrationTests": "bash ./scripts/integrationTests.sh"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@commitlint/cli": "18.6.1",
"@commitlint/config-conventional": "18.6.3",
"@types/jest": "^29.5.11",
"concurrently": "9.1.0",
"cross-env": "7.0.3",
"husky": "9.1.7",
"jest": "^29.7.0",
"lerna": "8.1.5",
"only-allow": "1.2.1",
"turbo": "2.3.3",
"typedoc": "0.26.11",
"typescript": "5.6.3",
"viem": "2.21.58",
"vite": "5.4.12",
"vitest": "2.1.5"
},
"pnpm": {
"overrides": {
"onnxruntime-node": "1.20.1",
"@solana/[email protected]": "npm:@solana/[email protected]",
"@solana/[email protected]": "npm:@solana/[email protected]",
"@solana/web3.js@2": "npm:@solana/[email protected]",
"viem": "2.21.58",
"@polkadot/util": "12.6.2",
"@polkadot/util-crypto": "12.6.2",
"@polkadot/types-create": "10.13.1",
"@polkadot/types-codec": "10.13.1",
"@ai-sdk/provider": "1.0.6",
"@ai-sdk/provider-utils": "2.1.2"
}
},
"engines": {
"node": "23.3.0"
},
"dependencies": {
"@0glabs/0g-ts-sdk": "0.2.1",
"@coinbase/coinbase-sdk": "0.10.0",
"@deepgram/sdk": "^3.9.0",
"@okxweb3/coin-bitcoin": "1.2.0",
"@okxweb3/crypto-lib": "1.0.10",
"@injectivelabs/sdk-ts": "^1.14.33",
"@vitest/eslint-plugin": "1.0.1",
"amqplib": "0.10.5",
"csv-parse": "5.6.0",
"langdetect": "^0.2.1",
"ollama-ai-provider": "0.16.1",
"optional": "0.1.4",
"pnpm": "9.14.4",
"sharp": "0.33.5",
"tslog": "4.9.3",
"bs58": "4.0.0",
"tiny-secp256k1": "2.2.3",
"tslog": "4.9.3"
},
"packageManager": "[email protected]+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee",
"workspaces": [
"packages/*"
]
}
"name": "eliza",
"scripts": {
"format": "biome format --write .",
"lint": "biome lint .",
"check": "biome check --apply .",
"preinstall": "npx only-allow pnpm",
"build": "turbo run build --filter=!eliza-docs",
"build-docker": "turbo run build",
"cleanstart": "if [ -f agent/data/db.sqlite ]; then rm agent/data/db.sqlite; fi && pnpm --filter \"@elizaos/agent\" start --isRoot",
"cleanstart:debug": "if [ -f agent/data/db.sqlite ]; then rm agent/data/db.sqlite; fi && cross-env NODE_ENV=development VERBOSE=true DEFAULT_LOG_LEVEL=debug DEBUG=eliza:* pnpm --filter \"@elizaos/agent\" start --isRoot",
"start": "pnpm --filter \"@elizaos/agent\" start --isRoot",
"start:client": "pnpm --dir client dev",
"start:debug": "cross-env NODE_ENV=development VERBOSE=true DEFAULT_LOG_LEVEL=debug DEBUG=eliza:* pnpm --filter \"@elizaos/agent\" start --isRoot",
"dev": "bash ./scripts/dev.sh",
"release": "pnpm build && pnpm format && npx lerna publish --no-private --force-publish",
"clean": "bash ./scripts/clean.sh",
"docker:build": "bash ./scripts/docker.sh build",
"docker:run": "bash ./scripts/docker.sh run",
"docker:bash": "bash ./scripts/docker.sh bash",
"docker:start": "bash ./scripts/docker.sh start",
"docker": "pnpm docker:build && pnpm docker:run && pnpm docker:bash",
"test": "bash ./scripts/test.sh",
"smokeTests": "bash ./scripts/smokeTests.sh",
"integrationTests": "bash ./scripts/integrationTests.sh"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@commitlint/cli": "18.6.1",
"@commitlint/config-conventional": "18.6.3",
"@types/jest": "^29.5.11",
"concurrently": "9.1.0",
"cross-env": "7.0.3",
"husky": "9.1.7",
"jest": "^29.7.0",
"lerna": "8.1.5",
"only-allow": "1.2.1",
"turbo": "2.3.3",
"typedoc": "0.26.11",
"typescript": "5.6.3",
"viem": "2.21.58",
"vite": "5.4.12",
"vitest": "2.1.5"
},
"pnpm": {
"overrides": {
"onnxruntime-node": "1.20.1",
"@solana/[email protected]": "npm:@solana/[email protected]",
"@solana/[email protected]": "npm:@solana/[email protected]",
"@solana/web3.js@2": "npm:@solana/[email protected]",
"viem": "2.21.58",
"@polkadot/util": "12.6.2",
"@polkadot/util-crypto": "12.6.2",
"@polkadot/types-create": "10.13.1",
"@polkadot/types-codec": "10.13.1",
"@ai-sdk/provider": "1.0.6",
"@ai-sdk/provider-utils": "2.1.2",
"cookie": "0.6.0"
}
},
"engines": {
"node": "23.3.0"
},
"dependencies": {
"@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",
"langdetect": "^0.2.1",
"ollama-ai-provider": "0.16.1",
"optional": "0.1.4",
"pnpm": "9.14.4",
"sharp": "0.33.5",
"bs58": "4.0.0"
},
"packageManager": "[email protected]+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee",
"workspaces": [
"packages/*"
]
}
52 changes: 49 additions & 3 deletions packages/plugin-btcfun/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
# `@elizaos/plugin-btcfun`

This plugin provides actions and providers to interact with btcfun via bitcoin network.
A powerful plugin for Eliza that enables interaction with BTCFun via the Bitcoin network. This plugin provides seamless integration for minting BRC20 and Runes tokens using BTCFun's API services.

---
## Features

### Provider Features

- **BTCFun Provider**
- Validates token operations for both BRC20 and Runes tokens
- Creates and manages minting orders
- Handles transaction broadcasting
- Manages PSBT (Partially Signed Bitcoin Transactions)

### Action Features

- **Token Minting**
- Supports minting of both BRC20 and Runes tokens
- Configurable mint parameters:
- Mint cap (maximum token supply)
- Address fundraising cap (per-address limit)
- Mint deadline (duration in seconds)
- Handles Bitcoin transaction signing and broadcasting
- Automatic PSBT creation and management

## Configuration

### Default Setup

By default, **Bitcoin mainnet** is enabled. To use it, simply add your private key to the `.env` file:
By default, **Bitcoin mainnet** is enabled. To use it, configure the following environment variables in your `.env` file:

```env
BTC_PRIVATE_KEY_WIF=your-private-key-here
Expand All @@ -17,3 +36,30 @@ BTCFUN_API_URL=https://api-testnet-new.btc.fun
MINTCAP=10000
MINTDEADLINE=864000
ADDRESS_FUNDRAISING_CAP=100
```

### Environment Variables

- `BTC_PRIVATE_KEY_WIF`: Your Bitcoin private key in WIF format
- `ADDRESS`: Your Bitcoin address
- `BTCFUN_API_URL`: BTCFun API endpoint URL
- `MINTCAP`: Default maximum token supply for minting
- `MINTDEADLINE`: Default duration for minting in seconds
- `ADDRESS_FUNDRAISING_CAP`: Default per-address fundraising limit

## API Reference

The plugin integrates with BTCFun's API services through the following endpoints:
- `/api/v1/import/brc20_validate` - BRC20 token validation
- `/api/v1/import/rune_validate` - Runes token validation
- `/api/v1/import/brc20_order` - BRC20 minting order creation
- `/api/v1/import/rune_order` - Runes minting order creation
- `/api/v1/import/broadcast` - Transaction broadcasting

## License

See parent project for license information.

## Contributing

Contributions are welcome! See parent project for contribution guidelines.
5 changes: 4 additions & 1 deletion packages/plugin-btcfun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"@lifi/sdk": "3.4.1",
"@lifi/types": "16.3.0",
"tsup": "8.3.5",
"viem": "2.21.53"
"viem": "2.21.53",
"@okxweb3/coin-bitcoin": "1.2.0",
"@okxweb3/crypto-lib": "1.0.10",
"tiny-secp256k1": "2.2.3"
},
"scripts": {
"build": "tsup --format esm --dts",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-btcfun/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export default defineConfig({
"agentkeepalive",
"viem",
"@lifi/sdk",
"@okxweb3/crypto-lib",
"tslog",
],
});
3 changes: 2 additions & 1 deletion packages/plugin-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
"wav-encoder": "1.3.0",
"wavefile": "11.0.0",
"yargs": "17.7.2",
"youtube-dl-exec": "3.0.10"
"youtube-dl-exec": "3.0.10",
"cookie": "0.6.0"
},
"devDependencies": {
"@types/node": "22.8.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-trikon/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ pnpm add @elizaos/plugin-trikon

The plugin requires the following environment variables:

- `TRIKON_API_KEY`: Your Trikon API key.
- `TRIKON_INITIAL_BALANCE`: The initial balance for the wallet.
- `TRIKON_WALLET_ADDRESS`: Your Trikon wallet address (must be a valid 64-character hex string starting with '0x')
- `TRIKON_INITIAL_BALANCE`: (Optional) The initial balance for the wallet. Defaults to "0" if not provided.

## Usage

Expand Down
Loading
Loading