I'm still not sure what you're saying.
All these features can be achieved via command line and all these commands can be accessed via RPC so the functionalities are available that way.
Are you asking for command shortcuts so things are as easy to code as using the UI? That's a lot to ask. That's not normally how command-line apps work.
RPC is intended to be used by programs/scripts so it needs to be flexible and have low-level methods. The script itself can implement the required logic.
Consider this, an application that uses xinput to drive the QT-client so as to gain access to the extra features it offers.... Ridiculous right!
If there is a good function or subroutine, then it should be exposed as an API extension... Not buried away as part of a user interface.
Why do I have a feeling that you're just too incompetent/lazy to use the raw transactions API?
I just don't want to maintain code that sucks and is all crappy. Given the following a wrapper around a QT application might look sane and manageable.
sub btcpu {
my $outputs = shift @_;
my $trns = $api->call( 'decoderawtransaction', shift @_ );
my $txid = $trns->{txid};
my @vout = @{ $trns->{vout} };
while ( $_ = shift @vout ) {
my $addr = $_->{scriptPubKey}->{addresses}->[0];
push @{$outputs},
{
txid => $txid,
amount => $_->{value},
vout => 0 + $_->{n},
scriptPubKey => $_->{scriptPubKey}->{hex},
address => $addr,
confirmations => 0.0001,
}
if ( $addr eq work
|| $addr eq $exca->[0]
|| $addr eq $exca->[1]
|| $addr eq $exca->[2]
|| $addr eq $exca->[3]
|| $addr eq $exca->[4]
|| $addr eq $exca->[5]
|| 0 );
}
}
sub createtransaction {
my ( $opts, $cost, $invest, $price, $change ) = @_;
my ( $rtx, $outputs ) = ( "", [] );
if ( $cost > $price + (FEE) ) {
$rtx = $_ = $api->call(
'signrawtransaction',
$api->call(
'createrawtransaction',
$opts,
{
$invest => 0 + $price,
$change => 0 + $cost - $price - (FEE)
}
)
)->{hex};
btcpu( $outputs, $_ );
}
else {
$rtx = $_ = $api->call(
'signrawtransaction',
$api->call(
'createrawtransaction', $opts, { $invest => 0 + $price }
)
)->{hex};
btcpu( $outputs, $_ );
}
return ( $rtx, $outputs );
}
sub gettarget {
my $target = [ gettimeofday() ];
$target->[0] += 2; # 2 seconds from now.
unless ($opt_f) {
my $dt = DateTime->now();
$dt->add( seconds => 3 );
$dt->truncate( to => 'minute' );
$dt->add( minutes => 1 );
my $now = DateTime->now();
die "Target time too far."
if (
DateTime->compare( $dt, $now ) != DateTime->compare(
DateTime->from_object( object => $now )->add( minutes => 2 ),
$dt
)
);
$target = [ $dt->hires_epoch(), 24e4 ];
clock_nanosleep( CLOCK_REALTIME,
tv_interval( [ gettimeofday() ], $target ) * 1e9 - 12e9 )
if ( DateTime->compare( $now->add( seconds => 13 ), $dt ) != 1 );
}
return $target;
}
sub getsocket {
my $cl = new IO::Socket::SSL(
PeerPort => 'https',
PeerHost => '141.101.112.196',
SSL_hostname => 'blockchain.info',
);
die "cannot connect to the server $!\n" unless $cl;
$cl->blocking(0);
$cl->autoflush(1);
$cl->sockopt( TCP_NODELAY, 1 );
return [ $cl, IO::Select->new($cl) ];
}
sub txspush {
my ( $cl, $sel, $target ) = ( shift @_, shift @_, shift @_ );
unless ($opt_f) {
clock_nanosleep( CLOCK_REALTIME,
max( 0, tv_interval( [ gettimeofday() ], $target ) * 1e9 - 1e6 ) );
1 while ( [ gettimeofday() ]->[1] > 9e5 );
1 while ( [ gettimeofday() ]->[1] <= 13e4 );
}
$opt_f = 1;
foreach (@_) {
$_ = Encode::encode_utf8($_);
my $out = Encode::encode_utf8( sprintf( REQ, length($_) + 3, $_ ) );
my $siz = length($out);
my $off = 0;
while ( $siz > $off ) {
$sel->can_write();
$off += $cl->syswrite( $out, $siz - $off, $off );
}
$sel->can_read();
1 while ( $cl->sysread( my $a, 4096 ) );
}
$api->call( 'sendrawtransaction', $_ ) foreach (@_);
}
my $target = [ gettimeofday() ];
NEWTX: while ( my $bid = shift @bids ) {
my $cost = 0;
my @opts = ();
while ( $_ = shift @unspent ) {
$_->{vout} += 0;
$_->{amount} += 0;
push @opts,
{
txid => $_->{txid},
vout => $_->{vout},
scriptPubKey => $_->{scriptPubKey}
};
$cost += $_->{amount};
last
if ( $cost >= $bid + FEE );
}
my @a = createtransaction(
\@opts, $cost, $GAME,
$cost <= $bid ? $cost - (FEE) < 0 ? $cost : $cost - (FEE) : $bid,
$exca->[ $opt_r ? -1 : 0 ]
);
push @txs, $a[0];
push @nextunspent, @{ $a[1] };
push @{$exca}, shift @{$exca}
if ($opt_r);
if ( $#unspent <= 0 ) {
last
if ( $#nextunspent <= 0 );
@unspent = @nextunspent;
@nextunspent = ();
}
}