Beispiel #1
0
    def __init__(self, shell=None, key=None):
        if shell is None:
            shell = default_shell

        if isinstance(shell, str):
            networks = {
                'mainnet': mainnet,
                'babylonnet': babylonnet,
                'zeronet': zeronet,
                'sandboxnet': localhost.sandboxnet
            }
            if shell in networks:
                self.shell = networks[shell]
            else:
                self.shell = ShellQuery(node=RpcNode(uri=shell))
        elif isinstance(shell, ShellQuery):
            self.shell = shell
        else:
            raise NotImplementedError(shell)

        if key is None:
            key = default_key

        if isinstance(key, str):
            if is_key(key):
                self.key = Key.from_encoded_key(key)
            elif exists(expanduser(key)):
                self.key = Key.from_faucet(key)
            else:
                self.key = Key.from_alias(key)
        elif isinstance(key, Key):
            self.key = key
        else:
            raise NotImplementedError(key)
Beispiel #2
0
    def key(self, message):
        key = Key.from_alias("fy", tezos_client_dir=".")
        pk = key.public_key()
        pkh = key.public_key_hash()

        content = code_notice(f"pkh = {pkh}")
        return [content]
Beispiel #3
0
    def __init__(self, shell=None, key=None):
        if shell is None:
            shell = default_shell

        if isinstance(shell, str):
            networks = {
                'mainnet': mainnet,
                'babylonnet': babylonnet,
                'carthagenet': carthagenet,
                'zeronet': zeronet,
                'sandboxnet': localhost.sandboxnet,
                'bbbox': localhost.bbbox,
                'labnet': labnet,
                'mainnet-pool': pool.mainnet
            }
            if shell in networks:
                self.shell = networks[shell]
            else:
                self.shell = ShellQuery(node=RpcNode(uri=shell))
        elif isinstance(shell, ShellQuery):
            self.shell = shell
        else:
            raise NotImplementedError(shell)

        if key is None:
            key = default_key if is_installed() else default_key_hash

        if isinstance(key, str):
            keys = {
                'alice': alice_key
            }
            if key in keys:
                self.key = keys[key]
            elif is_key(key):
                self.key = Key.from_encoded_key(key)
            elif is_pkh(key):
                self.key = KeyHash(key)
            elif exists(expanduser(key)):
                self.key = Key.from_faucet(key)
            else:
                self.key = Key.from_alias(key)
        elif isinstance(key, Key):
            self.key = key
        else:
            raise NotImplementedError(key)
Beispiel #4
0
 def sign(self, message):
     key = Key.from_alias("fy", tezos_client_dir=".")
     signature = key.sign(message["body"])
     content = code_notice(pprint.pformat(signature))
     return [content]