pvium 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.
- pvium-0.1.0/PKG-INFO +211 -0
- pvium-0.1.0/README.md +193 -0
- pvium-0.1.0/pyproject.toml +38 -0
- pvium-0.1.0/setup.cfg +4 -0
- pvium-0.1.0/src/pvium.egg-info/PKG-INFO +211 -0
- pvium-0.1.0/src/pvium.egg-info/SOURCES.txt +50 -0
- pvium-0.1.0/src/pvium.egg-info/dependency_links.txt +1 -0
- pvium-0.1.0/src/pvium.egg-info/requires.txt +11 -0
- pvium-0.1.0/src/pvium.egg-info/top_level.txt +1 -0
- pvium-0.1.0/src/pvium_sdk/__init__.py +124 -0
- pvium-0.1.0/src/pvium_sdk/async_sdk.py +1 -0
- pvium-0.1.0/src/pvium_sdk/client.py +1 -0
- pvium-0.1.0/src/pvium_sdk/core/__init__.py +4 -0
- pvium-0.1.0/src/pvium_sdk/core/async_sdk.py +36 -0
- pvium-0.1.0/src/pvium_sdk/core/client.py +175 -0
- pvium-0.1.0/src/pvium_sdk/core/sdk.py +20 -0
- pvium-0.1.0/src/pvium_sdk/core/types.py +68 -0
- pvium-0.1.0/src/pvium_sdk/crypto/__init__.py +2 -0
- pvium-0.1.0/src/pvium_sdk/crypto/invite_merkle.py +604 -0
- pvium-0.1.0/src/pvium_sdk/crypto/signing.py +194 -0
- pvium-0.1.0/src/pvium_sdk/endpoints.py +1 -0
- pvium-0.1.0/src/pvium_sdk/invite_merkle.py +1 -0
- pvium-0.1.0/src/pvium_sdk/invites.py +1 -0
- pvium-0.1.0/src/pvium_sdk/oauth.py +1 -0
- pvium-0.1.0/src/pvium_sdk/payout.py +1 -0
- pvium-0.1.0/src/pvium_sdk/sdk.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/__init__.py +5 -0
- pvium-0.1.0/src/pvium_sdk/services/endpoints.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/invites/__init__.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/invites/invites.py +400 -0
- pvium-0.1.0/src/pvium_sdk/services/invites.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/invoice/__init__.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/invoice/endpoints.py +45 -0
- pvium-0.1.0/src/pvium_sdk/services/oauth/__init__.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/oauth/oauth.py +78 -0
- pvium-0.1.0/src/pvium_sdk/services/oauth.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/payout/__init__.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/payout/payout.py +1253 -0
- pvium-0.1.0/src/pvium_sdk/services/payout.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/webhooks/__init__.py +1 -0
- pvium-0.1.0/src/pvium_sdk/services/webhooks/webhooks.py +93 -0
- pvium-0.1.0/src/pvium_sdk/services/webhooks.py +1 -0
- pvium-0.1.0/src/pvium_sdk/signing.py +1 -0
- pvium-0.1.0/src/pvium_sdk/types.py +1 -0
- pvium-0.1.0/src/pvium_sdk/webhooks.py +1 -0
- pvium-0.1.0/tests/test_async_sdk.py +20 -0
- pvium-0.1.0/tests/test_endpoints.py +142 -0
- pvium-0.1.0/tests/test_invites.py +198 -0
- pvium-0.1.0/tests/test_oauth.py +93 -0
- pvium-0.1.0/tests/test_payout.py +887 -0
- pvium-0.1.0/tests/test_signing.py +202 -0
- pvium-0.1.0/tests/test_webhooks.py +62 -0
pvium-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pvium
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for the Pvium API
|
|
5
|
+
Author: Pvium
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: eth-abi>=5.1.0
|
|
10
|
+
Requires-Dist: eth-account>=0.13.0
|
|
11
|
+
Requires-Dist: eth-keys>=0.6.0
|
|
12
|
+
Requires-Dist: eth-utils>=5.0.0
|
|
13
|
+
Provides-Extra: async
|
|
14
|
+
Requires-Dist: httpx>=0.27.0; extra == "async"
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest>=8.3.0; extra == "dev"
|
|
17
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == "dev"
|
|
18
|
+
|
|
19
|
+
# Pvium Python SDK
|
|
20
|
+
|
|
21
|
+
Python SDK equivalent of the Pvium TypeScript SDK.
|
|
22
|
+
|
|
23
|
+
## Project Structure
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
pvium-sdk/
|
|
27
|
+
src/pvium_sdk/
|
|
28
|
+
core/
|
|
29
|
+
client.py
|
|
30
|
+
types.py
|
|
31
|
+
sdk.py
|
|
32
|
+
async_sdk.py
|
|
33
|
+
services/
|
|
34
|
+
invoice/
|
|
35
|
+
endpoints.py
|
|
36
|
+
oauth/
|
|
37
|
+
oauth.py
|
|
38
|
+
invites/
|
|
39
|
+
invites.py
|
|
40
|
+
payout/
|
|
41
|
+
payout.py
|
|
42
|
+
webhooks/
|
|
43
|
+
webhooks.py
|
|
44
|
+
...compatibility wrapper modules...
|
|
45
|
+
crypto/
|
|
46
|
+
signing.py
|
|
47
|
+
invite_merkle.py
|
|
48
|
+
__init__.py
|
|
49
|
+
...compatibility wrapper modules...
|
|
50
|
+
tests/
|
|
51
|
+
...pytest suite...
|
|
52
|
+
pyproject.toml
|
|
53
|
+
README.md
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Install
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install -e .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
For development and tests:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install -e '.[dev]'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from pvium_sdk import PviumSdk, PviumSdkConfig
|
|
72
|
+
|
|
73
|
+
pvium = PviumSdk.init(
|
|
74
|
+
PviumSdkConfig(
|
|
75
|
+
environment="sandbox",
|
|
76
|
+
apiKey="your_api_key",
|
|
77
|
+
clientId="your_client_id",
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
invoices = pvium.endpoints.listInvoices()
|
|
82
|
+
print(invoices)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Async Usage
|
|
86
|
+
|
|
87
|
+
`AsyncPviumSdk` preserves the same service surface as `PviumSdk` and runs service calls in a worker thread.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from pvium_sdk import AsyncPviumSdk, PviumSdkConfig
|
|
91
|
+
|
|
92
|
+
sdk = AsyncPviumSdk.init(
|
|
93
|
+
PviumSdkConfig(baseUrl="https://api-sandbox.pvium.com/v1", apiKey="your_api_key")
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# await any service method
|
|
97
|
+
invoices = await sdk.endpoints.listInvoices()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Run Tests
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pytest
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Services
|
|
107
|
+
|
|
108
|
+
- `pvium.endpoints`
|
|
109
|
+
- `createInvoice(body, options=None)`
|
|
110
|
+
- `listInvoices(options=None)`
|
|
111
|
+
- `getInvoiceStatus(code, options=None)`
|
|
112
|
+
- `cancelInvoice(invoice_id, options=None)`
|
|
113
|
+
- `getInstallmentPayments(installment_id, options=None)`
|
|
114
|
+
|
|
115
|
+
- `pvium.oauth`
|
|
116
|
+
- `exchangeCodeForToken(input, options=None)`
|
|
117
|
+
- `refreshAccessToken(input, options=None)`
|
|
118
|
+
- `getAccessTokenFromRefreshToken(input, options=None)`
|
|
119
|
+
- `getUserInfo(options=None)`
|
|
120
|
+
|
|
121
|
+
- `pvium.invites`
|
|
122
|
+
- `createBundle(input)`
|
|
123
|
+
- `signBundle(bundle, signer)`
|
|
124
|
+
- `createSignedBundle(input, signer)`
|
|
125
|
+
- `commitBundle(bundle, options=None)`
|
|
126
|
+
- `createSignedAndCommit(input, signer, options=None)`
|
|
127
|
+
|
|
128
|
+
- `pvium.payout`
|
|
129
|
+
- `create(input, options=None)`
|
|
130
|
+
- `createFinalized(input, signer, options=None, request_options=None)`
|
|
131
|
+
- `list(query=None, options=None)`
|
|
132
|
+
- `get(payout_id, options=None)`
|
|
133
|
+
- `addPayments(payout, input, options=None)`
|
|
134
|
+
- `addRecipients(payout_id, input, options=None)`
|
|
135
|
+
- `resolveRecipients(payout_id, input, options=None)`
|
|
136
|
+
- `removePayments(payout_id, input, options=None)`
|
|
137
|
+
- `deletePayment(payout_id, payment_id, options=None)`
|
|
138
|
+
- `updatePayment(payout_id, payment_id, input, options=None)`
|
|
139
|
+
- `editPayment(payout_id, payment_id, input, options=None)`
|
|
140
|
+
- `listPayments(payout_id, query=None, options=None)`
|
|
141
|
+
- `listInvites(payout_id, options=None)`
|
|
142
|
+
- `revokeInvite(payout_id, invite_id, options=None)`
|
|
143
|
+
- `revokeInviteRoot(payout_id, invite_root_id, options=None)`
|
|
144
|
+
- `delete(payout_id, options=None)`
|
|
145
|
+
- `finalize(payout_input, signer, options=None, request_options=None)`
|
|
146
|
+
|
|
147
|
+
Single-payout responses are payout intent objects. They keep dictionary
|
|
148
|
+
compatibility with `["meta"]` and `["data"]`, and expose payout fields and proxy
|
|
149
|
+
methods directly:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
payout_intent = pvium.payout.create({
|
|
153
|
+
"type": "Instant",
|
|
154
|
+
"chain": "base",
|
|
155
|
+
"name": "Creator payroll",
|
|
156
|
+
"payments": [
|
|
157
|
+
{
|
|
158
|
+
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
159
|
+
"amount": 100,
|
|
160
|
+
"token": "usdc",
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
finalized = payout_intent.finalize("your_signer_private_key")
|
|
166
|
+
print(finalized.fundingUrl)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Batch detail responses include up to 250 embedded `payments`. If the payout has
|
|
170
|
+
more, the response meta/data includes truncation fields such as
|
|
171
|
+
`paymentsTruncated`, `paymentsLimit`, and `paymentCount`. Use the paginated
|
|
172
|
+
payment list for larger payouts:
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
payments = payout_intent.listPayments({"page": 1, "perPage": 100})
|
|
176
|
+
|
|
177
|
+
for payment in payments["data"]:
|
|
178
|
+
print(payment["id"], payment["amount"])
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
You can manage a payout intent and its payments through the intent object:
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
payout_intent.editPayment(payment_id, {"memo": "Updated memo"})
|
|
185
|
+
payout_intent.deletePayment(payment_id)
|
|
186
|
+
payout_intent.revokeInvite(invite_id)
|
|
187
|
+
payout_intent.delete()
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
For funded escrow payouts, use the intent proxy instead of passing the batch
|
|
191
|
+
back into the service:
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
funded_escrow = pvium.payout.get("escrow_batch_id")
|
|
195
|
+
|
|
196
|
+
funded_escrow.addPayments({
|
|
197
|
+
"payments": [
|
|
198
|
+
{
|
|
199
|
+
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
200
|
+
"amount": 100,
|
|
201
|
+
"memo": "Approved payout",
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
"signer": "your_signer_private_key",
|
|
205
|
+
"finalizeOptions": {"claimDate": 1777488000},
|
|
206
|
+
})
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Utilities
|
|
210
|
+
|
|
211
|
+
The package exports signing helpers, webhook verification helpers, invite merkle helpers, and payout hash helpers similar to the TypeScript SDK.
|
pvium-0.1.0/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Pvium Python SDK
|
|
2
|
+
|
|
3
|
+
Python SDK equivalent of the Pvium TypeScript SDK.
|
|
4
|
+
|
|
5
|
+
## Project Structure
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
pvium-sdk/
|
|
9
|
+
src/pvium_sdk/
|
|
10
|
+
core/
|
|
11
|
+
client.py
|
|
12
|
+
types.py
|
|
13
|
+
sdk.py
|
|
14
|
+
async_sdk.py
|
|
15
|
+
services/
|
|
16
|
+
invoice/
|
|
17
|
+
endpoints.py
|
|
18
|
+
oauth/
|
|
19
|
+
oauth.py
|
|
20
|
+
invites/
|
|
21
|
+
invites.py
|
|
22
|
+
payout/
|
|
23
|
+
payout.py
|
|
24
|
+
webhooks/
|
|
25
|
+
webhooks.py
|
|
26
|
+
...compatibility wrapper modules...
|
|
27
|
+
crypto/
|
|
28
|
+
signing.py
|
|
29
|
+
invite_merkle.py
|
|
30
|
+
__init__.py
|
|
31
|
+
...compatibility wrapper modules...
|
|
32
|
+
tests/
|
|
33
|
+
...pytest suite...
|
|
34
|
+
pyproject.toml
|
|
35
|
+
README.md
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install -e .
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For development and tests:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install -e '.[dev]'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from pvium_sdk import PviumSdk, PviumSdkConfig
|
|
54
|
+
|
|
55
|
+
pvium = PviumSdk.init(
|
|
56
|
+
PviumSdkConfig(
|
|
57
|
+
environment="sandbox",
|
|
58
|
+
apiKey="your_api_key",
|
|
59
|
+
clientId="your_client_id",
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
invoices = pvium.endpoints.listInvoices()
|
|
64
|
+
print(invoices)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Async Usage
|
|
68
|
+
|
|
69
|
+
`AsyncPviumSdk` preserves the same service surface as `PviumSdk` and runs service calls in a worker thread.
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from pvium_sdk import AsyncPviumSdk, PviumSdkConfig
|
|
73
|
+
|
|
74
|
+
sdk = AsyncPviumSdk.init(
|
|
75
|
+
PviumSdkConfig(baseUrl="https://api-sandbox.pvium.com/v1", apiKey="your_api_key")
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# await any service method
|
|
79
|
+
invoices = await sdk.endpoints.listInvoices()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Run Tests
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pytest
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Services
|
|
89
|
+
|
|
90
|
+
- `pvium.endpoints`
|
|
91
|
+
- `createInvoice(body, options=None)`
|
|
92
|
+
- `listInvoices(options=None)`
|
|
93
|
+
- `getInvoiceStatus(code, options=None)`
|
|
94
|
+
- `cancelInvoice(invoice_id, options=None)`
|
|
95
|
+
- `getInstallmentPayments(installment_id, options=None)`
|
|
96
|
+
|
|
97
|
+
- `pvium.oauth`
|
|
98
|
+
- `exchangeCodeForToken(input, options=None)`
|
|
99
|
+
- `refreshAccessToken(input, options=None)`
|
|
100
|
+
- `getAccessTokenFromRefreshToken(input, options=None)`
|
|
101
|
+
- `getUserInfo(options=None)`
|
|
102
|
+
|
|
103
|
+
- `pvium.invites`
|
|
104
|
+
- `createBundle(input)`
|
|
105
|
+
- `signBundle(bundle, signer)`
|
|
106
|
+
- `createSignedBundle(input, signer)`
|
|
107
|
+
- `commitBundle(bundle, options=None)`
|
|
108
|
+
- `createSignedAndCommit(input, signer, options=None)`
|
|
109
|
+
|
|
110
|
+
- `pvium.payout`
|
|
111
|
+
- `create(input, options=None)`
|
|
112
|
+
- `createFinalized(input, signer, options=None, request_options=None)`
|
|
113
|
+
- `list(query=None, options=None)`
|
|
114
|
+
- `get(payout_id, options=None)`
|
|
115
|
+
- `addPayments(payout, input, options=None)`
|
|
116
|
+
- `addRecipients(payout_id, input, options=None)`
|
|
117
|
+
- `resolveRecipients(payout_id, input, options=None)`
|
|
118
|
+
- `removePayments(payout_id, input, options=None)`
|
|
119
|
+
- `deletePayment(payout_id, payment_id, options=None)`
|
|
120
|
+
- `updatePayment(payout_id, payment_id, input, options=None)`
|
|
121
|
+
- `editPayment(payout_id, payment_id, input, options=None)`
|
|
122
|
+
- `listPayments(payout_id, query=None, options=None)`
|
|
123
|
+
- `listInvites(payout_id, options=None)`
|
|
124
|
+
- `revokeInvite(payout_id, invite_id, options=None)`
|
|
125
|
+
- `revokeInviteRoot(payout_id, invite_root_id, options=None)`
|
|
126
|
+
- `delete(payout_id, options=None)`
|
|
127
|
+
- `finalize(payout_input, signer, options=None, request_options=None)`
|
|
128
|
+
|
|
129
|
+
Single-payout responses are payout intent objects. They keep dictionary
|
|
130
|
+
compatibility with `["meta"]` and `["data"]`, and expose payout fields and proxy
|
|
131
|
+
methods directly:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
payout_intent = pvium.payout.create({
|
|
135
|
+
"type": "Instant",
|
|
136
|
+
"chain": "base",
|
|
137
|
+
"name": "Creator payroll",
|
|
138
|
+
"payments": [
|
|
139
|
+
{
|
|
140
|
+
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
141
|
+
"amount": 100,
|
|
142
|
+
"token": "usdc",
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
finalized = payout_intent.finalize("your_signer_private_key")
|
|
148
|
+
print(finalized.fundingUrl)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Batch detail responses include up to 250 embedded `payments`. If the payout has
|
|
152
|
+
more, the response meta/data includes truncation fields such as
|
|
153
|
+
`paymentsTruncated`, `paymentsLimit`, and `paymentCount`. Use the paginated
|
|
154
|
+
payment list for larger payouts:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
payments = payout_intent.listPayments({"page": 1, "perPage": 100})
|
|
158
|
+
|
|
159
|
+
for payment in payments["data"]:
|
|
160
|
+
print(payment["id"], payment["amount"])
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
You can manage a payout intent and its payments through the intent object:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
payout_intent.editPayment(payment_id, {"memo": "Updated memo"})
|
|
167
|
+
payout_intent.deletePayment(payment_id)
|
|
168
|
+
payout_intent.revokeInvite(invite_id)
|
|
169
|
+
payout_intent.delete()
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
For funded escrow payouts, use the intent proxy instead of passing the batch
|
|
173
|
+
back into the service:
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
funded_escrow = pvium.payout.get("escrow_batch_id")
|
|
177
|
+
|
|
178
|
+
funded_escrow.addPayments({
|
|
179
|
+
"payments": [
|
|
180
|
+
{
|
|
181
|
+
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
182
|
+
"amount": 100,
|
|
183
|
+
"memo": "Approved payout",
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"signer": "your_signer_private_key",
|
|
187
|
+
"finalizeOptions": {"claimDate": 1777488000},
|
|
188
|
+
})
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Utilities
|
|
192
|
+
|
|
193
|
+
The package exports signing helpers, webhook verification helpers, invite merkle helpers, and payout hash helpers similar to the TypeScript SDK.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pvium"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for the Pvium API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Pvium" }]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"eth-abi>=5.1.0",
|
|
15
|
+
"eth-account>=0.13.0",
|
|
16
|
+
"eth-keys>=0.6.0",
|
|
17
|
+
"eth-utils>=5.0.0",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
async = [
|
|
22
|
+
"httpx>=0.27.0",
|
|
23
|
+
]
|
|
24
|
+
dev = [
|
|
25
|
+
"pytest>=8.3.0",
|
|
26
|
+
"pytest-asyncio>=0.24.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[tool.setuptools]
|
|
30
|
+
package-dir = {"" = "src"}
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.packages.find]
|
|
33
|
+
where = ["src"]
|
|
34
|
+
include = ["pvium_sdk*"]
|
|
35
|
+
|
|
36
|
+
[tool.pytest.ini_options]
|
|
37
|
+
testpaths = ["tests"]
|
|
38
|
+
pythonpath = ["src"]
|
pvium-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pvium
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for the Pvium API
|
|
5
|
+
Author: Pvium
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: eth-abi>=5.1.0
|
|
10
|
+
Requires-Dist: eth-account>=0.13.0
|
|
11
|
+
Requires-Dist: eth-keys>=0.6.0
|
|
12
|
+
Requires-Dist: eth-utils>=5.0.0
|
|
13
|
+
Provides-Extra: async
|
|
14
|
+
Requires-Dist: httpx>=0.27.0; extra == "async"
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest>=8.3.0; extra == "dev"
|
|
17
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == "dev"
|
|
18
|
+
|
|
19
|
+
# Pvium Python SDK
|
|
20
|
+
|
|
21
|
+
Python SDK equivalent of the Pvium TypeScript SDK.
|
|
22
|
+
|
|
23
|
+
## Project Structure
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
pvium-sdk/
|
|
27
|
+
src/pvium_sdk/
|
|
28
|
+
core/
|
|
29
|
+
client.py
|
|
30
|
+
types.py
|
|
31
|
+
sdk.py
|
|
32
|
+
async_sdk.py
|
|
33
|
+
services/
|
|
34
|
+
invoice/
|
|
35
|
+
endpoints.py
|
|
36
|
+
oauth/
|
|
37
|
+
oauth.py
|
|
38
|
+
invites/
|
|
39
|
+
invites.py
|
|
40
|
+
payout/
|
|
41
|
+
payout.py
|
|
42
|
+
webhooks/
|
|
43
|
+
webhooks.py
|
|
44
|
+
...compatibility wrapper modules...
|
|
45
|
+
crypto/
|
|
46
|
+
signing.py
|
|
47
|
+
invite_merkle.py
|
|
48
|
+
__init__.py
|
|
49
|
+
...compatibility wrapper modules...
|
|
50
|
+
tests/
|
|
51
|
+
...pytest suite...
|
|
52
|
+
pyproject.toml
|
|
53
|
+
README.md
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Install
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install -e .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
For development and tests:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install -e '.[dev]'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from pvium_sdk import PviumSdk, PviumSdkConfig
|
|
72
|
+
|
|
73
|
+
pvium = PviumSdk.init(
|
|
74
|
+
PviumSdkConfig(
|
|
75
|
+
environment="sandbox",
|
|
76
|
+
apiKey="your_api_key",
|
|
77
|
+
clientId="your_client_id",
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
invoices = pvium.endpoints.listInvoices()
|
|
82
|
+
print(invoices)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Async Usage
|
|
86
|
+
|
|
87
|
+
`AsyncPviumSdk` preserves the same service surface as `PviumSdk` and runs service calls in a worker thread.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from pvium_sdk import AsyncPviumSdk, PviumSdkConfig
|
|
91
|
+
|
|
92
|
+
sdk = AsyncPviumSdk.init(
|
|
93
|
+
PviumSdkConfig(baseUrl="https://api-sandbox.pvium.com/v1", apiKey="your_api_key")
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# await any service method
|
|
97
|
+
invoices = await sdk.endpoints.listInvoices()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Run Tests
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pytest
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Services
|
|
107
|
+
|
|
108
|
+
- `pvium.endpoints`
|
|
109
|
+
- `createInvoice(body, options=None)`
|
|
110
|
+
- `listInvoices(options=None)`
|
|
111
|
+
- `getInvoiceStatus(code, options=None)`
|
|
112
|
+
- `cancelInvoice(invoice_id, options=None)`
|
|
113
|
+
- `getInstallmentPayments(installment_id, options=None)`
|
|
114
|
+
|
|
115
|
+
- `pvium.oauth`
|
|
116
|
+
- `exchangeCodeForToken(input, options=None)`
|
|
117
|
+
- `refreshAccessToken(input, options=None)`
|
|
118
|
+
- `getAccessTokenFromRefreshToken(input, options=None)`
|
|
119
|
+
- `getUserInfo(options=None)`
|
|
120
|
+
|
|
121
|
+
- `pvium.invites`
|
|
122
|
+
- `createBundle(input)`
|
|
123
|
+
- `signBundle(bundle, signer)`
|
|
124
|
+
- `createSignedBundle(input, signer)`
|
|
125
|
+
- `commitBundle(bundle, options=None)`
|
|
126
|
+
- `createSignedAndCommit(input, signer, options=None)`
|
|
127
|
+
|
|
128
|
+
- `pvium.payout`
|
|
129
|
+
- `create(input, options=None)`
|
|
130
|
+
- `createFinalized(input, signer, options=None, request_options=None)`
|
|
131
|
+
- `list(query=None, options=None)`
|
|
132
|
+
- `get(payout_id, options=None)`
|
|
133
|
+
- `addPayments(payout, input, options=None)`
|
|
134
|
+
- `addRecipients(payout_id, input, options=None)`
|
|
135
|
+
- `resolveRecipients(payout_id, input, options=None)`
|
|
136
|
+
- `removePayments(payout_id, input, options=None)`
|
|
137
|
+
- `deletePayment(payout_id, payment_id, options=None)`
|
|
138
|
+
- `updatePayment(payout_id, payment_id, input, options=None)`
|
|
139
|
+
- `editPayment(payout_id, payment_id, input, options=None)`
|
|
140
|
+
- `listPayments(payout_id, query=None, options=None)`
|
|
141
|
+
- `listInvites(payout_id, options=None)`
|
|
142
|
+
- `revokeInvite(payout_id, invite_id, options=None)`
|
|
143
|
+
- `revokeInviteRoot(payout_id, invite_root_id, options=None)`
|
|
144
|
+
- `delete(payout_id, options=None)`
|
|
145
|
+
- `finalize(payout_input, signer, options=None, request_options=None)`
|
|
146
|
+
|
|
147
|
+
Single-payout responses are payout intent objects. They keep dictionary
|
|
148
|
+
compatibility with `["meta"]` and `["data"]`, and expose payout fields and proxy
|
|
149
|
+
methods directly:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
payout_intent = pvium.payout.create({
|
|
153
|
+
"type": "Instant",
|
|
154
|
+
"chain": "base",
|
|
155
|
+
"name": "Creator payroll",
|
|
156
|
+
"payments": [
|
|
157
|
+
{
|
|
158
|
+
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
159
|
+
"amount": 100,
|
|
160
|
+
"token": "usdc",
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
finalized = payout_intent.finalize("your_signer_private_key")
|
|
166
|
+
print(finalized.fundingUrl)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Batch detail responses include up to 250 embedded `payments`. If the payout has
|
|
170
|
+
more, the response meta/data includes truncation fields such as
|
|
171
|
+
`paymentsTruncated`, `paymentsLimit`, and `paymentCount`. Use the paginated
|
|
172
|
+
payment list for larger payouts:
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
payments = payout_intent.listPayments({"page": 1, "perPage": 100})
|
|
176
|
+
|
|
177
|
+
for payment in payments["data"]:
|
|
178
|
+
print(payment["id"], payment["amount"])
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
You can manage a payout intent and its payments through the intent object:
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
payout_intent.editPayment(payment_id, {"memo": "Updated memo"})
|
|
185
|
+
payout_intent.deletePayment(payment_id)
|
|
186
|
+
payout_intent.revokeInvite(invite_id)
|
|
187
|
+
payout_intent.delete()
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
For funded escrow payouts, use the intent proxy instead of passing the batch
|
|
191
|
+
back into the service:
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
funded_escrow = pvium.payout.get("escrow_batch_id")
|
|
195
|
+
|
|
196
|
+
funded_escrow.addPayments({
|
|
197
|
+
"payments": [
|
|
198
|
+
{
|
|
199
|
+
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
200
|
+
"amount": 100,
|
|
201
|
+
"memo": "Approved payout",
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
"signer": "your_signer_private_key",
|
|
205
|
+
"finalizeOptions": {"claimDate": 1777488000},
|
|
206
|
+
})
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Utilities
|
|
210
|
+
|
|
211
|
+
The package exports signing helpers, webhook verification helpers, invite merkle helpers, and payout hash helpers similar to the TypeScript SDK.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/pvium.egg-info/PKG-INFO
|
|
4
|
+
src/pvium.egg-info/SOURCES.txt
|
|
5
|
+
src/pvium.egg-info/dependency_links.txt
|
|
6
|
+
src/pvium.egg-info/requires.txt
|
|
7
|
+
src/pvium.egg-info/top_level.txt
|
|
8
|
+
src/pvium_sdk/__init__.py
|
|
9
|
+
src/pvium_sdk/async_sdk.py
|
|
10
|
+
src/pvium_sdk/client.py
|
|
11
|
+
src/pvium_sdk/endpoints.py
|
|
12
|
+
src/pvium_sdk/invite_merkle.py
|
|
13
|
+
src/pvium_sdk/invites.py
|
|
14
|
+
src/pvium_sdk/oauth.py
|
|
15
|
+
src/pvium_sdk/payout.py
|
|
16
|
+
src/pvium_sdk/sdk.py
|
|
17
|
+
src/pvium_sdk/signing.py
|
|
18
|
+
src/pvium_sdk/types.py
|
|
19
|
+
src/pvium_sdk/webhooks.py
|
|
20
|
+
src/pvium_sdk/core/__init__.py
|
|
21
|
+
src/pvium_sdk/core/async_sdk.py
|
|
22
|
+
src/pvium_sdk/core/client.py
|
|
23
|
+
src/pvium_sdk/core/sdk.py
|
|
24
|
+
src/pvium_sdk/core/types.py
|
|
25
|
+
src/pvium_sdk/crypto/__init__.py
|
|
26
|
+
src/pvium_sdk/crypto/invite_merkle.py
|
|
27
|
+
src/pvium_sdk/crypto/signing.py
|
|
28
|
+
src/pvium_sdk/services/__init__.py
|
|
29
|
+
src/pvium_sdk/services/endpoints.py
|
|
30
|
+
src/pvium_sdk/services/invites.py
|
|
31
|
+
src/pvium_sdk/services/oauth.py
|
|
32
|
+
src/pvium_sdk/services/payout.py
|
|
33
|
+
src/pvium_sdk/services/webhooks.py
|
|
34
|
+
src/pvium_sdk/services/invites/__init__.py
|
|
35
|
+
src/pvium_sdk/services/invites/invites.py
|
|
36
|
+
src/pvium_sdk/services/invoice/__init__.py
|
|
37
|
+
src/pvium_sdk/services/invoice/endpoints.py
|
|
38
|
+
src/pvium_sdk/services/oauth/__init__.py
|
|
39
|
+
src/pvium_sdk/services/oauth/oauth.py
|
|
40
|
+
src/pvium_sdk/services/payout/__init__.py
|
|
41
|
+
src/pvium_sdk/services/payout/payout.py
|
|
42
|
+
src/pvium_sdk/services/webhooks/__init__.py
|
|
43
|
+
src/pvium_sdk/services/webhooks/webhooks.py
|
|
44
|
+
tests/test_async_sdk.py
|
|
45
|
+
tests/test_endpoints.py
|
|
46
|
+
tests/test_invites.py
|
|
47
|
+
tests/test_oauth.py
|
|
48
|
+
tests/test_payout.py
|
|
49
|
+
tests/test_signing.py
|
|
50
|
+
tests/test_webhooks.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|