arkhai-core-storefront-client 0.15.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,223 @@
1
+ .vscode/
2
+
3
+ # Project-local scratch files, private notes, and generated diagnostics.
4
+ .scm-local/
5
+
6
+ # Visible transfer staging for snap-confined tools such as Multipass.
7
+ scm-clean-room-transfer/
8
+
9
+ # Legacy local rehearsal params (private keys, RPC URLs, etc.).
10
+ .rehearsal-params.local.md
11
+ .rehearsal-params.local.*
12
+
13
+ ### Python ###
14
+ # Byte-compiled / optimized / DLL files
15
+ __pycache__/
16
+ *.py[cod]
17
+ *$py.class
18
+
19
+ # C extensions
20
+ *.so
21
+
22
+ # Distribution / packaging
23
+ .Python
24
+ build/
25
+ develop-eggs/
26
+ dist/
27
+ downloads/
28
+ eggs/
29
+ .eggs/
30
+ lib/
31
+ lib64/
32
+ parts/
33
+ sdist/
34
+ var/
35
+ wheels/
36
+ share/python-wheels/
37
+ *.egg-info/
38
+ .installed.cfg
39
+ *.egg
40
+ MANIFEST
41
+
42
+ # PyInstaller
43
+ # Usually these files are written by a python script from a template
44
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
45
+ *.manifest
46
+ *.spec
47
+
48
+ # Installer logs
49
+ pip-log.txt
50
+ pip-delete-this-directory.txt
51
+
52
+ # Unit test / coverage reports
53
+ htmlcov/
54
+ .tox/
55
+ .nox/
56
+ .coverage
57
+ .coverage.*
58
+ .cache
59
+ nosetests.xml
60
+ coverage.xml
61
+ *.cover
62
+ *.py,cover
63
+ .hypothesis/
64
+ .pytest_cache/
65
+ cover/
66
+
67
+ # Translations
68
+ *.mo
69
+ *.pot
70
+
71
+ # Django stuff:
72
+ *.log
73
+ *.log.[0-9]*
74
+ local_settings.py
75
+ db.sqlite3
76
+ db.sqlite3-journal
77
+
78
+ # Flask stuff:
79
+ instance/
80
+ .webassets-cache
81
+
82
+ # Scrapy stuff:
83
+ .scrapy
84
+
85
+ # Sphinx documentation
86
+ docs/_build/
87
+
88
+ # PyBuilder
89
+ .pybuilder/
90
+ target/
91
+
92
+ # Jupyter Notebook
93
+ .ipynb_checkpoints
94
+
95
+ # IPython
96
+ profile_default/
97
+ ipython_config.py
98
+
99
+ # pyenv
100
+ # For a library or package, you might want to ignore these files since the code is
101
+ # intended to run in multiple environments; otherwise, check them in:
102
+ # .python-version
103
+
104
+ # pipenv
105
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
106
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
107
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
108
+ # install all needed dependencies.
109
+ #Pipfile.lock
110
+
111
+ # poetry
112
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
113
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
114
+ # commonly ignored for libraries.
115
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
116
+ #poetry.lock
117
+
118
+ # pdm
119
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
120
+ #pdm.lock
121
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
122
+ # in version control.
123
+ # https://pdm.fming.dev/#use-with-ide
124
+ .pdm.toml
125
+
126
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
127
+ __pypackages__/
128
+
129
+ # Celery stuff
130
+ celerybeat-schedule
131
+ celerybeat.pid
132
+
133
+ # SageMath parsed files
134
+ *.sage.py
135
+
136
+ # Environments
137
+ .env
138
+ .env.*
139
+ .venv
140
+ env/
141
+ venv/
142
+ ENV/
143
+ env.bak/
144
+ venv.bak/
145
+
146
+ # Spyder project settings
147
+ .spyderproject
148
+ .spyproject
149
+
150
+ # Rope project settings
151
+ .ropeproject
152
+
153
+ # mkdocs documentation
154
+ /site
155
+
156
+ # mypy
157
+ .mypy_cache/
158
+ .dmypy.json
159
+ dmypy.json
160
+
161
+ # Pyre type checker
162
+ .pyre/
163
+
164
+ # pytype static type analyzer
165
+ .pytype/
166
+
167
+ # Cython debug symbols
168
+ cython_debug/
169
+
170
+ # PyCharm
171
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
172
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
173
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
174
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
175
+ #.idea/
176
+
177
+ ### Python Patch ###
178
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
179
+ poetry.toml
180
+
181
+ # ruff
182
+ .ruff_cache/
183
+
184
+ # LSP config files
185
+ pyrightconfig.json
186
+
187
+ # Infra
188
+ infra/*/*.tfvars
189
+ infra/*/*.tfstate
190
+ infra/*/*.tfstate.backup
191
+ infra/*/.terraform*
192
+ infra/*/*.plan
193
+ *.db
194
+ # PufferRL Experiments
195
+ experiments/
196
+ wandb/
197
+ !.env.sample
198
+ !.env.docker-compose
199
+ !.env.*.docker-compose
200
+ !.env.*.docker-compose
201
+ !.env.docker-compose
202
+ .cursor/
203
+
204
+ # Cloud Function
205
+ node_modules
206
+
207
+ # Puffer artifacts — ignore any resources/ dir or symlink at any depth
208
+ **/resources
209
+ pr-message-puffer.md
210
+ dev-env/state/state.json
211
+ shared-env/*
212
+ helm/Chart.lock
213
+ helm/charts/*.tgz
214
+ helm/.port-forward.pids
215
+ provisioning-service/settings.local.toml
216
+ provisioning-service/src/config/config-local.yml
217
+ .snapshot/*
218
+
219
+ # Per-env deployment scratch dirs (carry keys + per-env configs)
220
+ deploy-base-sepolia/
221
+
222
+ # Claude Code per-project state
223
+ .claude/
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: arkhai-core-storefront-client
3
+ Version: 0.15.0
4
+ Summary: Async and sync HTTP clients for the Arkhai storefront REST API.
5
+ Requires-Python: >=3.12
6
+ Requires-Dist: eth-account>=0.12
7
+ Requires-Dist: httpx>=0.27
@@ -0,0 +1,88 @@
1
+ # storefront-client
2
+
3
+ Async and synchronous HTTP clients for the Arkhai storefront REST API.
4
+
5
+ Distributed as a pure-Python wheel (`arkhai_storefront_client-*.whl`) via
6
+ the monorepo `.dist/` directory.
7
+
8
+ ## Usage
9
+
10
+ ### Async (application code)
11
+
12
+ ```python
13
+ from storefront_client import StorefrontClient
14
+
15
+ client = StorefrontClient("http://seller-storefront:8001", private_key="0x...")
16
+ async with client:
17
+ reg = await client.get_registration()
18
+ resp = await client.create_listing(
19
+ agent_wallet_address="0xSellerWallet",
20
+ offer={...},
21
+ demand={...},
22
+ )
23
+ ```
24
+
25
+ ### Sync (CLI commands, smoke tests, scripts)
26
+
27
+ ```python
28
+ from storefront_client import SyncStorefrontClient
29
+
30
+ with SyncStorefrontClient("http://seller-storefront:8001", private_key="0x...") as client:
31
+ reg = client.get_registration()
32
+ resp = client.create_listing(
33
+ agent_wallet_address="0xSellerWallet",
34
+ offer={...},
35
+ demand={...},
36
+ )
37
+ ```
38
+
39
+ ## Surface
40
+
41
+ Both clients cover:
42
+
43
+ - `POST /listings/create` → `create_listing`
44
+ - `POST /api/v1/listings/{listing_id}/close` → `close_listing`
45
+ - `POST /listings/refund` → `refund_listing`
46
+ - `POST /listings/claim` → `claim_listing`
47
+ - `POST /listings/discover` → `discover_listings`
48
+ - `POST /alerts/resource` → `send_resource_alert`
49
+
50
+ Responses parse into typed dataclasses (`StorefrontOrderCreateResponse`,
51
+ etc.); the raw JSON is preserved on each model's `.extra` field for
52
+ forward-compat with new server fields.
53
+
54
+ ## Versioning policy
55
+
56
+ **`storefront-client` versioning must stay in lockstep with the
57
+ storefront API.** Two contracts are not enforced by Python's type
58
+ system — mismatches produce silent 403s or unexpected response shapes
59
+ at runtime, not import errors:
60
+
61
+ ### 1. Auth message format
62
+
63
+ ```
64
+ create_listing → "create_listing:<agent_wallet_address>:<timestamp>"
65
+ close_listing → "close_listing:<listing_id>:<timestamp>"
66
+ refund_listing → "refund_listing:<listing_id>:<timestamp>"
67
+ claim_listing → "claim_listing:<listing_id>:<timestamp>"
68
+ discover_listings → "discover_listings:<listing_id>:<timestamp>"
69
+ ```
70
+
71
+ If this format changes in `domains/vms/storefront/src/market_storefront/agent.py`,
72
+ bump `storefront-client` version and update `_build_auth_headers` in
73
+ `client.py` in the same commit.
74
+
75
+ ### 2. Endpoint signatures
76
+
77
+ `/api/v1/listings/create`, `/api/v1/listings/{listing_id}/close`,
78
+ `/api/v1/listings/{listing_id}/refund`, `/listings/{claim,discover}`,
79
+ and `/alerts/resource` request and response shapes. If any field is
80
+ added, removed, or renamed, bump the version and update the
81
+ corresponding method in `client.py`.
82
+
83
+ ### Version bump checklist
84
+
85
+ 1. Update `client.py` and `models.py` to match the new server behaviour.
86
+ 2. Bump `version` in `core/storefront-client/pyproject.toml`.
87
+ 3. Run `make dist-storefront-client` to rebuild the wheel.
88
+ 4. Run `make reinit` in each consuming project to pick up the new wheel.
@@ -0,0 +1,24 @@
1
+ [project]
2
+ name = "arkhai-core-storefront-client"
3
+ version = "0.15.0"
4
+ description = "Async and sync HTTP clients for the Arkhai storefront REST API."
5
+ requires-python = ">=3.12"
6
+ dependencies = [
7
+ "httpx>=0.27",
8
+ "eth-account>=0.12",
9
+ ]
10
+
11
+ [build-system]
12
+ requires = ["hatchling"]
13
+ build-backend = "hatchling.build"
14
+
15
+ [tool.hatch.build.targets.wheel]
16
+ packages = ["src/storefront_client"]
17
+
18
+ [tool.pytest.ini_options]
19
+ pythonpath = ["src"]
20
+
21
+ [dependency-groups]
22
+ dev = [
23
+ "pytest>=8.0",
24
+ ]
@@ -0,0 +1,25 @@
1
+ """arkhai-storefront-client — async and sync HTTP clients for the Arkhai storefront REST API."""
2
+
3
+ from storefront_client.client import (
4
+ StorefrontClient,
5
+ StorefrontClientError,
6
+ SyncStorefrontClient,
7
+ _build_auth_headers,
8
+ )
9
+ from storefront_client.models import (
10
+ StorefrontListingClaimResponse,
11
+ StorefrontListingCloseResponse,
12
+ StorefrontListingCreateResponse,
13
+ StorefrontListingRefundResponse,
14
+ )
15
+
16
+ __all__ = [
17
+ "StorefrontClient",
18
+ "StorefrontClientError",
19
+ "SyncStorefrontClient",
20
+ "_build_auth_headers",
21
+ "StorefrontListingClaimResponse",
22
+ "StorefrontListingCloseResponse",
23
+ "StorefrontListingCreateResponse",
24
+ "StorefrontListingRefundResponse",
25
+ ]