crewai-x402bazaar 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.
@@ -0,0 +1,9 @@
1
+ node_modules/
2
+ dist/
3
+ __pycache__/
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+ *.tgz
8
+ .venv/
9
+ .eliza-probe/
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.5
2
+ Name: crewai-x402bazaar
3
+ Version: 0.1.0
4
+ Summary: CrewAI tool for x402 Bazaar — pre-trade token-verdict (SAFE/CAUTION/AVOID) for any Base token, paid per call over x402.
5
+ Project-URL: Homepage, https://402.com.tr
6
+ Project-URL: Repository, https://github.com/sukrutkrdg/x402-bazaar-plugins
7
+ Author-email: x402 Bazaar <sukrutkrdg@gmail.com>
8
+ License: MIT
9
+ Keywords: ai-agents,base,crewai,honeypot,rug,token-safety,token-verdict,usdc,x402
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: crewai>=0.70.0
12
+ Requires-Dist: pydantic>=2.0.0
13
+ Requires-Dist: requests>=2.31.0
14
+ Provides-Extra: pay
15
+ Requires-Dist: eth-account>=0.11.0; extra == 'pay'
16
+ Requires-Dist: x402>=0.1.0; extra == 'pay'
17
+ Description-Content-Type: text/markdown
18
+
19
+ # crewai-x402bazaar
20
+
21
+ A [CrewAI](https://www.crewai.com) tool for [x402 Bazaar](https://402.com.tr) — a
22
+ **pre-trade token safety verdict** for any Base ERC-20.
23
+
24
+ `TokenVerdictTool` returns one **SAFE / CAUTION / AVOID / UNKNOWN** answer with
25
+ the reasons behind it and a recommended max position size, distilling the full
26
+ pre-trade stack (honeypot, sell-tax, owner powers, exit-liquidity, deployer, B20
27
+ seize/freeze). Paid per call over [x402](https://x402.org) ($0.03 USDC on Base),
28
+ or **1 free call/day per IP** — no wallet needed to start.
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ pip install crewai-x402bazaar
34
+ # optional, to pay per call with your own wallet instead of the free tier:
35
+ pip install "crewai-x402bazaar[pay]"
36
+ ```
37
+
38
+ ## Use
39
+
40
+ ```python
41
+ from crewai import Agent
42
+ from crewai_x402bazaar import TokenVerdictTool
43
+
44
+ analyst = Agent(
45
+ role="Token safety analyst",
46
+ goal="Never let the crew buy a Base token that fails a pre-trade check.",
47
+ tools=[TokenVerdictTool()],
48
+ )
49
+ ```
50
+
51
+ ### Paying per call
52
+
53
+ ```bash
54
+ export X402_EVM_PRIVATE_KEY=0x... # funded USDC on Base
55
+ pip install "crewai-x402bazaar[pay]"
56
+ ```
57
+
58
+ When present, each call pays $0.03 USDC over x402; otherwise the tool uses the
59
+ free daily call.
60
+
61
+ Part of [x402 Bazaar](https://402.com.tr) — 230+ pay-per-call APIs for AI agents on Base + NEAR. MIT licensed.
@@ -0,0 +1,43 @@
1
+ # crewai-x402bazaar
2
+
3
+ A [CrewAI](https://www.crewai.com) tool for [x402 Bazaar](https://402.com.tr) — a
4
+ **pre-trade token safety verdict** for any Base ERC-20.
5
+
6
+ `TokenVerdictTool` returns one **SAFE / CAUTION / AVOID / UNKNOWN** answer with
7
+ the reasons behind it and a recommended max position size, distilling the full
8
+ pre-trade stack (honeypot, sell-tax, owner powers, exit-liquidity, deployer, B20
9
+ seize/freeze). Paid per call over [x402](https://x402.org) ($0.03 USDC on Base),
10
+ or **1 free call/day per IP** — no wallet needed to start.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pip install crewai-x402bazaar
16
+ # optional, to pay per call with your own wallet instead of the free tier:
17
+ pip install "crewai-x402bazaar[pay]"
18
+ ```
19
+
20
+ ## Use
21
+
22
+ ```python
23
+ from crewai import Agent
24
+ from crewai_x402bazaar import TokenVerdictTool
25
+
26
+ analyst = Agent(
27
+ role="Token safety analyst",
28
+ goal="Never let the crew buy a Base token that fails a pre-trade check.",
29
+ tools=[TokenVerdictTool()],
30
+ )
31
+ ```
32
+
33
+ ### Paying per call
34
+
35
+ ```bash
36
+ export X402_EVM_PRIVATE_KEY=0x... # funded USDC on Base
37
+ pip install "crewai-x402bazaar[pay]"
38
+ ```
39
+
40
+ When present, each call pays $0.03 USDC over x402; otherwise the tool uses the
41
+ free daily call.
42
+
43
+ Part of [x402 Bazaar](https://402.com.tr) — 230+ pay-per-call APIs for AI agents on Base + NEAR. MIT licensed.
@@ -0,0 +1,4 @@
1
+ from .tool import TokenVerdictTool, TokenVerdictInput
2
+
3
+ __all__ = ["TokenVerdictTool", "TokenVerdictInput"]
4
+ __version__ = "0.1.0"
@@ -0,0 +1,95 @@
1
+ """CrewAI tool for x402 Bazaar — token-verdict pre-trade safety check.
2
+
3
+ Works with no wallet by default (1 free call/day per IP). When a funded EVM
4
+ wallet is configured (env ``X402_EVM_PRIVATE_KEY`` and the optional ``pay`` extra
5
+ installed), it pays $0.03 USDC per call over x402 on Base instead.
6
+ """
7
+
8
+ import os
9
+ from typing import Optional, Type
10
+
11
+ import requests
12
+ from pydantic import BaseModel, Field
13
+ from crewai.tools import BaseTool
14
+
15
+ TOKEN_VERDICT_URL = "https://402.com.tr/api/x402/token-verdict"
16
+ BASE_CHAIN = "eip155:8453"
17
+ USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
18
+
19
+
20
+ class TokenVerdictInput(BaseModel):
21
+ address: str = Field(
22
+ ...,
23
+ pattern=r"^0x[a-fA-F0-9]{40}$",
24
+ description="Base ERC-20 token address (0x + 40 hex chars).",
25
+ )
26
+ amount_usd: Optional[float] = Field(
27
+ None,
28
+ description="Intended trade size in USD; tunes the recommended max safe size.",
29
+ )
30
+
31
+
32
+ def _paid_session():
33
+ """x402-paying requests session if a funded wallet is configured, else None.
34
+
35
+ The x402 Python client API has drifted across versions, so this imports
36
+ defensively and returns None on any mismatch — the free tier keeps the tool
37
+ usable regardless.
38
+ """
39
+ pk = os.getenv("X402_EVM_PRIVATE_KEY")
40
+ if not pk:
41
+ return None
42
+ try:
43
+ from eth_account import Account # type: ignore
44
+ from x402.clients import x402Client # type: ignore
45
+ from x402.http.clients import x402_requests # type: ignore
46
+ from x402.mechanisms.evm import EthAccountSigner # type: ignore
47
+ from x402.mechanisms.evm.exact.register import register_exact_evm_client # type: ignore
48
+
49
+ client = x402Client()
50
+ register_exact_evm_client(client, EthAccountSigner(Account.from_key(pk)))
51
+ return x402_requests(client)
52
+ except Exception:
53
+ return None
54
+
55
+
56
+ class TokenVerdictTool(BaseTool):
57
+ name: str = "token_verdict"
58
+ description: str = (
59
+ "Pre-trade safety check for a Base (eip155:8453) ERC-20 token before buying "
60
+ "or approving it. Returns a SAFE / CAUTION / AVOID / UNKNOWN verdict with "
61
+ "confidence, the reasons behind it, and a recommended max position size "
62
+ "(honeypot, sell-tax, owner powers, exit-liquidity, B20 seize/freeze). "
63
+ "Powered by x402 Bazaar: $0.03 USDC/call over x402, or 1 free call/day per IP."
64
+ )
65
+ args_schema: Type[BaseModel] = TokenVerdictInput
66
+
67
+ def _run(self, address: str, amount_usd: Optional[float] = None) -> dict:
68
+ params: dict = {"address": address}
69
+ if amount_usd is not None:
70
+ params["amountUsd"] = amount_usd
71
+
72
+ session = _paid_session()
73
+ try:
74
+ if session is not None:
75
+ with session as s:
76
+ r = s.get(TOKEN_VERDICT_URL, params=params, timeout=40)
77
+ else:
78
+ params["free"] = "1"
79
+ r = requests.get(TOKEN_VERDICT_URL, params=params, timeout=40)
80
+ except Exception as e:
81
+ return {"error": "request_failed", "message": str(e)}
82
+
83
+ if r.status_code == 402:
84
+ return {
85
+ "error": "payment_required",
86
+ "chain": BASE_CHAIN,
87
+ "asset": USDC_BASE,
88
+ "message": (
89
+ "Set X402_EVM_PRIVATE_KEY (funded USDC on Base) and install the "
90
+ "`pay` extra to pay, or omit for the free daily call."
91
+ ),
92
+ }
93
+ r.raise_for_status()
94
+ body = r.json()
95
+ return body.get("data", body) if isinstance(body, dict) else body
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "crewai-x402bazaar"
7
+ version = "0.1.0"
8
+ description = "CrewAI tool for x402 Bazaar — pre-trade token-verdict (SAFE/CAUTION/AVOID) for any Base token, paid per call over x402."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "x402 Bazaar", email = "sukrutkrdg@gmail.com" }]
13
+ keywords = ["x402", "crewai", "base", "token-safety", "honeypot", "rug", "token-verdict", "ai-agents", "usdc"]
14
+ dependencies = ["crewai>=0.70.0", "requests>=2.31.0", "pydantic>=2.0.0"]
15
+
16
+ [project.optional-dependencies]
17
+ pay = ["x402>=0.1.0", "eth-account>=0.11.0"]
18
+
19
+ [project.urls]
20
+ Homepage = "https://402.com.tr"
21
+ Repository = "https://github.com/sukrutkrdg/x402-bazaar-plugins"
22
+
23
+ [tool.hatch.build.targets.wheel]
24
+ packages = ["crewai_x402bazaar"]