poly-web3 0.0.2__tar.gz → 0.0.3__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.
Files changed (24) hide show
  1. {poly_web3-0.0.2 → poly_web3-0.0.3}/PKG-INFO +302 -302
  2. {poly_web3-0.0.2 → poly_web3-0.0.3}/README.md +275 -275
  3. {poly_web3-0.0.2 → poly_web3-0.0.3}/examples/example_redeem.py +63 -63
  4. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/__init__.py +33 -33
  5. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/const.py +171 -171
  6. poly_web3-0.0.3/poly_web3/log.py +18 -0
  7. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/schema.py +22 -22
  8. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/signature/__init__.py +6 -6
  9. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/signature/build.py +113 -113
  10. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/signature/hash_message.py +48 -48
  11. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/signature/secp256k1.py +57 -57
  12. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/web3_service/__init__.py +9 -9
  13. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/web3_service/base.py +182 -181
  14. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/web3_service/eoa_service.py +17 -17
  15. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/web3_service/proxy_service.py +166 -163
  16. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3/web3_service/safe_service.py +17 -17
  17. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3.egg-info/PKG-INFO +302 -302
  18. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3.egg-info/SOURCES.txt +1 -0
  19. {poly_web3-0.0.2 → poly_web3-0.0.3}/pyproject.toml +4 -1
  20. {poly_web3-0.0.2 → poly_web3-0.0.3}/setup.cfg +4 -4
  21. {poly_web3-0.0.2 → poly_web3-0.0.3}/setup.py +40 -40
  22. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3.egg-info/dependency_links.txt +0 -0
  23. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3.egg-info/requires.txt +0 -0
  24. {poly_web3-0.0.2 → poly_web3-0.0.3}/poly_web3.egg-info/top_level.txt +0 -0
