vaultody-sdk 0.9.0rc1__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.
- vaultody_sdk-0.9.0rc1/LICENSE +202 -0
- vaultody_sdk-0.9.0rc1/MANIFEST.in +3 -0
- vaultody_sdk-0.9.0rc1/PKG-INFO +298 -0
- vaultody_sdk-0.9.0rc1/README.md +283 -0
- vaultody_sdk-0.9.0rc1/pyproject.toml +31 -0
- vaultody_sdk-0.9.0rc1/setup.cfg +4 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/__init__.py +118 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/_async_client.py +230 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/_client.py +339 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/_core.py +1284 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/_defaults.py +18 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/_operations.py +356 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/_resources.py +475 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/_surface.py +91 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/_version.py +10 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/errors.py +350 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/models.py +1037 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/pagination.py +217 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/py.typed +0 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/request_target.py +72 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/retry.py +128 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/security_events.py +34 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/signers.py +296 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/stores.py +623 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/transport_errors.py +28 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/vault_keys.py +269 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk/webhooks.py +174 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk.egg-info/PKG-INFO +298 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk.egg-info/SOURCES.txt +30 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk.egg-info/dependency_links.txt +1 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk.egg-info/requires.txt +3 -0
- vaultody_sdk-0.9.0rc1/vaultody_sdk.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Vaultody
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vaultody-sdk
|
|
3
|
+
Version: 0.9.0rc1
|
|
4
|
+
Summary: The official Vaultody SDK for Python: sync and async clients that sign requests, verify responses and check returned addresses.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: vaultody-verify==0.9.0rc1
|
|
12
|
+
Requires-Dist: cryptography>=3.1
|
|
13
|
+
Requires-Dist: httpx>=0.27
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# vaultody-sdk (Python)
|
|
17
|
+
|
|
18
|
+
The official Vaultody SDK for Python, imported as `vaultody_sdk`. Python 3.10+. Dependencies:
|
|
19
|
+
`vaultody-verify` (same version), `httpx`, `cryptography`.
|
|
20
|
+
|
|
21
|
+
Release candidate: `pip install --pre vaultody-sdk`.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from vaultody_sdk import Vaultody, FileSigner
|
|
25
|
+
|
|
26
|
+
with Vaultody(api_key, api_secret, passphrase, signer=FileSigner("private.pem")) as vaultody:
|
|
27
|
+
for vault in vaultody.vaults.list_vaults(networkType="main"): # every page, fetched as you go
|
|
28
|
+
print(vault["id"], vault["name"])
|
|
29
|
+
|
|
30
|
+
address = vaultody.assets_addresses.generate_deposit_address(
|
|
31
|
+
vaultId=vault_id, blockchain="bitcoin", network="mainnet", label="Alice deposit", vaultAccountId=account_id,
|
|
32
|
+
)
|
|
33
|
+
address.item["address"], address.meta.address_checks # [{"vaultId", "address", "status": "verified"}]
|
|
34
|
+
|
|
35
|
+
transfer = vaultody.transactions.create_single_transfer(
|
|
36
|
+
vaultId=vault_id, vaultAccountId=account_id, assetId=asset_id,
|
|
37
|
+
fromAddress=sender, toAddress=recipient, amount="0.001", note="Payout 1842",
|
|
38
|
+
feePriority="standard", context="order-1842",
|
|
39
|
+
)
|
|
40
|
+
transfer.item["transactionRequestId"]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`AsyncVaultody` takes the same arguments and has the same methods: a single item is awaited
|
|
44
|
+
(`await client.transactions.create_single_transfer(...)`), a list is an async iterator
|
|
45
|
+
(`async for vault in client.vaults.list_vaults(networkType="main")`).
|
|
46
|
+
|
|
47
|
+
## API methods
|
|
48
|
+
|
|
49
|
+
One method per documented operation of API version 2026-03-20 (the published OpenAPI document,
|
|
50
|
+
`contract/openapi.json`, plus `contract/pending/`), on both clients. Methods are grouped as the docs group
|
|
51
|
+
them, and named by the docs operationId in snake_case: `createSingleTransfer` is
|
|
52
|
+
`client.transactions.create_single_transfer`. CI (`scripts/coverage.mjs`) fails when a documented operation
|
|
53
|
+
has no method, or a method or its parameters differ from the document.
|
|
54
|
+
|
|
55
|
+
- **Arguments** are keyword arguments with the API's own field names, path, query and body fields together
|
|
56
|
+
(`vaultId=`, `feePriority=`, `recipients=[{"address": ..., "amount": ...}]`): the SDK puts each one where
|
|
57
|
+
the operation takes it and builds the `{"context", "data": {"item"}}` body. Before anything is sent they
|
|
58
|
+
are checked against the documented operation: a field it does not document (`unknown_param`), a missing
|
|
59
|
+
required one (`missing_param`), a wrong type (amounts are strings), a `limit` outside 1 to the largest
|
|
60
|
+
page, or a value outside the list the document gives for that field of that operation, matched exactly
|
|
61
|
+
(`networkType="MAIN"` is refused; `prepareStrategy` is `minimize-dust` for `create_multiple_transfer` but
|
|
62
|
+
`minimize_dust` for `estimate_transaction_fee_by_asset_id`, as documented) raise `ParameterError`
|
|
63
|
+
(`invalid_param`). `.param` names the field (`recipients[0].amount`); the value is never echoed. An
|
|
64
|
+
optional field passed as `None` is left out. Nested objects are checked the same way. Answers are read
|
|
65
|
+
leniently: an unknown value or field in a response is passed through.
|
|
66
|
+
- **`context=`**, on every method, is your own value that the API echoes back (`meta.context`).
|
|
67
|
+
- **A single item** comes back as `Item`: `.item` (`data.item` as sent, unknown fields kept) and `.meta`
|
|
68
|
+
(request id, API version, context, whether the response signature verified, the address checks).
|
|
69
|
+
- **A list** comes back as `Pages` (`AsyncPages` on the async client): iterating it fetches page after
|
|
70
|
+
page, each one signed, verified and checked like any call; nothing is sent before the first item is asked
|
|
71
|
+
for. The page size is `limit=` or the operation's largest; `startingAfter=` starts mid-list;
|
|
72
|
+
`max_items=` stops early. `.pages()` yields the pages themselves (`Page`: `.items`, `.has_more`,
|
|
73
|
+
`.meta`), for what each answer says besides its items, such as the address checks of
|
|
74
|
+
`list_addresses_by_vault_account_id`.
|
|
75
|
+
- **Types**: `vaultody_sdk.models` has a `TypedDict` for the arguments (`<Operation>Params`) and the answer
|
|
76
|
+
(`<Operation>Result`, or `<Operation>Item` for a list) of every operation, checked field by field against
|
|
77
|
+
the document in the tests; a field with documented values is a `Literal` of exactly those values. The
|
|
78
|
+
package ships `py.typed`: mypy and pyright check the arguments of every call. CI runs `mypy --strict` over
|
|
79
|
+
`tests/typecheck/public_api.py`, an application's calls against the installed package, including calls
|
|
80
|
+
it must refuse.
|
|
81
|
+
- **Retries**: "read" operations (every GET, and the POSTs that change nothing) are retried re-signed;
|
|
82
|
+
"write" operations are never signed twice (see "What every call does").
|
|
83
|
+
|
|
84
|
+
### vaults
|
|
85
|
+
|
|
86
|
+
| Method | Request | Returns | Retry |
|
|
87
|
+
|---|---|---|---|
|
|
88
|
+
| `list_vaults` | `GET /vaults/{networkType}` | items, cursor `id`; every page compared with the vault xpub pins | read |
|
|
89
|
+
| `list_vaults_by_asset_id` | `GET /assets/{assetId}/{blockchain}/vaults/{networkType}` | Item | read |
|
|
90
|
+
| `list_assets_by_vault` | `GET /vaults/{vaultId}/assets` | Item | read |
|
|
91
|
+
| `list_transactions_by_vault` | `GET /vaults/{vaultId}/transactions` | items, cursor `id` | read |
|
|
92
|
+
|
|
93
|
+
### vault_accounts
|
|
94
|
+
|
|
95
|
+
| Method | Request | Returns | Retry |
|
|
96
|
+
|---|---|---|---|
|
|
97
|
+
| `create_vault_account` | `POST /vaults/{vaultId}/vault-account` | Item | write |
|
|
98
|
+
| `list_vault_accounts` | `GET /vaults/{vaultId}/vault-accounts/details` | items, cursor `vaultAccountId` | read |
|
|
99
|
+
| `get_vault_account_by_id` | `GET /vaults/{vaultId}/vault-accounts/{vaultAccountId}/details` | Item | read |
|
|
100
|
+
| `update_vault_account` | `PUT /vaults/{vaultId}/vault-accounts/{vaultAccountId}/edit` | Item | write |
|
|
101
|
+
| `add_asset_to_vault_account` | `PUT /vaults/{vaultId}/vault-accounts/{vaultAccountId}/add-asset` | Item; with `address=` the answer must name that address, with `label=` the new address is checked against the xpub | write |
|
|
102
|
+
| `list_assets_by_vault_account_id` | `GET /vaults/{vaultId}/vault-accounts/{vaultAccountId}/list-assets` | items, cursor `assetId` | read |
|
|
103
|
+
| `list_transactions_by_vault_account` | `GET /vaults/{vaultId}/vault-accounts/{vaultAccountId}/transactions` | items, cursor `id` | read |
|
|
104
|
+
|
|
105
|
+
### assets_addresses
|
|
106
|
+
|
|
107
|
+
| Method | Request | Returns | Retry |
|
|
108
|
+
|---|---|---|---|
|
|
109
|
+
| `generate_deposit_address` | `POST /vaults/{vaultId}/{blockchain}/{network}/addresses` | Item; the address is checked against the xpub | write |
|
|
110
|
+
| `get_address_balance` | `GET /vaults/{vaultId}/addresses/{address}/balance` | items; one page only (cursor field not documented: `PaginationError("cursor_unknown")` if there is more) | read |
|
|
111
|
+
| `list_addresses_by_vault_account_id` | `GET /vaults/{vaultId}/vault-accounts/{vaultAccountId}/list-addresses` | items, cursor `addressId`; every address checked against the xpub | read |
|
|
112
|
+
| `list_supported_assets` | `GET /supported-assets` | items, cursor `assetId` | read |
|
|
113
|
+
| `validate_address` | `POST /info/{blockchain}/{network}/addresses/validate` | Item | read |
|
|
114
|
+
| `encode_xrp_address` | `GET /utils/xrp/{network}/addresses/encode/{classicAddress}/{addressTag}` | Item | read |
|
|
115
|
+
| `decode_xrp_address` | `GET /utils/xrp/{network}/addresses/decode/{xAddress}` | Item | read |
|
|
116
|
+
| `tron_resource_overview` | `GET /vaults/{vaultId}/{blockchain}/{network}/{address}/overview` | Item | read |
|
|
117
|
+
| `tron_resource_management` | `POST /vaults/{vaultId}/{blockchain}/{network}/addresses/{fromAddress}/manage-resource` | Item | write |
|
|
118
|
+
|
|
119
|
+
### transactions
|
|
120
|
+
|
|
121
|
+
| Method | Request | Returns | Retry |
|
|
122
|
+
|---|---|---|---|
|
|
123
|
+
| `create_single_transfer` | `POST /vaults/{vaultId}/transaction-requests/single-transfer` | Item | write |
|
|
124
|
+
| `create_multiple_transfer` | `POST /vaults/{vaultId}/transaction-requests/multiple-transfer` | Item | write |
|
|
125
|
+
| `create_utxo_transfer` | `POST /vaults/{vaultId}/transaction-requests/utxo-transfer` | Item | write |
|
|
126
|
+
| `validate_utxo_transfer` | `POST /vaults/{vaultId}/transaction-requests/utxo-transfer/validate` | Item | read |
|
|
127
|
+
| `create_batch_transaction_request` | `POST /vaults/{vaultId}/transaction-requests/batch` | Item | write |
|
|
128
|
+
| `gas_sponsorship_transfer` | `POST /vaults/{vaultId}/transaction-requests/gas-sponsorship-transfer` | Item | write |
|
|
129
|
+
| `create_tron_contract_interaction_request` | `POST /vaults/{vaultId}/transaction-requests/contract-interaction` | Item | write |
|
|
130
|
+
| `estimate_transaction_fee_by_asset_id` | `POST /vaults/{vaultId}/approximate-fee` | Item | read |
|
|
131
|
+
| `get_transaction_details` | `GET /vaults/{vaultId}/{blockchain}/transactions/{transactionId}` | Item | read |
|
|
132
|
+
| `get_transaction_request_details` | `GET /transaction-requests/{transactionRequestId}` | Item | read |
|
|
133
|
+
| `list_utxos` | `GET /vaults/{vaultId}/utxos` | items, cursor `utxoId` | read |
|
|
134
|
+
|
|
135
|
+
### api_keys (documented, not on production yet)
|
|
136
|
+
|
|
137
|
+
| Method | Request | Returns | Retry |
|
|
138
|
+
|---|---|---|---|
|
|
139
|
+
| `list_api_key_signing_keys` | `GET /api-keys/current/signing-keys` | items (at most two keys); takes no parameter. `check_signing_key()` compares them with the signer's key | read |
|
|
140
|
+
|
|
141
|
+
## What every call does
|
|
142
|
+
|
|
143
|
+
`Vaultody` (httpx.Client) and `AsyncVaultody` (httpx.AsyncClient) are thin: all logic is in `_core.py`, a core
|
|
144
|
+
without I/O that yields the I/O it needs (send, sleep, sign, rate-limit, read or write the pin store) and
|
|
145
|
+
that both clients drive. So both behave the same, by construction.
|
|
146
|
+
|
|
147
|
+
1. **Request.** The path and query are percent-encoded by the SDK (RFC 3986 unreserved kept), so what is
|
|
148
|
+
signed is what goes on the request line. POST and PUT send `{"context"?, "data": {"item"}}` as compact
|
|
149
|
+
UTF-8 JSON, at most 1 MiB. `x-api-version` is pinned (`API_VERSION`, 2026-03-20) and signed.
|
|
150
|
+
2. **Rate limit.** At most `max_requests_per_second` (5) calls in any one-second window, per client.
|
|
151
|
+
3. **Signing.** HMAC v2 with a fresh 16-byte nonce for every call (`x-api-sign-version: 2`). With a
|
|
152
|
+
`signer`, also `x-api-keypair-sign` / `x-api-keypair-id` over the API key and the HMAC v2 fields:
|
|
153
|
+
Ed25519 (64 bytes) or P-256 (DER; a 64-byte IEEE P1363 r || s from Web Crypto, Azure or a KMS is
|
|
154
|
+
converted), checked against the signer's public key before sending.
|
|
155
|
+
4. **Response verification** (vaultody-verify), before the body is read (`test-vectors/response-mode-v1.json`).
|
|
156
|
+
A signed response (any of the four `x-api-response-*` headers) is always checked; a failure raises
|
|
157
|
+
`ResponseVerificationError` and is never retried, and a signed response with no root to check it with
|
|
158
|
+
raises `ConfigurationError` `no_root_keys`. An unsigned response passes (`response_signature="when-present"`,
|
|
159
|
+
the build default of release candidates, while production does not sign) until the origin has sent one
|
|
160
|
+
signed response, verified or not: that answer latches the origin before anything is raised (the security
|
|
161
|
+
event `response_signature_latched`, `rootId` `None` when it did not verify), and from then on the client
|
|
162
|
+
is strict, also after a restart (the latch is kept in the vault key store). `response_signature="required"`
|
|
163
|
+
(or `VAULTODY_RESPONSE_SIGNATURE=required`) is strict from the start. A client with response-signing roots
|
|
164
|
+
(`roots`, or those a stable release embeds) is always `required`: a `when-present` given then is ignored,
|
|
165
|
+
with one warning, and before its first write it makes one signed read (`GET /api-keys/current/signing-keys`,
|
|
166
|
+
the key-pair check when a `signer` is set), so a write is never sent to an origin that does not sign.
|
|
167
|
+
`client.response_signature` is the mode in force. The first unsigned response a client accepts raises
|
|
168
|
+
the security event `{"type": "unsigned_response_accepted", "origin", "operationId"}` (once per client;
|
|
169
|
+
`operationId` is `None` outside the API methods), then one warning on the `vaultody_sdk` logger.
|
|
170
|
+
5. **Retries** (`retry.py`, `test-vectors/retry-v1.json`). Reads (GET, and the POSTs that change
|
|
171
|
+
nothing: `validate_address`, `validate_utxo_transfer`, `estimate_transaction_fee_by_asset_id`) are
|
|
172
|
+
retried re-signed with backoff, each time with a new nonce. A write is never signed again once it may
|
|
173
|
+
have reached the gateway: it is resent unchanged (the gateway's replay protection answers a duplicate
|
|
174
|
+
with the first answer for 3 s), and only while the key pair is confirmed active through a signed
|
|
175
|
+
`GET /api-keys/current/signing-keys` (re-checked every 10 minutes). Where the outcome can't be learned,
|
|
176
|
+
`RequestOutcomeUnknownError` (with the nonce, timestamp and request id): check before sending again.
|
|
177
|
+
Every retry of a write keeps its `x-api-nonce` and body, so the gateway's idempotency (per API key and
|
|
178
|
+
nonce) sees one operation: a write signed again (its signature too
|
|
179
|
+
old to resend) gets a fresh timestamp and signatures over the same nonce. The one exception is the one
|
|
180
|
+
immediate retry of `address_derivation_conflict` / `vault_accounts_creation_failed`, which say nothing
|
|
181
|
+
was executed: it is signed again with a new nonce and the same body (with the same nonce the gateway
|
|
182
|
+
would only replay the 409), and later retries of that call keep the new nonce. A second conflict reaches
|
|
183
|
+
you as a `ConflictError` (`retryable` true). A 409 `api_nonce_reused` is a `RequestSigningError`, never
|
|
184
|
+
retried.
|
|
185
|
+
6. **Vault xpub pins and address checks.** Every `GET /vaults/{main|test}` answer is compared with the
|
|
186
|
+
pins of the origin. A new vault is pinned `verified` (signed answer) or `unverified` (trust on first
|
|
187
|
+
use); an unverified pin is confirmed by the first signed list. An xpub that differs, or disappears, an
|
|
188
|
+
algorithm added to a pinned vault and a vault type change raise `VaultKeyChangedError` (the alarm; the
|
|
189
|
+
security hook first, no pin changed, nothing returned). The last two are refused on purpose too: after
|
|
190
|
+
you confirm a legitimate change with Vaultody, re-pin the vault with
|
|
191
|
+
`npx @vaultody-com/sdk@next vault-keys accept --vault-id <id>` (the Node command line, which edits the pin file
|
|
192
|
+
every SDK shares: it shows the old and new fingerprints, and `--yes --expect type=…,ECDSA=…,EDDSA=…` re-pins
|
|
193
|
+
only when the API still shows exactly those) or `store.replace()`. Nothing else
|
|
194
|
+
changes a pin. Pins you give in `pinned_vault_keys` count as `verified`, are compared with every vault
|
|
195
|
+
list (signed or not) like any pin, so any difference is the alarm, are never written to the store, and
|
|
196
|
+
take the place of the stored pin of their vault. Addresses
|
|
197
|
+
returned by `generate_deposit_address`, `list_addresses_by_vault_account_id` and
|
|
198
|
+
`add_asset_to_vault_account` are derived from the pinned xpub (the address derivation in vaultody-verify);
|
|
199
|
+
a mismatch refuses the whole answer. Each address gets an entry `{"vaultId", "address", "status"}` in `meta.address_checks`, status `verified`, `unverified` or
|
|
200
|
+
`not_verifiable` (no derivation path: SMART vaults, older rows; never reported as verified). With
|
|
201
|
+
`require_address_paths`, an address `generate_deposit_address` answers without its derivation path, for a
|
|
202
|
+
vault with MPC keys on a chain the SDK can derive, is refused instead: `AddressVerificationError` with
|
|
203
|
+
`code` `path_missing` (after the `address_verification_failed` event). Each
|
|
204
|
+
vault-list page reports every vault in `meta.vault_keys`, in answer order, as
|
|
205
|
+
`{"vaultId", "status", "outcome"}`: `status` is its pin after the answer (`verified`, `unverified`) or
|
|
206
|
+
`not_verifiable` (no MPC keys), `outcome` is `pinned`, `unchanged`, `upgraded` or `not_verifiable`.
|
|
207
|
+
7. **Typed errors** (`errors.py`, `test-vectors/envelope-errors-v1.json`): branch on the class and `code`.
|
|
208
|
+
Every error class is exported from the package root (`vaultody_sdk.WebhookSignatureError` too), and is a
|
|
209
|
+
`VaultodyError`. `ParameterError.param` names the field (`recipients[0].amount`), never its value.
|
|
210
|
+
|
|
211
|
+
## Options
|
|
212
|
+
|
|
213
|
+
| Option | Default | |
|
|
214
|
+
|---|---|---|
|
|
215
|
+
| `base_url` | `https://rest.vaultody.com` | https only; plain http only to 127.0.0.1, ::1, localhost |
|
|
216
|
+
| `signer` | none | `PemSigner`, `FileSigner`, `CallbackSigner` (any KMS; `digest_only=True` for a P-256 digest), `AsyncCallbackSigner` (AsyncVaultody) |
|
|
217
|
+
| `response_signature` | `$VAULTODY_RESPONSE_SIGNATURE`, else the build default (`when-present` for release candidates) | or `required`. Always `required` with response-signing roots |
|
|
218
|
+
| `pinned_vault_keys` | none | vault xpubs you give yourself, for this client's origin: `[{"vaultId", "type": "main" \| "test", "keys": {"ECDSA": xpub or None, "EDDSA": xpub or None}}]`, exactly those fields, at least one xpub, each vault once (else `ConfigurationError` `invalid_pinned_vault_keys`). They count as verified and are checked against every answer; vaults not listed are pinned in the store as usual |
|
|
219
|
+
| `vault_key_store` | file | `$VAULTODY_VAULT_KEYS_FILE`, else `~/.vaultody/vault-keys.json` (0600 in a 0700 directory, atomic writes under a lock; memory with a warning when that location can't be written). Any object with the `VaultKeyStore` methods |
|
|
220
|
+
| `on_security_event` | each event logged once as a warning, `Vaultody security event: {json}` | `f(event)`: `unsigned_response_accepted`, `response_signature_latched`, `response_verification_failed`, `vault_key_pinned`, `vault_key_verified`, `vault_key_changed`, `address_verification_failed`, each with exactly the fields of `SECURITY_EVENTS` (the same in every language: [`../../docs/vault-keys-file.md`](../../docs/vault-keys-file.md), `test-vectors/security-events-v1.json`). Never given a secret, an xpub or an address |
|
|
221
|
+
| `roots` | embedded | response-signing roots, for test environments only. Given, the client is strict from its first response |
|
|
222
|
+
| `require_address_paths` | `ADDRESS_PATHS_PUBLIC` (off while the API hides the paths) | `True`: refuse (`path_missing`) a new deposit address of a vault with MPC keys that comes without its derivation path. `True` or `False` only (else `ConfigurationError` `invalid_require_address_paths`) |
|
|
223
|
+
| `max_requests_per_second` | 5 | |
|
|
224
|
+
| `timeout` | 30 | seconds per attempt |
|
|
225
|
+
| `verify`, `proxy`, `transport` | | a CA bundle or `ssl.SSLContext` (TLS checks can't be switched off), an HTTP proxy, an httpx transport |
|
|
226
|
+
|
|
227
|
+
The API secret, passphrase and API key are kept in memory (HMAC needs them) and never appear in `repr`,
|
|
228
|
+
errors, events or logs.
|
|
229
|
+
|
|
230
|
+
## The pin file
|
|
231
|
+
|
|
232
|
+
`FileVaultKeyStore` reads and writes the vault keys file every SDK language shares
|
|
233
|
+
([`docs/vault-keys-file.md`](../../docs/vault-keys-file.md)): `{format, origins: {origin: {responseSignature,
|
|
234
|
+
vaults, audit}}}`, checked strictly on every read. A file it refuses raises `VaultKeyStoreError` with the
|
|
235
|
+
same `code` as in Node and PHP (`not_json`, `unknown_format`, `malformed`, `insecure_permissions`,
|
|
236
|
+
`not_regular_file`, `too_large`) and is never taken as empty. It writes the canonical bytes (sorted keys,
|
|
237
|
+
two-space indent) atomically, and a change holds `<file>.lock`, created exclusively and removed afterwards
|
|
238
|
+
(stale after 30 s, given up after 10 s with `locked`), the lock the Node and PHP stores take too.
|
|
239
|
+
|
|
240
|
+
## Webhooks
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
event = vaultody_sdk.webhooks.verify(raw_body, request.headers, [new_secret, old_secret])
|
|
244
|
+
event.event, event.item
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The raw body only; a typed event (`OutgoingTransactionEvent`, `IncomingTransactionEvent`,
|
|
248
|
+
`IncomingTransactionRevertedEvent`, or `UnknownWebhookEvent` for an event this version does not know).
|
|
249
|
+
Also `client.webhooks.verify`. A bad signature raises `vaultody_sdk.WebhookSignatureError` (`reason`:
|
|
250
|
+
`missing`, `malformed`, `mismatch`), a signed body that is no event `WebhookPayloadError`.
|
|
251
|
+
|
|
252
|
+
The scheme has no timestamp, and Vaultody may deliver the same event more than once. Before you act on an
|
|
253
|
+
event, check whether you already acted on it, keyed on what the event is about, as the developer docs'
|
|
254
|
+
Webhook Notifications page says:
|
|
255
|
+
|
|
256
|
+
- outgoing transaction events: `event.item["requestId"]` and `event.event`;
|
|
257
|
+
- incoming transaction events: `event.item["transactionId"]`, `event.item["address"]`, `event.event` and
|
|
258
|
+
`event.item["currentConfirmations"]`. An internal transfer has no `transactionId`: use
|
|
259
|
+
`parentTransactionId` and `operationId` in its place.
|
|
260
|
+
|
|
261
|
+
The SDK stores nothing.
|
|
262
|
+
|
|
263
|
+
## Modules
|
|
264
|
+
|
|
265
|
+
| Module | What | Vectors |
|
|
266
|
+
|---|---|---|
|
|
267
|
+
| `_core.py` | the core without I/O; `Vaultody` (`_client.py`) and `AsyncVaultody` (`_async_client.py`) drive it | all of them, through both clients |
|
|
268
|
+
| `signers.py` | signers, P-256 encodings, the local check | `request-full-v1.json`, `request-keypair-v1.json`, `p1363-der-v1.json` |
|
|
269
|
+
| `stores.py` | the pin store protocol, the file and memory stores | `vault-keys-file-v1.json` |
|
|
270
|
+
| `vault_keys.py` | the pin model and decisions | `vault-key-pins-v1.json` |
|
|
271
|
+
| `errors.py` | typed errors, `read_envelope` | `envelope-errors-v1.json` |
|
|
272
|
+
| `retry.py` | `decide_retry` | `retry-v1.json` |
|
|
273
|
+
| `pagination.py` | `Pages`, `AsyncPages` | `pagination-v1.json` |
|
|
274
|
+
| `request_target.py` | the request target | `path-encoding-v1.json` |
|
|
275
|
+
| `transport_errors.py` | may an httpx error's request have been sent | `transport-errors-v1.json` |
|
|
276
|
+
| `webhooks.py` | `verify` → typed event | `webhook-v1.json` |
|
|
277
|
+
| `_operations.py` | the operation table: where each parameter goes, retry class, paging; the argument checks | |
|
|
278
|
+
| `_resources.py` | the API methods of both clients, one namespace per docs group | |
|
|
279
|
+
| `models.py` | the request and answer `TypedDict`s of every operation | |
|
|
280
|
+
| `_surface.py` | what `scripts/coverage.mjs` reads: the methods of both clients and the operation table | |
|
|
281
|
+
|
|
282
|
+
## Tests
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
cd python
|
|
286
|
+
python3 -m venv .venv && .venv/bin/pip install -e './vaultody-verify' -e './vaultody-sdk' pytest
|
|
287
|
+
cd vaultody-sdk && ../.venv/bin/pytest -q
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
`tests/mock_gateway.py` is a mock API gateway on `httpx.MockTransport`: it checks HMAC v2, the key-pair
|
|
291
|
+
signature and the replay rules, signs responses with the TEST-ONLY roots of `test-vectors/v1.json`, and
|
|
292
|
+
can play a man in the middle (strip or alter signatures, swap an address, change an xpub, inject a 429 or
|
|
293
|
+
a 5xx, drop an answer after the request ran). Every client test runs on both clients (`conftest.py`).
|
|
294
|
+
|
|
295
|
+
`test_methods.py` calls every method with the docs' own example and answers with the docs' own answer
|
|
296
|
+
(`contract/openapi.json`), checking the request line, the body, the result, a documented error, paging, the
|
|
297
|
+
retry class and the refused arguments; `test_method_addresses.py` the address and vault key checks of the
|
|
298
|
+
methods that return them; `test_models.py` every model and the operation table against the document.
|