Skip to content

Commit

Permalink
Type stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed Nov 18, 2024
1 parent 8489c64 commit bf04e3f
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 1 deletion.
4 changes: 3 additions & 1 deletion wheel/generate_type_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
input_dir = crates_dir / "chia-protocol" / "src"

# enums are exposed to python as int
enums = set(["NodeType", "ProtocolMessageTypes", "RejectStateReason"])
enums = set(
["NodeType", "ProtocolMessageTypes", "RejectStateReason", "MempoolRemoveReason"]
)


def transform_type(m: str) -> str:
Expand Down
145 changes: 145 additions & 0 deletions wheel/python/chia_rs/chia_rs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3890,6 +3890,151 @@ class RejectCoinState:
def from_json_dict(cls, json_dict: dict[str, Any]) -> Self: ...
def replace(self, *, reason: Union[ int, _Unspec] = _Unspec()) -> RejectCoinState: ...

@final
class RemovedMempoolItem:
transaction_id: bytes32
reason: int
def __init__(
self,
transaction_id: bytes,
reason: int
) -> None: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
def __deepcopy__(self, memo: object) -> RemovedMempoolItem: ...
def __copy__(self) -> RemovedMempoolItem: ...
@classmethod
def from_bytes(cls, blob: bytes) -> Self: ...
@classmethod
def from_bytes_unchecked(cls, blob: bytes) -> Self: ...
@classmethod
def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> tuple[Self, int]: ...
def to_bytes(self) -> bytes: ...
def __bytes__(self) -> bytes: ...
def stream_to_bytes(self) -> bytes: ...
def get_hash(self) -> bytes32: ...
def to_json_dict(self) -> dict[str, Any]: ...
@classmethod
def from_json_dict(cls, json_dict: dict[str, Any]) -> Self: ...
def replace(self, *, transaction_id: Union[ bytes32, _Unspec] = _Unspec(),
reason: Union[ int, _Unspec] = _Unspec()) -> RemovedMempoolItem: ...

@final
class MempoolItemsAdded:
transaction_ids: list[bytes32]
def __init__(
self,
transaction_ids: Sequence[bytes32]
) -> None: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
def __deepcopy__(self, memo: object) -> MempoolItemsAdded: ...
def __copy__(self) -> MempoolItemsAdded: ...
@classmethod
def from_bytes(cls, blob: bytes) -> Self: ...
@classmethod
def from_bytes_unchecked(cls, blob: bytes) -> Self: ...
@classmethod
def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> tuple[Self, int]: ...
def to_bytes(self) -> bytes: ...
def __bytes__(self) -> bytes: ...
def stream_to_bytes(self) -> bytes: ...
def get_hash(self) -> bytes32: ...
def to_json_dict(self) -> dict[str, Any]: ...
@classmethod
def from_json_dict(cls, json_dict: dict[str, Any]) -> Self: ...
def replace(self, *, transaction_ids: Union[ list[bytes32], _Unspec] = _Unspec()) -> MempoolItemsAdded: ...

@final
class MempoolItemsRemoved:
removed_items: list[RemovedMempoolItem]
def __init__(
self,
removed_items: Sequence[RemovedMempoolItem]
) -> None: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
def __deepcopy__(self, memo: object) -> MempoolItemsRemoved: ...
def __copy__(self) -> MempoolItemsRemoved: ...
@classmethod
def from_bytes(cls, blob: bytes) -> Self: ...
@classmethod
def from_bytes_unchecked(cls, blob: bytes) -> Self: ...
@classmethod
def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> tuple[Self, int]: ...
def to_bytes(self) -> bytes: ...
def __bytes__(self) -> bytes: ...
def stream_to_bytes(self) -> bytes: ...
def get_hash(self) -> bytes32: ...
def to_json_dict(self) -> dict[str, Any]: ...
@classmethod
def from_json_dict(cls, json_dict: dict[str, Any]) -> Self: ...
def replace(self, *, removed_items: Union[ list[RemovedMempoolItem], _Unspec] = _Unspec()) -> MempoolItemsRemoved: ...

@final
class RequestCostInfo:
def __init__(
self
) -> None: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
def __deepcopy__(self, memo: object) -> RequestCostInfo: ...
def __copy__(self) -> RequestCostInfo: ...
@classmethod
def from_bytes(cls, blob: bytes) -> Self: ...
@classmethod
def from_bytes_unchecked(cls, blob: bytes) -> Self: ...
@classmethod
def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> tuple[Self, int]: ...
def to_bytes(self) -> bytes: ...
def __bytes__(self) -> bytes: ...
def stream_to_bytes(self) -> bytes: ...
def get_hash(self) -> bytes32: ...
def to_json_dict(self) -> dict[str, Any]: ...
@classmethod
def from_json_dict(cls, json_dict: dict[str, Any]) -> Self: ...

@final
class RespondCostInfo:
max_transaction_cost: uint64
max_block_cost: uint64
max_mempool_cost: uint64
mempool_cost: uint64
mempool_fee: uint64
bump_fee_per_cost: uint8
def __init__(
self,
max_transaction_cost: uint64,
max_block_cost: uint64,
max_mempool_cost: uint64,
mempool_cost: uint64,
mempool_fee: uint64,
bump_fee_per_cost: uint8
) -> None: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
def __deepcopy__(self, memo: object) -> RespondCostInfo: ...
def __copy__(self) -> RespondCostInfo: ...
@classmethod
def from_bytes(cls, blob: bytes) -> Self: ...
@classmethod
def from_bytes_unchecked(cls, blob: bytes) -> Self: ...
@classmethod
def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> tuple[Self, int]: ...
def to_bytes(self) -> bytes: ...
def __bytes__(self) -> bytes: ...
def stream_to_bytes(self) -> bytes: ...
def get_hash(self) -> bytes32: ...
def to_json_dict(self) -> dict[str, Any]: ...
@classmethod
def from_json_dict(cls, json_dict: dict[str, Any]) -> Self: ...
def replace(self, *, max_transaction_cost: Union[ uint64, _Unspec] = _Unspec(),
max_block_cost: Union[ uint64, _Unspec] = _Unspec(),
max_mempool_cost: Union[ uint64, _Unspec] = _Unspec(),
mempool_cost: Union[ uint64, _Unspec] = _Unspec(),
mempool_fee: Union[ uint64, _Unspec] = _Unspec(),
bump_fee_per_cost: Union[ uint8, _Unspec] = _Unspec()) -> RespondCostInfo: ...

@final
class SubEpochData:
reward_chain_hash: bytes32
Expand Down

0 comments on commit bf04e3f

Please sign in to comment.