safe-kit 0.0.11__py3-none-any.whl
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.
- safe_kit/__init__.py +22 -0
- safe_kit/abis.py +366 -0
- safe_kit/adapter.py +147 -0
- safe_kit/contract_types.py +151 -0
- safe_kit/errors.py +57 -0
- safe_kit/factory.py +143 -0
- safe_kit/managers/__init__.py +15 -0
- safe_kit/managers/guard_manager.py +61 -0
- safe_kit/managers/module_manager.py +85 -0
- safe_kit/managers/owner_manager.py +94 -0
- safe_kit/managers/token_manager.py +100 -0
- safe_kit/multisend.py +41 -0
- safe_kit/py.typed +0 -0
- safe_kit/safe.py +386 -0
- safe_kit/service.py +343 -0
- safe_kit/types.py +239 -0
- safe_kit-0.0.11.dist-info/METADATA +137 -0
- safe_kit-0.0.11.dist-info/RECORD +20 -0
- safe_kit-0.0.11.dist-info/WHEEL +4 -0
- safe_kit-0.0.11.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: safe-kit
|
|
3
|
+
Version: 0.0.11
|
|
4
|
+
Summary: Python implementation of the Safe Protocol Kit
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: ethereum,safe,gnosis-safe,web3,sdk,blockchain
|
|
8
|
+
Author: smallyu
|
|
9
|
+
Author-email: smallyu@users.noreply.github.com
|
|
10
|
+
Requires-Python: >=3.10,<4.0
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Dist: eth-account (>=0.11.0,<0.12.0)
|
|
22
|
+
Requires-Dist: eth-typing (<5.0.0)
|
|
23
|
+
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
|
24
|
+
Requires-Dist: requests (>=2.0.0,<3.0.0)
|
|
25
|
+
Requires-Dist: setuptools
|
|
26
|
+
Requires-Dist: web3 (>=6.0.0,<7.0.0)
|
|
27
|
+
Project-URL: Documentation, https://github.com/smallyunet/safe-kit
|
|
28
|
+
Project-URL: Homepage, https://github.com/smallyunet/safe-kit
|
|
29
|
+
Project-URL: Repository, https://github.com/smallyunet/safe-kit
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# Safe Kit (Python)
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/safe-kit/)
|
|
35
|
+
[](https://pypi.org/project/safe-kit/)
|
|
36
|
+
[](https://github.com/smallyunet/safe-kit/blob/main/LICENSE)
|
|
37
|
+
[](https://github.com/smallyunet/safe-kit/actions/workflows/ci.yml)
|
|
38
|
+
[](https://codecov.io/gh/smallyunet/safe-kit)
|
|
39
|
+
|
|
40
|
+
A Python implementation of the [Safe Protocol Kit](https://github.com/safe-global/safe-core-sdk), designed to mirror the developer experience of the official Node.js SDK.
|
|
41
|
+
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
- **DX First**: Intuitive API for interacting with Safe smart accounts.
|
|
45
|
+
- **Type Safe**: Built with Pydantic and fully typed for robust development.
|
|
46
|
+
- **Modern Stack**: Uses Web3.py, Eth-account, and Python 3.10+.
|
|
47
|
+
- **Full Protocol Support**: Supports Safe deployment, transaction creation, signing (EIP-712 & eth_sign), and execution.
|
|
48
|
+
- **Advanced Features**: MultiSend (batching), Safe Transaction Service integration, and more.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
You can install `safe-kit` via pip:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install safe-kit
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or with Poetry:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
poetry add safe-kit
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
### Initialization
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from web3 import Web3
|
|
70
|
+
from eth_account import Account
|
|
71
|
+
from safe_kit.safe import Safe
|
|
72
|
+
from safe_kit.adapter import Web3Adapter
|
|
73
|
+
|
|
74
|
+
# Setup Web3 and Signer
|
|
75
|
+
w3 = Web3(Web3.HTTPProvider("RPC_URL"))
|
|
76
|
+
owner = Account.from_key("PRIVATE_KEY")
|
|
77
|
+
adapter = Web3Adapter(web3=w3, signer=owner)
|
|
78
|
+
|
|
79
|
+
# Initialize Safe
|
|
80
|
+
safe = Safe(eth_adapter=adapter, safe_address="0xSafeAddress")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Creating and Signing Transactions
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from safe_kit.types import SafeTransactionData
|
|
87
|
+
|
|
88
|
+
# Create a transaction (e.g., send ETH)
|
|
89
|
+
tx_data = SafeTransactionData(
|
|
90
|
+
to="0xRecipient",
|
|
91
|
+
value=1000000000000000000, # 1 ETH
|
|
92
|
+
data="0x"
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
safe_tx = safe.create_transaction(tx_data)
|
|
96
|
+
|
|
97
|
+
# Sign the transaction
|
|
98
|
+
# Supports "eth_sign_typed_data" (default, EIP-712) or "eth_sign" (legacy)
|
|
99
|
+
signed_tx = safe.sign_transaction(safe_tx)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Executing Transactions
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
# Execute the transaction on-chain
|
|
106
|
+
tx_hash = safe.execute_transaction(signed_tx)
|
|
107
|
+
print(f"Transaction executed: {tx_hash}")
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For more advanced usage (Batching, Transaction Service, Deployment), please refer to the [User Guide](https://smallyunet.github.io/safe-kit/user_guide/).
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
### Setup
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Install dependencies
|
|
118
|
+
poetry install
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Running Tests
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
poetry run pytest
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Linting
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
poetry run ruff check .
|
|
131
|
+
poetry run mypy .
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Roadmap
|
|
135
|
+
|
|
136
|
+
See [docs/roadmap.md](docs/roadmap.md) for the current implementation status.
|
|
137
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
safe_kit/__init__.py,sha256=IdkQGluiCnWhNipRzKaAaCy3rOfPip83NR09xIu-YP0,640
|
|
2
|
+
safe_kit/abis.py,sha256=GABlARwUpYV5VO1_vs1rkA6tu9NDRIYXrJL52THkBVA,13135
|
|
3
|
+
safe_kit/adapter.py,sha256=NUtDKOjQqPG4XjbcHI5M8CsfOyUHkj8KwfVKfYxSgjs,4309
|
|
4
|
+
safe_kit/contract_types.py,sha256=6ATY0O4eaaoB_W-puPbSH7tIfc61aDAXZKu1P388Yw0,2642
|
|
5
|
+
safe_kit/errors.py,sha256=GxxuctxqBCNPfDh3nfnvOf7VRyITx5ItK_t_aGu3Hus,2097
|
|
6
|
+
safe_kit/factory.py,sha256=zHuncqOrTuYfiB87bxSP83asULS135uJ_19W8n5C_wY,5021
|
|
7
|
+
safe_kit/managers/__init__.py,sha256=-3jVIeEgXeSJF3NJeFwky1NocPHvxXojCYjeOgZoSRc,422
|
|
8
|
+
safe_kit/managers/guard_manager.py,sha256=58eih6HBAWeHoD8NxCGxaA30xum0f4-JCWRz-eziISs,2099
|
|
9
|
+
safe_kit/managers/module_manager.py,sha256=dwv31NZsshJJwM4y2o9YrBgZmRAZiCGro5H6UFOSzcQ,2607
|
|
10
|
+
safe_kit/managers/owner_manager.py,sha256=tTwiG7_1623OeUGAvlbXH4APPbudxC0L6SovJqP9JAg,3016
|
|
11
|
+
safe_kit/managers/token_manager.py,sha256=E0XCzrUGg_5JGKHPAXTLaCRMAqQWSbNSO1m07nFZx1g,3215
|
|
12
|
+
safe_kit/multisend.py,sha256=6OzznO1ziEIrL3LCjNUGDLKFfaXh601d0yrfzVDPL9I,1252
|
|
13
|
+
safe_kit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
safe_kit/safe.py,sha256=BJbi6PGjwFESKuimXew3YM8R4N8jVmpXeggcgCXb08Y,14073
|
|
15
|
+
safe_kit/service.py,sha256=TkSKGQP0IeK3zqCqa3JWmqNSDttgCwtULl4C0jdF8DI,11954
|
|
16
|
+
safe_kit/types.py,sha256=vc9miABzsKwGv8-Niss0GCud4vBv9prZPKQQqhA_PKQ,7374
|
|
17
|
+
safe_kit-0.0.11.dist-info/METADATA,sha256=N9m7gRNGNtVW5AQByD7wMEYyC-NgljYA_OVOG61M92Q,4089
|
|
18
|
+
safe_kit-0.0.11.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
19
|
+
safe_kit-0.0.11.dist-info/licenses/LICENSE,sha256=YypDTCKk9BYU9jm_LE6nMaSpID4pwh1WLthxpvPgiI0,1064
|
|
20
|
+
safe_kit-0.0.11.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 smallyu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|