forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea9d1c0
commit 4e468af
Showing
26 changed files
with
8,776 additions
and
2,152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,3 +55,5 @@ coverage | |
.eslintcache | ||
|
||
agent/content | ||
|
||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# `@ai16z/plugin-bnb` | ||
|
||
This plugin enables interaction with the BNB Chain ecosystem, providing support for BNB Smart Chain, opBNB, and BNB Greenfield networks. | ||
|
||
--- | ||
|
||
## Configuration | ||
|
||
### Default Setup | ||
|
||
By default, **plugin-bnb** is not enabled. To use it, simply add your private key and public key to the `.env` file: | ||
|
||
```env | ||
BNB_PRIVATE_KEY=your-private-key-here | ||
BNB_PUBLIC_KEY=your-public-key-here | ||
``` | ||
|
||
### Custom RPC URLs | ||
|
||
By default, the RPC URL is inferred from the `viem/chains` config. To use custom RPC URLs, add the following to your `.env` file: | ||
|
||
```env | ||
BSC_PROVIDER_URL=https://your-custom-bsc-rpc-url | ||
OPBNB_PROVIDER_URL=https://your-custom-opbnb-rpc-url | ||
``` | ||
|
||
## Provider | ||
|
||
The **Wallet Provider** initializes with BSC as the default. It: | ||
|
||
- Provides the **context** of the currently connected address and its balance. | ||
- Creates **Public** and **Wallet clients** to interact with the supported chains. | ||
|
||
--- | ||
|
||
## Actions | ||
|
||
### Get Balance | ||
|
||
Get the balance of an address on BSC. Just specify the: | ||
|
||
- **Chain** | ||
- **Address** | ||
- **Token** | ||
|
||
**Example usage:** | ||
|
||
```bash | ||
Get the USDC balance of 0x1234567890 on BSC. | ||
``` | ||
|
||
### Transfer | ||
|
||
Transfer tokens from one address to another on BSC/opBNB. Just specify the: | ||
|
||
- **Chain** | ||
- **Token** | ||
- **Amount** | ||
- **Recipient Address** | ||
- **Data**(Optional) | ||
|
||
**Example usage:** | ||
|
||
```bash | ||
Transfer 1 BNB to 0xRecipient on BSC. | ||
``` | ||
|
||
### Swap | ||
|
||
Swap tokens from one address to another on BSC. Just specify the: | ||
|
||
- **Input Token** | ||
- **Output Token** | ||
- **Amount** | ||
- **Chain** | ||
- **Slippage**(Optional) | ||
|
||
**Example usage:** | ||
|
||
```bash | ||
Swap 1 BNB to USDC on BSC. | ||
``` | ||
|
||
### Bridge | ||
|
||
Bridge tokens from one chain to another on BSC/opBNB. Just specify the: | ||
|
||
- **From Chain** | ||
- **To Chain** | ||
- **From Token** | ||
- **To Token** | ||
- **Amount** | ||
- **Recipient Address**(Optional) | ||
|
||
**Example usage:** | ||
|
||
```bash | ||
Bridge 1 BNB from BSC to opBNB. | ||
``` | ||
|
||
### Stake | ||
|
||
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: | ||
|
||
- **Action** | ||
- **Amount** | ||
|
||
**Example usage:** | ||
|
||
```bash | ||
Deposit 1 BNB to Lista Dao. | ||
``` | ||
|
||
### Faucet | ||
|
||
Request testnet tokens from the faucet. You could request any of the supported tokens(BNB, BTC, BUSD, DAI, ETH, USDC). Just specify the: | ||
|
||
- **Token**(Optional) | ||
- **Recipient Address** | ||
|
||
The recipient address must maintain a minimum balance of 0.002 BNB on BSC Mainnet to qualify. | ||
|
||
**Example usage:** | ||
|
||
```bash | ||
Get some testnet USDC from the faucet. | ||
``` | ||
|
||
--- | ||
|
||
## Contribution | ||
|
||
The plugin contains tests. Whether you're using **TDD** or not, please make sure to run the tests before submitting a PR. | ||
|
||
### Running Tests | ||
|
||
Navigate to the `plugin-bnb` directory and run: | ||
|
||
```bash | ||
pnpm test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "@elizaos/plugin-bnb", | ||
"version": "0.1.0-alpha.1", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@elizaos/core": "workspace:*", | ||
"@lifi/data-types": "5.15.5", | ||
"@lifi/sdk": "3.4.1", | ||
"@lifi/types": "16.3.0", | ||
"@web3-name-sdk/core": "^0.3.2", | ||
"@openzeppelin/contracts": "^5.1.0", | ||
"@types/node": "^22.10.5", | ||
"solc": "^0.8.28", | ||
"tsup": "8.3.5", | ||
"viem": "2.21.53", | ||
"ws": "^8.18.0" | ||
}, | ||
"scripts": { | ||
"build": "tsup --format esm --dts", | ||
"dev": "tsup --format esm --dts --watch", | ||
"test": "vitest run", | ||
"lint": "eslint --fix --cache ." | ||
}, | ||
"peerDependencies": { | ||
"whatwg-url": "7.1.0" | ||
} | ||
} |
Oops, something went wrong.