Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions examples/example_get_consensus_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from pactus.rpc.blockchain_pb2_grpc import BlockchainStub
from pactus.rpc.blockchain_pb2 import GetConsensusInfoRequest
import grpc


def main() -> None:
# Creating a gRPC channel
channel = grpc.insecure_channel("bootstrap1.pactus.org:50051")

# Creating a stub from channel
stub = BlockchainStub(channel)

# Initialize a request and call get consensus info method
req = GetConsensusInfoRequest()
consensus_info = stub.GetConsensusInfo(req)

print(f"Consensus info:\n{consensus_info}")


if __name__ == "__main__":
main()
136 changes: 67 additions & 69 deletions pactus/rpc/blockchain_pb2.py

Large diffs are not rendered by default.

177 changes: 33 additions & 144 deletions pactus/rpc/blockchain_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ from google.protobuf.internal import containers as _containers
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from typing import (
ClassVar as _ClassVar,
Iterable as _Iterable,
Mapping as _Mapping,
Optional as _Optional,
Union as _Union,
)
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union

DESCRIPTOR: _descriptor.FileDescriptor

Expand All @@ -25,7 +19,6 @@ class VoteType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
VOTE_PREPARE: _ClassVar[VoteType]
VOTE_PRECOMMIT: _ClassVar[VoteType]
VOTE_CHANGE_PROPOSER: _ClassVar[VoteType]

BLOCK_DATA: BlockVerbosity
BLOCK_INFO: BlockVerbosity
BLOCK_TRANSACTIONS: BlockVerbosity
Expand All @@ -44,9 +37,7 @@ class GetAccountResponse(_message.Message):
__slots__ = ("account",)
ACCOUNT_FIELD_NUMBER: _ClassVar[int]
account: AccountInfo
def __init__(
self, account: _Optional[_Union[AccountInfo, _Mapping]] = ...
) -> None: ...
def __init__(self, account: _Optional[_Union[AccountInfo, _Mapping]] = ...) -> None: ...

class GetValidatorAddressesRequest(_message.Message):
__slots__ = ()
Expand Down Expand Up @@ -74,9 +65,7 @@ class GetValidatorResponse(_message.Message):
__slots__ = ("validator",)
VALIDATOR_FIELD_NUMBER: _ClassVar[int]
validator: ValidatorInfo
def __init__(
self, validator: _Optional[_Union[ValidatorInfo, _Mapping]] = ...
) -> None: ...
def __init__(self, validator: _Optional[_Union[ValidatorInfo, _Mapping]] = ...) -> None: ...

class GetPublicKeyRequest(_message.Message):
__slots__ = ("address",)
Expand All @@ -96,11 +85,7 @@ class GetBlockRequest(_message.Message):
VERBOSITY_FIELD_NUMBER: _ClassVar[int]
height: int
verbosity: BlockVerbosity
def __init__(
self,
height: _Optional[int] = ...,
verbosity: _Optional[_Union[BlockVerbosity, str]] = ...,
) -> None: ...
def __init__(self, height: _Optional[int] = ..., verbosity: _Optional[_Union[BlockVerbosity, str]] = ...) -> None: ...

class GetBlockResponse(_message.Message):
__slots__ = ("height", "hash", "data", "block_time", "header", "prev_cert", "txs")
Expand All @@ -118,18 +103,7 @@ class GetBlockResponse(_message.Message):
header: BlockHeaderInfo
prev_cert: CertificateInfo
txs: _containers.RepeatedCompositeFieldContainer[_transaction_pb2.TransactionInfo]
def __init__(
self,
height: _Optional[int] = ...,
hash: _Optional[str] = ...,
data: _Optional[str] = ...,
block_time: _Optional[int] = ...,
header: _Optional[_Union[BlockHeaderInfo, _Mapping]] = ...,
prev_cert: _Optional[_Union[CertificateInfo, _Mapping]] = ...,
txs: _Optional[
_Iterable[_Union[_transaction_pb2.TransactionInfo, _Mapping]]
] = ...,
) -> None: ...
def __init__(self, height: _Optional[int] = ..., hash: _Optional[str] = ..., data: _Optional[str] = ..., block_time: _Optional[int] = ..., header: _Optional[_Union[BlockHeaderInfo, _Mapping]] = ..., prev_cert: _Optional[_Union[CertificateInfo, _Mapping]] = ..., txs: _Optional[_Iterable[_Union[_transaction_pb2.TransactionInfo, _Mapping]]] = ...) -> None: ...

class GetBlockHashRequest(_message.Message):
__slots__ = ("height",)
Expand Down Expand Up @@ -160,18 +134,7 @@ class GetBlockchainInfoRequest(_message.Message):
def __init__(self) -> None: ...

