├── .github └── workflows │ └── tests.yml ├── .gitignore ├── .npmignore ├── .prettierignore ├── .prettierrc.json ├── LICENSE ├── README.md ├── idl └── pump-idl.ts ├── package-lock.json ├── package.json ├── src ├── core │ ├── base.ts │ ├── layout.ts │ ├── lru.ts │ └── utils.ts ├── index.ts └── parser │ ├── pumpfun │ ├── index.ts │ ├── layout.ts │ ├── parser.ts │ └── types.ts │ └── raydium │ ├── index.ts │ └── v4 │ ├── layout.ts │ ├── parser.ts │ └── types.ts ├── tests ├── core │ └── test.spec.ts ├── jupiter │ └── tests.spec.ts ├── pumpfun │ ├── parsed-buy-txn.json │ ├── parsed-complete-txn.json │ ├── parsed-create-txn.json │ ├── parsed-sell-txn.json │ └── tests.spec.ts └── raydium │ ├── parsed-deposit-txn.json │ ├── parsed-init-txn.json │ ├── parsed-swap-base-out-txn.json │ ├── parsed-swap-txn.json │ ├── parsed-withdraw-txn.json │ ├── swap-edge-1.json │ ├── swap-edge-2.json │ └── tests.spec.ts └── tsconfig.json /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Run Tests 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Use Node.js 17 | uses: actions/setup-node@v3 18 | with: 19 | node-version: '18' 20 | 21 | - name: Cache node modules 22 | uses: actions/cache@v3 23 | env: 24 | cache-name: cache-node-modules 25 | with: 26 | path: ~/.npm 27 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} 28 | restore-keys: | 29 | ${{ runner.os }}-build-${{ env.cache-name }}- 30 | ${{ runner.os }}-build- 31 | ${{ runner.os }}- 32 | 33 | - name: Install dependencies 34 | run: npm ci 35 | 36 | - name: Run tests 37 | run: npm test -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | dist 4 | *.tgz 5 | *.tsbuildinfo 6 | package-test/ 7 | .DS_Store -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | src/ 2 | tests/ 3 | idl/ 4 | node_modules/ 5 | tsconfig.json 6 | jest.config.js 7 | .github/ 8 | .gitignore 9 | *.log 10 | .prettierrc.json 11 | .prettierignore 12 | *.tsbuildinfo 13 | package-test/ -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "trailingComma": "es5", 4 | "singleQuote": true, 5 | "printWidth": 100, 6 | "tabWidth": 4 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 solana-txn-parser 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |

solana-transaction-parser

4 |
5 | 6 |

An open-source and lightweight transaction parser for popular DeFi applications on the Solana blockchain, written in TypeScript.

