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

Solana kits #248

Closed
wants to merge 89 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
b56116d
feat: add Voltr check balance, deposit and withdraw strategy
jakeyvee Jan 4, 2025
23ca0b0
refactoring for standarization
biccsdev Jan 7, 2025
f85fe66
feat: Add functions to create Meteora pools + alpha vault
quangkeu95 Dec 16, 2024
0e5e1b2
fix(meteora): Update imports
quangkeu95 Dec 20, 2024
25f3015
fix(meteora): Exclude alpha vault due to package conflict
quangkeu95 Dec 21, 2024
4695e15
chore: Update imports
quangkeu95 Dec 21, 2024
2aaf3f8
Rebase upstream
quangkeu95 Jan 11, 2025
835a42a
fix: Update tests for Meteora
quangkeu95 Jan 11, 2025
58a190d
Merge pull request #1 from quangkeu95/feat/meteora
quangkeu95 Jan 11, 2025
d859da4
chore: Format code
quangkeu95 Jan 11, 2025
dd8ef31
Merge pull request #2 from quangkeu95/feat/meteora
quangkeu95 Jan 11, 2025
e5fb59d
fix: Update initPrice when creating DLMM pool
quangkeu95 Jan 11, 2025
b966069
feat: Add Meteora to langchain index
quangkeu95 Jan 11, 2025
7b20437
feat: Add Meteora to langchain
quangkeu95 Jan 11, 2025
33737f8
lend and withdraw asset with lulo, not only usdc
zhourunlai Jan 2, 2025
89b4bc0
fix: Parse float number to BN error
quangkeu95 Jan 13, 2025
872427a
--amend
quangkeu95 Jan 13, 2025
4f72b55
fix: Update script to create meteora dlmm pool
quangkeu95 Jan 13, 2025
2f06954
chore: Merge main
quangkeu95 Jan 13, 2025
1e00dab
fix: Bump alpha vault sdk to 1.1.7
quangkeu95 Jan 13, 2025
7d6327a
Merge pull request #3 from quangkeu95/feat/meteora
quangkeu95 Jan 13, 2025
edaaa36
fix: Update eslintrc to ts file
quangkeu95 Jan 13, 2025
76ac0d8
fix: Update meteora create dynamic pool test
quangkeu95 Jan 13, 2025
1fcf818
fix: Remove Meteora alpha vault tool
quangkeu95 Jan 13, 2025
12a05f4
chore: Merge sendai main
quangkeu95 Jan 13, 2025
fb935b6
chore: Remove comments
quangkeu95 Jan 14, 2025
0ef7fbf
fix: Using sendTx function
quangkeu95 Jan 14, 2025
c71f215
fix: changes for Voltr vault program upgrade
jakeyvee Jan 15, 2025
04cd1b2
chore: merge Voltr changes into remote branch
jakeyvee Jan 15, 2025
2971bda
feat: include Voltr into readme
jakeyvee Jan 15, 2025
e3c9322
chore: export voltr folder instead of indiv files in tools
jakeyvee Jan 15, 2025
484a64d
fix: drift user account info fetching
michaelessiet Jan 15, 2025
dc520df
Merge branch 'main' of github.com:3-land/solana-agent-kit into main
biccsdev Jan 15, 2025
7cf2e80
chore: resolve merge conflights
jakeyvee Jan 16, 2025
651ee96
Implement getAsset tool
dimitrov-d Jan 16, 2025
be0287c
Implement getAssetsByAuthority tool
dimitrov-d Jan 16, 2025
a477437
Implement getAssetsByCreator tool
dimitrov-d Jan 16, 2025
4d21366
Implement searchAssets tool
dimitrov-d Jan 16, 2025
611de50
Tool fixes and updates
dimitrov-d Jan 16, 2025
00f033c
merge: main
michaelessiet Jan 16, 2025
7df99ae
Update README.md
dimitrov-d Jan 16, 2025
97e9673
feat: add more drift actions
michaelessiet Jan 16, 2025
79fe5b0
fix: bugs noticed during testing
michaelessiet Jan 16, 2025
15172ee
fix: Allow input normal token amounts
quangkeu95 Jan 17, 2025
0c840d9
feat: add more drift actions
michaelessiet Jan 17, 2025
67fa821
fix: revert all changes in vercel ai test file
michaelessiet Jan 17, 2025
e4fa501
chore: add minimum compute price to constants
michaelessiet Jan 17, 2025
6bbb6d4
implemented nft creation with LP
biccsdev Jan 17, 2025
6c124ac
Implemented NFT creation with Liquidity Pool (#224)
thearyanag Jan 17, 2025
d8c6731
Add Voltr check balance, deposit and withdraw strategy (#128)
thearyanag Jan 17, 2025
deb75d5
Merge branch 'main' into deposit_and_withdraw_with_lulo
thearyanag Jan 17, 2025
34f2e94
feat: deposit and withdraw with lulo (#117)
thearyanag Jan 17, 2025
d67747b
Merge branch 'main' into feat/drift-tool
thearyanag Jan 17, 2025
68cb11b
fix: Drift protocol team review implementation (#210)
thearyanag Jan 17, 2025
89aed54
Merge branch 'main' into quangkeu95/main
thearyanag Jan 17, 2025
54382a5
feat: Create Meteora pools (#203)
thearyanag Jan 17, 2025
343cf4c
chore: docs + lint
thearyanag Jan 17, 2025
925d0cf
Merge remote-tracking branch 'sak/main'
dimitrov-d Jan 18, 2025
331482a
Update get_asset.ts
dimitrov-d Jan 18, 2025
9267cc3
Integrate Metaplex DAS API (#215)
thearyanag Jan 18, 2025
ef9aac5
fix: dynamic fees
thearyanag Jan 20, 2025
853ac07
chore: dist lint
thearyanag Jan 20, 2025
016c8d6
add perplexity ai for latest info
thearyanag Jan 21, 2025
bf0cc27
fix doc
thearyanag Jan 21, 2025
42e5cf0
Feat/perplexity (#228)
thearyanag Jan 21, 2025
a5de076
fix: search assets
thearyanag Jan 21, 2025
e0dfaeb
fix: search assets (#229)
thearyanag Jan 21, 2025
cac2e71
chore: pkg + docs
thearyanag Jan 21, 2025
f7fd180
merge latest
thearyanag Jan 21, 2025
27cc366
fix: drift user account balances and position amounts
michaelessiet Jan 23, 2025
741f2a5
feat: Adds Allora Network price inference tool
fernandofcampos Jan 21, 2025
7816825
fix: perp position precision
michaelessiet Jan 24, 2025
b8f9162
fix: spot position balance type
michaelessiet Jan 24, 2025
64f3800
fix: overall drift account usd balance
michaelessiet Jan 24, 2025
a128016
fix: spot position balance type and signs
michaelessiet Jan 24, 2025
b909310
priority fees added
biccsdev Jan 24, 2025
776e94a
priority fees added (#235)
thearyanag Jan 24, 2025
ecf8741
chore: pkg + docs
thearyanag Jan 24, 2025
78cef3f
feat: Adds Allora Network inference tool (#231)
thearyanag Jan 24, 2025
c417b9b
fix: spot position balance signs
michaelessiet Jan 25, 2025
e33f292
do not log kp
Jan 25, 2025
c5020d1
Merge branch 'main' into feat/drift-tool
michaelessiet Jan 26, 2025
2f1b1cd
Merge branch 'main' into no-log-kp
michaelessiet Jan 27, 2025
99ecb85
Do not log secret key on load (#238)
michaelessiet Jan 27, 2025
6bd0356
Update README.md: change 15+ actions to 60+ actions
michaelessiet Jan 27, 2025
328201b
Update README.md: change 15+ actions to 60+ actions (#244)
thearyanag Jan 27, 2025
1e3ae1c
Merge branch 'main' into feat/drift-tool
michaelessiet Jan 27, 2025
5797498
chore: remove unused import
michaelessiet Jan 27, 2025
0e8c1d1
fix: drift user account balances and position amounts (#232)
arihantbansal Jan 28, 2025
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: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ SOLANA_PRIVATE_KEY=
JUPITER_REFERRAL_ACCOUNT=
JUPITER_FEE_BPS=
FLASH_PRIVILEGE= referral | nft | none
HELIUS_API_KEY=
FLEXLEND_API_KEY=
HELIUS_API_KEY=
ALLORA_API_KEY=
ALLORA_API_URL=
ALLORA_NETWORK= testnet | mainnet
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"plugin:@typescript-eslint/recommended",
"prettier"
],
"ignorePatterns": ["examples/**/*", "src/utils/keypair.ts", "test/**/*"],
"ignorePatterns": ["examples/**/*", "src/utils/keypair.ts", "test/**/*", "dist/**/*"],
"rules": {
"prettier/prettier": "error",
"no-constant-condition": "off",
Expand Down
91 changes: 76 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

</div>

An open-source toolkit for connecting AI agents to Solana protocols. Now, any agent, using any model can autonomously perform 15+ Solana actions:
An open-source toolkit for connecting AI agents to Solana protocols. Now, any agent, using any model can autonomously perform 60+ Solana actions:

- Trade tokens
- Launch new tokens
Expand Down Expand Up @@ -134,10 +134,8 @@ console.log("Token Mint Address:", result.mint.toString());
```
### Create NFT Collection on 3Land
```typescript
const optionsWithBase58: StoreInitOptions = {
privateKey: "",
isMainnet: true, // if false, collection will be created on devnet 3.land (dev.3.land)
};
const isDevnet = false; // (Optional) if not present TX takes place in Mainnet
const priorityFeeParam = 1000000; // (Optional) if not present the default priority fee will be 50000

const collectionOpts: CreateCollectionOptions = {
collectionName: "",
Expand All @@ -147,18 +145,18 @@ const optionsWithBase58: StoreInitOptions = {
};

const result = await agent.create3LandCollection(
optionsWithBase58,
collectionOpts
collectionOpts,
isDevnet, // (Optional) if not present TX takes place in Mainnet
priorityFeeParam, //(Optional)
);
```

### Create NFT on 3Land
When creating an NFT using 3Land's tool, it automatically goes for sale on 3.land website
```typescript
const optionsWithBase58: StoreInitOptions = {
privateKey: "",
isMainnet: true, // if false, listing will be on devnet 3.land (dev.3.land)
};
const isDevnet = true; // (Optional) if not present TX takes place in Mainnet
const withPool = true; // (Optional) only present if NFT will be created with a Liquidity Pool for a specific SPL token
const priorityFeeParam = 1000000; // (Optional) if not present the default priority fee will be 50000
const collectionAccount = ""; //hash for the collection
const createItemOptions: CreateSingleOptions = {
itemName: "",
Expand All @@ -170,15 +168,16 @@ const createItemOptions: CreateSingleOptions = {
{ trait_type: "", value: "" },
],
price: 0, //100000000 == 0.1 sol, can be set to 0 for a free mint
splHash: "", //present if listing is on a specific SPL token, if not present sale will be on $SOL, must be present if "withPool" is true
poolName: "", // Only present if "withPool" is true
mainImageUrl: "",
splHash: "", //present if listing is on a specific SPL token, if not present sale will be on $SOL
};
const isMainnet = true;
const result = await agent.create3LandNft(
optionsWithBase58,
collectionAccount,
createItemOptions,
isMainnet
isDevnet, // (Optional) if not present TX takes place in Mainnet
withPool
priorityFeeParam, //(Optional)
);

```
Expand Down Expand Up @@ -471,6 +470,67 @@ Update the address a drift vault is delegated to.
const signature = await agent.updateDriftVaultDelegate("41Y8C4oxk4zgJT1KXyQr35UhZcfsp5mP86Z2G7UUzojU", "new-address")
```

### Get Voltr Vault Position Values

Get the current position values and total value of assets in a Voltr vault.

```typescript
const values = await agent.voltrGetPositionValues("7opUkqYtxmQRriZvwZkPcg6LqmGjAh1RSEsVrdsGDx5K")
```

### Deposit into Voltr Strategy

Deposit assets into a specific strategy within a Voltr vault.

```typescript
const signature = await agent.voltrDepositStrategy(
new BN("1000000000"), // amount in base units (e.g., 1 USDC = 1000000)
"7opUkqYtxmQRriZvwZkPcg6LqmGjAh1RSEsVrdsGDx5K", // vault
"9ZQQYvr4x7AMqd6abVa1f5duGjti5wk1MHsX6hogPsLk" // strategy
)
```

### Withdraw from Voltr Strategy

Withdraw assets from a specific strategy within a Voltr vault.

```typescript
const signature = await agent.voltrWithdrawStrategy(
new BN("1000000000"), // amount in base units (e.g., 1 USDC = 1000000)
"7opUkqYtxmQRriZvwZkPcg6LqmGjAh1RSEsVrdsGDx5K", // vault
"9ZQQYvr4x7AMqd6abVa1f5duGjti5wk1MHsX6hogPsLk" // strategy
)
```

### Get a Solana asset by its ID

```typescript
const asset = await agent.getAsset("41Y8C4oxk4zgJT1KXyQr35UhZcfsp5mP86Z2G7UUzojU")
```

### Get a price inference from Allora

Get the price for a given token and timeframe from Allora's API

```typescript
const sol5mPrice = await agent.getPriceInference("SOL", "5m");
console.log("5m price inference of SOL/USD:", sol5mPrice);
```

### List all topics from Allora

```typescript
const topics = await agent.getAllTopics();
console.log("Allora topics:", topics);
```

### Get an inference for an specific topic from Allora

```typescript
const inference = await agent.getInferenceByTopicId(42);
console.log("Allora inference for topic 42:", inference);
```

## Examples

### LangGraph Multi-Agent System
Expand All @@ -494,6 +554,7 @@ The toolkit relies on several key Solana and Metaplex libraries:

- @solana/web3.js
- @solana/spl-token
- @metaplex-foundation/digital-asset-standard-api
- @metaplex-foundation/mpl-token-metadata
- @metaplex-foundation/mpl-core
- @metaplex-foundation/umi
Expand Down
Loading
Loading