kaleido-cli 0.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kaleido_cli/__init__.py +3 -0
- kaleido_cli/__main__.py +6 -0
- kaleido_cli/app.py +204 -0
- kaleido_cli/commands/__init__.py +1 -0
- kaleido_cli/commands/asset.py +850 -0
- kaleido_cli/commands/channel.py +855 -0
- kaleido_cli/commands/config_cmd.py +113 -0
- kaleido_cli/commands/market.py +241 -0
- kaleido_cli/commands/node.py +874 -0
- kaleido_cli/commands/node_swap.py +274 -0
- kaleido_cli/commands/payment.py +364 -0
- kaleido_cli/commands/peer.py +108 -0
- kaleido_cli/commands/swap.py +460 -0
- kaleido_cli/commands/wallet.py +487 -0
- kaleido_cli/config.py +88 -0
- kaleido_cli/context.py +41 -0
- kaleido_cli/docker_manager.py +463 -0
- kaleido_cli/onboarding.py +275 -0
- kaleido_cli/output.py +123 -0
- kaleido_cli/utils/__init__.py +1 -0
- kaleido_cli/utils/assets.py +40 -0
- kaleido_cli/utils/channel_orders.py +822 -0
- kaleido_cli/utils/errors.py +17 -0
- kaleido_cli/utils/pairs.py +133 -0
- kaleido_cli/utils/prompts.py +102 -0
- kaleido_cli/utils/quotes.py +163 -0
- kaleido_cli/utils/swaps.py +142 -0
- kaleido_cli-0.1.2.dist-info/METADATA +416 -0
- kaleido_cli-0.1.2.dist-info/RECORD +32 -0
- kaleido_cli-0.1.2.dist-info/WHEEL +4 -0
- kaleido_cli-0.1.2.dist-info/entry_points.txt +2 -0
- kaleido_cli-0.1.2.dist-info/licenses/LICENSE +21 -0
kaleido_cli/__init__.py
ADDED
kaleido_cli/__main__.py
ADDED
kaleido_cli/app.py
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"""Main Typer application — global state, callback, and sub-command registration."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
|
|
9
|
+
from .config import DEFAULT_API_URL, DEFAULT_NETWORK, load_config
|
|
10
|
+
from .context import state
|
|
11
|
+
from .onboarding import SetupMode, run_setup
|
|
12
|
+
from .output import set_agent_mode, set_json_mode
|
|
13
|
+
|
|
14
|
+
# ---------------------------------------------------------------------------
|
|
15
|
+
# Root app
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
app = typer.Typer(
|
|
19
|
+
name="kaleido",
|
|
20
|
+
help=(
|
|
21
|
+
"Manage RGB Lightning Nodes and interact with the Kaleidoswap protocol.\n\n"
|
|
22
|
+
"[bold]First time here?[/bold]\n\n"
|
|
23
|
+
" [cyan]kaleido setup[/cyan] Create/start one mutinynet node with defaults\n"
|
|
24
|
+
" [cyan]kaleido setup signetcustom[/cyan] Create/start a node on a specific network\n\n"
|
|
25
|
+
"[bold]Global flags[/bold] can be placed before any sub-command:\n\n"
|
|
26
|
+
" [cyan]kaleido --node-url http://localhost:3001 wallet balance[/cyan]\n"
|
|
27
|
+
" [cyan]kaleido --json market pairs[/cyan]\n"
|
|
28
|
+
" [cyan]kaleido --agent channel open --peer 03ab...@host:9735 --capacity 100000[/cyan]\n\n"
|
|
29
|
+
"[bold]Environment variables[/bold]\n\n"
|
|
30
|
+
" [green]KALEIDO_NODE_URL[/green] RLN node URL (overrides config)\n"
|
|
31
|
+
" [green]KALEIDO_API_URL[/green] Kaleidoswap API URL (overrides config)\n"
|
|
32
|
+
),
|
|
33
|
+
no_args_is_help=True,
|
|
34
|
+
pretty_exceptions_show_locals=False,
|
|
35
|
+
rich_markup_mode="rich",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@app.callback()
|
|
40
|
+
def _root(
|
|
41
|
+
json_output: Annotated[
|
|
42
|
+
bool, typer.Option("--json", help="Output raw JSON instead of formatted tables.")
|
|
43
|
+
] = False,
|
|
44
|
+
agent: Annotated[
|
|
45
|
+
bool,
|
|
46
|
+
typer.Option(
|
|
47
|
+
"--agent",
|
|
48
|
+
help="Non-interactive mode for scripted/agent use — skips wizard prompts.",
|
|
49
|
+
),
|
|
50
|
+
] = False,
|
|
51
|
+
node_url: Annotated[
|
|
52
|
+
str | None,
|
|
53
|
+
typer.Option(
|
|
54
|
+
"--node-url",
|
|
55
|
+
help="RGB Lightning Node base URL. Overrides config + env.",
|
|
56
|
+
envvar="KALEIDO_NODE_URL",
|
|
57
|
+
show_default="config / KALEIDO_NODE_URL",
|
|
58
|
+
),
|
|
59
|
+
] = None,
|
|
60
|
+
api_url: Annotated[
|
|
61
|
+
str | None,
|
|
62
|
+
typer.Option(
|
|
63
|
+
"--api-url",
|
|
64
|
+
help="Kaleidoswap maker API URL. Overrides config + env.",
|
|
65
|
+
envvar="KALEIDO_API_URL",
|
|
66
|
+
show_default="config / KALEIDO_API_URL",
|
|
67
|
+
),
|
|
68
|
+
] = None,
|
|
69
|
+
) -> None:
|
|
70
|
+
state.config = load_config()
|
|
71
|
+
state.node_url = node_url
|
|
72
|
+
state.api_url = api_url
|
|
73
|
+
set_json_mode(json_output)
|
|
74
|
+
set_agent_mode(agent)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@app.command(
|
|
78
|
+
"setup",
|
|
79
|
+
epilog=(
|
|
80
|
+
"[bold]Examples[/bold]\n\n"
|
|
81
|
+
" Create and start one mutinynet node with defaults:\n"
|
|
82
|
+
" [cyan]kaleido setup[/cyan]\n\n"
|
|
83
|
+
" Create and start one node on an explicit network:\n"
|
|
84
|
+
" [cyan]kaleido setup signetcustom[/cyan]\n\n"
|
|
85
|
+
" Market-only defaults without prompts:\n"
|
|
86
|
+
" [cyan]kaleido setup --mode market --defaults[/cyan]\n\n"
|
|
87
|
+
" Use a custom environment name:\n"
|
|
88
|
+
" [cyan]kaleido setup mutinynet --env-name taker-1[/cyan]"
|
|
89
|
+
),
|
|
90
|
+
)
|
|
91
|
+
def setup_command(
|
|
92
|
+
network: Annotated[
|
|
93
|
+
str | None,
|
|
94
|
+
typer.Argument(
|
|
95
|
+
help="Bitcoin network for the local node. Defaults to mutinynet.",
|
|
96
|
+
),
|
|
97
|
+
] = None,
|
|
98
|
+
mode: Annotated[
|
|
99
|
+
SetupMode | None,
|
|
100
|
+
typer.Option("--mode", help="Setup profile: 'market' or 'local'."),
|
|
101
|
+
] = None,
|
|
102
|
+
defaults: Annotated[
|
|
103
|
+
bool,
|
|
104
|
+
typer.Option(
|
|
105
|
+
"--defaults",
|
|
106
|
+
help="Use saved/default values for any omitted options instead of prompting.",
|
|
107
|
+
),
|
|
108
|
+
] = False,
|
|
109
|
+
api_url: Annotated[
|
|
110
|
+
str | None,
|
|
111
|
+
typer.Option("--api-url", help="Kaleidoswap API URL to save in config."),
|
|
112
|
+
] = None,
|
|
113
|
+
node_url: Annotated[
|
|
114
|
+
str | None,
|
|
115
|
+
typer.Option("--node-url", help="RGB Lightning Node URL to save in config."),
|
|
116
|
+
] = None,
|
|
117
|
+
create_node: Annotated[
|
|
118
|
+
bool | None,
|
|
119
|
+
typer.Option(
|
|
120
|
+
"--create-node/--no-create-node",
|
|
121
|
+
help="Create a local Docker node environment during setup.",
|
|
122
|
+
),
|
|
123
|
+
] = None,
|
|
124
|
+
spawn_dir: Annotated[
|
|
125
|
+
str | None,
|
|
126
|
+
typer.Option("--spawn-dir", help="Base directory for local node environments."),
|
|
127
|
+
] = None,
|
|
128
|
+
env_name: Annotated[
|
|
129
|
+
str | None,
|
|
130
|
+
typer.Option("--env-name", help="Environment name when creating a local node."),
|
|
131
|
+
] = None,
|
|
132
|
+
node_count: Annotated[
|
|
133
|
+
int | None,
|
|
134
|
+
typer.Option("--node-count", min=1, help="Number of nodes to create."),
|
|
135
|
+
] = None,
|
|
136
|
+
start: Annotated[
|
|
137
|
+
bool | None,
|
|
138
|
+
typer.Option("--start/--no-start", help="Start the node environment after creating it."),
|
|
139
|
+
] = None,
|
|
140
|
+
) -> None:
|
|
141
|
+
"""Create a local mutinynet node by default, or run the selected setup profile."""
|
|
142
|
+
resolved_mode = mode or SetupMode.local
|
|
143
|
+
resolved_defaults = defaults or mode is None
|
|
144
|
+
resolved_create_node = create_node
|
|
145
|
+
if mode is None and resolved_create_node is None:
|
|
146
|
+
resolved_create_node = True
|
|
147
|
+
|
|
148
|
+
run_setup(
|
|
149
|
+
mode=resolved_mode,
|
|
150
|
+
defaults=resolved_defaults,
|
|
151
|
+
api_url=api_url or (DEFAULT_API_URL if resolved_mode == SetupMode.local else None),
|
|
152
|
+
network=network or (DEFAULT_NETWORK if resolved_mode == SetupMode.local else None),
|
|
153
|
+
node_url=node_url,
|
|
154
|
+
create_node=resolved_create_node,
|
|
155
|
+
spawn_dir=spawn_dir,
|
|
156
|
+
env_name=env_name,
|
|
157
|
+
node_count=node_count,
|
|
158
|
+
start=start,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# ---------------------------------------------------------------------------
|
|
163
|
+
# Register sub-command groups
|
|
164
|
+
# ---------------------------------------------------------------------------
|
|
165
|
+
|
|
166
|
+
from .commands.asset import asset_app # noqa: E402
|
|
167
|
+
from .commands.channel import channel_app # noqa: E402
|
|
168
|
+
from .commands.config_cmd import config_app # noqa: E402
|
|
169
|
+
from .commands.market import market_app # noqa: E402
|
|
170
|
+
from .commands.node import node_app # noqa: E402
|
|
171
|
+
from .commands.payment import payment_app # noqa: E402
|
|
172
|
+
from .commands.peer import peer_app # noqa: E402
|
|
173
|
+
from .commands.swap import swap_app # noqa: E402
|
|
174
|
+
from .commands.wallet import wallet_app # noqa: E402
|
|
175
|
+
|
|
176
|
+
app.add_typer(node_app, name="node", help="Manage the RLN node via Docker (start, stop, init…).")
|
|
177
|
+
app.add_typer(
|
|
178
|
+
wallet_app, name="wallet", help="BTC wallet — balance, addresses, send, UTXOs, backup, restore."
|
|
179
|
+
)
|
|
180
|
+
app.add_typer(
|
|
181
|
+
asset_app, name="asset", help="RGB assets — list, issue by schema, send, invoices, transfers."
|
|
182
|
+
)
|
|
183
|
+
app.add_typer(
|
|
184
|
+
channel_app, name="channel", help="Lightning channels — list, open, close, and LSP order flow."
|
|
185
|
+
)
|
|
186
|
+
app.add_typer(peer_app, name="peer", help="Peer connections — list, connect, disconnect.")
|
|
187
|
+
app.add_typer(
|
|
188
|
+
payment_app, name="payment", help="Lightning payments — pay, invoice, keysend, decode, status."
|
|
189
|
+
)
|
|
190
|
+
app.add_typer(
|
|
191
|
+
market_app,
|
|
192
|
+
name="market",
|
|
193
|
+
help="Kaleidoswap market data — assets, pairs, routes, quotes, analytics.",
|
|
194
|
+
)
|
|
195
|
+
app.add_typer(
|
|
196
|
+
swap_app,
|
|
197
|
+
name="swap",
|
|
198
|
+
help="Atomic swap flow against the Kaleidoswap maker server, using your local node as taker.",
|
|
199
|
+
)
|
|
200
|
+
app.add_typer(config_app, name="config", help="CLI configuration stored in ~/.kaleido/config.json.")
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def main() -> None:
|
|
204
|
+
app()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# command group sub-packages
|