x402-trinity 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,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: x402-trinity
3
+ Version: 0.1.0
4
+ Summary: Zero-dependency, Python standard-library-only execution core for machine-to-machine x402 payment handshakes.
5
+ Author: devmster
6
+ Maintainer: devmster
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/devmster/x402-trinity
9
+ Project-URL: Repository, https://github.com/devmster/x402-trinity
10
+ Project-URL: Issues, https://github.com/devmster/x402-trinity/issues
11
+ Keywords: x402,http-402,ai-agent,robotics-commerce,embedded-crypto,stdlib-only,gasless-transfer,eip-3009,constant-time-signing
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Security :: Cryptography
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+
22
+ # x402-trinity
23
+
24
+ **Let a Python process pay for things by itself — with hard spending limits, no hosted wallet
25
+ service, and no changes to the code doing the fetching.**
26
+
27
+ Standard library only. No dependencies, at all.
28
+
29
+ ```bash
30
+ pip install x402-trinity
31
+ ```
32
+
33
+ ## Why
34
+
35
+ When a script hits a paid resource it gets `402 Payment Required`. Without something to handle
36
+ that, the request simply fails.
37
+
38
+ x402-trinity handles it: reads the challenge, checks it against limits you set, signs, retries.
39
+ All of it locally — no hosted wallet service, no third-party API, and the key never leaves your
40
+ process.
41
+
42
+ Gas exists but the payer doesn't pay it — under EIP-3009 the facilitator submits the transfer,
43
+ so the wallet only ever needs USDC.
44
+
45
+ ## Use
46
+
47
+ ```python
48
+ import os
49
+ from x402_trinity import X402Client, Policy
50
+
51
+ client = X402Client(
52
+ private_key=os.environ["X402_PRIVATE_KEY"],
53
+ policy=Policy(
54
+ max_amount_per_request=5000, # 0.005 USDC per call (REQUIRED)
55
+ total_budget=1_000_000, # 1.00 USDC lifetime (REQUIRED)
56
+ allow_hosts=["api.example.com"],
57
+ ),
58
+ )
59
+
60
+ body = client.urlopen("https://api.example.com/data").read()
61
+ ```
62
+
63
+ Or as a decorator, so payment-unaware code just works:
64
+
65
+ ```python
66
+ from x402_trinity import x402_telemetry, Policy
67
+
68
+ @x402_telemetry(private_key=KEY, policy=Policy(max_amount_per_request=5000,
69
+ total_budget=1_000_000))
70
+ def harvest():
71
+ return urllib.request.urlopen("https://sensor.local/v1/lidar").read()
72
+ ```
73
+
74
+ Inside the decorated function `urllib.request.urlopen` pays 402s automatically. Existing code
75
+ is untouched.
76
+
77
+ ## Scope
78
+
79
+ **Buyer only.** To charge for a resource, use the TypeScript seller in the same project.
80
+
81
+ **Base mainnet + USDC.** Other EVM chains work by passing `custom_chains` to `X402Client`.
82
+ Check any entry against the deployed contract first: call `DOMAIN_SEPARATOR()` and confirm it
83
+ equals what this library computes. A wrong `name` or `version` produces a signature that looks
84
+ valid and the contract rejects.
85
+
86
+ ## Limits are not optional
87
+
88
+ `max_amount_per_request` and `total_budget` are required arguments. An auto-payer without caps
89
+ is a money leak controlled by whoever runs the server on the other end. Set `allow_hosts` and
90
+ nothing else can be paid, however convincing the challenge looks.
91
+
92
+ ## Before you use it with real money
93
+
94
+ This software signs payment authorizations. You are responsible for the funds in any wallet you
95
+ configure it with, for the limits you set, and for the behaviour of any autonomous process you
96
+ connect to it. Use a dedicated wallet holding only what you would accept losing.
97
+
98
+ ## Links
99
+
100
+ - Source: https://github.com/devmster/x402-trinity
101
+ - TypeScript package (buyer, seller, MCP server): `npm install x402-trinity`
102
+
103
+ MIT
@@ -0,0 +1,82 @@
1
+ # x402-trinity
2
+
3
+ **Let a Python process pay for things by itself — with hard spending limits, no hosted wallet
4
+ service, and no changes to the code doing the fetching.**
5
+
6
+ Standard library only. No dependencies, at all.
7
+
8
+ ```bash
9
+ pip install x402-trinity
10
+ ```
11
+
12
+ ## Why
13
+
14
+ When a script hits a paid resource it gets `402 Payment Required`. Without something to handle
15
+ that, the request simply fails.
16
+
17
+ x402-trinity handles it: reads the challenge, checks it against limits you set, signs, retries.
18
+ All of it locally — no hosted wallet service, no third-party API, and the key never leaves your
19
+ process.
20
+
21
+ Gas exists but the payer doesn't pay it — under EIP-3009 the facilitator submits the transfer,
22
+ so the wallet only ever needs USDC.
23
+
24
+ ## Use
25
+
26
+ ```python
27
+ import os
28
+ from x402_trinity import X402Client, Policy
29
+
30
+ client = X402Client(
31
+ private_key=os.environ["X402_PRIVATE_KEY"],
32
+ policy=Policy(
33
+ max_amount_per_request=5000, # 0.005 USDC per call (REQUIRED)
34
+ total_budget=1_000_000, # 1.00 USDC lifetime (REQUIRED)
35
+ allow_hosts=["api.example.com"],
36
+ ),
37
+ )
38
+
39
+ body = client.urlopen("https://api.example.com/data").read()
40
+ ```
41
+
42
+ Or as a decorator, so payment-unaware code just works:
43
+
44
+ ```python
45
+ from x402_trinity import x402_telemetry, Policy
46
+
47
+ @x402_telemetry(private_key=KEY, policy=Policy(max_amount_per_request=5000,
48
+ total_budget=1_000_000))
49
+ def harvest():
50
+ return urllib.request.urlopen("https://sensor.local/v1/lidar").read()
51
+ ```
52
+
53
+ Inside the decorated function `urllib.request.urlopen` pays 402s automatically. Existing code
54
+ is untouched.
55
+
56
+ ## Scope
57
+
58
+ **Buyer only.** To charge for a resource, use the TypeScript seller in the same project.
59
+
60
+ **Base mainnet + USDC.** Other EVM chains work by passing `custom_chains` to `X402Client`.
61
+ Check any entry against the deployed contract first: call `DOMAIN_SEPARATOR()` and confirm it
62
+ equals what this library computes. A wrong `name` or `version` produces a signature that looks
63
+ valid and the contract rejects.
64
+
65
+ ## Limits are not optional
66
+
67
+ `max_amount_per_request` and `total_budget` are required arguments. An auto-payer without caps
68
+ is a money leak controlled by whoever runs the server on the other end. Set `allow_hosts` and
69
+ nothing else can be paid, however convincing the challenge looks.
70
+
71
+ ## Before you use it with real money
72
+
73
+ This software signs payment authorizations. You are responsible for the funds in any wallet you
74
+ configure it with, for the limits you set, and for the behaviour of any autonomous process you
75
+ connect to it. Use a dedicated wallet holding only what you would accept losing.
76
+
77
+ ## Links
78
+
79
+ - Source: https://github.com/devmster/x402-trinity
80
+ - TypeScript package (buyer, seller, MCP server): `npm install x402-trinity`
81
+
82
+ MIT
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "x402-trinity"
7
+ version = "0.1.0"
8
+ description = "Zero-dependency, Python standard-library-only execution core for machine-to-machine x402 payment handshakes."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "devmster" }]
13
+ maintainers = [{ name = "devmster" }]
14
+ keywords = [
15
+ "x402",
16
+ "http-402",
17
+ "ai-agent",
18
+ "robotics-commerce",
19
+ "embedded-crypto",
20
+ "stdlib-only",
21
+ "gasless-transfer",
22
+ "eip-3009",
23
+ "constant-time-signing",
24
+ ]
25
+ classifiers = [
26
+ "Development Status :: 3 - Alpha",
27
+ "Intended Audience :: Developers",
28
+ "License :: OSI Approved :: MIT License",
29
+ "Programming Language :: Python :: 3",
30
+ "Operating System :: OS Independent",
31
+ "Topic :: Software Development :: Libraries :: Python Modules",
32
+ "Topic :: Security :: Cryptography",
33
+ ]
34
+ dependencies = [] # stdlib only, by design
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/devmster/x402-trinity"
38
+ Repository = "https://github.com/devmster/x402-trinity"
39
+ Issues = "https://github.com/devmster/x402-trinity/issues"
40
+
41
+ [tool.setuptools]
42
+ packages = ["x402_trinity"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+