7 |
8 | 9 | ## 💪🏽 Supported DeFi Platforms 10 | 11 | - PumpFun ✅ 12 | - RaydiumV4 ✅ 13 | - Jupiter 🔜 14 | 15 | ## 👨‍🔧 Installation 16 | ```bash 17 | npm i solana-parser 18 | ``` 19 | 20 | ## 👨🏽‍💻 Usage 21 | 22 | ### 🎰 PumpFun Parser 23 | 24 | ```typescript 25 | import { PumpFunParser } from 'solana-parser'; 26 | import { Connection, PublicKey, clusterApiUrl, ParsedTransactionWithMeta } from '@solana/web3.js'; 27 | import fs from "fs"; 28 | 29 | const connection = new Connection(clusterApiUrl('mainnet-beta')); 30 | const parser = new PumpFunParser(); 31 | 32 | // Fetch a transaction 33 | const txnSig = '' 34 | const txn1 = await connection.getParsedTransaction(txnSig); 35 | 36 | // Parse single transaction 37 | const pumpTxn = parser.parse(transaction); 38 | console.log(parsedTx); 39 | 40 | // Parse multiple transactions 41 | const txnSig2 = '' 42 | const txn2 = await connection.getParsedTransaction(txnSig2) 43 | const pumpTxns = parser.parseMultiple([txn1, txn2]) 44 | 45 | // Parse transaction from json file 46 | const txn = JSON.parse(fs.readFileSync("", "utf-8")) as unknown as ParsedTransactionWithMeta 47 | const pumpTxn = parser.parse(txn) 48 | ``` 49 | 50 | #### 📦 Output Structure 51 | 52 | The parser returns a `PumpFunTransaction` object (or an array of `PumpFunTransaction` objects if `parseMultiple` is called): 53 | 54 | #### 🎰 PumpFun Transaction Structure 55 | The `PumpFunTransaction` object shows the different operations that occurred in the transaction. These operations are gotten from the events emitted during the transaction execution and are represented by the `PumpFunAction` interface as follows: 56 | ```typescript 57 | interface PumpFunTransaction { 58 | platform: string; // pumpfun 59 | actions: PumpFunAction[]; 60 | } 61 | ``` 62 | 63 | #### PumpFun Action Structure 64 | The `PumpFunAction` interface contains the three major actions that can occur in a PumpFun transaction (`create`, `complete`, `trade`), with the `info` field containing the relevant information for each action. The info field is of type `TradeInfo`, `CreateInfo`, or `CompleteInfo` depending on the action. 65 | 66 | ```typescript 67 | interface PumpFunAction { 68 | type: "create" | "complete" | "trade"; 69 | info: TradeInfo | CreateInfo | CompleteInfo; 70 | } 71 | 72 | type TradeInfo = { 73 | solAmount: bigint; 74 | tokenAmount: bigint; 75 | tokenMint: PublicKey; 76 | trader: PublicKey; 77 | isBuy: boolean; 78 | timestamp: bigint; 79 | virtualSolReserves: bigint; 80 | virtualTokenReserves: bigint; 81 | }; 82 | 83 | type CreateInfo = { 84 | name: string; 85 | symbol: string; 86 | uri: string; 87 | tokenMint: PublicKey; 88 | bondingCurve: PublicKey; 89 | tokenDecimals: number; 90 | createdBy: PublicKey; 91 | }; 92 | 93 | type CompleteInfo = { 94 | user: PublicKey; 95 | tokenMint: PublicKey; 96 | bondingCurve: PublicKey; 97 | timestamp: bigint; 98 | }; 99 | ``` 100 | 101 | ### 🧑🏼‍🚀 RaydiumV4 Parser 102 | ```typescript 103 | import { RaydiumV4Parser } from 'sol-parser/src'; 104 | import { Connection, PublicKey, clusterApiUrl, ParsedTransactionWithMeta } from '@solana/web3.js'; 105 | import fs from "fs"; 106 | 107 | const connection = new Connection(clusterApiUrl('mainnet-beta')); 108 | // set max size of lru cache for caching decoded pool info 109 | const parser = new RaydiumV4Parser(connection, { maxPoolCache: 20 }); 110 | 111 | // Fetch a transaction 112 | const txnSig = '' 113 | const txn1 = await connection.getParsedTransaction(txnSig); 114 | 115 | // Parse single transaction 116 | const result = await parser.parse(transaction); 117 | console.log(result); 118 | 119 | // Parse multiple transactions 120 | const txnSig2 = '' 121 | const txn2 = await connection.getParsedTransaction(txnSig2) 122 | const results = await parser.parseMultiple([txn1, txn2]) 123 | 124 | // Parse transaction from json file 125 | const txn = JSON.parse(fs.readFileSync("", "utf-8")) as unknown as ParsedTransactionWithMeta 126 | const result = parser.parse(txn) 127 | ``` 128 | 129 | ### 🔄 Jupiter Parser [Coming soon] 130 | 131 | ### 🧰 Creating Custom Parsers 132 | 133 | You can create custom parsers for other DeFi platforms by extending the `BaseParser` class: 134 | 135 | ```typescript 136 | import { BaseParser, ParsedTransactionWithMeta } from 'solana-txn-parser'; 137 | 138 | // define action information 139 | type ActionInfo = { 140 | // add neccessary fields for the action 141 | }; 142 | 143 | // define your custom action 144 | interface CustomAction extends BaseParsedAction { 145 | info: ActionInfo; 146 | } 147 | 148 | // define your custom transaction 149 | interface CustomTransaction extends BaseParsedTransaction { 150 | actions: CustomAction[]; 151 | } 152 | 153 | // define your parser class 154 | class CustomParser extends BaseParser { 155 | parse(transaction: ParsedTransactionWithMeta): CustomTransaction { 156 | // Implement your parsing logic here 157 | } 158 | 159 | parseMultiple(transactions: ParsedTransactionWithMeta[]): CustomTransaction[] { 160 | return transactions.map((tx) => this.parse(tx)); 161 | } 162 | } 163 | ``` 164 | 165 | > NB: For anchor specific parsers that rely on events, you can use the `anchorLogScanner` function present in the `src/core/utils` file to get program events from the transaction. 166 | 167 | 168 | ## 🤝 Contributing 169 | 170 | Here's how you can contribute to the library: 171 | 172 | ### 🎉 Adding a New Parser 173 | 174 | - Fork the repository and create a new branch for your parser. 175 | - Create a new folder in the `src/parsers` directory for your parser (e.g., `newparser`). 176 | - Add an index.ts file in the `src/parser/` directory to hold your Parser logic 177 | - Implement your parser by extending the `BaseParser` class. 178 | - Write unit tests for your parser in the `tests/newparser` directory. 179 | - Update the README.md to include documentation for your new parser. 180 | - Submit a pull request with your changes. 181 | 182 | You can check the parser directory for more information on how to implement your new parser 183 | 184 | ### ♻️ Modifying/Improving Existing Parsers 185 | 186 | - Fork the repository and create a new branch for your modifications. 187 | - Make your changes to the existing parser file. 188 | - If you're adding new functionality, make sure to add corresponding unit tests. 189 | - If you're fixing a bug, add a test case that would have caught the bug. 190 | - Update the README.md if your changes affect the usage of the parser. 191 | - Submit a pull request with your changes, explaining the modifications and their purpose. 192 | 193 | 194 | > NB: For all contributions, please ensure your code passes all existing tests and include additional tests for the new parser. I also recommend using the `anchorLogScanner` function present in the `src/core/utils` file to get anchor program events from the transaction to avoid having to install anchor library (trying to make this library as lightweight as possible). 195 | 196 | ## 🗂️ License 197 | 198 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -------------------------------------------------------------------------------- /idl/pump-idl.ts: -------------------------------------------------------------------------------- 1 | export const PumpIDL = { 2 | version: '0.1.0', 3 | name: 'pump', 4 | instructions: [ 5 | { 6 | name: 'initialize', 7 | docs: ['Creates the global state.'], 8 | accounts: [ 9 | { 10 | name: 'global', 11 | isMut: true, 12 | isSigner: false, 13 | }, 14 | { 15 | name: 'user', 16 | isMut: true, 17 | isSigner: true, 18 | }, 19 | { 20 | name: 'systemProgram', 21 | isMut: false, 22 | isSigner: false, 23 | }, 24 | ], 25 | args: [], 26 | }, 27 | { 28 | name: 'setParams', 29 | docs: ['Sets the global state parameters.'], 30 | accounts: [ 31 | { 32 | name: 'global', 33 | isMut: true, 34 | isSigner: false, 35 | }, 36 | { 37 | name: 'user', 38 | isMut: true, 39 | isSigner: true, 40 | }, 41 | { 42 | name: 'systemProgram', 43 | isMut: false, 44 | isSigner: false, 45 | }, 46 | { 47 | name: 'eventAuthority', 48 | isMut: false, 49 | isSigner: false, 50 | }, 51 | { 52 | name: 'program', 53 | isMut: false, 54 | isSigner: false, 55 | }, 56 | ], 57 | args: [ 58 | { 59 | name: 'feeRecipient', 60 | type: 'publicKey', 61 | }, 62 | { 63 | name: 'initialVirtualTokenReserves', 64 | type: 'u64', 65 | }, 66 | { 67 | name: 'initialVirtualSolReserves', 68 | type: 'u64', 69 | }, 70 | { 71 | name: 'initialRealTokenReserves', 72 | type: 'u64', 73 | }, 74 | { 75 | name: 'tokenTotalSupply', 76 | type: 'u64', 77 | }, 78 | { 79 | name: 'feeBasisPoints', 80 | type: 'u64', 81 | }, 82 | ], 83 | }, 84 | { 85 | name: 'create', 86 | docs: ['Creates a new coin and bonding curve.'], 87 | accounts: [ 88 | { 89 | name: 'mint', 90 | isMut: true, 91 | isSigner: true, 92 | }, 93 | { 94 | name: 'mintAuthority', 95 | isMut: false, 96 | isSigner: false, 97 | }, 98 | { 99 | name: 'bondingCurve', 100 | isMut: true, 101 | isSigner: false, 102 | }, 103 | { 104 | name: 'associatedBondingCurve', 105 | isMut: true, 106 | isSigner: false, 107 | }, 108 | { 109 | name: 'global', 110 | isMut: false, 111 | isSigner: false, 112 | }, 113 | { 114 | name: 'mplTokenMetadata', 115 | isMut: false, 116 | isSigner: false, 117 | }, 118 | { 119 | name: 'metadata', 120 | isMut: true, 121 | isSigner: false, 122 | }, 123 | { 124 | name: 'user', 125 | isMut: true, 126 | isSigner: true, 127 | }, 128 | { 129 | name: 'systemProgram', 130 | isMut: false, 131 | isSigner: false, 132 | }, 133 | { 134 | name: 'tokenProgram', 135 | isMut: false, 136 | isSigner: false, 137 | }, 138 | { 139 | name: 'associatedTokenProgram', 140 | isMut: false, 141 | isSigner: false, 142 | }, 143 | { 144 | name: 'rent', 145 | isMut: false, 146 | isSigner: false, 147 | }, 148 | { 149 | name: 'eventAuthority', 150 | isMut: false, 151 | isSigner: false, 152 | }, 153 | { 154 | name: 'program', 155 | isMut: false, 156 | isSigner: false, 157 | }, 158 | ], 159 | args: [ 160 | { 161 | name: 'name', 162 | type: 'string', 163 | }, 164 | { 165 | name: 'symbol', 166 | type: 'string', 167 | }, 168 | { 169 | name: 'uri', 170 | type: 'string', 171 | }, 172 | ], 173 | }, 174 | { 175 | name: 'buy', 176 | docs: ['Buys tokens from a bonding curve.'], 177 | accounts: [ 178 | { 179 | name: 'global', 180 | isMut: false, 181 | isSigner: false, 182 | }, 183 | { 184 | name: 'feeRecipient', 185 | isMut: true, 186 | isSigner: false, 187 | }, 188 | { 189 | name: 'mint', 190 | isMut: false, 191 | isSigner: false, 192 | }, 193 | { 194 | name: 'bondingCurve', 195 | isMut: true, 196 | isSigner: false, 197 | }, 198 | { 199 | name: 'associatedBondingCurve', 200 | isMut: true, 201 | isSigner: false, 202 | }, 203 | { 204 | name: 'associatedUser', 205 | isMut: true, 206 | isSigner: false, 207 | }, 208 | { 209 | name: 'user', 210 | isMut: true, 211 | isSigner: true, 212 | }, 213 | { 214 | name: 'systemProgram', 215 | isMut: false, 216 | isSigner: false, 217 | }, 218 | { 219 | name: 'tokenProgram', 220 | isMut: false, 221 | isSigner: false, 222 | }, 223 | { 224 | name: 'rent', 225 | isMut: false, 226 | isSigner: false, 227 | }, 228 | { 229 | name: 'eventAuthority', 230 | isMut: false, 231 | isSigner: false, 232 | }, 233 | { 234 | name: 'program', 235 | isMut: false, 236 | isSigner: false, 237 | }, 238 | ], 239 | args: [ 240 | { 241 | name: 'amount', 242 | type: 'u64', 243 | }, 244 | { 245 | name: 'maxSolCost', 246 | type: 'u64', 247 | }, 248 | ], 249 | }, 250 | { 251 | name: 'sell', 252 | docs: ['Sells tokens into a bonding curve.'], 253 | accounts: [ 254 | { 255 | name: 'global', 256 | isMut: false, 257 | isSigner: false, 258 | }, 259 | { 260 | name: 'feeRecipient', 261 | isMut: true, 262 | isSigner: false, 263 | }, 264 | { 265 | name: 'mint', 266 | isMut: false, 267 | isSigner: false, 268 | }, 269 | { 270 | name: 'bondingCurve', 271 | isMut: true, 272 | isSigner: false, 273 | }, 274 | { 275 | name: 'associatedBondingCurve', 276 | isMut: true, 277 | isSigner: false, 278 | }, 279 | { 280 | name: 'associatedUser', 281 | isMut: true, 282 | isSigner: false, 283 | }, 284 | { 285 | name: 'user', 286 | isMut: true, 287 | isSigner: true, 288 | }, 289 | { 290 | name: 'systemProgram', 291 | isMut: false, 292 | isSigner: false, 293 | }, 294 | { 295 | name: 'associatedTokenProgram', 296 | isMut: false, 297 | isSigner: false, 298 | }, 299 | { 300 | name: 'tokenProgram', 301 | isMut: false, 302 | isSigner: false, 303 | }, 304 | { 305 | name: 'eventAuthority', 306 | isMut: false, 307 | isSigner: false, 308 | }, 309 | { 310 | name: 'program', 311 | isMut: false, 312 | isSigner: false, 313 | }, 314 | ], 315 | args: [ 316 | { 317 | name: 'amount', 318 | type: 'u64', 319 | }, 320 | { 321 | name: 'minSolOutput', 322 | type: 'u64', 323 | }, 324 | ], 325 | }, 326 | { 327 | name: 'withdraw', 328 | docs: [ 329 | 'Allows the admin to withdraw liquidity for a migration once the bonding curve completes', 330 | ], 331 | accounts: [ 332 | { 333 | name: 'global', 334 | isMut: false, 335 | isSigner: false, 336 | }, 337 | { 338 | name: 'mint', 339 | isMut: false, 340 | isSigner: false, 341 | }, 342 | { 343 | name: 'bondingCurve', 344 | isMut: true, 345 | isSigner: false, 346 | }, 347 | { 348 | name: 'associatedBondingCurve', 349 | isMut: true, 350 | isSigner: false, 351 | }, 352 | { 353 | name: 'associatedUser', 354 | isMut: true, 355 | isSigner: false, 356 | }, 357 | { 358 | name: 'user', 359 | isMut: true, 360 | isSigner: true, 361 | }, 362 | { 363 | name: 'systemProgram', 364 | isMut: false, 365 | isSigner: false, 366 | }, 367 | { 368 | name: 'tokenProgram', 369 | isMut: false, 370 | isSigner: false, 371 | }, 372 | { 373 | name: 'rent', 374 | isMut: false, 375 | isSigner: false, 376 | }, 377 | { 378 | name: 'eventAuthority', 379 | isMut: false, 380 | isSigner: false, 381 | }, 382 | { 383 | name: 'program', 384 | isMut: false, 385 | isSigner: false, 386 | }, 387 | ], 388 | args: [], 389 | }, 390 | ], 391 | accounts: [ 392 | { 393 | name: 'Global', 394 | type: { 395 | kind: 'struct', 396 | fields: [ 397 | { 398 | name: 'initialized', 399 | type: 'bool', 400 | }, 401 | { 402 | name: 'authority', 403 | type: 'publicKey', 404 | }, 405 | { 406 | name: 'feeRecipient', 407 | type: 'publicKey', 408 | }, 409 | { 410 | name: 'initialVirtualTokenReserves', 411 | type: 'u64', 412 | }, 413 | { 414 | name: 'initialVirtualSolReserves', 415 | type: 'u64', 416 | }, 417 | { 418 | name: 'initialRealTokenReserves', 419 | type: 'u64', 420 | }, 421 | { 422 | name: 'tokenTotalSupply', 423 | type: 'u64', 424 | }, 425 | { 426 | name: 'feeBasisPoints', 427 | type: 'u64', 428 | }, 429 | ], 430 | }, 431 | }, 432 | { 433 | name: 'BondingCurve', 434 | type: { 435 | kind: 'struct', 436 | fields: [ 437 | { 438 | name: 'virtualTokenReserves', 439 | type: 'u64', 440 | }, 441 | { 442 | name: 'virtualSolReserves', 443 | type: 'u64', 444 | }, 445 | { 446 | name: 'realTokenReserves', 447 | type: 'u64', 448 | }, 449 | { 450 | name: 'realSolReserves', 451 | type: 'u64', 452 | }, 453 | { 454 | name: 'tokenTotalSupply', 455 | type: 'u64', 456 | }, 457 | { 458 | name: 'complete', 459 | type: 'bool', 460 | }, 461 | ], 462 | }, 463 | }, 464 | ], 465 | events: [ 466 | { 467 | name: 'CreateEvent', 468 | fields: [ 469 | { 470 | name: 'name', 471 | type: 'string', 472 | index: false, 473 | }, 474 | { 475 | name: 'symbol', 476 | type: 'string', 477 | index: false, 478 | }, 479 | { 480 | name: 'uri', 481 | type: 'string', 482 | index: false, 483 | }, 484 | { 485 | name: 'mint', 486 | type: 'publicKey', 487 | index: false, 488 | }, 489 | { 490 | name: 'bondingCurve', 491 | type: 'publicKey', 492 | index: false, 493 | }, 494 | { 495 | name: 'user', 496 | type: 'publicKey', 497 | index: false, 498 | }, 499 | ], 500 | }, 501 | { 502 | name: 'TradeEvent', 503 | fields: [ 504 | { 505 | name: 'mint', 506 | type: 'publicKey', 507 | index: false, 508 | }, 509 | { 510 | name: 'solAmount', 511 | type: 'u64', 512 | index: false, 513 | }, 514 | { 515 | name: 'tokenAmount', 516 | type: 'u64', 517 | index: false, 518 | }, 519 | { 520 | name: 'isBuy', 521 | type: 'bool', 522 | index: false, 523 | }, 524 | { 525 | name: 'user', 526 | type: 'publicKey', 527 | index: false, 528 | }, 529 | { 530 | name: 'timestamp', 531 | type: 'i64', 532 | index: false, 533 | }, 534 | { 535 | name: 'virtualSolReserves', 536 | type: 'u64', 537 | index: false, 538 | }, 539 | { 540 | name: 'virtualTokenReserves', 541 | type: 'u64', 542 | index: false, 543 | }, 544 | ], 545 | }, 546 | { 547 | name: 'CompleteEvent', 548 | fields: [ 549 | { 550 | name: 'user', 551 | type: 'publicKey', 552 | index: false, 553 | }, 554 | { 555 | name: 'mint', 556 | type: 'publicKey', 557 | index: false, 558 | }, 559 | { 560 | name: 'bondingCurve', 561 | type: 'publicKey', 562 | index: false, 563 | }, 564 | { 565 | name: 'timestamp', 566 | type: 'i64', 567 | index: false, 568 | }, 569 | ], 570 | }, 571 | { 572 | name: 'SetParamsEvent', 573 | fields: [ 574 | { 575 | name: 'feeRecipient', 576 | type: 'publicKey', 577 | index: false, 578 | }, 579 | { 580 | name: 'initialVirtualTokenReserves', 581 | type: 'u64', 582 | index: false, 583 | }, 584 | { 585 | name: 'initialVirtualSolReserves', 586 | type: 'u64', 587 | index: false, 588 | }, 589 | { 590 | name: 'initialRealTokenReserves', 591 | type: 'u64', 592 | index: false, 593 | }, 594 | { 595 | name: 'tokenTotalSupply', 596 | type: 'u64', 597 | index: false, 598 | }, 599 | { 600 | name: 'feeBasisPoints', 601 | type: 'u64', 602 | index: false, 603 | }, 604 | ], 605 | }, 606 | ], 607 | errors: [ 608 | { 609 | code: 6000, 610 | name: 'NotAuthorized', 611 | msg: 'The given account is not authorized to execute this instruction.', 612 | }, 613 | { 614 | code: 6001, 615 | name: 'AlreadyInitialized', 616 | msg: 'The program is already initialized.', 617 | }, 618 | { 619 | code: 6002, 620 | name: 'TooMuchSolRequired', 621 | msg: 'slippage: Too much SOL required to buy the given amount of tokens.', 622 | }, 623 | { 624 | code: 6003, 625 | name: 'TooLittleSolReceived', 626 | msg: 'slippage: Too little SOL received to sell the given amount of tokens.', 627 | }, 628 | { 629 | code: 6004, 630 | name: 'MintDoesNotMatchBondingCurve', 631 | msg: 'The mint does not match the bonding curve.', 632 | }, 633 | { 634 | code: 6005, 635 | name: 'BondingCurveComplete', 636 | msg: 'The bonding curve has completed and liquidity migrated to raydium.', 637 | }, 638 | { 639 | code: 6006, 640 | name: 'BondingCurveNotComplete', 641 | msg: 'The bonding curve has not completed.', 642 | }, 643 | { 644 | code: 6007, 645 | name: 'NotInitialized', 646 | msg: 'The program is not initialized.', 647 | }, 648 | ], 649 | metadata: { 650 | address: '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P', 651 | }, 652 | }; 653 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "solana-parser", 3 | "version": "0.1.4", 4 | "main": "dist/index.js", 5 | "types": "dist/types/index.d.ts", 6 | "files": [ 7 | "dist", 8 | "README.md", 9 | "LICENSE" 10 | ], 11 | "scripts": { 12 | "clean": "rimraf dist", 13 | "build": "npm run clean && tsc && rm tsconfig.tsbuildinfo", 14 | "build:types": "tsc --emitDeclarationOnly", 15 | "test": "jest", 16 | "format": "prettier --write \"src/**/*.ts\" && prettier --write \"tests/**/*.ts\"", 17 | "format:check": "prettier --check \"src/**/*.ts\"", 18 | "check:types": "tsc --noEmit" 19 | }, 20 | "exports": { 21 | ".": { 22 | "types": "./dist/types/index.d.ts", 23 | "require": "./dist/index.js", 24 | "import": "./dist/index.js" 25 | } 26 | }, 27 | "typesVersions": { 28 | "*": { 29 | "*": ["dist/types/*"] 30 | } 31 | }, 32 | "jest": { 33 | "preset": "ts-jest", 34 | "testEnvironment": "node", 35 | "roots": [ 36 | "/src", 37 | "/tests" 38 | ], 39 | "testMatch": [ 40 | "**/tests/**/*.+(ts|tsx|js)", 41 | "**/?(*.)+(spec|test).+(ts|tsx|js)" 42 | ], 43 | "transform": { 44 | "^.+\\.(ts|tsx)$": "ts-jest" 45 | } 46 | }, 47 | "keywords": [ 48 | "blockchain", 49 | "solana", 50 | "transaction", 51 | "parser", 52 | "raydium", 53 | "pumpfun", 54 | "jupiter", 55 | "instruction", 56 | "web3", 57 | "defi" 58 | ], 59 | "author": "Oluwatobiloba Emmanuel", 60 | "license": "MIT", 61 | "description": "lightweight transaction parser for popular DeFi applications on the Solana blockchain, written in TypeScript.", 62 | "dependencies": { 63 | "@noble/hashes": "^1.5.0", 64 | "@solana/web3.js": "^1.95.3", 65 | "bs58": "^6.0.0" 66 | }, 67 | "devDependencies": { 68 | "@types/jest": "^29.5.12", 69 | "@typescript-eslint/eslint-plugin": "^8.4.0", 70 | "@typescript-eslint/parser": "^8.4.0", 71 | "jest": "^29.7.0", 72 | "prettier": "^3.3.3", 73 | "rimraf": "^5.0.10", 74 | "ts-jest": "^29.2.5", 75 | "typescript": "^5.7.3" 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/core/base.ts: -------------------------------------------------------------------------------- 1 | import { ParsedTransactionWithMeta } from '@solana/web3.js'; 2 | 3 | export type BaseParsedAction = { 4 | type: string; 5 | }; 6 | 7 | export type BaseParsedTransaction = { 8 | platform: string; 9 | actions: T[]; 10 | }; 11 | 12 | export interface BaseParser> { 13 | parse(transaction: ParsedTransactionWithMeta): T | null; 14 | parseMultiple(transactions: ParsedTransactionWithMeta[]): T[] | null; 15 | } 16 | 17 | export interface AsyncBaseParser> { 18 | parse(transaction: ParsedTransactionWithMeta): Promise; 19 | parseMultiple(transactions: ParsedTransactionWithMeta[]): Promise; 20 | } 21 | -------------------------------------------------------------------------------- /src/core/layout.ts: -------------------------------------------------------------------------------- 1 | import { blob, Layout } from '@solana/buffer-layout'; 2 | import { PublicKey } from '@solana/web3.js'; 3 | 4 | export const pubKey = (property: string): Layout => { 5 | const layout = blob(32, property); 6 | const pubKeyLayout = layout as Layout as Layout; 7 | const decode = layout.decode.bind(layout); 8 | pubKeyLayout.decode = (buffer: Buffer, offset: number) => { 9 | const src = decode(buffer, offset); 10 | return new PublicKey(src); 11 | }; 12 | return pubKeyLayout; 13 | }; 14 | 15 | export const uint64 = (property: string): Layout => { 16 | const layout = blob(8, property); 17 | const uint64Layout = layout as Layout as Layout; 18 | const decode = layout.decode.bind(layout); 19 | uint64Layout.decode = (buffer: Buffer, offset: number) => { 20 | const src = decode(buffer, offset); 21 | return Buffer.from(src).readBigUInt64LE(); 22 | }; 23 | return uint64Layout; 24 | }; 25 | 26 | export const uint128 = (property: string): Layout => { 27 | const layout = blob(16, property); 28 | const uint128Layout = layout as Layout as Layout; 29 | const decode = layout.decode.bind(layout); 30 | uint128Layout.decode = (buffer: Buffer, offset: number) => { 31 | const src = decode(buffer, offset); 32 | return Buffer.from(src).readBigUInt64LE(); 33 | }; 34 | return uint128Layout; 35 | }; 36 | 37 | export const stringLayout = (property: string): Layout => { 38 | const layout = blob(4, property); 39 | const stringLayout = layout as Layout as Layout; 40 | 41 | stringLayout.decode = (buffer: Buffer, offset: number) => { 42 | const length = buffer.readUInt32LE(offset); 43 | return buffer.slice(offset + 4, offset + 4 + length).toString('utf-8'); 44 | }; 45 | 46 | stringLayout.getSpan = (buffer: Buffer, offset: number) => { 47 | const length = buffer.readUInt32LE(offset); 48 | return 4 + length; 49 | }; 50 | 51 | return stringLayout; 52 | }; 53 | 54 | export const boolean = (property: string): Layout => { 55 | const layout = blob(1, property); 56 | const booleanLayout = layout as Layout as Layout; 57 | const decode = layout.decode.bind(layout); 58 | booleanLayout.decode = (buffer: Buffer, offset: number) => { 59 | const src = decode(buffer, offset); 60 | return src[0] === 1; 61 | }; 62 | return booleanLayout; 63 | }; 64 | -------------------------------------------------------------------------------- /src/core/lru.ts: -------------------------------------------------------------------------------- 1 | class LRUNode { 2 | key: string; 3 | value: V; 4 | prev: LRUNode | null = null; 5 | next: LRUNode | null = null; 6 | 7 | constructor(key: string, value: V) { 8 | this.key = key; 9 | this.value = value; 10 | } 11 | } 12 | 13 | export class LRUCache { 14 | private capacity: number; 15 | private cache: Map>; 16 | private head: LRUNode | null = null; 17 | private tail: LRUNode | null = null; 18 | 19 | constructor(capacity: number) { 20 | this.capacity = capacity; 21 | this.cache = new Map(); 22 | } 23 | 24 | get(key: string): V | null { 25 | const node = this.cache.get(key); 26 | if (!node) return null; 27 | 28 | this.moveToFront(node); 29 | return node.value; 30 | } 31 | 32 | set(key: string, value: V): void { 33 | if (this.cache.has(key)) { 34 | const node = this.cache.get(key)!; 35 | node.value = value; 36 | this.moveToFront(node); 37 | return; 38 | } 39 | 40 | const newNode = new LRUNode(key, value); 41 | if (this.cache.size >= this.capacity) { 42 | if (this.tail) { 43 | this.cache.delete(this.tail.key); 44 | this.removeNode(this.tail); 45 | } 46 | } 47 | 48 | this.cache.set(key, newNode); 49 | this.addToFront(newNode); 50 | } 51 | 52 | private moveToFront(node: LRUNode): void { 53 | this.removeNode(node); 54 | this.addToFront(node); 55 | } 56 | 57 | private removeNode(node: LRUNode): void { 58 | if (node.prev) node.prev.next = node.next; 59 | if (node.next) node.next.prev = node.prev; 60 | if (node === this.head) this.head = node.next; 61 | if (node === this.tail) this.tail = node.prev; 62 | } 63 | 64 | private addToFront(node: LRUNode): void { 65 | node.prev = null; 66 | node.next = this.head; 67 | 68 | if (this.head) this.head.prev = node; 69 | this.head = node; 70 | 71 | if (!this.tail) this.tail = node; 72 | } 73 | 74 | clear(): void { 75 | this.cache.clear(); 76 | this.head = null; 77 | this.tail = null; 78 | } 79 | 80 | get size(): number { 81 | return this.cache.size; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/core/utils.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ParsedInstruction, 3 | ParsedTransactionWithMeta, 4 | PartiallyDecodedInstruction, 5 | PublicKey, 6 | } from '@solana/web3.js'; 7 | import { sha256 } from '@noble/hashes/sha256'; 8 | 9 | export const anchorLogScanner = (logs: string[], programId: string) => { 10 | const executionStack: string[] = []; 11 | const programEvents: { [key: string]: string[] } = {}; 12 | 13 | for (const log of logs) { 14 | if (log.includes('invoke')) { 15 | const program = log.split(' ')[1]; 16 | executionStack.push(program); 17 | if (programEvents[program] == undefined) { 18 | programEvents[program] = []; 19 | } 20 | } else { 21 | const currentProgram = executionStack[executionStack.length - 1]; 22 | if (log.match(/^Program (.*) success/g) !== null) { 23 | executionStack.pop(); 24 | continue; 25 | } 26 | if (currentProgram == programId) { 27 | if (log.startsWith('Program data: ')) { 28 | const data = log.split('Program data: ')[1]; 29 | programEvents[currentProgram].push(data); 30 | } 31 | continue; 32 | } 33 | } 34 | } 35 | return programEvents[programId]; 36 | }; 37 | 38 | export const createAnchorSigHash = (sig: string) => { 39 | return Buffer.from(sha256(sig).slice(0, 8)); 40 | }; 41 | 42 | export const flattenTransactionInstructions = (transaction: ParsedTransactionWithMeta) => { 43 | // Takes a parsed transaction and creates a sorted array of all the instructions (including cpi calls) 44 | let txnIxs = transaction.transaction.message.instructions; 45 | let cpiIxs = transaction.meta?.innerInstructions?.sort((a, b) => a.index - b.index) || []; 46 | const totalCalls = cpiIxs.reduce((acc, ix) => acc + ix.instructions.length, 0) + txnIxs.length; 47 | 48 | const flattended = []; 49 | let lastPushedIx = -1; 50 | let currCallIndex = -1; 51 | for (const cpiIx of cpiIxs) { 52 | while (lastPushedIx != cpiIx.index) { 53 | lastPushedIx += 1; 54 | currCallIndex += 1; 55 | flattended.push(txnIxs[lastPushedIx]); 56 | } 57 | for (const innerIx of cpiIx.instructions) { 58 | flattended.push(innerIx); 59 | currCallIndex += 1; 60 | } 61 | } 62 | while (currCallIndex < totalCalls - 1) { 63 | lastPushedIx += 1; 64 | currCallIndex += 1; 65 | flattended.push(txnIxs[lastPushedIx]); 66 | } 67 | return flattended; 68 | }; 69 | 70 | export const getAccountSOLBalanceChange = ( 71 | transaction: ParsedTransactionWithMeta, 72 | account: PublicKey 73 | ) => { 74 | const accountIndex = transaction.transaction.message.accountKeys.findIndex( 75 | (acct) => acct.pubkey.toString() == account.toString() 76 | ); 77 | if (accountIndex == -1) return 0; 78 | const preBalances = transaction.meta?.preBalances || []; 79 | const postBalances = transaction.meta?.postBalances || []; 80 | return Math.abs(postBalances[accountIndex] - preBalances[accountIndex]); 81 | }; 82 | 83 | export const getSplTransfers = ( 84 | instructions: (ParsedInstruction | PartiallyDecodedInstruction)[] 85 | ) => { 86 | return instructions.filter( 87 | (ix) => 88 | ix.programId.toString() == 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA' && 89 | // @ts-ignore 90 | ix.parsed.type == 'transfer' 91 | ); 92 | }; 93 | 94 | export const getSOLTransfers = ( 95 | instructions: (ParsedInstruction | PartiallyDecodedInstruction)[] 96 | ) => { 97 | return instructions.filter( 98 | (ix) => 99 | ix.programId.toString() == '11111111111111111111111111111111' && 100 | // @ts-ignore 101 | ix.parsed.type == 'transfer' 102 | ); 103 | }; 104 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './parser/pumpfun'; 2 | export * from './parser/raydium'; 3 | -------------------------------------------------------------------------------- /src/parser/pumpfun/index.ts: -------------------------------------------------------------------------------- 1 | export * from './parser'; 2 | -------------------------------------------------------------------------------- /src/parser/pumpfun/layout.ts: -------------------------------------------------------------------------------- 1 | import { struct } from '@solana/buffer-layout'; 2 | import { CreateEvent, TradeEvent, CompleteEvent } from './types'; 3 | import { stringLayout, pubKey, uint64, boolean } from '../../core/layout'; 4 | 5 | export const CREATE_EVENT_LAYOUT = struct([ 6 | stringLayout('name'), 7 | stringLayout('symbol'), 8 | stringLayout('uri'), 9 | pubKey('mint'), 10 | pubKey('bondingCurve'), 11 | pubKey('user'), 12 | ]); 13 | 14 | export const TRADE_EVENT_LAYOUT = struct([ 15 | pubKey('mint'), 16 | uint64('solAmount'), 17 | uint64('tokenAmount'), 18 | boolean('isBuy'), 19 | pubKey('user'), 20 | uint64('timestamp'), 21 | uint64('virtualSolReserves'), 22 | uint64('virtualTokenReserves'), 23 | ]); 24 | 25 | export const COMPLETE_EVENT_LAYOUT = struct([ 26 | pubKey('user'), 27 | pubKey('mint'), 28 | pubKey('bondingCurve'), 29 | uint64('timestamp'), 30 | ]); 31 | -------------------------------------------------------------------------------- /src/parser/pumpfun/parser.ts: -------------------------------------------------------------------------------- 1 | import { ParsedTransactionWithMeta, PublicKey } from '@solana/web3.js'; 2 | import { BaseParser } from '../../core/base'; 3 | import { 4 | PumpFunTransaction, 5 | PumpFunAction, 6 | CREATE_EVENT_SIG, 7 | COMPLETE_EVENT_SIG, 8 | TRADE_EVENT_SIG, 9 | ActionType, 10 | } from './types'; 11 | import { createAnchorSigHash } from '../../core/utils'; 12 | import { anchorLogScanner } from '../../core/utils'; 13 | import { CREATE_EVENT_LAYOUT, COMPLETE_EVENT_LAYOUT, TRADE_EVENT_LAYOUT } from './layout'; 14 | 15 | export class PumpFunParser implements BaseParser { 16 | private readonly discriminators = { 17 | create: createAnchorSigHash(CREATE_EVENT_SIG), 18 | trade: createAnchorSigHash(TRADE_EVENT_SIG), 19 | complete: createAnchorSigHash(COMPLETE_EVENT_SIG), 20 | } as const; 21 | readonly PROGRAM_ID = new PublicKey('6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P'); 22 | 23 | private decodeEvent(event: string): PumpFunAction { 24 | const discriminator = Buffer.from(event, 'base64').slice(0, 8); 25 | const remainder = Buffer.from(event, 'base64').slice(8); 26 | if (discriminator.equals(this.discriminators.create)) { 27 | const createEvent = CREATE_EVENT_LAYOUT.decode(remainder); 28 | return { 29 | type: ActionType.CREATE, 30 | info: { 31 | name: createEvent.name, 32 | symbol: createEvent.symbol, 33 | uri: createEvent.uri, 34 | tokenMint: createEvent.mint, 35 | createdBy: createEvent.user, 36 | bondingCurve: createEvent.bondingCurve, 37 | tokenDecimals: 6, 38 | }, 39 | }; 40 | } 41 | if (discriminator.equals(this.discriminators.trade)) { 42 | const tradeEvent = TRADE_EVENT_LAYOUT.decode(remainder); 43 | return { 44 | type: ActionType.TRADE, 45 | info: { 46 | solAmount: tradeEvent.solAmount, 47 | tokenAmount: tradeEvent.tokenAmount, 48 | tokenMint: tradeEvent.mint, 49 | trader: tradeEvent.user, 50 | isBuy: tradeEvent.isBuy, 51 | timestamp: tradeEvent.timestamp, 52 | virtualSolReserves: tradeEvent.virtualSolReserves, 53 | virtualTokenReserves: tradeEvent.virtualTokenReserves, 54 | }, 55 | }; 56 | } 57 | if (discriminator.equals(this.discriminators.complete)) { 58 | const completeEvent = COMPLETE_EVENT_LAYOUT.decode(remainder); 59 | return { 60 | type: ActionType.COMPLETE, 61 | info: { 62 | user: completeEvent.user, 63 | tokenMint: completeEvent.mint, 64 | bondingCurve: completeEvent.bondingCurve, 65 | timestamp: completeEvent.timestamp, 66 | }, 67 | }; 68 | } 69 | return { 70 | type: ActionType.UNKNOWN, 71 | info: {}, 72 | } as PumpFunAction; 73 | } 74 | 75 | parse(transaction: ParsedTransactionWithMeta): PumpFunTransaction { 76 | const transactionResult: PumpFunTransaction = { 77 | actions: [], 78 | platform: 'pumpfun', 79 | }; 80 | const events = anchorLogScanner( 81 | transaction.meta?.logMessages ?? [], 82 | this.PROGRAM_ID.toBase58() 83 | ); 84 | const actions = events.map((event) => this.decodeEvent(event)); 85 | transactionResult.actions = actions; 86 | return transactionResult; 87 | } 88 | 89 | parseMultiple(transactions: ParsedTransactionWithMeta[]): PumpFunTransaction[] { 90 | return transactions.map((txn) => this.parse(txn)); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/parser/pumpfun/types.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from '@solana/web3.js'; 2 | import { BaseParsedTransaction } from '../../core/base'; 3 | import { BaseParsedAction } from '../../core/base'; 4 | 5 | export const CREATE_EVENT_SIG = 'event:CreateEvent'; 6 | export const COMPLETE_EVENT_SIG = 'event:CompleteEvent'; 7 | export const TRADE_EVENT_SIG = 'event:TradeEvent'; 8 | 9 | export enum ActionType { 10 | CREATE = 'create', 11 | COMPLETE = 'complete', 12 | TRADE = 'trade', 13 | UNKNOWN = 'unknown', 14 | } 15 | 16 | export type CreateEvent = { 17 | name: string; 18 | symbol: string; 19 | uri: string; 20 | mint: PublicKey; 21 | bondingCurve: PublicKey; 22 | user: PublicKey; 23 | }; 24 | 25 | export type CompleteEvent = { 26 | user: PublicKey; 27 | mint: PublicKey; 28 | bondingCurve: PublicKey; 29 | timestamp: bigint; 30 | }; 31 | 32 | export type TradeEvent = { 33 | mint: PublicKey; 34 | solAmount: bigint; 35 | tokenAmount: bigint; 36 | isBuy: boolean; 37 | user: PublicKey; 38 | timestamp: bigint; 39 | virtualSolReserves: bigint; 40 | virtualTokenReserves: bigint; 41 | }; 42 | 43 | export type TradeInfo = { 44 | solAmount: bigint; 45 | tokenAmount: bigint; 46 | tokenMint: PublicKey; 47 | trader: PublicKey; 48 | isBuy: boolean; 49 | timestamp: bigint; 50 | virtualSolReserves: bigint; 51 | virtualTokenReserves: bigint; 52 | }; 53 | 54 | export type CreateInfo = { 55 | name: string; 56 | symbol: string; 57 | uri: string; 58 | tokenMint: PublicKey; 59 | bondingCurve: PublicKey; 60 | tokenDecimals: number; 61 | createdBy: PublicKey; 62 | }; 63 | 64 | export type CompleteInfo = { 65 | user: PublicKey; 66 | tokenMint: PublicKey; 67 | bondingCurve: PublicKey; 68 | timestamp: BigInt; 69 | }; 70 | 71 | export interface PumpFunAction extends BaseParsedAction { 72 | info: TradeInfo | CreateInfo | CompleteInfo; 73 | } 74 | 75 | export interface PumpFunTransaction extends BaseParsedTransaction { 76 | actions: PumpFunAction[]; 77 | } 78 | -------------------------------------------------------------------------------- /src/parser/raydium/index.ts: -------------------------------------------------------------------------------- 1 | export { RaydiumV4Parser } from './v4/parser'; 2 | -------------------------------------------------------------------------------- /src/parser/raydium/v4/layout.ts: -------------------------------------------------------------------------------- 1 | import { struct, u8, blob } from '@solana/buffer-layout'; 2 | import { pubKey, uint64, uint128 } from '../../../core/layout'; 3 | import { InitPool, Deposit, Withdraw, SwapBaseIn, SwapBaseOut, PoolInfo } from './types'; 4 | 5 | export const INIT_POOL_LAYOUT = struct([ 6 | uint64('timestamp'), 7 | u8('quoteDecimals'), 8 | u8('baseDecimals'), 9 | uint64('quoteLotSize'), 10 | uint64('baseLotSize'), 11 | uint64('quoteAmountIn'), 12 | uint64('baseAmountIn'), 13 | pubKey('marketId'), 14 | ]); 15 | 16 | export const DEPOSIT_LAYOUT = struct([ 17 | uint64('maxBaseAmount'), 18 | uint64('maxQuoteAmount'), 19 | uint64('fixedSide'), 20 | uint64('baseReserve'), 21 | uint64('quoteReserve'), 22 | uint64('poolLpAmount'), 23 | uint128('pnlX'), 24 | uint128('pnlY'), 25 | uint64('baseAmountIn'), 26 | uint64('quoteAmountIn'), 27 | uint64('mintedLpAmount'), 28 | ]); 29 | 30 | export const WITHDRAW_LAYOUT = struct([ 31 | uint64('withdrawLpAmount'), 32 | uint64('userLpAmount'), 33 | uint64('baseReserve'), 34 | uint64('quoteReserve'), 35 | uint64('poolLpAmount'), 36 | uint128('pnlX'), 37 | uint128('pnlY'), 38 | uint64('baseAmountOut'), 39 | uint64('quoteAmountOut'), 40 | ]); 41 | 42 | export const SWAP_BASE_IN_LAYOUT = struct([ 43 | uint64('amountIn'), 44 | uint64('minimumAmountOut'), 45 | uint64('direction'), 46 | uint64('userSource'), 47 | uint64('baseReserve'), 48 | uint64('quoteReserve'), 49 | uint64('amountOut'), 50 | ]); 51 | 52 | export const SWAP_BASE_OUT_LAYOUT = struct([ 53 | uint64('maxAmountIn'), 54 | uint64('amountOut'), 55 | uint64('direction'), 56 | uint64('userSource'), 57 | uint64('baseReserve'), 58 | uint64('quoteReserve'), 59 | uint64('amountIn'), 60 | ]); 61 | 62 | export const RAY_AMM_V4_POOL_LAYOUT = struct([ 63 | uint64('status'), 64 | uint64('nonce'), 65 | uint64('maxOrder'), 66 | uint64('depth'), 67 | uint64('baseDecimal'), 68 | uint64('quoteDecimal'), 69 | uint64('state'), 70 | uint64('resetFlag'), 71 | uint64('minSize'), 72 | uint64('volMaxCutRatio'), 73 | uint64('amountWaveRatio'), 74 | uint64('baseLotSize'), 75 | uint64('quoteLotSize'), 76 | uint64('minPriceMultiplier'), 77 | uint64('maxPriceMultiplier'), 78 | uint64('systemDecimalValue'), 79 | uint64('minSeparateNumerator'), 80 | uint64('minSeparateDenominator'), 81 | uint64('tradeFeeNumerator'), 82 | uint64('tradeFeeDenominator'), 83 | uint64('pnlNumerator'), 84 | uint64('pnlDenominator'), 85 | uint64('swapFeeNumerator'), 86 | uint64('swapFeeDenominator'), 87 | uint64('baseNeedTakePnl'), 88 | uint64('quoteNeedTakePnl'), 89 | uint64('quoteTotalPnl'), 90 | uint64('baseTotalPnl'), 91 | uint64('poolOpenTime'), 92 | uint64('punishPcAmount'), 93 | uint64('punishCoinAmount'), 94 | uint64('orderbookToInitTime'), 95 | uint128('swapBaseInAmount'), 96 | uint128('swapQuoteOutAmount'), 97 | uint64('swapBase2QuoteFee'), 98 | uint128('swapQuoteInAmount'), 99 | uint128('swapBaseOutAmount'), 100 | uint64('swapQuote2BaseFee'), 101 | pubKey('baseVault'), 102 | pubKey('quoteVault'), 103 | pubKey('baseMint'), 104 | pubKey('quoteMint'), 105 | pubKey('lpMint'), 106 | pubKey('openOrders'), 107 | pubKey('marketId'), 108 | pubKey('marketProgramId'), 109 | pubKey('targetOrders'), 110 | pubKey('withdrawQueue'), 111 | pubKey('lpVault'), 112 | pubKey('owner'), 113 | uint64('lpReserve'), 114 | blob(24, 'padding'), 115 | ]); 116 | -------------------------------------------------------------------------------- /src/parser/raydium/v4/parser.ts: -------------------------------------------------------------------------------- 1 | import { Connection, ParsedTransactionWithMeta, PublicKey } from '@solana/web3.js'; 2 | import { AsyncBaseParser } from '../../../core/base'; 3 | import { LRUCache } from '../../../core/lru'; 4 | import { 5 | ActionType, 6 | DEPOSIT_LOG_TYPE, 7 | INIT_LOG_TYPE, 8 | InitPool, 9 | RaydiumV4Transaction, 10 | RayV4Program, 11 | SWAP_BASE_IN_LOG_TYPE, 12 | SWAP_BASE_OUT_LOG_TYPE, 13 | Withdraw, 14 | WITHDRAW_LOG_TYPE, 15 | PoolInfo, 16 | SwapBaseIn, 17 | SwapBaseOut, 18 | Deposit, 19 | } from './types'; 20 | import { 21 | DEPOSIT_LAYOUT, 22 | INIT_POOL_LAYOUT, 23 | RAY_AMM_V4_POOL_LAYOUT, 24 | SWAP_BASE_IN_LAYOUT, 25 | SWAP_BASE_OUT_LAYOUT, 26 | WITHDRAW_LAYOUT, 27 | } from './layout'; 28 | import { flattenTransactionInstructions } from '../../../core/utils'; 29 | 30 | export class RaydiumV4Parser implements AsyncBaseParser { 31 | private poolInfoCache: LRUCache; 32 | private connection: Connection; 33 | 34 | constructor(rpcConnection: Connection, options: { maxPoolCache?: number }) { 35 | this.connection = rpcConnection; 36 | this.poolInfoCache = new LRUCache(options.maxPoolCache || 100); 37 | } 38 | 39 | getRayLogs(transaction: ParsedTransactionWithMeta) { 40 | return transaction.meta?.logMessages?.filter((msg) => msg.includes('ray_log')); 41 | } 42 | 43 | decodeRayLog(msg: string) { 44 | const logData = msg.match(/^Program log: ray_log: (.+)$/)?.[1] ?? msg; 45 | const logBuffer = Buffer.from(logData, 'base64'); 46 | const logType = logBuffer.slice(0, 1).readInt8(); 47 | const dataBuffer = logBuffer.slice(1); 48 | 49 | switch (logType) { 50 | case INIT_LOG_TYPE: 51 | return { ...INIT_POOL_LAYOUT.decode(dataBuffer), logType }; 52 | case DEPOSIT_LOG_TYPE: 53 | return { ...DEPOSIT_LAYOUT.decode(dataBuffer), logType }; 54 | case WITHDRAW_LOG_TYPE: 55 | return { ...WITHDRAW_LAYOUT.decode(dataBuffer), logType }; 56 | case SWAP_BASE_IN_LOG_TYPE: 57 | return { ...SWAP_BASE_IN_LAYOUT.decode(dataBuffer), logType }; 58 | case SWAP_BASE_OUT_LOG_TYPE: 59 | return { ...SWAP_BASE_OUT_LAYOUT.decode(dataBuffer), logType }; 60 | default: 61 | return null; 62 | } 63 | } 64 | 65 | async getPoolInfo(poolId: string) { 66 | const info = this.poolInfoCache.get(poolId); 67 | if (info) return info; 68 | const poolInfo = await this.connection.getAccountInfo(new PublicKey(poolId)); 69 | if (!poolInfo) return null; 70 | const parsedInfo = RAY_AMM_V4_POOL_LAYOUT.decode(poolInfo.data); 71 | this.poolInfoCache.set(poolId, { 72 | baseMint: parsedInfo.baseMint, 73 | quoteMint: parsedInfo.quoteMint, 74 | baseDecimal: parsedInfo.baseDecimal, 75 | quoteDecimal: parsedInfo.quoteDecimal, 76 | }); 77 | return parsedInfo; 78 | } 79 | 80 | private async handleSwap( 81 | parsedLog: SwapBaseIn | SwapBaseOut, 82 | instruction: { accounts: PublicKey[] } 83 | ) { 84 | const poolId = instruction.accounts[1]; 85 | const user = instruction.accounts[instruction.accounts.length - 1]; 86 | const poolInfo = await this.getPoolInfo(poolId.toString()); 87 | if (!poolInfo) return null; 88 | switch (parsedLog.logType) { 89 | case SWAP_BASE_IN_LOG_TYPE: 90 | return { 91 | type: ActionType.SWAP, 92 | info: { 93 | amountIn: parsedLog.amountIn, 94 | amountOut: parsedLog.amountOut, 95 | baseReserve: parsedLog.baseReserve, 96 | quoteReserve: parsedLog.quoteReserve, 97 | tokenIn: parsedLog.direction == 1n ? poolInfo.quoteMint : poolInfo.baseMint, 98 | tokenInDecimal: 99 | parsedLog.direction == 1n 100 | ? poolInfo.quoteDecimal 101 | : poolInfo.baseDecimal, 102 | tokenOut: 103 | parsedLog.direction == 1n ? poolInfo.baseMint : poolInfo.quoteMint, 104 | tokenOutDecimal: 105 | parsedLog.direction == 1n 106 | ? poolInfo.baseDecimal 107 | : poolInfo.quoteDecimal, 108 | user, 109 | poolId, 110 | }, 111 | }; 112 | default: 113 | return { 114 | type: ActionType.SWAP, 115 | info: { 116 | amountIn: parsedLog.amountIn, 117 | amountOut: parsedLog.amountOut, 118 | baseReserve: parsedLog.baseReserve, 119 | quoteReserve: parsedLog.quoteReserve, 120 | tokenIn: poolInfo.quoteMint, 121 | tokenInDecimal: poolInfo.quoteDecimal, 122 | tokenOut: poolInfo.baseMint, 123 | tokenOutDecimal: poolInfo.baseDecimal, 124 | user, 125 | poolId, 126 | }, 127 | }; 128 | } 129 | } 130 | 131 | private handleCreatePool(parsedLog: InitPool, instruction: { accounts: PublicKey[] }) { 132 | return { 133 | type: ActionType.CREATE, 134 | info: { 135 | baseDecimals: parsedLog.baseDecimals, 136 | quoteDecimals: parsedLog.quoteDecimals, 137 | timestamp: parsedLog.timestamp, 138 | baseAmountIn: parsedLog.baseAmountIn, 139 | quoteAmountIn: parsedLog.quoteAmountIn, 140 | baseMint: instruction.accounts[8], 141 | quoteMint: instruction.accounts[9], 142 | marketId: parsedLog.marketId, 143 | user: instruction.accounts[17], 144 | poolId: instruction.accounts[4], 145 | }, 146 | }; 147 | } 148 | 149 | private async handleDeposit(parsedLog: Deposit, instruction: { accounts: PublicKey[] }) { 150 | const poolId = instruction.accounts[1]; 151 | const user = instruction.accounts[12]; 152 | const poolInfo = await this.getPoolInfo(poolId.toString()); 153 | if (!poolInfo) return null; 154 | return { 155 | type: ActionType.ADD, 156 | info: { 157 | user, 158 | poolId, 159 | baseMint: poolInfo.baseMint, 160 | quoteMint: poolInfo.quoteMint, 161 | baseDecimal: poolInfo.baseDecimal, 162 | quoteDecimal: poolInfo.quoteDecimal, 163 | baseAmountIn: parsedLog.baseAmountIn, 164 | quoteAmountIn: parsedLog.quoteAmountIn, 165 | mintedLpAmount: parsedLog.mintedLpAmount, 166 | }, 167 | }; 168 | } 169 | 170 | private async handleWithdraw(parsedLog: Withdraw, instruction: { accounts: PublicKey[] }) { 171 | const poolId = instruction.accounts[1]; 172 | const user = instruction.accounts[18]; 173 | const poolInfo = await this.getPoolInfo(poolId.toString()); 174 | if (!poolInfo) return null; 175 | return { 176 | type: ActionType.REMOVE, 177 | info: { 178 | lpAmountOut: parsedLog.withdrawLpAmount, 179 | poolLpAmount: parsedLog.poolLpAmount, 180 | baseReserve: parsedLog.baseReserve, 181 | quoteReserve: parsedLog.quoteReserve, 182 | baseAmountOut: parsedLog.baseAmountOut, 183 | quoteAmountOut: parsedLog.quoteAmountOut, 184 | baseMint: poolInfo.baseMint, 185 | quoteMint: poolInfo.quoteMint, 186 | baseDecimal: poolInfo.baseDecimal, 187 | quoteDecimal: poolInfo.quoteDecimal, 188 | user, 189 | poolId, 190 | }, 191 | }; 192 | } 193 | 194 | async parse(transaction: ParsedTransactionWithMeta): Promise { 195 | const logs = this.getRayLogs(transaction); 196 | if (!logs) { 197 | return null; 198 | } 199 | const decodedLogs = logs.map((msg) => this.decodeRayLog(msg)); 200 | const instructions = flattenTransactionInstructions(transaction).filter( 201 | (ix) => ix.programId.toString() === RayV4Program.toString() 202 | ); 203 | if (instructions.length == 0) return null; 204 | const result: RaydiumV4Transaction = { 205 | platform: 'raydiumv4', 206 | actions: [], 207 | }; 208 | for (let i = 0; i < decodedLogs.length; i++) { 209 | let ixLog = decodedLogs[i]; 210 | let ix = instructions[i] as { accounts: PublicKey[] }; 211 | let action; 212 | if (!ixLog) continue; 213 | switch (ixLog.logType) { 214 | case SWAP_BASE_IN_LOG_TYPE: 215 | action = await this.handleSwap(ixLog as SwapBaseIn | SwapBaseOut, ix); 216 | if (!action) continue; 217 | result.actions.push(action); 218 | break; 219 | case SWAP_BASE_OUT_LOG_TYPE: 220 | action = await this.handleSwap(ixLog as SwapBaseIn | SwapBaseOut, ix); 221 | if (!action) continue; 222 | result.actions.push(action); 223 | break; 224 | case INIT_LOG_TYPE: 225 | result.actions.push(this.handleCreatePool(ixLog as unknown as InitPool, ix)); 226 | break; 227 | 228 | case WITHDRAW_LOG_TYPE: 229 | action = await this.handleWithdraw(ixLog as Withdraw, ix); 230 | if (!action) continue; 231 | result.actions.push(action); 232 | break; 233 | 234 | case DEPOSIT_LOG_TYPE: 235 | action = await this.handleDeposit(ixLog as Deposit, ix); 236 | if (!action) continue; 237 | result.actions.push(action); 238 | break; 239 | default: 240 | continue; 241 | } 242 | } 243 | return result; 244 | } 245 | 246 | async parseMultiple( 247 | transactions: ParsedTransactionWithMeta[] 248 | ): Promise { 249 | return ( 250 | await Promise.all( 251 | transactions.map(async (txn) => { 252 | return await this.parse(txn); 253 | }) 254 | ) 255 | ).filter((res) => res !== null); 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /src/parser/raydium/v4/types.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from '@solana/web3.js'; 2 | import { BaseParsedAction, BaseParsedTransaction } from '../../../core/base'; 3 | 4 | export const RayV4Program = new PublicKey('675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'); 5 | 6 | export const INIT_LOG_TYPE = 0; 7 | export const DEPOSIT_LOG_TYPE = 1; 8 | export const WITHDRAW_LOG_TYPE = 2; 9 | export const SWAP_BASE_IN_LOG_TYPE = 3; 10 | export const SWAP_BASE_OUT_LOG_TYPE = 4; 11 | 12 | export enum ActionType { 13 | CREATE = 'create', 14 | ADD = 'add', 15 | REMOVE = 'remove', 16 | SWAP = 'swap', 17 | } 18 | 19 | export type PoolInfo = { 20 | baseDecimal: bigint; 21 | quoteDecimal: bigint; 22 | baseMint: PublicKey; 23 | quoteMint: PublicKey; 24 | }; 25 | 26 | export type InitPool = { 27 | logType: number; 28 | timestamp: bigint; 29 | quoteDecimals: number; 30 | baseDecimals: number; 31 | quoteLotSize: bigint; 32 | baseLotSize: bigint; 33 | quoteAmountIn: bigint; 34 | baseAmountIn: bigint; 35 | marketId: PublicKey; 36 | }; 37 | 38 | export type Deposit = { 39 | logType: number; 40 | maxBaseAmount: bigint; 41 | maxQuoteAmount: bigint; 42 | fixedSide: bigint; // 0n, then baseToken else quoteToken 43 | baseReserve: bigint; 44 | quoteReserve: bigint; 45 | poolLpAmount: bigint; 46 | pnlX: bigint; 47 | pnlY: bigint; 48 | baseAmountIn: bigint; 49 | quoteAmountIn: bigint; 50 | mintedLpAmount: bigint; 51 | }; 52 | 53 | export type Withdraw = { 54 | logType: number; 55 | withdrawLpAmount: bigint; 56 | userLpAmount: bigint; 57 | baseReserve: bigint; 58 | quoteReserve: bigint; 59 | poolLpAmount: bigint; 60 | pnlX: bigint; 61 | pnlY: bigint; 62 | baseAmountOut: bigint; 63 | quoteAmountOut: bigint; 64 | }; 65 | 66 | export type SwapBaseIn = { 67 | logType: number; 68 | amountIn: bigint; 69 | minimumAmountOut: bigint; 70 | direction: bigint; // 0n, then baseToken else quoteToken 71 | userSource: bigint; 72 | baseReserve: bigint; 73 | quoteReserve: bigint; 74 | amountOut: bigint; 75 | }; 76 | 77 | export type SwapBaseOut = { 78 | logType: number; 79 | maxAmountIn: bigint; 80 | amountOut: bigint; 81 | direction: bigint; // 0n, then baseToken else quoteToken 82 | userSource: bigint; 83 | baseReserve: bigint; 84 | quoteReserve: bigint; 85 | amountIn: bigint; 86 | }; 87 | 88 | export type CreatePoolInfo = { 89 | baseDecimals: number; 90 | quoteDecimals: number; 91 | timestamp: bigint; 92 | baseAmountIn: bigint; 93 | quoteAmountIn: bigint; 94 | user: PublicKey; 95 | baseMint: PublicKey; 96 | quoteMint: PublicKey; 97 | poolId: PublicKey; 98 | marketId: PublicKey; 99 | }; 100 | 101 | export type AddLiquidityInfo = { 102 | user: PublicKey; 103 | poolId: PublicKey; 104 | baseMint: PublicKey; 105 | quoteMint: PublicKey; 106 | baseDecimal: bigint; 107 | quoteDecimal: bigint; 108 | baseAmountIn: bigint; 109 | quoteAmountIn: bigint; 110 | mintedLpAmount: bigint; 111 | }; 112 | 113 | export type RemoveLiquidityInfo = { 114 | lpAmountOut: bigint; 115 | poolLpAmount: bigint; 116 | baseReserve: bigint; 117 | quoteReserve: bigint; 118 | baseAmountOut: bigint; 119 | quoteAmountOut: bigint; 120 | baseDecimal: bigint; 121 | quoteDecimal: bigint; 122 | baseMint: PublicKey; 123 | quoteMint: PublicKey; 124 | user: PublicKey; 125 | poolId: PublicKey; 126 | }; 127 | 128 | export type SwapInfo = { 129 | amountIn: bigint; 130 | amountOut: bigint; 131 | baseReserve: bigint; 132 | quoteReserve: bigint; 133 | tokenInDecimal: bigint; 134 | tokenOutDecimal: bigint; 135 | tokenIn: PublicKey; 136 | tokenOut: PublicKey; 137 | user: PublicKey; 138 | poolId: PublicKey; 139 | }; 140 | 141 | export interface RaydiumV4Action extends BaseParsedAction { 142 | type: string; 143 | info: CreatePoolInfo | AddLiquidityInfo | RemoveLiquidityInfo | SwapInfo; 144 | } 145 | 146 | export interface RaydiumV4Transaction extends BaseParsedTransaction { 147 | platform: 'raydiumv4'; 148 | actions: RaydiumV4Action[]; 149 | } 150 | -------------------------------------------------------------------------------- /tests/core/test.spec.ts: -------------------------------------------------------------------------------- 1 | import { ParsedTransactionWithMeta, PublicKey } from '@solana/web3.js'; 2 | import fs from 'fs'; 3 | import { getAccountSOLBalanceChange, flattenTransactionInstructions } from '../../src/core/utils'; 4 | import { LRUCache } from '../../src/core/lru'; 5 | 6 | describe('Transaction Parser Utils', () => { 7 | describe('flattenTransactionInstructions', () => { 8 | it('should handle empty inner instructions', () => { 9 | const mockTransaction = { 10 | transaction: { 11 | message: { 12 | instructions: [ 13 | { 14 | accounts: ['acct-1', 'acct-2', 'acct-3'], 15 | data: '0xray-test', 16 | programId: new PublicKey( 17 | 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA' 18 | ), 19 | }, 20 | { 21 | accounts: ['acct-1', 'acct-2', 'acct-3'], 22 | data: '0xray-test', 23 | programId: new PublicKey( 24 | 'B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump' 25 | ), 26 | }, 27 | ], 28 | }, 29 | }, 30 | meta: {}, 31 | }; 32 | 33 | const result = flattenTransactionInstructions(mockTransaction as any); 34 | expect(result.length).toEqual(2); 35 | expect((result as { programId: PublicKey }[])[0].programId.toString()).toEqual( 36 | 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA' 37 | ); 38 | expect((result as { programId: PublicKey }[])[1].programId.toString()).toEqual( 39 | 'B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump' 40 | ); 41 | }); 42 | 43 | it('should handle instructions with inner cpi calls', () => { 44 | const testTxn = JSON.parse( 45 | fs.readFileSync('tests/raydium/parsed-swap-txn.json', 'utf-8') 46 | ) as unknown as ParsedTransactionWithMeta; 47 | 48 | const result = flattenTransactionInstructions(testTxn); 49 | expect(result.length).toEqual(15); 50 | }); 51 | }); 52 | 53 | describe('getAccountSOLBalanceChange', () => { 54 | it('should calculate the correct balance change', () => { 55 | const txnData = { 56 | meta: { 57 | postBalances: [ 58 | 30129394, 3946560, 2039280, 310260922401375, 29512424817, 2039280, 1, 1, 59 | 731913600, 1461600, 934087680, 1141440, 5530000, 1009200, 0, 60 | ], 61 | preBalances: [ 62 | 115657476, 946560, 0, 310260921604922, 29432779468, 2039280, 1, 1, 63 | 731913600, 1461600, 934087680, 1141440, 5530000, 1009200, 0, 64 | ], 65 | }, 66 | transaction: { 67 | message: { 68 | accountKeys: [ 69 | { 70 | pubkey: new PublicKey( 71 | '4SrXdKFYoiUfYzWN7YV8kdJ2TkZieDmjVCEJg4mTAun6' 72 | ), 73 | signer: true, 74 | source: 'transaction', 75 | writable: true, 76 | }, 77 | { 78 | pubkey: new PublicKey( 79 | 'ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt' 80 | ), 81 | signer: false, 82 | source: 'transaction', 83 | writable: true, 84 | }, 85 | ], 86 | }, 87 | }, 88 | } as unknown as ParsedTransactionWithMeta; 89 | const result = getAccountSOLBalanceChange( 90 | txnData!, 91 | new PublicKey('ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt') 92 | ); 93 | expect(result).toBe(3000000); 94 | }); 95 | 96 | it('should return 0 if account not found', () => { 97 | const txnData = { 98 | transaction: { 99 | message: { 100 | accountKeys: [ 101 | { 102 | pubkey: new PublicKey( 103 | '4SrXdKFYoiUfYzWN7YV8kdJ2TkZieDmjVCEJg4mTAun6' 104 | ), 105 | signer: true, 106 | source: 'transaction', 107 | writable: true, 108 | }, 109 | { 110 | pubkey: new PublicKey( 111 | 'ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt' 112 | ), 113 | signer: false, 114 | source: 'transaction', 115 | writable: true, 116 | }, 117 | ], 118 | }, 119 | }, 120 | } as unknown as ParsedTransactionWithMeta; 121 | const result = getAccountSOLBalanceChange(txnData!, PublicKey.default); 122 | expect(result).toBe(0); 123 | }); 124 | }); 125 | 126 | describe('LRUCache Tests', () => { 127 | let cache: LRUCache; 128 | 129 | beforeEach(() => { 130 | cache = new LRUCache(3); 131 | }); 132 | 133 | test('should initialize with correct capacity', () => { 134 | expect(cache.size).toBe(0); 135 | const cache2 = new LRUCache(5); 136 | expect(cache2.size).toBe(0); 137 | }); 138 | 139 | test('should set and get values correctly', () => { 140 | cache.set('a', 1); 141 | expect(cache.get('a')).toBe(1); 142 | expect(cache.size).toBe(1); 143 | }); 144 | 145 | test('should return null for non-existent keys', () => { 146 | expect(cache.get('missing')).toBeNull(); 147 | }); 148 | 149 | test('should update existing keys', () => { 150 | cache.set('a', 1); 151 | cache.set('a', 2); 152 | expect(cache.get('a')).toBe(2); 153 | expect(cache.size).toBe(1); 154 | }); 155 | 156 | test('should evict least recently used item when capacity is reached', () => { 157 | cache.set('a', 1); 158 | cache.set('b', 2); 159 | cache.set('c', 3); 160 | cache.set('d', 4); 161 | 162 | expect(cache.get('a')).toBeNull(); 163 | expect(cache.get('b')).toBe(2); 164 | expect(cache.get('c')).toBe(3); 165 | expect(cache.get('d')).toBe(4); 166 | expect(cache.size).toBe(3); 167 | }); 168 | 169 | test('should maintain LRU order with gets', () => { 170 | cache.set('a', 1); 171 | cache.set('b', 2); 172 | cache.set('c', 3); 173 | 174 | cache.get('a'); 175 | 176 | cache.set('d', 4); 177 | 178 | expect(cache.get('b')).toBeNull(); 179 | expect(cache.get('a')).toBe(1); 180 | expect(cache.get('c')).toBe(3); 181 | expect(cache.get('d')).toBe(4); 182 | }); 183 | 184 | test('should clear the cache', () => { 185 | cache.set('a', 1); 186 | cache.set('b', 2); 187 | cache.clear(); 188 | 189 | expect(cache.size).toBe(0); 190 | expect(cache.get('a')).toBeNull(); 191 | expect(cache.get('b')).toBeNull(); 192 | }); 193 | 194 | // test('should handle complex sequence of operations', () => { 195 | // cache.set('a', 1); 196 | // cache.set('b', 2); 197 | // cache.get('a'); 198 | // cache.set('c', 3); 199 | // cache.set('d', 4); 200 | 201 | // expect(cache.get('b')).toBeNull(); 202 | // expect(cache.get('a')).toBe(1); 203 | // expect(cache.get('c')).toBe(3); 204 | // expect(cache.get('d')).toBe(4); 205 | 206 | // cache.set('e', 5); 207 | 208 | // expect(cache.get('c')).toBeNull(); 209 | // expect(cache.get('a')).toBe(1); 210 | // expect(cache.get('d')).toBe(4); 211 | // expect(cache.get('e')).toBe(5); 212 | // }); 213 | }); 214 | }); 215 | -------------------------------------------------------------------------------- /tests/jupiter/tests.spec.ts: -------------------------------------------------------------------------------- 1 | describe('Jupiter Parser', () => { 2 | test('parse should correctly identify buy action', () => {}); 3 | 4 | test('parse should correctly identify sell action', () => {}); 5 | 6 | test('parseMultiple should parse multiple transactions', () => {}); 7 | }); 8 | -------------------------------------------------------------------------------- /tests/pumpfun/parsed-complete-txn.json: -------------------------------------------------------------------------------- 1 | { 2 | "blockTime": 1738104027, 3 | "meta": { 4 | "computeUnitsConsumed": 76759, 5 | "err": null, 6 | "fee": 151223, 7 | "innerInstructions": [ 8 | { 9 | "index": 2, 10 | "instructions": [ 11 | { 12 | "parsed": { 13 | "info": { 14 | "extensionTypes": [ 15 | "immutableOwner" 16 | ], 17 | "mint": "B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump" 18 | }, 19 | "type": "getAccountDataSize" 20 | }, 21 | "program": "spl-token", 22 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 23 | "stackHeight": 2 24 | }, 25 | { 26 | "parsed": { 27 | "info": { 28 | "lamports": 2039280, 29 | "newAccount": "DkYdMiuERoLpzFQtc1dxfx5HwzczXQ3WmPFJdUn7cKkf", 30 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 31 | "source": "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS", 32 | "space": 165 33 | }, 34 | "type": "createAccount" 35 | }, 36 | "program": "system", 37 | "programId": "11111111111111111111111111111111", 38 | "stackHeight": 2 39 | }, 40 | { 41 | "parsed": { 42 | "info": { 43 | "account": "DkYdMiuERoLpzFQtc1dxfx5HwzczXQ3WmPFJdUn7cKkf" 44 | }, 45 | "type": "initializeImmutableOwner" 46 | }, 47 | "program": "spl-token", 48 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 49 | "stackHeight": 2 50 | }, 51 | { 52 | "parsed": { 53 | "info": { 54 | "account": "DkYdMiuERoLpzFQtc1dxfx5HwzczXQ3WmPFJdUn7cKkf", 55 | "mint": "B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump", 56 | "owner": "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS" 57 | }, 58 | "type": "initializeAccount3" 59 | }, 60 | "program": "spl-token", 61 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 62 | "stackHeight": 2 63 | } 64 | ] 65 | }, 66 | { 67 | "index": 3, 68 | "instructions": [ 69 | { 70 | "accounts": [ 71 | "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 72 | "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM", 73 | "B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump", 74 | "5dhRAEw3LfUMTJcPqYSyasH45jHnWeZQmM2Hccic59SZ", 75 | "AsfkUNpPWLpPnWptZxjWyd5BtLeywMW2Mucw29bxtmvQ", 76 | "DkYdMiuERoLpzFQtc1dxfx5HwzczXQ3WmPFJdUn7cKkf", 77 | "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS", 78 | "11111111111111111111111111111111", 79 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 80 | "SysvarRent111111111111111111111111111111111", 81 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 82 | "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 83 | ], 84 | "data": "AJTQ2h9DXrBtBMyLsTLfYRZMJ5TE96BCs", 85 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 86 | "stackHeight": 2 87 | }, 88 | { 89 | "accounts": [ 90 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 91 | ], 92 | "data": "YeADJEDSy5WzCFuDLrfFZ1wny1Wmry3mMYYhEPNd9atnPtLyMGi1JSGif6CX7cQVNMAVAujpRH53nsv4XRZV38qLaZZdgAufKvUrXvqspVYCbcGQC8tKFd9e9AvoKhHZGzjnn3F8r9TnZvyhuF2jhERvSbAYhxaehho5", 93 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 94 | "stackHeight": 3 95 | }, 96 | { 97 | "parsed": { 98 | "info": { 99 | "amount": "20963465348985", 100 | "authority": "5dhRAEw3LfUMTJcPqYSyasH45jHnWeZQmM2Hccic59SZ", 101 | "destination": "DkYdMiuERoLpzFQtc1dxfx5HwzczXQ3WmPFJdUn7cKkf", 102 | "source": "AsfkUNpPWLpPnWptZxjWyd5BtLeywMW2Mucw29bxtmvQ" 103 | }, 104 | "type": "transfer" 105 | }, 106 | "program": "spl-token", 107 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 108 | "stackHeight": 3 109 | }, 110 | { 111 | "parsed": { 112 | "info": { 113 | "destination": "5dhRAEw3LfUMTJcPqYSyasH45jHnWeZQmM2Hccic59SZ", 114 | "lamports": 8013305498, 115 | "source": "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS" 116 | }, 117 | "type": "transfer" 118 | }, 119 | "program": "system", 120 | "programId": "11111111111111111111111111111111", 121 | "stackHeight": 3 122 | }, 123 | { 124 | "parsed": { 125 | "info": { 126 | "destination": "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM", 127 | "lamports": 80133054, 128 | "source": "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS" 129 | }, 130 | "type": "transfer" 131 | }, 132 | "program": "system", 133 | "programId": "11111111111111111111111111111111", 134 | "stackHeight": 3 135 | }, 136 | { 137 | "accounts": [ 138 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 139 | ], 140 | "data": "2K7nL28PxCW8ejnyCeuMpbXAQMRPPDdJn7MwcYMSooskHGFKkkhmyfoMCf7qbFu4pH1NYqjZVJ9pq3eTVDWowLebZdCzagR4hmR9SUNEXDE3ccuLD1UU5iYkbPei6f6wU9zVky1zsBdE8cPMX1pZ7ft59eMT5BJXD1ScAE9L5VUndRfbJSjf9BCVEwAw", 141 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 142 | "stackHeight": 3 143 | } 144 | ] 145 | } 146 | ], 147 | "logMessages": [ 148 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 149 | "Program ComputeBudget111111111111111111111111111111 success", 150 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 151 | "Program ComputeBudget111111111111111111111111111111 success", 152 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]", 153 | "Program log: Create", 154 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 155 | "Program log: Instruction: GetAccountDataSize", 156 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1569 of 88335 compute units", 157 | "Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=", 158 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 159 | "Program 11111111111111111111111111111111 invoke [2]", 160 | "Program 11111111111111111111111111111111 success", 161 | "Program log: Initialize the associated token account", 162 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 163 | "Program log: Instruction: InitializeImmutableOwner", 164 | "Program log: Please upgrade to SPL Token 2022 for immutable owner support", 165 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 81748 compute units", 166 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 167 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 168 | "Program log: Instruction: InitializeAccount3", 169 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4188 of 77867 compute units", 170 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 171 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 20304 of 93700 compute units", 172 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success", 173 | "Program B7Av1b2CqhA1y1TLQdyUCyU8w37EMbmL39TPqxUsDaps invoke [1]", 174 | "Program log: Virtual Token Reserves: 300863465348985", 175 | "Program log: Virtual SOL Reserves: 106992053620", 176 | "Program log: instruction_number: 10", 177 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]", 178 | "Program log: Instruction: Buy", 179 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [3]", 180 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2132 of 40804 compute units", 181 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success", 182 | "Program data: X3JhnNQumAgLtkTVo8BbMgNhl+07ZljDgbDjtpIYeT9RqXi79YFJI5bTIrg/h9rife0w/5+iy65iu0JGA/CYDNs4MNowTKUvRNVbICi/GoQ7eqRZb6uO5FeVcC18gZE7tXsN8jR3i5rbXJlnAAAAAA==", 183 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]", 184 | "Program log: Instruction: Transfer", 185 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 34697 compute units", 186 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 187 | "Program 11111111111111111111111111111111 invoke [3]", 188 | "Program 11111111111111111111111111111111 success", 189 | "Program 11111111111111111111111111111111 invoke [3]", 190 | "Program 11111111111111111111111111111111 success", 191 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [3]", 192 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2132 of 22127 compute units", 193 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success", 194 | "Program data: vdt/007mYe6W0yK4P4fa4n3tMP+fosuuYrtCRgPwmAzbODDaMEylL5pWod0BAAAAecfn7xATAAABC7ZE1aPAWzIDYZftO2ZYw4Gw47aSGHk/Ual4u/WBSSPbXJlnAAAAAA6E2sYaAAAAAJgSTJH+AAAO2LbKEwAAAAAAAAAAAAAA", 195 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 46833 of 64624 compute units", 196 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success", 197 | "Program B7Av1b2CqhA1y1TLQdyUCyU8w37EMbmL39TPqxUsDaps consumed 56005 of 73396 compute units", 198 | "Program B7Av1b2CqhA1y1TLQdyUCyU8w37EMbmL39TPqxUsDaps success", 199 | "Program 11111111111111111111111111111111 invoke [1]", 200 | "Program 11111111111111111111111111111111 success" 201 | ], 202 | "postBalances": [ 203 | 4538451371835, 204 | 2039280, 205 | 1461600, 206 | 127561894019920, 207 | 85006591038, 208 | 2039280, 209 | 225809510, 210 | 1, 211 | 731913600, 212 | 1, 213 | 934087680, 214 | 1141440, 215 | 246642259, 216 | 1009200, 217 | 122000014, 218 | 1141440 219 | ], 220 | "postTokenBalances": [ 221 | { 222 | "accountIndex": 1, 223 | "mint": "B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump", 224 | "owner": "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS", 225 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 226 | "uiTokenAmount": { 227 | "amount": "20963465348985", 228 | "decimals": 6, 229 | "uiAmount": 20963465.348985, 230 | "uiAmountString": "20963465.348985" 231 | } 232 | }, 233 | { 234 | "accountIndex": 5, 235 | "mint": "B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump", 236 | "owner": "5dhRAEw3LfUMTJcPqYSyasH45jHnWeZQmM2Hccic59SZ", 237 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 238 | "uiTokenAmount": { 239 | "amount": "206900000000000", 240 | "decimals": 6, 241 | "uiAmount": 206900000, 242 | "uiAmountString": "206900000" 243 | } 244 | } 245 | ], 246 | "preBalances": [ 247 | 4546608000890, 248 | 0, 249 | 1461600, 250 | 127561813886866, 251 | 76993285540, 252 | 2039280, 253 | 164809510, 254 | 1, 255 | 731913600, 256 | 1, 257 | 934087680, 258 | 1141440, 259 | 246642259, 260 | 1009200, 261 | 122000014, 262 | 1141440 263 | ], 264 | "preTokenBalances": [ 265 | { 266 | "accountIndex": 5, 267 | "mint": "B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump", 268 | "owner": "5dhRAEw3LfUMTJcPqYSyasH45jHnWeZQmM2Hccic59SZ", 269 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 270 | "uiTokenAmount": { 271 | "amount": "227863465348985", 272 | "decimals": 6, 273 | "uiAmount": 227863465.348985, 274 | "uiAmountString": "227863465.348985" 275 | } 276 | } 277 | ], 278 | "rewards": [], 279 | "status": { 280 | "Ok": null 281 | } 282 | }, 283 | "slot": 317007416, 284 | "transaction": { 285 | "message": { 286 | "accountKeys": [ 287 | { 288 | "pubkey": "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS", 289 | "signer": true, 290 | "source": "transaction", 291 | "writable": true 292 | }, 293 | { 294 | "pubkey": "DkYdMiuERoLpzFQtc1dxfx5HwzczXQ3WmPFJdUn7cKkf", 295 | "signer": false, 296 | "source": "transaction", 297 | "writable": true 298 | }, 299 | { 300 | "pubkey": "B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump", 301 | "signer": false, 302 | "source": "transaction", 303 | "writable": true 304 | }, 305 | { 306 | "pubkey": "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM", 307 | "signer": false, 308 | "source": "transaction", 309 | "writable": true 310 | }, 311 | { 312 | "pubkey": "5dhRAEw3LfUMTJcPqYSyasH45jHnWeZQmM2Hccic59SZ", 313 | "signer": false, 314 | "source": "transaction", 315 | "writable": true 316 | }, 317 | { 318 | "pubkey": "AsfkUNpPWLpPnWptZxjWyd5BtLeywMW2Mucw29bxtmvQ", 319 | "signer": false, 320 | "source": "transaction", 321 | "writable": true 322 | }, 323 | { 324 | "pubkey": "NexTBLockJYZ7QD7p2byrUa6df8ndV2WSd8GkbWqfbb", 325 | "signer": false, 326 | "source": "transaction", 327 | "writable": true 328 | }, 329 | { 330 | "pubkey": "ComputeBudget111111111111111111111111111111", 331 | "signer": false, 332 | "source": "transaction", 333 | "writable": false 334 | }, 335 | { 336 | "pubkey": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 337 | "signer": false, 338 | "source": "transaction", 339 | "writable": false 340 | }, 341 | { 342 | "pubkey": "11111111111111111111111111111111", 343 | "signer": false, 344 | "source": "transaction", 345 | "writable": false 346 | }, 347 | { 348 | "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 349 | "signer": false, 350 | "source": "transaction", 351 | "writable": false 352 | }, 353 | { 354 | "pubkey": "B7Av1b2CqhA1y1TLQdyUCyU8w37EMbmL39TPqxUsDaps", 355 | "signer": false, 356 | "source": "transaction", 357 | "writable": false 358 | }, 359 | { 360 | "pubkey": "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 361 | "signer": false, 362 | "source": "transaction", 363 | "writable": false 364 | }, 365 | { 366 | "pubkey": "SysvarRent111111111111111111111111111111111", 367 | "signer": false, 368 | "source": "transaction", 369 | "writable": false 370 | }, 371 | { 372 | "pubkey": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 373 | "signer": false, 374 | "source": "transaction", 375 | "writable": false 376 | }, 377 | { 378 | "pubkey": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 379 | "signer": false, 380 | "source": "transaction", 381 | "writable": false 382 | } 383 | ], 384 | "addressTableLookups": [], 385 | "instructions": [ 386 | { 387 | "accounts": [], 388 | "data": "FKsMLs", 389 | "programId": "ComputeBudget111111111111111111111111111111", 390 | "stackHeight": null 391 | }, 392 | { 393 | "accounts": [], 394 | "data": "3W97brn8jnwH", 395 | "programId": "ComputeBudget111111111111111111111111111111", 396 | "stackHeight": null 397 | }, 398 | { 399 | "parsed": { 400 | "info": { 401 | "account": "DkYdMiuERoLpzFQtc1dxfx5HwzczXQ3WmPFJdUn7cKkf", 402 | "mint": "B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump", 403 | "source": "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS", 404 | "systemProgram": "11111111111111111111111111111111", 405 | "tokenProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 406 | "wallet": "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS" 407 | }, 408 | "type": "create" 409 | }, 410 | "program": "spl-associated-token-account", 411 | "programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 412 | "stackHeight": null 413 | }, 414 | { 415 | "accounts": [ 416 | "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 417 | "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM", 418 | "B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump", 419 | "5dhRAEw3LfUMTJcPqYSyasH45jHnWeZQmM2Hccic59SZ", 420 | "AsfkUNpPWLpPnWptZxjWyd5BtLeywMW2Mucw29bxtmvQ", 421 | "DkYdMiuERoLpzFQtc1dxfx5HwzczXQ3WmPFJdUn7cKkf", 422 | "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS", 423 | "11111111111111111111111111111111", 424 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 425 | "SysvarRent111111111111111111111111111111111", 426 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 427 | "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 428 | ], 429 | "data": "8gFyKLu61d6h", 430 | "programId": "B7Av1b2CqhA1y1TLQdyUCyU8w37EMbmL39TPqxUsDaps", 431 | "stackHeight": null 432 | }, 433 | { 434 | "parsed": { 435 | "info": { 436 | "destination": "NexTBLockJYZ7QD7p2byrUa6df8ndV2WSd8GkbWqfbb", 437 | "lamports": 61000000, 438 | "source": "niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS" 439 | }, 440 | "type": "transfer" 441 | }, 442 | "program": "system", 443 | "programId": "11111111111111111111111111111111", 444 | "stackHeight": null 445 | } 446 | ], 447 | "recentBlockhash": "3s1YmaDgRkpgMZAmBw7hdwmKAssMwxcrc1JU7mmtmd6P" 448 | }, 449 | "signatures": [ 450 | "2wkECde79GonMwWQsDMcMm5nNex6ma72pyrKVxgJAps7S26iLqaP5JBPxqNu8vuCM6J15mbfgXavU7DFDDjR2S3i" 451 | ] 452 | }, 453 | "version": 0 454 | } -------------------------------------------------------------------------------- /tests/pumpfun/parsed-create-txn.json: -------------------------------------------------------------------------------- 1 | { 2 | "blockTime": 1739054849, 3 | "meta": { 4 | "computeUnitsConsumed": 138524, 5 | "err": null, 6 | "fee": 110000, 7 | "innerInstructions": [ 8 | { 9 | "index": 2, 10 | "instructions": [ 11 | { 12 | "parsed": { 13 | "info": { 14 | "lamports": 1461600, 15 | "newAccount": "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 16 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 17 | "source": "FiYwf895W6ntoitNvhVwBLS4uwKZmMhsxiQmYY44488U", 18 | "space": 82 19 | }, 20 | "type": "createAccount" 21 | }, 22 | "program": "system", 23 | "programId": "11111111111111111111111111111111", 24 | "stackHeight": 2 25 | }, 26 | { 27 | "parsed": { 28 | "info": { 29 | "decimals": 6, 30 | "mint": "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 31 | "mintAuthority": "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM" 32 | }, 33 | "type": "initializeMint2" 34 | }, 35 | "program": "spl-token", 36 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 37 | "stackHeight": 2 38 | }, 39 | { 40 | "parsed": { 41 | "info": { 42 | "lamports": 1231920, 43 | "newAccount": "6qK8Cazc6dqMSCfgN455J7aw1hHgknb6PeY8gjkAL4BE", 44 | "owner": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 45 | "source": "FiYwf895W6ntoitNvhVwBLS4uwKZmMhsxiQmYY44488U", 46 | "space": 49 47 | }, 48 | "type": "createAccount" 49 | }, 50 | "program": "system", 51 | "programId": "11111111111111111111111111111111", 52 | "stackHeight": 2 53 | }, 54 | { 55 | "parsed": { 56 | "info": { 57 | "account": "J2iHSUVY71hEZpZi5NKqFXAiX6dWPZbuQny8F223mQ6R", 58 | "mint": "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 59 | "source": "FiYwf895W6ntoitNvhVwBLS4uwKZmMhsxiQmYY44488U", 60 | "systemProgram": "11111111111111111111111111111111", 61 | "tokenProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 62 | "wallet": "6qK8Cazc6dqMSCfgN455J7aw1hHgknb6PeY8gjkAL4BE" 63 | }, 64 | "type": "create" 65 | }, 66 | "program": "spl-associated-token-account", 67 | "programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 68 | "stackHeight": 2 69 | }, 70 | { 71 | "parsed": { 72 | "info": { 73 | "extensionTypes": [ 74 | "immutableOwner" 75 | ], 76 | "mint": "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu" 77 | }, 78 | "type": "getAccountDataSize" 79 | }, 80 | "program": "spl-token", 81 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 82 | "stackHeight": 3 83 | }, 84 | { 85 | "parsed": { 86 | "info": { 87 | "lamports": 2039280, 88 | "newAccount": "J2iHSUVY71hEZpZi5NKqFXAiX6dWPZbuQny8F223mQ6R", 89 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 90 | "source": "FiYwf895W6ntoitNvhVwBLS4uwKZmMhsxiQmYY44488U", 91 | "space": 165 92 | }, 93 | "type": "createAccount" 94 | }, 95 | "program": "system", 96 | "programId": "11111111111111111111111111111111", 97 | "stackHeight": 3 98 | }, 99 | { 100 | "parsed": { 101 | "info": { 102 | "account": "J2iHSUVY71hEZpZi5NKqFXAiX6dWPZbuQny8F223mQ6R" 103 | }, 104 | "type": "initializeImmutableOwner" 105 | }, 106 | "program": "spl-token", 107 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 108 | "stackHeight": 3 109 | }, 110 | { 111 | "parsed": { 112 | "info": { 113 | "account": "J2iHSUVY71hEZpZi5NKqFXAiX6dWPZbuQny8F223mQ6R", 114 | "mint": "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 115 | "owner": "6qK8Cazc6dqMSCfgN455J7aw1hHgknb6PeY8gjkAL4BE" 116 | }, 117 | "type": "initializeAccount3" 118 | }, 119 | "program": "spl-token", 120 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 121 | "stackHeight": 3 122 | }, 123 | { 124 | "accounts": [ 125 | "BcXSVX1i71H66stvnbaCGY4QUA9G6iNZNZKPxsU4A39C", 126 | "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 127 | "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 128 | "FiYwf895W6ntoitNvhVwBLS4uwKZmMhsxiQmYY44488U", 129 | "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 130 | "11111111111111111111111111111111" 131 | ], 132 | "data": "x2C8JtSGgB51JyMxpw3RUdKeD6JRVuqrqEcwiYq5VtAmSz4FF4xvb9of9MVfvtFFRM84TVqvqkRL2GFTfqfcq7LiSMD26116ACj3HyuXDEGmNFmFXW6JwhveZuxVNFp2j8JpRmYACAiWhqfhp2B", 133 | "programId": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", 134 | "stackHeight": 2 135 | }, 136 | { 137 | "parsed": { 138 | "info": { 139 | "destination": "BcXSVX1i71H66stvnbaCGY4QUA9G6iNZNZKPxsU4A39C", 140 | "lamports": 15115600, 141 | "source": "FiYwf895W6ntoitNvhVwBLS4uwKZmMhsxiQmYY44488U" 142 | }, 143 | "type": "transfer" 144 | }, 145 | "program": "system", 146 | "programId": "11111111111111111111111111111111", 147 | "stackHeight": 3 148 | }, 149 | { 150 | "parsed": { 151 | "info": { 152 | "account": "BcXSVX1i71H66stvnbaCGY4QUA9G6iNZNZKPxsU4A39C", 153 | "space": 607 154 | }, 155 | "type": "allocate" 156 | }, 157 | "program": "system", 158 | "programId": "11111111111111111111111111111111", 159 | "stackHeight": 3 160 | }, 161 | { 162 | "parsed": { 163 | "info": { 164 | "account": "BcXSVX1i71H66stvnbaCGY4QUA9G6iNZNZKPxsU4A39C", 165 | "owner": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" 166 | }, 167 | "type": "assign" 168 | }, 169 | "program": "system", 170 | "programId": "11111111111111111111111111111111", 171 | "stackHeight": 3 172 | }, 173 | { 174 | "parsed": { 175 | "info": { 176 | "account": "J2iHSUVY71hEZpZi5NKqFXAiX6dWPZbuQny8F223mQ6R", 177 | "amount": "1000000000000000", 178 | "mint": "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 179 | "mintAuthority": "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM" 180 | }, 181 | "type": "mintTo" 182 | }, 183 | "program": "spl-token", 184 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 185 | "stackHeight": 2 186 | }, 187 | { 188 | "parsed": { 189 | "info": { 190 | "authority": "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 191 | "authorityType": "mintTokens", 192 | "mint": "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 193 | "newAuthority": null 194 | }, 195 | "type": "setAuthority" 196 | }, 197 | "program": "spl-token", 198 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 199 | "stackHeight": 2 200 | }, 201 | { 202 | "accounts": [ 203 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 204 | ], 205 | "data": "8MQYghs1Nhw4rrPVeHt6iMyVXpmArfBb9vxLDdaq2dHxWbm4vVFTn8FYMQAZJC3Zzt8V9yj7pgauX8QxYXbv2n32htBB7r2R9XBxwZa1aEFVDuuHfDDPvtdV1gUHCkjo9KyJzUNkVLLdgQ1XpZUQz7Bh1QsXRyDN7vixbPUVkH8JkPSHsmQeRjH6EBVUFrJtqGqD52Hz6YeFq3XA368J8z5yC9iz2L54TQHMT3d3CbyV1yL7LvjYK5nkSUN6jUfBGESNASajkX5jAffqEYQTbKSiAZuX1xGegc", 206 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 207 | "stackHeight": 2 208 | } 209 | ] 210 | } 211 | ], 212 | "logMessages": [ 213 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 214 | "Program ComputeBudget111111111111111111111111111111 success", 215 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 216 | "Program ComputeBudget111111111111111111111111111111 success", 217 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [1]", 218 | "Program log: Instruction: Create", 219 | "Program 11111111111111111111111111111111 invoke [2]", 220 | "Program 11111111111111111111111111111111 success", 221 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 222 | "Program log: Instruction: InitializeMint2", 223 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2780 of 237951 compute units", 224 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 225 | "Program 11111111111111111111111111111111 invoke [2]", 226 | "Program 11111111111111111111111111111111 success", 227 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [2]", 228 | "Program log: Create", 229 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]", 230 | "Program log: Instruction: GetAccountDataSize", 231 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1595 of 201937 compute units", 232 | "Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=", 233 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 234 | "Program 11111111111111111111111111111111 invoke [3]", 235 | "Program 11111111111111111111111111111111 success", 236 | "Program log: Initialize the associated token account", 237 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]", 238 | "Program log: Instruction: InitializeImmutableOwner", 239 | "Program log: Please upgrade to SPL Token 2022 for immutable owner support", 240 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 195324 compute units", 241 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 242 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]", 243 | "Program log: Instruction: InitializeAccount3", 244 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4214 of 191440 compute units", 245 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 246 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 24990 of 211912 compute units", 247 | "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success", 248 | "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [2]", 249 | "Program log: IX: Create Metadata Accounts v3", 250 | "Program 11111111111111111111111111111111 invoke [3]", 251 | "Program 11111111111111111111111111111111 success", 252 | "Program log: Allocate space for the account", 253 | "Program 11111111111111111111111111111111 invoke [3]", 254 | "Program 11111111111111111111111111111111 success", 255 | "Program log: Assign the account to the owning program", 256 | "Program 11111111111111111111111111111111 invoke [3]", 257 | "Program 11111111111111111111111111111111 success", 258 | "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 36976 of 170247 compute units", 259 | "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s success", 260 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 261 | "Program log: Instruction: MintTo", 262 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4492 of 130146 compute units", 263 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 264 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 265 | "Program log: Instruction: SetAuthority", 266 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2911 of 123077 compute units", 267 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 268 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]", 269 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2132 of 115992 compute units", 270 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success", 271 | "Program data: G3KpTd7rY3YQAAAAQmx1ZSBTdHJpcCBGaWVuZAUAAABNb3NleUMAAABodHRwczovL2lwZnMuaW8vaXBmcy9RbVFRQXp4ZUhmUERSbWExZE5oY0JQNGs5ZWo0ZXBVOVUyVDgxOEZ5RUc3aXpQXMOOeNT02e0uA5hRra9E9WovHly/C+B4F20vMjT0zIBWqs52LgN7LRhEzc/IO7L+ZQI1SBEVRFO4bfGmpxCzJdqojChZj8nfnYUzugrEbOi2ZoYwiQ1INSaDuwWTGtl1", 272 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 138224 of 249700 compute units", 273 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success" 274 | ], 275 | "postBalances": [ 276 | 1318618310, 277 | 1461600, 278 | 1231920, 279 | 2039280, 280 | 15115600, 281 | 1, 282 | 1141440, 283 | 441495942, 284 | 247133320, 285 | 1141440, 286 | 1, 287 | 934087680, 288 | 731913600, 289 | 1009200, 290 | 122100014 291 | ], 292 | "postTokenBalances": [ 293 | { 294 | "accountIndex": 3, 295 | "mint": "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 296 | "owner": "6qK8Cazc6dqMSCfgN455J7aw1hHgknb6PeY8gjkAL4BE", 297 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 298 | "uiTokenAmount": { 299 | "amount": "1000000000000000", 300 | "decimals": 6, 301 | "uiAmount": 1000000000, 302 | "uiAmountString": "1000000000" 303 | } 304 | } 305 | ], 306 | "preBalances": [ 307 | 1338576710, 308 | 0, 309 | 0, 310 | 0, 311 | 0, 312 | 1, 313 | 1141440, 314 | 441495942, 315 | 247133320, 316 | 1141440, 317 | 1, 318 | 934087680, 319 | 731913600, 320 | 1009200, 321 | 122100014 322 | ], 323 | "preTokenBalances": [], 324 | "rewards": [], 325 | "status": { 326 | "Ok": null 327 | } 328 | }, 329 | "slot": 319383548, 330 | "transaction": { 331 | "message": { 332 | "accountKeys": [ 333 | { 334 | "pubkey": "FiYwf895W6ntoitNvhVwBLS4uwKZmMhsxiQmYY44488U", 335 | "signer": true, 336 | "source": "transaction", 337 | "writable": true 338 | }, 339 | { 340 | "pubkey": "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 341 | "signer": true, 342 | "source": "transaction", 343 | "writable": true 344 | }, 345 | { 346 | "pubkey": "6qK8Cazc6dqMSCfgN455J7aw1hHgknb6PeY8gjkAL4BE", 347 | "signer": false, 348 | "source": "transaction", 349 | "writable": true 350 | }, 351 | { 352 | "pubkey": "J2iHSUVY71hEZpZi5NKqFXAiX6dWPZbuQny8F223mQ6R", 353 | "signer": false, 354 | "source": "transaction", 355 | "writable": true 356 | }, 357 | { 358 | "pubkey": "BcXSVX1i71H66stvnbaCGY4QUA9G6iNZNZKPxsU4A39C", 359 | "signer": false, 360 | "source": "transaction", 361 | "writable": true 362 | }, 363 | { 364 | "pubkey": "ComputeBudget111111111111111111111111111111", 365 | "signer": false, 366 | "source": "transaction", 367 | "writable": false 368 | }, 369 | { 370 | "pubkey": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 371 | "signer": false, 372 | "source": "transaction", 373 | "writable": false 374 | }, 375 | { 376 | "pubkey": "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 377 | "signer": false, 378 | "source": "transaction", 379 | "writable": false 380 | }, 381 | { 382 | "pubkey": "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 383 | "signer": false, 384 | "source": "transaction", 385 | "writable": false 386 | }, 387 | { 388 | "pubkey": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", 389 | "signer": false, 390 | "source": "transaction", 391 | "writable": false 392 | }, 393 | { 394 | "pubkey": "11111111111111111111111111111111", 395 | "signer": false, 396 | "source": "transaction", 397 | "writable": false 398 | }, 399 | { 400 | "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 401 | "signer": false, 402 | "source": "transaction", 403 | "writable": false 404 | }, 405 | { 406 | "pubkey": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 407 | "signer": false, 408 | "source": "transaction", 409 | "writable": false 410 | }, 411 | { 412 | "pubkey": "SysvarRent111111111111111111111111111111111", 413 | "signer": false, 414 | "source": "transaction", 415 | "writable": false 416 | }, 417 | { 418 | "pubkey": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 419 | "signer": false, 420 | "source": "transaction", 421 | "writable": false 422 | } 423 | ], 424 | "addressTableLookups": [], 425 | "instructions": [ 426 | { 427 | "accounts": [], 428 | "data": "HnkkG7", 429 | "programId": "ComputeBudget111111111111111111111111111111", 430 | "stackHeight": null 431 | }, 432 | { 433 | "accounts": [], 434 | "data": "3atJtxCCtbsV", 435 | "programId": "ComputeBudget111111111111111111111111111111", 436 | "stackHeight": null 437 | }, 438 | { 439 | "accounts": [ 440 | "7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu", 441 | "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM", 442 | "6qK8Cazc6dqMSCfgN455J7aw1hHgknb6PeY8gjkAL4BE", 443 | "J2iHSUVY71hEZpZi5NKqFXAiX6dWPZbuQny8F223mQ6R", 444 | "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 445 | "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", 446 | "BcXSVX1i71H66stvnbaCGY4QUA9G6iNZNZKPxsU4A39C", 447 | "FiYwf895W6ntoitNvhVwBLS4uwKZmMhsxiQmYY44488U", 448 | "11111111111111111111111111111111", 449 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 450 | "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 451 | "SysvarRent111111111111111111111111111111111", 452 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 453 | "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 454 | ], 455 | "data": "h95wiy926iNwYRDnjh3AqDGptqSszhggaiFxKio7u1TBiwWbDxh7tfg11j6vjLoGgrH7ghWGdFD55fF2fWygVDTN8r4s27Vs6fsBZ6Zo4uJvKVX3xK5b3Xe1dmyYocqE1s2Mk4bCocb4UPYs1RZ", 456 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 457 | "stackHeight": null 458 | } 459 | ], 460 | "recentBlockhash": "7LZqLnZHM9T7oPJm7pGbBSMQJ43mcE87LGpRYCQiTaJW" 461 | }, 462 | "signatures": [ 463 | "2nebvBA9wsBgxGNLoynwLySNxKQrrty2ozfA6ziFkX2koMrFHt6o9yqmLe1Jy8W2i67E4BnxSLb7zTmc8CwC6j8M", 464 | "4vKWZCdwa11Gha8rQMZWBtCU3ULnB66qSN18kMJF5VNmvUt6B8ZeQwZk7txZfe4xPHwsA3HpY78WahaTLNqgkCxS" 465 | ] 466 | }, 467 | "version": 0 468 | } -------------------------------------------------------------------------------- /tests/pumpfun/parsed-sell-txn.json: -------------------------------------------------------------------------------- 1 | { 2 | "blockTime": 1725658406, 3 | "meta": { 4 | "computeUnitsConsumed": 30868, 5 | "err": null, 6 | "fee": 37127, 7 | "innerInstructions": [ 8 | { 9 | "index": 3, 10 | "instructions": [ 11 | { 12 | "parsed": { 13 | "info": { 14 | "amount": "94443000000", 15 | "authority": "3P2pmfQAFTwcC1xWtYbVYoRn3hngya8Kd9jMaF5GfnUa", 16 | "destination": "8NETDunyVnrNA44qUqUd8Km8XdfYyyujcWWVX7uDs9eE", 17 | "source": "HhE4skfuuxsbmhn5fRByP1y8A8tWJwuwHWi4x9UXGC88" 18 | }, 19 | "type": "transfer" 20 | }, 21 | "program": "spl-token", 22 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 23 | "stackHeight": 2 24 | }, 25 | { 26 | "accounts": [ 27 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1" 28 | ], 29 | "data": "2K7nL28PxCW8ejnyCeuMpbXuNBx6UiXevhCQQ1w3jKAeKaFaH7ikhYLsMshRzKzkbCVWsDmvLzysKxu7TgwumXtVuCdqTrqqTjtjan5hit5UfRaWKb4p8CZpNnKKqhVkRELdQtt5jLPusZYpmV8HqXcWK2iQTB7tmu2h5sU9PiaqFQzFQWLA4tqE6Wh5", 30 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 31 | "stackHeight": 2 32 | } 33 | ] 34 | } 35 | ], 36 | "logMessages": [ 37 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 38 | "Program ComputeBudget111111111111111111111111111111 success", 39 | "Program 11111111111111111111111111111111 invoke [1]", 40 | "Program 11111111111111111111111111111111 success", 41 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 42 | "Program ComputeBudget111111111111111111111111111111 success", 43 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [1]", 44 | "Program log: Instruction: Sell", 45 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 46 | "Program log: Instruction: Transfer", 47 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 80991 compute units", 48 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 49 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]", 50 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2003 of 72861 compute units", 51 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success", 52 | "Program data: vdt/007mYe7dDIbC462lt8tHfC8YUEWYYi7eJOS+RHtheLgucQrWT69DNgAAAAAAwNA9/RUAAAAAI1w2sEtKMNOjRCRW3DE+RxAmMPZLeaDDN0K2bsWTm/MmddtmAAAAAGfNDxsIAAAAhglpSPNIAwBnIeweAQAAAIZxVvxhSgIA", 53 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 30418 of 99550 compute units", 54 | "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success" 55 | ], 56 | "postBalances": [ 57 | 23021046, 58 | 717338521967, 59 | 314436784039042, 60 | 4814990743, 61 | 2039280, 62 | 2039280, 63 | 1, 64 | 1, 65 | 1141440, 66 | 5530000, 67 | 1461600, 68 | 731913600, 69 | 934087680, 70 | 0 71 | ], 72 | "postTokenBalances": [ 73 | { 74 | "accountIndex": 4, 75 | "mint": "FstBRGMkNKf4wNvfieYUPS9YsbNoQJMCh6v89zajpump", 76 | "owner": "BtMzrjEpmLTk4ZGdaS9VVp1jfneoyc1AWsU8ko7ffnug", 77 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 78 | "uiTokenAmount": { 79 | "amount": "851634659228038", 80 | "decimals": 6, 81 | "uiAmount": 851634659.228038, 82 | "uiAmountString": "851634659.228038" 83 | } 84 | }, 85 | { 86 | "accountIndex": 5, 87 | "mint": "FstBRGMkNKf4wNvfieYUPS9YsbNoQJMCh6v89zajpump", 88 | "owner": "3P2pmfQAFTwcC1xWtYbVYoRn3hngya8Kd9jMaF5GfnUa", 89 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 90 | "uiTokenAmount": { 91 | "amount": "393091", 92 | "decimals": 6, 93 | "uiAmount": 0.393091, 94 | "uiAmountString": "0.393091" 95 | } 96 | } 97 | ], 98 | "preBalances": [ 99 | 22537464, 100 | 717335521967, 101 | 314436784003480, 102 | 4818547014, 103 | 2039280, 104 | 2039280, 105 | 1, 106 | 1, 107 | 1141440, 108 | 5530000, 109 | 1461600, 110 | 731913600, 111 | 934087680, 112 | 0 113 | ], 114 | "preTokenBalances": [ 115 | { 116 | "accountIndex": 4, 117 | "mint": "FstBRGMkNKf4wNvfieYUPS9YsbNoQJMCh6v89zajpump", 118 | "owner": "BtMzrjEpmLTk4ZGdaS9VVp1jfneoyc1AWsU8ko7ffnug", 119 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 120 | "uiTokenAmount": { 121 | "amount": "851540216228038", 122 | "decimals": 6, 123 | "uiAmount": 851540216.228038, 124 | "uiAmountString": "851540216.228038" 125 | } 126 | }, 127 | { 128 | "accountIndex": 5, 129 | "mint": "FstBRGMkNKf4wNvfieYUPS9YsbNoQJMCh6v89zajpump", 130 | "owner": "3P2pmfQAFTwcC1xWtYbVYoRn3hngya8Kd9jMaF5GfnUa", 131 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 132 | "uiTokenAmount": { 133 | "amount": "94443393091", 134 | "decimals": 6, 135 | "uiAmount": 94443.393091, 136 | "uiAmountString": "94443.393091" 137 | } 138 | } 139 | ], 140 | "rewards": [], 141 | "status": { 142 | "Ok": null 143 | } 144 | }, 145 | "slot": 288224272, 146 | "transaction": { 147 | "message": { 148 | "accountKeys": [ 149 | { 150 | "pubkey": "3P2pmfQAFTwcC1xWtYbVYoRn3hngya8Kd9jMaF5GfnUa", 151 | "signer": true, 152 | "source": "transaction", 153 | "writable": true 154 | }, 155 | { 156 | "pubkey": "HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY", 157 | "signer": false, 158 | "source": "transaction", 159 | "writable": true 160 | }, 161 | { 162 | "pubkey": "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM", 163 | "signer": false, 164 | "source": "transaction", 165 | "writable": true 166 | }, 167 | { 168 | "pubkey": "BtMzrjEpmLTk4ZGdaS9VVp1jfneoyc1AWsU8ko7ffnug", 169 | "signer": false, 170 | "source": "transaction", 171 | "writable": true 172 | }, 173 | { 174 | "pubkey": "8NETDunyVnrNA44qUqUd8Km8XdfYyyujcWWVX7uDs9eE", 175 | "signer": false, 176 | "source": "transaction", 177 | "writable": true 178 | }, 179 | { 180 | "pubkey": "HhE4skfuuxsbmhn5fRByP1y8A8tWJwuwHWi4x9UXGC88", 181 | "signer": false, 182 | "source": "transaction", 183 | "writable": true 184 | }, 185 | { 186 | "pubkey": "ComputeBudget111111111111111111111111111111", 187 | "signer": false, 188 | "source": "transaction", 189 | "writable": false 190 | }, 191 | { 192 | "pubkey": "11111111111111111111111111111111", 193 | "signer": false, 194 | "source": "transaction", 195 | "writable": false 196 | }, 197 | { 198 | "pubkey": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 199 | "signer": false, 200 | "source": "transaction", 201 | "writable": false 202 | }, 203 | { 204 | "pubkey": "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 205 | "signer": false, 206 | "source": "transaction", 207 | "writable": false 208 | }, 209 | { 210 | "pubkey": "FstBRGMkNKf4wNvfieYUPS9YsbNoQJMCh6v89zajpump", 211 | "signer": false, 212 | "source": "transaction", 213 | "writable": false 214 | }, 215 | { 216 | "pubkey": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 217 | "signer": false, 218 | "source": "transaction", 219 | "writable": false 220 | }, 221 | { 222 | "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 223 | "signer": false, 224 | "source": "transaction", 225 | "writable": false 226 | }, 227 | { 228 | "pubkey": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 229 | "signer": false, 230 | "source": "transaction", 231 | "writable": false 232 | } 233 | ], 234 | "addressTableLookups": [], 235 | "instructions": [ 236 | { 237 | "accounts": [], 238 | "data": "JC3gyu", 239 | "programId": "ComputeBudget111111111111111111111111111111", 240 | "stackHeight": null 241 | }, 242 | { 243 | "parsed": { 244 | "info": { 245 | "destination": "HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY", 246 | "lamports": 3000000, 247 | "source": "3P2pmfQAFTwcC1xWtYbVYoRn3hngya8Kd9jMaF5GfnUa" 248 | }, 249 | "type": "transfer" 250 | }, 251 | "program": "system", 252 | "programId": "11111111111111111111111111111111", 253 | "stackHeight": null 254 | }, 255 | { 256 | "accounts": [], 257 | "data": "3uvHGZCG1HLb", 258 | "programId": "ComputeBudget111111111111111111111111111111", 259 | "stackHeight": null 260 | }, 261 | { 262 | "accounts": [ 263 | "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf", 264 | "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM", 265 | "FstBRGMkNKf4wNvfieYUPS9YsbNoQJMCh6v89zajpump", 266 | "BtMzrjEpmLTk4ZGdaS9VVp1jfneoyc1AWsU8ko7ffnug", 267 | "8NETDunyVnrNA44qUqUd8Km8XdfYyyujcWWVX7uDs9eE", 268 | "HhE4skfuuxsbmhn5fRByP1y8A8tWJwuwHWi4x9UXGC88", 269 | "3P2pmfQAFTwcC1xWtYbVYoRn3hngya8Kd9jMaF5GfnUa", 270 | "11111111111111111111111111111111", 271 | "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 272 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 273 | "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1", 274 | "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 275 | ], 276 | "data": "5jRcjdixRUDdsurHfw6nmxhBKfiYQZH43", 277 | "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 278 | "stackHeight": null 279 | } 280 | ], 281 | "recentBlockhash": "261oWuAQqwtEo8xQ3fWtjnvdub8iqA98oMw7u4L5suyq" 282 | }, 283 | "signatures": [ 284 | "3tJczs8y2bR8tVALRQZBZFihn2gZ9EWJuHgKQiyiWawr3aCNekd76BNX78fero23nv4afmsuE5Rsa99RccCijWy5" 285 | ] 286 | }, 287 | "version": 0 288 | } -------------------------------------------------------------------------------- /tests/pumpfun/tests.spec.ts: -------------------------------------------------------------------------------- 1 | import { ParsedTransactionWithMeta } from '@solana/web3.js'; 2 | import { PumpFunParser } from '../../src'; 3 | import fs from 'fs'; 4 | import { CompleteInfo, CreateInfo, TradeInfo } from '../../src/parser/pumpfun/types'; 5 | describe('PumpFunParser', () => { 6 | const buyTransaction = JSON.parse( 7 | fs.readFileSync('tests/pumpfun/parsed-buy-txn.json', 'utf-8') 8 | ) as unknown as ParsedTransactionWithMeta; 9 | const sellTransaction = JSON.parse( 10 | fs.readFileSync('tests/pumpfun/parsed-sell-txn.json', 'utf-8') 11 | ) as unknown as ParsedTransactionWithMeta; 12 | const createTransaction = JSON.parse( 13 | fs.readFileSync('tests/pumpfun/parsed-create-txn.json', 'utf-8') 14 | ) as unknown as ParsedTransactionWithMeta; 15 | const completeTransaction = JSON.parse( 16 | fs.readFileSync('tests/pumpfun/parsed-complete-txn.json', 'utf-8') 17 | ) as unknown as ParsedTransactionWithMeta; 18 | const parser = new PumpFunParser(); 19 | 20 | test('parse should correctly identify trade action [buy]', async () => { 21 | const result = parser.parse(buyTransaction); 22 | const expectedActionInfos = [ 23 | { 24 | tokenMint: '63XVR6bgnKN8Mpt6iavzQH5Z2ig5EGd4sHvrGFuBpump', 25 | solAmount: '3766555', 26 | tokenAmount: '134031426910', 27 | trader: 'CBFCFmju7azw3pDHXWre24PjvDVrYwDdfgiKejmvJJqj', 28 | isBuy: true, 29 | timestamp: '1737713686', 30 | virtualSolReserves: '30078520006', 31 | virtualTokenReserves: '1070198932876269', 32 | }, 33 | { 34 | tokenMint: '63XVR6bgnKN8Mpt6iavzQH5Z2ig5EGd4sHvrGFuBpump', 35 | solAmount: '7255022', 36 | tokenAmount: '258072669121', 37 | trader: 'AhRYQBSvkAR5WEr1hDFEz6NwfVKkcS5G37ZM14yFUE8A', 38 | isBuy: true, 39 | timestamp: '1737713686', 40 | virtualSolReserves: '30085775028', 41 | virtualTokenReserves: '1069940860207148', 42 | }, 43 | { 44 | tokenMint: '63XVR6bgnKN8Mpt6iavzQH5Z2ig5EGd4sHvrGFuBpump', 45 | solAmount: '2170530', 46 | tokenAmount: '77185002179', 47 | trader: 'FspiJ3b2s3xoaGVWVidhi5kKhxuzGUMmk7qGGsF3Bpjv', 48 | isBuy: true, 49 | timestamp: '1737713686', 50 | virtualSolReserves: '30087945558', 51 | virtualTokenReserves: '1069863675204969', 52 | }, 53 | { 54 | tokenMint: '63XVR6bgnKN8Mpt6iavzQH5Z2ig5EGd4sHvrGFuBpump', 55 | solAmount: '2600404', 56 | tokenAmount: '92456837488', 57 | trader: 'HAZyn8MtsGucsi6kJxwybnVjJxi7BtwriRU1SNB6NVft', 58 | isBuy: true, 59 | timestamp: '1737713686', 60 | virtualSolReserves: '30090545962', 61 | virtualTokenReserves: '1069771218367481', 62 | }, 63 | ]; 64 | 65 | expect(result.platform).toBe('pumpfun'); 66 | expect(result.actions).toHaveLength(4); 67 | expect(result.actions.filter((a) => a.type == 'trade').length).toBe(4); 68 | expect(result.actions.filter((a) => (a.info as TradeInfo).isBuy).length).toBe(4); 69 | 70 | for (let i = 0; i < result.actions.length; i++) { 71 | expect((result.actions[i].info as TradeInfo).solAmount.toString()).toBe( 72 | expectedActionInfos[i].solAmount 73 | ); 74 | expect((result.actions[i].info as TradeInfo).tokenAmount.toString()).toBe( 75 | expectedActionInfos[i].tokenAmount 76 | ); 77 | expect((result.actions[i].info as TradeInfo).tokenMint.toString()).toBe( 78 | expectedActionInfos[i].tokenMint 79 | ); 80 | expect((result.actions[i].info as TradeInfo).trader.toString()).toBe( 81 | expectedActionInfos[i].trader 82 | ); 83 | expect((result.actions[i].info as TradeInfo).timestamp.toString()).toBe( 84 | expectedActionInfos[i].timestamp 85 | ); 86 | expect((result.actions[i].info as TradeInfo).virtualSolReserves.toString()).toBe( 87 | expectedActionInfos[i].virtualSolReserves 88 | ); 89 | expect((result.actions[i].info as TradeInfo).virtualTokenReserves.toString()).toBe( 90 | expectedActionInfos[i].virtualTokenReserves 91 | ); 92 | } 93 | }); 94 | 95 | test('parse should correctly identify trade action [sell]', () => { 96 | const result = parser.parse(sellTransaction); 97 | const expectedActionInfos = [ 98 | { 99 | tokenMint: 'FstBRGMkNKf4wNvfieYUPS9YsbNoQJMCh6v89zajpump', 100 | solAmount: '3556271', 101 | tokenAmount: '94443000000', 102 | trader: '3P2pmfQAFTwcC1xWtYbVYoRn3hngya8Kd9jMaF5GfnUa', 103 | isBuy: false, 104 | timestamp: '1725658406', 105 | virtualSolReserves: '34813758823', 106 | virtualTokenReserves: '924634659228038', 107 | }, 108 | ]; 109 | 110 | expect(result.platform).toBe('pumpfun'); 111 | expect(result.actions).toHaveLength(1); 112 | expect(result.actions.filter((a) => a.type == 'trade')).toHaveLength(1); 113 | expect(result.actions.filter((a) => !(a.info as TradeInfo).isBuy)).toHaveLength(1); 114 | 115 | for (let i = 0; i < result.actions.length; i++) { 116 | expect((result.actions[i].info as TradeInfo).solAmount.toString()).toBe( 117 | expectedActionInfos[i].solAmount 118 | ); 119 | expect((result.actions[i].info as TradeInfo).tokenAmount.toString()).toBe( 120 | expectedActionInfos[i].tokenAmount 121 | ); 122 | expect((result.actions[i].info as TradeInfo).tokenMint.toString()).toBe( 123 | expectedActionInfos[i].tokenMint 124 | ); 125 | expect((result.actions[i].info as TradeInfo).trader.toString()).toBe( 126 | expectedActionInfos[i].trader 127 | ); 128 | expect((result.actions[i].info as TradeInfo).timestamp.toString()).toBe( 129 | expectedActionInfos[i].timestamp 130 | ); 131 | expect((result.actions[i].info as TradeInfo).virtualSolReserves.toString()).toBe( 132 | expectedActionInfos[i].virtualSolReserves 133 | ); 134 | expect((result.actions[i].info as TradeInfo).virtualTokenReserves.toString()).toBe( 135 | expectedActionInfos[i].virtualTokenReserves 136 | ); 137 | } 138 | }); 139 | 140 | test('parse should correctly identify complete action', () => { 141 | const result = parser.parse(completeTransaction); 142 | const expectedActionInfos = [ 143 | { 144 | tokenMint: 'B9ktH3g7mwgdoDgCgGRim6qeqPcyRVWJueXS12CMpump', 145 | bondingCurve: '5dhRAEw3LfUMTJcPqYSyasH45jHnWeZQmM2Hccic59SZ', 146 | user: 'niggerd597QYedtvjQDVHZTCCGyJrwHNm2i49dkm5zS', 147 | timestamp: '1738104027', 148 | }, 149 | ]; 150 | const completeActions = result.actions.filter((a) => a.type == 'complete'); 151 | expect(completeActions).toHaveLength(1); 152 | expect((completeActions[0].info as CompleteInfo).tokenMint.toString()).toBe( 153 | expectedActionInfos[0].tokenMint 154 | ); 155 | expect((completeActions[0].info as CompleteInfo).bondingCurve.toString()).toBe( 156 | expectedActionInfos[0].bondingCurve 157 | ); 158 | expect((completeActions[0].info as CompleteInfo).user.toString()).toBe( 159 | expectedActionInfos[0].user 160 | ); 161 | expect((completeActions[0].info as CompleteInfo).timestamp.toString()).toBe( 162 | expectedActionInfos[0].timestamp 163 | ); 164 | }); 165 | 166 | test('parse should correctly identify create action', () => { 167 | const result = parser.parse(createTransaction); 168 | const expectedActionInfos = [ 169 | { 170 | name: 'Blue Strip Fiend', 171 | symbol: 'Mosey', 172 | uri: 'https://ipfs.io/ipfs/QmQQAzxeHfPDRma1dNhcBP4k9ej4epU9U2T818FyEG7izP', 173 | tokenMint: '7F7TeMsGutc2YpxeH7U3PiFLwG2FygN2jMLeDKAXNbwu', 174 | bondingCurve: '6qK8Cazc6dqMSCfgN455J7aw1hHgknb6PeY8gjkAL4BE', 175 | tokenDecimals: 6, 176 | createdBy: 'FiYwf895W6ntoitNvhVwBLS4uwKZmMhsxiQmYY44488U', 177 | }, 178 | ]; 179 | const createActions = result.actions.filter((a) => a.type == 'create'); 180 | expect(createActions).toHaveLength(1); 181 | expect((createActions[0].info as CreateInfo).name).toBe(expectedActionInfos[0].name); 182 | expect((createActions[0].info as CreateInfo).symbol).toBe(expectedActionInfos[0].symbol); 183 | expect((createActions[0].info as CreateInfo).uri).toBe(expectedActionInfos[0].uri); 184 | expect((createActions[0].info as CreateInfo).tokenMint.toString()).toBe( 185 | expectedActionInfos[0].tokenMint 186 | ); 187 | expect((createActions[0].info as CreateInfo).bondingCurve.toString()).toBe( 188 | expectedActionInfos[0].bondingCurve 189 | ); 190 | expect((createActions[0].info as CreateInfo).createdBy.toString()).toBe( 191 | expectedActionInfos[0].createdBy 192 | ); 193 | expect((createActions[0].info as CreateInfo).tokenDecimals).toBe( 194 | expectedActionInfos[0].tokenDecimals 195 | ); 196 | }); 197 | 198 | test('parseMultiple should parse multiple transactions', () => { 199 | const results = parser.parseMultiple([buyTransaction, sellTransaction]); 200 | expect(results).toHaveLength(2); 201 | expect(results[0].platform).toBe('pumpfun'); 202 | expect(results[1].platform).toBe('pumpfun'); 203 | expect(results[0].actions[0].type == 'buy'); 204 | expect(results[1].actions[0].type == 'sell'); 205 | }); 206 | }); 207 | -------------------------------------------------------------------------------- /tests/raydium/parsed-deposit-txn.json: -------------------------------------------------------------------------------- 1 | { 2 | "blockTime": 1740101327, 3 | "meta": { 4 | "computeUnitsConsumed": 74399, 5 | "err": null, 6 | "fee": 15001, 7 | "innerInstructions": [ 8 | { 9 | "index": 4, 10 | "instructions": [ 11 | { 12 | "parsed": { 13 | "info": { 14 | "amount": "214323699689057", 15 | "authority": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 16 | "destination": "GRbSyoXBiiSkcCqE2k8bjPbXC5GH2qH7aKJnZi5GgcNT", 17 | "source": "8GQR2bwwgxh3hkaK2bGQm3FUMudB1iyEUVfwPah97Ros" 18 | }, 19 | "type": "transfer" 20 | }, 21 | "program": "spl-token", 22 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 23 | "stackHeight": 2 24 | }, 25 | { 26 | "parsed": { 27 | "info": { 28 | "amount": "1000000", 29 | "authority": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 30 | "destination": "FJHdVRQanLo8JZvWy4hGZqiNdRLacnGf3U6Y7R2QUt62", 31 | "source": "9VAwVMzAMcKy6SZn4dSPCe3WYWuCtNQaxicB2oN1ubwz" 32 | }, 33 | "type": "transfer" 34 | }, 35 | "program": "spl-token", 36 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 37 | "stackHeight": 2 38 | }, 39 | { 40 | "parsed": { 41 | "info": { 42 | "account": "DjVFbeC8e1Tjt7Hsv2GaWWbVWvyEKArkDpzhbPMVV79A", 43 | "amount": "14561191343", 44 | "mint": "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ", 45 | "mintAuthority": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1" 46 | }, 47 | "type": "mintTo" 48 | }, 49 | "program": "spl-token", 50 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 51 | "stackHeight": 2 52 | } 53 | ] 54 | } 55 | ], 56 | "logMessages": [ 57 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 58 | "Program ComputeBudget111111111111111111111111111111 success", 59 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 60 | "Program ComputeBudget111111111111111111111111111111 success", 61 | "Program 11111111111111111111111111111111 invoke [1]", 62 | "Program 11111111111111111111111111111111 success", 63 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", 64 | "Program log: Instruction: InitializeAccount", 65 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3443 of 599550 compute units", 66 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 67 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [1]", 68 | "Program log: ray_log: AT8JSqfMxwAAQEIPAAAAAAABAAAAAAAAANqXrwtOFx8Agw1vAgAAAACvvwZvigAAAGh3TAIAAAAAAAAAAAAAAABcX/SwC+ogAAAAAAAAAAAAYab8H+3CAABAQg8AAAAAAK8l6mMDAAAA", 69 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 70 | "Program log: Instruction: Transfer", 71 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 552637 compute units", 72 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 73 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 74 | "Program log: Instruction: Transfer", 75 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4736 of 545035 compute units", 76 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 77 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 78 | "Program log: Instruction: MintTo", 79 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4492 of 537317 compute units", 80 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 81 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 67591 of 596107 compute units", 82 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 success", 83 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", 84 | "Program log: Instruction: CloseAccount", 85 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2915 of 528516 compute units", 86 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success" 87 | ], 88 | "postBalances": [ 89 | 1121568694, 90 | 0, 91 | 2039280, 92 | 2039280, 93 | 1, 94 | 1, 95 | 934087680, 96 | 1141440, 97 | 18862180065, 98 | 23357760, 99 | 3591360, 100 | 79594560, 101 | 6124800, 102 | 16258560, 103 | 1461600, 104 | 2039280, 105 | 43901704, 106 | 1009200, 107 | 989572826826 108 | ], 109 | "postTokenBalances": [ 110 | { 111 | "accountIndex": 2, 112 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 113 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 114 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 115 | "uiTokenAmount": { 116 | "amount": "376035017353701", 117 | "decimals": 9, 118 | "uiAmount": 376035.017353701, 119 | "uiAmountString": "376035.017353701" 120 | } 121 | }, 122 | { 123 | "accountIndex": 3, 124 | "mint": "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ", 125 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 126 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 127 | "uiTokenAmount": { 128 | "amount": "608129391454", 129 | "decimals": 9, 130 | "uiAmount": 608.129391454, 131 | "uiAmountString": "608.129391454" 132 | } 133 | }, 134 | { 135 | "accountIndex": 15, 136 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 137 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 138 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 139 | "uiTokenAmount": { 140 | "amount": "8972878678660369", 141 | "decimals": 9, 142 | "uiAmount": 8972878.678660369, 143 | "uiAmountString": "8972878.678660369" 144 | } 145 | }, 146 | { 147 | "accountIndex": 16, 148 | "mint": "So11111111111111111111111111111111111111112", 149 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 150 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 151 | "uiTokenAmount": { 152 | "amount": "41862424", 153 | "decimals": 9, 154 | "uiAmount": 0.041862424, 155 | "uiAmountString": "0.041862424" 156 | } 157 | } 158 | ], 159 | "preBalances": [ 160 | 1122583695, 161 | 0, 162 | 2039280, 163 | 2039280, 164 | 1, 165 | 1, 166 | 934087680, 167 | 1141440, 168 | 18862180065, 169 | 23357760, 170 | 3591360, 171 | 79594560, 172 | 6124800, 173 | 16258560, 174 | 1461600, 175 | 2039280, 176 | 42901704, 177 | 1009200, 178 | 989572826826 179 | ], 180 | "preTokenBalances": [ 181 | { 182 | "accountIndex": 2, 183 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 184 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 185 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 186 | "uiTokenAmount": { 187 | "amount": "590358717042758", 188 | "decimals": 9, 189 | "uiAmount": 590358.717042758, 190 | "uiAmountString": "590358.717042758" 191 | } 192 | }, 193 | { 194 | "accountIndex": 3, 195 | "mint": "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ", 196 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 197 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 198 | "uiTokenAmount": { 199 | "amount": "593568200111", 200 | "decimals": 9, 201 | "uiAmount": 593.568200111, 202 | "uiAmountString": "593.568200111" 203 | } 204 | }, 205 | { 206 | "accountIndex": 15, 207 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 208 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 209 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 210 | "uiTokenAmount": { 211 | "amount": "8758554978971312", 212 | "decimals": 9, 213 | "uiAmount": 8758554.978971312, 214 | "uiAmountString": "8758554.978971312" 215 | } 216 | }, 217 | { 218 | "accountIndex": 16, 219 | "mint": "So11111111111111111111111111111111111111112", 220 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 221 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 222 | "uiTokenAmount": { 223 | "amount": "40862424", 224 | "decimals": 9, 225 | "uiAmount": 0.040862424, 226 | "uiAmountString": "0.040862424" 227 | } 228 | } 229 | ], 230 | "rewards": [], 231 | "status": { 232 | "Ok": null 233 | } 234 | }, 235 | "slot": 322023787, 236 | "transaction": { 237 | "message": { 238 | "accountKeys": [ 239 | { 240 | "pubkey": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 241 | "signer": true, 242 | "source": "transaction", 243 | "writable": true 244 | }, 245 | { 246 | "pubkey": "9VAwVMzAMcKy6SZn4dSPCe3WYWuCtNQaxicB2oN1ubwz", 247 | "signer": false, 248 | "source": "transaction", 249 | "writable": true 250 | }, 251 | { 252 | "pubkey": "8GQR2bwwgxh3hkaK2bGQm3FUMudB1iyEUVfwPah97Ros", 253 | "signer": false, 254 | "source": "transaction", 255 | "writable": true 256 | }, 257 | { 258 | "pubkey": "DjVFbeC8e1Tjt7Hsv2GaWWbVWvyEKArkDpzhbPMVV79A", 259 | "signer": false, 260 | "source": "transaction", 261 | "writable": true 262 | }, 263 | { 264 | "pubkey": "ComputeBudget111111111111111111111111111111", 265 | "signer": false, 266 | "source": "transaction", 267 | "writable": false 268 | }, 269 | { 270 | "pubkey": "11111111111111111111111111111111", 271 | "signer": false, 272 | "source": "transaction", 273 | "writable": false 274 | }, 275 | { 276 | "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 277 | "signer": false, 278 | "source": "transaction", 279 | "writable": false 280 | }, 281 | { 282 | "pubkey": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", 283 | "signer": false, 284 | "source": "transaction", 285 | "writable": false 286 | }, 287 | { 288 | "pubkey": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 289 | "signer": false, 290 | "source": "transaction", 291 | "writable": false 292 | }, 293 | { 294 | "pubkey": "2pVgkcG7ribZ72R7mfKmY5ygJTe6L9FpaKCHtyKiV4qT", 295 | "signer": false, 296 | "source": "transaction", 297 | "writable": false 298 | }, 299 | { 300 | "pubkey": "Cux4RjDHhRUYkNLePxrRo97ppg3LopHfg1mE2RF2gPY", 301 | "signer": false, 302 | "source": "transaction", 303 | "writable": false 304 | }, 305 | { 306 | "pubkey": "8NQimqJ5MeaaEYECShkGCGPNauofjQ1UneCNdVWbHzSY", 307 | "signer": false, 308 | "source": "transaction", 309 | "writable": false 310 | }, 311 | { 312 | "pubkey": "43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq", 313 | "signer": false, 314 | "source": "lookupTable", 315 | "writable": true 316 | }, 317 | { 318 | "pubkey": "DLGYoCeeLwJcZrrWy4bEgce3osTFGshwTovMME4mppwK", 319 | "signer": false, 320 | "source": "lookupTable", 321 | "writable": true 322 | }, 323 | { 324 | "pubkey": "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ", 325 | "signer": false, 326 | "source": "lookupTable", 327 | "writable": true 328 | }, 329 | { 330 | "pubkey": "GRbSyoXBiiSkcCqE2k8bjPbXC5GH2qH7aKJnZi5GgcNT", 331 | "signer": false, 332 | "source": "lookupTable", 333 | "writable": true 334 | }, 335 | { 336 | "pubkey": "FJHdVRQanLo8JZvWy4hGZqiNdRLacnGf3U6Y7R2QUt62", 337 | "signer": false, 338 | "source": "lookupTable", 339 | "writable": true 340 | }, 341 | { 342 | "pubkey": "SysvarRent111111111111111111111111111111111", 343 | "signer": false, 344 | "source": "lookupTable", 345 | "writable": false 346 | }, 347 | { 348 | "pubkey": "So11111111111111111111111111111111111111112", 349 | "signer": false, 350 | "source": "lookupTable", 351 | "writable": false 352 | } 353 | ], 354 | "addressTableLookups": [ 355 | { 356 | "accountKey": "2immgwYNHBbyVQKVGCEkgWpi53bLwWNRMB5G2nbgYV17", 357 | "readonlyIndexes": [ 358 | 5 359 | ], 360 | "writableIndexes": [] 361 | }, 362 | { 363 | "accountKey": "7tzMoKvLTwPZfdQvPaU2KMVCb7fqp9LvfrRcrzisvnDL", 364 | "readonlyIndexes": [ 365 | 3 366 | ], 367 | "writableIndexes": [ 368 | 1, 369 | 7, 370 | 6, 371 | 4, 372 | 5 373 | ] 374 | } 375 | ], 376 | "instructions": [ 377 | { 378 | "accounts": [], 379 | "data": "3J1xdJKApyfV", 380 | "programId": "ComputeBudget111111111111111111111111111111", 381 | "stackHeight": null 382 | }, 383 | { 384 | "accounts": [], 385 | "data": "JzwPro", 386 | "programId": "ComputeBudget111111111111111111111111111111", 387 | "stackHeight": null 388 | }, 389 | { 390 | "parsed": { 391 | "info": { 392 | "base": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 393 | "lamports": 3039280, 394 | "newAccount": "9VAwVMzAMcKy6SZn4dSPCe3WYWuCtNQaxicB2oN1ubwz", 395 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 396 | "seed": "AorXdytFYpNTHnsXYf9rpYj5vWuMP3GN", 397 | "source": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 398 | "space": 165 399 | }, 400 | "type": "createAccountWithSeed" 401 | }, 402 | "program": "system", 403 | "programId": "11111111111111111111111111111111", 404 | "stackHeight": null 405 | }, 406 | { 407 | "parsed": { 408 | "info": { 409 | "account": "9VAwVMzAMcKy6SZn4dSPCe3WYWuCtNQaxicB2oN1ubwz", 410 | "mint": "So11111111111111111111111111111111111111112", 411 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 412 | "rentSysvar": "SysvarRent111111111111111111111111111111111" 413 | }, 414 | "type": "initializeAccount" 415 | }, 416 | "program": "spl-token", 417 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 418 | "stackHeight": null 419 | }, 420 | { 421 | "accounts": [ 422 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 423 | "43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq", 424 | "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 425 | "2pVgkcG7ribZ72R7mfKmY5ygJTe6L9FpaKCHtyKiV4qT", 426 | "DLGYoCeeLwJcZrrWy4bEgce3osTFGshwTovMME4mppwK", 427 | "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ", 428 | "GRbSyoXBiiSkcCqE2k8bjPbXC5GH2qH7aKJnZi5GgcNT", 429 | "FJHdVRQanLo8JZvWy4hGZqiNdRLacnGf3U6Y7R2QUt62", 430 | "Cux4RjDHhRUYkNLePxrRo97ppg3LopHfg1mE2RF2gPY", 431 | "8GQR2bwwgxh3hkaK2bGQm3FUMudB1iyEUVfwPah97Ros", 432 | "9VAwVMzAMcKy6SZn4dSPCe3WYWuCtNQaxicB2oN1ubwz", 433 | "DjVFbeC8e1Tjt7Hsv2GaWWbVWvyEKArkDpzhbPMVV79A", 434 | "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 435 | "8NQimqJ5MeaaEYECShkGCGPNauofjQ1UneCNdVWbHzSY" 436 | ], 437 | "data": "xw21qSE4e8XWQu37EG8QDe3NDkoteb9QrxLiGDgqVhKD", 438 | "programId": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", 439 | "stackHeight": null 440 | }, 441 | { 442 | "parsed": { 443 | "info": { 444 | "account": "9VAwVMzAMcKy6SZn4dSPCe3WYWuCtNQaxicB2oN1ubwz", 445 | "destination": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 446 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6" 447 | }, 448 | "type": "closeAccount" 449 | }, 450 | "program": "spl-token", 451 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 452 | "stackHeight": null 453 | } 454 | ], 455 | "recentBlockhash": "2Ubp4vydCTBoeUrg6sp6ExvhEcRWAp9tyQbLEPxRtxKK" 456 | }, 457 | "signatures": [ 458 | "pXPLUDJPBn58aYkP9d91fySxpiy8qzFmwid33jPsMKG2TfkasT7zMTAu15HuBBQ6NFLXHpM27yx8ooCikzjjrEg" 459 | ] 460 | }, 461 | "version": 0 462 | } -------------------------------------------------------------------------------- /tests/raydium/parsed-swap-base-out-txn.json: -------------------------------------------------------------------------------- 1 | { 2 | "blockTime": 1739418845, 3 | "meta": { 4 | "computeUnitsConsumed": 42046, 5 | "err": null, 6 | "fee": 45000, 7 | "innerInstructions": [ 8 | { 9 | "index": 2, 10 | "instructions": [ 11 | { 12 | "parsed": { 13 | "info": { 14 | "amount": "10123879371073", 15 | "authority": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU", 16 | "destination": "GRbSyoXBiiSkcCqE2k8bjPbXC5GH2qH7aKJnZi5GgcNT", 17 | "source": "6zE53dpDdXwysXPgeFmP83P4s1pMm25jmjLmknuWaayu" 18 | }, 19 | "type": "transfer" 20 | }, 21 | "program": "spl-token", 22 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 23 | "stackHeight": 2 24 | }, 25 | { 26 | "parsed": { 27 | "info": { 28 | "amount": "42094", 29 | "authority": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 30 | "destination": "GpGzc6Trzp8Chcbh6fYHyMMPd5z5E3uJ76hDD2xq87vs", 31 | "source": "FJHdVRQanLo8JZvWy4hGZqiNdRLacnGf3U6Y7R2QUt62" 32 | }, 33 | "type": "transfer" 34 | }, 35 | "program": "spl-token", 36 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 37 | "stackHeight": 2 38 | } 39 | ] 40 | } 41 | ], 42 | "logMessages": [ 43 | "Program 11111111111111111111111111111111 invoke [1]", 44 | "Program 11111111111111111111111111111111 success", 45 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", 46 | "Program log: Instruction: InitializeAccount", 47 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3443 of 99850 compute units", 48 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 49 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [1]", 50 | "Program log: ray_log: A0HROyY1CQAAAAAAAAAAAAACAAAAAAAAAEHROyY1CQAAvVQ43NH+IgDIKHMCAAAAAG6kAAAAAAAA", 51 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 52 | "Program log: Instruction: Transfer", 53 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 77525 compute units", 54 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 55 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 56 | "Program log: Instruction: Transfer", 57 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4736 of 69899 compute units", 58 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 59 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 32322 of 96407 compute units", 60 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 success", 61 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", 62 | "Program log: Instruction: CloseAccount", 63 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2915 of 64085 compute units", 64 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 65 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", 66 | "Program log: Instruction: CloseAccount", 67 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2916 of 61170 compute units", 68 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 69 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 70 | "Program ComputeBudget111111111111111111111111111111 success", 71 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 72 | "Program ComputeBudget111111111111111111111111111111 success" 73 | ], 74 | "postBalances": [ 75 | 5581224451, 76 | 0, 77 | 6124800, 78 | 23357760, 79 | 16258560, 80 | 2039280, 81 | 43098698, 82 | 3591360, 83 | 101978120, 84 | 101978120, 85 | 79594560, 86 | 2039280, 87 | 2039280, 88 | 0, 89 | 1, 90 | 934087680, 91 | 951627446606, 92 | 1009200, 93 | 1141440, 94 | 15707671713, 95 | 1141440, 96 | 0, 97 | 1 98 | ], 99 | "postTokenBalances": [ 100 | { 101 | "accountIndex": 5, 102 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 103 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 104 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 105 | "uiTokenAmount": { 106 | "amount": "9860450383832574", 107 | "decimals": 9, 108 | "uiAmount": 9860450.383832574, 109 | "uiAmountString": "9860450.383832574" 110 | } 111 | }, 112 | { 113 | "accountIndex": 6, 114 | "mint": "So11111111111111111111111111111111111111112", 115 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 116 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 117 | "uiTokenAmount": { 118 | "amount": "41059418", 119 | "decimals": 9, 120 | "uiAmount": 0.041059418, 121 | "uiAmountString": "0.041059418" 122 | } 123 | }, 124 | { 125 | "accountIndex": 11, 126 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 127 | "owner": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 128 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 129 | "uiTokenAmount": { 130 | "amount": "0", 131 | "decimals": 9, 132 | "uiAmount": null, 133 | "uiAmountString": "0" 134 | } 135 | }, 136 | { 137 | "accountIndex": 12, 138 | "mint": "So11111111111111111111111111111111111111112", 139 | "owner": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 140 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 141 | "uiTokenAmount": { 142 | "amount": "0", 143 | "decimals": 9, 144 | "uiAmount": null, 145 | "uiAmountString": "0" 146 | } 147 | } 148 | ], 149 | "preBalances": [ 150 | 5579188077, 151 | 0, 152 | 6124800, 153 | 23357760, 154 | 16258560, 155 | 2039280, 156 | 43140792, 157 | 3591360, 158 | 101978120, 159 | 101978120, 160 | 79594560, 161 | 2039280, 162 | 2039280, 163 | 2039280, 164 | 1, 165 | 934087680, 166 | 951627446606, 167 | 1009200, 168 | 1141440, 169 | 15707671713, 170 | 1141440, 171 | 0, 172 | 1 173 | ], 174 | "preTokenBalances": [ 175 | { 176 | "accountIndex": 5, 177 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 178 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 179 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 180 | "uiTokenAmount": { 181 | "amount": "9850326504461501", 182 | "decimals": 9, 183 | "uiAmount": 9850326.5044615, 184 | "uiAmountString": "9850326.504461501" 185 | } 186 | }, 187 | { 188 | "accountIndex": 6, 189 | "mint": "So11111111111111111111111111111111111111112", 190 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 191 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 192 | "uiTokenAmount": { 193 | "amount": "41101512", 194 | "decimals": 9, 195 | "uiAmount": 0.041101512, 196 | "uiAmountString": "0.041101512" 197 | } 198 | }, 199 | { 200 | "accountIndex": 11, 201 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 202 | "owner": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 203 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 204 | "uiTokenAmount": { 205 | "amount": "0", 206 | "decimals": 9, 207 | "uiAmount": null, 208 | "uiAmountString": "0" 209 | } 210 | }, 211 | { 212 | "accountIndex": 12, 213 | "mint": "So11111111111111111111111111111111111111112", 214 | "owner": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 215 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 216 | "uiTokenAmount": { 217 | "amount": "0", 218 | "decimals": 9, 219 | "uiAmount": null, 220 | "uiAmountString": "0" 221 | } 222 | }, 223 | { 224 | "accountIndex": 13, 225 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 226 | "owner": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU", 227 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 228 | "uiTokenAmount": { 229 | "amount": "10123879371073", 230 | "decimals": 9, 231 | "uiAmount": 10123.879371073, 232 | "uiAmountString": "10123.879371073" 233 | } 234 | } 235 | ], 236 | "rewards": [], 237 | "status": { 238 | "Ok": null 239 | } 240 | }, 241 | "slot": 320301972, 242 | "transaction": { 243 | "message": { 244 | "accountKeys": [ 245 | { 246 | "pubkey": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU", 247 | "signer": true, 248 | "source": "transaction", 249 | "writable": true 250 | }, 251 | { 252 | "pubkey": "GpGzc6Trzp8Chcbh6fYHyMMPd5z5E3uJ76hDD2xq87vs", 253 | "signer": false, 254 | "source": "transaction", 255 | "writable": true 256 | }, 257 | { 258 | "pubkey": "43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq", 259 | "signer": false, 260 | "source": "transaction", 261 | "writable": true 262 | }, 263 | { 264 | "pubkey": "2pVgkcG7ribZ72R7mfKmY5ygJTe6L9FpaKCHtyKiV4qT", 265 | "signer": false, 266 | "source": "transaction", 267 | "writable": true 268 | }, 269 | { 270 | "pubkey": "DLGYoCeeLwJcZrrWy4bEgce3osTFGshwTovMME4mppwK", 271 | "signer": false, 272 | "source": "transaction", 273 | "writable": true 274 | }, 275 | { 276 | "pubkey": "GRbSyoXBiiSkcCqE2k8bjPbXC5GH2qH7aKJnZi5GgcNT", 277 | "signer": false, 278 | "source": "transaction", 279 | "writable": true 280 | }, 281 | { 282 | "pubkey": "FJHdVRQanLo8JZvWy4hGZqiNdRLacnGf3U6Y7R2QUt62", 283 | "signer": false, 284 | "source": "transaction", 285 | "writable": true 286 | }, 287 | { 288 | "pubkey": "Cux4RjDHhRUYkNLePxrRo97ppg3LopHfg1mE2RF2gPY", 289 | "signer": false, 290 | "source": "transaction", 291 | "writable": true 292 | }, 293 | { 294 | "pubkey": "Gq6Lj6ERw195D8EM8qMvUp9FpPN6qbsJP22vLa2i7JRn", 295 | "signer": false, 296 | "source": "transaction", 297 | "writable": true 298 | }, 299 | { 300 | "pubkey": "CyNm3vXn2ohV9FLS8gM5NcxVb25btBkHawELurtzPL5", 301 | "signer": false, 302 | "source": "transaction", 303 | "writable": true 304 | }, 305 | { 306 | "pubkey": "8NQimqJ5MeaaEYECShkGCGPNauofjQ1UneCNdVWbHzSY", 307 | "signer": false, 308 | "source": "transaction", 309 | "writable": true 310 | }, 311 | { 312 | "pubkey": "5WzgFSfQKcboLeMJDXe8ie1iJ6MgkAR3yhtqpZTTFjg3", 313 | "signer": false, 314 | "source": "transaction", 315 | "writable": true 316 | }, 317 | { 318 | "pubkey": "8q4E5h5BYUxaubvwH9u8fprXqGZ4Jfj7VGG3mpqAZZCz", 319 | "signer": false, 320 | "source": "transaction", 321 | "writable": true 322 | }, 323 | { 324 | "pubkey": "6zE53dpDdXwysXPgeFmP83P4s1pMm25jmjLmknuWaayu", 325 | "signer": false, 326 | "source": "transaction", 327 | "writable": true 328 | }, 329 | { 330 | "pubkey": "11111111111111111111111111111111", 331 | "signer": false, 332 | "source": "transaction", 333 | "writable": false 334 | }, 335 | { 336 | "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 337 | "signer": false, 338 | "source": "transaction", 339 | "writable": false 340 | }, 341 | { 342 | "pubkey": "So11111111111111111111111111111111111111112", 343 | "signer": false, 344 | "source": "transaction", 345 | "writable": false 346 | }, 347 | { 348 | "pubkey": "SysvarRent111111111111111111111111111111111", 349 | "signer": false, 350 | "source": "transaction", 351 | "writable": false 352 | }, 353 | { 354 | "pubkey": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", 355 | "signer": false, 356 | "source": "transaction", 357 | "writable": false 358 | }, 359 | { 360 | "pubkey": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 361 | "signer": false, 362 | "source": "transaction", 363 | "writable": false 364 | }, 365 | { 366 | "pubkey": "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX", 367 | "signer": false, 368 | "source": "transaction", 369 | "writable": false 370 | }, 371 | { 372 | "pubkey": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 373 | "signer": false, 374 | "source": "transaction", 375 | "writable": false 376 | }, 377 | { 378 | "pubkey": "ComputeBudget111111111111111111111111111111", 379 | "signer": false, 380 | "source": "transaction", 381 | "writable": false 382 | } 383 | ], 384 | "addressTableLookups": [], 385 | "instructions": [ 386 | { 387 | "parsed": { 388 | "info": { 389 | "base": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU", 390 | "lamports": 2039280, 391 | "newAccount": "GpGzc6Trzp8Chcbh6fYHyMMPd5z5E3uJ76hDD2xq87vs", 392 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 393 | "seed": "5VK44eesshUm5V9UVdQzmvzEL5n9LAMV", 394 | "source": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU", 395 | "space": 165 396 | }, 397 | "type": "createAccountWithSeed" 398 | }, 399 | "program": "system", 400 | "programId": "11111111111111111111111111111111", 401 | "stackHeight": null 402 | }, 403 | { 404 | "parsed": { 405 | "info": { 406 | "account": "GpGzc6Trzp8Chcbh6fYHyMMPd5z5E3uJ76hDD2xq87vs", 407 | "mint": "So11111111111111111111111111111111111111112", 408 | "owner": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU", 409 | "rentSysvar": "SysvarRent111111111111111111111111111111111" 410 | }, 411 | "type": "initializeAccount" 412 | }, 413 | "program": "spl-token", 414 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 415 | "stackHeight": null 416 | }, 417 | { 418 | "accounts": [ 419 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 420 | "43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq", 421 | "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 422 | "2pVgkcG7ribZ72R7mfKmY5ygJTe6L9FpaKCHtyKiV4qT", 423 | "DLGYoCeeLwJcZrrWy4bEgce3osTFGshwTovMME4mppwK", 424 | "GRbSyoXBiiSkcCqE2k8bjPbXC5GH2qH7aKJnZi5GgcNT", 425 | "FJHdVRQanLo8JZvWy4hGZqiNdRLacnGf3U6Y7R2QUt62", 426 | "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX", 427 | "Cux4RjDHhRUYkNLePxrRo97ppg3LopHfg1mE2RF2gPY", 428 | "Gq6Lj6ERw195D8EM8qMvUp9FpPN6qbsJP22vLa2i7JRn", 429 | "CyNm3vXn2ohV9FLS8gM5NcxVb25btBkHawELurtzPL5", 430 | "8NQimqJ5MeaaEYECShkGCGPNauofjQ1UneCNdVWbHzSY", 431 | "5WzgFSfQKcboLeMJDXe8ie1iJ6MgkAR3yhtqpZTTFjg3", 432 | "8q4E5h5BYUxaubvwH9u8fprXqGZ4Jfj7VGG3mpqAZZCz", 433 | "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 434 | "6zE53dpDdXwysXPgeFmP83P4s1pMm25jmjLmknuWaayu", 435 | "GpGzc6Trzp8Chcbh6fYHyMMPd5z5E3uJ76hDD2xq87vs", 436 | "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU" 437 | ], 438 | "data": "63dqdHeigo2AaR97X36swGb", 439 | "programId": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", 440 | "stackHeight": null 441 | }, 442 | { 443 | "parsed": { 444 | "info": { 445 | "account": "GpGzc6Trzp8Chcbh6fYHyMMPd5z5E3uJ76hDD2xq87vs", 446 | "destination": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU", 447 | "owner": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU" 448 | }, 449 | "type": "closeAccount" 450 | }, 451 | "program": "spl-token", 452 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 453 | "stackHeight": null 454 | }, 455 | { 456 | "parsed": { 457 | "info": { 458 | "account": "6zE53dpDdXwysXPgeFmP83P4s1pMm25jmjLmknuWaayu", 459 | "destination": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU", 460 | "owner": "CaShxDq2Vbdp2XryjDdUZthbTzwYsvKuH6Knn9pPi4xU" 461 | }, 462 | "type": "closeAccount" 463 | }, 464 | "program": "spl-token", 465 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 466 | "stackHeight": null 467 | }, 468 | { 469 | "accounts": [], 470 | "data": "3atJtxCCtbsV", 471 | "programId": "ComputeBudget111111111111111111111111111111", 472 | "stackHeight": null 473 | }, 474 | { 475 | "accounts": [], 476 | "data": "JC3gyu", 477 | "programId": "ComputeBudget111111111111111111111111111111", 478 | "stackHeight": null 479 | } 480 | ], 481 | "recentBlockhash": "H7LoZBjQMUoSwJJsaedarUxosSUkP23vzD8zws2uKv3t" 482 | }, 483 | "signatures": [ 484 | "ofdtgS5sKqhEuAZVebXXuqy9v4koYCgiHy9vGj3nkhWYi265pU1vLmMwdhtiBCGQ6exrm5U84yejwG5ScfNoMb9" 485 | ] 486 | }, 487 | "version": 0 488 | } -------------------------------------------------------------------------------- /tests/raydium/parsed-withdraw-txn.json: -------------------------------------------------------------------------------- 1 | { 2 | "blockTime": 1740098218, 3 | "meta": { 4 | "computeUnitsConsumed": 76506, 5 | "err": null, 6 | "fee": 15001, 7 | "innerInstructions": [ 8 | { 9 | "index": 4, 10 | "instructions": [ 11 | { 12 | "parsed": { 13 | "info": { 14 | "amount": "590358717042758", 15 | "authority": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 16 | "destination": "8GQR2bwwgxh3hkaK2bGQm3FUMudB1iyEUVfwPah97Ros", 17 | "source": "GRbSyoXBiiSkcCqE2k8bjPbXC5GH2qH7aKJnZi5GgcNT" 18 | }, 19 | "type": "transfer" 20 | }, 21 | "program": "spl-token", 22 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 23 | "stackHeight": 2 24 | }, 25 | { 26 | "parsed": { 27 | "info": { 28 | "amount": "2457502", 29 | "authority": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 30 | "destination": "4sxEnJJePsxJVPD2vzFJtYf3rc8yc44s8b95V9AK7N7B", 31 | "source": "FJHdVRQanLo8JZvWy4hGZqiNdRLacnGf3U6Y7R2QUt62" 32 | }, 33 | "type": "transfer" 34 | }, 35 | "program": "spl-token", 36 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 37 | "stackHeight": 2 38 | }, 39 | { 40 | "parsed": { 41 | "info": { 42 | "account": "DjVFbeC8e1Tjt7Hsv2GaWWbVWvyEKArkDpzhbPMVV79A", 43 | "amount": "37887331922", 44 | "authority": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 45 | "mint": "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ" 46 | }, 47 | "type": "burn" 48 | }, 49 | "program": "spl-token", 50 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 51 | "stackHeight": 2 52 | } 53 | ] 54 | } 55 | ], 56 | "logMessages": [ 57 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 58 | "Program ComputeBudget111111111111111111111111111111 success", 59 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 60 | "Program ComputeBudget111111111111111111111111111111 success", 61 | "Program 11111111111111111111111111111111 invoke [1]", 62 | "Program 11111111111111111111111111111111 success", 63 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", 64 | "Program log: Instruction: InitializeAccount", 65 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3443 of 599550 compute units", 66 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 67 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [1]", 68 | "Program log: ray_log: AlLOQtIIAAAAAcSuBZMAAACi75JK+QIjAAb3cQIAAAAAAY5JQZMAAAAA4fUFAAAAAAAAAAAAAAAAAAAak/o1DgAAAAAAAAAAAEaQnpntGAIAnn8lAAAAAAA=", 69 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 70 | "Program log: Instruction: Transfer", 71 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 550938 compute units", 72 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 73 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 74 | "Program log: Instruction: Transfer", 75 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4736 of 543312 compute units", 76 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 77 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 78 | "Program log: Instruction: Burn", 79 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4707 of 535618 compute units", 80 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 81 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 69698 of 596107 compute units", 82 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 success", 83 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", 84 | "Program log: Instruction: CloseAccount", 85 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2915 of 526409 compute units", 86 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success" 87 | ], 88 | "postBalances": [ 89 | 1122583495, 90 | 0, 91 | 23357760, 92 | 3591360, 93 | 2039280, 94 | 2039280, 95 | 2039280, 96 | 2039280, 97 | 79594560, 98 | 101978120, 99 | 101978120, 100 | 1, 101 | 1, 102 | 934087680, 103 | 1141440, 104 | 18862172208, 105 | 0, 106 | 6124800, 107 | 16258560, 108 | 1461600, 109 | 2039280, 110 | 40634704, 111 | 1009200, 112 | 1141440, 113 | 989572826826 114 | ], 115 | "postTokenBalances": [ 116 | { 117 | "accountIndex": 4, 118 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 119 | "owner": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 120 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 121 | "uiTokenAmount": { 122 | "amount": "0", 123 | "decimals": 9, 124 | "uiAmount": null, 125 | "uiAmountString": "0" 126 | } 127 | }, 128 | { 129 | "accountIndex": 5, 130 | "mint": "So11111111111111111111111111111111111111112", 131 | "owner": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 132 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 133 | "uiTokenAmount": { 134 | "amount": "0", 135 | "decimals": 9, 136 | "uiAmount": null, 137 | "uiAmountString": "0" 138 | } 139 | }, 140 | { 141 | "accountIndex": 6, 142 | "mint": "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ", 143 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 144 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 145 | "uiTokenAmount": { 146 | "amount": "593568200111", 147 | "decimals": 9, 148 | "uiAmount": 593.568200111, 149 | "uiAmountString": "593.568200111" 150 | } 151 | }, 152 | { 153 | "accountIndex": 7, 154 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 155 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 156 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 157 | "uiTokenAmount": { 158 | "amount": "590358717042758", 159 | "decimals": 9, 160 | "uiAmount": 590358.717042758, 161 | "uiAmountString": "590358.717042758" 162 | } 163 | }, 164 | { 165 | "accountIndex": 20, 166 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 167 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 168 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 169 | "uiTokenAmount": { 170 | "amount": "9271667051526672", 171 | "decimals": 9, 172 | "uiAmount": 9271667.051526671, 173 | "uiAmountString": "9271667.051526672" 174 | } 175 | }, 176 | { 177 | "accountIndex": 21, 178 | "mint": "So11111111111111111111111111111111111111112", 179 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 180 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 181 | "uiTokenAmount": { 182 | "amount": "38595424", 183 | "decimals": 9, 184 | "uiAmount": 0.038595424, 185 | "uiAmountString": "0.038595424" 186 | } 187 | } 188 | ], 189 | "preBalances": [ 190 | 1120140994, 191 | 0, 192 | 23357760, 193 | 3591360, 194 | 2039280, 195 | 2039280, 196 | 2039280, 197 | 2039280, 198 | 79594560, 199 | 101978120, 200 | 101978120, 201 | 1, 202 | 1, 203 | 934087680, 204 | 1141440, 205 | 18862172208, 206 | 0, 207 | 6124800, 208 | 16258560, 209 | 1461600, 210 | 2039280, 211 | 43092206, 212 | 1009200, 213 | 1141440, 214 | 989572826826 215 | ], 216 | "preTokenBalances": [ 217 | { 218 | "accountIndex": 4, 219 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 220 | "owner": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 221 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 222 | "uiTokenAmount": { 223 | "amount": "0", 224 | "decimals": 9, 225 | "uiAmount": null, 226 | "uiAmountString": "0" 227 | } 228 | }, 229 | { 230 | "accountIndex": 5, 231 | "mint": "So11111111111111111111111111111111111111112", 232 | "owner": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 233 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 234 | "uiTokenAmount": { 235 | "amount": "0", 236 | "decimals": 9, 237 | "uiAmount": null, 238 | "uiAmountString": "0" 239 | } 240 | }, 241 | { 242 | "accountIndex": 6, 243 | "mint": "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ", 244 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 245 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 246 | "uiTokenAmount": { 247 | "amount": "631455532033", 248 | "decimals": 9, 249 | "uiAmount": 631.455532033, 250 | "uiAmountString": "631.455532033" 251 | } 252 | }, 253 | { 254 | "accountIndex": 7, 255 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 256 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 257 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 258 | "uiTokenAmount": { 259 | "amount": "0", 260 | "decimals": 9, 261 | "uiAmount": null, 262 | "uiAmountString": "0" 263 | } 264 | }, 265 | { 266 | "accountIndex": 20, 267 | "mint": "9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump", 268 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 269 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 270 | "uiTokenAmount": { 271 | "amount": "9862025768569430", 272 | "decimals": 9, 273 | "uiAmount": 9862025.76856943, 274 | "uiAmountString": "9862025.76856943" 275 | } 276 | }, 277 | { 278 | "accountIndex": 21, 279 | "mint": "So11111111111111111111111111111111111111112", 280 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 281 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 282 | "uiTokenAmount": { 283 | "amount": "41052926", 284 | "decimals": 9, 285 | "uiAmount": 0.041052926, 286 | "uiAmountString": "0.041052926" 287 | } 288 | } 289 | ], 290 | "rewards": [], 291 | "status": { 292 | "Ok": null 293 | } 294 | }, 295 | "slot": 322015925, 296 | "transaction": { 297 | "message": { 298 | "accountKeys": [ 299 | { 300 | "pubkey": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 301 | "signer": true, 302 | "source": "transaction", 303 | "writable": true 304 | }, 305 | { 306 | "pubkey": "4sxEnJJePsxJVPD2vzFJtYf3rc8yc44s8b95V9AK7N7B", 307 | "signer": false, 308 | "source": "transaction", 309 | "writable": true 310 | }, 311 | { 312 | "pubkey": "2pVgkcG7ribZ72R7mfKmY5ygJTe6L9FpaKCHtyKiV4qT", 313 | "signer": false, 314 | "source": "transaction", 315 | "writable": true 316 | }, 317 | { 318 | "pubkey": "Cux4RjDHhRUYkNLePxrRo97ppg3LopHfg1mE2RF2gPY", 319 | "signer": false, 320 | "source": "transaction", 321 | "writable": true 322 | }, 323 | { 324 | "pubkey": "5WzgFSfQKcboLeMJDXe8ie1iJ6MgkAR3yhtqpZTTFjg3", 325 | "signer": false, 326 | "source": "transaction", 327 | "writable": true 328 | }, 329 | { 330 | "pubkey": "8q4E5h5BYUxaubvwH9u8fprXqGZ4Jfj7VGG3mpqAZZCz", 331 | "signer": false, 332 | "source": "transaction", 333 | "writable": true 334 | }, 335 | { 336 | "pubkey": "DjVFbeC8e1Tjt7Hsv2GaWWbVWvyEKArkDpzhbPMVV79A", 337 | "signer": false, 338 | "source": "transaction", 339 | "writable": true 340 | }, 341 | { 342 | "pubkey": "8GQR2bwwgxh3hkaK2bGQm3FUMudB1iyEUVfwPah97Ros", 343 | "signer": false, 344 | "source": "transaction", 345 | "writable": true 346 | }, 347 | { 348 | "pubkey": "8NQimqJ5MeaaEYECShkGCGPNauofjQ1UneCNdVWbHzSY", 349 | "signer": false, 350 | "source": "transaction", 351 | "writable": true 352 | }, 353 | { 354 | "pubkey": "Gq6Lj6ERw195D8EM8qMvUp9FpPN6qbsJP22vLa2i7JRn", 355 | "signer": false, 356 | "source": "transaction", 357 | "writable": true 358 | }, 359 | { 360 | "pubkey": "CyNm3vXn2ohV9FLS8gM5NcxVb25btBkHawELurtzPL5", 361 | "signer": false, 362 | "source": "transaction", 363 | "writable": true 364 | }, 365 | { 366 | "pubkey": "ComputeBudget111111111111111111111111111111", 367 | "signer": false, 368 | "source": "transaction", 369 | "writable": false 370 | }, 371 | { 372 | "pubkey": "11111111111111111111111111111111", 373 | "signer": false, 374 | "source": "transaction", 375 | "writable": false 376 | }, 377 | { 378 | "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 379 | "signer": false, 380 | "source": "transaction", 381 | "writable": false 382 | }, 383 | { 384 | "pubkey": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", 385 | "signer": false, 386 | "source": "transaction", 387 | "writable": false 388 | }, 389 | { 390 | "pubkey": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 391 | "signer": false, 392 | "source": "transaction", 393 | "writable": false 394 | }, 395 | { 396 | "pubkey": "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 397 | "signer": false, 398 | "source": "transaction", 399 | "writable": false 400 | }, 401 | { 402 | "pubkey": "43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq", 403 | "signer": false, 404 | "source": "lookupTable", 405 | "writable": true 406 | }, 407 | { 408 | "pubkey": "DLGYoCeeLwJcZrrWy4bEgce3osTFGshwTovMME4mppwK", 409 | "signer": false, 410 | "source": "lookupTable", 411 | "writable": true 412 | }, 413 | { 414 | "pubkey": "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ", 415 | "signer": false, 416 | "source": "lookupTable", 417 | "writable": true 418 | }, 419 | { 420 | "pubkey": "GRbSyoXBiiSkcCqE2k8bjPbXC5GH2qH7aKJnZi5GgcNT", 421 | "signer": false, 422 | "source": "lookupTable", 423 | "writable": true 424 | }, 425 | { 426 | "pubkey": "FJHdVRQanLo8JZvWy4hGZqiNdRLacnGf3U6Y7R2QUt62", 427 | "signer": false, 428 | "source": "lookupTable", 429 | "writable": true 430 | }, 431 | { 432 | "pubkey": "SysvarRent111111111111111111111111111111111", 433 | "signer": false, 434 | "source": "lookupTable", 435 | "writable": false 436 | }, 437 | { 438 | "pubkey": "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX", 439 | "signer": false, 440 | "source": "lookupTable", 441 | "writable": false 442 | }, 443 | { 444 | "pubkey": "So11111111111111111111111111111111111111112", 445 | "signer": false, 446 | "source": "lookupTable", 447 | "writable": false 448 | } 449 | ], 450 | "addressTableLookups": [ 451 | { 452 | "accountKey": "2immgwYNHBbyVQKVGCEkgWpi53bLwWNRMB5G2nbgYV17", 453 | "readonlyIndexes": [ 454 | 5, 455 | 11 456 | ], 457 | "writableIndexes": [] 458 | }, 459 | { 460 | "accountKey": "7tzMoKvLTwPZfdQvPaU2KMVCb7fqp9LvfrRcrzisvnDL", 461 | "readonlyIndexes": [ 462 | 3 463 | ], 464 | "writableIndexes": [ 465 | 1, 466 | 7, 467 | 6, 468 | 4, 469 | 5 470 | ] 471 | } 472 | ], 473 | "instructions": [ 474 | { 475 | "accounts": [], 476 | "data": "3J1xdJKApyfV", 477 | "programId": "ComputeBudget111111111111111111111111111111", 478 | "stackHeight": null 479 | }, 480 | { 481 | "accounts": [], 482 | "data": "JzwPro", 483 | "programId": "ComputeBudget111111111111111111111111111111", 484 | "stackHeight": null 485 | }, 486 | { 487 | "parsed": { 488 | "info": { 489 | "base": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 490 | "lamports": 2039280, 491 | "newAccount": "4sxEnJJePsxJVPD2vzFJtYf3rc8yc44s8b95V9AK7N7B", 492 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 493 | "seed": "2NPkT4XkfZ14QXgjYpAME1pbtdZiPZsh", 494 | "source": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 495 | "space": 165 496 | }, 497 | "type": "createAccountWithSeed" 498 | }, 499 | "program": "system", 500 | "programId": "11111111111111111111111111111111", 501 | "stackHeight": null 502 | }, 503 | { 504 | "parsed": { 505 | "info": { 506 | "account": "4sxEnJJePsxJVPD2vzFJtYf3rc8yc44s8b95V9AK7N7B", 507 | "mint": "So11111111111111111111111111111111111111112", 508 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 509 | "rentSysvar": "SysvarRent111111111111111111111111111111111" 510 | }, 511 | "type": "initializeAccount" 512 | }, 513 | "program": "spl-token", 514 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 515 | "stackHeight": null 516 | }, 517 | { 518 | "accounts": [ 519 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 520 | "43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq", 521 | "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 522 | "2pVgkcG7ribZ72R7mfKmY5ygJTe6L9FpaKCHtyKiV4qT", 523 | "DLGYoCeeLwJcZrrWy4bEgce3osTFGshwTovMME4mppwK", 524 | "7aRh7s688sJ1nJq1HKYwnKrnXNBi43PAsmFYfGg1b1CJ", 525 | "GRbSyoXBiiSkcCqE2k8bjPbXC5GH2qH7aKJnZi5GgcNT", 526 | "FJHdVRQanLo8JZvWy4hGZqiNdRLacnGf3U6Y7R2QUt62", 527 | "43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq", 528 | "43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq", 529 | "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX", 530 | "Cux4RjDHhRUYkNLePxrRo97ppg3LopHfg1mE2RF2gPY", 531 | "5WzgFSfQKcboLeMJDXe8ie1iJ6MgkAR3yhtqpZTTFjg3", 532 | "8q4E5h5BYUxaubvwH9u8fprXqGZ4Jfj7VGG3mpqAZZCz", 533 | "F3gPt3bz3s1LF9soDdQVVNfbWryNcivbjxiZBbBFAGBC", 534 | "DjVFbeC8e1Tjt7Hsv2GaWWbVWvyEKArkDpzhbPMVV79A", 535 | "8GQR2bwwgxh3hkaK2bGQm3FUMudB1iyEUVfwPah97Ros", 536 | "4sxEnJJePsxJVPD2vzFJtYf3rc8yc44s8b95V9AK7N7B", 537 | "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 538 | "8NQimqJ5MeaaEYECShkGCGPNauofjQ1UneCNdVWbHzSY", 539 | "Gq6Lj6ERw195D8EM8qMvUp9FpPN6qbsJP22vLa2i7JRn", 540 | "CyNm3vXn2ohV9FLS8gM5NcxVb25btBkHawELurtzPL5" 541 | ], 542 | "data": "2juFSS1TmUkYkfbWetqoyLkV9X7qB9gQJK", 543 | "programId": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", 544 | "stackHeight": null 545 | }, 546 | { 547 | "parsed": { 548 | "info": { 549 | "account": "4sxEnJJePsxJVPD2vzFJtYf3rc8yc44s8b95V9AK7N7B", 550 | "destination": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6", 551 | "owner": "5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6" 552 | }, 553 | "type": "closeAccount" 554 | }, 555 | "program": "spl-token", 556 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 557 | "stackHeight": null 558 | } 559 | ], 560 | "recentBlockhash": "26euZsDLzDB4jvRAucTqMGJ71FmPRZ34ZYz4VhRJj3CG" 561 | }, 562 | "signatures": [ 563 | "66cbwhMBm9NiubNzLGxKveFj2TuMg91x8xUtKHm7RQPiGsbeXfUBUi25Erq5QM17A8BnPvkA2Dz4hQuNnt5HWeC8" 564 | ] 565 | }, 566 | "version": 0 567 | } -------------------------------------------------------------------------------- /tests/raydium/swap-edge-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "blockTime": 1740305339, 3 | "meta": { 4 | "computeUnitsConsumed": 48091, 5 | "err": null, 6 | "fee": 8005000, 7 | "innerInstructions": [ 8 | { 9 | "index": 4, 10 | "instructions": [ 11 | { 12 | "parsed": { 13 | "info": { 14 | "amount": "4030305731740", 15 | "authority": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9", 16 | "destination": "7sEa6gpnpszBDoyGotzEdTEzUeDdhZmRuG58uYeug44J", 17 | "source": "D3CSsMELZJ2Zv1TstF2L8A5YHDj4mUC3oKTHQqBEWGEk" 18 | }, 19 | "type": "transfer" 20 | }, 21 | "program": "spl-token", 22 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 23 | "stackHeight": 2 24 | }, 25 | { 26 | "parsed": { 27 | "info": { 28 | "amount": "109811565", 29 | "authority": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 30 | "destination": "4FQFH5mus7ajUuQpKyfVnvXjt3kfxjiXi1yGCWk8xKGL", 31 | "source": "7VzLs2TuuCtKbFrmawR2JvjjSkNVBm1wWg69BK9bGHk" 32 | }, 33 | "type": "transfer" 34 | }, 35 | "program": "spl-token", 36 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 37 | "stackHeight": 2 38 | } 39 | ] 40 | }, 41 | { 42 | "index": 5, 43 | "instructions": [ 44 | { 45 | "parsed": { 46 | "info": { 47 | "account": "4FQFH5mus7ajUuQpKyfVnvXjt3kfxjiXi1yGCWk8xKGL", 48 | "destination": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9", 49 | "owner": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9" 50 | }, 51 | "type": "closeAccount" 52 | }, 53 | "program": "spl-token", 54 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 55 | "stackHeight": 2 56 | }, 57 | { 58 | "parsed": { 59 | "info": { 60 | "destination": "AVUCZyuT35YSuj4RH7fwiyPu82Djn2Hfg7y2ND2XcnZH", 61 | "lamports": 1098115, 62 | "source": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9" 63 | }, 64 | "type": "transfer" 65 | }, 66 | "program": "system", 67 | "programId": "11111111111111111111111111111111", 68 | "stackHeight": 2 69 | } 70 | ] 71 | } 72 | ], 73 | "logMessages": [ 74 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 75 | "Program ComputeBudget111111111111111111111111111111 success", 76 | "Program ComputeBudget111111111111111111111111111111 invoke [1]", 77 | "Program ComputeBudget111111111111111111111111111111 success", 78 | "Program 11111111111111111111111111111111 invoke [1]", 79 | "Program 11111111111111111111111111111111 success", 80 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", 81 | "Program log: Instruction: InitializeAccount", 82 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3443 of 149550 compute units", 83 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 84 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [1]", 85 | "Program log: ray_log: A5wE8WCqAwAAqzaDBgAAAAABAAAAAAAAAJwE8WCqAwAAmtUFMwUAAAD1/C364+MCAG2XiwYAAAAA", 86 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 87 | "Program log: Instruction: Transfer", 88 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 127180 compute units", 89 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 90 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 91 | "Program log: Instruction: Transfer", 92 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4736 of 119554 compute units", 93 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 94 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 32366 of 146107 compute units", 95 | "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 success", 96 | "Program BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW invoke [1]", 97 | "Program log: Instruction: CollectFee", 98 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", 99 | "Program log: Instruction: CloseAccount", 100 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2915 of 107675 compute units", 101 | "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success", 102 | "Program 11111111111111111111111111111111 invoke [2]", 103 | "Program 11111111111111111111111111111111 success", 104 | "Program BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW consumed 11682 of 113741 compute units", 105 | "Program BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW success", 106 | "Program 11111111111111111111111111111111 invoke [1]", 107 | "Program 11111111111111111111111111111111 success" 108 | ], 109 | "postBalances": [ 110 | 19979467568, 111 | 0, 112 | 6124800, 113 | 23357760, 114 | 16258560, 115 | 22223084573, 116 | 2039280, 117 | 3591360, 118 | 101977920, 119 | 101977920, 120 | 79594560, 121 | 2039280, 122 | 2039280, 123 | 2039280, 124 | 58468310844, 125 | 1, 126 | 1, 127 | 934087680, 128 | 1141440, 129 | 0, 130 | 1398960, 131 | 412235087072, 132 | 989976195711, 133 | 1009200, 134 | 20387231145, 135 | 1141440 136 | ], 137 | "postTokenBalances": [ 138 | { 139 | "accountIndex": 5, 140 | "mint": "So11111111111111111111111111111111111111112", 141 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 142 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 143 | "uiTokenAmount": { 144 | "amount": "22221045293", 145 | "decimals": 9, 146 | "uiAmount": 22.221045293, 147 | "uiAmountString": "22.221045293" 148 | } 149 | }, 150 | { 151 | "accountIndex": 6, 152 | "mint": "4qu5jPY7dDkmtB6Q4iECFyWjaESTfwiAK86g99yPpump", 153 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 154 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 155 | "uiTokenAmount": { 156 | "amount": "817548553552273", 157 | "decimals": 6, 158 | "uiAmount": 817548553.552273, 159 | "uiAmountString": "817548553.552273" 160 | } 161 | }, 162 | { 163 | "accountIndex": 11, 164 | "mint": "So11111111111111111111111111111111111111112", 165 | "owner": "YCydyzGpsuBKVzNNLqNW3eavZgTV29hpfL3BnZCLfdC", 166 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 167 | "uiTokenAmount": { 168 | "amount": "0", 169 | "decimals": 9, 170 | "uiAmount": null, 171 | "uiAmountString": "0" 172 | } 173 | }, 174 | { 175 | "accountIndex": 12, 176 | "mint": "4qu5jPY7dDkmtB6Q4iECFyWjaESTfwiAK86g99yPpump", 177 | "owner": "YCydyzGpsuBKVzNNLqNW3eavZgTV29hpfL3BnZCLfdC", 178 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 179 | "uiTokenAmount": { 180 | "amount": "0", 181 | "decimals": 6, 182 | "uiAmount": null, 183 | "uiAmountString": "0" 184 | } 185 | }, 186 | { 187 | "accountIndex": 13, 188 | "mint": "4qu5jPY7dDkmtB6Q4iECFyWjaESTfwiAK86g99yPpump", 189 | "owner": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9", 190 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 191 | "uiTokenAmount": { 192 | "amount": "0", 193 | "decimals": 6, 194 | "uiAmount": null, 195 | "uiAmountString": "0" 196 | } 197 | } 198 | ], 199 | "preBalances": [ 200 | 19890759118, 201 | 0, 202 | 6124800, 203 | 23357760, 204 | 16258560, 205 | 22332896138, 206 | 2039280, 207 | 3591360, 208 | 101977920, 209 | 101977920, 210 | 79594560, 211 | 2039280, 212 | 2039280, 213 | 2039280, 214 | 58456310844, 215 | 1, 216 | 1, 217 | 934087680, 218 | 1141440, 219 | 0, 220 | 1398960, 221 | 412233988957, 222 | 989976195711, 223 | 1009200, 224 | 20387231145, 225 | 1141440 226 | ], 227 | "preTokenBalances": [ 228 | { 229 | "accountIndex": 5, 230 | "mint": "So11111111111111111111111111111111111111112", 231 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 232 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 233 | "uiTokenAmount": { 234 | "amount": "22330856858", 235 | "decimals": 9, 236 | "uiAmount": 22.330856858, 237 | "uiAmountString": "22.330856858" 238 | } 239 | }, 240 | { 241 | "accountIndex": 6, 242 | "mint": "4qu5jPY7dDkmtB6Q4iECFyWjaESTfwiAK86g99yPpump", 243 | "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 244 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 245 | "uiTokenAmount": { 246 | "amount": "813518247820533", 247 | "decimals": 6, 248 | "uiAmount": 813518247.820533, 249 | "uiAmountString": "813518247.820533" 250 | } 251 | }, 252 | { 253 | "accountIndex": 11, 254 | "mint": "So11111111111111111111111111111111111111112", 255 | "owner": "YCydyzGpsuBKVzNNLqNW3eavZgTV29hpfL3BnZCLfdC", 256 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 257 | "uiTokenAmount": { 258 | "amount": "0", 259 | "decimals": 9, 260 | "uiAmount": null, 261 | "uiAmountString": "0" 262 | } 263 | }, 264 | { 265 | "accountIndex": 12, 266 | "mint": "4qu5jPY7dDkmtB6Q4iECFyWjaESTfwiAK86g99yPpump", 267 | "owner": "YCydyzGpsuBKVzNNLqNW3eavZgTV29hpfL3BnZCLfdC", 268 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 269 | "uiTokenAmount": { 270 | "amount": "0", 271 | "decimals": 6, 272 | "uiAmount": null, 273 | "uiAmountString": "0" 274 | } 275 | }, 276 | { 277 | "accountIndex": 13, 278 | "mint": "4qu5jPY7dDkmtB6Q4iECFyWjaESTfwiAK86g99yPpump", 279 | "owner": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9", 280 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 281 | "uiTokenAmount": { 282 | "amount": "4030305731740", 283 | "decimals": 6, 284 | "uiAmount": 4030305.73174, 285 | "uiAmountString": "4030305.73174" 286 | } 287 | } 288 | ], 289 | "rewards": [], 290 | "status": { 291 | "Ok": null 292 | } 293 | }, 294 | "slot": 322539359, 295 | "transaction": { 296 | "message": { 297 | "accountKeys": [ 298 | { 299 | "pubkey": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9", 300 | "signer": true, 301 | "source": "transaction", 302 | "writable": true 303 | }, 304 | { 305 | "pubkey": "4FQFH5mus7ajUuQpKyfVnvXjt3kfxjiXi1yGCWk8xKGL", 306 | "signer": false, 307 | "source": "transaction", 308 | "writable": true 309 | }, 310 | { 311 | "pubkey": "FeMTcuyjT3KWd1f1f5n5MaXnUZRSwchtwtwV6R7XPk86", 312 | "signer": false, 313 | "source": "transaction", 314 | "writable": true 315 | }, 316 | { 317 | "pubkey": "CRbK5dv3hX4t3VEh3fWBxJt8L786CNpesQp3y5KyyTnV", 318 | "signer": false, 319 | "source": "transaction", 320 | "writable": true 321 | }, 322 | { 323 | "pubkey": "AQWoAkhPyBRMmsGPjrsABdpQf1MhFL57KbsKgfi7VnHM", 324 | "signer": false, 325 | "source": "transaction", 326 | "writable": true 327 | }, 328 | { 329 | "pubkey": "7VzLs2TuuCtKbFrmawR2JvjjSkNVBm1wWg69BK9bGHk", 330 | "signer": false, 331 | "source": "transaction", 332 | "writable": true 333 | }, 334 | { 335 | "pubkey": "7sEa6gpnpszBDoyGotzEdTEzUeDdhZmRuG58uYeug44J", 336 | "signer": false, 337 | "source": "transaction", 338 | "writable": true 339 | }, 340 | { 341 | "pubkey": "FQZ15Yd5o5k9SFGou8syYYwxd95pADj7R3G1ZfsK1oZJ", 342 | "signer": false, 343 | "source": "transaction", 344 | "writable": true 345 | }, 346 | { 347 | "pubkey": "DjU4HepMi827FkzCEdCdmFg97BzaqqhpEH2m5mXjMevD", 348 | "signer": false, 349 | "source": "transaction", 350 | "writable": true 351 | }, 352 | { 353 | "pubkey": "UVonXjFiv7UifCAzYxDC3a6Pfj7GH2JhCCemtNQgQio", 354 | "signer": false, 355 | "source": "transaction", 356 | "writable": true 357 | }, 358 | { 359 | "pubkey": "5EBc5PbvXrUjw8LXpGbDVaQKKswFshNMJCVDBERbQuqW", 360 | "signer": false, 361 | "source": "transaction", 362 | "writable": true 363 | }, 364 | { 365 | "pubkey": "JDxEQXb58732h4HYHTfBX5ZFwo7DNL1itTiAsJRvURr4", 366 | "signer": false, 367 | "source": "transaction", 368 | "writable": true 369 | }, 370 | { 371 | "pubkey": "9NwApTdzw3V8fgteiXLX5YthjvaA7khqTX4Wkk4K16Jr", 372 | "signer": false, 373 | "source": "transaction", 374 | "writable": true 375 | }, 376 | { 377 | "pubkey": "D3CSsMELZJ2Zv1TstF2L8A5YHDj4mUC3oKTHQqBEWGEk", 378 | "signer": false, 379 | "source": "transaction", 380 | "writable": true 381 | }, 382 | { 383 | "pubkey": "7ks326H4LbMVaUC8nW5FpC5EoAf5eK5pf4Dsx4HDQLpq", 384 | "signer": false, 385 | "source": "transaction", 386 | "writable": true 387 | }, 388 | { 389 | "pubkey": "ComputeBudget111111111111111111111111111111", 390 | "signer": false, 391 | "source": "transaction", 392 | "writable": false 393 | }, 394 | { 395 | "pubkey": "11111111111111111111111111111111", 396 | "signer": false, 397 | "source": "transaction", 398 | "writable": false 399 | }, 400 | { 401 | "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 402 | "signer": false, 403 | "source": "transaction", 404 | "writable": false 405 | }, 406 | { 407 | "pubkey": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", 408 | "signer": false, 409 | "source": "transaction", 410 | "writable": false 411 | }, 412 | { 413 | "pubkey": "YCydyzGpsuBKVzNNLqNW3eavZgTV29hpfL3BnZCLfdC", 414 | "signer": false, 415 | "source": "transaction", 416 | "writable": false 417 | }, 418 | { 419 | "pubkey": "BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW", 420 | "signer": false, 421 | "source": "transaction", 422 | "writable": false 423 | }, 424 | { 425 | "pubkey": "AVUCZyuT35YSuj4RH7fwiyPu82Djn2Hfg7y2ND2XcnZH", 426 | "signer": false, 427 | "source": "lookupTable", 428 | "writable": true 429 | }, 430 | { 431 | "pubkey": "So11111111111111111111111111111111111111112", 432 | "signer": false, 433 | "source": "lookupTable", 434 | "writable": false 435 | }, 436 | { 437 | "pubkey": "SysvarRent111111111111111111111111111111111", 438 | "signer": false, 439 | "source": "lookupTable", 440 | "writable": false 441 | }, 442 | { 443 | "pubkey": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 444 | "signer": false, 445 | "source": "lookupTable", 446 | "writable": false 447 | }, 448 | { 449 | "pubkey": "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX", 450 | "signer": false, 451 | "source": "lookupTable", 452 | "writable": false 453 | } 454 | ], 455 | "addressTableLookups": [ 456 | { 457 | "accountKey": "4QHABYqrbhcj3EtknQ3dYewAmjuqU9Pstuo7kcCcz3FM", 458 | "readonlyIndexes": [ 459 | 0, 460 | 12, 461 | 7, 462 | 6 463 | ], 464 | "writableIndexes": [ 465 | 4 466 | ] 467 | } 468 | ], 469 | "instructions": [ 470 | { 471 | "accounts": [], 472 | "data": "LEJDE7", 473 | "programId": "ComputeBudget111111111111111111111111111111", 474 | "stackHeight": null 475 | }, 476 | { 477 | "accounts": [], 478 | "data": "3Towjo2HBAqm", 479 | "programId": "ComputeBudget111111111111111111111111111111", 480 | "stackHeight": null 481 | }, 482 | { 483 | "parsed": { 484 | "info": { 485 | "base": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9", 486 | "lamports": 2039280, 487 | "newAccount": "4FQFH5mus7ajUuQpKyfVnvXjt3kfxjiXi1yGCWk8xKGL", 488 | "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 489 | "seed": "Ahs3w6M94GnZ8axmMvq8ZPDAN7hifcdi", 490 | "source": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9", 491 | "space": 165 492 | }, 493 | "type": "createAccountWithSeed" 494 | }, 495 | "program": "system", 496 | "programId": "11111111111111111111111111111111", 497 | "stackHeight": null 498 | }, 499 | { 500 | "parsed": { 501 | "info": { 502 | "account": "4FQFH5mus7ajUuQpKyfVnvXjt3kfxjiXi1yGCWk8xKGL", 503 | "mint": "So11111111111111111111111111111111111111112", 504 | "owner": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9", 505 | "rentSysvar": "SysvarRent111111111111111111111111111111111" 506 | }, 507 | "type": "initializeAccount" 508 | }, 509 | "program": "spl-token", 510 | "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 511 | "stackHeight": null 512 | }, 513 | { 514 | "accounts": [ 515 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 516 | "FeMTcuyjT3KWd1f1f5n5MaXnUZRSwchtwtwV6R7XPk86", 517 | "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", 518 | "CRbK5dv3hX4t3VEh3fWBxJt8L786CNpesQp3y5KyyTnV", 519 | "AQWoAkhPyBRMmsGPjrsABdpQf1MhFL57KbsKgfi7VnHM", 520 | "7VzLs2TuuCtKbFrmawR2JvjjSkNVBm1wWg69BK9bGHk", 521 | "7sEa6gpnpszBDoyGotzEdTEzUeDdhZmRuG58uYeug44J", 522 | "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX", 523 | "FQZ15Yd5o5k9SFGou8syYYwxd95pADj7R3G1ZfsK1oZJ", 524 | "DjU4HepMi827FkzCEdCdmFg97BzaqqhpEH2m5mXjMevD", 525 | "UVonXjFiv7UifCAzYxDC3a6Pfj7GH2JhCCemtNQgQio", 526 | "5EBc5PbvXrUjw8LXpGbDVaQKKswFshNMJCVDBERbQuqW", 527 | "JDxEQXb58732h4HYHTfBX5ZFwo7DNL1itTiAsJRvURr4", 528 | "9NwApTdzw3V8fgteiXLX5YthjvaA7khqTX4Wkk4K16Jr", 529 | "YCydyzGpsuBKVzNNLqNW3eavZgTV29hpfL3BnZCLfdC", 530 | "D3CSsMELZJ2Zv1TstF2L8A5YHDj4mUC3oKTHQqBEWGEk", 531 | "4FQFH5mus7ajUuQpKyfVnvXjt3kfxjiXi1yGCWk8xKGL", 532 | "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9" 533 | ], 534 | "data": "6Emsdekdt7ogyt6SVaCkLbR", 535 | "programId": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", 536 | "stackHeight": null 537 | }, 538 | { 539 | "accounts": [ 540 | "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9", 541 | "4FQFH5mus7ajUuQpKyfVnvXjt3kfxjiXi1yGCWk8xKGL", 542 | "AVUCZyuT35YSuj4RH7fwiyPu82Djn2Hfg7y2ND2XcnZH", 543 | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", 544 | "11111111111111111111111111111111" 545 | ], 546 | "data": "RR93MXKVQPnV6LLt1kzc5Wmhd9EZUkY6iU", 547 | "programId": "BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW", 548 | "stackHeight": null 549 | }, 550 | { 551 | "parsed": { 552 | "info": { 553 | "destination": "7ks326H4LbMVaUC8nW5FpC5EoAf5eK5pf4Dsx4HDQLpq", 554 | "lamports": 12000000, 555 | "source": "G7rwfu2c5JNHqkJSne6Hyu6ztrJK6PCHctmXAZxACNe9" 556 | }, 557 | "type": "transfer" 558 | }, 559 | "program": "system", 560 | "programId": "11111111111111111111111111111111", 561 | "stackHeight": null 562 | } 563 | ], 564 | "recentBlockhash": "AbeQzVz4qQgaFJHVRv7Ed7Y5j5Bz9TdnYBqCWe6GdZoS" 565 | }, 566 | "signatures": [ 567 | "uv3TobUcLYkgod7if4StahXEftSmj8N6Un269Z6gvxjmo1q8sCzEihAyYczuRqpiMvhPY1hr2WNmnrePdzyQ8rs" 568 | ] 569 | }, 570 | "version": 0 571 | } -------------------------------------------------------------------------------- /tests/raydium/tests.spec.ts: -------------------------------------------------------------------------------- 1 | import { clusterApiUrl, Connection, ParsedTransactionWithMeta } from '@solana/web3.js'; 2 | import fs from 'fs'; 3 | import { RaydiumV4Parser } from '../../src/parser/raydium'; 4 | import { 5 | AddLiquidityInfo, 6 | CreatePoolInfo, 7 | RemoveLiquidityInfo, 8 | SwapInfo, 9 | } from '../../src/parser/raydium/v4/types'; 10 | 11 | describe('Raydium Parser', () => { 12 | const swapBaseInTransaction = JSON.parse( 13 | fs.readFileSync('tests/raydium/parsed-swap-txn.json', 'utf-8') 14 | ) as unknown as ParsedTransactionWithMeta; 15 | const swapBaseOutTransaction = JSON.parse( 16 | fs.readFileSync('tests/raydium/parsed-swap-base-out-txn.json', 'utf-8') 17 | ) as unknown as ParsedTransactionWithMeta; 18 | const createPoolTransaction = JSON.parse( 19 | fs.readFileSync('tests/raydium/parsed-init-txn.json', 'utf-8') 20 | ) as unknown as ParsedTransactionWithMeta; 21 | const addLiquidityTransaction = JSON.parse( 22 | fs.readFileSync('tests/raydium/parsed-deposit-txn.json', 'utf-8') 23 | ) as unknown as ParsedTransactionWithMeta; 24 | const removeLiquidityTransaction = JSON.parse( 25 | fs.readFileSync('tests/raydium/parsed-withdraw-txn.json', 'utf-8') 26 | ) as unknown as ParsedTransactionWithMeta; 27 | const connection = new Connection(clusterApiUrl("mainnet-beta")); 28 | const parser = new RaydiumV4Parser(connection, { maxPoolCache: 100 }); 29 | 30 | test('parse should correctly identify swap action [base in]', async () => { 31 | const result = await parser.parse(swapBaseInTransaction); 32 | expect(result?.platform).toEqual('raydiumv4'); 33 | expect(result?.actions.length).toEqual(5); 34 | for (const action of result?.actions || []) { 35 | expect(action.type).toEqual('swap'); 36 | expect(action.info.poolId.toString()).toEqual( 37 | 'ZFBZunJyh7HZWJrrUUazZiVegN8SXXBrHYVYMEeWG4T' 38 | ); 39 | expect((action.info as SwapInfo).tokenIn.toString()).toEqual( 40 | 'So11111111111111111111111111111111111111112' 41 | ); 42 | expect((action.info as SwapInfo).tokenOut.toString()).toEqual( 43 | 'GPrF7LXiQAY8Y9Fci7et2C7a9JsrCBDRvEAKLCjLpump' 44 | ); 45 | expect((action.info as SwapInfo).tokenInDecimal).toEqual(BigInt(9)); 46 | expect((action.info as SwapInfo).tokenOutDecimal).toEqual(BigInt(6)); 47 | } 48 | }); 49 | 50 | test('parse should correctly identify swap action [base out]', async () => { 51 | const result = await parser.parse(swapBaseOutTransaction); 52 | expect(result?.platform).toEqual('raydiumv4'); 53 | expect(result?.actions.length).toEqual(1); 54 | for (const action of result?.actions || []) { 55 | expect(action.type).toEqual('swap'); 56 | expect(action.info.poolId.toString()).toEqual( 57 | '43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq' 58 | ); 59 | expect((action.info as SwapInfo).tokenIn.toString()).toEqual( 60 | '9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump' 61 | ); 62 | expect((action.info as SwapInfo).tokenOut.toString()).toEqual( 63 | 'So11111111111111111111111111111111111111112' 64 | ); 65 | expect((action.info as SwapInfo).tokenInDecimal).toEqual(BigInt(9)); 66 | expect((action.info as SwapInfo).tokenOutDecimal).toEqual(BigInt(9)); 67 | } 68 | }); 69 | 70 | test('parse create pool info', async () => { 71 | const result = await parser.parse(createPoolTransaction); 72 | expect(result?.platform).toEqual('raydiumv4'); 73 | expect(result?.actions.length).toEqual(1); 74 | for (const action of result?.actions || []) { 75 | expect(action.type).toEqual('create'); 76 | expect(action.info.poolId.toString()).toEqual( 77 | '43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq' 78 | ); 79 | expect((action.info as CreatePoolInfo).baseMint.toString()).toEqual( 80 | '9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump' 81 | ); 82 | expect((action.info as CreatePoolInfo).quoteMint.toString()).toEqual( 83 | 'So11111111111111111111111111111111111111112' 84 | ); 85 | expect((action.info as CreatePoolInfo).baseDecimals).toEqual(9); 86 | expect((action.info as CreatePoolInfo).quoteDecimals).toEqual(9); 87 | expect((action.info as CreatePoolInfo).baseAmountIn).toEqual( 88 | BigInt('4000000000000000') 89 | ); 90 | expect((action.info as CreatePoolInfo).quoteAmountIn).toEqual(BigInt('100000000')); 91 | expect((action.info as CreatePoolInfo).marketId.toString()).toEqual( 92 | 'Cux4RjDHhRUYkNLePxrRo97ppg3LopHfg1mE2RF2gPY' 93 | ); 94 | expect((action.info as CreatePoolInfo).user.toString()).toEqual( 95 | '5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6' 96 | ); 97 | } 98 | }); 99 | 100 | test('parse add liquidity action', async () => { 101 | const result = await parser.parse(addLiquidityTransaction); 102 | expect(result?.platform).toEqual('raydiumv4'); 103 | expect(result?.actions.length).toEqual(1); 104 | for (const action of result?.actions || []) { 105 | expect(action.type).toEqual('add'); 106 | expect(action.info.poolId.toString()).toEqual( 107 | '43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq' 108 | ); 109 | expect((action.info as AddLiquidityInfo).baseMint.toString()).toEqual( 110 | '9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump' 111 | ); 112 | expect((action.info as AddLiquidityInfo).quoteMint.toString()).toEqual( 113 | 'So11111111111111111111111111111111111111112' 114 | ); 115 | expect((action.info as AddLiquidityInfo).baseDecimal).toEqual(BigInt(9)); 116 | expect((action.info as AddLiquidityInfo).quoteDecimal).toEqual(BigInt(9)); 117 | expect((action.info as AddLiquidityInfo).baseAmountIn).toEqual( 118 | BigInt('214323699689057') 119 | ); 120 | expect((action.info as AddLiquidityInfo).quoteAmountIn).toEqual(BigInt('1000000')); 121 | expect((action.info as AddLiquidityInfo).mintedLpAmount).toEqual(BigInt('14561191343')); 122 | expect((action.info as AddLiquidityInfo).user.toString()).toEqual( 123 | '5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6' 124 | ); 125 | } 126 | }); 127 | 128 | test('parse remove liquidity action', async () => { 129 | const result = await parser.parse(removeLiquidityTransaction); 130 | expect(result?.platform).toEqual('raydiumv4'); 131 | expect(result?.actions.length).toEqual(1); 132 | for (const action of result?.actions || []) { 133 | expect(action.type).toEqual('remove'); 134 | expect(action.info.poolId.toString()).toEqual( 135 | '43QDFSth4Fu2JFVKto13zASQu8Dc7RL6wkUqksgeYvqq' 136 | ); 137 | expect((action.info as RemoveLiquidityInfo).baseMint.toString()).toEqual( 138 | '9Zw3CR7NPD6hXNk5PZYpYKsvWv9puwr1eEaPxXRapump' 139 | ); 140 | expect((action.info as RemoveLiquidityInfo).quoteMint.toString()).toEqual( 141 | 'So11111111111111111111111111111111111111112' 142 | ); 143 | expect((action.info as RemoveLiquidityInfo).baseDecimal).toEqual(BigInt(9)); 144 | expect((action.info as RemoveLiquidityInfo).quoteDecimal).toEqual(BigInt(9)); 145 | expect((action.info as RemoveLiquidityInfo).baseAmountOut).toEqual( 146 | BigInt('590358717042758') 147 | ); 148 | expect((action.info as RemoveLiquidityInfo).quoteAmountOut).toEqual(BigInt('2457502')); 149 | expect((action.info as RemoveLiquidityInfo).lpAmountOut).toEqual(BigInt('37887331922')); 150 | expect((action.info as RemoveLiquidityInfo).user.toString()).toEqual( 151 | '5z4giZ7YjS7LMGYfPjCUA8qUUxNSFm3Ru3xGtKCziqb6' 152 | ); 153 | } 154 | }); 155 | 156 | test('parseMultiple should parse multiple transactions', async () => { 157 | const result = await parser.parseMultiple([ 158 | swapBaseInTransaction, 159 | swapBaseOutTransaction, 160 | createPoolTransaction, 161 | addLiquidityTransaction, 162 | removeLiquidityTransaction, 163 | ]); 164 | expect(result?.length).toEqual(5); 165 | }); 166 | 167 | test('Edge cases tests', async () => { 168 | const txn1 = JSON.parse( 169 | fs.readFileSync('tests/raydium/swap-edge-1.json', 'utf-8') 170 | ) as unknown as ParsedTransactionWithMeta; 171 | const txn2 = JSON.parse( 172 | fs.readFileSync('tests/raydium/swap-edge-2.json', 'utf-8') 173 | ) as unknown as ParsedTransactionWithMeta; 174 | const parsed = await parser.parseMultiple([txn1!, txn2!]) 175 | 176 | // checks for the first 177 | expect((parsed || [])[0].platform).toEqual('raydiumv4'); 178 | expect((parsed || [])[0].actions.length).toEqual(1); 179 | for (const action of (parsed || [])[0].actions || []) { 180 | expect(action.type).toEqual('swap'); 181 | expect(action.info.poolId.toString()).toEqual( 182 | 'FeMTcuyjT3KWd1f1f5n5MaXnUZRSwchtwtwV6R7XPk86' 183 | ); 184 | expect((action.info as SwapInfo).tokenIn.toString()).toEqual( 185 | '4qu5jPY7dDkmtB6Q4iECFyWjaESTfwiAK86g99yPpump' 186 | ); 187 | expect((action.info as SwapInfo).tokenOut.toString()).toEqual( 188 | 'So11111111111111111111111111111111111111112' 189 | ); 190 | expect((action.info as SwapInfo).tokenInDecimal).toEqual(BigInt(6)); 191 | expect((action.info as SwapInfo).tokenOutDecimal).toEqual(BigInt(9)); 192 | } 193 | 194 | // checks for the second 195 | expect((parsed || [])[1].platform).toEqual('raydiumv4'); 196 | expect((parsed || [])[1].actions.length).toEqual(1); 197 | for (const action of (parsed || [])[1].actions || []) { 198 | expect(action.type).toEqual('swap'); 199 | expect(action.info.poolId.toString()).toEqual( 200 | 'FeMTcuyjT3KWd1f1f5n5MaXnUZRSwchtwtwV6R7XPk86' 201 | ); 202 | expect((action.info as SwapInfo).tokenIn.toString()).toEqual( 203 | 'So11111111111111111111111111111111111111112' 204 | ); 205 | expect((action.info as SwapInfo).tokenOut.toString()).toEqual( 206 | '4qu5jPY7dDkmtB6Q4iECFyWjaESTfwiAK86g99yPpump' 207 | ); 208 | expect((action.info as SwapInfo).tokenInDecimal).toEqual(BigInt(9)); 209 | expect((action.info as SwapInfo).tokenOutDecimal).toEqual(BigInt(6)); 210 | } 211 | }); 212 | }); 213 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "NodeNext", 5 | "lib": ["ES2020"], 6 | "declaration": true, 7 | "declarationMap": true, 8 | "sourceMap": true, 9 | "outDir": "./dist", 10 | "rootDir": "./src", 11 | "esModuleInterop": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "strict": true, 14 | "skipLibCheck": true, 15 | "moduleResolution": "nodenext", 16 | "resolveJsonModule": true, 17 | "composite": true, 18 | "declarationDir": "./dist/types" 19 | }, 20 | "include": ["src/**/*"], 21 | "exclude": ["node_modules", "tests", "dist", "idl"] 22 | } 23 | --------------------------------------------------------------------------------