Skip to content

Commit 02c4d29

Browse files
committed
updated readme
1 parent 4b30080 commit 02c4d29

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ An open-source transaction parser for popular DeFi applications on the Solana bl
55
## 💪🏽 Supported DeFi Platforms
66

77
- PumpFun ✅
8-
- Raydium 🔜
8+
- RaydiumV4 ✅
99
- Jupiter 🔜
1010

1111
## 👨‍🔧 Installation
12-
1312
```bash
1413
npm install git+https://github.com/Tee-py/solana-txn-parser.git
1514
```
@@ -98,7 +97,33 @@ type CompleteInfo = {
9897
> NB: The `CompleteInfo` event might return unexpected results due to issues with parsing variable length string fields (`name`, `symbol`, `uri`).
9998
10099

101-
### 🔄 Raydium Parser [Comming soon]
100+
### 🧑🏼‍🚀 RaydiumV4 Parser
101+
```typescript
102+
import { RaydiumV4Parser } from 'sol-parser/src';
103+
import { Connection, PublicKey, clusterApiUrl, ParsedTransactionWithMeta } from '@solana/web3.js';
104+
import fs from "fs";
105+
106+
const connection = new Connection(clusterApiUrl('mainnet-beta'));
107+
// set max size of lru cache for caching decoded pool info
108+
const parser = new RaydiumV4Parser(connection, { maxPoolCache: 20 });
109+
110+
// Fetch a transaction
111+
const txnSig = '<transaction_signature>'
112+
const txn1 = await connection.getParsedTransaction(txnSig);
113+
114+
// Parse single transaction
115+
const result = await parser.parse(transaction);
116+
console.log(result);
117+
118+
// Parse multiple transactions
119+
const txnSig2 = '<second transaction signature>'
120+
const txn2 = await connection.getParsedTransaction(txnSig2)
121+
const results = await parser.parseMultiple([txn1, txn2])
122+
123+
// Parse transaction from json file
124+
const txn = JSON.parse(fs.readFileSync("<file_path>", "utf-8")) as unknown as ParsedTransactionWithMeta
125+
const result = parser.parse(txn)
126+
```
102127

103128
### 🔄 Jupiter Parser [Coming soon]
104129

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './parser/pumpfun';
2+
export * from './parser/raydium'

0 commit comments

Comments
 (0)