Ejemplo n.º 1
0
def connect(host, port):
    # Set Up GRPC connection to wallet
    if port == '443':
        credentials = grpc.ssl_channel_credentials()
        channel = grpc.secure_channel('{}:{}'.format(host, port), credentials)
    else:
        channel = grpc.insecure_channel('{}:{}'.format(host, port))

    return mobilecoind_api_pb2_grpc.MobilecoindAPIStub(channel)
Ejemplo n.º 2
0
    def __init__(self, daemon, ssl):
        """ Initializes the client and connects to a mobilecoind service.
          daemon -- address and port of mobilecoind daemon
          ssl    -- use SSL to connect
        """

        if ssl:
            credentials = grpc.ssl_channel_credentials()
            self.channel = grpc.secure_channel(daemon, credentials)
        else:
            self.channel = grpc.insecure_channel(daemon)
        self.stub = api_grpc.MobilecoindAPIStub(self.channel)