class GetBlockchainInfoResponse(_message.Message):
__slots__ = (
"last_block_height",
"last_block_hash",
"total_accounts",
"total_validators",
"total_power",
"committee_power",
"committee_validators",
"is_pruned",
"pruning_height",
"last_block_time",
)
__slots__ = ("last_block_height", "last_block_hash", "total_accounts", "total_validators", "total_power", "committee_power", "committee_validators", "is_pruned", "pruning_height", "last_block_time")
LAST_BLOCK_HEIGHT_FIELD_NUMBER: _ClassVar[int]
LAST_BLOCK_HASH_FIELD_NUMBER: _ClassVar[int]
TOTAL_ACCOUNTS_FIELD_NUMBER: _ClassVar[int]
Expand All @@ -192,66 +155,34 @@ class GetBlockchainInfoResponse(_message.Message):
is_pruned: bool
pruning_height: int
last_block_time: int
def __init__(
self,
last_block_height: _Optional[int] = ...,
last_block_hash: _Optional[str] = ...,
total_accounts: _Optional[int] = ...,
total_validators: _Optional[int] = ...,
total_power: _Optional[int] = ...,
committee_power: _Optional[int] = ...,
committee_validators: _Optional[
_Iterable[_Union[ValidatorInfo, _Mapping]]
] = ...,
is_pruned: bool = ...,
pruning_height: _Optional[int] = ...,
last_block_time: _Optional[int] = ...,
) -> None: ...
def __init__(self, last_block_height: _Optional[int] = ..., last_block_hash: _Optional[str] = ..., total_accounts: _Optional[int] = ..., total_validators: _Optional[int] = ..., total_power: _Optional[int] = ..., committee_power: _Optional[int] = ..., committee_validators: _Optional[_Iterable[_Union[ValidatorInfo, _Mapping]]] = ..., is_pruned: bool = ..., pruning_height: _Optional[int] = ..., last_block_time: _Optional[int] = ...) -> None: ...

class GetConsensusInfoRequest(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...

class GetConsensusInfoResponse(_message.Message):
__slots__ = ("instances",)
__slots__ = ("proposal", "instances")
PROPOSAL_FIELD_NUMBER: _ClassVar[int]
INSTANCES_FIELD_NUMBER: _ClassVar[int]
proposal: ProposalInfo
instances: _containers.RepeatedCompositeFieldContainer[ConsensusInfo]
def __init__(
self, instances: _Optional[_Iterable[_Union[ConsensusInfo, _Mapping]]] = ...
) -> None: ...
def __init__(self, proposal: _Optional[_Union[ProposalInfo, _Mapping]] = ..., instances: _Optional[_Iterable[_Union[ConsensusInfo, _Mapping]]] = ...) -> None: ...

class GetTxPoolContentRequest(_message.Message):
__slots__ = ("payload_type",)
PAYLOAD_TYPE_FIELD_NUMBER: _ClassVar[int]
payload_type: _transaction_pb2.PayloadType
def __init__(
self, payload_type: _Optional[_Union[_transaction_pb2.PayloadType, str]] = ...
) -> None: ...
def __init__(self, payload_type: _Optional[_Union[_transaction_pb2.PayloadType, str]] = ...) -> None: ...

class GetTxPoolContentResponse(_message.Message):
__slots__ = ("txs",)
TXS_FIELD_NUMBER: _ClassVar[int]
txs: _containers.RepeatedCompositeFieldContainer[_transaction_pb2.TransactionInfo]
def __init__(
self,
txs: _Optional[
_Iterable[_Union[_transaction_pb2.TransactionInfo, _Mapping]]
] = ...,
) -> None: ...
def __init__(self, txs: _Optional[_Iterable[_Union[_transaction_pb2.TransactionInfo, _Mapping]]] = ...) -> None: ...

class ValidatorInfo(_message.Message):
__slots__ = (
"hash",
"data",
"public_key",
"number",
"stake",
"last_bonding_height",
"last_sortition_height",
"unbonding_height",
"address",
"availability_score",
)
__slots__ = ("hash", "data", "public_key", "number", "stake", "last_bonding_height", "last_sortition_height", "unbonding_height", "address", "availability_score")
HASH_FIELD_NUMBER: _ClassVar[int]
DATA_FIELD_NUMBER: _ClassVar[int]
PUBLIC_KEY_FIELD_NUMBER: _ClassVar[int]
Expand All @@ -272,19 +203,7 @@ class ValidatorInfo(_message.Message):
unbonding_height: int
address: str
availability_score: float
def __init__(
self,
hash: _Optional[str] = ...,
data: _Optional[str] = ...,
public_key: _Optional[str] = ...,
number: _Optional[int] = ...,
stake: _Optional[int] = ...,
last_bonding_height: _Optional[int] = ...,
last_sortition_height: _Optional[int] = ...,
unbonding_height: _Optional[int] = ...,
address: _Optional[str] = ...,
availability_score: _Optional[float] = ...,
) -> None: ...
def __init__(self, hash: _Optional[str] = ..., data: _Optional[str] = ..., public_key: _Optional[str] = ..., number: _Optional[int] = ..., stake: _Optional[int] = ..., last_bonding_height: _Optional[int] = ..., last_sortition_height: _Optional[int] = ..., unbonding_height: _Optional[int] = ..., address: _Optional[str] = ..., availability_score: _Optional[float] = ...) -> None: ...

class AccountInfo(_message.Message):
__slots__ = ("hash", "data", "number", "balance", "address")
Expand All @@ -298,23 +217,10 @@ class AccountInfo(_message.Message):
number: int
balance: int
address: str
def __init__(
self,
hash: _Optional[str] = ...,
data: _Optional[str] = ...,
number: _Optional[int] = ...,
balance: _Optional[int] = ...,
address: _Optional[str] = ...,
) -> None: ...
def __init__(self, hash: _Optional[str] = ..., data: _Optional[str] = ..., number: _Optional[int] = ..., balance: _Optional[int] = ..., address: _Optional[str] = ...) -> None: ...

class BlockHeaderInfo(_message.Message):
__slots__ = (
"version",
"prev_block_hash",
"state_root",
"sortition_seed",
"proposer_address",
)
__slots__ = ("version", "prev_block_hash", "state_root", "sortition_seed", "proposer_address")
VERSION_FIELD_NUMBER: _ClassVar[int]
PREV_BLOCK_HASH_FIELD_NUMBER: _ClassVar[int]
STATE_ROOT_FIELD_NUMBER: _ClassVar[int]
Expand All @@ -325,14 +231,7 @@ class BlockHeaderInfo(_message.Message):
state_root: str
sortition_seed: str
proposer_address: str
def __init__(
self,
version: _Optional[int] = ...,
prev_block_hash: _Optional[str] = ...,
state_root: _Optional[str] = ...,
sortition_seed: _Optional[str] = ...,
proposer_address: _Optional[str] = ...,
) -> None: ...
def __init__(self, version: _Optional[int] = ..., prev_block_hash: _Optional[str] = ..., state_root: _Optional[str] = ..., sortition_seed: _Optional[str] = ..., proposer_address: _Optional[str] = ...) -> None: ...

class CertificateInfo(_message.Message):
__slots__ = ("hash", "round", "committers", "absentees", "signature")
Expand All @@ -346,14 +245,7 @@ class CertificateInfo(_message.Message):
committers: _containers.RepeatedScalarFieldContainer[int]
absentees: _containers.RepeatedScalarFieldContainer[int]
signature: str
def __init__(
self,
hash: _Optional[str] = ...,
round: _Optional[int] = ...,
committers: _Optional[_Iterable[int]] = ...,
absentees: _Optional[_Iterable[int]] = ...,
signature: _Optional[str] = ...,
) -> None: ...
def __init__(self, hash: _Optional[str] = ..., round: _Optional[int] = ..., committers: _Optional[_Iterable[int]] = ..., absentees: _Optional[_Iterable[int]] = ..., signature: _Optional[str] = ...) -> None: ...

class VoteInfo(_message.Message):
__slots__ = ("type", "voter", "block_hash", "round", "cp_round", "cp_value")
Expand All @@ -369,15 +261,7 @@ class VoteInfo(_message.Message):
round: int
cp_round: int
cp_value: int
def __init__(
self,
type: _Optional[_Union[VoteType, str]] = ...,
voter: _Optional[str] = ...,
block_hash: _Optional[str] = ...,
round: _Optional[int] = ...,
cp_round: _Optional[int] = ...,
cp_value: _Optional[int] = ...,
) -> None: ...
def __init__(self, type: _Optional[_Union[VoteType, str]] = ..., voter: _Optional[str] = ..., block_hash: _Optional[str] = ..., round: _Optional[int] = ..., cp_round: _Optional[int] = ..., cp_value: _Optional[int] = ...) -> None: ...

class ConsensusInfo(_message.Message):
__slots__ = ("address", "active", "height", "round", "votes")
Expand All @@ -391,11 +275,16 @@ class ConsensusInfo(_message.Message):
height: int
round: int
votes: _containers.RepeatedCompositeFieldContainer[VoteInfo]
def __init__(
self,
address: _Optional[str] = ...,
active: bool = ...,
height: _Optional[int] = ...,
round: _Optional[int] = ...,
votes: _Optional[_Iterable[_Union[VoteInfo, _Mapping]]] = ...,
) -> None: ...
def __init__(self, address: _Optional[str] = ..., active: bool = ..., height: _Optional[int] = ..., round: _Optional[int] = ..., votes: _Optional[_Iterable[_Union[VoteInfo, _Mapping]]] = ...) -> None: ...

class ProposalInfo(_message.Message):
__slots__ = ("height", "round", "block_data", "signature")
HEIGHT_FIELD_NUMBER: _ClassVar[int]
ROUND_FIELD_NUMBER: _ClassVar[int]
BLOCK_DATA_FIELD_NUMBER: _ClassVar[int]
SIGNATURE_FIELD_NUMBER: _ClassVar[int]
height: int
round: int
block_data: str
signature: str
def __init__(self, height: _Optional[int] = ..., round: _Optional[int] = ..., block_data: _Optional[str] = ..., signature: _Optional[str] = ...) -> None: ...
Loading
Loading