MCPcopy
hub / github.com/raiden-network/raiden / matrix_api_shell

Function matrix_api_shell

tools/debugging/matrix/api_shell.py:29–40  ·  view source on GitHub ↗
(address: Address, password: str, server: str)

Source from the content-addressed store, hash-verified

27 "--server", help="Matrix server to connect to", default="https://transport01.raiden.network"
28)
29def matrix_api_shell(address: Address, password: str, server: str) -> None:
30 am = AccountManager(os.path.expanduser("~/.ethereum/keystore"))
31 signer = LocalSigner(am.get_privkey(to_checksum_address(address), password))
32 server_name = server.split("//")[1]
33 matrix_password = encode_hex(signer.sign(server_name.encode()))
34
35 api = GMatrixHttpApi(server)
36 resp = api.login(
37 "m.login.password", user=to_normalized_address(address), password=matrix_password
38 )
39 api.token = resp["access_token"]
40 IPython.embed(header=f"Use the `api` object to interact with matrix on {server}.")
41
42
43if __name__ == "__main__":

Callers 1

api_shell.pyFile · 0.85

Calls 6

get_privkeyMethod · 0.95
signMethod · 0.95
AccountManagerClass · 0.90
LocalSignerClass · 0.90
to_checksum_addressFunction · 0.90
GMatrixHttpApiClass · 0.90

Tested by

no test coverage detected