solana-launch-check 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- solana_launch_check-0.1.0/LICENSE +21 -0
- solana_launch_check-0.1.0/PKG-INFO +162 -0
- solana_launch_check-0.1.0/README.md +134 -0
- solana_launch_check-0.1.0/pyproject.toml +42 -0
- solana_launch_check-0.1.0/src/solana_launch_check/__init__.py +25 -0
- solana_launch_check-0.1.0/src/solana_launch_check/cli.py +113 -0
- solana_launch_check-0.1.0/src/solana_launch_check/client.py +298 -0
- solana_launch_check-0.1.0/src/solana_launch_check/py.typed +0 -0
- solana_launch_check-0.1.0/tests/test_client.py +176 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Veriql
|
|
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.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: solana-launch-check
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Check a Solana or pump.fun token before your bot buys: 0-100 launch score, penalty drivers, and the creator's earlier launches. Plus a new-launches feed poller.
|
|
5
|
+
Project-URL: Homepage, https://veriql.app
|
|
6
|
+
Project-URL: Documentation, https://veriql.app/openapi.json
|
|
7
|
+
Project-URL: Free API key, https://veriql.app/api/checkout?pack=free
|
|
8
|
+
Project-URL: x402scan listing, https://www.x402scan.com/server/b43a466b-e90b-41bf-a7a8-1502cde22f10
|
|
9
|
+
Author: Veriql
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: creator-wallet,deployer,launch,memecoin,pump.fun,pumpfun,rug-check,sniper,solana,token-security,trading-bot,veriql
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
24
|
+
Classifier: Topic :: Security
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# solana-launch-check
|
|
30
|
+
|
|
31
|
+
Check a Solana token before your bot buys it.
|
|
32
|
+
|
|
33
|
+
- **Launch score.** One call returns Veriql's 0-100 launch score, with every penalty spelled out: holder concentration, thin or unlocked liquidity, mint and freeze powers, wash-traded volume.
|
|
34
|
+
- **Creator history.** A second call reads the token's pump.fun creator off its bonding curve and shows what happened to that creator's other launches.
|
|
35
|
+
- **Launches feed.** `watch()` polls Veriql's feed of new Solana tokens that are already checked.
|
|
36
|
+
|
|
37
|
+
It uses only the Python standard library, and it works from the command line or inside a bot.
|
|
38
|
+
|
|
39
|
+
> **Disclosure:** we make Veriql. This package calls Veriql's API, which is paid. A check uses 2 credits, and a free key comes with 250.
|
|
40
|
+
|
|
41
|
+
## Install and get a key
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install solana-launch-check
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
To get a free key, open <https://veriql.app/api/checkout?pack=free> in a browser. It holds 250 credits and needs no sign-up. Then set the key:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
export VERIQL_API_KEY=vq_live_... # PowerShell: $env:VERIQL_API_KEY="vq_live_..."
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Command line
|
|
54
|
+
|
|
55
|
+
```console
|
|
56
|
+
$ solana-launch-check <MINT>
|
|
57
|
+
<MINT>
|
|
58
|
+
launch score : 40/100 (caution)
|
|
59
|
+
summary : Caution: real risks here. Understand them before you buy.
|
|
60
|
+
- Top 10 wallets hold 93% of supply, so a few holders can exit into whoever buys next (-42)
|
|
61
|
+
- Very thin liquidity ($2.3k) (-8)
|
|
62
|
+
- 24h volume is 79× liquidity, likely wash-traded (-7)
|
|
63
|
+
- Launched under 24h ago, unproven (-3)
|
|
64
|
+
creator : <CREATOR WALLET>
|
|
65
|
+
other launches on record: 7 (ledger starts 2026-09-30, so a floor)
|
|
66
|
+
their measured collapses: withdrawn 0, sold off 0, unclassified 0
|
|
67
|
+
YOUR RULES TRIPPED:
|
|
68
|
+
* launch score 40 is below your minimum of 60
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The output above is a real response. We replaced the addresses with placeholders.
|
|
72
|
+
|
|
73
|
+
The exit code tells your script what happened:
|
|
74
|
+
|
|
75
|
+
| Exit code | Meaning |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `0` | None of your rules tripped. |
|
|
78
|
+
| `2` | At least one rule tripped. |
|
|
79
|
+
| `1` | Error, for example a bad address, a bad key or no credits left. |
|
|
80
|
+
|
|
81
|
+
More commands:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
solana-launch-check <MINT> --json --min-score 70 --max-creator-launches 10
|
|
85
|
+
solana-launch-check --watch --interval 60 # new tokens as Veriql checks them
|
|
86
|
+
solana-launch-check --usage # credits left (free call)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## In your bot
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from solana_launch_check import Client
|
|
93
|
+
|
|
94
|
+
client = Client() # reads VERIQL_API_KEY
|
|
95
|
+
|
|
96
|
+
report = client.check(mint) # /launch + /deployer, 2 credits
|
|
97
|
+
reasons = report.reasons_to_skip(
|
|
98
|
+
min_score=60, # below this: skip
|
|
99
|
+
max_creator_collapses=0, # creator's earlier tokens that collapsed
|
|
100
|
+
max_creator_other_launches=10, # serial launchers (None = ignore)
|
|
101
|
+
)
|
|
102
|
+
if reasons:
|
|
103
|
+
print("skip:", "; ".join(reasons))
|
|
104
|
+
else:
|
|
105
|
+
... # your own logic decides from here
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`report.score`, `report.band`, `report.drivers` (a list of `(label, penalty)` pairs), `report.creator`, `report.creator_other_launches` and `report.creator_collapses` are all there for your own rules. The raw API answers are in `report.launch` and `report.deployer`.
|
|
109
|
+
|
|
110
|
+
### Watch new launches
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
for token in client.watch(interval=60): # one credit per poll
|
|
114
|
+
v = token["verdict"]
|
|
115
|
+
print(token["address"], v["score"], token["deployer"]["otherLaunches"])
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Every token in the feed is already scored and carries its creator summary, so you don't need a second call per token. The feed refreshes every few minutes. In the 7 days to 30 November 2026 it listed 1,795 tokens, about 256 a day.
|
|
119
|
+
|
|
120
|
+
## What the numbers mean
|
|
121
|
+
|
|
122
|
+
- **Score.** Structure read off the chain: holder concentration, liquidity and its lock, and mint and freeze powers at scan time. It measures structure. It does not forecast price, and it does not predict a rug.
|
|
123
|
+
- **No score.** When a partial check finds nothing, no score is published. The `reasons_to_skip()` default treats a missing score as a reason to skip; pass `skip_unscored=False` to change that.
|
|
124
|
+
- **Top-10 share** is an upper bound, because the ten largest accounts can include pool vaults and the bonding curve.
|
|
125
|
+
- **Creator.**
|
|
126
|
+
- The creator is pump.fun's creator for the token: the address named at creation, which receives the creator fees. It is not necessarily the wallet that paid.
|
|
127
|
+
- The ledger starts on 2026-09-30, so "other launches" is a floor.
|
|
128
|
+
- Zero other launches means unknown, not clean, because a fresh wallet per launch is common.
|
|
129
|
+
- **Collapses.** A collapse is a measured liquidity collapse after Veriql's verdict, counted once per token by its strongest cause:
|
|
130
|
+
- `withdrawn`: both sides of the pool left.
|
|
131
|
+
- `soldOff`: holders sold.
|
|
132
|
+
- `unclassified`: measured as an amount only.
|
|
133
|
+
|
|
134
|
+
## Cost
|
|
135
|
+
|
|
136
|
+
| Call | On a key | Pay per call over x402 (no key) |
|
|
137
|
+
|---|---|---|
|
|
138
|
+
| `launch` (score) | 1 credit | USD 0.005 |
|
|
139
|
+
| `deployer` (creator) | 1 credit. Free when the token is not a pump.fun token or no creator can be read. | USD 0.01 |
|
|
140
|
+
| `launches` (feed page) | 1 credit | USD 0.005 |
|
|
141
|
+
| `usage` | free | free |
|
|
142
|
+
|
|
143
|
+
Failed calls cost nothing.
|
|
144
|
+
|
|
145
|
+
**Free and paid keys:**
|
|
146
|
+
- A free key sees the launches feed 15 minutes late.
|
|
147
|
+
- For real time, a paid key is 20,000 calls for USD 19, paid in USDC or USDT on Solana, Base or Polygon. Buy it in Telegram: [@VeriqlBot](https://t.me/VeriqlBot?start=apikey), send `/apikey`.
|
|
148
|
+
- At one poll a minute, `watch()` uses 1,440 credits a day. At one poll every five minutes, it uses 288.
|
|
149
|
+
|
|
150
|
+
**x402:** the API also takes x402 pay-per-call in USDC on Base, Solana, Polygon, Arbitrum or Avalanche. This package does not sign x402 payments. If your agent already has an x402 client, see [openapi.json](https://veriql.app/openapi.json).
|
|
151
|
+
|
|
152
|
+
## Not advice
|
|
153
|
+
|
|
154
|
+
This is a read-only, best-effort risk signal. It detects known patterns and may miss new ones. It is not financial advice, and it is not a guarantee about any token.
|
|
155
|
+
|
|
156
|
+
## Links
|
|
157
|
+
|
|
158
|
+
- API description: [veriql.app/openapi.json](https://veriql.app/openapi.json)
|
|
159
|
+
- Veriql: [veriql.app](https://veriql.app)
|
|
160
|
+
- Related: [x402-payee-guard](https://pypi.org/project/x402-payee-guard/) and [stablecoin-freeze-check](https://pypi.org/project/stablecoin-freeze-check/)
|
|
161
|
+
|
|
162
|
+
MIT licensed.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# solana-launch-check
|
|
2
|
+
|
|
3
|
+
Check a Solana token before your bot buys it.
|
|
4
|
+
|
|
5
|
+
- **Launch score.** One call returns Veriql's 0-100 launch score, with every penalty spelled out: holder concentration, thin or unlocked liquidity, mint and freeze powers, wash-traded volume.
|
|
6
|
+
- **Creator history.** A second call reads the token's pump.fun creator off its bonding curve and shows what happened to that creator's other launches.
|
|
7
|
+
- **Launches feed.** `watch()` polls Veriql's feed of new Solana tokens that are already checked.
|
|
8
|
+
|
|
9
|
+
It uses only the Python standard library, and it works from the command line or inside a bot.
|
|
10
|
+
|
|
11
|
+
> **Disclosure:** we make Veriql. This package calls Veriql's API, which is paid. A check uses 2 credits, and a free key comes with 250.
|
|
12
|
+
|
|
13
|
+
## Install and get a key
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install solana-launch-check
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
To get a free key, open <https://veriql.app/api/checkout?pack=free> in a browser. It holds 250 credits and needs no sign-up. Then set the key:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
export VERIQL_API_KEY=vq_live_... # PowerShell: $env:VERIQL_API_KEY="vq_live_..."
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Command line
|
|
26
|
+
|
|
27
|
+
```console
|
|
28
|
+
$ solana-launch-check <MINT>
|
|
29
|
+
<MINT>
|
|
30
|
+
launch score : 40/100 (caution)
|
|
31
|
+
summary : Caution: real risks here. Understand them before you buy.
|
|
32
|
+
- Top 10 wallets hold 93% of supply, so a few holders can exit into whoever buys next (-42)
|
|
33
|
+
- Very thin liquidity ($2.3k) (-8)
|
|
34
|
+
- 24h volume is 79× liquidity, likely wash-traded (-7)
|
|
35
|
+
- Launched under 24h ago, unproven (-3)
|
|
36
|
+
creator : <CREATOR WALLET>
|
|
37
|
+
other launches on record: 7 (ledger starts 2026-09-30, so a floor)
|
|
38
|
+
their measured collapses: withdrawn 0, sold off 0, unclassified 0
|
|
39
|
+
YOUR RULES TRIPPED:
|
|
40
|
+
* launch score 40 is below your minimum of 60
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The output above is a real response. We replaced the addresses with placeholders.
|
|
44
|
+
|
|
45
|
+
The exit code tells your script what happened:
|
|
46
|
+
|
|
47
|
+
| Exit code | Meaning |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `0` | None of your rules tripped. |
|
|
50
|
+
| `2` | At least one rule tripped. |
|
|
51
|
+
| `1` | Error, for example a bad address, a bad key or no credits left. |
|
|
52
|
+
|
|
53
|
+
More commands:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
solana-launch-check <MINT> --json --min-score 70 --max-creator-launches 10
|
|
57
|
+
solana-launch-check --watch --interval 60 # new tokens as Veriql checks them
|
|
58
|
+
solana-launch-check --usage # credits left (free call)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## In your bot
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from solana_launch_check import Client
|
|
65
|
+
|
|
66
|
+
client = Client() # reads VERIQL_API_KEY
|
|
67
|
+
|
|
68
|
+
report = client.check(mint) # /launch + /deployer, 2 credits
|
|
69
|
+
reasons = report.reasons_to_skip(
|
|
70
|
+
min_score=60, # below this: skip
|
|
71
|
+
max_creator_collapses=0, # creator's earlier tokens that collapsed
|
|
72
|
+
max_creator_other_launches=10, # serial launchers (None = ignore)
|
|
73
|
+
)
|
|
74
|
+
if reasons:
|
|
75
|
+
print("skip:", "; ".join(reasons))
|
|
76
|
+
else:
|
|
77
|
+
... # your own logic decides from here
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`report.score`, `report.band`, `report.drivers` (a list of `(label, penalty)` pairs), `report.creator`, `report.creator_other_launches` and `report.creator_collapses` are all there for your own rules. The raw API answers are in `report.launch` and `report.deployer`.
|
|
81
|
+
|
|
82
|
+
### Watch new launches
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
for token in client.watch(interval=60): # one credit per poll
|
|
86
|
+
v = token["verdict"]
|
|
87
|
+
print(token["address"], v["score"], token["deployer"]["otherLaunches"])
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Every token in the feed is already scored and carries its creator summary, so you don't need a second call per token. The feed refreshes every few minutes. In the 7 days to 30 November 2026 it listed 1,795 tokens, about 256 a day.
|
|
91
|
+
|
|
92
|
+
## What the numbers mean
|
|
93
|
+
|
|
94
|
+
- **Score.** Structure read off the chain: holder concentration, liquidity and its lock, and mint and freeze powers at scan time. It measures structure. It does not forecast price, and it does not predict a rug.
|
|
95
|
+
- **No score.** When a partial check finds nothing, no score is published. The `reasons_to_skip()` default treats a missing score as a reason to skip; pass `skip_unscored=False` to change that.
|
|
96
|
+
- **Top-10 share** is an upper bound, because the ten largest accounts can include pool vaults and the bonding curve.
|
|
97
|
+
- **Creator.**
|
|
98
|
+
- The creator is pump.fun's creator for the token: the address named at creation, which receives the creator fees. It is not necessarily the wallet that paid.
|
|
99
|
+
- The ledger starts on 2026-09-30, so "other launches" is a floor.
|
|
100
|
+
- Zero other launches means unknown, not clean, because a fresh wallet per launch is common.
|
|
101
|
+
- **Collapses.** A collapse is a measured liquidity collapse after Veriql's verdict, counted once per token by its strongest cause:
|
|
102
|
+
- `withdrawn`: both sides of the pool left.
|
|
103
|
+
- `soldOff`: holders sold.
|
|
104
|
+
- `unclassified`: measured as an amount only.
|
|
105
|
+
|
|
106
|
+
## Cost
|
|
107
|
+
|
|
108
|
+
| Call | On a key | Pay per call over x402 (no key) |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `launch` (score) | 1 credit | USD 0.005 |
|
|
111
|
+
| `deployer` (creator) | 1 credit. Free when the token is not a pump.fun token or no creator can be read. | USD 0.01 |
|
|
112
|
+
| `launches` (feed page) | 1 credit | USD 0.005 |
|
|
113
|
+
| `usage` | free | free |
|
|
114
|
+
|
|
115
|
+
Failed calls cost nothing.
|
|
116
|
+
|
|
117
|
+
**Free and paid keys:**
|
|
118
|
+
- A free key sees the launches feed 15 minutes late.
|
|
119
|
+
- For real time, a paid key is 20,000 calls for USD 19, paid in USDC or USDT on Solana, Base or Polygon. Buy it in Telegram: [@VeriqlBot](https://t.me/VeriqlBot?start=apikey), send `/apikey`.
|
|
120
|
+
- At one poll a minute, `watch()` uses 1,440 credits a day. At one poll every five minutes, it uses 288.
|
|
121
|
+
|
|
122
|
+
**x402:** the API also takes x402 pay-per-call in USDC on Base, Solana, Polygon, Arbitrum or Avalanche. This package does not sign x402 payments. If your agent already has an x402 client, see [openapi.json](https://veriql.app/openapi.json).
|
|
123
|
+
|
|
124
|
+
## Not advice
|
|
125
|
+
|
|
126
|
+
This is a read-only, best-effort risk signal. It detects known patterns and may miss new ones. It is not financial advice, and it is not a guarantee about any token.
|
|
127
|
+
|
|
128
|
+
## Links
|
|
129
|
+
|
|
130
|
+
- API description: [veriql.app/openapi.json](https://veriql.app/openapi.json)
|
|
131
|
+
- Veriql: [veriql.app](https://veriql.app)
|
|
132
|
+
- Related: [x402-payee-guard](https://pypi.org/project/x402-payee-guard/) and [stablecoin-freeze-check](https://pypi.org/project/stablecoin-freeze-check/)
|
|
133
|
+
|
|
134
|
+
MIT licensed.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "solana-launch-check"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Check a Solana or pump.fun token before your bot buys: 0-100 launch score, penalty drivers, and the creator's earlier launches. Plus a new-launches feed poller."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
authors = [{ name = "Veriql" }]
|
|
14
|
+
keywords = ["solana", "pump.fun", "pumpfun", "memecoin", "rug-check", "token-security", "trading-bot", "sniper", "launch", "deployer", "creator-wallet", "veriql"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Office/Business :: Financial :: Investment",
|
|
27
|
+
"Topic :: Security",
|
|
28
|
+
"Typing :: Typed",
|
|
29
|
+
]
|
|
30
|
+
dependencies = []
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
solana-launch-check = "solana_launch_check.cli:main"
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://veriql.app"
|
|
37
|
+
Documentation = "https://veriql.app/openapi.json"
|
|
38
|
+
"Free API key" = "https://veriql.app/api/checkout?pack=free"
|
|
39
|
+
"x402scan listing" = "https://www.x402scan.com/server/b43a466b-e90b-41bf-a7a8-1502cde22f10"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["src/solana_launch_check"]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Check a Solana token before your bot buys: Veriql's 0-100 launch score plus
|
|
2
|
+
the pump.fun creator's track record, and a polling helper for new launches."""
|
|
3
|
+
|
|
4
|
+
from .client import (
|
|
5
|
+
API_BASE,
|
|
6
|
+
FREE_KEY_URL,
|
|
7
|
+
Client,
|
|
8
|
+
MissingKey,
|
|
9
|
+
RateLimited,
|
|
10
|
+
Report,
|
|
11
|
+
VeriqlError,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__version__ = "0.1.0"
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"API_BASE",
|
|
18
|
+
"FREE_KEY_URL",
|
|
19
|
+
"Client",
|
|
20
|
+
"MissingKey",
|
|
21
|
+
"RateLimited",
|
|
22
|
+
"Report",
|
|
23
|
+
"VeriqlError",
|
|
24
|
+
"__version__",
|
|
25
|
+
]
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""Command line: check one Solana token, or watch new launches.
|
|
2
|
+
|
|
3
|
+
solana-launch-check <MINT> score + creator history, exit 2 if your rules trip
|
|
4
|
+
solana-launch-check <MINT> --json the same as JSON
|
|
5
|
+
solana-launch-check --watch [--interval 60] new tokens as Veriql checks them
|
|
6
|
+
solana-launch-check --usage credits left on your key
|
|
7
|
+
|
|
8
|
+
Needs VERIQL_API_KEY (free key, 250 credits: https://veriql.app/api/checkout?pack=free).
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import argparse
|
|
14
|
+
import json
|
|
15
|
+
import sys
|
|
16
|
+
from typing import List, Optional
|
|
17
|
+
|
|
18
|
+
from .client import FREE_KEY_URL, Client, VeriqlError
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _print_report(rep, reasons: List[str]) -> None:
|
|
22
|
+
score = "no score" if rep.score is None else f"{rep.score}/100"
|
|
23
|
+
print(f"{rep.mint}")
|
|
24
|
+
print(f" launch score : {score} ({rep.band})")
|
|
25
|
+
if rep.summary:
|
|
26
|
+
print(f" summary : {rep.summary}")
|
|
27
|
+
for label, penalty in rep.drivers:
|
|
28
|
+
print(f" - {label} (-{penalty})")
|
|
29
|
+
if rep.creator:
|
|
30
|
+
print(f" creator : {rep.creator}")
|
|
31
|
+
print(f" other launches on record: {rep.creator_other_launches} (ledger starts 2026-09-30, so a floor)")
|
|
32
|
+
c = rep.creator_collapses
|
|
33
|
+
print(
|
|
34
|
+
f" their measured collapses: withdrawn {c['withdrawn']}, sold off {c['soldOff']},"
|
|
35
|
+
f" unclassified {c['unclassified']}"
|
|
36
|
+
)
|
|
37
|
+
else:
|
|
38
|
+
print(f" creator : {rep.creator_status}")
|
|
39
|
+
if reasons:
|
|
40
|
+
print(" YOUR RULES TRIPPED:")
|
|
41
|
+
for r in reasons:
|
|
42
|
+
print(f" * {r}")
|
|
43
|
+
else:
|
|
44
|
+
print(" none of your rules tripped (not a guarantee: structure, not price or intent)")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def main(argv: Optional[List[str]] = None) -> int:
|
|
48
|
+
p = argparse.ArgumentParser(prog="solana-launch-check", description=__doc__,
|
|
49
|
+
formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
50
|
+
p.add_argument("mint", nargs="?", help="Solana token mint address")
|
|
51
|
+
p.add_argument("--json", action="store_true", help="print JSON")
|
|
52
|
+
p.add_argument("--min-score", type=int, default=60)
|
|
53
|
+
p.add_argument("--max-creator-collapses", type=int, default=0)
|
|
54
|
+
p.add_argument("--max-creator-launches", type=int, default=None)
|
|
55
|
+
p.add_argument("--no-creator", action="store_true", help="skip the creator lookup (one call instead of two)")
|
|
56
|
+
p.add_argument("--watch", action="store_true", help="print new launches as they arrive")
|
|
57
|
+
p.add_argument("--interval", type=float, default=60.0, help="seconds between feed polls (default 60)")
|
|
58
|
+
p.add_argument("--max-polls", type=int, default=None, help=argparse.SUPPRESS)
|
|
59
|
+
p.add_argument("--usage", action="store_true", help="credits left on your key")
|
|
60
|
+
a = p.parse_args(argv)
|
|
61
|
+
|
|
62
|
+
if not (a.mint or a.watch or a.usage):
|
|
63
|
+
p.print_help()
|
|
64
|
+
return 1
|
|
65
|
+
try:
|
|
66
|
+
client = Client()
|
|
67
|
+
if a.usage:
|
|
68
|
+
print(json.dumps(client.usage(), indent=2))
|
|
69
|
+
return 0
|
|
70
|
+
if a.watch:
|
|
71
|
+
print("Watching new Solana launches (Ctrl+C to stop). Free keys see them 15 minutes late.",
|
|
72
|
+
file=sys.stderr)
|
|
73
|
+
for item in client.watch(interval=a.interval, max_polls=a.max_polls):
|
|
74
|
+
if a.json:
|
|
75
|
+
print(json.dumps(item), flush=True)
|
|
76
|
+
continue
|
|
77
|
+
v = item.get("verdict") or {}
|
|
78
|
+
d = item.get("deployer") or {}
|
|
79
|
+
score = v.get("score")
|
|
80
|
+
print(
|
|
81
|
+
f"{item.get('firstSeenAt', '')[:19]} {item.get('address')} "
|
|
82
|
+
f"{(item.get('symbol') or '-')[:12]:<12} score {score if score is not None else '-':>3} "
|
|
83
|
+
f"{v.get('band', ''):<8} creator other launches: {d.get('otherLaunches', '-')}",
|
|
84
|
+
flush=True,
|
|
85
|
+
)
|
|
86
|
+
return 0
|
|
87
|
+
rep = client.check(a.mint, with_creator=not a.no_creator)
|
|
88
|
+
reasons = rep.reasons_to_skip(
|
|
89
|
+
min_score=a.min_score,
|
|
90
|
+
max_creator_collapses=a.max_creator_collapses,
|
|
91
|
+
max_creator_other_launches=a.max_creator_launches,
|
|
92
|
+
)
|
|
93
|
+
if a.json:
|
|
94
|
+
print(json.dumps({
|
|
95
|
+
"mint": rep.mint, "score": rep.score, "band": rep.band, "inconclusive": rep.inconclusive,
|
|
96
|
+
"summary": rep.summary, "drivers": rep.drivers, "creator": rep.creator,
|
|
97
|
+
"creatorStatus": rep.creator_status, "creatorOtherLaunches": rep.creator_other_launches,
|
|
98
|
+
"creatorCollapses": rep.creator_collapses, "reasonsToSkip": reasons,
|
|
99
|
+
}, indent=2))
|
|
100
|
+
else:
|
|
101
|
+
_print_report(rep, reasons)
|
|
102
|
+
return 2 if reasons else 0
|
|
103
|
+
except KeyboardInterrupt:
|
|
104
|
+
return 130
|
|
105
|
+
except VeriqlError as e:
|
|
106
|
+
print(f"error: {e}", file=sys.stderr)
|
|
107
|
+
if e.code == "missing_key":
|
|
108
|
+
print(f"free key: {FREE_KEY_URL}", file=sys.stderr)
|
|
109
|
+
return 1
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
if __name__ == "__main__": # pragma: no cover
|
|
113
|
+
sys.exit(main())
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
"""Small, dependency-free client for Veriql's Solana launch endpoints.
|
|
2
|
+
|
|
3
|
+
Endpoints used (https://veriql.app/openapi.json):
|
|
4
|
+
GET /api/v1/launch 0-100 launch score with itemised penalty drivers
|
|
5
|
+
GET /api/v1/deployer pump.fun creator of a token and what happened to their other launches
|
|
6
|
+
GET /api/v1/launches feed of new Solana tokens Veriql has already checked
|
|
7
|
+
GET /api/v1/usage credits left on the key (free, not metered)
|
|
8
|
+
|
|
9
|
+
Authentication is a Veriql API key sent as ``x-api-key``. A free key (250 credits,
|
|
10
|
+
no sign-up) comes from https://veriql.app/api/checkout?pack=free . On a key, every
|
|
11
|
+
successful call costs one credit; failed calls cost nothing.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import os
|
|
18
|
+
import time
|
|
19
|
+
import urllib.error
|
|
20
|
+
import urllib.parse
|
|
21
|
+
import urllib.request
|
|
22
|
+
from dataclasses import dataclass, field
|
|
23
|
+
from typing import Any, Dict, Iterator, List, Optional, Tuple
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"API_BASE",
|
|
27
|
+
"FREE_KEY_URL",
|
|
28
|
+
"Client",
|
|
29
|
+
"Report",
|
|
30
|
+
"VeriqlError",
|
|
31
|
+
"MissingKey",
|
|
32
|
+
"RateLimited",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
API_BASE = "https://veriql.app/api/v1"
|
|
36
|
+
FREE_KEY_URL = "https://veriql.app/api/checkout?pack=free"
|
|
37
|
+
_UA = "solana-launch-check/0.1.0 (+https://pypi.org/project/solana-launch-check/)"
|
|
38
|
+
|
|
39
|
+
# Indirection so tests can replace the network call.
|
|
40
|
+
_urlopen = urllib.request.urlopen
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class VeriqlError(Exception):
|
|
44
|
+
"""The API answered with an error (bad address, bad key, no credits, ...)."""
|
|
45
|
+
|
|
46
|
+
def __init__(self, status: int, code: str, message: str):
|
|
47
|
+
super().__init__(f"{status} {code}: {message}")
|
|
48
|
+
self.status = status
|
|
49
|
+
self.code = code
|
|
50
|
+
self.message = message
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class MissingKey(VeriqlError):
|
|
54
|
+
def __init__(self) -> None:
|
|
55
|
+
super().__init__(
|
|
56
|
+
0,
|
|
57
|
+
"missing_key",
|
|
58
|
+
"No API key. Pass api_key=... or set VERIQL_API_KEY. "
|
|
59
|
+
f"A free key (250 credits, no sign-up): {FREE_KEY_URL}",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class RateLimited(VeriqlError):
|
|
64
|
+
def __init__(self, status: int, code: str, message: str, retry_after: Optional[float]):
|
|
65
|
+
super().__init__(status, code, message)
|
|
66
|
+
self.retry_after = retry_after
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _fix_text(value: Any) -> Any:
|
|
70
|
+
"""Repair UTF-8 text that was decoded as Windows-1252 somewhere upstream
|
|
71
|
+
(for example a multiplication sign arriving as two odd characters).
|
|
72
|
+
Leaves text alone unless the round trip succeeds."""
|
|
73
|
+
if isinstance(value, str) and ("Ã" in value or "â€" in value):
|
|
74
|
+
try:
|
|
75
|
+
return value.encode("cp1252").decode("utf-8")
|
|
76
|
+
except (UnicodeEncodeError, UnicodeDecodeError):
|
|
77
|
+
return value
|
|
78
|
+
return value
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@dataclass(frozen=True)
|
|
82
|
+
class Report:
|
|
83
|
+
"""One token, two answers: the launch score and the creator's history."""
|
|
84
|
+
|
|
85
|
+
mint: str
|
|
86
|
+
score: Optional[int]
|
|
87
|
+
band: str
|
|
88
|
+
inconclusive: bool
|
|
89
|
+
summary: str
|
|
90
|
+
drivers: List[Tuple[str, int]]
|
|
91
|
+
creator: Optional[str]
|
|
92
|
+
creator_status: str
|
|
93
|
+
creator_other_launches: Optional[int]
|
|
94
|
+
creator_collapses: Dict[str, int]
|
|
95
|
+
launch: Dict[str, Any] = field(repr=False)
|
|
96
|
+
deployer: Optional[Dict[str, Any]] = field(repr=False)
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def creator_collapse_count(self) -> int:
|
|
100
|
+
return sum(int(v or 0) for v in self.creator_collapses.values())
|
|
101
|
+
|
|
102
|
+
def reasons_to_skip(
|
|
103
|
+
self,
|
|
104
|
+
min_score: int = 60,
|
|
105
|
+
max_creator_collapses: int = 0,
|
|
106
|
+
max_creator_other_launches: Optional[int] = None,
|
|
107
|
+
skip_unscored: bool = True,
|
|
108
|
+
) -> List[str]:
|
|
109
|
+
"""Plain-English reasons this token fails YOUR rules. Empty list = none of
|
|
110
|
+
your rules tripped. That is not a verdict that the token is fine: the score
|
|
111
|
+
measures structure read off the chain, not price or intent."""
|
|
112
|
+
reasons: List[str] = []
|
|
113
|
+
if self.score is None:
|
|
114
|
+
if skip_unscored:
|
|
115
|
+
reasons.append("no score: the check was partial and found nothing to score")
|
|
116
|
+
elif self.score < min_score:
|
|
117
|
+
reasons.append(f"launch score {self.score} is below your minimum of {min_score}")
|
|
118
|
+
if self.band == "danger":
|
|
119
|
+
reasons.append("launch score is in the danger band")
|
|
120
|
+
if self.creator_collapse_count > max_creator_collapses:
|
|
121
|
+
c = self.creator_collapses
|
|
122
|
+
reasons.append(
|
|
123
|
+
"creator's earlier tokens had "
|
|
124
|
+
f"{self.creator_collapse_count} measured liquidity collapse(s) "
|
|
125
|
+
f"(withdrawn {c.get('withdrawn', 0)}, sold off {c.get('soldOff', 0)}, "
|
|
126
|
+
f"unclassified {c.get('unclassified', 0)})"
|
|
127
|
+
)
|
|
128
|
+
if (
|
|
129
|
+
max_creator_other_launches is not None
|
|
130
|
+
and self.creator_other_launches is not None
|
|
131
|
+
and self.creator_other_launches > max_creator_other_launches
|
|
132
|
+
):
|
|
133
|
+
reasons.append(
|
|
134
|
+
f"creator has {self.creator_other_launches} other launches on record "
|
|
135
|
+
f"(your limit is {max_creator_other_launches})"
|
|
136
|
+
)
|
|
137
|
+
return reasons
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class Client:
|
|
141
|
+
def __init__(
|
|
142
|
+
self,
|
|
143
|
+
api_key: Optional[str] = None,
|
|
144
|
+
base_url: str = API_BASE,
|
|
145
|
+
timeout: float = 30.0,
|
|
146
|
+
user_agent: str = _UA,
|
|
147
|
+
) -> None:
|
|
148
|
+
self.api_key = api_key or os.environ.get("VERIQL_API_KEY") or ""
|
|
149
|
+
if not self.api_key:
|
|
150
|
+
raise MissingKey()
|
|
151
|
+
self.base_url = base_url.rstrip("/")
|
|
152
|
+
self.timeout = timeout
|
|
153
|
+
self.user_agent = user_agent
|
|
154
|
+
|
|
155
|
+
# -- transport -------------------------------------------------------
|
|
156
|
+
def _get(self, path: str, params: Dict[str, Any]) -> Dict[str, Any]:
|
|
157
|
+
query = urllib.parse.urlencode({k: v for k, v in params.items() if v is not None})
|
|
158
|
+
url = f"{self.base_url}/{path}" + (f"?{query}" if query else "")
|
|
159
|
+
req = urllib.request.Request(
|
|
160
|
+
url,
|
|
161
|
+
headers={
|
|
162
|
+
"x-api-key": self.api_key,
|
|
163
|
+
"Accept": "application/json",
|
|
164
|
+
"User-Agent": self.user_agent,
|
|
165
|
+
},
|
|
166
|
+
)
|
|
167
|
+
try:
|
|
168
|
+
with _urlopen(req, timeout=self.timeout) as resp:
|
|
169
|
+
body = json.loads(resp.read().decode("utf-8"))
|
|
170
|
+
except urllib.error.HTTPError as e:
|
|
171
|
+
raw = e.read().decode("utf-8", "replace") if e.fp else ""
|
|
172
|
+
try:
|
|
173
|
+
err = json.loads(raw).get("error") or {}
|
|
174
|
+
except ValueError:
|
|
175
|
+
err = {}
|
|
176
|
+
if not isinstance(err, dict): # an x402 challenge carries a string here
|
|
177
|
+
err = {"message": str(err)}
|
|
178
|
+
code = err.get("code") or ("payment_required" if e.code == 402 else "http_error")
|
|
179
|
+
message = err.get("message") or raw[:200] or str(e)
|
|
180
|
+
if e.code == 402:
|
|
181
|
+
message += (
|
|
182
|
+
" (no usable key was sent, so the API asked for an x402 payment;"
|
|
183
|
+
f" get a free key at {FREE_KEY_URL})"
|
|
184
|
+
)
|
|
185
|
+
if e.code == 429:
|
|
186
|
+
ra = e.headers.get("Retry-After") if e.headers else None
|
|
187
|
+
try:
|
|
188
|
+
retry = float(ra) if ra else None
|
|
189
|
+
except ValueError:
|
|
190
|
+
retry = None
|
|
191
|
+
raise RateLimited(e.code, code, message, retry) from None
|
|
192
|
+
raise VeriqlError(e.code, code, message) from None
|
|
193
|
+
result = body.get("result")
|
|
194
|
+
if not isinstance(result, dict):
|
|
195
|
+
raise VeriqlError(200, "unexpected_response", "No 'result' object in the response.")
|
|
196
|
+
return result
|
|
197
|
+
|
|
198
|
+
# -- endpoints ---------------------------------------------------------
|
|
199
|
+
def launch(self, mint: str) -> Dict[str, Any]:
|
|
200
|
+
"""Launch score for a Solana token (one credit)."""
|
|
201
|
+
return self._get("launch", {"address": mint, "chainId": "solana"})
|
|
202
|
+
|
|
203
|
+
def deployer(self, address: str, limit: Optional[int] = None) -> Dict[str, Any]:
|
|
204
|
+
"""pump.fun creator of a mint (or a creator wallet) and their other launches.
|
|
205
|
+
One credit when a creator is identified; not_pumpfun / no_creator /
|
|
206
|
+
unreadable / not_found answers are free."""
|
|
207
|
+
return self._get("deployer", {"address": address, "limit": limit})
|
|
208
|
+
|
|
209
|
+
def launches(
|
|
210
|
+
self, since: Optional[str] = None, limit: int = 100, cursor: Optional[str] = None
|
|
211
|
+
) -> Dict[str, Any]:
|
|
212
|
+
"""One page of the new-launches feed, newest first (one credit)."""
|
|
213
|
+
return self._get("launches", {"since": since, "limit": limit, "cursor": cursor})
|
|
214
|
+
|
|
215
|
+
def usage(self) -> Dict[str, Any]:
|
|
216
|
+
"""Credits and rate limit left on the key (free)."""
|
|
217
|
+
return self._get("usage", {})
|
|
218
|
+
|
|
219
|
+
# -- helpers -------------------------------------------------------------
|
|
220
|
+
def check(self, mint: str, with_creator: bool = True) -> Report:
|
|
221
|
+
"""Launch score plus creator history for one mint (two calls)."""
|
|
222
|
+
lr = self.launch(mint)
|
|
223
|
+
dr: Optional[Dict[str, Any]] = None
|
|
224
|
+
if with_creator:
|
|
225
|
+
try:
|
|
226
|
+
dr = self.deployer(mint)
|
|
227
|
+
except VeriqlError as e:
|
|
228
|
+
if e.status in (401, 402, 429):
|
|
229
|
+
raise
|
|
230
|
+
dr = {"status": f"error:{e.code}"}
|
|
231
|
+
drivers = [
|
|
232
|
+
(_fix_text(str(d.get("label", ""))), int(d.get("penalty") or 0))
|
|
233
|
+
for d in (lr.get("drivers") or [])
|
|
234
|
+
if isinstance(d, dict)
|
|
235
|
+
]
|
|
236
|
+
dr = dr or {}
|
|
237
|
+
outcomes = dr.get("outcomes") or {}
|
|
238
|
+
status = str(dr.get("status") or ("read" if dr.get("deployer") else "skipped"))
|
|
239
|
+
return Report(
|
|
240
|
+
mint=mint,
|
|
241
|
+
score=lr.get("score"),
|
|
242
|
+
band=str(lr.get("band") or "unknown"),
|
|
243
|
+
inconclusive=bool(lr.get("inconclusive")),
|
|
244
|
+
summary=_fix_text(str(lr.get("summary") or "")),
|
|
245
|
+
drivers=drivers,
|
|
246
|
+
creator=dr.get("deployer"),
|
|
247
|
+
creator_status=status,
|
|
248
|
+
creator_other_launches=dr.get("otherLaunches") if dr.get("deployer") else None,
|
|
249
|
+
creator_collapses={
|
|
250
|
+
"withdrawn": int(outcomes.get("withdrawn") or 0),
|
|
251
|
+
"soldOff": int(outcomes.get("soldOff") or 0),
|
|
252
|
+
"unclassified": int(outcomes.get("unclassified") or 0),
|
|
253
|
+
},
|
|
254
|
+
launch=lr,
|
|
255
|
+
deployer=dr or None,
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
def watch(
|
|
259
|
+
self,
|
|
260
|
+
since: Optional[str] = None,
|
|
261
|
+
interval: float = 60.0,
|
|
262
|
+
max_polls: Optional[int] = None,
|
|
263
|
+
sleep=time.sleep,
|
|
264
|
+
) -> Iterator[Dict[str, Any]]:
|
|
265
|
+
"""Yield new tokens from the launches feed, oldest first, forever (or for
|
|
266
|
+
max_polls polls). Each poll costs one credit per page fetched. The feed is
|
|
267
|
+
refreshed every few minutes, so polling faster than once a minute mostly
|
|
268
|
+
buys empty pages."""
|
|
269
|
+
seen: Dict[str, None] = {}
|
|
270
|
+
polls = 0
|
|
271
|
+
while max_polls is None or polls < max_polls:
|
|
272
|
+
polls += 1
|
|
273
|
+
items: List[Dict[str, Any]] = []
|
|
274
|
+
cursor = None
|
|
275
|
+
while True:
|
|
276
|
+
try:
|
|
277
|
+
page = self.launches(since=since, cursor=cursor)
|
|
278
|
+
except RateLimited as e:
|
|
279
|
+
sleep(e.retry_after or interval)
|
|
280
|
+
break
|
|
281
|
+
items.extend(page.get("items") or [])
|
|
282
|
+
cursor = page.get("nextCursor")
|
|
283
|
+
if not cursor:
|
|
284
|
+
break
|
|
285
|
+
items.sort(key=lambda x: x.get("firstSeenAt") or "")
|
|
286
|
+
for item in items:
|
|
287
|
+
addr = item.get("address")
|
|
288
|
+
if not addr or addr in seen:
|
|
289
|
+
continue
|
|
290
|
+
seen[addr] = None
|
|
291
|
+
if len(seen) > 5000: # bounded memory
|
|
292
|
+
for old in list(seen)[:1000]:
|
|
293
|
+
del seen[old]
|
|
294
|
+
yield item
|
|
295
|
+
if items:
|
|
296
|
+
since = items[-1].get("firstSeenAt") or since
|
|
297
|
+
if max_polls is None or polls < max_polls:
|
|
298
|
+
sleep(interval)
|
|
File without changes
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import json
|
|
3
|
+
import urllib.error
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
import solana_launch_check.client as c
|
|
8
|
+
from solana_launch_check import Client, MissingKey, RateLimited, VeriqlError
|
|
9
|
+
from solana_launch_check.cli import main
|
|
10
|
+
|
|
11
|
+
MINT = "So1aNaMintAddre55Example111111111111111111pump"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class _Resp(io.BytesIO):
|
|
15
|
+
def __enter__(self):
|
|
16
|
+
return self
|
|
17
|
+
|
|
18
|
+
def __exit__(self, *a):
|
|
19
|
+
return False
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _ok(result):
|
|
23
|
+
return _Resp(json.dumps({"version": "1", "result": result}).encode())
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _http_error(status, body, headers=None):
|
|
27
|
+
return urllib.error.HTTPError("https://x", status, "err", headers or {}, io.BytesIO(json.dumps(body).encode()))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
LAUNCH = {
|
|
31
|
+
"found": True, "score": 40, "band": "caution", "inconclusive": False,
|
|
32
|
+
"summary": "Caution: real risks here.",
|
|
33
|
+
"drivers": [
|
|
34
|
+
{"label": "Top 10 wallets hold 93% of supply", "penalty": 42},
|
|
35
|
+
{"label": "24h volume is 79× liquidity, likely wash-traded", "penalty": 7},
|
|
36
|
+
],
|
|
37
|
+
}
|
|
38
|
+
DEPLOYER = {
|
|
39
|
+
"status": "read", "deployer": "Creator1111111111111111111111111111111111111",
|
|
40
|
+
"otherLaunches": 7, "outcomes": {"withdrawn": 1, "soldOff": 2, "unclassified": 0},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@pytest.fixture
|
|
45
|
+
def calls(monkeypatch):
|
|
46
|
+
log = []
|
|
47
|
+
queue = []
|
|
48
|
+
|
|
49
|
+
def fake(req, timeout=None):
|
|
50
|
+
log.append(req)
|
|
51
|
+
item = queue.pop(0)
|
|
52
|
+
if isinstance(item, Exception):
|
|
53
|
+
raise item
|
|
54
|
+
return item
|
|
55
|
+
|
|
56
|
+
monkeypatch.setattr(c, "_urlopen", fake)
|
|
57
|
+
return log, queue
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_missing_key(monkeypatch):
|
|
61
|
+
monkeypatch.delenv("VERIQL_API_KEY", raising=False)
|
|
62
|
+
with pytest.raises(MissingKey):
|
|
63
|
+
Client()
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def test_check_combines_launch_and_creator(calls):
|
|
67
|
+
log, queue = calls
|
|
68
|
+
queue += [_ok(LAUNCH), _ok(DEPLOYER)]
|
|
69
|
+
rep = Client("vq_live_test").check(MINT)
|
|
70
|
+
assert rep.score == 40 and rep.band == "caution"
|
|
71
|
+
assert rep.creator_other_launches == 7
|
|
72
|
+
assert rep.creator_collapse_count == 3
|
|
73
|
+
assert "79× liquidity" in rep.drivers[1][0] # mojibake repaired
|
|
74
|
+
assert log[0].full_url.endswith(f"launch?address={MINT}&chainId=solana")
|
|
75
|
+
assert log[1].full_url.endswith(f"deployer?address={MINT}")
|
|
76
|
+
assert log[0].headers["X-api-key"] == "vq_live_test"
|
|
77
|
+
reasons = rep.reasons_to_skip()
|
|
78
|
+
assert any("below your minimum of 60" in r for r in reasons)
|
|
79
|
+
assert any("3 measured liquidity collapse" in r for r in reasons)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_not_pumpfun_creator_is_not_a_reason(calls):
|
|
83
|
+
_, queue = calls
|
|
84
|
+
launch = dict(LAUNCH, score=90, band="good", drivers=[])
|
|
85
|
+
queue += [_ok(launch), _ok({"status": "not_pumpfun", "deployer": None, "otherLaunches": 0, "outcomes": {}})]
|
|
86
|
+
rep = Client("k").check(MINT)
|
|
87
|
+
assert rep.creator is None and rep.creator_status == "not_pumpfun"
|
|
88
|
+
assert rep.creator_other_launches is None
|
|
89
|
+
assert rep.reasons_to_skip() == []
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_unscored_is_a_reason_by_default(calls):
|
|
93
|
+
_, queue = calls
|
|
94
|
+
queue += [_ok(dict(LAUNCH, score=None, band="unknown", inconclusive=True, drivers=[]))]
|
|
95
|
+
rep = Client("k").check(MINT, with_creator=False)
|
|
96
|
+
assert rep.reasons_to_skip()[0].startswith("no score")
|
|
97
|
+
assert rep.reasons_to_skip(skip_unscored=False) == []
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_creator_launch_limit(calls):
|
|
101
|
+
_, queue = calls
|
|
102
|
+
queue += [_ok(dict(LAUNCH, score=80, drivers=[])), _ok(dict(DEPLOYER, outcomes={}))]
|
|
103
|
+
rep = Client("k").check(MINT)
|
|
104
|
+
assert rep.reasons_to_skip(max_creator_other_launches=5) == [
|
|
105
|
+
"creator has 7 other launches on record (your limit is 5)"
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_errors_map(calls):
|
|
110
|
+
_, queue = calls
|
|
111
|
+
queue += [_http_error(401, {"version": "1", "error": {"code": "unauthorized", "message": "Invalid or revoked API key."}})]
|
|
112
|
+
with pytest.raises(VeriqlError) as e:
|
|
113
|
+
Client("k").launch(MINT)
|
|
114
|
+
assert e.value.status == 401 and e.value.code == "unauthorized"
|
|
115
|
+
|
|
116
|
+
queue += [_http_error(402, {"x402Version": 2, "error": "No payment presented."})]
|
|
117
|
+
with pytest.raises(VeriqlError) as e:
|
|
118
|
+
Client("k").launch(MINT)
|
|
119
|
+
assert e.value.code == "payment_required" and "free key" in e.value.message
|
|
120
|
+
|
|
121
|
+
queue += [_http_error(429, {"error": {"code": "rate_limited", "message": "slow down"}}, {"Retry-After": "7"})]
|
|
122
|
+
with pytest.raises(RateLimited) as e:
|
|
123
|
+
Client("k").launch(MINT)
|
|
124
|
+
assert e.value.retry_after == 7.0
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_check_reraises_auth_errors_from_deployer(calls):
|
|
128
|
+
_, queue = calls
|
|
129
|
+
queue += [_ok(LAUNCH), _http_error(401, {"error": {"code": "unauthorized", "message": "x"}})]
|
|
130
|
+
with pytest.raises(VeriqlError):
|
|
131
|
+
Client("k").check(MINT)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def test_watch_dedupes_and_advances_since(calls):
|
|
135
|
+
log, queue = calls
|
|
136
|
+
a = {"address": "A", "firstSeenAt": "2026-11-30T00:00:00Z"}
|
|
137
|
+
b = {"address": "B", "firstSeenAt": "2026-11-30T00:05:00Z"}
|
|
138
|
+
d = {"address": "D", "firstSeenAt": "2026-11-30T00:10:00Z"}
|
|
139
|
+
queue += [
|
|
140
|
+
_ok({"items": [b, a], "nextCursor": None}),
|
|
141
|
+
_ok({"items": [d, b], "nextCursor": None}), # B repeats because since is inclusive
|
|
142
|
+
]
|
|
143
|
+
slept = []
|
|
144
|
+
got = list(Client("k").watch(interval=5, max_polls=2, sleep=slept.append))
|
|
145
|
+
assert [x["address"] for x in got] == ["A", "B", "D"]
|
|
146
|
+
assert "since=2026-11-30T00%3A05%3A00Z" in log[1].full_url
|
|
147
|
+
assert slept == [5]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def test_watch_follows_cursor(calls):
|
|
151
|
+
log, queue = calls
|
|
152
|
+
queue += [
|
|
153
|
+
_ok({"items": [{"address": "X", "firstSeenAt": "2026-11-30T00:01:00Z"}], "nextCursor": "c1"}),
|
|
154
|
+
_ok({"items": [{"address": "Y", "firstSeenAt": "2026-11-30T00:00:00Z"}], "nextCursor": None}),
|
|
155
|
+
]
|
|
156
|
+
got = list(Client("k").watch(max_polls=1, sleep=lambda s: None))
|
|
157
|
+
assert [x["address"] for x in got] == ["Y", "X"]
|
|
158
|
+
assert "cursor=c1" in log[1].full_url
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def test_cli_exit_codes(calls, monkeypatch, capsys):
|
|
162
|
+
_, queue = calls
|
|
163
|
+
monkeypatch.setenv("VERIQL_API_KEY", "k")
|
|
164
|
+
queue += [_ok(LAUNCH), _ok(DEPLOYER)]
|
|
165
|
+
assert main([MINT]) == 2
|
|
166
|
+
out = capsys.readouterr().out
|
|
167
|
+
assert "YOUR RULES TRIPPED" in out and "safe" not in out.lower()
|
|
168
|
+
queue += [_ok(dict(LAUNCH, score=95, drivers=[])), _ok(dict(DEPLOYER, outcomes={}))]
|
|
169
|
+
assert main([MINT, "--json"]) == 0
|
|
170
|
+
assert json.loads(capsys.readouterr().out)["reasonsToSkip"] == []
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def test_cli_missing_key(monkeypatch, capsys):
|
|
174
|
+
monkeypatch.delenv("VERIQL_API_KEY", raising=False)
|
|
175
|
+
assert main([MINT]) == 1
|
|
176
|
+
assert "checkout?pack=free" in capsys.readouterr().err
|