sibit 0.32.4 → 0.32.6
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/Gemfile.lock +2 -2
- data/features/cli.feature +13 -0
- data/features/step_definitions/steps.rb +1 -1
- data/lib/sibit/bin.rb +21 -10
- data/lib/sibit/version.rb +1 -1
- data/lib/sibit.rb +1 -0
- 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: 9fd0f078031f164079de39c2fd14dcd8ac8675861ff74bec96fac105525110cd
|
|
4
|
+
data.tar.gz: 7f77f659da2b18be975c7587915f5aa875a21e55237d06582cdac36c8ccda6f8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 072721e3965d7e0719332cdf970f32be79d2b266c5807bad9c56d00a8e2fbd5ba4ca7817c876d093e57873dd6393486e9c3d2052147315dd64ff0b1a565c7f6f
|
|
7
|
+
data.tar.gz: bd3727fef02c55442ed256fa836baf422fe9352f58eff4b755f2f87da45a7bf0fd3ba424d54e29da3c9a9f1d8fcd4e6cc913dd4f557de52374ee9ffa29842256
|
data/Gemfile.lock
CHANGED
|
@@ -57,7 +57,7 @@ GEM
|
|
|
57
57
|
cucumber-messages (>= 31, < 32)
|
|
58
58
|
cucumber-html-formatter (22.3.0)
|
|
59
59
|
cucumber-messages (> 23, < 33)
|
|
60
|
-
cucumber-messages (31.
|
|
60
|
+
cucumber-messages (31.2.0)
|
|
61
61
|
cucumber-tag-expressions (8.1.0)
|
|
62
62
|
date (3.5.1)
|
|
63
63
|
decoor (0.1.0)
|
|
@@ -67,7 +67,7 @@ GEM
|
|
|
67
67
|
backtrace (~> 0.3)
|
|
68
68
|
os (~> 1.1)
|
|
69
69
|
qbash (~> 0.3)
|
|
70
|
-
elapsed (0.2.
|
|
70
|
+
elapsed (0.2.2)
|
|
71
71
|
loog (~> 0.6)
|
|
72
72
|
tago (~> 0.1)
|
|
73
73
|
ellipsized (0.3.0)
|
data/features/cli.feature
CHANGED
|
@@ -24,6 +24,14 @@ Feature: Command Line Processing
|
|
|
24
24
|
When I run bin/sibit with "create 46feba063e9b59a8ae0dba68abd39a3cb8f52089e776576d6eb1bb5bfec123d1"
|
|
25
25
|
Then Exit code is zero
|
|
26
26
|
|
|
27
|
+
Scenario: Bitcoin address can be created with base58 option at the end
|
|
28
|
+
When I run bin/sibit with "create 46feba063e9b59a8ae0dba68abd39a3cb8f52089e776576d6eb1bb5bfec123d1 --base58"
|
|
29
|
+
Then Exit code is zero
|
|
30
|
+
|
|
31
|
+
Scenario: Bitcoin address can be created with base58 option before command
|
|
32
|
+
When I run bin/sibit with "--base58 create 46feba063e9b59a8ae0dba68abd39a3cb8f52089e776576d6eb1bb5bfec123d1"
|
|
33
|
+
Then Exit code is zero
|
|
34
|
+
|
|
27
35
|
Scenario: Bitcoin balance can be checked
|
|
28
36
|
When I run bin/sibit with "balance 1MZT1fa6y8H9UmbZV6HqKF4UY41o9MGT5f --verbose --api=blockchain,btc"
|
|
29
37
|
Then Exit code is zero
|
|
@@ -36,3 +44,8 @@ Feature: Command Line Processing
|
|
|
36
44
|
When I run bin/sibit with "pay --help"
|
|
37
45
|
Then Exit code is zero
|
|
38
46
|
And Stdout contains "--skip-utxo"
|
|
47
|
+
|
|
48
|
+
Scenario: Unknown option shows error message
|
|
49
|
+
When I run bin/sibit with "generate --foo"
|
|
50
|
+
Then Exit code is not zero
|
|
51
|
+
And Stdout contains "Unknown option"
|
|
@@ -27,7 +27,7 @@ end
|
|
|
27
27
|
|
|
28
28
|
When(%r{^I run bin/sibit with "([^"]*)"$}) do |arg|
|
|
29
29
|
home = File.join(File.dirname(__FILE__), '../..')
|
|
30
|
-
@stdout = `ruby -I#{home}/lib #{home}/bin/sibit #{arg}`
|
|
30
|
+
@stdout = `ruby -I#{home}/lib #{home}/bin/sibit #{arg} 2>&1`
|
|
31
31
|
@exitstatus = $CHILD_STATUS.exitstatus
|
|
32
32
|
end
|
|
33
33
|
|
data/lib/sibit/bin.rb
CHANGED
|
@@ -20,23 +20,35 @@ class Sibit
|
|
|
20
20
|
# Sibit::Bin.start(['price'])
|
|
21
21
|
# Sibit::Bin.start(['balance', '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa'])
|
|
22
22
|
class Bin < Thor
|
|
23
|
-
|
|
23
|
+
stop_on_unknown_option!
|
|
24
|
+
|
|
25
|
+
class_option :proxy, type: :string,
|
|
26
|
+
desc: 'HTTPS proxy for all requests, e.g. "localhost:3128"'
|
|
24
27
|
class_option :attempts, type: :numeric, default: 1,
|
|
25
28
|
desc: 'How many times should we try before failing'
|
|
26
29
|
class_option :dry, type: :boolean, default: false,
|
|
27
30
|
desc: "Don't send a real payment, run in a read-only mode"
|
|
28
|
-
class_option :verbose, type: :boolean, default: false,
|
|
29
|
-
|
|
31
|
+
class_option :verbose, type: :boolean, default: false,
|
|
32
|
+
desc: 'Print all possible debug messages'
|
|
33
|
+
class_option :quiet, type: :boolean, default: false,
|
|
34
|
+
desc: 'Print only informative messages'
|
|
30
35
|
class_option :api, type: :array, default: %w[blockchain btc bitcoinchain blockchair cex],
|
|
31
36
|
desc: 'Ordered List of APIs to use, e.g. "blockchain,btc,bitcoinchain"'
|
|
37
|
+
class_option :base58, type: :boolean, default: false,
|
|
38
|
+
desc: 'Use base58 address format instead of bech32'
|
|
32
39
|
|
|
33
40
|
def self.exit_on_failure?
|
|
34
41
|
true
|
|
35
42
|
end
|
|
36
43
|
|
|
37
44
|
def self.handle_argument_error(command, error, args, _arity)
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
return new.help(command.name) if args.include?('--help') || args.include?('-h')
|
|
46
|
+
unknown = args.find { |a| a.start_with?('-') }
|
|
47
|
+
if unknown
|
|
48
|
+
warn "Unknown option: #{unknown}"
|
|
49
|
+
exit 1
|
|
50
|
+
end
|
|
51
|
+
raise error
|
|
40
52
|
end
|
|
41
53
|
|
|
42
54
|
desc 'price', 'Get current price of BTC in USD'
|
|
@@ -69,7 +81,8 @@ class Sibit
|
|
|
69
81
|
desc 'create KEY', 'Create a public Bitcoin address from the private key'
|
|
70
82
|
def create(key)
|
|
71
83
|
log.debug("Private key provided: #{key.ellipsized(8).inspect}")
|
|
72
|
-
|
|
84
|
+
k = Sibit::Key.new(key)
|
|
85
|
+
log.info(options[:base58] ? k.base58 : k.bech32)
|
|
73
86
|
end
|
|
74
87
|
|
|
75
88
|
desc 'balance ADDRESS', 'Check the balance of the Bitcoin address'
|
|
@@ -82,8 +95,6 @@ class Sibit
|
|
|
82
95
|
'Send a new Bitcoin transaction (AMOUNT can be "MAX" to use full balance)'
|
|
83
96
|
option :skip_utxo, type: :array, default: [],
|
|
84
97
|
desc: 'List of UTXO that must be skipped while paying'
|
|
85
|
-
option :base58, type: :boolean, default: false,
|
|
86
|
-
desc: 'Convert private addresses to public in base58'
|
|
87
98
|
option :yes, type: :boolean, default: false,
|
|
88
99
|
desc: 'Skip confirmation prompt and send the payment immediately'
|
|
89
100
|
def pay(amount, fee, sources, target, change)
|
|
@@ -117,8 +128,8 @@ class Sibit
|
|
|
117
128
|
|
|
118
129
|
def log
|
|
119
130
|
@log ||= begin
|
|
120
|
-
verbose = !
|
|
121
|
-
(
|
|
131
|
+
verbose = !options[:quiet] &&
|
|
132
|
+
(options[:verbose] || ENV.fetch('SIBIT_VERBOSE', nil))
|
|
122
133
|
verbose ? Loog::VERBOSE : Loog::REGULAR
|
|
123
134
|
end
|
|
124
135
|
end
|
data/lib/sibit/version.rb
CHANGED
data/lib/sibit.rb
CHANGED