Update browser wallet for Whirlpools SDK (#182)

# Pull Request Description

## Related Issue
Fixes # (issue number)

## Changes Made
This PR adds the following changes:
- Created a custom Wallet class to support browser use of Orca tools


## Transaction executed by agent 
Example transaction:
https://solscan.io/tx/GNmgxM4ZRHURDWcgmhLmBrSG5RgF9yw5B4jzEXzWX2jpNvCbUsQyaMdkkH77au7pisJ89hJdrcs8dv54U8H3J8V?cluster=devnet

## Prompt Used
Using Devnet
```
i want to open a single sided position in pool 7MghXMotsf9CLr6Z9obV8g9Kt2y1Mqn6wXm2mdPhRnMe
```
then provide details

## Additional Notes

## 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:
aryan
2025-01-11 02:27:33 +05:30
committed by GitHub
7 changed files with 175 additions and 136 deletions

248
pnpm-lock.yaml generated
View File

@@ -10,10 +10,10 @@ importers:
dependencies:
'@3land/listings-sdk':
specifier: ^0.0.4
version: 0.0.4(@types/node@22.10.5)(arweave@1.15.5)(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)
version: 0.0.4(@types/node@22.10.5)(arweave@1.15.5)(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)
'@ai-sdk/openai':
specifier: ^1.0.11
version: 1.0.13(zod@3.24.1)
version: 1.0.11(zod@3.24.1)
'@bonfida/spl-name-service':
specifier: ^3.0.7
version: 3.0.7(@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)
@@ -109,7 +109,7 @@ importers:
version: 16.4.7
flash-sdk:
specifier: ^2.24.3
version: 2.24.3(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)
version: 2.24.3(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)
form-data:
specifier: ^4.0.1
version: 4.0.1
@@ -134,7 +134,7 @@ importers:
version: 5.0.1
'@types/node':
specifier: ^22.10.2
version: 22.10.2
version: 22.10.5
'@typescript-eslint/eslint-plugin':
specifier: ^8.18.2
version: 8.19.0(@typescript-eslint/parser@8.19.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2)
@@ -161,7 +161,7 @@ importers:
version: 3.4.2
ts-node:
specifier: ^10.9.2
version: 10.9.2(@types/node@22.10.2)(typescript@5.7.2)
version: 10.9.2(@types/node@22.10.5)(typescript@5.7.2)
typescript:
specifier: ^5.7.2
version: 5.7.2
@@ -855,6 +855,9 @@ packages:
'@shikijs/vscode-textmate@10.0.1':
resolution: {integrity: sha512-fTIQwLF+Qhuws31iw7Ncl1R3HUDtGwIipiJ9iU+UsDUwMhegFcQKQHd51nZjb7CArq0MvON8rbgCGQYWHUKAdg==}
'@shikijs/vscode-textmate@9.3.1':
resolution: {integrity: sha512-79QfK1393x9Ho60QFyLti+QfdJzRQCVLFb97kOIV7Eo9vQU/roINgk7m24uv0a7AUvN//RDH36FLjjK48v0s9g==}
'@sindresorhus/is@4.6.0':
resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==}
engines: {node: '>=10'}
@@ -1036,6 +1039,10 @@ packages:
'@solana/web3.js@1.98.0':
resolution: {integrity: sha512-nz3Q5OeyGFpFCR+erX2f6JPt3sKhzhYcSycBCSPkWjzSVDh/Rr1FqTVMRe58FKO16/ivTUcuJjeS5MyBvpkbzA==}
'@sqds/multisig@2.1.3':
resolution: {integrity: sha512-WOiL7La+RSiJsz7jVO85yhSiiSvNMUthiWuLPeWVOoD6IYa34BEAzanF1RdXRWGglSbRFYCTkyr+Ay1WmXmSRQ==}
engines: {node: '>=14'}
'@supercharge/promise-pool@3.2.0':
resolution: {integrity: sha512-pj0cAALblTZBPtMltWOlZTQSLT07jIaFNeM8TWoJD1cQMgDB9mcMlVMoetiB35OzNJpqQ2b+QEtwiR9f20mADg==}
engines: {node: '>=8'}
@@ -2121,12 +2128,8 @@ packages:
resolution: {integrity: sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==}
engines: {node: '>=18'}
get-intrinsic@1.2.7:
resolution: {integrity: sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==}
engines: {node: '>= 0.4'}
get-proto@1.0.1:
resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
get-intrinsic@1.2.6:
resolution: {integrity: sha512-qxsEs+9A+u85HhllWJJFicJfPDhRmjzoYdl64aMWW9yRIJmSyxdn8IEkuIM530/7T+lv0TIHd8L6Q/ra0tEoeA==}
engines: {node: '>= 0.4'}
get-stream@5.2.0:
@@ -2284,6 +2287,9 @@ packages:
resolution: {integrity: sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==}
engines: {node: '>=12.0.0'}
invariant@2.2.4:
resolution: {integrity: sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==}
ipaddr.js@1.9.1:
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
engines: {node: '>= 0.10'}
@@ -2347,10 +2353,6 @@ packages:
resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==}
engines: {node: '>=8'}
is-regex@1.2.1:
resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==}
engines: {node: '>= 0.4'}
is-retry-allowed@2.2.0:
resolution: {integrity: sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==}
engines: {node: '>=10'}
@@ -3060,8 +3062,8 @@ packages:
regex-utilities@2.3.0:
resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==}
regex@5.1.1:
resolution: {integrity: sha512-dN5I359AVGPnwzJm2jN1k0W9LPZ+ePvoOeVMMfqIMFz53sSwXkxaJoxr50ptnsC771lK95BnTrVSZxq0b9yCGw==}
regex@5.0.2:
resolution: {integrity: sha512-/pczGbKIQgfTMRV0XjABvc5RzLqQmwqxLHdQao2RTXPk+pmTXB2P0IaUHYdYyk412YLwUIkaeMd5T+RzVgTqnQ==}
resolve-alpn@1.2.1:
resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==}
@@ -3661,14 +3663,14 @@ packages:
snapshots:
'@3land/listings-sdk@0.0.4(@types/node@22.10.5)(arweave@1.15.5)(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)':
'@3land/listings-sdk@0.0.4(@types/node@22.10.5)(arweave@1.15.5)(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)':
dependencies:
'@coral-xyz/borsh': 0.30.1(@solana/web3.js@1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))
'@irys/sdk': 0.2.11(arweave@1.15.5)(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@coral-xyz/borsh': 0.30.1(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))
'@irys/sdk': 0.2.11(arweave@1.15.5)(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@metaplex-foundation/beet': 0.7.2
'@metaplex-foundation/mpl-token-metadata': 2.13.0(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)
'@project-serum/anchor': 0.26.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@metaplex-foundation/mpl-token-metadata': 2.13.0(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)
'@project-serum/anchor': 0.26.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
bn: 1.0.5
bn.js: 5.2.1
bs58: 6.0.0
@@ -3743,8 +3745,8 @@ snapshots:
dependencies:
'@aptos-labs/aptos-cli': 1.0.2
'@aptos-labs/aptos-client': 0.1.1
'@noble/curves': 1.8.0
'@noble/hashes': 1.7.0
'@noble/curves': 1.7.0
'@noble/hashes': 1.6.1
'@scure/bip32': 1.4.0
'@scure/bip39': 1.3.0
eventemitter3: 5.0.1
@@ -3838,16 +3840,16 @@ snapshots:
- encoding
- utf-8-validate
'@coral-xyz/anchor@0.27.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@coral-xyz/anchor@0.27.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@coral-xyz/borsh': 0.27.0(@solana/web3.js@1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))
'@solana/web3.js': 1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@coral-xyz/borsh': 0.27.0(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
base64-js: 1.5.1
bn.js: 5.2.1
bs58: 4.0.1
buffer-layout: 1.2.2
camelcase: 6.3.0
cross-fetch: 3.2.0
cross-fetch: 3.1.8
crypto-hash: 1.3.0
eventemitter3: 4.0.7
js-sha256: 0.9.0
@@ -3860,7 +3862,7 @@ snapshots:
- encoding
- utf-8-validate
'@coral-xyz/anchor@0.29.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@coral-xyz/anchor@0.29.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@coral-xyz/borsh': 0.29.0(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))
'@noble/hashes': 1.6.1
@@ -3887,27 +3889,27 @@ snapshots:
bn.js: 5.2.1
buffer-layout: 1.2.2
'@coral-xyz/borsh@0.27.0(@solana/web3.js@1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))':
'@coral-xyz/borsh@0.27.0(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))':
dependencies:
'@solana/web3.js': 1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
bn.js: 5.2.1
buffer-layout: 1.2.2
'@coral-xyz/borsh@0.28.0(@solana/web3.js@1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10))':
'@coral-xyz/borsh@0.28.0(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))':
dependencies:
'@solana/web3.js': 1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)
bn.js: 5.2.1
buffer-layout: 1.2.2
'@coral-xyz/borsh@0.29.0(@solana/web3.js@1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))':
'@coral-xyz/borsh@0.29.0(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))':
dependencies:
'@solana/web3.js': 1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
bn.js: 5.2.1
buffer-layout: 1.2.2
'@coral-xyz/borsh@0.30.1(@solana/web3.js@1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))':
'@coral-xyz/borsh@0.30.1(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))':
dependencies:
'@solana/web3.js': 1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
bn.js: 5.2.1
buffer-layout: 1.2.2
@@ -4122,7 +4124,7 @@ snapshots:
dependencies:
'@ethersproject/logger': 5.7.0
'@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@ethersproject/providers@5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@ethersproject/abstract-provider': 5.7.0
'@ethersproject/abstract-signer': 5.7.0
@@ -4143,7 +4145,7 @@ snapshots:
'@ethersproject/transactions': 5.7.0
'@ethersproject/web': 5.7.1
bech32: 1.1.4
ws: 7.4.6(bufferutil@4.0.9)(utf-8-validate@5.0.10)
ws: 7.4.6(bufferutil@4.0.8)(utf-8-validate@5.0.10)
transitivePeerDependencies:
- bufferutil
- utf-8-validate
@@ -4271,22 +4273,22 @@ snapshots:
transitivePeerDependencies:
- debug
'@irys/sdk@0.2.11(arweave@1.15.5)(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@irys/sdk@0.2.11(arweave@1.15.5)(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@aptos-labs/ts-sdk': 1.33.1
'@ethersproject/bignumber': 5.7.0
'@ethersproject/contracts': 5.7.0
'@ethersproject/providers': 5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@ethersproject/providers': 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@ethersproject/wallet': 5.7.0
'@irys/query': 0.0.8
'@near-js/crypto': 0.0.3
'@near-js/keystores-browser': 0.0.3
'@near-js/providers': 0.0.4
'@near-js/transactions': 0.1.1
'@solana/web3.js': 1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@supercharge/promise-pool': 3.2.0
algosdk: 1.24.1
arbundles: 0.11.2(arweave@1.15.5)(bufferutil@4.0.9)(utf-8-validate@5.0.10)
arbundles: 0.11.2(arweave@1.15.5)(bufferutil@4.0.8)(utf-8-validate@5.0.10)
async-retry: 1.3.3
axios: 1.7.9
base64url: 3.0.1
@@ -4778,7 +4780,7 @@ snapshots:
'@noble/curves@1.7.0':
dependencies:
'@noble/hashes': 1.7.0
'@noble/hashes': 1.6.0
'@noble/ed25519@1.7.3': {}
@@ -4839,16 +4841,16 @@ snapshots:
'@pkgr/core@0.1.1': {}
'@project-serum/anchor@0.26.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@project-serum/anchor@0.26.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@coral-xyz/borsh': 0.26.0(@solana/web3.js@1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))
'@solana/web3.js': 1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@coral-xyz/borsh': 0.26.0(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
base64-js: 1.5.1
bn.js: 5.2.1
bs58: 4.0.1
buffer-layout: 1.2.2
camelcase: 6.3.0
cross-fetch: 3.2.0
cross-fetch: 3.1.8
crypto-hash: 1.3.0
eventemitter3: 4.0.7
js-sha256: 0.9.0
@@ -4861,11 +4863,11 @@ snapshots:
- encoding
- utf-8-validate
'@pythnetwork/client@2.22.0(@solana/web3.js@1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@pythnetwork/client@2.22.0(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@coral-xyz/anchor': 0.29.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@coral-xyz/borsh': 0.28.0(@solana/web3.js@1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10))
'@solana/web3.js': 1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@coral-xyz/anchor': 0.29.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@coral-xyz/borsh': 0.28.0(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))
'@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)
buffer: 6.0.3
transitivePeerDependencies:
- bufferutil
@@ -4880,15 +4882,15 @@ snapshots:
transitivePeerDependencies:
- axios
'@pythnetwork/price-service-client@1.9.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@pythnetwork/price-service-client@1.9.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@pythnetwork/price-service-sdk': 1.8.0
'@types/ws': 8.5.13
axios: 1.7.9
axios-retry: 3.9.1
isomorphic-ws: 4.0.1(ws@8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))
isomorphic-ws: 4.0.1(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))
ts-log: 2.2.7
ws: 8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
transitivePeerDependencies:
- bufferutil
- debug
@@ -4906,7 +4908,7 @@ snapshots:
'@randlabs/communication-bridge': 1.0.1
optional: true
'@raydium-io/raydium-sdk-v2@0.1.95-alpha(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)':
'@raydium-io/raydium-sdk-v2@0.1.95-alpha(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
'@solana/spl-token': 0.4.9(@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)
@@ -4997,9 +4999,11 @@ snapshots:
'@shikijs/vscode-textmate@10.0.1': {}
'@shikijs/vscode-textmate@9.3.1': {}
'@sindresorhus/is@4.6.0': {}
'@solana/buffer-layout-utils@0.2.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@solana/buffer-layout-utils@0.2.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@solana/buffer-layout': 4.0.1
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
@@ -5266,15 +5270,15 @@ snapshots:
- fastestsmallesttextencoderdecoder
- typescript
'@solana/spl-token-metadata@0.1.6(@solana/web3.js@1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)':
'@solana/spl-token-metadata@0.1.6(@solana/web3.js@1.95.8(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)
'@solana/web3.js': 1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.95.8(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.9)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)':
'@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)
@@ -5303,12 +5307,12 @@ snapshots:
- encoding
- utf-8-validate
'@solana/spl-token@0.3.11(@solana/web3.js@1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)':
'@solana/spl-token@0.3.11(@solana/web3.js@1.95.8(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
'@solana/buffer-layout-utils': 0.2.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@solana/spl-token-metadata': 0.1.6(@solana/web3.js@1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)
'@solana/web3.js': 1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@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.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)
'@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)
buffer: 6.0.3
transitivePeerDependencies:
- bufferutil
@@ -5317,7 +5321,7 @@ snapshots:
- typescript
- utf-8-validate
'@solana/spl-token@0.3.11(@solana/web3.js@1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@4.9.5)(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)':
dependencies:
'@solana/buffer-layout': 4.0.1
'@solana/buffer-layout-utils': 0.2.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
@@ -5400,7 +5404,7 @@ snapshots:
'@noble/curves': 1.7.0
'@noble/hashes': 1.6.1
'@solana/buffer-layout': 4.0.1
agentkeepalive: 4.5.0
agentkeepalive: 4.6.0
bigint-buffer: 1.1.5
bn.js: 5.2.1
borsh: 0.7.0
@@ -5416,11 +5420,11 @@ snapshots:
- encoding
- utf-8-validate
'@solana/web3.js@1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@babel/runtime': 7.26.0
'@noble/curves': 1.8.0
'@noble/hashes': 1.7.0
'@noble/curves': 1.7.0
'@noble/hashes': 1.6.1
'@solana/buffer-layout': 4.0.1
agentkeepalive: 4.6.0
bigint-buffer: 1.1.5
@@ -5429,7 +5433,7 @@ snapshots:
bs58: 4.0.1
buffer: 6.0.3
fast-stable-stringify: 1.0.0
jayson: 4.1.3(bufferutil@4.0.9)(utf-8-validate@5.0.10)
jayson: 4.1.3(bufferutil@4.0.8)(utf-8-validate@5.0.10)
node-fetch: 2.7.0
rpc-websockets: 9.0.4
superstruct: 2.0.2
@@ -5438,13 +5442,13 @@ snapshots:
- encoding
- utf-8-validate
'@solana/web3.js@1.98.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)':
dependencies:
'@babel/runtime': 7.26.0
'@noble/curves': 1.7.0
'@noble/hashes': 1.6.1
'@solana/buffer-layout': 4.0.1
agentkeepalive: 4.5.0
agentkeepalive: 4.6.0
bigint-buffer: 1.1.5
bn.js: 5.2.1
borsh: 0.7.0
@@ -5460,6 +5464,26 @@ snapshots:
- encoding
- utf-8-validate
'@sqds/multisig@2.1.3(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)':
dependencies:
'@metaplex-foundation/beet': 0.7.1
'@metaplex-foundation/beet-solana': 0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@metaplex-foundation/cusper': 0.0.2
'@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@5.7.2)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@types/bn.js': 5.1.6
assert: 2.1.0
bn.js: 5.2.1
buffer: 6.0.3
invariant: 2.2.4
transitivePeerDependencies:
- bufferutil
- encoding
- fastestsmallesttextencoderdecoder
- supports-color
- typescript
- utf-8-validate
'@supercharge/promise-pool@3.2.0': {}
'@swc/helpers@0.5.15':
@@ -5470,7 +5494,7 @@ snapshots:
dependencies:
defer-to-connect: 2.0.1
'@tensor-hq/tensor-common@8.3.1(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)':
'@tensor-hq/tensor-common@8.3.1(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)':
dependencies:
'@coral-xyz/anchor': 0.26.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@metaplex-foundation/mpl-auction-house': 2.5.1(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)
@@ -5550,7 +5574,7 @@ snapshots:
'@types/bn.js@5.1.6':
dependencies:
'@types/node': 22.10.2
'@types/node': 22.10.5
'@types/body-parser@1.19.5':
dependencies:
@@ -5570,7 +5594,7 @@ snapshots:
'@types/connect@3.4.38':
dependencies:
'@types/node': 22.10.2
'@types/node': 22.10.5
'@types/deep-eql@4.0.2': {}
@@ -5580,7 +5604,7 @@ snapshots:
'@types/express-serve-static-core@4.19.6':
dependencies:
'@types/node': 22.10.2
'@types/node': 22.10.5
'@types/qs': 6.9.17
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
@@ -5614,7 +5638,7 @@ snapshots:
'@types/node-fetch@2.6.12':
dependencies:
'@types/node': 22.10.2
'@types/node': 22.10.5
form-data: 4.0.1
'@types/node@11.11.6': {}
@@ -5652,12 +5676,12 @@ snapshots:
'@types/send@0.17.4':
dependencies:
'@types/mime': 1.3.5
'@types/node': 22.10.2
'@types/node': 22.10.5
'@types/serve-static@1.15.7':
dependencies:
'@types/http-errors': 2.0.4
'@types/node': 22.10.2
'@types/node': 22.10.5
'@types/send': 0.17.4
'@types/unist@3.0.3': {}
@@ -5668,11 +5692,11 @@ snapshots:
'@types/ws@7.4.7':
dependencies:
'@types/node': 22.10.2
'@types/node': 22.10.5
'@types/ws@8.5.13':
dependencies:
'@types/node': 22.10.2
'@types/node': 22.10.5
'@typescript-eslint/eslint-plugin@8.19.0(@typescript-eslint/parser@8.19.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2)':
dependencies:
@@ -5814,7 +5838,7 @@ snapshots:
dependencies:
algo-msgpack-with-bigint: 2.1.1
buffer: 6.0.3
cross-fetch: 3.2.0
cross-fetch: 3.1.8
hi-base32: 0.5.1
js-sha256: 0.9.0
js-sha3: 0.8.0
@@ -5847,11 +5871,11 @@ snapshots:
ansicolors@0.3.2: {}
arbundles@0.11.2(arweave@1.15.5)(bufferutil@4.0.9)(utf-8-validate@5.0.10):
arbundles@0.11.2(arweave@1.15.5)(bufferutil@4.0.8)(utf-8-validate@5.0.10):
dependencies:
'@ethersproject/bytes': 5.7.0
'@ethersproject/hash': 5.7.0
'@ethersproject/providers': 5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@ethersproject/providers': 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@ethersproject/signing-key': 5.7.0
'@ethersproject/transactions': 5.7.0
'@ethersproject/wallet': 5.7.0
@@ -5901,7 +5925,7 @@ snapshots:
asn1.js@5.4.1:
dependencies:
bn.js: 4.11.6
bn.js: 4.12.1
inherits: 2.0.4
minimalistic-assert: 1.0.1
safer-buffer: 2.1.2
@@ -6715,13 +6739,13 @@ snapshots:
locate-path: 6.0.0
path-exists: 4.0.0
flash-sdk@2.24.3(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10):
flash-sdk@2.24.3(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10):
dependencies:
'@coral-xyz/anchor': 0.27.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@pythnetwork/client': 2.22.0(@solana/web3.js@1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@pythnetwork/price-service-client': 1.9.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@solana/spl-token': 0.3.11(@solana/web3.js@1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)
'@solana/web3.js': 1.95.8(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@coral-xyz/anchor': 0.27.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@pythnetwork/client': 2.22.0(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@pythnetwork/price-service-client': 1.9.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@solana/spl-token': 0.3.11(@solana/web3.js@1.95.8(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)
'@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)
'@types/node': 20.17.11
bignumber.js: 9.1.2
bs58: 5.0.0
@@ -6809,11 +6833,6 @@ snapshots:
hasown: 2.0.2
math-intrinsics: 1.1.0
get-proto@1.0.1:
dependencies:
dunder-proto: 1.0.1
es-object-atoms: 1.0.0
get-stream@5.2.0:
dependencies:
pump: 3.0.2
@@ -6892,7 +6911,7 @@ snapshots:
'@types/node': 18.19.68
'@types/node-fetch': 2.6.12
abort-controller: 3.0.0
agentkeepalive: 4.5.0
agentkeepalive: 4.6.0
form-data-encoder: 1.7.2
formdata-node: 4.4.1
node-fetch: 2.7.0
@@ -7026,6 +7045,10 @@ snapshots:
through: 2.3.8
wrap-ansi: 6.2.0
invariant@2.2.4:
dependencies:
loose-envify: 1.4.0
ipaddr.js@1.9.1: {}
ipaddr.js@2.2.0: {}
@@ -7070,13 +7093,6 @@ snapshots:
is-path-inside@3.0.3: {}
is-regex@1.2.1:
dependencies:
call-bound: 1.0.3
gopd: 1.2.0
has-tostringtag: 1.0.2
hasown: 2.0.2
is-retry-allowed@2.2.0: {}
is-stream@3.0.0: {}
@@ -7093,11 +7109,11 @@ snapshots:
isomorphic-ws@4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)):
dependencies:
ws: 7.5.10(bufferutil@4.0.9)(utf-8-validate@5.0.10)
ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)
isomorphic-ws@4.0.1(ws@8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)):
isomorphic-ws@4.0.1(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)):
dependencies:
ws: 8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
jackspeak@3.4.3:
dependencies:
@@ -7553,7 +7569,7 @@ snapshots:
'@types/node': 18.19.68
'@types/node-fetch': 2.6.12
abort-controller: 3.0.0
agentkeepalive: 4.5.0
agentkeepalive: 4.6.0
form-data-encoder: 1.7.2
formdata-node: 4.4.1
node-fetch: 2.7.0
@@ -7817,12 +7833,6 @@ snapshots:
safe-buffer@5.2.1: {}
safe-regex-test@1.1.0:
dependencies:
call-bound: 1.0.3
es-errors: 1.3.0
is-regex: 1.2.1
safer-buffer@2.1.2: {}
scrypt-js@3.0.1: {}
@@ -8116,7 +8126,7 @@ snapshots:
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 22.10.2
'@types/node': 22.10.5
acorn: 8.14.0
acorn-walk: 8.3.4
arg: 4.1.3
@@ -8338,12 +8348,12 @@ snapshots:
wrappy@1.0.2: {}
ws@7.4.6(bufferutil@4.0.9)(utf-8-validate@5.0.10):
ws@7.4.6(bufferutil@4.0.8)(utf-8-validate@5.0.10):
optionalDependencies:
bufferutil: 4.0.9
bufferutil: 4.0.8
utf-8-validate: 5.0.10
ws@7.5.10(bufferutil@4.0.9)(utf-8-validate@5.0.10):
ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10):
optionalDependencies:
bufferutil: 4.0.8
utf-8-validate: 5.0.10

