mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-14 07:26:46 +00:00
feat: created tiplink for Sol and spl tokens (#64)
# Pull Request Description Agent can now create links with sol and spl tokens ## Related Issue Fixes #21 ## Changes Made This PR adds the following changes: <!-- List the key changes made in this PR --> - Added support for tiplinks for SOL - Also supports spl tokens ## Transaction executed by agent <!-- If applicable, provide example usage, transactions, or screenshots --> Example transaction:   ## Prompt Used <!-- If relevant, include the prompt or configuration used --> ```create me a tiplink for 0.001 sol``` ## Checklist - [x] I have tested these changes locally - [ ] I have updated the documentation - [x] I have added a transaction link - [x] I have added the prompt used to test it
This commit is contained in:
11
package.json
11
package.json
@@ -42,6 +42,7 @@
|
||||
"@raydium-io/raydium-sdk-v2": "0.1.95-alpha",
|
||||
"@solana/spl-token": "^0.4.9",
|
||||
"@solana/web3.js": "^1.95.4",
|
||||
"@tiplink/api": "^0.3.1",
|
||||
"bn.js": "^5.2.1",
|
||||
"bs58": "^6.0.0",
|
||||
"chai": "^5.1.2",
|
||||
@@ -56,13 +57,13 @@
|
||||
"@types/bn.js": "^5.1.5",
|
||||
"@types/chai": "^5.0.1",
|
||||
"@types/node": "^22.9.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.7.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0",
|
||||
"prettier": "^3.2.5"
|
||||
"prettier": "^3.2.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
213
pnpm-lock.yaml
generated
213
pnpm-lock.yaml
generated
@@ -71,6 +71,9 @@ importers:
|
||||
'@solana/web3.js':
|
||||
specifier: ^1.95.4
|
||||
version: 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
|
||||
'@tiplink/api':
|
||||
specifier: ^0.3.1
|
||||
version: 0.3.1(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(sodium-native@3.4.1)(utf-8-validate@5.0.10)
|
||||
bn.js:
|
||||
specifier: ^5.2.1
|
||||
version: 5.2.1
|
||||
@@ -578,6 +581,12 @@ packages:
|
||||
peerDependencies:
|
||||
'@solana/web3.js': ^1.95.3
|
||||
|
||||
'@solana/spl-token@0.3.11':
|
||||
resolution: {integrity: sha512-bvohO3rIMSVL24Pb+I4EYTJ6cL82eFpInEXD/I8K8upOGjpqHsKUoAempR/RnUlI1qSFNyFlWJfu6MNUgfbCQQ==}
|
||||
engines: {node: '>=16'}
|
||||
peerDependencies:
|
||||
'@solana/web3.js': ^1.88.0
|
||||
|
||||
'@solana/spl-token@0.4.6':
|
||||
resolution: {integrity: sha512-1nCnUqfHVtdguFciVWaY/RKcQz1IF4b31jnKgAmjU9QVN1q7dRUkTEWJZgTYIEtsULjVnC9jRqlhgGN39WbKKA==}
|
||||
engines: {node: '>=16'}
|
||||
@@ -609,6 +618,9 @@ packages:
|
||||
'@swc/helpers@0.5.15':
|
||||
resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
|
||||
|
||||
'@tiplink/api@0.3.1':
|
||||
resolution: {integrity: sha512-HjnXethjKOHTYT0IP1BewlMS7wZJ+hsoDgRa6jA1cNvxvwQjE1WHOyvOUPpAi+DJDw4P4/omFtyHr7dwLfnB/g==}
|
||||
|
||||
'@tsconfig/node10@1.0.11':
|
||||
resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==}
|
||||
|
||||
@@ -822,6 +834,10 @@ packages:
|
||||
base64-js@1.5.1:
|
||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||
|
||||
big-integer@1.6.52:
|
||||
resolution: {integrity: sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==}
|
||||
engines: {node: '>=0.6'}
|
||||
|
||||
big.js@6.2.2:
|
||||
resolution: {integrity: sha512-y/ie+Faknx7sZA5MfGA2xKlu0GDv8RWrXGsmlteyJQ2lvoKv9GBK/fpRMc2qlSoBAgNxrixICFCBefIq8WCQpQ==}
|
||||
|
||||
@@ -870,6 +886,9 @@ packages:
|
||||
resolution: {integrity: sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA==}
|
||||
engines: {node: '>=4.5'}
|
||||
|
||||
buffer@5.7.1:
|
||||
resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
|
||||
|
||||
buffer@6.0.3:
|
||||
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
|
||||
|
||||
@@ -1352,6 +1371,9 @@ packages:
|
||||
resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
is-typedarray@1.0.0:
|
||||
resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==}
|
||||
|
||||
isexe@2.0.0:
|
||||
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
||||
|
||||
@@ -1464,6 +1486,18 @@ packages:
|
||||
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
libsodium-sumo@0.7.15:
|
||||
resolution: {integrity: sha512-5tPmqPmq8T8Nikpm1Nqj0hBHvsLFCXvdhBFV7SGOitQPZAA6jso8XoL0r4L7vmfKXr486fiQInvErHtEvizFMw==}
|
||||
|
||||
libsodium-wrappers-sumo@0.7.15:
|
||||
resolution: {integrity: sha512-aSWY8wKDZh5TC7rMvEdTHoyppVq/1dTSAeAR7H6pzd6QRT3vQWcT5pGwCotLcpPEOLXX6VvqihSPkpEhYAjANA==}
|
||||
|
||||
libsodium-wrappers@0.7.15:
|
||||
resolution: {integrity: sha512-E4anqJQwcfiC6+Yrl01C1m8p99wEhLmJSs0VQqST66SbQXXBoaJY0pF4BNjRYa/sOQAxx6lXAaAFIlx+15tXJQ==}
|
||||
|
||||
libsodium@0.7.15:
|
||||
resolution: {integrity: sha512-sZwRknt/tUpE2AwzHq3jEyUU5uvIZHtSssktXq7owd++3CSgn8RGrv6UZJJBpP7+iBghBqe7Z06/2M31rI2NKw==}
|
||||
|
||||
linkify-it@5.0.0:
|
||||
resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
|
||||
|
||||
@@ -1554,6 +1588,11 @@ packages:
|
||||
resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==}
|
||||
hasBin: true
|
||||
|
||||
nanoid@3.3.8:
|
||||
resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
|
||||
natural-compare@1.4.0:
|
||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||
|
||||
@@ -1669,6 +1708,9 @@ packages:
|
||||
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
|
||||
engines: {node: '>=8.6'}
|
||||
|
||||
poly1305-js@0.4.4:
|
||||
resolution: {integrity: sha512-5B6/S+vg5AOr66wJDkh5LOpU/F3EKANDy4VXKsNZLXea1uCy6CiOWOZ3VhcC0nYdhE7vJUMcLxqcVlrv2g/+Rg==}
|
||||
|
||||
possible-typed-array-names@1.0.0:
|
||||
resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -1768,6 +1810,14 @@ packages:
|
||||
snake-case@3.0.4:
|
||||
resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==}
|
||||
|
||||
sodium-native@3.4.1:
|
||||
resolution: {integrity: sha512-PaNN/roiFWzVVTL6OqjzYct38NSXewdl2wz8SRB51Br/MLIJPrbM3XexhVWkq7D3UWMysfrhKVf1v1phZq6MeQ==}
|
||||
|
||||
sodium-plus@0.9.0:
|
||||
resolution: {integrity: sha512-WWKxrd81qDL7C1A10yxNmZ135yovEZuIRnZ/BIf/FcajYBupbKbPdgzwlusPHLVxkMDDamcarq9PxxRBUSqpCw==}
|
||||
peerDependencies:
|
||||
sodium-native: ^3.2.0
|
||||
|
||||
space-separated-tokens@2.0.2:
|
||||
resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}
|
||||
|
||||
@@ -1862,6 +1912,9 @@ packages:
|
||||
tslib@2.8.1:
|
||||
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||
|
||||
tweetnacl-util@0.15.1:
|
||||
resolution: {integrity: sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==}
|
||||
|
||||
tweetnacl@1.0.3:
|
||||
resolution: {integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==}
|
||||
|
||||
@@ -1873,6 +1926,9 @@ packages:
|
||||
resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
typedarray-to-buffer@3.1.5:
|
||||
resolution: {integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==}
|
||||
|
||||
typedoc@0.26.11:
|
||||
resolution: {integrity: sha512-sFEgRRtrcDl2FxVP58Ze++ZK2UQAEvtvvH8rRlig1Ja3o7dDaMHmaBfvJmdGnNEFaLTpQsN8dpvZaTqJSu/Ugw==}
|
||||
engines: {node: '>= 18'}
|
||||
@@ -1880,6 +1936,11 @@ packages:
|
||||
peerDependencies:
|
||||
typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x
|
||||
|
||||
typescript@4.9.5:
|
||||
resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==}
|
||||
engines: {node: '>=4.2.0'}
|
||||
hasBin: true
|
||||
|
||||
typescript@5.7.2:
|
||||
resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==}
|
||||
engines: {node: '>=14.17'}
|
||||
@@ -2001,6 +2062,9 @@ packages:
|
||||
utf-8-validate:
|
||||
optional: true
|
||||
|
||||
xsalsa20@1.2.0:
|
||||
resolution: {integrity: sha512-FIr/DEeoHfj7ftfylnoFt3rAIRoWXpx2AoDfrT2qD2wtp7Dp+COajvs/Icb7uHqRW9m60f5iXZwdsJJO3kvb7w==}
|
||||
|
||||
yaml@2.6.1:
|
||||
resolution: {integrity: sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==}
|
||||
engines: {node: '>= 14'}
|
||||
@@ -2514,6 +2578,11 @@ snapshots:
|
||||
'@solana/errors': 2.0.0-preview.4(typescript@5.7.2)
|
||||
typescript: 5.7.2
|
||||
|
||||
'@solana/codecs-core@2.0.0-rc.1(typescript@4.9.5)':
|
||||
dependencies:
|
||||
'@solana/errors': 2.0.0-rc.1(typescript@4.9.5)
|
||||
typescript: 4.9.5
|
||||
|
||||
'@solana/codecs-core@2.0.0-rc.1(typescript@5.7.2)':
|
||||
dependencies:
|
||||
'@solana/errors': 2.0.0-rc.1(typescript@5.7.2)
|
||||
@@ -2532,6 +2601,13 @@ snapshots:
|
||||
'@solana/errors': 2.0.0-preview.4(typescript@5.7.2)
|
||||
typescript: 5.7.2
|
||||
|
||||
'@solana/codecs-data-structures@2.0.0-rc.1(typescript@4.9.5)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/codecs-numbers': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/errors': 2.0.0-rc.1(typescript@4.9.5)
|
||||
typescript: 4.9.5
|
||||
|
||||
'@solana/codecs-data-structures@2.0.0-rc.1(typescript@5.7.2)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2)
|
||||
@@ -2550,6 +2626,12 @@ snapshots:
|
||||
'@solana/errors': 2.0.0-preview.4(typescript@5.7.2)
|
||||
typescript: 5.7.2
|
||||
|
||||
'@solana/codecs-numbers@2.0.0-rc.1(typescript@4.9.5)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/errors': 2.0.0-rc.1(typescript@4.9.5)
|
||||
typescript: 4.9.5
|
||||
|
||||
'@solana/codecs-numbers@2.0.0-rc.1(typescript@5.7.2)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2)
|
||||
@@ -2571,6 +2653,14 @@ snapshots:
|
||||
fastestsmallesttextencoderdecoder: 1.0.22
|
||||
typescript: 5.7.2
|
||||
|
||||
'@solana/codecs-strings@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/codecs-numbers': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/errors': 2.0.0-rc.1(typescript@4.9.5)
|
||||
fastestsmallesttextencoderdecoder: 1.0.22
|
||||
typescript: 4.9.5
|
||||
|
||||
'@solana/codecs-strings@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2)
|
||||
@@ -2600,6 +2690,17 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- fastestsmallesttextencoderdecoder
|
||||
|
||||
'@solana/codecs@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/codecs-data-structures': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/codecs-numbers': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/codecs-strings': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)
|
||||
'@solana/options': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)
|
||||
typescript: 4.9.5
|
||||
transitivePeerDependencies:
|
||||
- fastestsmallesttextencoderdecoder
|
||||
|
||||
'@solana/codecs@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2)
|
||||
@@ -2622,6 +2723,12 @@ snapshots:
|
||||
commander: 12.1.0
|
||||
typescript: 5.7.2
|
||||
|
||||
'@solana/errors@2.0.0-rc.1(typescript@4.9.5)':
|
||||
dependencies:
|
||||
chalk: 5.4.0
|
||||
commander: 12.1.0
|
||||
typescript: 4.9.5
|
||||
|
||||
'@solana/errors@2.0.0-rc.1(typescript@5.7.2)':
|
||||
dependencies:
|
||||
chalk: 5.4.0
|
||||
@@ -2644,6 +2751,17 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- fastestsmallesttextencoderdecoder
|
||||
|
||||
'@solana/options@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/codecs-data-structures': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/codecs-numbers': 2.0.0-rc.1(typescript@4.9.5)
|
||||
'@solana/codecs-strings': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)
|
||||
'@solana/errors': 2.0.0-rc.1(typescript@4.9.5)
|
||||
typescript: 4.9.5
|
||||
transitivePeerDependencies:
|
||||
- fastestsmallesttextencoderdecoder
|
||||
|
||||
'@solana/options@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)':
|
||||
dependencies:
|
||||
'@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2)
|
||||
@@ -2688,6 +2806,14 @@ snapshots:
|
||||
- fastestsmallesttextencoderdecoder
|
||||
- typescript
|
||||
|
||||
'@solana/spl-token-metadata@0.1.6(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)':
|
||||
dependencies:
|
||||
'@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)
|
||||
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
|
||||
transitivePeerDependencies:
|
||||
- fastestsmallesttextencoderdecoder
|
||||
- typescript
|
||||
|
||||
'@solana/spl-token-metadata@0.1.6(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)':
|
||||
dependencies:
|
||||
'@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)
|
||||
@@ -2696,6 +2822,20 @@ snapshots:
|
||||
- fastestsmallesttextencoderdecoder
|
||||
- typescript
|
||||
|
||||
'@solana/spl-token@0.3.11(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)(utf-8-validate@5.0.10)':
|
||||
dependencies:
|
||||
'@solana/buffer-layout': 4.0.1
|
||||
'@solana/buffer-layout-utils': 0.2.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
|
||||
'@solana/spl-token-metadata': 0.1.6(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)
|
||||
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
|
||||
buffer: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- encoding
|
||||
- fastestsmallesttextencoderdecoder
|
||||
- typescript
|
||||
- utf-8-validate
|
||||
|
||||
'@solana/spl-token@0.4.6(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)':
|
||||
dependencies:
|
||||
'@solana/buffer-layout': 4.0.1
|
||||
@@ -2793,6 +2933,26 @@ snapshots:
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
|
||||
'@tiplink/api@0.3.1(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(sodium-native@3.4.1)(utf-8-validate@5.0.10)':
|
||||
dependencies:
|
||||
'@coral-xyz/anchor': 0.29.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
|
||||
'@solana/spl-token': 0.3.11(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)(utf-8-validate@5.0.10)
|
||||
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
|
||||
bs58: 5.0.0
|
||||
libsodium: 0.7.15
|
||||
libsodium-wrappers-sumo: 0.7.15
|
||||
nanoid: 3.3.8
|
||||
sodium-plus: 0.9.0(sodium-native@3.4.1)
|
||||
tweetnacl: 1.0.3
|
||||
tweetnacl-util: 0.15.1
|
||||
typescript: 4.9.5
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- encoding
|
||||
- fastestsmallesttextencoderdecoder
|
||||
- sodium-native
|
||||
- utf-8-validate
|
||||
|
||||
'@tsconfig/node10@1.0.11': {}
|
||||
|
||||
'@tsconfig/node12@1.0.11': {}
|
||||
@@ -3026,6 +3186,8 @@ snapshots:
|
||||
|
||||
base64-js@1.5.1: {}
|
||||
|
||||
big-integer@1.6.52: {}
|
||||
|
||||
big.js@6.2.2: {}
|
||||
|
||||
bigint-buffer@1.1.5:
|
||||
@@ -3077,6 +3239,11 @@ snapshots:
|
||||
|
||||
buffer-layout@1.2.2: {}
|
||||
|
||||
buffer@5.7.1:
|
||||
dependencies:
|
||||
base64-js: 1.5.1
|
||||
ieee754: 1.2.1
|
||||
|
||||
buffer@6.0.3:
|
||||
dependencies:
|
||||
base64-js: 1.5.1
|
||||
@@ -3572,6 +3739,8 @@ snapshots:
|
||||
dependencies:
|
||||
which-typed-array: 1.1.18
|
||||
|
||||
is-typedarray@1.0.0: {}
|
||||
|
||||
isexe@2.0.0: {}
|
||||
|
||||
isomorphic-ws@4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)):
|
||||
@@ -3672,6 +3841,18 @@ snapshots:
|
||||
prelude-ls: 1.2.1
|
||||
type-check: 0.4.0
|
||||
|
||||
libsodium-sumo@0.7.15: {}
|
||||
|
||||
libsodium-wrappers-sumo@0.7.15:
|
||||
dependencies:
|
||||
libsodium-sumo: 0.7.15
|
||||
|
||||
libsodium-wrappers@0.7.15:
|
||||
dependencies:
|
||||
libsodium: 0.7.15
|
||||
|
||||
libsodium@0.7.15: {}
|
||||
|
||||
linkify-it@5.0.0:
|
||||
dependencies:
|
||||
uc.micro: 2.1.0
|
||||
@@ -3765,6 +3946,8 @@ snapshots:
|
||||
|
||||
mustache@4.2.0: {}
|
||||
|
||||
nanoid@3.3.8: {}
|
||||
|
||||
natural-compare@1.4.0: {}
|
||||
|
||||
no-case@3.0.4:
|
||||
@@ -3778,8 +3961,7 @@ snapshots:
|
||||
dependencies:
|
||||
whatwg-url: 5.0.0
|
||||
|
||||
node-gyp-build@4.8.4:
|
||||
optional: true
|
||||
node-gyp-build@4.8.4: {}
|
||||
|
||||
object-is@1.1.6:
|
||||
dependencies:
|
||||
@@ -3876,6 +4058,10 @@ snapshots:
|
||||
|
||||
picomatch@2.3.1: {}
|
||||
|
||||
poly1305-js@0.4.4:
|
||||
dependencies:
|
||||
big-integer: 1.6.52
|
||||
|
||||
possible-typed-array-names@1.0.0: {}
|
||||
|
||||
prelude-ls@1.2.1: {}
|
||||
@@ -3970,6 +4156,19 @@ snapshots:
|
||||
dot-case: 3.0.4
|
||||
tslib: 2.8.1
|
||||
|
||||
sodium-native@3.4.1:
|
||||
dependencies:
|
||||
node-gyp-build: 4.8.4
|
||||
|
||||
sodium-plus@0.9.0(sodium-native@3.4.1):
|
||||
dependencies:
|
||||
buffer: 5.7.1
|
||||
libsodium-wrappers: 0.7.15
|
||||
poly1305-js: 0.4.4
|
||||
sodium-native: 3.4.1
|
||||
typedarray-to-buffer: 3.1.5
|
||||
xsalsa20: 1.2.0
|
||||
|
||||
space-separated-tokens@2.0.2: {}
|
||||
|
||||
stringify-entities@4.0.4:
|
||||
@@ -4052,6 +4251,8 @@ snapshots:
|
||||
|
||||
tslib@2.8.1: {}
|
||||
|
||||
tweetnacl-util@0.15.1: {}
|
||||
|
||||
tweetnacl@1.0.3: {}
|
||||
|
||||
type-check@0.4.0:
|
||||
@@ -4060,6 +4261,10 @@ snapshots:
|
||||
|
||||
type-fest@0.20.2: {}
|
||||
|
||||
typedarray-to-buffer@3.1.5:
|
||||
dependencies:
|
||||
is-typedarray: 1.0.0
|
||||
|
||||
typedoc@0.26.11(typescript@5.7.2):
|
||||
dependencies:
|
||||
lunr: 2.3.9
|
||||
@@ -4069,6 +4274,8 @@ snapshots:
|
||||
typescript: 5.7.2
|
||||
yaml: 2.6.1
|
||||
|
||||
typescript@4.9.5: {}
|
||||
|
||||
typescript@5.7.2: {}
|
||||
|
||||
uc.micro@2.1.0: {}
|
||||
@@ -4180,6 +4387,8 @@ snapshots:
|
||||
bufferutil: 4.0.8
|
||||
utf-8-validate: 5.0.10
|
||||
|
||||
xsalsa20@1.2.0: {}
|
||||
|
||||
yaml@2.6.1: {}
|
||||
|
||||
yn@3.1.1: {}
|
||||
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
resolveAllDomains,
|
||||
create_gibwork_task,
|
||||
rock_paper_scissor,
|
||||
create_TipLink,
|
||||
} from "../tools";
|
||||
import {
|
||||
CollectionDeployment,
|
||||
@@ -345,4 +346,7 @@ export class SolanaAgentKit {
|
||||
) {
|
||||
return rock_paper_scissor(this, amount, choice);
|
||||
}
|
||||
async createTiplink(amount: number, splmintAddress?: PublicKey) {
|
||||
return create_TipLink(this, amount, splmintAddress);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1279,6 +1279,53 @@ export class SolanaRockPaperScissorsTool extends Tool {
|
||||
}
|
||||
}
|
||||
|
||||
export class SolanaTipLinkTool extends Tool {
|
||||
name = "solana_tiplink";
|
||||
description = `Create a TipLink for transferring SOL or SPL tokens.
|
||||
Input is a JSON string with:
|
||||
- amount: number (required) - Amount to transfer
|
||||
- splmintAddress: string (optional) - SPL token mint address`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
}
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const parsedInput = JSON.parse(input);
|
||||
|
||||
if (!parsedInput.amount) {
|
||||
throw new Error("Amount is required");
|
||||
}
|
||||
|
||||
const amount = parseFloat(parsedInput.amount);
|
||||
const splmintAddress = parsedInput.splmintAddress
|
||||
? new PublicKey(parsedInput.splmintAddress)
|
||||
: undefined;
|
||||
|
||||
const { url, signature } = await this.solanaKit.createTiplink(
|
||||
amount,
|
||||
splmintAddress,
|
||||
);
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
url,
|
||||
signature,
|
||||
amount,
|
||||
tokenType: splmintAddress ? "SPL" : "SOL",
|
||||
message: `TipLink created successfully`,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "UNKNOWN_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function createSolanaTools(solanaKit: SolanaAgentKit) {
|
||||
return [
|
||||
new SolanaBalanceTool(solanaKit),
|
||||
@@ -1314,5 +1361,6 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) {
|
||||
new SolanaResolveAllDomainsTool(solanaKit),
|
||||
new SolanaCreateGibworkTask(solanaKit),
|
||||
new SolanaRockPaperScissorsTool(solanaKit),
|
||||
new SolanaTipLinkTool(solanaKit),
|
||||
];
|
||||
}
|
||||
|
||||
112
src/tools/create_tiplinks.ts
Normal file
112
src/tools/create_tiplinks.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
import { TipLink } from "@tiplink/api";
|
||||
import {
|
||||
Transaction,
|
||||
SystemProgram,
|
||||
LAMPORTS_PER_SOL,
|
||||
sendAndConfirmTransaction,
|
||||
PublicKey,
|
||||
ComputeBudgetProgram,
|
||||
} from "@solana/web3.js";
|
||||
import {
|
||||
getAssociatedTokenAddress,
|
||||
createTransferInstruction,
|
||||
getMint,
|
||||
createAssociatedTokenAccountInstruction,
|
||||
} from "@solana/spl-token";
|
||||
import { SolanaAgentKit } from "../index";
|
||||
|
||||
const MINIMUM_SOL_BALANCE = 0.003 * LAMPORTS_PER_SOL;
|
||||
|
||||
export async function create_TipLink(
|
||||
agent: SolanaAgentKit,
|
||||
amount: number,
|
||||
splmintAddress?: PublicKey,
|
||||
): Promise<{ url: string; signature: string }> {
|
||||
try {
|
||||
const tiplink = await TipLink.create();
|
||||
|
||||
if (!splmintAddress) {
|
||||
const transaction = new Transaction();
|
||||
transaction.add(
|
||||
SystemProgram.transfer({
|
||||
fromPubkey: agent.wallet_address,
|
||||
toPubkey: tiplink.keypair.publicKey,
|
||||
lamports: amount * LAMPORTS_PER_SOL,
|
||||
}),
|
||||
);
|
||||
|
||||
const signature = await sendAndConfirmTransaction(
|
||||
agent.connection,
|
||||
transaction,
|
||||
[agent.wallet],
|
||||
{ commitment: "confirmed" },
|
||||
);
|
||||
|
||||
return {
|
||||
url: tiplink.url.toString(),
|
||||
signature,
|
||||
};
|
||||
} else {
|
||||
const fromAta = await getAssociatedTokenAddress(
|
||||
splmintAddress,
|
||||
agent.wallet_address,
|
||||
);
|
||||
const toAta = await getAssociatedTokenAddress(
|
||||
splmintAddress,
|
||||
tiplink.keypair.publicKey,
|
||||
);
|
||||
|
||||
const mintInfo = await getMint(agent.connection, splmintAddress);
|
||||
const adjustedAmount = amount * Math.pow(10, mintInfo.decimals);
|
||||
|
||||
const transaction = new Transaction();
|
||||
|
||||
transaction.add(
|
||||
ComputeBudgetProgram.setComputeUnitPrice({
|
||||
microLamports: 5000,
|
||||
}),
|
||||
);
|
||||
|
||||
transaction.add(
|
||||
SystemProgram.transfer({
|
||||
fromPubkey: agent.wallet_address,
|
||||
toPubkey: tiplink.keypair.publicKey,
|
||||
lamports: MINIMUM_SOL_BALANCE,
|
||||
}),
|
||||
);
|
||||
|
||||
transaction.add(
|
||||
createAssociatedTokenAccountInstruction(
|
||||
agent.wallet_address,
|
||||
toAta,
|
||||
tiplink.keypair.publicKey,
|
||||
splmintAddress,
|
||||
),
|
||||
);
|
||||
|
||||
transaction.add(
|
||||
createTransferInstruction(
|
||||
fromAta,
|
||||
toAta,
|
||||
agent.wallet_address,
|
||||
adjustedAmount,
|
||||
),
|
||||
);
|
||||
|
||||
const signature = await sendAndConfirmTransaction(
|
||||
agent.connection,
|
||||
transaction,
|
||||
[agent.wallet],
|
||||
{ commitment: "confirmed" },
|
||||
);
|
||||
|
||||
return {
|
||||
url: tiplink.url.toString(),
|
||||
signature,
|
||||
};
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error("Error creating TipLink or sending funds:", error.message);
|
||||
throw new Error(`Failed to create TipLink: ${error.message}`);
|
||||
}
|
||||
}
|
||||
@@ -39,3 +39,4 @@ export * from "./pyth_fetch_price";
|
||||
export * from "./create_gibwork_task";
|
||||
|
||||
export * from "./rock_paper_scissor";
|
||||
export * from "./create_tiplinks";
|
||||
|
||||
Reference in New Issue
Block a user