@fiber-pay/cli 0.1.0-rc.5 → 0.1.0-rc.7

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.
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/index.ts
4
4
  import { join as join9 } from "path";
5
- import { Command as Command13 } from "commander";
5
+ import { Command as Command14 } from "commander";
6
6
 
7
7
  // src/commands/binary.ts
8
8
  import { DEFAULT_FIBER_VERSION, downloadFiberBinary } from "@fiber-pay/node";
@@ -169,12 +169,61 @@ import {
169
169
  shannonsToCkb,
170
170
  toHex
171
171
  } from "@fiber-pay/sdk";
172
+ var SHANNONS_PER_CKB = 100000000n;
172
173
  function truncateMiddle(value, start = 10, end = 8) {
173
174
  if (!value || value.length <= start + end + 3) {
174
175
  return value;
175
176
  }
176
177
  return `${value.slice(0, start)}...${value.slice(-end)}`;
177
178
  }
179
+ function sanitizeForTerminal(value) {
180
+ const input = String(value ?? "");
181
+ let output = "";
182
+ for (let i = 0; i < input.length; i++) {
183
+ const code = input.charCodeAt(i);
184
+ if (code === 27) {
185
+ i++;
186
+ if (i >= input.length) break;
187
+ if (input.charCodeAt(i) === 91) {
188
+ i++;
189
+ while (i < input.length) {
190
+ const csiCode = input.charCodeAt(i);
191
+ if (csiCode >= 64 && csiCode <= 126) {
192
+ break;
193
+ }
194
+ i++;
195
+ }
196
+ }
197
+ continue;
198
+ }
199
+ if (code === 9 || code === 10 || code === 13) {
200
+ output += " ";
201
+ continue;
202
+ }
203
+ if (code >= 0 && code <= 8 || code >= 11 && code <= 31) {
204
+ continue;
205
+ }
206
+ if (code >= 127 && code <= 159) {
207
+ continue;
208
+ }
209
+ output += input[i];
210
+ }
211
+ return output;
212
+ }
213
+ function formatShannonsAsCkb(shannons, fractionDigits = 8) {
214
+ const value = typeof shannons === "bigint" ? shannons : BigInt(shannons);
215
+ const sign = value < 0n ? "-" : "";
216
+ const abs = value < 0n ? -value : value;
217
+ const safeDigits = Math.max(0, Math.min(8, Math.trunc(fractionDigits)));
218
+ const multiplier = 10n ** BigInt(safeDigits);
219
+ const scaled = (abs * multiplier + SHANNONS_PER_CKB / 2n) / SHANNONS_PER_CKB;
220
+ const whole = scaled / multiplier;
221
+ if (safeDigits === 0) {
222
+ return `${sign}${whole}`;
223
+ }
224
+ const fraction = (scaled % multiplier).toString().padStart(safeDigits, "0");
225
+ return `${sign}${whole}.${fraction}`;
226
+ }
178
227
  function parseHexTimestampMs(hexTimestamp) {
179
228
  if (!hexTimestamp) return null;
180
229
  try {
@@ -931,20 +980,20 @@ function registerChannelRebalanceCommand(parent, config) {
931
980
  // src/commands/channel.ts
932
981
  function createChannelCommand(config) {
933
982
  const channel = new Command2("channel").description("Channel lifecycle and status commands");
934
- channel.command("list").option("--state <state>").option("--peer <peerId>").option("--include-closed").option("--raw").option("--json").action(async (options) => {
983
+ channel.command("list").option("--state <state>").option("--peer <peerId>").option("--include-closed").option("--json").action(async (options) => {
935
984
  const rpc = await createReadyRpcClient(config);
936
985
  const stateFilter = parseChannelState(options.state);
937
986
  const response = await rpc.listChannels(
938
987
  options.peer ? { peer_id: options.peer, include_closed: Boolean(options.includeClosed) } : { include_closed: Boolean(options.includeClosed) }
939
988
  );
940
989
  const channels = stateFilter ? response.channels.filter((item) => item.state.state_name === stateFilter) : response.channels;
941
- if (options.raw || options.json) {
990
+ if (options.json) {
942
991
  printJsonSuccess({ channels, count: channels.length });
943
992
  } else {
944
993
  printChannelListHuman(channels);
945
994
  }
946
995
  });
947
- channel.command("get").argument("<channelId>").option("--raw").option("--json").action(async (channelId, options) => {
996
+ channel.command("get").argument("<channelId>").option("--json").action(async (channelId, options) => {
948
997
  const rpc = await createReadyRpcClient(config);
949
998
  const response = await rpc.listChannels({ include_closed: true });
950
999
  const found = response.channels.find((item) => item.channel_id === channelId);
@@ -962,7 +1011,7 @@ function createChannelCommand(config) {
962
1011
  }
963
1012
  process.exit(1);
964
1013
  }
965
- if (options.raw || options.json) {
1014
+ if (options.json) {
966
1015
  printJsonSuccess(found);
967
1016
  } else {
968
1017
  printChannelDetailHuman(found);
@@ -3256,6 +3305,167 @@ function inferDateFromPaths(paths) {
3256
3305
  // src/commands/node.ts
3257
3306
  import { Command as Command8 } from "commander";
3258
3307
 
3308
+ // src/lib/node-info.ts
3309
+ async function runNodeInfoCommand(config, options) {
3310
+ const rpc = await createReadyRpcClient(config);
3311
+ const nodeInfo = await rpc.nodeInfo();
3312
+ if (options.json) {
3313
+ printJsonSuccess(nodeInfo);
3314
+ return;
3315
+ }
3316
+ console.log("\u2705 Node info retrieved");
3317
+ console.log(` Version: ${nodeInfo.version}`);
3318
+ console.log(` Commit: ${nodeInfo.commit_hash}`);
3319
+ console.log(` Node ID: ${nodeInfo.node_id}`);
3320
+ if (nodeInfo.features.length > 0) {
3321
+ console.log(" Features:");
3322
+ for (const feature of nodeInfo.features) {
3323
+ console.log(` - ${sanitizeForTerminal(feature)}`);
3324
+ }
3325
+ }
3326
+ console.log(` Name: ${sanitizeForTerminal(nodeInfo.node_name ?? "-")}`);
3327
+ if (nodeInfo.addresses.length > 0) {
3328
+ console.log(" Addresses:");
3329
+ for (const address of nodeInfo.addresses) {
3330
+ console.log(` - ${sanitizeForTerminal(address)}`);
3331
+ }
3332
+ }
3333
+ console.log(` Chain Hash: ${nodeInfo.chain_hash}`);
3334
+ console.log(` Channels: ${BigInt(nodeInfo.channel_count)}`);
3335
+ console.log(` Pending Channels: ${BigInt(nodeInfo.pending_channel_count)}`);
3336
+ console.log(` Peers: ${BigInt(nodeInfo.peers_count)}`);
3337
+ if (nodeInfo.udt_cfg_infos.length > 0) {
3338
+ console.log(" UDT Configs:");
3339
+ for (const udt of nodeInfo.udt_cfg_infos) {
3340
+ console.log(` - Name: ${sanitizeForTerminal(udt.name)}`);
3341
+ console.log(` Script: ${JSON.stringify(udt.script, null, 6)}`);
3342
+ if (udt.auto_accept_amount) {
3343
+ console.log(` Auto Accept Amount: ${BigInt(udt.auto_accept_amount)}`);
3344
+ }
3345
+ if (udt.cell_deps.length > 0) {
3346
+ console.log(" Cell Deps:");
3347
+ for (const dep of udt.cell_deps) {
3348
+ console.log(
3349
+ ` - Cell Dep: ${dep.cell_dep ? JSON.stringify(dep.cell_dep) : "null"}`
3350
+ );
3351
+ console.log(` Type ID: ${dep.type_id ? JSON.stringify(dep.type_id) : "null"}`);
3352
+ }
3353
+ }
3354
+ }
3355
+ }
3356
+ }
3357
+
3358
+ // src/lib/node-network.ts
3359
+ import { shannonsToCkb as shannonsToCkb5, toHex as toHex4 } from "@fiber-pay/sdk";
3360
+ async function runNodeNetworkCommand(config, options) {
3361
+ const rpc = await createReadyRpcClient(config);
3362
+ const [nodeInfo, localPeers, localChannels, graphNodes, graphChannels] = await Promise.all([
3363
+ rpc.nodeInfo(),
3364
+ rpc.listPeers(),
3365
+ rpc.listChannels({ include_closed: false }),
3366
+ rpc.graphNodes({}),
3367
+ rpc.graphChannels({})
3368
+ ]);
3369
+ const graphNodesMap = /* @__PURE__ */ new Map();
3370
+ for (const node of graphNodes.nodes) {
3371
+ graphNodesMap.set(node.node_id, node);
3372
+ }
3373
+ const peerIdToNodeIdMap = /* @__PURE__ */ new Map();
3374
+ for (const peer of localPeers.peers) {
3375
+ peerIdToNodeIdMap.set(peer.peer_id, peer.pubkey);
3376
+ }
3377
+ const graphChannelsMap = /* @__PURE__ */ new Map();
3378
+ for (const channel of graphChannels.channels) {
3379
+ if (channel.channel_outpoint) {
3380
+ const outpointKey = `${channel.channel_outpoint.tx_hash}:${channel.channel_outpoint.index}`;
3381
+ graphChannelsMap.set(outpointKey, channel);
3382
+ }
3383
+ }
3384
+ const enrichedPeers = localPeers.peers.map((peer) => ({
3385
+ ...peer,
3386
+ nodeInfo: graphNodesMap.get(peer.pubkey)
3387
+ }));
3388
+ const enrichedChannels = localChannels.channels.map((channel) => {
3389
+ const nodeId = peerIdToNodeIdMap.get(channel.peer_id) || channel.peer_id;
3390
+ const peerNodeInfo = graphNodesMap.get(nodeId);
3391
+ let graphChannelInfo;
3392
+ if (channel.channel_outpoint) {
3393
+ const outpointKey = `${channel.channel_outpoint.tx_hash}:${channel.channel_outpoint.index}`;
3394
+ graphChannelInfo = graphChannelsMap.get(outpointKey);
3395
+ }
3396
+ return {
3397
+ ...channel,
3398
+ peerNodeInfo,
3399
+ graphChannelInfo
3400
+ };
3401
+ });
3402
+ const activeChannels = enrichedChannels.filter((ch) => ch.state?.state_name === "CHANNEL_READY");
3403
+ const totalChannelCapacityShannons = activeChannels.reduce((sum, ch) => {
3404
+ const capacity = ch.graphChannelInfo?.capacity ? ch.graphChannelInfo.capacity : toHex4(BigInt(ch.local_balance) + BigInt(ch.remote_balance));
3405
+ return sum + BigInt(capacity);
3406
+ }, 0n);
3407
+ const totalChannelCapacity = formatShannonsAsCkb(totalChannelCapacityShannons, 1);
3408
+ const networkData = {
3409
+ localNodeId: nodeInfo.node_id,
3410
+ peers: enrichedPeers,
3411
+ channels: enrichedChannels,
3412
+ graphNodes: graphNodes.nodes,
3413
+ graphChannels: graphChannels.channels,
3414
+ summary: {
3415
+ connectedPeers: enrichedPeers.length,
3416
+ activeChannels: activeChannels.length,
3417
+ totalChannelCapacity
3418
+ }
3419
+ };
3420
+ if (options.json) {
3421
+ printJsonSuccess(networkData);
3422
+ return;
3423
+ }
3424
+ printNodeNetworkHuman(networkData);
3425
+ }
3426
+ function printNodeNetworkHuman(data) {
3427
+ console.log("Node Network Overview");
3428
+ console.log("=====================");
3429
+ console.log("");
3430
+ console.log(`Connected Peers: ${data.summary.connectedPeers}`);
3431
+ console.log(`Active Channels: ${data.summary.activeChannels}`);
3432
+ console.log(`Total Channel Capacity: ${data.summary.totalChannelCapacity} CKB`);
3433
+ console.log("");
3434
+ if (data.peers.length > 0) {
3435
+ console.log("Peers:");
3436
+ console.log(" PEER_ID ALIAS ADDRESS VERSION");
3437
+ console.log(
3438
+ " --------------------------------------------------------------------------------"
3439
+ );
3440
+ for (const peer of data.peers) {
3441
+ const peerId = truncateMiddle(peer.peer_id, 10, 8).padEnd(22, " ");
3442
+ const alias = sanitizeForTerminal(peer.nodeInfo?.node_name || "(unnamed)").slice(0, 20).padEnd(20, " ");
3443
+ const address = truncateMiddle(sanitizeForTerminal(peer.address), 15, 8).padEnd(25, " ");
3444
+ const version = sanitizeForTerminal(peer.nodeInfo?.version || "?").slice(0, 8).padEnd(8, " ");
3445
+ console.log(` ${peerId} ${alias} ${address} ${version}`);
3446
+ }
3447
+ console.log("");
3448
+ }
3449
+ if (data.channels.length > 0) {
3450
+ console.log("Channels:");
3451
+ console.log(
3452
+ " CHANNEL_ID PEER_ALIAS STATE LOCAL_BAL REMOTE_BAL CAPACITY"
3453
+ );
3454
+ console.log(
3455
+ " -----------------------------------------------------------------------------------------------"
3456
+ );
3457
+ for (const channel of data.channels) {
3458
+ const channelId = truncateMiddle(channel.channel_id, 10, 8).padEnd(22, " ");
3459
+ const peerAlias = sanitizeForTerminal(channel.peerNodeInfo?.node_name || "(unnamed)").slice(0, 18).padEnd(18, " ");
3460
+ const state = (channel.state?.state_name || "UNKNOWN").slice(0, 13).padEnd(13, " ");
3461
+ const localBal = shannonsToCkb5(channel.local_balance).toFixed(1).padStart(11, " ");
3462
+ const remoteBal = shannonsToCkb5(channel.remote_balance).toFixed(1).padStart(11, " ");
3463
+ const capacity = channel.graphChannelInfo?.capacity ? shannonsToCkb5(channel.graphChannelInfo.capacity).toFixed(1).padStart(8, " ") : shannonsToCkb5(toHex4(BigInt(channel.local_balance) + BigInt(channel.remote_balance))).toFixed(1).padStart(8, " ");
3464
+ console.log(` ${channelId} ${peerAlias} ${state} ${localBal} ${remoteBal} ${capacity}`);
3465
+ }
3466
+ }
3467
+ }
3468
+
3259
3469
  // src/lib/node-start.ts
3260
3470
  import { spawn } from "child_process";
3261
3471
  import { mkdirSync as mkdirSync3 } from "fs";
@@ -4136,6 +4346,7 @@ async function runNodeStatusCommand(config, options) {
4136
4346
  const nodeRunning = Boolean(pid && isProcessRunning(pid));
4137
4347
  let rpcResponsive = false;
4138
4348
  let nodeId = null;
4349
+ let nodeName = null;
4139
4350
  let addresses = [];
4140
4351
  let chainHash = null;
4141
4352
  let version = null;
@@ -4163,6 +4374,7 @@ async function runNodeStatusCommand(config, options) {
4163
4374
  const channels = await rpc.listChannels({ include_closed: false });
4164
4375
  rpcResponsive = true;
4165
4376
  nodeId = nodeInfo.node_id;
4377
+ nodeName = nodeInfo.node_name;
4166
4378
  addresses = nodeInfo.addresses;
4167
4379
  chainHash = nodeInfo.chain_hash;
4168
4380
  version = nodeInfo.version;
@@ -4234,6 +4446,7 @@ async function runNodeStatusCommand(config, options) {
4234
4446
  rpcTarget: resolvedRpc.target,
4235
4447
  resolvedRpcUrl: resolvedRpc.url,
4236
4448
  nodeId,
4449
+ nodeName,
4237
4450
  addresses,
4238
4451
  chainHash,
4239
4452
  version,
@@ -4296,8 +4509,11 @@ async function runNodeStatusCommand(config, options) {
4296
4509
  console.log(`\u2705 Node is running (PID: ${output.pid})`);
4297
4510
  if (output.rpcResponsive) {
4298
4511
  console.log(` Node ID: ${String(output.nodeId)}`);
4512
+ if (output.nodeName) {
4513
+ console.log(` Name: ${sanitizeForTerminal(output.nodeName)}`);
4514
+ }
4299
4515
  if (output.version) {
4300
- console.log(` Version: ${String(output.version)}`);
4516
+ console.log(` Version: ${sanitizeForTerminal(output.version)}`);
4301
4517
  }
4302
4518
  if (output.chainHash) {
4303
4519
  console.log(` Chain Hash: ${String(output.chainHash)}`);
@@ -4320,7 +4536,7 @@ async function runNodeStatusCommand(config, options) {
4320
4536
  if (output.addresses.length > 0) {
4321
4537
  console.log(" Addresses:");
4322
4538
  for (const address of output.addresses) {
4323
- console.log(` - ${address}`);
4539
+ console.log(` - ${sanitizeForTerminal(address)}`);
4324
4540
  }
4325
4541
  }
4326
4542
  } else {
@@ -4797,6 +5013,12 @@ function createNodeCommand(config) {
4797
5013
  node.command("status").option("--json").action(async (options) => {
4798
5014
  await runNodeStatusCommand(config, options);
4799
5015
  });
5016
+ node.command("network").description("Display comprehensive network topology and connections").option("--json").action(async (options) => {
5017
+ await runNodeNetworkCommand(config, options);
5018
+ });
5019
+ node.command("info").description("Display information about the running node").option("--json").action(async (options) => {
5020
+ await runNodeInfoCommand(config, options);
5021
+ });
4800
5022
  node.command("ready").description("Agent-oriented readiness summary for automation").option("--json").action(async (options) => {
4801
5023
  await runNodeReadyCommand(config, options);
4802
5024
  });
@@ -4810,7 +5032,7 @@ function createNodeCommand(config) {
4810
5032
  }
4811
5033
 
4812
5034
  // src/commands/payment.ts
4813
- import { ckbToShannons as ckbToShannons4, shannonsToCkb as shannonsToCkb5 } from "@fiber-pay/sdk";
5035
+ import { ckbToShannons as ckbToShannons4, shannonsToCkb as shannonsToCkb6 } from "@fiber-pay/sdk";
4814
5036
  import { Command as Command9 } from "commander";
4815
5037
  function createPaymentCommand(config) {
4816
5038
  const payment = new Command9("payment").description("Payment lifecycle and status commands");
@@ -4896,7 +5118,7 @@ function createPaymentCommand(config) {
4896
5118
  const payload = {
4897
5119
  paymentHash: result.payment_hash,
4898
5120
  status: result.status === "Success" ? "success" : result.status === "Failed" ? "failed" : "pending",
4899
- feeCkb: shannonsToCkb5(result.fee),
5121
+ feeCkb: shannonsToCkb6(result.fee),
4900
5122
  failureReason: result.failed_error
4901
5123
  };
4902
5124
  if (json) {
@@ -5076,7 +5298,7 @@ function createPaymentCommand(config) {
5076
5298
  console.log(
5077
5299
  ` Outpoint: ${hop.channel_outpoint.tx_hash}:${hop.channel_outpoint.index}`
5078
5300
  );
5079
- console.log(` Amount: ${shannonsToCkb5(hop.amount_received)} CKB`);
5301
+ console.log(` Amount: ${shannonsToCkb6(hop.amount_received)} CKB`);
5080
5302
  console.log(` Expiry: ${hop.incoming_tlc_expiry}`);
5081
5303
  }
5082
5304
  }
@@ -5115,7 +5337,7 @@ function createPaymentCommand(config) {
5115
5337
  const payload = {
5116
5338
  paymentHash: result.payment_hash,
5117
5339
  status: result.status === "Success" ? "success" : result.status === "Failed" ? "failed" : "pending",
5118
- feeCkb: shannonsToCkb5(result.fee),
5340
+ feeCkb: shannonsToCkb6(result.fee),
5119
5341
  failureReason: result.failed_error,
5120
5342
  dryRun: Boolean(options.dryRun)
5121
5343
  };
@@ -5139,7 +5361,7 @@ function getJobPaymentHash(job) {
5139
5361
  }
5140
5362
  function getJobFeeCkb(job) {
5141
5363
  const result = job.result;
5142
- return result?.fee ? shannonsToCkb5(result.fee) : 0;
5364
+ return result?.fee ? shannonsToCkb6(result.fee) : 0;
5143
5365
  }
5144
5366
  function getJobFailure(job) {
5145
5367
  const result = job.result;
@@ -5521,7 +5743,7 @@ function createRuntimeCommand(config) {
5521
5743
  if (fallback && isFiberRuntimeCommand(fallback.command)) {
5522
5744
  pid = fallback.pid;
5523
5745
  writeRuntimePid(config.dataDir, pid);
5524
- } else if (fallback && fallback.command) {
5746
+ } else if (fallback?.command) {
5525
5747
  const details = fallback.command ? `PID ${fallback.pid} (${fallback.command})` : `PID ${fallback.pid}`;
5526
5748
  if (asJson) {
5527
5749
  printJsonError({
@@ -5618,7 +5840,7 @@ function createRuntimeCommand(config) {
5618
5840
  if (fallback && isFiberRuntimeCommand(fallback.command)) {
5619
5841
  pid = fallback.pid;
5620
5842
  writeRuntimePid(config.dataDir, pid);
5621
- } else if (fallback && fallback.command) {
5843
+ } else if (fallback?.command) {
5622
5844
  const details = fallback.command ? `PID ${fallback.pid} (${fallback.command})` : `PID ${fallback.pid}`;
5623
5845
  if (asJson) {
5624
5846
  printJsonError({
@@ -5702,8 +5924,8 @@ function createRuntimeCommand(config) {
5702
5924
  import { Command as Command12 } from "commander";
5703
5925
 
5704
5926
  // src/lib/build-info.ts
5705
- var CLI_VERSION = "0.1.0-rc.5";
5706
- var CLI_COMMIT = "28cee07226e004d775ed747bbcbf61474f93c492";
5927
+ var CLI_VERSION = "0.1.0-rc.7";
5928
+ var CLI_COMMIT = "f71c561d8f423b9c88b79f5568dc1c6f9fbc93e3";
5707
5929
 
5708
5930
  // src/commands/version.ts
5709
5931
  function createVersionCommand() {
@@ -5721,6 +5943,64 @@ function createVersionCommand() {
5721
5943
  });
5722
5944
  }
5723
5945
 
5946
+ // src/commands/wallet.ts
5947
+ import { Command as Command13 } from "commander";
5948
+
5949
+ // src/lib/wallet-address.ts
5950
+ import { scriptToAddress as scriptToAddress2 } from "@fiber-pay/sdk";
5951
+ async function runWalletAddressCommand(config, options) {
5952
+ const rpc = await createReadyRpcClient(config);
5953
+ const nodeInfo = await rpc.nodeInfo();
5954
+ const address = scriptToAddress2(
5955
+ nodeInfo.default_funding_lock_script,
5956
+ config.network === "mainnet" ? "mainnet" : "testnet"
5957
+ );
5958
+ if (options.json) {
5959
+ printJsonSuccess({ address });
5960
+ return;
5961
+ }
5962
+ console.log("\u2705 Funding address retrieved");
5963
+ console.log(` Address: ${address}`);
5964
+ }
5965
+
5966
+ // src/lib/wallet-balance.ts
5967
+ async function runWalletBalanceCommand(config, options) {
5968
+ if (!config.ckbRpcUrl) {
5969
+ throw new Error(
5970
+ "CKB RPC URL is not configured. Set FIBER_CKB_RPC_URL or add ckb.rpc_url to config.yml."
5971
+ );
5972
+ }
5973
+ const rpc = await createReadyRpcClient(config);
5974
+ const nodeInfo = await rpc.nodeInfo();
5975
+ const balanceShannons = await getLockBalanceShannons(
5976
+ config.ckbRpcUrl,
5977
+ nodeInfo.default_funding_lock_script
5978
+ );
5979
+ const balanceCkb = formatShannonsAsCkb(balanceShannons, 8);
5980
+ if (options.json) {
5981
+ printJsonSuccess({
5982
+ balance_ckb: balanceCkb,
5983
+ balance_shannons: balanceShannons.toString()
5984
+ });
5985
+ return;
5986
+ }
5987
+ console.log("\u2705 CKB balance retrieved");
5988
+ console.log(` Balance: ${balanceCkb} CKB`);
5989
+ console.log(` Balance (shannons): ${balanceShannons.toString()}`);
5990
+ }
5991
+
5992
+ // src/commands/wallet.ts
5993
+ function createWalletCommand(config) {
5994
+ const wallet = new Command13("wallet").description("Wallet management");
5995
+ wallet.command("address").description("Display the funding address").option("--json").action(async (options) => {
5996
+ await runWalletAddressCommand(config, options);
5997
+ });
5998
+ wallet.command("balance").description("Display the CKB balance").option("--json").action(async (options) => {
5999
+ await runWalletBalanceCommand(config, options);
6000
+ });
6001
+ return wallet;
6002
+ }
6003
+
5724
6004
  // src/lib/argv.ts
5725
6005
  var GLOBAL_OPTIONS_WITH_VALUE = /* @__PURE__ */ new Set([
5726
6006
  "--profile",
@@ -5886,7 +6166,7 @@ async function main() {
5886
6166
  }
5887
6167
  applyGlobalOverrides(argv);
5888
6168
  const config = getEffectiveConfig(explicitFlags).config;
5889
- const program = new Command13();
6169
+ const program = new Command14();
5890
6170
  program.name("fiber-pay").description("AI Agent Payment SDK for CKB Lightning Network").option("--profile <name>", "Use profile at ~/.fiber-pay/profiles/<name>").option("--data-dir <path>", "Override data directory for all commands").option("--rpc-url <url>", "Override RPC URL for all commands").option("--rpc-biscuit-token <token>", "Set RPC Authorization Bearer token for all commands").option("--network <network>", "Override network for all commands (testnet|mainnet)").option("--key-password <password>", "Override key password for all commands").option("--binary-path <path>", "Override fiber binary path for all commands").showHelpAfterError().showSuggestionAfterError();
5891
6171
  program.exitOverride();
5892
6172
  program.configureOutput({
@@ -5909,6 +6189,7 @@ async function main() {
5909
6189
  program.addCommand(createConfigCommand(config));
5910
6190
  program.addCommand(createRuntimeCommand(config));
5911
6191
  program.addCommand(createVersionCommand());
6192
+ program.addCommand(createWalletCommand(config));
5912
6193
  await program.parseAsync(argv);
5913
6194
  }
5914
6195
  main().catch((error) => {