View File

@@ -5,7 +5,7 @@ import {
VersionedTransaction,
} from "@solana/web3.js";
import { SolanaAgentKit } from "../agent";
import { Wallet } from "@coral-xyz/anchor";
import { Wallet } from "../utils/keypair";
import {
ORCA_WHIRLPOOL_PROGRAM_ID,
WhirlpoolContext,

View File

@@ -5,7 +5,7 @@ import {
VersionedTransaction,
} from "@solana/web3.js";
import { SolanaAgentKit } from "../agent";
import { Wallet } from "@coral-xyz/anchor";
import { Wallet } from "../utils/keypair";
import { Decimal } from "decimal.js";
import {
ORCA_WHIRLPOOL_PROGRAM_ID,

View File

@@ -5,7 +5,8 @@ import {
VersionedTransaction,
} from "@solana/web3.js";
import { SolanaAgentKit } from "../agent";
import { BN, Wallet } from "@coral-xyz/anchor";
import { BN } from "@coral-xyz/anchor";
import { Wallet } from "../utils/keypair";
import { Decimal } from "decimal.js";
import {
PDAUtil,

View File

@@ -6,7 +6,7 @@ import {
VersionedTransaction,
} from "@solana/web3.js";
import { SolanaAgentKit } from "../agent";
import { Wallet } from "@coral-xyz/anchor";
import { Wallet } from "../utils/keypair";
import { Decimal } from "decimal.js";
import {
ORCA_WHIRLPOOL_PROGRAM_ID,

View File

@@ -1,11 +1,12 @@
import {
Keypair,
PublicKey,
TransactionInstruction,
TransactionMessage,
VersionedTransaction,
} from "@solana/web3.js";
import { SolanaAgentKit } from "../agent";
import { Wallet } from "@coral-xyz/anchor";
import { Wallet } from "../utils/keypair";
import { Decimal } from "decimal.js";
import {
ORCA_WHIRLPOOL_PROGRAM_ID,
@@ -119,17 +120,17 @@ export async function orcaOpenSingleSidedPosition(
lowerTick,
upperTick,
]);
let txIds: string = "";
let instructions: TransactionInstruction[] = [];
let signers: Keypair[] = [];
if (txBuilderTickArrays !== null) {
const txPayloadTickArrays = await txBuilderTickArrays.build();
const txPayloadTickArraysDecompiled = TransactionMessage.decompile(
(txPayloadTickArrays.transaction as VersionedTransaction).message,
);
const instructions = txPayloadTickArraysDecompiled.instructions;
const signers = txPayloadTickArrays.signers as Keypair[];
const tickArrayTxId = await sendTx(agent, instructions, signers);
txIds += tickArrayTxId + ",";
instructions = instructions.concat(
txPayloadTickArraysDecompiled.instructions,
);
signers = signers.concat(txPayloadTickArrays.signers as Keypair[]);
}
const tokenExtensionCtx: TokenExtensionContextForPool = {
@@ -161,14 +162,13 @@ export async function orcaOpenSingleSidedPosition(
const txPayloadDecompiled = TransactionMessage.decompile(
(txPayload.transaction as VersionedTransaction).message,
);
const instructions = txPayloadDecompiled.instructions;
const signers = txPayload.signers as Keypair[];
instructions = instructions.concat(txPayloadDecompiled.instructions);
signers = signers.concat(txPayload.signers as Keypair[]);
const positionTxId = await sendTx(agent, instructions, signers);
txIds += positionTxId;
const txId = await sendTx(agent, instructions, signers);
return JSON.stringify({
transactionIds: txIds,
transactionIds: txId,
positionMint: positionMint.toString(),
});
} catch (error) {

View File

@@ -1,7 +1,35 @@
import { Keypair } from "@solana/web3.js";
import { Keypair, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
import bs58 from "bs58";
export const keypair = Keypair.generate();
console.log(keypair.publicKey.toString());
console.log(bs58.encode(keypair.secretKey));
export class Wallet {
private _signer: Keypair;
constructor(signer: Keypair) {
this._signer = signer;
}
async signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T> {
if (tx instanceof Transaction) {
tx.sign(this._signer);
} else if (tx instanceof VersionedTransaction) {
tx.sign([this._signer]);
} else {
throw new Error("Unsupported transaction type");
}
return tx;
}
async signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]> {
return Promise.all(txs.map((tx) => this.signTransaction(tx)));
}
get publicKey(): PublicKey {
return this._signer.publicKey;
}
}