@@ -1,302 +1,302 @@
1
- Metadata-Version: 2.4
2
- Name: poly-web3
3
- Version: 0.0.2
4
- Summary: Polymarket Proxy wallet redeem SDK - Execute redeem operations on Polymarket using proxy wallets
5
- Home-page: https://github.com/tosmart01/poly-web3
6
- Author: PinBar
7
- Project-URL: Homepage, https://github.com/tosmart01/poly-web3
8
- Project-URL: Repository, https://github.com/tosmart01/poly-web3
9
- Project-URL: Bug Tracker, https://github.com/tosmart01/poly-web3/issues
10
- Keywords: polymarket,web3,proxy,wallet,redeem,blockchain,polygon
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.11
16
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
- Classifier: Topic :: Internet :: WWW/HTTP
18
- Requires-Python: >=3.11
19
- Description-Content-Type: text/markdown
20
- Requires-Dist: py-clob-client>=0.25.0
21
- Requires-Dist: py-builder-relayer-client>=0.0.1
22
- Requires-Dist: web3==6.8
23
- Requires-Dist: eth-utils==5.3.1
24
- Requires-Dist: setuptools>=80.9.0
25
- Dynamic: home-page
26
- Dynamic: requires-python
27
-
28
- # poly-web3
29
-
30
- Python SDK for Polymarket Proxy wallet redeem operations. Supports executing Conditional Token Fund (CTF) redeem operations on Polymarket through proxy wallets, Free gas.
31
-
32
- [English](README.md) | [中文](README.zh.md)
33
-
34
- ## About the Project
35
-
36
- This project is a Python rewrite of Polymarket's official TypeScript implementation of `builder-relayer-client`, designed to provide Python developers with a convenient tool for executing proxy wallet redeem operations on Polymarket.
37
-
38
- **Important Notes:**
39
- - This project **only implements the official redeem functionality**, focusing on Conditional Token Fund (CTF) redeem operations
40
- - Other features (such as trading, order placement, etc.) are not within the scope of this project
41
-
42
- **Some Polymarket-related redeem or write operations implemented in this project depend on access granted through Polymarket's Builder program. To perform real redeem operations against Polymarket, you must apply for and obtain a Builder key/credentials via Polymarket's official Builder application process. After approval you will receive the credentials required to use the Builder API—only then will the redeem flows in this repository work against the live service. For local development or automated tests, use mocks or testnet setups instead of real keys to avoid exposing production credentials.**
43
-
44
- Reference:
45
- - Polymarket Builders — Introduction: https://docs.polymarket.com/developers/builders/builder-intro
46
-
47
- **Current Status:**
48
- - ✅ **Proxy Wallet** - Fully supported for redeem functionality
49
- - 🚧 **Safe Wallet** - Under development
50
- - 🚧 **EOA Wallet** - Under development
51
-
52
- We welcome community contributions! If you'd like to help implement Safe or EOA wallet redeem functionality, or have other improvement suggestions, please feel free to submit a Pull Request.
53
-
54
- ## Features
55
-
56
- - ✅ Support for Polymarket Proxy wallet redeem operations (currently only Proxy wallet is supported)
57
- - ✅ Check if conditions are resolved
58
- - ✅ Get redeemable indexes and balances
59
- - ✅ Support for standard CTF redeem and negative risk (neg_risk) redeem
60
- - ✅ Automatic transaction execution through Relayer service
61
-
62
- ## Installation
63
-
64
- ```bash
65
- pip install poly-web3
66
- ```
67
-
68
- Or using uv:
69
-
70
- ```bash
71
- uv add poly-web3
72
- ```
73
-
74
- ## Requirements
75
-
76
- - Python >= 3.11
77
-
78
- ## Dependencies
79
-
80
- - `py-clob-client >= 0.25.0` - Polymarket CLOB client
81
- - `py-builder-relayer-client >= 0.0.1` - Builder Relayer client
82
- - `web3 == 6.8` - Web3.py library
83
- - `eth-utils == 5.3.1` - Ethereum utilities library
84
-
85
- ## Quick Start
86
-
87
- ### Basic Usage - Execute Redeem
88
-
89
- ```python
90
- import os
91
- import dotenv
92
- from py_builder_relayer_client.client import RelayClient
93
- from py_builder_signing_sdk.config import BuilderConfig
94
- from py_builder_signing_sdk.sdk_types import BuilderApiKeyCreds
95
- from py_clob_client.client import ClobClient
96
- from poly_web3 import RELAYER_URL, PolyWeb3Service
97
-
98
- dotenv.load_dotenv()
99
-
100
- # Initialize ClobClient
101
- host = "https://clob.polymarket.com"
102
- chain_id = 137 # Polygon mainnet
103
- client = ClobClient(
104
- host,
105
- key=os.getenv("POLY_API_KEY"),
106
- chain_id=chain_id,
107
- signature_type=1, # Proxy wallet type
108
- funder=os.getenv("POLYMARKET_PROXY_ADDRESS"),
109
- )
110
-
111
- client.set_api_creds(client.create_or_derive_api_creds())
112
-
113
- # Initialize RelayerClient
114
- relayer_client = RelayClient(
115
- RELAYER_URL,
116
- chain_id,
117
- os.getenv("POLY_API_KEY"),
118
- BuilderConfig(
119
- local_builder_creds=BuilderApiKeyCreds(
120
- key=os.getenv("BUILDER_KEY"),
121
- secret=os.getenv("BUILDER_SECRET"),
122
- passphrase=os.getenv("BUILDER_PASSPHRASE"),
123
- )
124
- ),
125
- )
126
-
127
- # Create service instance
128
- service = PolyWeb3Service(
129
- clob_client=client,
130
- relayer_client=relayer_client,
131
- rpc_url="https://polygon-bor.publicnode.com", # optional
132
- )
133
-
134
- # Execute redeem operation
135
- condition_id = "0xc3df016175463c44f9c9f98bddaa3bf3daaabb14b069fb7869621cffe73ddd1c"
136
- redeem_result = service.redeem(condition_id=condition_id)
137
- print(f"Redeem result: {redeem_result}")
138
-
139
- # Redeem all positions that are currently redeemable
140
- redeem_all_result = service.redeem_all()
141
- print(f"Redeem all result: {redeem_all_result}")
142
- ```
143
-
144
- ### Optional - Query Operations
145
-
146
- Before executing redeem, you can optionally check the condition status and query redeemable balances:
147
-
148
- ```python
149
- # Check if condition is resolved
150
- condition_id = "0xc3df016175463c44f9c9f98bddaa3bf3daaabb14b069fb7869621cffe73ddd1c"
151
- can_redeem = service.is_condition_resolved(condition_id)
152
-
153
- # Get redeemable indexes and balances
154
- redeem_balance = service.get_redeemable_index_and_balance(
155
- condition_id, owner=client.builder.funder
156
- )
157
-
158
- print(f"Can redeem: {can_redeem}")
159
- print(f"Redeemable balance: {redeem_balance}")
160
- ```
161
-
162
- ## API Documentation
163
-
164
- ### PolyWeb3Service
165
-
166
- The main service class that automatically selects the appropriate service implementation based on wallet type.
167
-
168
- #### Methods
169
-
170
- ##### `is_condition_resolved(condition_id: str) -> bool`
171
-
172
- Check if the specified condition is resolved.
173
-
174
- **Parameters:**
175
- - `condition_id` (str): Condition ID (32-byte hexadecimal string)
176
-
177
- **Returns:**
178
- - `bool`: Returns `True` if the condition is resolved, otherwise `False`
179
-
180
- ##### `get_winning_indexes(condition_id: str) -> list[int]`
181
-
182
- Get the list of winning indexes.
183
-
184
- **Parameters:**
185
- - `condition_id` (str): Condition ID
186
-
187
- **Returns:**
188
- - `list[int]`: List of winning indexes
189
-
190
- ##### `get_redeemable_index_and_balance(condition_id: str, owner: str) -> list[tuple]`
191
-
192
- Get redeemable indexes and balances for the specified address.
193
-
194
- **Parameters:**
195
- - `condition_id` (str): Condition ID
196
- - `owner` (str): Wallet address
197
-
198
- **Returns:**
199
- - `list[tuple]`: List of tuples containing (index, balance), balance is in USDC units
200
-
201
- ##### `redeem(condition_id: str, neg_risk: bool = False, redeem_amounts: list[int] | None = None)`
202
-
203
- Execute redeem operation.
204
-
205
- **Parameters:**
206
- - `condition_id` (str): Condition ID
207
- - `neg_risk` (bool): Whether it's a negative risk redeem, defaults to `False`
208
- - `redeem_amounts` (list[int] | None): Amount list for negative risk redeem, must contain 2 elements
209
-
210
- **Returns:**
211
- - `dict`: Transaction result containing transaction status and related information
212
-
213
- **Examples:**
214
-
215
- ```python
216
- # Standard CTF redeem
217
- result = service.redeem(condition_id="0x...")
218
-
219
- # Negative risk redeem
220
- result = service.redeem(
221
- condition_id="0x...",
222
- neg_risk=True,
223
- redeem_amounts=[1000000, 2000000] # Amounts in smallest unit (6 decimal places)
224
- )
225
- ```
226
-
227
- ##### `redeem_all() -> list[dict] | None`
228
-
229
- Redeem all positions that are currently redeemable for the authenticated account.
230
-
231
- **Returns:**
232
- - `list[dict] | None`: List of redeem results, or `None` if no redeemable positions
233
-
234
- **Examples:**
235
-
236
- ```python
237
- # Redeem all positions that can be redeemed
238
- service.redeem_all()
239
- ```
240
-
241
- ## Project Structure
242
-
243
- ```
244
- poly_web3/
245
- ├── __init__.py # Main entry point, exports PolyWeb3Service
246
- ├── const.py # Constant definitions (contract addresses, ABIs, etc.)
247
- ├── schema.py # Data models (WalletType, etc.)
248
- ├── signature/ # Signature-related modules
249
- │ ├── build.py # Proxy wallet derivation and struct hashing
250
- │ ├── hash_message.py # Message hashing
251
- │ └── secp256k1.py # secp256k1 signing
252
- └── web3_service/ # Web3 service implementations
253
- ├── base.py # Base service class
254
- ├── proxy_service.py # Proxy wallet service (✅ Implemented)
255
- ├── eoa_service.py # EOA wallet service (🚧 Under development)
256
- └── safe_service.py # Safe wallet service (🚧 Under development)
257
- ```
258
-
259
- ## Notes
260
-
261
- 1. **Environment Variable Security**: Make sure `.env` file is added to `.gitignore`, do not commit sensitive information to the code repository
262
- 2. **Network Support**: Currently mainly supports Polygon mainnet (chain_id: 137), Amoy testnet may have limited functionality
263
- 3. **Wallet Type**: **Currently only Proxy wallet is supported** (signature_type: 1), Safe and EOA wallet redeem functionality is under development
264
- 4. **Gas Fees**: Transactions are executed through Relayer, gas fees are handled by the Relayer
265
-
266
- ## Development
267
-
268
- ### Install Development Dependencies
269
-
270
- ```bash
271
- uv pip install -e ".[dev]"
272
- ```
273
-
274
- ### Run Examples
275
-
276
- ```bash
277
- python examples/example_redeem.py
278
- ```
279
-
280
- ### Contributing
281
-
282
- We welcome all forms of contributions! If you'd like to:
283
-
284
- - Implement Safe or EOA wallet support
285
- - Fix bugs or improve existing functionality
286
- - Add new features or improve documentation
287
- - Make suggestions or report issues
288
-
289
- Please feel free to submit an Issue or Pull Request. Your contributions will help make this project better!
290
-
291
- ## License
292
-
293
- MIT
294
-
295
- ## Author
296
-
297
- PinBar
298
-
299
- ## Related Links
300
-
301
- - [Polymarket](https://polymarket.com/)
302
- - [Polygon Network](https://polygon.technology/)
1
+ Metadata-Version: 2.4
2
+ Name: poly-web3
3
+ Version: 0.0.3
4
+ Summary: Polymarket Proxy wallet redeem SDK - Execute redeem operations on Polymarket using proxy wallets
5
+ Home-page: https://github.com/tosmart01/poly-web3
6
+ Author: PinBar
7
+ Project-URL: Homepage, https://github.com/tosmart01/poly-web3
8
+ Project-URL: Repository, https://github.com/tosmart01/poly-web3
9
+ Project-URL: Bug Tracker, https://github.com/tosmart01/poly-web3/issues
10
+ Keywords: polymarket,web3,proxy,wallet,redeem,blockchain,polygon
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.11
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: Topic :: Internet :: WWW/HTTP
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: py-clob-client>=0.25.0
21
+ Requires-Dist: py-builder-relayer-client>=0.0.1
22
+ Requires-Dist: web3==6.8
23
+ Requires-Dist: eth-utils==5.3.1
24
+ Requires-Dist: setuptools>=80.9.0
25
+ Dynamic: home-page
26
+ Dynamic: requires-python
27
+
28
+ # poly-web3
29
+
30
+ Python SDK for Polymarket Proxy wallet redeem operations. Supports executing Conditional Token Fund (CTF) redeem operations on Polymarket through proxy wallets, Free gas.
31
+
32
+ [English](README.md) | [中文](README.zh.md)
33
+
34
+ ## About the Project
35
+
36
+ This project is a Python rewrite of Polymarket's official TypeScript implementation of `builder-relayer-client`, designed to provide Python developers with a convenient tool for executing proxy wallet redeem operations on Polymarket.
37
+
38
+ **Important Notes:**
39
+ - This project **only implements the official redeem functionality**, focusing on Conditional Token Fund (CTF) redeem operations
40
+ - Other features (such as trading, order placement, etc.) are not within the scope of this project
41
+
42
+ **Some Polymarket-related redeem or write operations implemented in this project depend on access granted through Polymarket's Builder program. To perform real redeem operations against Polymarket, you must apply for and obtain a Builder key/credentials via Polymarket's official Builder application process. After approval you will receive the credentials required to use the Builder API—only then will the redeem flows in this repository work against the live service. For local development or automated tests, use mocks or testnet setups instead of real keys to avoid exposing production credentials.**
43
+
44
+ Reference:
45
+ - Polymarket Builders — Introduction: https://docs.polymarket.com/developers/builders/builder-intro
46
+
47
+ **Current Status:**
48
+ - ✅ **Proxy Wallet** - Fully supported for redeem functionality
49
+ - 🚧 **Safe Wallet** - Under development
50
+ - 🚧 **EOA Wallet** - Under development
51
+
52
+ We welcome community contributions! If you'd like to help implement Safe or EOA wallet redeem functionality, or have other improvement suggestions, please feel free to submit a Pull Request.
53
+
54
+ ## Features
55
+
56
+ - ✅ Support for Polymarket Proxy wallet redeem operations (currently only Proxy wallet is supported)
57
+ - ✅ Check if conditions are resolved
58
+ - ✅ Get redeemable indexes and balances
59
+ - ✅ Support for standard CTF redeem and negative risk (neg_risk) redeem
60
+ - ✅ Automatic transaction execution through Relayer service
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ pip install poly-web3
66
+ ```
67
+
68
+ Or using uv:
69
+
70
+ ```bash
71
+ uv add poly-web3
72
+ ```
73
+
74
+ ## Requirements
75
+
76
+ - Python >= 3.11
77
+
78
+ ## Dependencies
79
+
80
+ - `py-clob-client >= 0.25.0` - Polymarket CLOB client
81
+ - `py-builder-relayer-client >= 0.0.1` - Builder Relayer client
82
+ - `web3 == 6.8` - Web3.py library
83
+ - `eth-utils == 5.3.1` - Ethereum utilities library
84
+
85
+ ## Quick Start
86
+
87
+ ### Basic Usage - Execute Redeem
88
+
89
+ ```python
90
+ import os
91
+ import dotenv
92
+ from py_builder_relayer_client.client import RelayClient
93
+ from py_builder_signing_sdk.config import BuilderConfig
94
+ from py_builder_signing_sdk.sdk_types import BuilderApiKeyCreds
95
+ from py_clob_client.client import ClobClient
96
+ from poly_web3 import RELAYER_URL, PolyWeb3Service
97
+
98
+ dotenv.load_dotenv()
99
+
100
+ # Initialize ClobClient
101
+ host = "https://clob.polymarket.com"
102
+ chain_id = 137 # Polygon mainnet
103
+ client = ClobClient(
104
+ host,
105
+ key=os.getenv("POLY_API_KEY"),
106
+ chain_id=chain_id,
107
+ signature_type=1, # Proxy wallet type
108
+ funder=os.getenv("POLYMARKET_PROXY_ADDRESS"),
109
+ )
110
+
111
+ client.set_api_creds(client.create_or_derive_api_creds())
112
+
113
+ # Initialize RelayerClient
114
+ relayer_client = RelayClient(
115
+ RELAYER_URL,
116
+ chain_id,
117
+ os.getenv("POLY_API_KEY"),
118
+ BuilderConfig(
119
+ local_builder_creds=BuilderApiKeyCreds(
120
+ key=os.getenv("BUILDER_KEY"),
121
+ secret=os.getenv("BUILDER_SECRET"),
122
+ passphrase=os.getenv("BUILDER_PASSPHRASE"),
123
+ )
124
+ ),
125
+ )
126
+
127
+ # Create service instance
128
+ service = PolyWeb3Service(
129
+ clob_client=client,
130
+ relayer_client=relayer_client,
131
+ rpc_url="https://polygon-bor.publicnode.com", # optional
132
+ )
133
+
134
+ # Execute redeem operation
135
+ condition_id = "0xc3df016175463c44f9c9f98bddaa3bf3daaabb14b069fb7869621cffe73ddd1c"
136
+ redeem_result = service.redeem(condition_id=condition_id)
137
+ print(f"Redeem result: {redeem_result}")
138
+
139
+ # Redeem all positions that are currently redeemable
140
+ redeem_all_result = service.redeem_all()
141
+ print(f"Redeem all result: {redeem_all_result}")
142
+ ```
143
+
144
+ ### Optional - Query Operations
145
+
146
+ Before executing redeem, you can optionally check the condition status and query redeemable balances:
147
+
148
+ ```python
149
+ # Check if condition is resolved
150
+ condition_id = "0xc3df016175463c44f9c9f98bddaa3bf3daaabb14b069fb7869621cffe73ddd1c"
151
+ can_redeem = service.is_condition_resolved(condition_id)
152
+
153
+ # Get redeemable indexes and balances
154
+ redeem_balance = service.get_redeemable_index_and_balance(
155
+ condition_id, owner=client.builder.funder
156
+ )
157
+
158
+ print(f"Can redeem: {can_redeem}")
159
+ print(f"Redeemable balance: {redeem_balance}")
160
+ ```
161
+
162
+ ## API Documentation
163
+
164
+ ### PolyWeb3Service
165
+
166
+ The main service class that automatically selects the appropriate service implementation based on wallet type.
167
+
168
+ #### Methods
169
+
170
+ ##### `is_condition_resolved(condition_id: str) -> bool`
171
+
172
+ Check if the specified condition is resolved.
173
+
174
+ **Parameters:**
175
+ - `condition_id` (str): Condition ID (32-byte hexadecimal string)
176
+
177
+ **Returns:**
178
+ - `bool`: Returns `True` if the condition is resolved, otherwise `False`
179
+
180
+ ##### `get_winning_indexes(condition_id: str) -> list[int]`
181
+
182
+ Get the list of winning indexes.
183
+
184
+ **Parameters:**
185
+ - `condition_id` (str): Condition ID
186
+
187
+ **Returns:**
188
+ - `list[int]`: List of winning indexes
189
+
190
+ ##### `get_redeemable_index_and_balance(condition_id: str, owner: str) -> list[tuple]`
191
+
192
+ Get redeemable indexes and balances for the specified address.
193
+
194
+ **Parameters:**
195
+ - `condition_id` (str): Condition ID
196
+ - `owner` (str): Wallet address
197
+
198
+ **Returns:**
199
+ - `list[tuple]`: List of tuples containing (index, balance), balance is in USDC units
200
+
201
+ ##### `redeem(condition_id: str, neg_risk: bool = False, redeem_amounts: list[int] | None = None)`
202
+
203
+ Execute redeem operation.
204
+
205
+ **Parameters:**
206
+ - `condition_id` (str): Condition ID
207
+ - `neg_risk` (bool): Whether it's a negative risk redeem, defaults to `False`
208
+ - `redeem_amounts` (list[int] | None): Amount list for negative risk redeem, must contain 2 elements
209
+
210
+ **Returns:**
211
+ - `dict`: Transaction result containing transaction status and related information
212
+
213
+ **Examples:**
214
+
215
+ ```python
216
+ # Standard CTF redeem
217
+ result = service.redeem(condition_id="0x...")
218
+
219
+ # Negative risk redeem
220
+ result = service.redeem(
221
+ condition_id="0x...",
222
+ neg_risk=True,
223
+ redeem_amounts=[1000000, 2000000] # Amounts in smallest unit (6 decimal places)
224
+ )
225
+ ```
226
+
227
+ ##### `redeem_all() -> list[dict] | None`
228
+
229
+ Redeem all positions that are currently redeemable for the authenticated account.
230
+
231
+ **Returns:**
232
+ - `list[dict] | None`: List of redeem results, or `None` if no redeemable positions
233
+
234
+ **Examples:**
235
+
236
+ ```python
237
+ # Redeem all positions that can be redeemed
238
+ service.redeem_all()
239
+ ```
240
+
241
+ ## Project Structure
242
+
243
+ ```
244
+ poly_web3/
245
+ ├── __init__.py # Main entry point, exports PolyWeb3Service
246
+ ├── const.py # Constant definitions (contract addresses, ABIs, etc.)
247
+ ├── schema.py # Data models (WalletType, etc.)
248
+ ├── signature/ # Signature-related modules
249
+ │ ├── build.py # Proxy wallet derivation and struct hashing
250
+ │ ├── hash_message.py # Message hashing
251
+ │ └── secp256k1.py # secp256k1 signing
252
+ └── web3_service/ # Web3 service implementations
253
+ ├── base.py # Base service class
254
+ ├── proxy_service.py # Proxy wallet service (✅ Implemented)
255
+ ├── eoa_service.py # EOA wallet service (🚧 Under development)
256
+ └── safe_service.py # Safe wallet service (🚧 Under development)
257
+ ```
258
+
259
+ ## Notes
260
+
261
+ 1. **Environment Variable Security**: Make sure `.env` file is added to `.gitignore`, do not commit sensitive information to the code repository
262
+ 2. **Network Support**: Currently mainly supports Polygon mainnet (chain_id: 137), Amoy testnet may have limited functionality
263
+ 3. **Wallet Type**: **Currently only Proxy wallet is supported** (signature_type: 1), Safe and EOA wallet redeem functionality is under development
264
+ 4. **Gas Fees**: Transactions are executed through Relayer, gas fees are handled by the Relayer
265
+
266
+ ## Development
267
+
268
+ ### Install Development Dependencies
269
+
270
+ ```bash
271
+ uv pip install -e ".[dev]"
272
+ ```
273
+
274
+ ### Run Examples
275
+
276
+ ```bash
277
+ python examples/example_redeem.py
278
+ ```
279
+
280
+ ### Contributing
281
+
282
+ We welcome all forms of contributions! If you'd like to:
283
+
284
+ - Implement Safe or EOA wallet support
285
+ - Fix bugs or improve existing functionality
286
+ - Add new features or improve documentation
287
+ - Make suggestions or report issues
288
+
289
+ Please feel free to submit an Issue or Pull Request. Your contributions will help make this project better!
290
+
291
+ ## License
292
+
293
+ MIT
294
+
295
+ ## Author
296
+
297
+ PinBar
298
+
299
+ ## Related Links
300
+
301
+ - [Polymarket](https://polymarket.com/)
302
+ - [Polygon Network](https://polygon.technology/)