defistream 1.0.3__tar.gz → 1.0.6__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.
- {defistream-1.0.3 → defistream-1.0.6}/PKG-INFO +2 -2
- {defistream-1.0.3 → defistream-1.0.6}/README.md +1 -1
- {defistream-1.0.3 → defistream-1.0.6}/pyproject.toml +1 -1
- {defistream-1.0.3 → defistream-1.0.6}/src/defistream/__init__.py +1 -28
- defistream-1.0.6/src/defistream/models.py +27 -0
- defistream-1.0.3/sample_usage.py +0 -23
- defistream-1.0.3/src/defistream/models.py +0 -174
- {defistream-1.0.3 → defistream-1.0.6}/.gitignore +0 -0
- {defistream-1.0.3 → defistream-1.0.6}/LICENSE +0 -0
- {defistream-1.0.3 → defistream-1.0.6}/src/defistream/client.py +0 -0
- {defistream-1.0.3 → defistream-1.0.6}/src/defistream/exceptions.py +0 -0
- {defistream-1.0.3 → defistream-1.0.6}/src/defistream/protocols.py +0 -0
- {defistream-1.0.3 → defistream-1.0.6}/src/defistream/py.typed +0 -0
- {defistream-1.0.3 → defistream-1.0.6}/src/defistream/query.py +0 -0
- {defistream-1.0.3 → defistream-1.0.6}/tests/__init__.py +0 -0
- {defistream-1.0.3 → defistream-1.0.6}/tests/test_client.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: defistream
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.6
|
|
4
4
|
Summary: Python client for the DeFiStream API
|
|
5
5
|
Project-URL: Homepage, https://defistream.dev
|
|
6
6
|
Project-URL: Documentation, https://docs.defistream.dev
|
|
@@ -413,7 +413,7 @@ print(f"Request cost: {client.last_response.request_cost}")
|
|
|
413
413
|
|
|
414
414
|
| Method | Protocols | Description |
|
|
415
415
|
|--------|-----------|-------------|
|
|
416
|
-
| `.token(symbol)` | ERC20 | Token symbol (USDT, USDC) or contract address |
|
|
416
|
+
| `.token(symbol)` | ERC20 | Token symbol (USDT, USDC) or contract address (required) |
|
|
417
417
|
| `.sender(addr)` | ERC20, Native | Filter by sender address |
|
|
418
418
|
| `.receiver(addr)` | ERC20, Native | Filter by receiver address |
|
|
419
419
|
| `.min_amount(amt)` | ERC20, Native | Minimum transfer amount |
|
|
@@ -379,7 +379,7 @@ print(f"Request cost: {client.last_response.request_cost}")
|
|
|
379
379
|
|
|
380
380
|
| Method | Protocols | Description |
|
|
381
381
|
|--------|-----------|-------------|
|
|
382
|
-
| `.token(symbol)` | ERC20 | Token symbol (USDT, USDC) or contract address |
|
|
382
|
+
| `.token(symbol)` | ERC20 | Token symbol (USDT, USDC) or contract address (required) |
|
|
383
383
|
| `.sender(addr)` | ERC20, Native | Filter by sender address |
|
|
384
384
|
| `.receiver(addr)` | ERC20, Native | Filter by receiver address |
|
|
385
385
|
| `.min_amount(amt)` | ERC20, Native | Minimum transfer amount |
|
|
@@ -29,23 +29,9 @@ from .exceptions import (
|
|
|
29
29
|
ServerError,
|
|
30
30
|
ValidationError,
|
|
31
31
|
)
|
|
32
|
-
from .models import (
|
|
33
|
-
AAVEBorrowEvent,
|
|
34
|
-
AAVEDepositEvent,
|
|
35
|
-
AAVELiquidationEvent,
|
|
36
|
-
AAVERepayEvent,
|
|
37
|
-
AAVEWithdrawEvent,
|
|
38
|
-
ERC20TransferEvent,
|
|
39
|
-
EventBase,
|
|
40
|
-
LidoDepositEvent,
|
|
41
|
-
LidoWithdrawEvent,
|
|
42
|
-
NativeTransferEvent,
|
|
43
|
-
ResponseMetadata,
|
|
44
|
-
UniswapSwapEvent,
|
|
45
|
-
)
|
|
46
32
|
from .query import AsyncQueryBuilder, QueryBuilder
|
|
47
33
|
|
|
48
|
-
__version__ = "1.0.
|
|
34
|
+
__version__ = "1.0.6"
|
|
49
35
|
|
|
50
36
|
__all__ = [
|
|
51
37
|
# Clients
|
|
@@ -62,17 +48,4 @@ __all__ = [
|
|
|
62
48
|
"ValidationError",
|
|
63
49
|
"NotFoundError",
|
|
64
50
|
"ServerError",
|
|
65
|
-
# Models
|
|
66
|
-
"EventBase",
|
|
67
|
-
"ResponseMetadata",
|
|
68
|
-
"ERC20TransferEvent",
|
|
69
|
-
"NativeTransferEvent",
|
|
70
|
-
"AAVEDepositEvent",
|
|
71
|
-
"AAVEWithdrawEvent",
|
|
72
|
-
"AAVEBorrowEvent",
|
|
73
|
-
"AAVERepayEvent",
|
|
74
|
-
"AAVELiquidationEvent",
|
|
75
|
-
"UniswapSwapEvent",
|
|
76
|
-
"LidoDepositEvent",
|
|
77
|
-
"LidoWithdrawEvent",
|
|
78
51
|
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Pydantic models for DeFiStream API responses."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ResponseMetadata(BaseModel):
|
|
8
|
+
"""Metadata from API response headers."""
|
|
9
|
+
|
|
10
|
+
rate_limit: int | None = None
|
|
11
|
+
quota_remaining: int | None = None
|
|
12
|
+
request_cost: int | None = None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class EventsResponse(BaseModel):
|
|
16
|
+
"""Standard events API response."""
|
|
17
|
+
|
|
18
|
+
status: Literal["success", "error"]
|
|
19
|
+
events: list[dict[str, Any]] = []
|
|
20
|
+
count: int = 0
|
|
21
|
+
error: str | None = None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class DecodersResponse(BaseModel):
|
|
25
|
+
"""Response from /decoders endpoint."""
|
|
26
|
+
|
|
27
|
+
decoders: list[str] = []
|
defistream-1.0.3/sample_usage.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from defistream import DeFiStream
|
|
2
|
-
|
|
3
|
-
client = DeFiStream(api_key="")
|
|
4
|
-
|
|
5
|
-
# # Test the builder pattern
|
|
6
|
-
# query = client.erc20.transfers("DAI").network("ETH").start_block(24000000).end_block(24000100).min_amount(100)
|
|
7
|
-
# print(query) # Shows QueryBuilder repr
|
|
8
|
-
#
|
|
9
|
-
# # Execute (requires actual API connection)
|
|
10
|
-
# transfers_df = query.as_df()
|
|
11
|
-
# print(transfers_df)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
transfers = (
|
|
15
|
-
client.native_token.transfers()
|
|
16
|
-
.network("ETH")
|
|
17
|
-
.start_block(24000000)
|
|
18
|
-
.end_block(24000100)
|
|
19
|
-
.min_amount(1.0)
|
|
20
|
-
.as_dict()
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
print(transfers)
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"""Pydantic models for DeFiStream API responses."""
|
|
2
|
-
|
|
3
|
-
from typing import Any, Literal
|
|
4
|
-
from pydantic import BaseModel, Field
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class ResponseMetadata(BaseModel):
|
|
8
|
-
"""Metadata from API response headers."""
|
|
9
|
-
|
|
10
|
-
rate_limit: int | None = None
|
|
11
|
-
quota_remaining: int | None = None
|
|
12
|
-
request_cost: int | None = None
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class EventBase(BaseModel):
|
|
16
|
-
"""Base model for all events."""
|
|
17
|
-
|
|
18
|
-
block_number: int
|
|
19
|
-
time: str | None = None
|
|
20
|
-
# Verbose fields (only present when verbose=true)
|
|
21
|
-
name: str | None = None
|
|
22
|
-
network: str | None = None
|
|
23
|
-
tx_id: str | None = None
|
|
24
|
-
tx_hash: str | None = None
|
|
25
|
-
log_index: int | None = None
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class ERC20TransferEvent(EventBase):
|
|
29
|
-
"""ERC20 Transfer event."""
|
|
30
|
-
|
|
31
|
-
sender: str = Field(alias="from_address", default="")
|
|
32
|
-
receiver: str = Field(alias="to_address", default="")
|
|
33
|
-
amount: float = 0.0
|
|
34
|
-
token_address: str | None = None
|
|
35
|
-
token_symbol: str | None = None
|
|
36
|
-
|
|
37
|
-
model_config = {"populate_by_name": True}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class ERC20ApprovalEvent(EventBase):
|
|
41
|
-
"""ERC20 Approval event."""
|
|
42
|
-
|
|
43
|
-
owner: str = ""
|
|
44
|
-
spender: str = ""
|
|
45
|
-
amount: float = 0.0
|
|
46
|
-
token_address: str | None = None
|
|
47
|
-
token_symbol: str | None = None
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class NativeTransferEvent(EventBase):
|
|
51
|
-
"""Native token (ETH/MATIC/etc) transfer event."""
|
|
52
|
-
|
|
53
|
-
sender: str = ""
|
|
54
|
-
receiver: str = ""
|
|
55
|
-
amount: float = 0.0
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
class AAVEDepositEvent(EventBase):
|
|
59
|
-
"""AAVE V3 Supply/Deposit event."""
|
|
60
|
-
|
|
61
|
-
user: str = ""
|
|
62
|
-
reserve: str = ""
|
|
63
|
-
amount: float = 0.0
|
|
64
|
-
on_behalf_of: str | None = None
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class AAVEWithdrawEvent(EventBase):
|
|
68
|
-
"""AAVE V3 Withdraw event."""
|
|
69
|
-
|
|
70
|
-
user: str = ""
|
|
71
|
-
reserve: str = ""
|
|
72
|
-
amount: float = 0.0
|
|
73
|
-
to: str | None = None
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class AAVEBorrowEvent(EventBase):
|
|
77
|
-
"""AAVE V3 Borrow event."""
|
|
78
|
-
|
|
79
|
-
user: str = ""
|
|
80
|
-
reserve: str = ""
|
|
81
|
-
amount: float = 0.0
|
|
82
|
-
interest_rate_mode: int | None = None
|
|
83
|
-
borrow_rate: float | None = None
|
|
84
|
-
on_behalf_of: str | None = None
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
class AAVERepayEvent(EventBase):
|
|
88
|
-
"""AAVE V3 Repay event."""
|
|
89
|
-
|
|
90
|
-
user: str = ""
|
|
91
|
-
reserve: str = ""
|
|
92
|
-
amount: float = 0.0
|
|
93
|
-
repayer: str | None = None
|
|
94
|
-
use_a_tokens: bool | None = None
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
class AAVELiquidationEvent(EventBase):
|
|
98
|
-
"""AAVE V3 Liquidation event."""
|
|
99
|
-
|
|
100
|
-
liquidator: str = ""
|
|
101
|
-
user: str = ""
|
|
102
|
-
collateral_asset: str = ""
|
|
103
|
-
debt_asset: str = ""
|
|
104
|
-
debt_to_cover: float = 0.0
|
|
105
|
-
liquidated_collateral_amount: float = 0.0
|
|
106
|
-
receive_a_token: bool | None = None
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
class UniswapSwapEvent(EventBase):
|
|
110
|
-
"""Uniswap V3 Swap event."""
|
|
111
|
-
|
|
112
|
-
pool: str = ""
|
|
113
|
-
sender: str = ""
|
|
114
|
-
recipient: str = ""
|
|
115
|
-
amount0: float = 0.0
|
|
116
|
-
amount1: float = 0.0
|
|
117
|
-
sqrt_price_x96: int | None = None
|
|
118
|
-
liquidity: int | None = None
|
|
119
|
-
tick: int | None = None
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
class UniswapMintEvent(EventBase):
|
|
123
|
-
"""Uniswap V3 Mint (add liquidity) event."""
|
|
124
|
-
|
|
125
|
-
pool: str = ""
|
|
126
|
-
owner: str = ""
|
|
127
|
-
tick_lower: int = 0
|
|
128
|
-
tick_upper: int = 0
|
|
129
|
-
amount: int = 0
|
|
130
|
-
amount0: float = 0.0
|
|
131
|
-
amount1: float = 0.0
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
class UniswapBurnEvent(EventBase):
|
|
135
|
-
"""Uniswap V3 Burn (remove liquidity) event."""
|
|
136
|
-
|
|
137
|
-
pool: str = ""
|
|
138
|
-
owner: str = ""
|
|
139
|
-
tick_lower: int = 0
|
|
140
|
-
tick_upper: int = 0
|
|
141
|
-
amount: int = 0
|
|
142
|
-
amount0: float = 0.0
|
|
143
|
-
amount1: float = 0.0
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
class LidoDepositEvent(EventBase):
|
|
147
|
-
"""Lido stETH deposit event."""
|
|
148
|
-
|
|
149
|
-
sender: str = ""
|
|
150
|
-
amount: float = 0.0
|
|
151
|
-
shares: float = 0.0
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
class LidoWithdrawEvent(EventBase):
|
|
155
|
-
"""Lido stETH withdrawal event."""
|
|
156
|
-
|
|
157
|
-
owner: str = ""
|
|
158
|
-
request_id: int = 0
|
|
159
|
-
amount: float = 0.0
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
class EventsResponse(BaseModel):
|
|
163
|
-
"""Standard events API response."""
|
|
164
|
-
|
|
165
|
-
status: Literal["success", "error"]
|
|
166
|
-
events: list[dict[str, Any]] = []
|
|
167
|
-
count: int = 0
|
|
168
|
-
error: str | None = None
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
class DecodersResponse(BaseModel):
|
|
172
|
-
"""Response from /decoders endpoint."""
|
|
173
|
-
|
|
174
|
-
decoders: list[str] = []
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|