sibit 0.23.1 → 0.24.0
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.
- checksums.yaml +4 -4
- data/bin/sibit +8 -1
- data/lib/sibit/version.rb +1 -1
- data/lib/sibit.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 454f8e5b1c59bdca8524051e3cfdc27314b4d192d37c03f295cc60a30a16472d
|
|
4
|
+
data.tar.gz: 5b13db6edbc82e48d413508777056cebcf0305965c6c72ed9c9e91060f90975b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d8b02c3e16cc4f99a3a39e593bc23ad49a04a706603391c3e38027e7251f9034a7a44eb07764360e25bca3dc2bb6bf7dba3b1e36fe09218ae433fb3cb20cc2a
|
|
7
|
+
data.tar.gz: f6f67a0c39f4728fbf73094d9ea01ced727ebd5a043fe8c2d2ba4620ea7b65fd1dffb377e3e902f3b6a21d1559a6edffd269accfae49907f354b3c4b798fcfc2
|
data/bin/sibit
CHANGED
|
@@ -26,6 +26,7 @@ $stdout.sync = true
|
|
|
26
26
|
# see https://stackoverflow.com/a/6048451/187141
|
|
27
27
|
require 'openssl'
|
|
28
28
|
OpenSSL::SSL::VERIFY_PEER ||= OpenSSL::SSL::VERIFY_NONE
|
|
29
|
+
puts OpenSSL::X509::DEFAULT_CERT_FILE
|
|
29
30
|
|
|
30
31
|
require 'slop'
|
|
31
32
|
require 'backtrace'
|
|
@@ -71,6 +72,11 @@ Options are:"
|
|
|
71
72
|
'Ordered List of APIs to use, e.g. "earn,blockchain,btc,bitcoinchain"',
|
|
72
73
|
default: %w[earn blockchain btc bitcoinchain blockchair cex]
|
|
73
74
|
)
|
|
75
|
+
o.array(
|
|
76
|
+
'--skip-utxo',
|
|
77
|
+
'List of UTXTO that must be skipped while paying',
|
|
78
|
+
default: []
|
|
79
|
+
)
|
|
74
80
|
end
|
|
75
81
|
rescue Slop::Error => e
|
|
76
82
|
raise e.message
|
|
@@ -141,7 +147,8 @@ Options are:"
|
|
|
141
147
|
puts sibit.pay(
|
|
142
148
|
amount, fee,
|
|
143
149
|
sources.split(',').map { |p| p.split(':') }.to_h,
|
|
144
|
-
target, change
|
|
150
|
+
target, change,
|
|
151
|
+
skip_utxo: opts['skip-utxo']
|
|
145
152
|
)
|
|
146
153
|
else
|
|
147
154
|
raise "Command #{opts.arguments[0]} is not supported"
|
data/lib/sibit/version.rb
CHANGED
data/lib/sibit.rb
CHANGED
|
@@ -113,7 +113,7 @@ class Sibit
|
|
|
113
113
|
# their addresses as keys and private keys as values
|
|
114
114
|
# +target+: the target address to send to
|
|
115
115
|
# +change+: the address where the change has to be sent to
|
|
116
|
-
def pay(amount, fee, sources, target, change)
|
|
116
|
+
def pay(amount, fee, sources, target, change, skip_utxo: [])
|
|
117
117
|
p = price('USD')
|
|
118
118
|
satoshi = satoshi(amount)
|
|
119
119
|
builder = Bitcoin::Builder::TxBuilder.new
|
|
@@ -123,6 +123,10 @@ class Sibit
|
|
|
123
123
|
@log.info("#{utxos.count} UTXOs found, these will be used \
|
|
124
124
|
(value/confirmations at tx_hash):")
|
|
125
125
|
utxos.each do |utxo|
|
|
126
|
+
if skip_utxo.include?(utxo[:hash])
|
|
127
|
+
@log.info("UTXO skipped: #{utxo[:hash]}")
|
|
128
|
+
next
|
|
129
|
+
end
|
|
126
130
|
unspent += utxo[:value]
|
|
127
131
|
builder.input do |i|
|
|
128
132
|
i.prev_out(utxo[:hash])
|