Skip to content

Commit f642cab

Browse files
committed
Release PumpFun USDC parser updates
1 parent 2bab38f commit f642cab

19 files changed

Lines changed: 1694 additions & 53 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
**From PyPI**
5757

5858
```bash
59-
pip install sol-parser-sdk-python==0.4.4
59+
pip install sol-parser-sdk-python==0.4.5
6060
```
6161

6262
**From source**

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
**PyPI**
5757

5858
```bash
59-
pip install sol-parser-sdk-python==0.4.4
59+
pip install sol-parser-sdk-python==0.4.5
6060
```
6161

6262
**源码**

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "sol-parser-sdk-python"
3-
version = "0.4.4"
3+
version = "0.4.5"
44
description = "Solana DEX program log parsing (pure Python, API aligned with sol-parser-sdk)"
55
requires-python = ">=3.10"
66
dependencies = [

sol_parser/account_fillers/pumpfun.py

Lines changed: 83 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,96 @@ def _empty(s: str) -> bool:
2222

2323

2424
def fill_trade_accounts(e: PumpFunTradeEvent, get: AccountGetter) -> None:
25-
if e.ix_name in ("buy_v2", "sell_v2", "buy_exact_quote_in_v2"):
26-
if _empty(e.user):
27-
e.user = get(13)
28-
if _empty(e.bonding_curve):
29-
e.bonding_curve = get(10)
30-
if _empty(e.associated_bonding_curve):
31-
e.associated_bonding_curve = get(11)
32-
if _empty(e.creator_vault):
33-
e.creator_vault = get(16)
34-
if _empty(e.token_program):
35-
e.token_program = get(3)
25+
def account_at_matches_mint(idx: int) -> bool:
26+
return not _empty(e.mint) and get(idx) == e.mint
27+
28+
def set_attr(name: str, idx: int) -> None:
29+
if _empty(getattr(e, name)):
30+
setattr(e, name, get(idx))
31+
32+
is_v2 = e.ix_name in ("buy_v2", "sell_v2", "buy_exact_quote_in_v2") or (
33+
e.ix_name == "buy_exact_quote_in" and account_at_matches_mint(1)
34+
)
35+
if is_v2:
36+
set_attr("global_account", 0)
37+
set_attr("quote_mint", 2)
38+
set_attr("fee_recipient", 6)
39+
set_attr("bonding_curve", 10)
40+
set_attr("associated_bonding_curve", 11)
41+
set_attr("associated_quote_bonding_curve", 12)
42+
set_attr("user", 13)
43+
set_attr("associated_user", 14)
44+
set_attr("associated_quote_user", 15)
45+
set_attr("token_program", 3)
46+
set_attr("quote_token_program", 4)
47+
set_attr("associated_token_program", 5)
48+
set_attr("creator_vault", 16)
49+
set_attr("associated_quote_fee_recipient", 7)
50+
set_attr("buyback_fee_recipient", 8)
51+
set_attr("associated_quote_buyback_fee_recipient", 9)
52+
set_attr("associated_creator_vault", 17)
53+
set_attr("sharing_config", 18)
54+
if e.ix_name == "sell_v2":
55+
set_attr("user_volume_accumulator", 19)
56+
set_attr("associated_user_volume_accumulator", 20)
57+
set_attr("fee_config", 21)
58+
set_attr("fee_program", 22)
59+
set_attr("system_program", 23)
60+
set_attr("event_authority", 24)
61+
set_attr("program", 25)
62+
else:
63+
set_attr("global_volume_accumulator", 19)
64+
set_attr("user_volume_accumulator", 20)
65+
set_attr("associated_user_volume_accumulator", 21)
66+
set_attr("fee_config", 22)
67+
set_attr("fee_program", 23)
68+
set_attr("system_program", 24)
69+
set_attr("event_authority", 25)
70+
set_attr("program", 26)
3671
return
37-
if _empty(e.user):
38-
e.user = get(6)
39-
if _empty(e.bonding_curve):
40-
e.bonding_curve = get(3)
41-
if _empty(e.associated_bonding_curve):
42-
e.associated_bonding_curve = get(4)
72+
set_attr("global_account", 0)
73+
set_attr("fee_recipient", 1)
74+
set_attr("bonding_curve", 3)
75+
set_attr("associated_bonding_curve", 4)
76+
set_attr("associated_user", 5)
77+
set_attr("user", 6)
78+
set_attr("system_program", 7)
4379
if _empty(e.creator_vault):
4480
e.creator_vault = get(9) if e.is_buy else get(8)
4581
if _empty(e.token_program):
4682
e.token_program = get(8) if e.is_buy else get(9)
83+
set_attr("event_authority", 10)
84+
set_attr("program", 11)
85+
if e.is_buy:
86+
set_attr("global_volume_accumulator", 12)
87+
set_attr("user_volume_accumulator", 13)
88+
set_attr("fee_config", 14)
89+
set_attr("fee_program", 15)
90+
set_attr("bonding_curve_v2", 16)
91+
set_attr("buyback_fee_recipient", 17)
92+
a17 = get(17)
93+
if not _empty(a17) and _empty(e.extra_instruction_account):
94+
e.extra_instruction_account = a17
95+
return
96+
set_attr("fee_config", 12)
97+
set_attr("fee_program", 13)
4798
a16 = get(16)
4899
if not _empty(a16):
49-
e.extra_instruction_account = a16
100+
set_attr("user_volume_accumulator", 14)
101+
set_attr("bonding_curve_v2", 15)
102+
set_attr("buyback_fee_recipient", 16)
103+
if _empty(e.extra_instruction_account):
104+
e.extra_instruction_account = a16
105+
return
106+
if e.is_cashback_coin:
107+
set_attr("user_volume_accumulator", 14)
108+
set_attr("bonding_curve_v2", 15)
109+
return
110+
set_attr("bonding_curve_v2", 14)
111+
set_attr("buyback_fee_recipient", 15)
112+
a15 = get(15)
113+
if not _empty(a15) and _empty(e.extra_instruction_account):
114+
e.extra_instruction_account = a15
50115

51116

52117
def fill_create_accounts(e: PumpFunCreateEvent, get: AccountGetter) -> None:

sol_parser/account_fillers/pumpswap.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,50 @@ def _fill_trade_common(
5858

5959
def fill_buy_accounts(e: PumpSwapBuyEvent, get: AccountGetter) -> None:
6060
_fill_trade_common(e, get)
61+
a26 = get(26)
62+
if not _empty(a26):
63+
if _empty(e.pool_v2):
64+
e.pool_v2 = get(24)
65+
if _empty(e.fee_recipient):
66+
e.fee_recipient = get(25)
67+
if _empty(e.fee_recipient_quote_token_account):
68+
e.fee_recipient_quote_token_account = a26
69+
return
70+
a25 = get(25)
71+
if not _empty(a25):
72+
if _empty(e.pool_v2):
73+
e.pool_v2 = get(23)
74+
if _empty(e.fee_recipient):
75+
e.fee_recipient = get(24)
76+
if _empty(e.fee_recipient_quote_token_account):
77+
e.fee_recipient_quote_token_account = a25
78+
return
79+
if _empty(e.pool_v2):
80+
e.pool_v2 = get(23)
6181

6282

6383
def fill_sell_accounts(e: PumpSwapSellEvent, get: AccountGetter) -> None:
6484
_fill_trade_common(e, get)
85+
a25 = get(25)
86+
if not _empty(a25):
87+
if _empty(e.pool_v2):
88+
e.pool_v2 = get(23)
89+
if _empty(e.fee_recipient):
90+
e.fee_recipient = get(24)
91+
if _empty(e.fee_recipient_quote_token_account):
92+
e.fee_recipient_quote_token_account = a25
93+
return
94+
a23 = get(23)
95+
if not _empty(a23):
96+
if _empty(e.pool_v2):
97+
e.pool_v2 = get(21)
98+
if _empty(e.fee_recipient):
99+
e.fee_recipient = get(22)
100+
if _empty(e.fee_recipient_quote_token_account):
101+
e.fee_recipient_quote_token_account = a23
102+
return
103+
if _empty(e.pool_v2):
104+
e.pool_v2 = get(21)
65105

66106

67107
def fill_trade_accounts(_e: Any, _get: AccountGetter) -> None:

0 commit comments

Comments
 (0)