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: Add Flow Blockchain plugin #874

Merged
merged 20 commits into from
Dec 7, 2024
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
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ WHATSAPP_BUSINESS_ACCOUNT_ID= # Business Account ID from Facebook Business Mana
WHATSAPP_WEBHOOK_VERIFY_TOKEN= # Custom string for webhook verification
WHATSAPP_API_VERSION=v17.0 # WhatsApp API version (default: v17.0)

# Flow Blockchain Configuration
FLOW_ADDRESS=
FLOW_PRIVATE_KEY= # Private key for SHA3-256 + P256 ECDSA
FLOW_NETWORK= # Default: mainnet
FLOW_ENDPOINT_URL= # Default: https://mainnet.onflow.org

# ICP
INTERNET_COMPUTER_PRIVATE_KEY=
INTERNET_COMPUTER_ADDRESS=
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"typescript.format.enable": false,
"files.trimTrailingWhitespace": true,
"editor.trimAutoWhitespace": true,
"cadence.test.maxConcurrency": 5,
"cadence.customConfigPath": "packages/plugin-flow/flow.json",
"[properties]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
Expand Down Expand Up @@ -42,4 +44,4 @@
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
}
}
}
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@ai16z/plugin-coinbase": "workspace:*",
"@ai16z/plugin-conflux": "workspace:*",
"@ai16z/plugin-evm": "workspace:*",
"@ai16z/plugin-flow": "workspace:*",
"@ai16z/plugin-goat": "workspace:*",
"@ai16z/plugin-icp": "workspace:*",
"@ai16z/plugin-image-generation": "workspace:*",
Expand Down
5 changes: 5 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { evmPlugin } from "@ai16z/plugin-evm";
import { createNodePlugin } from "@ai16z/plugin-node";
import { solanaPlugin } from "@ai16z/plugin-solana";
import { aptosPlugin, TransferAptosToken } from "@ai16z/plugin-aptos";
import { flowPlugin } from "@ai16z/plugin-flow";
import { teePlugin } from "@ai16z/plugin-tee";
import Database from "better-sqlite3";
import fs from "fs";
Expand Down Expand Up @@ -408,6 +409,10 @@ export function createAgent(
: null,
getSecret(character, "WALLET_SECRET_SALT") ? teePlugin : null,
getSecret(character, "ALCHEMY_API_KEY") ? goatPlugin : null,
getSecret(character, "FLOW_ADDRESS") &&
getSecret(character, "FLOW_PRIVATE_KEY")
? flowPlugin
: null,
getSecret(character, "APTOS_PRIVATE_KEY") ? aptosPlugin : null,
].filter(Boolean),
providers: [],
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-flow/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
imports
7 changes: 7 additions & 0 deletions packages/plugin-flow/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*

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

This plugin provides basic actions and providers for interacting with the [Flow Blockchain](https://developers.flow.com/).

## Actions

### Transfer

name: `SEND_COIN`

Transfer native FLOW token/arbitrary FTs/ERC20s on Flow from agent's wallet to another EVM address or Flow address.

Message sample: `Send 5 FLOW to 0xa51d7fe9e0080662`
3 changes: 3 additions & 0 deletions packages/plugin-flow/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];
Loading
Loading