whitemagic-pay 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.
- whitemagic_pay-0.1.0/PKG-INFO +97 -0
- whitemagic_pay-0.1.0/README.md +82 -0
- whitemagic_pay-0.1.0/pyproject.toml +33 -0
- whitemagic_pay-0.1.0/setup.cfg +4 -0
- whitemagic_pay-0.1.0/whitemagic_pay.egg-info/PKG-INFO +97 -0
- whitemagic_pay-0.1.0/whitemagic_pay.egg-info/SOURCES.txt +8 -0
- whitemagic_pay-0.1.0/whitemagic_pay.egg-info/dependency_links.txt +1 -0
- whitemagic_pay-0.1.0/whitemagic_pay.egg-info/entry_points.txt +2 -0
- whitemagic_pay-0.1.0/whitemagic_pay.egg-info/requires.txt +3 -0
- whitemagic_pay-0.1.0/whitemagic_pay.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: whitemagic-pay
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Autonomous x402 payment client, session pass caching, and context notarization SDK for AI agents.
|
|
5
|
+
Author-email: WhiteMagic Labs <contact@whitemagic.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: x402,agent,payments,usdc,base,whitemagic,eip-3009,notarization
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Provides-Extra: signing
|
|
14
|
+
Requires-Dist: eth-account>=0.11.0; extra == "signing"
|
|
15
|
+
|
|
16
|
+
# whitemagic-pay
|
|
17
|
+
|
|
18
|
+
Autonomous machine payment client, session lease caching, and cryptographic Proof-of-Context notarization for AI agents.
|
|
19
|
+
|
|
20
|
+
Zero mandatory dependencies (uses standard library `urllib`, `json`, `hmac`). Optional `eth-account` dependency enables autonomous EIP-3009 gasless permit signing on Base mainnet.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 🚀 Quickstart
|
|
25
|
+
|
|
26
|
+
### 1. Free Onboarding (No Wallet, No API Key)
|
|
27
|
+
Ephemeral agents can claim an instant 10-minute trial session pass (`10,000 RPM`) via the faucet:
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from whitemagic_pay import X402Client
|
|
31
|
+
|
|
32
|
+
client = X402Client()
|
|
33
|
+
# Dispenses a 10-minute pass (1/day per IP/address)
|
|
34
|
+
faucet_data = client.claim_faucet("https://mcp.whitemagic.dev")
|
|
35
|
+
print("Session pass acquired:", client.cached_pass)
|
|
36
|
+
|
|
37
|
+
# Subsequent calls automatically reuse the pass with zero latency
|
|
38
|
+
status, data, headers = client.request(
|
|
39
|
+
"POST",
|
|
40
|
+
"https://mcp.whitemagic.dev/mcp",
|
|
41
|
+
data={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "memory.search", "arguments": {"query": "context continuity"}}}
|
|
42
|
+
)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Autonomous Multi-Tier Micro-Leases (x402 / Base)
|
|
46
|
+
When operating autonomously with a funded wallet, `X402Client` automatically negotiates HTTP 402 challenges, signs EIP-3009 gasless permits on Base, and caches the returned lease:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
client = X402Client(
|
|
50
|
+
private_key="0x...",
|
|
51
|
+
preferred_tier="call" # Options: "call" ($0.002), "task" ($0.01), "swarm" ($0.05), "day" ($0.50)
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Negotiates 402, settles on Base, acquires session lease, and executes tool call
|
|
55
|
+
status, result, headers = client.request("POST", "https://mcp.whitemagic.dev/mcp", data={...})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Multi-Tier Pricing Menu
|
|
59
|
+
| Tier | Price (USDC) | Atomic Units | Duration | Best For |
|
|
60
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
61
|
+
| **`call`** | **$0.002** | 2,000 | 60s (1 min) | Single tool invocation, health probe, sanity check |
|
|
62
|
+
| **`task`** | **$0.010** | 10,000 | 300s (5 min) | Standard multi-step reasoning task |
|
|
63
|
+
| **`swarm`** | **$0.050** | 50,000 | 900s (15 min) | Multi-agent swarm coordination, deep research |
|
|
64
|
+
| **`day`** | **$0.500** | 500,000 | 86,400s (24h) | Continuous production agent worker |
|
|
65
|
+
|
|
66
|
+
### 3. Cryptographic Proof-of-Context Notarization
|
|
67
|
+
Attest to an agent's reasoning trace, prompt, and action at a tamper-proof UTC timestamp signed with Ed25519:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
receipt = client.notarize_context(
|
|
71
|
+
base_url="https://api.whitemagic.dev",
|
|
72
|
+
context_digest="sha256:b10b001a2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7",
|
|
73
|
+
action="agent.decision",
|
|
74
|
+
model="gemini-2.5-flash",
|
|
75
|
+
metadata={"epoch": 1, "converged": True}
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
print("Notarized digest:", receipt["digest"])
|
|
79
|
+
print("Lookup URL:", receipt["lookup_url"])
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Anyone can verify the attestation completely offline using the issuer's public key (`did:key:...`).
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 🛠️ CLI Usage
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Claim trial session pass
|
|
90
|
+
python -m whitemagic_pay.cli faucet --url https://mcp.whitemagic.dev
|
|
91
|
+
|
|
92
|
+
# Notarize context
|
|
93
|
+
python -m whitemagic_pay.cli notarize --digest 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef --action "agent.step"
|
|
94
|
+
|
|
95
|
+
# Probe live endpoint
|
|
96
|
+
python -m whitemagic_pay.cli probe https://mcp.whitemagic.dev/mcp --tier call --query "continuity"
|
|
97
|
+
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# whitemagic-pay
|
|
2
|
+
|
|
3
|
+
Autonomous machine payment client, session lease caching, and cryptographic Proof-of-Context notarization for AI agents.
|
|
4
|
+
|
|
5
|
+
Zero mandatory dependencies (uses standard library `urllib`, `json`, `hmac`). Optional `eth-account` dependency enables autonomous EIP-3009 gasless permit signing on Base mainnet.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Quickstart
|
|
10
|
+
|
|
11
|
+
### 1. Free Onboarding (No Wallet, No API Key)
|
|
12
|
+
Ephemeral agents can claim an instant 10-minute trial session pass (`10,000 RPM`) via the faucet:
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from whitemagic_pay import X402Client
|
|
16
|
+
|
|
17
|
+
client = X402Client()
|
|
18
|
+
# Dispenses a 10-minute pass (1/day per IP/address)
|
|
19
|
+
faucet_data = client.claim_faucet("https://mcp.whitemagic.dev")
|
|
20
|
+
print("Session pass acquired:", client.cached_pass)
|
|
21
|
+
|
|
22
|
+
# Subsequent calls automatically reuse the pass with zero latency
|
|
23
|
+
status, data, headers = client.request(
|
|
24
|
+
"POST",
|
|
25
|
+
"https://mcp.whitemagic.dev/mcp",
|
|
26
|
+
data={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "memory.search", "arguments": {"query": "context continuity"}}}
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2. Autonomous Multi-Tier Micro-Leases (x402 / Base)
|
|
31
|
+
When operating autonomously with a funded wallet, `X402Client` automatically negotiates HTTP 402 challenges, signs EIP-3009 gasless permits on Base, and caches the returned lease:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
client = X402Client(
|
|
35
|
+
private_key="0x...",
|
|
36
|
+
preferred_tier="call" # Options: "call" ($0.002), "task" ($0.01), "swarm" ($0.05), "day" ($0.50)
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Negotiates 402, settles on Base, acquires session lease, and executes tool call
|
|
40
|
+
status, result, headers = client.request("POST", "https://mcp.whitemagic.dev/mcp", data={...})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Multi-Tier Pricing Menu
|
|
44
|
+
| Tier | Price (USDC) | Atomic Units | Duration | Best For |
|
|
45
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
46
|
+
| **`call`** | **$0.002** | 2,000 | 60s (1 min) | Single tool invocation, health probe, sanity check |
|
|
47
|
+
| **`task`** | **$0.010** | 10,000 | 300s (5 min) | Standard multi-step reasoning task |
|
|
48
|
+
| **`swarm`** | **$0.050** | 50,000 | 900s (15 min) | Multi-agent swarm coordination, deep research |
|
|
49
|
+
| **`day`** | **$0.500** | 500,000 | 86,400s (24h) | Continuous production agent worker |
|
|
50
|
+
|
|
51
|
+
### 3. Cryptographic Proof-of-Context Notarization
|
|
52
|
+
Attest to an agent's reasoning trace, prompt, and action at a tamper-proof UTC timestamp signed with Ed25519:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
receipt = client.notarize_context(
|
|
56
|
+
base_url="https://api.whitemagic.dev",
|
|
57
|
+
context_digest="sha256:b10b001a2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7",
|
|
58
|
+
action="agent.decision",
|
|
59
|
+
model="gemini-2.5-flash",
|
|
60
|
+
metadata={"epoch": 1, "converged": True}
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
print("Notarized digest:", receipt["digest"])
|
|
64
|
+
print("Lookup URL:", receipt["lookup_url"])
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Anyone can verify the attestation completely offline using the issuer's public key (`did:key:...`).
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 🛠️ CLI Usage
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Claim trial session pass
|
|
75
|
+
python -m whitemagic_pay.cli faucet --url https://mcp.whitemagic.dev
|
|
76
|
+
|
|
77
|
+
# Notarize context
|
|
78
|
+
python -m whitemagic_pay.cli notarize --digest 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef --action "agent.step"
|
|
79
|
+
|
|
80
|
+
# Probe live endpoint
|
|
81
|
+
python -m whitemagic_pay.cli probe https://mcp.whitemagic.dev/mcp --tier call --query "continuity"
|
|
82
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "whitemagic-pay"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Autonomous x402 payment client, session pass caching, and context notarization SDK for AI agents."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "WhiteMagic Labs", email = "contact@whitemagic.dev"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["x402", "agent", "payments", "usdc", "base", "whitemagic", "eip-3009", "notarization"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
20
|
+
]
|
|
21
|
+
dependencies = []
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
signing = [
|
|
25
|
+
"eth-account>=0.11.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
whitemagic-pay = "whitemagic_pay.cli:main"
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.packages.find]
|
|
32
|
+
where = ["."]
|
|
33
|
+
include = ["whitemagic_pay*"]
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: whitemagic-pay
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Autonomous x402 payment client, session pass caching, and context notarization SDK for AI agents.
|
|
5
|
+
Author-email: WhiteMagic Labs <contact@whitemagic.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: x402,agent,payments,usdc,base,whitemagic,eip-3009,notarization
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Provides-Extra: signing
|
|
14
|
+
Requires-Dist: eth-account>=0.11.0; extra == "signing"
|
|
15
|
+
|
|
16
|
+
# whitemagic-pay
|
|
17
|
+
|
|
18
|
+
Autonomous machine payment client, session lease caching, and cryptographic Proof-of-Context notarization for AI agents.
|
|
19
|
+
|
|
20
|
+
Zero mandatory dependencies (uses standard library `urllib`, `json`, `hmac`). Optional `eth-account` dependency enables autonomous EIP-3009 gasless permit signing on Base mainnet.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 🚀 Quickstart
|
|
25
|
+
|
|
26
|
+
### 1. Free Onboarding (No Wallet, No API Key)
|
|
27
|
+
Ephemeral agents can claim an instant 10-minute trial session pass (`10,000 RPM`) via the faucet:
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from whitemagic_pay import X402Client
|
|
31
|
+
|
|
32
|
+
client = X402Client()
|
|
33
|
+
# Dispenses a 10-minute pass (1/day per IP/address)
|
|
34
|
+
faucet_data = client.claim_faucet("https://mcp.whitemagic.dev")
|
|
35
|
+
print("Session pass acquired:", client.cached_pass)
|
|
36
|
+
|
|
37
|
+
# Subsequent calls automatically reuse the pass with zero latency
|
|
38
|
+
status, data, headers = client.request(
|
|
39
|
+
"POST",
|
|
40
|
+
"https://mcp.whitemagic.dev/mcp",
|
|
41
|
+
data={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "memory.search", "arguments": {"query": "context continuity"}}}
|
|
42
|
+
)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Autonomous Multi-Tier Micro-Leases (x402 / Base)
|
|
46
|
+
When operating autonomously with a funded wallet, `X402Client` automatically negotiates HTTP 402 challenges, signs EIP-3009 gasless permits on Base, and caches the returned lease:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
client = X402Client(
|
|
50
|
+
private_key="0x...",
|
|
51
|
+
preferred_tier="call" # Options: "call" ($0.002), "task" ($0.01), "swarm" ($0.05), "day" ($0.50)
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Negotiates 402, settles on Base, acquires session lease, and executes tool call
|
|
55
|
+
status, result, headers = client.request("POST", "https://mcp.whitemagic.dev/mcp", data={...})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Multi-Tier Pricing Menu
|
|
59
|
+
| Tier | Price (USDC) | Atomic Units | Duration | Best For |
|
|
60
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
61
|
+
| **`call`** | **$0.002** | 2,000 | 60s (1 min) | Single tool invocation, health probe, sanity check |
|
|
62
|
+
| **`task`** | **$0.010** | 10,000 | 300s (5 min) | Standard multi-step reasoning task |
|
|
63
|
+
| **`swarm`** | **$0.050** | 50,000 | 900s (15 min) | Multi-agent swarm coordination, deep research |
|
|
64
|
+
| **`day`** | **$0.500** | 500,000 | 86,400s (24h) | Continuous production agent worker |
|
|
65
|
+
|
|
66
|
+
### 3. Cryptographic Proof-of-Context Notarization
|
|
67
|
+
Attest to an agent's reasoning trace, prompt, and action at a tamper-proof UTC timestamp signed with Ed25519:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
receipt = client.notarize_context(
|
|
71
|
+
base_url="https://api.whitemagic.dev",
|
|
72
|
+
context_digest="sha256:b10b001a2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7",
|
|
73
|
+
action="agent.decision",
|
|
74
|
+
model="gemini-2.5-flash",
|
|
75
|
+
metadata={"epoch": 1, "converged": True}
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
print("Notarized digest:", receipt["digest"])
|
|
79
|
+
print("Lookup URL:", receipt["lookup_url"])
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Anyone can verify the attestation completely offline using the issuer's public key (`did:key:...`).
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 🛠️ CLI Usage
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Claim trial session pass
|
|
90
|
+
python -m whitemagic_pay.cli faucet --url https://mcp.whitemagic.dev
|
|
91
|
+
|
|
92
|
+
# Notarize context
|
|
93
|
+
python -m whitemagic_pay.cli notarize --digest 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef --action "agent.step"
|
|
94
|
+
|
|
95
|
+
# Probe live endpoint
|
|
96
|
+
python -m whitemagic_pay.cli probe https://mcp.whitemagic.dev/mcp --tier call --query "continuity"
|
|
97
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
whitemagic_pay.egg-info/PKG-INFO
|
|
4
|
+
whitemagic_pay.egg-info/SOURCES.txt
|
|
5
|
+
whitemagic_pay.egg-info/dependency_links.txt
|
|
6
|
+
whitemagic_pay.egg-info/entry_points.txt
|
|
7
|
+
whitemagic_pay.egg-info/requires.txt
|
|
8
|
+
whitemagic_pay.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|