tristero 0.3.0__py3-none-any.whl → 0.3.2__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.
- {tristero-0.3.0.dist-info → tristero-0.3.2.dist-info}/METADATA +93 -12
- {tristero-0.3.0.dist-info → tristero-0.3.2.dist-info}/RECORD +5 -5
- {tristero-0.3.0.dist-info → tristero-0.3.2.dist-info}/WHEEL +0 -0
- {tristero-0.3.0.dist-info → tristero-0.3.2.dist-info}/licenses/LICENSE +0 -0
- {tristero-0.3.0.dist-info → tristero-0.3.2.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tristero
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Library for trading on Tristero
|
|
5
5
|
Author-email: pty1 <pty11@proton.me>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -22,6 +22,23 @@ Dynamic: license-file
|
|
|
22
22
|
|
|
23
23
|
This repository is home to Tristero's trading library.
|
|
24
24
|
|
|
25
|
+
|
|
26
|
+
### How it works
|
|
27
|
+
|
|
28
|
+
Tristero supports two primary swap mechanisms:
|
|
29
|
+
|
|
30
|
+
#### Permit2 Swaps (EVM-to-EVM)
|
|
31
|
+
- **Quote & Approve** - Request a quote and approve tokens via Permit2 (gasless approval)
|
|
32
|
+
- **Sign & Submit** - Sign an EIP-712 order and submit for execution
|
|
33
|
+
- **Monitor** - Track swap progress via WebSocket updates
|
|
34
|
+
|
|
35
|
+
#### Feather Swaps (UTXO-based)
|
|
36
|
+
- **Quote & Deposit** - Request a quote to receive a deposit address
|
|
37
|
+
- **Manual Transfer** - Send funds to the provided deposit address
|
|
38
|
+
- **Monitor** - Track swap completion via WebSocket updates
|
|
39
|
+
|
|
40
|
+
This library provides both high-level convenience functions and lower-level components for precise control.
|
|
41
|
+
|
|
25
42
|
### Installation
|
|
26
43
|
```
|
|
27
44
|
pip install tristero
|
|
@@ -181,18 +198,82 @@ async def main() -> None:
|
|
|
181
198
|
asyncio.run(main())
|
|
182
199
|
```
|
|
183
200
|
|
|
184
|
-
### How it works
|
|
185
201
|
|
|
186
|
-
|
|
202
|
+
#### Feather: Start (get deposit address)
|
|
187
203
|
|
|
188
|
-
|
|
189
|
-
- **Quote & Approve** - Request a quote and approve tokens via Permit2 (gasless approval)
|
|
190
|
-
- **Sign & Submit** - Sign an EIP-712 order and submit for execution
|
|
191
|
-
- **Monitor** - Track swap progress via WebSocket updates
|
|
204
|
+
Feather swaps are deposit-based: you start an order to receive a `deposit_address`, send funds to it manually, then optionally wait for completion.
|
|
192
205
|
|
|
193
|
-
|
|
194
|
-
- **Quote & Deposit** - Request a quote to receive a deposit address
|
|
195
|
-
- **Manual Transfer** - Send funds to the provided deposit address
|
|
196
|
-
- **Monitor** - Track swap completion via WebSocket updates
|
|
206
|
+
Submit only:
|
|
197
207
|
|
|
198
|
-
|
|
208
|
+
```py
|
|
209
|
+
import asyncio
|
|
210
|
+
|
|
211
|
+
from tristero import ChainID, TokenSpec, start_feather_swap
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
async def main() -> None:
|
|
215
|
+
# Example: ETH (native) -> XMR (native)
|
|
216
|
+
src_t = TokenSpec(chain_id=ChainID.ethereum, token_address="native")
|
|
217
|
+
dst_t = TokenSpec(chain_id=ChainID.monero, token_address="native")
|
|
218
|
+
|
|
219
|
+
# Replace with your own destination address on the destination chain.
|
|
220
|
+
dst_addr = "YOUR_XMR_ADDRESS"
|
|
221
|
+
|
|
222
|
+
swap = await start_feather_swap(
|
|
223
|
+
src_t=src_t,
|
|
224
|
+
dst_t=dst_t,
|
|
225
|
+
dst_addr=dst_addr,
|
|
226
|
+
raw_amount=100_000_000_000_000_000, # 0.1 ETH in wei
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
order_id = (
|
|
230
|
+
(swap.data or {}).get("id")
|
|
231
|
+
or (swap.data or {}).get("order_id")
|
|
232
|
+
or (swap.data or {}).get("orderId")
|
|
233
|
+
or ""
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
print("order_id:", order_id)
|
|
237
|
+
print("deposit_address:", swap.deposit_address)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
asyncio.run(main())
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Submit + wait (WebSocket):
|
|
244
|
+
|
|
245
|
+
```py
|
|
246
|
+
import asyncio
|
|
247
|
+
|
|
248
|
+
from tristero import ChainID, OrderType, TokenSpec, start_feather_swap, wait_for_completion
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
async def main() -> None:
|
|
252
|
+
src_t = TokenSpec(chain_id=ChainID.ethereum, token_address="native")
|
|
253
|
+
dst_t = TokenSpec(chain_id=ChainID.monero, token_address="native")
|
|
254
|
+
dst_addr = "YOUR_XMR_ADDRESS"
|
|
255
|
+
|
|
256
|
+
swap = await start_feather_swap(
|
|
257
|
+
src_t=src_t,
|
|
258
|
+
dst_t=dst_t,
|
|
259
|
+
dst_addr=dst_addr,
|
|
260
|
+
raw_amount=100_000_000_000_000_000,
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
order_id = (
|
|
264
|
+
(swap.data or {}).get("id")
|
|
265
|
+
or (swap.data or {}).get("order_id")
|
|
266
|
+
or (swap.data or {}).get("orderId")
|
|
267
|
+
or ""
|
|
268
|
+
)
|
|
269
|
+
if not order_id:
|
|
270
|
+
raise RuntimeError(f"Feather swap response missing order id: {swap.data}")
|
|
271
|
+
|
|
272
|
+
print("deposit_address:", swap.deposit_address)
|
|
273
|
+
print("Waiting for completion...")
|
|
274
|
+
completion = await wait_for_completion(order_id, order_type=OrderType.FEATHER)
|
|
275
|
+
print(completion)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
asyncio.run(main())
|
|
279
|
+
```
|
|
@@ -15,8 +15,8 @@ tristero/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
15
15
|
tristero/files/chains.json,sha256=04jFywe_V0wrS0tcjdCUHMxIutaLJ_k5ABbbmkyZ9jY,256150
|
|
16
16
|
tristero/files/erc20_abi.json,sha256=jvsJ6aCwhMcmo3Yy1ajt5lPl_nTRg7tv-tGj87xzTOg,12800
|
|
17
17
|
tristero/files/permit2_abi.json,sha256=NV0AUUA9kqFPk56njvRRzUyjBhrBncKIMd3PrSH0LCc,17817
|
|
18
|
-
tristero-0.3.
|
|
19
|
-
tristero-0.3.
|
|
20
|
-
tristero-0.3.
|
|
21
|
-
tristero-0.3.
|
|
22
|
-
tristero-0.3.
|
|
18
|
+
tristero-0.3.2.dist-info/licenses/LICENSE,sha256=b-9ikwk9ICk964mtUbqVkDgSf3S6d52HTQxyGHmNo9M,10925
|
|
19
|
+
tristero-0.3.2.dist-info/METADATA,sha256=B1vn317_Yr9qROxJbBuzyqFxtyTtmJnRVIZhT0CIlhg,7380
|
|
20
|
+
tristero-0.3.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
21
|
+
tristero-0.3.2.dist-info/top_level.txt,sha256=xO745nTllCKw6Fdu-a2ZYv5-ZVOKl2vt9ccRUjCVXfI,9
|
|
22
|
+
tristero-0.3.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|