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: fix review comments #4

Merged
merged 1 commit into from
Jan 20, 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
15 changes: 7 additions & 8 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ import path from "path";
import { fileURLToPath } from "url";
import yargs from "yargs";


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 @@ -247,14 +246,13 @@ async function loadCharacter(filePath: string): Promise<Character> {
}

function commaSeparatedStringToArray(commaSeparated: string): string[] {
return commaSeparated?.split(",").map(value => value.trim())
return commaSeparated?.split(",").map((value) => value.trim());
}


export async function loadCharacters(
charactersArg: string
): Promise<Character[]> {
let characterPaths = commaSeparatedStringToArray(charactersArg)
let characterPaths = commaSeparatedStringToArray(charactersArg);
const loadedCharacters: Character[] = [];

if (characterPaths?.length > 0) {
Expand Down Expand Up @@ -328,7 +326,9 @@ export async function loadCharacters(

if (hasValidRemoteUrls()) {
elizaLogger.info("Loading characters from remote URLs");
let characterUrls = commaSeparatedStringToArray(process.env.REMOTE_CHARACTER_URLS)
let characterUrls = commaSeparatedStringToArray(
process.env.REMOTE_CHARACTER_URLS
);
for (const characterUrl of characterUrls) {
const character = await loadCharacterFromUrl(characterUrl);
loadedCharacters.push(character);
Expand Down Expand Up @@ -942,8 +942,7 @@ export async function createAgent(
? createNFTCollectionsPlugin()
: null,
getSecret(character, "BNB_PRIVATE_KEY") ||
(getSecret(character, "BNB_PUBLIC_KEY") &&
getSecret(character, "BNB_PUBLIC_KEY")?.startsWith("0x"))
getSecret(character, "BNB_PUBLIC_KEY")?.startsWith("0x")
? bnbPlugin
: null,
].filter(Boolean),
Expand Down Expand Up @@ -1109,7 +1108,7 @@ const checkPortAvailable = (port: number): Promise<boolean> => {

const hasValidRemoteUrls = () =>
process.env.REMOTE_CHARACTER_URLS != "" &&
process.env.REMOTE_CHARACTER_URLS.startsWith("http")
process.env.REMOTE_CHARACTER_URLS.startsWith("http");

const startAgents = async () => {
const directClient = new DirectClient();
Expand Down
7 changes: 5 additions & 2 deletions packages/plugin-bnb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ This plugin enables interaction with the BNB Chain ecosystem, providing support

### Default Setup

By default, **plugin-bnb** is not enabled. To use it, simply add your private key and public key to the `.env` file:
By default, **plugin-bnb** is not enabled. To use it, simply add your private key and/or public key to the `.env` file. If private key is not provided, some actions will be disabled.

**Security Note:** Your private key grants full access to your associated funds. Store it securely and never share it with anyone. Do not commit or upload your `.env` file to version control systems like Git.

```env
BNB_PRIVATE_KEY=your-private-key-here
Expand Down Expand Up @@ -69,10 +71,10 @@ Transfer 1 BNB to 0xRecipient on BSC.

Swap tokens from one address to another on BSC. Just specify the:

- **Chain**(Only BSC is supported for now)
- **Input Token**
- **Output Token**
- **Amount**
- **Chain**
- **Slippage**(Optional)

**Example usage:**
Expand Down Expand Up @@ -102,6 +104,7 @@ Bridge 1 BNB from BSC to opBNB.

Perform staking operations on BSC through [Lista Dao](https://lista.org/liquid-staking/BNB). User will receive sliBNB(0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B) as staking credit. Just specify the:

- **Chain**(Only BSC is supported for now)
- **Action**
- **Amount**

Expand Down
Loading
Loading