Index
data_types
¶
Enums and Models used in the derive_client module
Classes¶
Currency
¶
Bases: Enum
Depositable currencies
Environment
¶
Bases: Enum
Environment.
BridgeTxDetails
¶
ChecksumAddress
¶
Bases: str
ChecksumAddress with validation.
PositionTransfer
dataclass
¶
PositionTransfer(instrument_name: str, amount: Decimal)
Position to transfer between subaccounts.
PreparedBridgeTx
¶
TxHash
¶
Bases: str
Transaction hash with validation.
TypedFilterParams
¶
Bases: BaseModel
Typed filter params for eth_getLogs that we actually use.
Unlike web3.types.FilterParams which has overly-broad unions, this reflects our actual runtime behavior: - We work with int block numbers internally - We convert to hex strings right before RPC calls - We use 'latest' as a special case for open-ended queries
Functions¶
to_rpc_params
¶
to_rpc_params() -> FilterParams
Convert to RPC-compatible filter params with hex block numbers.
Source code in derive_client/data_types/models.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
TypedLogReceipt
¶
Bases: BaseModel
Typed log entry from transaction receipt.
Functions¶
to_w3
¶
to_w3() -> LogReceipt
Convert to web3.py LogReceipt dict.
Source code in derive_client/data_types/models.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
TypedSignedTransaction
¶
Bases: BaseModel
Properly typed signed transaction.
Immutable replacement for eth_account.datastructures.SignedTransaction.
Functions¶
to_w3
¶
to_w3() -> SignedTransaction
Convert to eth_account SignedTransaction.
Source code in derive_client/data_types/models.py
338 339 340 341 342 343 344 345 346 347 | |
TypedTransaction
¶
Bases: BaseModel
Fully typed transaction data retrieved from the blockchain.
Based on web3.types.TxData but with proper attribute access. This represents a transaction that has been retrieved from a node, which may or may not be mined yet.
TypedTxReceipt
¶
Bases: BaseModel
Fully typed transaction receipt with attribute access.
Based on web3.types.TxReceipt but actually usable with type checkers. All fields from EIP-658 and common extensions included.
Functions¶
to_w3
¶
to_w3() -> TxReceipt
Convert to web3.py TxReceipt dict.
Source code in derive_client/data_types/models.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
Wei
¶
Bases: int
Wei with validation.
Functions¶
D
¶
D(value: int | float | str | Decimal) -> Decimal
Helper function to cast int, float, and str to Decimal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int | float | str | Decimal
|
The value to convert to Decimal |
required |
Returns:
| Type | Description |
|---|---|
Decimal
|
Decimal representation of the value |
Examples:
>>> D(0.1)
Decimal('0.1')
>>> D("123.456")
Decimal('123.456')
>>> D(42)
Decimal('42')
Source code in derive_client/data_types/utils.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |