Ejemplo n.º 1
0
    def get_tx(self, tx_hash):
        """ GRPC call to get detailed information of a transaction

        Args:
            tx_hash(string or list[string]): hash of the transaction

        Returns:
             ResponseGetTx(stream)

        """
        def to_req(item):
            return protos.RequestGetTx(hash=item)

        requests = lib.to_iter(to_req, tx_hash)
        return self.stub.get_tx(requests)
Ejemplo n.º 2
0
    def store_file(self, chunk):
        """GRPC call to store file

        Args:
            chunk(bytes or list[bytes]): file bytes to store

        Returns:
            ResponseStoreFile

        """
        def to_req(item):
            return protos.RequestStoreFile(chunk=item)

        requests = lib.to_iter(to_req, chunk)
        return self.stub.store_file(requests)
Ejemplo n.º 3
0
    def get_block(self, height):
        """ GRPC call to get blocks information

        Args:
            height(int or list[int]): height of the block

        Returns:
            ResponseGetBlock(stream)

        """
        def to_req(item):
            return protos.RequestGetBlock(height=item)

        requests = lib.to_iter(to_req, height)
        return self.stub.get_block(requests)
Ejemplo n.º 4
0
    def get_delegate_state(self, queries):
        """GRPC call to get detailed of stake

        Args:
            queries(dict): dictionaries of requested parameters

        Returns:
            ResponseGetStakeState(stream)

        """

        def to_req(query):
            return protos.RequestGetDelegateState(
                    address=query.get('address'),
                    keys=query.get('keys'),
                    height=query.get('height'),
            )

        requests = lib.to_iter(to_req, queries)
        return self.stub.get_delegate_state(requests)
Ejemplo n.º 5
0
    def get_swap_state(self, queries):
        """GRPC call to get state of tether

        Args:
            queries(dict): dictionaries of requested parameters

        Returns:
            ResponseGetTetherState(stream)

        """

        def to_req(query):
            return protos.RequestGetSwapState(
                    address=query.get('address'),
                    keys=query.get('keys'),
                    height=query.get('height'),
            )

        requests = lib.to_iter(to_req, queries)

        return self.stub.get_swap_state(requests)