mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-14 15:10:20 +00:00
Merge pull request #4 from scriptscrypt/feat/pump-fun
Feat: Added Pumpfun Token Launch
This commit is contained in:
@@ -1 +0,0 @@
|
||||
solanaagentkit.xyz
|
||||
@@ -1 +1 @@
|
||||
window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE4XSwU7DMAwG4HfxuaJbxQb0VlFxAYYEuyEOUfBYhGdHtSttmvbuqGxi7ei6Sy7+8zlO8r4Fw7VBDm9Cjl3xhWyPwSCB6GwJOXhyqqhpt361tBVBAt+BPyEfZ7e75E+6FyL0FoRLjCSbFXLLC2xYLZxHTfuCXTibTHvhl9isekE9pAbJCp1J1Q/ta0Pbn2qSwnup2Uo0F0hfUaOwYq94Pj7U5DmwHYeaPcwHe5xNX5qjxCgarFBFa5Cjbpt4OPxp5sQc3d2MJ1nL9c0V4v7rzEWo9WKLmn9PqOm/UFedXu8+fgCaFcWUpwIAAA=="
|
||||
window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE4WSTU/DMAyG/0vOFWUVG9DbRLUL40PQG+IQBZdGS+2odiQmtP+OyibWji695OInj+PXeftWAl+icvVKTqNefgLKvRWVKK+lVrkyTjMDp8P6RS2NU4naWPxQ+Sy72SV/pjtyDoxYwgK8o20D2PNZFGgrbYDTMXAozuaLUfGT706esB6oqLIFLdSOi/a12PV1cLQ0hgJKAaKt4xdgT8gwajyPx5o8WJTjUI+rMtrjLB1r8RwaXwVc64CmjupHySn1KmBJG4iubYSbSr4AT2xlyQzSjX30ytYf4j5lTpyXt9ezedbzmm7psP/sJZHrPbYK+Jspp/+goXVxtXv/ATHeAoJZAwAA"
|
||||
@@ -1 +1 @@
|
||||
window.searchData = "data:application/octet-stream;base64,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";
|
||||
window.searchData = "data:application/octet-stream;base64,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";
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
7
docs/interfaces/PumpFunTokenOptions.html
Normal file
7
docs/interfaces/PumpFunTokenOptions.html
Normal file
File diff suppressed because one or more lines are too long
5
docs/interfaces/PumpfunLaunchResponse.html
Normal file
5
docs/interfaces/PumpfunLaunchResponse.html
Normal file
File diff suppressed because one or more lines are too long
@@ -4,6 +4,8 @@
|
||||
<a href="interfaces/Creator.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Creator</span></a>
|
||||
<a href="interfaces/LuloAccountDetailsResponse.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Lulo<wbr/>Account<wbr/>Details<wbr/>Response</span></a>
|
||||
<a href="interfaces/MintCollectionNFTResponse.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Mint<wbr/>CollectionNFTResponse</span></a>
|
||||
<a href="interfaces/PumpfunLaunchResponse.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Pumpfun<wbr/>Launch<wbr/>Response</span></a>
|
||||
<a href="interfaces/PumpFunTokenOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Pump<wbr/>Fun<wbr/>Token<wbr/>Options</span></a>
|
||||
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Type Aliases</h3><div class="tsd-index-list"><a href="types/LuloDepositAssetMint.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-2097152"></use></svg><span>Lulo<wbr/>Deposit<wbr/>Asset<wbr/>Mint</span></a>
|
||||
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Functions</h3><div class="tsd-index-list"><a href="functions/createSolanaTools.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-64"></use></svg><span>create<wbr/>Solana<wbr/>Tools</span></a>
|
||||
</div></section></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>solana-agent-kit</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>LuloDepositAssetMint | solana-agent-kit</title><meta name="description" content="Documentation for solana-agent-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">solana-agent-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">solana-agent-kit</a></li><li><a href="LuloDepositAssetMint.html">LuloDepositAssetMint</a></li></ul><h1>Type Alias LuloDepositAssetMint</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Lulo<wbr/>Deposit<wbr/>Asset<wbr/>Mint</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">typeof </span><span class="tsd-signature-type">TOKENS</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-keyword">keyof </span><span class="tsd-signature-keyword">typeof </span><span class="tsd-signature-type">TOKENS</span><span class="tsd-signature-symbol">]</span></div><div class="tsd-comment tsd-typography"><p>Mint addresses of supported tokens for lending on Lulo</p>
|
||||
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/arihantbansal/solana-agent-kit/blob/e3d1ff1d419696356ab6c10021d694b51a86f79c/src/types/index.ts#L30">types/index.ts:30</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>solana-agent-kit</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
||||
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/thearyanag/solana-agent-kit/blob/b40f65d5c02bcb20381f8c2c273b3f8208eaf241/src/types/index.ts#L47">types/index.ts:47</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>solana-agent-kit</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"docs": "typedoc src --out docs",
|
||||
"test": "ts-node test/index.ts"
|
||||
"test": "ts-node test/index.ts",
|
||||
"generate": "ts-node src/utils/keypair.ts"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
@@ -15,6 +16,8 @@
|
||||
"dependencies": {
|
||||
"@bonfida/spl-name-service": "^3.0.7",
|
||||
"@langchain/core": "^0.3.18",
|
||||
"@langchain/groq": "^0.1.2",
|
||||
"@langchain/langgraph": "^0.2.27",
|
||||
"@langchain/openai": "^0.3.13",
|
||||
"@metaplex-foundation/mpl-core": "^1.1.1",
|
||||
"@metaplex-foundation/mpl-token-metadata": "^3.3.0",
|
||||
@@ -25,7 +28,9 @@
|
||||
"@solana/web3.js": "^1.95.4",
|
||||
"bs58": "^6.0.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"form-data": "^4.0.1",
|
||||
"langchain": "^0.3.6",
|
||||
"openai": "^4.75.0",
|
||||
"typedoc": "^0.26.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
139
pnpm-lock.yaml
generated
139
pnpm-lock.yaml
generated
@@ -13,10 +13,16 @@ importers:
|
||||
version: 3.0.7(@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.3)(utf-8-validate@5.0.10)
|
||||
'@langchain/core':
|
||||
specifier: ^0.3.18
|
||||
version: 0.3.18(openai@4.72.0(zod@3.23.8))
|
||||
version: 0.3.18(openai@4.75.0(zod@3.23.8))
|
||||
'@langchain/groq':
|
||||
specifier: ^0.1.2
|
||||
version: 0.1.2(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))
|
||||
'@langchain/langgraph':
|
||||
specifier: ^0.2.27
|
||||
version: 0.2.27(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))
|
||||
'@langchain/openai':
|
||||
specifier: ^0.3.13
|
||||
version: 0.3.13(@langchain/core@0.3.18(openai@4.72.0(zod@3.23.8)))
|
||||
version: 0.3.13(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))
|
||||
'@metaplex-foundation/mpl-core':
|
||||
specifier: ^1.1.1
|
||||
version: 1.1.1(@metaplex-foundation/umi@0.9.2)(@noble/hashes@1.5.0)
|
||||
@@ -44,9 +50,15 @@ importers:
|
||||
dotenv:
|
||||
specifier: ^16.4.5
|
||||
version: 16.4.5
|
||||
form-data:
|
||||
specifier: ^4.0.1
|
||||
version: 4.0.1
|
||||
langchain:
|
||||
specifier: ^0.3.6
|
||||
version: 0.3.6(@langchain/core@0.3.18(openai@4.72.0(zod@3.23.8)))(axios@1.7.7)(openai@4.72.0(zod@3.23.8))
|
||||
version: 0.3.6(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))(@langchain/groq@0.1.2(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8))))(axios@1.7.7)(openai@4.75.0(zod@3.23.8))
|
||||
openai:
|
||||
specifier: ^4.75.0
|
||||
version: 4.75.0(zod@3.23.8)
|
||||
typedoc:
|
||||
specifier: ^0.26.11
|
||||
version: 0.26.11(typescript@5.6.3)
|
||||
@@ -92,6 +104,27 @@ packages:
|
||||
resolution: {integrity: sha512-IEZCrFs1Xd0J2FTH1D3Lnm3/Yk2r8LSpwDeLYwcCom3rNAK5k4mKQ2rwIpNq3YuqBdrTNMKRO+PopjkP1SB17A==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@langchain/groq@0.1.2':
|
||||
resolution: {integrity: sha512-bgQ9yGoNHOwG6LG2ngGvSNxF/1U1c1u3vKmFWmzecFIcBoQQOJY0jb0MrL3g1uTife0Sr3zxkWKXQg2aK/U4Sg==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
'@langchain/core': '>=0.2.21 <0.4.0'
|
||||
|
||||
'@langchain/langgraph-checkpoint@0.0.13':
|
||||
resolution: {integrity: sha512-amdmBcNT8a9xP2VwcEWxqArng4gtRDcnVyVI4DsQIo1Aaz8e8+hH17zSwrUF3pt1pIYztngIfYnBOim31mtKMg==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
'@langchain/core': '>=0.2.31 <0.4.0'
|
||||
|
||||
'@langchain/langgraph-sdk@0.0.31':
|
||||
resolution: {integrity: sha512-oYZWoC3x7vH9bAL1Y30XjtuWnic1j3knXD4BbldsY0chFLxwIT5i6/GMThNy3Oiwb4SB+c6gvaSuxBNDkp7dkw==}
|
||||
|
||||
'@langchain/langgraph@0.2.27':
|
||||
resolution: {integrity: sha512-7+PlVXlNpswzXzZp/k8O99YBN3zBkUdusfyxISkZ/gdXz1p5RySQEpKQ4EVIZnzBrZ98zZ3FArj4OWOgeF0EeA==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
'@langchain/core': '>=0.2.36 <0.3.0 || >=0.3.9 < 0.4.0'
|
||||
|
||||
'@langchain/openai@0.3.13':
|
||||
resolution: {integrity: sha512-lfiauYttb1Vv1GVGDNZlse8475RUsKm9JJ7X9kMVtYoOQnK8xxzMVSrpW7HYLmJokrtVgF6STwRzNJI2gZ3uBw==}
|
||||
engines: {node: '>=18'}
|
||||
@@ -353,6 +386,9 @@ packages:
|
||||
'@types/hast@3.0.4':
|
||||
resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==}
|
||||
|
||||
'@types/json-schema@7.0.15':
|
||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||
|
||||
'@types/mdast@4.0.4':
|
||||
resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}
|
||||
|
||||
@@ -606,6 +642,9 @@ packages:
|
||||
graphemesplit@2.4.4:
|
||||
resolution: {integrity: sha512-lKrpp1mk1NH26USxC/Asw4OHbhSQf5XfrWZ+CDv/dFVvd1j17kFgMotdJvOesmHkbFX9P9sBfpH8VogxOWLg8w==}
|
||||
|
||||
groq-sdk@0.5.0:
|
||||
resolution: {integrity: sha512-RVmhW7qZ+XZoy5fIuSdx/LGQJONpL8MHgZEW7dFwTdgkzStub2XQx6OKv28CHogijdwH41J+Npj/z2jBPu3vmw==}
|
||||
|
||||
hast-util-to-html@9.0.3:
|
||||
resolution: {integrity: sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==}
|
||||
|
||||
@@ -783,8 +822,8 @@ packages:
|
||||
oniguruma-to-es@0.1.2:
|
||||
resolution: {integrity: sha512-sBYKVJlIMB0WPO+tSu/NNB1ytSFeHyyJZ3Ayxfx3f/QUuXu0lvZk0VB4K7npmdlHSC0ldqanzh/sUSlAbgCTfw==}
|
||||
|
||||
openai@4.72.0:
|
||||
resolution: {integrity: sha512-hFqG9BWCs7L7ifrhJXw7mJXmUBr7d9N6If3J9563o0jfwVA4wFANFDDaOIWFdgDdwgCXg5emf0Q+LoLCGszQYA==}
|
||||
openai@4.75.0:
|
||||
resolution: {integrity: sha512-8cWaK3td0qLspaflKWD6AvpQnl0gynWFbHg7sMAgiu//F20I4GJlCCpllDrECO6WFSuY8HXJj8gji3urw2BGGg==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
zod: ^3.23.8
|
||||
@@ -951,6 +990,10 @@ packages:
|
||||
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
|
||||
hasBin: true
|
||||
|
||||
uuid@9.0.1:
|
||||
resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==}
|
||||
hasBin: true
|
||||
|
||||
v8-compile-cache-lib@3.0.1:
|
||||
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
||||
|
||||
@@ -960,6 +1003,10 @@ packages:
|
||||
vfile@6.0.3:
|
||||
resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
|
||||
|
||||
web-streams-polyfill@3.3.3:
|
||||
resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
web-streams-polyfill@4.0.0-beta.3:
|
||||
resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==}
|
||||
engines: {node: '>= 14'}
|
||||
@@ -1059,13 +1106,13 @@ snapshots:
|
||||
'@jridgewell/resolve-uri': 3.1.2
|
||||
'@jridgewell/sourcemap-codec': 1.5.0
|
||||
|
||||
'@langchain/core@0.3.18(openai@4.72.0(zod@3.23.8))':
|
||||
'@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8))':
|
||||
dependencies:
|
||||
ansi-styles: 5.2.0
|
||||
camelcase: 6.3.0
|
||||
decamelize: 1.2.0
|
||||
js-tiktoken: 1.0.15
|
||||
langsmith: 0.2.5(openai@4.72.0(zod@3.23.8))
|
||||
langsmith: 0.2.5(openai@4.75.0(zod@3.23.8))
|
||||
mustache: 4.2.0
|
||||
p-queue: 6.6.2
|
||||
p-retry: 4.6.2
|
||||
@@ -1075,19 +1122,49 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- openai
|
||||
|
||||
'@langchain/openai@0.3.13(@langchain/core@0.3.18(openai@4.72.0(zod@3.23.8)))':
|
||||
'@langchain/groq@0.1.2(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))':
|
||||
dependencies:
|
||||
'@langchain/core': 0.3.18(openai@4.72.0(zod@3.23.8))
|
||||
js-tiktoken: 1.0.15
|
||||
openai: 4.72.0(zod@3.23.8)
|
||||
'@langchain/core': 0.3.18(openai@4.75.0(zod@3.23.8))
|
||||
'@langchain/openai': 0.3.13(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))
|
||||
groq-sdk: 0.5.0
|
||||
zod: 3.23.8
|
||||
zod-to-json-schema: 3.23.5(zod@3.23.8)
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
|
||||
'@langchain/textsplitters@0.1.0(@langchain/core@0.3.18(openai@4.72.0(zod@3.23.8)))':
|
||||
'@langchain/langgraph-checkpoint@0.0.13(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))':
|
||||
dependencies:
|
||||
'@langchain/core': 0.3.18(openai@4.72.0(zod@3.23.8))
|
||||
'@langchain/core': 0.3.18(openai@4.75.0(zod@3.23.8))
|
||||
uuid: 10.0.0
|
||||
|
||||
'@langchain/langgraph-sdk@0.0.31':
|
||||
dependencies:
|
||||
'@types/json-schema': 7.0.15
|
||||
p-queue: 6.6.2
|
||||
p-retry: 4.6.2
|
||||
uuid: 9.0.1
|
||||
|
||||
'@langchain/langgraph@0.2.27(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))':
|
||||
dependencies:
|
||||
'@langchain/core': 0.3.18(openai@4.75.0(zod@3.23.8))
|
||||
'@langchain/langgraph-checkpoint': 0.0.13(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))
|
||||
'@langchain/langgraph-sdk': 0.0.31
|
||||
uuid: 10.0.0
|
||||
zod: 3.23.8
|
||||
|
||||
'@langchain/openai@0.3.13(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))':
|
||||
dependencies:
|
||||
'@langchain/core': 0.3.18(openai@4.75.0(zod@3.23.8))
|
||||
js-tiktoken: 1.0.15
|
||||
openai: 4.75.0(zod@3.23.8)
|
||||
zod: 3.23.8
|
||||
zod-to-json-schema: 3.23.5(zod@3.23.8)
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
|
||||
'@langchain/textsplitters@0.1.0(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))':
|
||||
dependencies:
|
||||
'@langchain/core': 0.3.18(openai@4.75.0(zod@3.23.8))
|
||||
js-tiktoken: 1.0.15
|
||||
|
||||
'@metaplex-foundation/mpl-core@1.1.1(@metaplex-foundation/umi@0.9.2)(@noble/hashes@1.5.0)':
|
||||
@@ -1446,6 +1523,8 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/unist': 3.0.3
|
||||
|
||||
'@types/json-schema@7.0.15': {}
|
||||
|
||||
'@types/mdast@4.0.4':
|
||||
dependencies:
|
||||
'@types/unist': 3.0.3
|
||||
@@ -1664,6 +1743,19 @@ snapshots:
|
||||
js-base64: 3.7.7
|
||||
unicode-trie: 2.0.0
|
||||
|
||||
groq-sdk@0.5.0:
|
||||
dependencies:
|
||||
'@types/node': 18.19.64
|
||||
'@types/node-fetch': 2.6.12
|
||||
abort-controller: 3.0.0
|
||||
agentkeepalive: 4.5.0
|
||||
form-data-encoder: 1.7.2
|
||||
formdata-node: 4.4.1
|
||||
node-fetch: 2.7.0
|
||||
web-streams-polyfill: 3.3.3
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
|
||||
hast-util-to-html@9.0.3:
|
||||
dependencies:
|
||||
'@types/hast': 3.0.4
|
||||
@@ -1730,15 +1822,15 @@ snapshots:
|
||||
|
||||
jsonpointer@5.0.1: {}
|
||||
|
||||
langchain@0.3.6(@langchain/core@0.3.18(openai@4.72.0(zod@3.23.8)))(axios@1.7.7)(openai@4.72.0(zod@3.23.8)):
|
||||
langchain@0.3.6(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))(@langchain/groq@0.1.2(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8))))(axios@1.7.7)(openai@4.75.0(zod@3.23.8)):
|
||||
dependencies:
|
||||
'@langchain/core': 0.3.18(openai@4.72.0(zod@3.23.8))
|
||||
'@langchain/openai': 0.3.13(@langchain/core@0.3.18(openai@4.72.0(zod@3.23.8)))
|
||||
'@langchain/textsplitters': 0.1.0(@langchain/core@0.3.18(openai@4.72.0(zod@3.23.8)))
|
||||
'@langchain/core': 0.3.18(openai@4.75.0(zod@3.23.8))
|
||||
'@langchain/openai': 0.3.13(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))
|
||||
'@langchain/textsplitters': 0.1.0(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))
|
||||
js-tiktoken: 1.0.15
|
||||
js-yaml: 4.1.0
|
||||
jsonpointer: 5.0.1
|
||||
langsmith: 0.2.5(openai@4.72.0(zod@3.23.8))
|
||||
langsmith: 0.2.5(openai@4.75.0(zod@3.23.8))
|
||||
openapi-types: 12.1.3
|
||||
p-retry: 4.6.2
|
||||
uuid: 10.0.0
|
||||
@@ -1746,12 +1838,13 @@ snapshots:
|
||||
zod: 3.23.8
|
||||
zod-to-json-schema: 3.23.5(zod@3.23.8)
|
||||
optionalDependencies:
|
||||
'@langchain/groq': 0.1.2(@langchain/core@0.3.18(openai@4.75.0(zod@3.23.8)))
|
||||
axios: 1.7.7
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- openai
|
||||
|
||||
langsmith@0.2.5(openai@4.72.0(zod@3.23.8)):
|
||||
langsmith@0.2.5(openai@4.75.0(zod@3.23.8)):
|
||||
dependencies:
|
||||
'@types/uuid': 10.0.0
|
||||
commander: 10.0.1
|
||||
@@ -1760,7 +1853,7 @@ snapshots:
|
||||
semver: 7.6.3
|
||||
uuid: 10.0.0
|
||||
optionalDependencies:
|
||||
openai: 4.72.0(zod@3.23.8)
|
||||
openai: 4.75.0(zod@3.23.8)
|
||||
|
||||
linkify-it@5.0.0:
|
||||
dependencies:
|
||||
@@ -1839,7 +1932,7 @@ snapshots:
|
||||
regex: 4.4.0
|
||||
regex-recursion: 4.2.1
|
||||
|
||||
openai@4.72.0(zod@3.23.8):
|
||||
openai@4.75.0(zod@3.23.8):
|
||||
dependencies:
|
||||
'@types/node': 18.19.64
|
||||
'@types/node-fetch': 2.6.12
|
||||
@@ -2013,6 +2106,8 @@ snapshots:
|
||||
|
||||
uuid@8.3.2: {}
|
||||
|
||||
uuid@9.0.1: {}
|
||||
|
||||
v8-compile-cache-lib@3.0.1: {}
|
||||
|
||||
vfile-message@4.0.2:
|
||||
@@ -2025,6 +2120,8 @@ snapshots:
|
||||
'@types/unist': 3.0.3
|
||||
vfile-message: 4.0.2
|
||||
|
||||
web-streams-polyfill@3.3.3: {}
|
||||
|
||||
web-streams-polyfill@4.0.0-beta.3: {}
|
||||
|
||||
webidl-conversions@3.0.1: {}
|
||||
|
||||
@@ -9,11 +9,9 @@ import {
|
||||
transfer,
|
||||
trade,
|
||||
registerDomain,
|
||||
lendAsset,
|
||||
getLendingDetails,
|
||||
getTPS,
|
||||
launchPumpFunToken,
|
||||
} from "../tools";
|
||||
import { CollectionOptions, LuloDepositAssetMint } from "../types";
|
||||
import { CollectionOptions, PumpFunTokenOptions } from "../types";
|
||||
import { DEFAULT_OPTIONS } from "../constants";
|
||||
|
||||
/**
|
||||
@@ -29,26 +27,17 @@ export class SolanaAgentKit {
|
||||
public connection: Connection;
|
||||
public wallet: Keypair;
|
||||
public wallet_address: PublicKey;
|
||||
public openai_api_key: string;
|
||||
|
||||
constructor(
|
||||
privateKey?: string,
|
||||
rpcURL = "https://api.mainnet-beta.solana.com",
|
||||
private_key: string,
|
||||
rpc_url = "https://api.mainnet-beta.solana.com",
|
||||
openai_api_key: string
|
||||
) {
|
||||
this.connection = new Connection(rpcURL);
|
||||
if (privateKey) {
|
||||
this.wallet = Keypair.fromSecretKey(bs58.decode(privateKey));
|
||||
} else {
|
||||
this.wallet = Keypair.generate();
|
||||
console.log("Generated new wallet: ", this.wallet.publicKey.toBase58());
|
||||
console.log(
|
||||
"Safely store the private key: ",
|
||||
"\n----------------------------------\n",
|
||||
this.wallet.secretKey,
|
||||
"\n----------------------------------\n",
|
||||
"Please fund this wallet with SOL to use it (on mainnet), or use the faucet method to request funds (only on devnet/testnet).",
|
||||
);
|
||||
}
|
||||
this.connection = new Connection(rpc_url);
|
||||
this.wallet = Keypair.fromSecretKey(bs58.decode(private_key));
|
||||
this.wallet_address = this.wallet.publicKey;
|
||||
this.openai_api_key = openai_api_key;
|
||||
}
|
||||
|
||||
// Tool methods
|
||||
@@ -57,7 +46,7 @@ export class SolanaAgentKit {
|
||||
}
|
||||
|
||||
async deployToken(
|
||||
decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS,
|
||||
decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS
|
||||
// initialSupply?: number
|
||||
) {
|
||||
return deploy_token(this, decimals);
|
||||
@@ -74,7 +63,7 @@ export class SolanaAgentKit {
|
||||
async mintNFT(
|
||||
collectionMint: PublicKey,
|
||||
metadata: Parameters<typeof mintCollectionNFT>[2],
|
||||
recipient?: PublicKey,
|
||||
recipient?: PublicKey
|
||||
) {
|
||||
return mintCollectionNFT(this, collectionMint, metadata, recipient);
|
||||
}
|
||||
@@ -91,24 +80,25 @@ export class SolanaAgentKit {
|
||||
outputMint: PublicKey,
|
||||
inputAmount: number,
|
||||
inputMint?: PublicKey,
|
||||
slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS,
|
||||
slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS
|
||||
) {
|
||||
return trade(this, outputMint, inputAmount, inputMint, slippageBps);
|
||||
}
|
||||
|
||||
async lendAssets(
|
||||
asset: LuloDepositAssetMint,
|
||||
amount: number,
|
||||
LULO_API_KEY: string,
|
||||
async launchPumpFunToken(
|
||||
tokenName: string,
|
||||
tokenTicker: string,
|
||||
description: string,
|
||||
imageUrl: string,
|
||||
options?: PumpFunTokenOptions
|
||||
) {
|
||||
return lendAsset(this, asset, amount, LULO_API_KEY);
|
||||
}
|
||||
|
||||
async fetchLendingDetails(LULO_API_KEY: string) {
|
||||
return getLendingDetails(this, LULO_API_KEY);
|
||||
}
|
||||
|
||||
async getTPS() {
|
||||
return getTPS(this);
|
||||
return launchPumpFunToken(
|
||||
this,
|
||||
tokenName,
|
||||
tokenTicker,
|
||||
description,
|
||||
imageUrl,
|
||||
options
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,86 @@
|
||||
import { Tool } from "langchain/tools";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { toJSON } from "../utils/toJSON";
|
||||
import { create_image } from "../tools/create_image";
|
||||
|
||||
export class SolanaBalanceTool extends Tool {
|
||||
name = "solana_balance";
|
||||
description =
|
||||
"Get the balance of a Solana wallet or token account. Input can be a token address or empty for SOL balance.";
|
||||
description = `Get the balance of a Solana wallet or token account.
|
||||
|
||||
If you want to get the balance of your wallet, you don't need to provide the tokenAddress.
|
||||
If no tokenAddress is provided, the balance will be in SOL.
|
||||
|
||||
Inputs:
|
||||
tokenAddress: string, eg "So11111111111111111111111111111111111111112" (optional)`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(input: string): Promise<string> {
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const tokenAddress = input ? new PublicKey(input) : undefined;
|
||||
const balance = await this.solanaKit.getBalance(tokenAddress);
|
||||
return `Balance: ${balance}`;
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
balance: balance,
|
||||
token: input || "SOL",
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error getting balance: ${error.message}`;
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class SolanaTransferTool extends Tool {
|
||||
name = "solana_transfer";
|
||||
description =
|
||||
"Transfer tokens or SOL to another address. Input should be JSON string with: {to: string, amount: number, mint?: string}";
|
||||
description = `Transfer tokens or SOL to another address ( also called as wallet address ).
|
||||
|
||||
Inputs ( input is a JSON string ):
|
||||
to: string, eg "8x2dR8Mpzuz2YqyZyZjUbYWKSWesBo5jMx2Q9Y86udVk" (required)
|
||||
amount: number, eg 1 (required)
|
||||
mint?: string, eg "So11111111111111111111111111111111111111112" or "SENDdRQtYMWaQrBroBrJ2Q53fgVuq95CV9UPGEvpCxa" (optional)`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(input: string): Promise<string> {
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const { to, amount, mint } = JSON.parse(input);
|
||||
const recipient = new PublicKey(to);
|
||||
const mintAddress = mint ? new PublicKey(mint) : undefined;
|
||||
const parsedInput = JSON.parse(input);
|
||||
console.log(parsedInput);
|
||||
|
||||
await this.solanaKit.transfer(recipient, amount, mintAddress);
|
||||
return `Successfully transferred ${amount} to ${to}`;
|
||||
const recipient = new PublicKey(parsedInput.to);
|
||||
const mintAddress = parsedInput.mint
|
||||
? new PublicKey(parsedInput.mint)
|
||||
: undefined;
|
||||
|
||||
const tx = await this.solanaKit.transfer(
|
||||
recipient,
|
||||
parsedInput.amount,
|
||||
mintAddress
|
||||
);
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Transfer completed successfully",
|
||||
amount: parsedInput.amount,
|
||||
recipient: parsedInput.to,
|
||||
token: parsedInput.mint || "SOL",
|
||||
transaction: tx,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error making transfer: ${error.message}`;
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,16 +94,44 @@ export class SolanaDeployTokenTool extends Tool {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(input: string): Promise<string> {
|
||||
private validateInput(input: any): void {
|
||||
if (
|
||||
input.decimals !== undefined &&
|
||||
(typeof input.decimals !== "number" ||
|
||||
input.decimals < 0 ||
|
||||
input.decimals > 9)
|
||||
) {
|
||||
throw new Error(
|
||||
"decimals must be a number between 0 and 9 when provided"
|
||||
);
|
||||
}
|
||||
if (
|
||||
input.initialSupply !== undefined &&
|
||||
(typeof input.initialSupply !== "number" || input.initialSupply <= 0)
|
||||
) {
|
||||
throw new Error("initialSupply must be a positive number when provided");
|
||||
}
|
||||
}
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const validJson = input
|
||||
.replace(/([a-zA-Z0-9_]+):/g, '"$1":') // Add quotes around keys
|
||||
.trim();
|
||||
const { decimals = 9 } = JSON.parse(validJson);
|
||||
const result = await this.solanaKit.deployToken(decimals);
|
||||
return `Token deployed successfully. Mint address: ${result.mint.toString()}`;
|
||||
const parsedInput = toJSON(input);
|
||||
this.validateInput(parsedInput);
|
||||
|
||||
const result = await this.solanaKit.deployToken(parsedInput.decimals);
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Token deployed successfully",
|
||||
mintAddress: result.mint.toString(),
|
||||
decimals: parsedInput.decimals || 9,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error deploying token: ${error.message}`;
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,13 +145,65 @@ export class SolanaDeployCollectionTool extends Tool {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(input: string): Promise<string> {
|
||||
private validateInput(input: any): void {
|
||||
if (!input.name || typeof input.name !== "string") {
|
||||
throw new Error("name is required and must be a string");
|
||||
}
|
||||
if (!input.uri || typeof input.uri !== "string") {
|
||||
throw new Error("uri is required and must be a string");
|
||||
}
|
||||
if (
|
||||
input.royaltyBasisPoints !== undefined &&
|
||||
(typeof input.royaltyBasisPoints !== "number" ||
|
||||
input.royaltyBasisPoints < 0 ||
|
||||
input.royaltyBasisPoints > 10000)
|
||||
) {
|
||||
throw new Error(
|
||||
"royaltyBasisPoints must be a number between 0 and 10000 when provided"
|
||||
);
|
||||
}
|
||||
if (input.creators) {
|
||||
if (!Array.isArray(input.creators)) {
|
||||
throw new Error("creators must be an array when provided");
|
||||
}
|
||||
input.creators.forEach((creator: any, index: number) => {
|
||||
if (!creator.address || typeof creator.address !== "string") {
|
||||
throw new Error(
|
||||
`creator[${index}].address is required and must be a string`
|
||||
);
|
||||
}
|
||||
if (
|
||||
typeof creator.percentage !== "number" ||
|
||||
creator.percentage < 0 ||
|
||||
creator.percentage > 100
|
||||
) {
|
||||
throw new Error(
|
||||
`creator[${index}].percentage must be a number between 0 and 100`
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const options = JSON.parse(input);
|
||||
const result = await this.solanaKit.deployCollection(options);
|
||||
return `Collection deployed successfully. Address: ${result.collectionAddress.toString()}`;
|
||||
const parsedInput = toJSON(input);
|
||||
this.validateInput(parsedInput);
|
||||
|
||||
const result = await this.solanaKit.deployCollection(parsedInput);
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Collection deployed successfully",
|
||||
collectionAddress: result.collectionAddress.toString(),
|
||||
name: parsedInput.name,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error deploying collection: ${error.message}`;
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,44 +217,97 @@ export class SolanaMintNFTTool extends Tool {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(input: string): Promise<string> {
|
||||
private validateInput(input: any): void {
|
||||
if (!input.collectionMint || typeof input.collectionMint !== "string") {
|
||||
throw new Error("collectionMint is required and must be a string");
|
||||
}
|
||||
if (!input.metadata || typeof input.metadata !== "object") {
|
||||
throw new Error("metadata is required and must be an object");
|
||||
}
|
||||
if (!input.metadata.name || typeof input.metadata.name !== "string") {
|
||||
throw new Error("metadata.name is required and must be a string");
|
||||
}
|
||||
if (!input.metadata.symbol || typeof input.metadata.symbol !== "string") {
|
||||
throw new Error("metadata.symbol is required and must be a string");
|
||||
}
|
||||
if (!input.metadata.uri || typeof input.metadata.uri !== "string") {
|
||||
throw new Error("metadata.uri is required and must be a string");
|
||||
}
|
||||
if (input.recipient !== undefined && typeof input.recipient !== "string") {
|
||||
throw new Error("recipient must be a string when provided");
|
||||
}
|
||||
}
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const { collectionMint, metadata, recipient } = JSON.parse(input);
|
||||
const recipientPubkey = recipient ? new PublicKey(recipient) : undefined;
|
||||
const parsedInput = toJSON(input);
|
||||
this.validateInput(parsedInput);
|
||||
|
||||
const result = await this.solanaKit.mintNFT(
|
||||
new PublicKey(collectionMint),
|
||||
metadata,
|
||||
recipientPubkey,
|
||||
new PublicKey(parsedInput.collectionMint),
|
||||
parsedInput.metadata,
|
||||
parsedInput.recipient ? new PublicKey(parsedInput.recipient) : undefined
|
||||
);
|
||||
return `NFT minted successfully. Mint address: ${result.mint.toString()}`;
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "NFT minted successfully",
|
||||
mintAddress: result.mint.toString(),
|
||||
name: parsedInput.metadata.name,
|
||||
recipient: parsedInput.recipient || result.mint.toString(),
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error minting NFT: ${error.message}`;
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class SolanaTradeTool extends Tool {
|
||||
name = "solana_trade";
|
||||
description =
|
||||
"Swap tokens using Jupiter Exchange. Input should be JSON with: {outputMint: string, inputAmount: number, inputMint?: string, slippageBps?: number}";
|
||||
description = `This tool can be used to swap tokens to another token ( It uses Jupiter Exchange ).
|
||||
|
||||
Inputs ( input is a JSON string ):
|
||||
outputMint: string, eg "So11111111111111111111111111111111111111112" or "SENDdRQtYMWaQrBroBrJ2Q53fgVuq95CV9UPGEvpCxa" (required)
|
||||
inputAmount: number, eg 1 or 0.01 (required)
|
||||
inputMint?: string, eg "So11111111111111111111111111111111111111112" (optional)
|
||||
slippageBps?: number, eg 100 (optional)`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(input: string): Promise<string> {
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const { outputMint, inputAmount, inputMint, slippageBps } =
|
||||
JSON.parse(input);
|
||||
const parsedInput = JSON.parse(input);
|
||||
|
||||
const tx = await this.solanaKit.trade(
|
||||
new PublicKey(outputMint),
|
||||
inputAmount,
|
||||
inputMint ? new PublicKey(inputMint) : undefined,
|
||||
slippageBps,
|
||||
new PublicKey(parsedInput.outputMint),
|
||||
parsedInput.inputAmount,
|
||||
parsedInput.inputMint
|
||||
? new PublicKey(parsedInput.inputMint)
|
||||
: new PublicKey("So11111111111111111111111111111111111111112"),
|
||||
parsedInput.slippageBps
|
||||
);
|
||||
return `Trade executed successfully. Transaction: ${tx}`;
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Trade executed successfully",
|
||||
transaction: tx,
|
||||
inputAmount: parsedInput.inputAmount,
|
||||
inputToken: parsedInput.inputMint || "SOL",
|
||||
outputToken: parsedInput.outputMint,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error executing trade: ${error.message}`;
|
||||
console.log(error);
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,39 +320,80 @@ export class SolanaRequestFundsTool extends Tool {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(_input: string): Promise<string> {
|
||||
protected async _call(_input: string): Promise<string> {
|
||||
try {
|
||||
await this.solanaKit.requestFaucetFunds();
|
||||
return "Successfully requested faucet funds";
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Successfully requested faucet funds",
|
||||
network: this.solanaKit.connection.rpcEndpoint.split("/")[2],
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error requesting funds: ${error.message}`;
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class SolanaRegisterDomainTool extends Tool {
|
||||
name = "solana_register_domain";
|
||||
description =
|
||||
"Register a .sol domain name. Input should be JSON with: {name: string, spaceKB?: number}";
|
||||
description = `Register a .sol domain name for your wallet.
|
||||
|
||||
Inputs:
|
||||
name: string, eg "pumpfun.sol" (required)
|
||||
spaceKB: number, eg 1 (optional, default is 1)
|
||||
`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(input: string): Promise<string> {
|
||||
private validateInput(input: any): void {
|
||||
if (!input.name || typeof input.name !== "string") {
|
||||
throw new Error("name is required and must be a string");
|
||||
}
|
||||
if (
|
||||
input.spaceKB !== undefined &&
|
||||
(typeof input.spaceKB !== "number" || input.spaceKB <= 0)
|
||||
) {
|
||||
throw new Error("spaceKB must be a positive number when provided");
|
||||
}
|
||||
}
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const { name, spaceKB = 1 } = JSON.parse(input);
|
||||
const tx = await this.solanaKit.registerDomain(name, spaceKB);
|
||||
return `Domain registered successfully. Transaction: ${tx}`;
|
||||
const parsedInput = toJSON(input);
|
||||
this.validateInput(parsedInput);
|
||||
|
||||
const tx = await this.solanaKit.registerDomain(
|
||||
parsedInput.name,
|
||||
parsedInput.spaceKB || 1
|
||||
);
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Domain registered successfully",
|
||||
transaction: tx,
|
||||
domain: `${parsedInput.name}.sol`,
|
||||
spaceKB: parsedInput.spaceKB || 1,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error registering domain: ${error.message}`;
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class SolanaGetWalletAddressTool extends Tool {
|
||||
name = "solana_get_wallet_address";
|
||||
description = "Get the wallet address of the agent";
|
||||
description = `Get the wallet address of the agent`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
@@ -190,74 +404,119 @@ export class SolanaGetWalletAddressTool extends Tool {
|
||||
}
|
||||
}
|
||||
|
||||
export class SolanaLendAssetTool extends Tool {
|
||||
name = "solana_lend_asset";
|
||||
description =
|
||||
"Lend idle assets for yield using Lulo. Input should be JSON with: {asset: string, amount: number, luloApiKey: string}";
|
||||
export class SolanaPumpfunTokenLaunchTool extends Tool {
|
||||
name = "solana_launch_pumpfun_token";
|
||||
|
||||
description = `This tool can be used to launch a token on Pump.fun,
|
||||
do not use this tool for any other purpose, or for creating SPL tokens.
|
||||
If the user asks you to chose the parameters, you should generate valid values.
|
||||
For generating the image, you can use the solana_create_image tool.
|
||||
|
||||
Inputs:
|
||||
tokenName: string, eg "PumpFun Token",
|
||||
tokenTicker: string, eg "PUMP",
|
||||
description: string, eg "PumpFun Token is a token on the Solana blockchain",
|
||||
imageUrl: string, eg "https://i.imgur.com/UFm07Np_d.png`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const { asset, amount, luloApiKey } = JSON.parse(input);
|
||||
private validateInput(input: any): void {
|
||||
console.log(input);
|
||||
if (!input.tokenName || typeof input.tokenName !== "string") {
|
||||
throw new Error("tokenName is required and must be a string");
|
||||
}
|
||||
if (!input.tokenTicker || typeof input.tokenTicker !== "string") {
|
||||
throw new Error("tokenTicker is required and must be a string");
|
||||
}
|
||||
if (!input.description || typeof input.description !== "string") {
|
||||
throw new Error("description is required and must be a string");
|
||||
}
|
||||
if (!input.imageUrl || typeof input.imageUrl !== "string") {
|
||||
throw new Error("imageUrl is required and must be a string");
|
||||
}
|
||||
if (
|
||||
input.initialLiquiditySOL !== undefined &&
|
||||
typeof input.initialLiquiditySOL !== "number"
|
||||
) {
|
||||
throw new Error("initialLiquiditySOL must be a number when provided");
|
||||
}
|
||||
}
|
||||
|
||||
const tx = await this.solanaKit.lendAssets(
|
||||
new PublicKey(asset),
|
||||
amount,
|
||||
luloApiKey,
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
// Parse and normalize input
|
||||
input = input.trim();
|
||||
let parsedInput = JSON.parse(input);
|
||||
|
||||
this.validateInput(parsedInput);
|
||||
|
||||
// Launch token with validated input
|
||||
await this.solanaKit.launchPumpFunToken(
|
||||
parsedInput.tokenName,
|
||||
parsedInput.tokenTicker,
|
||||
parsedInput.description,
|
||||
parsedInput.imageUrl,
|
||||
{
|
||||
twitter: parsedInput.twitter,
|
||||
telegram: parsedInput.telegram,
|
||||
website: parsedInput.website,
|
||||
initialLiquiditySOL: parsedInput.initialLiquiditySOL,
|
||||
}
|
||||
);
|
||||
|
||||
return `Asset lent successfully. Transaction: ${tx}`;
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Token launched successfully on Pump.fun",
|
||||
tokenName: parsedInput.tokenName,
|
||||
tokenTicker: parsedInput.tokenTicker,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error lending asset: ${error.message}`;
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class SolanaFetchLendingDetailsTool extends Tool {
|
||||
name = "solana_get_lending_details";
|
||||
export class SolanaCreateImageTool extends Tool {
|
||||
name = "solana_create_image";
|
||||
description =
|
||||
"Get details of assets lent on Lulo. Input should be JSON with: {luloApiKey: string}";
|
||||
"Create an image using OpenAI's DALL-E. Input should be a string prompt for the image.";
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(input: string): Promise<string> {
|
||||
private validateInput(input: string): void {
|
||||
if (typeof input !== "string" || input.trim().length === 0) {
|
||||
throw new Error("Input must be a non-empty string prompt");
|
||||
}
|
||||
}
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const { luloApiKey } = JSON.parse(input);
|
||||
this.validateInput(input);
|
||||
const result = await create_image(this.solanaKit, input.trim());
|
||||
|
||||
const lendingDetails =
|
||||
await this.solanaKit.fetchLendingDetails(luloApiKey);
|
||||
|
||||
return `Lending details: ${lendingDetails}`;
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Image created successfully",
|
||||
...result,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return `Error fetching lending details: ${error.message}`;
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class SolanaTPSCalculatorTool extends Tool {
|
||||
name = "solana_get_tps";
|
||||
description = "Get the current TPS of the Solana network";
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
}
|
||||
|
||||
async _call(_input: string): Promise<string> {
|
||||
try {
|
||||
const tps = await this.solanaKit.getTPS();
|
||||
return `Solana (mainnet-beta) current transactions per second: ${tps}`;
|
||||
} catch (error: any) {
|
||||
return `Error fetching TPS: ${error.message}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Updated createSolanaTools function
|
||||
export function createSolanaTools(solanaKit: SolanaAgentKit) {
|
||||
return [
|
||||
new SolanaBalanceTool(solanaKit),
|
||||
@@ -269,8 +528,7 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) {
|
||||
new SolanaRequestFundsTool(solanaKit),
|
||||
new SolanaRegisterDomainTool(solanaKit),
|
||||
new SolanaGetWalletAddressTool(solanaKit),
|
||||
new SolanaLendAssetTool(solanaKit),
|
||||
new SolanaFetchLendingDetailsTool(solanaKit),
|
||||
new SolanaTPSCalculatorTool(solanaKit),
|
||||
new SolanaPumpfunTokenLaunchTool(solanaKit),
|
||||
new SolanaCreateImageTool(solanaKit),
|
||||
];
|
||||
}
|
||||
|
||||
40
src/tools/create_image.ts
Normal file
40
src/tools/create_image.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import OpenAI from "openai";
|
||||
|
||||
/**
|
||||
* Generate an image using OpenAI's DALL-E
|
||||
* @param agent SolanaAgentKit instance
|
||||
* @param prompt Text description of the image to generate
|
||||
* @param size Image size ('256x256', '512x512', or '1024x1024') (default: '1024x1024')
|
||||
* @param n Number of images to generate (default: 1)
|
||||
* @returns Object containing the generated image URLs
|
||||
*/
|
||||
export async function create_image(
|
||||
agent: SolanaAgentKit,
|
||||
prompt: string,
|
||||
size: "256x256" | "512x512" | "1024x1024" = "1024x1024",
|
||||
n: number = 1
|
||||
) {
|
||||
try {
|
||||
if (!agent.openai_api_key) {
|
||||
throw new Error("OpenAI API key not found in agent configuration");
|
||||
}
|
||||
|
||||
const openai = new OpenAI({
|
||||
apiKey: agent.openai_api_key
|
||||
});
|
||||
|
||||
const response = await openai.images.generate({
|
||||
prompt,
|
||||
n,
|
||||
size,
|
||||
});
|
||||
|
||||
return {
|
||||
images: response.data.map((img) => img.url),
|
||||
};
|
||||
|
||||
} catch (error: any) {
|
||||
throw new Error(`Image generation failed: ${error.message}`);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
export * from "./request_faucet_funds";
|
||||
export * from "./deploy_token";
|
||||
export * from "./deploy_collection";
|
||||
export * from "./get_balance";
|
||||
export * from "./mint_nft";
|
||||
export * from "./transfer";
|
||||
export * from "./trade";
|
||||
export * from "./register_domain";
|
||||
export * from "./lend";
|
||||
export * from "./get_tps";
|
||||
export * from './request_faucet_funds';
|
||||
export * from './deploy_token';
|
||||
export * from './deploy_collection';
|
||||
export * from './get_balance';
|
||||
export * from './mint_nft';
|
||||
export * from './transfer';
|
||||
export * from './trade';
|
||||
export * from './register_domain';
|
||||
export * from './launch_pumpfun_token';
|
||||
|
||||
192
src/tools/launch_pumpfun_token.ts
Normal file
192
src/tools/launch_pumpfun_token.ts
Normal file
@@ -0,0 +1,192 @@
|
||||
// src/tools/launch_pumpfun_token.ts
|
||||
import { VersionedTransaction, Keypair } from "@solana/web3.js";
|
||||
import { PumpFunTokenOptions, SolanaAgentKit } from "../index";
|
||||
|
||||
async function uploadMetadata(
|
||||
tokenName: string,
|
||||
tokenTicker: string,
|
||||
description: string,
|
||||
imageUrl: string,
|
||||
options?: PumpFunTokenOptions
|
||||
): Promise<any> {
|
||||
// Create metadata object
|
||||
const formData = new URLSearchParams();
|
||||
formData.append('name', tokenName);
|
||||
formData.append("symbol", tokenTicker);
|
||||
formData.append("description", description);
|
||||
|
||||
formData.append("showName", "true");
|
||||
|
||||
if (options?.twitter) formData.append('twitter', options.twitter);
|
||||
if (options?.telegram) formData.append("telegram", options.telegram);
|
||||
if (options?.website) formData.append("website", options.website);
|
||||
|
||||
const imageResponse = await fetch(imageUrl);
|
||||
const imageBlob = await imageResponse.blob();
|
||||
const files = {
|
||||
file: new File([imageBlob], "token_image.png", { type: "image/png" }),
|
||||
};
|
||||
|
||||
// Create form data with both metadata and file
|
||||
const finalFormData = new FormData();
|
||||
// Add all metadata fields
|
||||
for (const [key, value] of formData.entries()) {
|
||||
finalFormData.append(key, value);
|
||||
}
|
||||
// Add file if exists
|
||||
if (files?.file) {
|
||||
finalFormData.append('file', files.file);
|
||||
}
|
||||
|
||||
console.log("Final form data:", finalFormData);
|
||||
|
||||
const metadataResponse = await fetch("https://pump.fun/api/ipfs", {
|
||||
method: "POST",
|
||||
body: finalFormData
|
||||
});
|
||||
|
||||
if (!metadataResponse.ok) {
|
||||
console.log("Metadata response:", await metadataResponse.json());
|
||||
throw new Error(`Metadata upload failed: ${metadataResponse.statusText}`);
|
||||
}
|
||||
|
||||
return await metadataResponse.json();
|
||||
}
|
||||
|
||||
async function createTokenTransaction(
|
||||
agent: SolanaAgentKit,
|
||||
mintKeypair: Keypair,
|
||||
metadataResponse: any,
|
||||
options?: PumpFunTokenOptions
|
||||
) {
|
||||
const payload = {
|
||||
publicKey: agent.wallet_address.toBase58(),
|
||||
action: "create",
|
||||
tokenMetadata: {
|
||||
name: metadataResponse.metadata.name,
|
||||
symbol: metadataResponse.metadata.symbol,
|
||||
uri: metadataResponse.metadataUri,
|
||||
},
|
||||
mint: mintKeypair.publicKey.toBase58(),
|
||||
denominatedInSol: "true", // API expects string "true"
|
||||
amount: options?.initialLiquiditySOL || 0.0001,
|
||||
slippage: options?.slippageBps || 5,
|
||||
priorityFee: options?.priorityFee || 0.00005,
|
||||
pool: "pump",
|
||||
};
|
||||
|
||||
const response = await fetch("https://pumpportal.fun/api/trade-local", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
throw new Error(`Transaction creation failed: ${response.status} - ${errorText}`);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
async function signAndSendTransaction(
|
||||
kit: SolanaAgentKit,
|
||||
tx: VersionedTransaction,
|
||||
mintKeypair: Keypair
|
||||
) {
|
||||
try {
|
||||
// Get the latest blockhash
|
||||
const { blockhash, lastValidBlockHeight } = await kit.connection.getLatestBlockhash();
|
||||
|
||||
// Update transaction with latest blockhash
|
||||
tx.message.recentBlockhash = blockhash;
|
||||
|
||||
// Sign the transaction
|
||||
tx.sign([mintKeypair, kit.wallet]);
|
||||
|
||||
// Send and confirm transaction with options
|
||||
const signature = await kit.connection.sendTransaction(tx, {
|
||||
skipPreflight: false,
|
||||
preflightCommitment: 'confirmed',
|
||||
maxRetries: 5
|
||||
});
|
||||
|
||||
// Wait for confirmation
|
||||
const confirmation = await kit.connection.confirmTransaction({
|
||||
signature,
|
||||
blockhash,
|
||||
lastValidBlockHeight
|
||||
});
|
||||
|
||||
if (confirmation.value.err) {
|
||||
throw new Error(`Transaction failed: ${confirmation.value.err}`);
|
||||
}
|
||||
|
||||
return signature;
|
||||
} catch (error) {
|
||||
console.error('Transaction send error:', error);
|
||||
if (error instanceof Error && 'logs' in error) {
|
||||
console.error('Transaction logs:', error.logs);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch a token on Pump.fun
|
||||
* @param agent - SolanaAgentKit instance
|
||||
* @param tokenName - Name of the token
|
||||
* @param tokenTicker - Ticker of the token
|
||||
* @param description - Description of the token
|
||||
* @param imageUrl - URL of the token image
|
||||
* @param options - Optional token options (twitter, telegram, website, initialLiquiditySOL, slippageBps, priorityFee)
|
||||
*/
|
||||
export async function launchPumpFunToken(
|
||||
agent: SolanaAgentKit,
|
||||
tokenName: string,
|
||||
tokenTicker: string,
|
||||
description: string,
|
||||
imageUrl: string,
|
||||
options?: PumpFunTokenOptions
|
||||
) {
|
||||
try {
|
||||
// TBD : Remove clgs after approval
|
||||
console.log("Starting token launch process...");
|
||||
|
||||
// Generate mint keypair
|
||||
const mintKeypair = Keypair.generate();
|
||||
console.log("Mint public key:", mintKeypair.publicKey.toBase58());
|
||||
|
||||
// Upload metadata
|
||||
console.log("Uploading metadata to IPFS...");
|
||||
const metadataResponse = await uploadMetadata(tokenName, tokenTicker, description, imageUrl, options);
|
||||
console.log("Metadata response:", metadataResponse);
|
||||
|
||||
// Create token transaction
|
||||
console.log("Creating token transaction...");
|
||||
const response = await createTokenTransaction(agent, mintKeypair, metadataResponse, options);
|
||||
|
||||
const transactionData = await response.arrayBuffer();
|
||||
const tx = VersionedTransaction.deserialize(new Uint8Array(transactionData));
|
||||
|
||||
// Send transaction with proper blockhash handling
|
||||
console.log("Sending transaction...");
|
||||
const signature = await signAndSendTransaction(agent, tx, mintKeypair);
|
||||
|
||||
console.log("Token launch successful!");
|
||||
return {
|
||||
signature,
|
||||
mint: mintKeypair.publicKey.toBase58(),
|
||||
metadataUri: metadataResponse.metadataUri,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error in launchpumpfuntoken:", error);
|
||||
if (error instanceof Error && 'logs' in error) {
|
||||
console.error('Transaction logs:', (error as any).logs);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { VersionedTransaction, PublicKey } from "@solana/web3.js";
|
||||
import { VersionedTransaction, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants";
|
||||
|
||||
@@ -20,12 +20,13 @@ export async function trade(
|
||||
): Promise<string> {
|
||||
try {
|
||||
// Get quote for the swap
|
||||
console.log(inputMint.toString(), outputMint.toString(), inputAmount, slippageBps);
|
||||
const quoteResponse = await (
|
||||
await fetch(
|
||||
`${JUP_API}/quote?` +
|
||||
`inputMint=${inputMint.toString()}` +
|
||||
`&outputMint=${outputMint.toString()}` +
|
||||
`&amount=${inputAmount}` +
|
||||
`&amount=${inputAmount * LAMPORTS_PER_SOL}` +
|
||||
`&slippageBps=${slippageBps}` +
|
||||
`&onlyDirectRoutes=true` +
|
||||
`&maxAccounts=20`,
|
||||
@@ -48,11 +49,10 @@ export async function trade(
|
||||
}),
|
||||
})
|
||||
).json();
|
||||
|
||||
// Deserialize transaction
|
||||
const swapTransactionBuf = Buffer.from(swapTransaction, "base64");
|
||||
const transaction = VersionedTransaction.deserialize(swapTransactionBuf);
|
||||
|
||||
const transaction = VersionedTransaction.deserialize(swapTransactionBuf);
|
||||
// Sign and send transaction
|
||||
transaction.sign([agent.wallet]);
|
||||
const signature = await agent.connection.sendTransaction(transaction);
|
||||
|
||||
@@ -24,6 +24,23 @@ export interface MintCollectionNFTResponse {
|
||||
metadata: PublicKey;
|
||||
}
|
||||
|
||||
export interface PumpFunTokenOptions {
|
||||
twitter?: string;
|
||||
telegram?: string;
|
||||
website?: string;
|
||||
initialLiquiditySOL?: number;
|
||||
slippageBps?: number;
|
||||
priorityFee?: number;
|
||||
}
|
||||
|
||||
export interface PumpfunLaunchResponse {
|
||||
signature: string;
|
||||
mint: string;
|
||||
metadataUri?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mint addresses of supported tokens for lending on Lulo
|
||||
*/
|
||||
|
||||
26
src/utils/toJSON.ts
Normal file
26
src/utils/toJSON.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
export const toJSON = (str: string): any => {
|
||||
try {
|
||||
// Remove curly braces and split by comma
|
||||
const pairs = str.trim().slice(1, -1).split(",");
|
||||
|
||||
// Convert to object with explicit type
|
||||
const obj: Record<string, any> = {};
|
||||
|
||||
pairs.forEach((pair) => {
|
||||
const [key, value] = pair
|
||||
.trim()
|
||||
.split(":")
|
||||
.map((s) => s.trim());
|
||||
|
||||
if (!key || value === undefined) {
|
||||
throw new Error("Invalid key-value pair format");
|
||||
}
|
||||
|
||||
obj[key] = isNaN(Number(value)) ? value : Number(value);
|
||||
});
|
||||
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to parse string to JSON: ${error}`);
|
||||
}
|
||||
};
|
||||
194
test/index.ts
194
test/index.ts
@@ -1,42 +1,168 @@
|
||||
// import { SolanaAgentKit } from "../src";
|
||||
// import { createSolanaTools } from "../src/langchain";
|
||||
// import { OpenAI } from "@langchain/openai";
|
||||
// import { AgentExecutor } from "langchain/agents";
|
||||
// import { PromptTemplate } from "@langchain/core/prompts";
|
||||
// import { pull } from "langchain/hub";
|
||||
// import { createReactAgent } from "langchain/agents";
|
||||
import { SolanaAgentKit } from "../src";
|
||||
import { createSolanaTools } from "../src/langchain";
|
||||
import { OpenAI } from "@langchain/openai";
|
||||
import { AgentExecutor } from "langchain/agents";
|
||||
import { PromptTemplate } from "@langchain/core/prompts";
|
||||
import { pull } from "langchain/hub";
|
||||
import { createReactAgent } from "langchain/agents";
|
||||
import { HumanMessage, AIMessage, BaseMessage } from "@langchain/core/messages";
|
||||
import * as readline from "readline";
|
||||
|
||||
// // Initialize SolanaAgentKit
|
||||
// const solanaKit = new SolanaAgentKit(undefined, "rpc-url");
|
||||
async function initializeAgent() {
|
||||
const solanaKit = new SolanaAgentKit(
|
||||
"5wuqAMP68kNiqs935hDfYkm9ngLzPAxWwYuk12eqVvdMVGJfaVcmYgcz8Met7w61goYubwegRJ7btEBWYsBtpubU",
|
||||
"https://mainnet.helius-rpc.com/?api-key=da5b04e7-ae1c-4474-ae18-cf81af2b0653"
|
||||
);
|
||||
|
||||
// // Create Solana-specific tools
|
||||
// const tools = createSolanaTools(solanaKit);
|
||||
// Create Solana-specific tools
|
||||
const tools = createSolanaTools(solanaKit);
|
||||
|
||||
// (async () => {
|
||||
// // Define a Prompt Template for the Agent
|
||||
// const prompt = await pull<PromptTemplate>("hwchase17/react");
|
||||
// Create an LLM Chain
|
||||
const llm = new OpenAI({
|
||||
modelName: "gpt-4o-mini",
|
||||
temperature: 0.7,
|
||||
});
|
||||
|
||||
// // Create an LLM Chain
|
||||
// const llm = new OpenAI({
|
||||
// modelName: "gpt-4o-mini",
|
||||
// temperature: 0,
|
||||
// });
|
||||
const prompt = await pull<PromptTemplate>("hwchase17/react");
|
||||
|
||||
// const agent = await createReactAgent({
|
||||
// llm,
|
||||
// tools,
|
||||
// prompt,
|
||||
// });
|
||||
const agent = await createReactAgent({
|
||||
llm,
|
||||
tools,
|
||||
prompt,
|
||||
});
|
||||
|
||||
// const agentExecutor = new AgentExecutor({
|
||||
// agent,
|
||||
// tools,
|
||||
// maxIterations: 50,
|
||||
// });
|
||||
const agentExecutor = new AgentExecutor({
|
||||
agent,
|
||||
tools,
|
||||
maxIterations: 5,
|
||||
});
|
||||
|
||||
// const result = await agentExecutor.invoke({
|
||||
// input: "Deploy a token with 6 decimals ",
|
||||
// });
|
||||
return { agentExecutor };
|
||||
}
|
||||
|
||||
// console.log(result);
|
||||
// })();
|
||||
async function runAutonomousMode(
|
||||
agentExecutor: AgentExecutor,
|
||||
interval: number = 10000
|
||||
) {
|
||||
console.log("Starting autonomous mode...");
|
||||
|
||||
// Initialize message history
|
||||
const messageHistory: BaseMessage[] = [];
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
// Use the same thought prompt as in the Python example
|
||||
const thought =
|
||||
"Be creative and do something interesting on the blockchain. " +
|
||||
"Choose an action or set of actions and execute it that highlights your abilities.";
|
||||
|
||||
const result = await agentExecutor.invoke({
|
||||
input: thought, // Changed from messages to input
|
||||
history: messageHistory,
|
||||
returnIntermediateSteps: true,
|
||||
});
|
||||
|
||||
console.log(result);
|
||||
|
||||
// Add the interaction to history
|
||||
messageHistory.push(new HumanMessage(thought));
|
||||
messageHistory.push(new AIMessage(result.output));
|
||||
|
||||
console.log(result.output);
|
||||
console.log("-------------------");
|
||||
|
||||
// Wait before the next action
|
||||
await new Promise((resolve) => setTimeout(resolve, interval));
|
||||
} catch (error) {
|
||||
console.error("Error in autonomous mode:", error);
|
||||
await new Promise((resolve) => setTimeout(resolve, interval));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function runChatMode(agentExecutor: AgentExecutor) {
|
||||
console.log("Starting chat mode... Type 'exit' to end.");
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
// Initialize message history
|
||||
const messageHistory: BaseMessage[] = [];
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
const userInput = await new Promise<string>((resolve) => {
|
||||
rl.question("\nUser: ", resolve);
|
||||
});
|
||||
|
||||
if (userInput.toLowerCase() === "exit") {
|
||||
break;
|
||||
}
|
||||
|
||||
const result = await agentExecutor.invoke({
|
||||
input: userInput, // Changed from messages to input
|
||||
history: messageHistory,
|
||||
});
|
||||
|
||||
// Add the interaction to history
|
||||
messageHistory.push(new HumanMessage(userInput));
|
||||
messageHistory.push(new AIMessage(result.output));
|
||||
|
||||
console.log(result.output);
|
||||
console.log("-------------------");
|
||||
} catch (error) {
|
||||
console.error("Error in chat mode:", error);
|
||||
}
|
||||
}
|
||||
|
||||
rl.close();
|
||||
}
|
||||
|
||||
function chooseMode(): Promise<string> {
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
console.log("\nAvailable modes:");
|
||||
console.log("1. chat - Interactive chat mode");
|
||||
console.log("2. auto - Autonomous action mode");
|
||||
|
||||
return new Promise((resolve) => {
|
||||
rl.question("\nChoose a mode (enter number or name): ", (answer) => {
|
||||
rl.close();
|
||||
const mode = answer.toLowerCase().trim();
|
||||
if (mode === "1" || mode === "chat") {
|
||||
resolve("chat");
|
||||
} else if (mode === "2" || mode === "auto") {
|
||||
resolve("auto");
|
||||
} else {
|
||||
console.log("Invalid choice. Defaulting to chat mode.");
|
||||
resolve("chat");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log("Starting Agent...");
|
||||
const { agentExecutor } = await initializeAgent();
|
||||
|
||||
const mode = await chooseMode();
|
||||
if (mode === "chat") {
|
||||
await runChatMode(agentExecutor);
|
||||
} else {
|
||||
await runAutonomousMode(agentExecutor);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Ctrl+C gracefully
|
||||
process.on("SIGINT", () => {
|
||||
console.log("\nGoodbye Agent!");
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
// Start the agent
|
||||
main().catch(console.error);
|
||||
|
||||
@@ -10,21 +10,15 @@
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictBindCallApply": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"noImplicitThis": true,
|
||||
"useUnknownInCatchVariables": true,
|
||||
"alwaysStrict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"exactOptionalPropertyTypes": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true,
|
||||
|
||||
Reference in New Issue
Block a user