Windows版の Daedalus Mainnet (4.1.0#18213)。

起動後のプロセスの概略は
* cardano-node.exe ブロックチェーンの土台。名前付きパイプを張る。dir \\.\pipe\\cardano-node-mainnet.*
* cardano-wallet.exe そのパイプと通信し、RESTAPI を提供。port に listen
* daedalus 見えてる画面。Electronで固めたもの

だと思われます。

付属の cardano-wallet.exe で動作中の情報を取れないかなと。
cardano-wallet.exe だと

C:\Program Files\Daedalus Mainnet>cardano-wallet network clock --port XXXXX
This server only accepts secure HTTPS connections.

と出てきてしまって、HTTPS通信する方法が分からず。

下でできた。cardano-wallet.exe 経由ではなく RESTリクエスト 直だけど。

#!/usr/bin/perl

use Modern::Perl;

use File::Spec::Functions qw(catfile);
use HTTP::Tiny;
use IPC::System::Simple qw(capture);
use JSON::MaybeXS qw(:legacy);
use YAML::Syck;

sub get_cardano_wallet_pid {
    capture("tasklist") =~ /cardano-wallet\.exe\s+(\d+)/ ? $1 : die;
}

sub get_cardano_wallet_port {
    my $pid = get_cardano_wallet_pid();
    capture("netstat -nao") =~ /\s+127\.0\.0\.1:(\d+).*\s+$pid$/m ? $1 : die;
}

my $port = get_cardano_wallet_port();

my $http = HTTP::Tiny->new(
    SSL_options => {
        SSL_cert_file => catfile($ENV{APPDATA}, 'Daedalus Mainnet\tls\client\client.crt'),
        SSL_key_file  => catfile($ENV{APPDATA}, 'Daedalus Mainnet\tls\client\client.key'),
    },
    default_headers => {
        'Content-Type' => 'application/json',
    },
);
#my $uri  = "https://127.0.0.1:$port/v2/network/clock";
my $uri  = "https://127.0.0.1:$port/v2/wallets";
my $res  = $http->get($uri);

if ($res->{success}) {
    say Dump decode_json $res->{content};
}
else {
    die Dump $res;
}

__END__
---
-
  address_pool_gap: 20
  assets:
    available: []

    total: []

  balance:
    available:
      quantity: 'XXX'
      unit: lovelace
    reward:
      quantity: XXX
      unit: lovelace
    total:
      quantity: 'XXX'
      unit: lovelace
  delegation:
    active:
      status: delegating
      target: poolXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    next: []

  id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  name: XXXXXXXXXXXXXXXXXXXXX
  passphrase:
    last_updated_at: 20XX-XX-XXTXX:XX:XX.XXXXXXXZ
  state:
    status: ready
  tip:
    absolute_slot_number: XXXXXXXX
    epoch_number: 276
    height:
      quantity: 5951584
      unit: block
    slot_number: 282623
    time: 2021-07-08T04:15:14Z
perl adv
perl adv