Skip to content

Commit 42900d7

Browse files
committed
feat(python): evolu CLI
[no changelog]
1 parent 749a864 commit 42900d7

File tree

8 files changed

+84
-5
lines changed

8 files changed

+84
-5
lines changed

python/src/trezorlib/cli/evolu.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This file is part of the Trezor project.
2+
#
3+
# Copyright (C) 2012-2025 SatoshiLabs and contributors
4+
#
5+
# This library is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU Lesser General Public License version 3
7+
# as published by the Free Software Foundation.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the License along with this library.
15+
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
16+
17+
from __future__ import annotations
18+
19+
import typing as t
20+
21+
import click
22+
23+
from .. import evolu, messages
24+
from . import with_session
25+
26+
if t.TYPE_CHECKING:
27+
from ..transport.session import Session
28+
29+
30+
@click.group(name="evolu")
31+
def cli() -> None:
32+
"""Evolu commands. Evolu is a local first storage framework. See https://github.com/evoluhq/evolu"""
33+
34+
35+
@cli.command()
36+
@with_session
37+
def get_node(
38+
session: "Session",
39+
) -> dict[str, str]:
40+
"""Return the SLIP-21 node for Evolu."""
41+
42+
node: messages.EvoluNode = evolu.get_evolu_node(
43+
session,
44+
)
45+
return {
46+
"data": node.data.hex(),
47+
}

python/src/trezorlib/cli/trezorctl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
device,
4141
eos,
4242
ethereum,
43+
evolu,
4344
fido,
4445
firmware,
4546
monero,
@@ -410,6 +411,7 @@ def wait_for_emulator(obj: TrezorConnection, timeout: float) -> None:
410411
cli.add_command(device.cli)
411412
cli.add_command(eos.cli)
412413
cli.add_command(ethereum.cli)
414+
cli.add_command(evolu.cli)
413415
cli.add_command(fido.cli)
414416
cli.add_command(monero.cli)
415417
cli.add_command(nem.cli)

python/src/trezorlib/evolu.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file is part of the Trezor project.
2+
#
3+
# Copyright (C) 2012-2025 SatoshiLabs and contributors
4+
#
5+
# This library is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU Lesser General Public License version 3
7+
# as published by the Free Software Foundation.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the License along with this library.
15+
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
16+
17+
18+
from typing import TYPE_CHECKING
19+
20+
from . import messages
21+
22+
if TYPE_CHECKING:
23+
from .transport.session import Session
24+
25+
26+
def get_evolu_node(session: "Session") -> messages.EvoluNode:
27+
return session.call(
28+
messages.EvoluGetNode(),
29+
expect=messages.EvoluNode,
30+
)

python/src/trezorlib/messages.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/trezor-client/scripts/build_messages

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ FEATURES = {
2121
#
2222
"Cardano": "cardano",
2323
"EOS": "eos",
24+
"Evolu": "evolu",
2425
"Monero": "monero",
2526
"NEM": "nem",
2627
"Nostr": "nostr",

rust/trezor-client/src/messages/generated.rs

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/trezor-client/src/protos/generated/messages.rs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/trezor-client/src/protos/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ mod generated {
3232
"ethereum" => messages_ethereum_eip712
3333
"cardano" => messages_cardano
3434
"eos" => messages_eos
35+
"evolu" => messages_evolu
3536
"monero" => messages_monero
3637
"nem" => messages_nem
3738
"nostr" => messages_nostr

0 commit comments

Comments
 (0)