sibit 0.26.0 → 0.27.1
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 +1 -1
- data/Gemfile.lock +25 -24
- data/README.md +10 -11
- data/bin/sibit +2 -6
- data/lib/sibit/version.rb +1 -1
- metadata +1 -2
- data/lib/sibit/earn.rb +0 -86
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 731731c7fc499008d0a0fd713a84f8b416d55163674e6c2e45783436a283720d
|
|
4
|
+
data.tar.gz: f4b5d3b5119381ffdf4c764a1f4e82b4eb06f3b66135070b33ebffc43e523ec3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4b72bfda3a91eeb48eaf97b1badaba49d0cceaf4e935fe3b3ee983217b920602ad9935f1b2f70b881b08c9ed0f946b11be93abd606642d293846657f359c473
|
|
7
|
+
data.tar.gz: 2e4e84c22a4be9f275d53c5003ccbf5feaba4813546624c590cf853938e958b7e934c60d2924c9ed4e8f8ed301923df89edf337676fb4a231bb0f9ebe2b3c9c9
|
data/Gemfile
CHANGED
|
@@ -9,7 +9,7 @@ gemspec
|
|
|
9
9
|
# gem 'debase', '0.2.4.1', require: false
|
|
10
10
|
|
|
11
11
|
gem 'aruba', '~>2.2', require: false
|
|
12
|
-
gem 'cucumber', '~>
|
|
12
|
+
gem 'cucumber', '~>10.0', require: false
|
|
13
13
|
gem 'logger', '~>1.7', require: false
|
|
14
14
|
gem 'minitest', '~>6.0', require: false
|
|
15
15
|
gem 'minitest-reporters', '~>1.7', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -24,37 +24,38 @@ GEM
|
|
|
24
24
|
thor (~> 1.0)
|
|
25
25
|
ast (2.4.3)
|
|
26
26
|
backtrace (0.4.1)
|
|
27
|
+
base64 (0.3.0)
|
|
27
28
|
bigdecimal (4.0.1)
|
|
28
29
|
builder (3.3.0)
|
|
29
30
|
contracts (0.17.3)
|
|
30
31
|
crack (1.0.1)
|
|
31
32
|
bigdecimal
|
|
32
33
|
rexml
|
|
33
|
-
cucumber (
|
|
34
|
+
cucumber (10.2.0)
|
|
35
|
+
base64 (~> 0.2)
|
|
34
36
|
builder (~> 3.2)
|
|
35
|
-
cucumber-ci-environment (> 9, <
|
|
36
|
-
cucumber-core (>
|
|
37
|
-
cucumber-cucumber-expressions (
|
|
38
|
-
cucumber-
|
|
39
|
-
cucumber-html-formatter (> 20.3, < 22)
|
|
40
|
-
cucumber-messages (> 19, < 25)
|
|
37
|
+
cucumber-ci-environment (> 9, < 12)
|
|
38
|
+
cucumber-core (> 15, < 17)
|
|
39
|
+
cucumber-cucumber-expressions (> 17, < 20)
|
|
40
|
+
cucumber-html-formatter (> 21, < 23)
|
|
41
41
|
diff-lcs (~> 1.5)
|
|
42
|
+
logger (~> 1.6)
|
|
42
43
|
mini_mime (~> 1.1)
|
|
43
44
|
multi_test (~> 1.1)
|
|
44
|
-
sys-uname (~> 1.
|
|
45
|
-
cucumber-ci-environment (
|
|
46
|
-
cucumber-core (
|
|
47
|
-
cucumber-gherkin (
|
|
48
|
-
cucumber-messages (
|
|
49
|
-
cucumber-tag-expressions (>
|
|
50
|
-
cucumber-cucumber-expressions (
|
|
45
|
+
sys-uname (~> 1.3)
|
|
46
|
+
cucumber-ci-environment (11.0.0)
|
|
47
|
+
cucumber-core (16.1.1)
|
|
48
|
+
cucumber-gherkin (> 36, < 40)
|
|
49
|
+
cucumber-messages (> 31, < 33)
|
|
50
|
+
cucumber-tag-expressions (> 6, < 9)
|
|
51
|
+
cucumber-cucumber-expressions (18.0.1)
|
|
51
52
|
bigdecimal
|
|
52
|
-
cucumber-gherkin (
|
|
53
|
-
cucumber-messages (>=
|
|
54
|
-
cucumber-html-formatter (
|
|
55
|
-
cucumber-messages (>
|
|
56
|
-
cucumber-messages (
|
|
57
|
-
cucumber-tag-expressions (
|
|
53
|
+
cucumber-gherkin (37.0.1)
|
|
54
|
+
cucumber-messages (>= 31, < 32)
|
|
55
|
+
cucumber-html-formatter (22.3.0)
|
|
56
|
+
cucumber-messages (> 23, < 33)
|
|
57
|
+
cucumber-messages (31.1.0)
|
|
58
|
+
cucumber-tag-expressions (8.1.0)
|
|
58
59
|
date (3.5.1)
|
|
59
60
|
diff-lcs (1.6.2)
|
|
60
61
|
docile (1.4.1)
|
|
@@ -71,7 +72,7 @@ GEM
|
|
|
71
72
|
logger (~> 1.0)
|
|
72
73
|
memoist3 (1.0.0)
|
|
73
74
|
mini_mime (1.1.5)
|
|
74
|
-
minitest (6.0.
|
|
75
|
+
minitest (6.0.1)
|
|
75
76
|
prism (~> 1.5)
|
|
76
77
|
minitest-reporters (1.7.1)
|
|
77
78
|
ansi
|
|
@@ -96,7 +97,7 @@ GEM
|
|
|
96
97
|
racc (1.8.1)
|
|
97
98
|
rainbow (3.1.1)
|
|
98
99
|
rake (13.3.1)
|
|
99
|
-
rdoc (7.0.
|
|
100
|
+
rdoc (7.0.3)
|
|
100
101
|
erb
|
|
101
102
|
psych (>= 4.0.0)
|
|
102
103
|
tsort
|
|
@@ -109,7 +110,7 @@ GEM
|
|
|
109
110
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
110
111
|
rspec-support (~> 3.13.0)
|
|
111
112
|
rspec-support (3.13.6)
|
|
112
|
-
rubocop (1.82.
|
|
113
|
+
rubocop (1.82.1)
|
|
113
114
|
json (~> 2.3)
|
|
114
115
|
language_server-protocol (~> 3.17.0.2)
|
|
115
116
|
lint_roller (~> 1.1.0)
|
|
@@ -167,7 +168,7 @@ PLATFORMS
|
|
|
167
168
|
|
|
168
169
|
DEPENDENCIES
|
|
169
170
|
aruba (~> 2.2)
|
|
170
|
-
cucumber (~>
|
|
171
|
+
cucumber (~> 10.0)
|
|
171
172
|
logger (~> 1.7)
|
|
172
173
|
minitest (~> 6.0)
|
|
173
174
|
minitest-reporters (~> 1.7)
|
data/README.md
CHANGED
|
@@ -38,30 +38,30 @@ gem install sibit
|
|
|
38
38
|
Then, you generate a [private key]:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
sibit generate
|
|
42
|
-
|
|
41
|
+
$ sibit generate
|
|
42
|
+
1461cc61c3b09d01d5c02b901577c9d052264e77043bddd3d222ab8a6f7e0db0
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Next, you create a new [address],
|
|
46
46
|
using your private key:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
sibit create
|
|
50
|
-
|
|
49
|
+
$ sibit create 1461cc61c3b09d01d5c02b901577c9d052264e77043bddd3d222ab8a6f7e0db0
|
|
50
|
+
1PfsYNygsuVL8fvBarJNQnHytkg4rGih1U
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
To check the balance at the address (the result is in
|
|
54
54
|
[satoshi]):
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
sibit balance
|
|
57
|
+
$ sibit balance 1PfsYNygsuVL8fvBarJNQnHytkg4rGih1U
|
|
58
58
|
80988977
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
To send a payment from a few addresses to a new address:
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
|
-
sibit pay AMOUNT FEE A1:P1,A2:P2,... TARGET CHANGE
|
|
64
|
+
$ sibit pay AMOUNT FEE A1:P1,A2:P2,... TARGET CHANGE
|
|
65
65
|
e87f138c9ebf5986151667719825c28458a28cc66f69fed4f1032a93b399fdf8
|
|
66
66
|
```
|
|
67
67
|
|
|
@@ -123,7 +123,6 @@ work with the following APIs:
|
|
|
123
123
|
* [Bitcoinchain.com] - `Sibit::Bitcoinchain`
|
|
124
124
|
* [Blockchair.com] - `Sibit::Blockchair`
|
|
125
125
|
* [Cex.io] - `Sibit::Cex`
|
|
126
|
-
* [Earn.com] - `Sibit::Earn`
|
|
127
126
|
|
|
128
127
|
The first one in this list is used by default. If you want to use a different
|
|
129
128
|
one, you just specify it in the constructor of `Sibit` object:
|
|
@@ -168,14 +167,15 @@ gem install rake --no-document
|
|
|
168
167
|
gem install sibit
|
|
169
168
|
```
|
|
170
169
|
|
|
171
|
-
It should work.
|
|
170
|
+
It should work.
|
|
171
|
+
If it doesn't, submit an issue and I will try to help.
|
|
172
172
|
|
|
173
173
|
## How to contribute
|
|
174
174
|
|
|
175
175
|
Read [these guidelines].
|
|
176
176
|
Make sure your build is green before you contribute
|
|
177
|
-
your pull request. You will need to have [Ruby] 2.3+ and
|
|
178
|
-
|
|
177
|
+
your pull request. You will need to have [Ruby] 2.3+ and [Bundler] installed.
|
|
178
|
+
Then:
|
|
179
179
|
|
|
180
180
|
```bash
|
|
181
181
|
bundle update
|
|
@@ -196,7 +196,6 @@ If it's clean and you don't see any error messages, submit your pull request.
|
|
|
196
196
|
[Bundler]: https://bundler.io/
|
|
197
197
|
[Cex.io]: https://cex.io/rest-api
|
|
198
198
|
[Cryptoapis.io]: https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index
|
|
199
|
-
[Earn.com]: https://bitcoinfees.earn.com/api
|
|
200
199
|
[Electrum]: https://electrum.org/
|
|
201
200
|
[miner fee]: https://en.bitcoin.it/wiki/Miner_fees
|
|
202
201
|
[private key]: https://en.bitcoin.it/wiki/Private_key
|
data/bin/sibit
CHANGED
|
@@ -9,7 +9,6 @@ $stdout.sync = true
|
|
|
9
9
|
# see https://stackoverflow.com/a/6048451/187141
|
|
10
10
|
require 'openssl'
|
|
11
11
|
OpenSSL::SSL::VERIFY_PEER ||= OpenSSL::SSL::VERIFY_NONE
|
|
12
|
-
puts OpenSSL::X509::DEFAULT_CERT_FILE
|
|
13
12
|
|
|
14
13
|
require 'backtrace'
|
|
15
14
|
require 'loog'
|
|
@@ -21,7 +20,6 @@ require_relative '../lib/sibit/blockchain'
|
|
|
21
20
|
require_relative '../lib/sibit/blockchair'
|
|
22
21
|
require_relative '../lib/sibit/btc'
|
|
23
22
|
require_relative '../lib/sibit/cex'
|
|
24
|
-
require_relative '../lib/sibit/earn'
|
|
25
23
|
require_relative '../lib/sibit/fake'
|
|
26
24
|
require_relative '../lib/sibit/firstof'
|
|
27
25
|
require_relative '../lib/sibit/version'
|
|
@@ -53,8 +51,8 @@ Options are:"
|
|
|
53
51
|
o.bool '--verbose', 'Print all possible debug messages'
|
|
54
52
|
o.array(
|
|
55
53
|
'--api',
|
|
56
|
-
'Ordered List of APIs to use, e.g. "
|
|
57
|
-
default: %w[
|
|
54
|
+
'Ordered List of APIs to use, e.g. "eblockchain,btc,bitcoinchain"',
|
|
55
|
+
default: %w[blockchain btc bitcoinchain blockchair cex]
|
|
58
56
|
)
|
|
59
57
|
o.array(
|
|
60
58
|
'--skip-utxo',
|
|
@@ -83,8 +81,6 @@ Options are:"
|
|
|
83
81
|
api = Sibit::Cex.new(http: http, log: log, dry: opts[:dry])
|
|
84
82
|
when 'fake'
|
|
85
83
|
api = Sibit::Fake.new
|
|
86
|
-
when 'earn'
|
|
87
|
-
api = Sibit::Earn.new(http: http, log: log, dry: opts[:dry])
|
|
88
84
|
else
|
|
89
85
|
raise Sibit::Error, "Unknown API \"#{a}\""
|
|
90
86
|
end
|
data/lib/sibit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sibit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.27.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
@@ -144,7 +144,6 @@ files:
|
|
|
144
144
|
- lib/sibit/btc.rb
|
|
145
145
|
- lib/sibit/cex.rb
|
|
146
146
|
- lib/sibit/cryptoapis.rb
|
|
147
|
-
- lib/sibit/earn.rb
|
|
148
147
|
- lib/sibit/error.rb
|
|
149
148
|
- lib/sibit/fake.rb
|
|
150
149
|
- lib/sibit/firstof.rb
|
data/lib/sibit/earn.rb
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require 'iri'
|
|
7
|
-
require 'json'
|
|
8
|
-
require 'loog'
|
|
9
|
-
require 'uri'
|
|
10
|
-
require_relative 'error'
|
|
11
|
-
require_relative 'http'
|
|
12
|
-
require_relative 'json'
|
|
13
|
-
require_relative 'version'
|
|
14
|
-
|
|
15
|
-
# Earn.com API.
|
|
16
|
-
#
|
|
17
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
18
|
-
# Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
|
|
19
|
-
# License:: MIT
|
|
20
|
-
class Sibit
|
|
21
|
-
# Blockchain.info API.
|
|
22
|
-
class Earn
|
|
23
|
-
# Constructor.
|
|
24
|
-
def initialize(log: Loog::NULL, http: Sibit::Http.new, dry: false)
|
|
25
|
-
@http = http
|
|
26
|
-
@log = log
|
|
27
|
-
@dry = dry
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# Current price of BTC in USD (float returned).
|
|
31
|
-
def price(_currency)
|
|
32
|
-
raise Sibit::NotSupportedError, 'price() doesn\'t work here'
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Gets the balance of the address, in satoshi.
|
|
36
|
-
def balance(_address)
|
|
37
|
-
raise Sibit::NotSupportedError, 'balance() doesn\'t work here'
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Get hash of the block after this one.
|
|
41
|
-
def next_of(_hash)
|
|
42
|
-
raise Sibit::NotSupportedError, 'Earn.com API doesn\'t provide next_of()'
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# The height of the block.
|
|
46
|
-
def height(_hash)
|
|
47
|
-
raise Sibit::NotSupportedError, 'Earn API doesn\'t provide height()'
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# Get recommended fees, in satoshi per byte. The method returns
|
|
51
|
-
# a hash: { S: 12, M: 45, L: 100, XL: 200 }
|
|
52
|
-
def fees
|
|
53
|
-
json = Sibit::Json.new(http: @http, log: @log).get(
|
|
54
|
-
Iri.new('https://bitcoinfees.earn.com/api/v1/fees/recommended')
|
|
55
|
-
)
|
|
56
|
-
@log.info("Current recommended Bitcoin fees: \
|
|
57
|
-
#{json['hourFee']}/#{json['halfHourFee']}/#{json['fastestFee']} sat/byte")
|
|
58
|
-
{
|
|
59
|
-
S: json['hourFee'] / 3,
|
|
60
|
-
M: json['hourFee'],
|
|
61
|
-
L: json['halfHourFee'],
|
|
62
|
-
XL: json['fastestFee']
|
|
63
|
-
}
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
# Fetch all unspent outputs per address.
|
|
67
|
-
def utxos(_sources)
|
|
68
|
-
raise Sibit::NotSupportedError, 'Not implemented yet'
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# Push this transaction (in hex format) to the network.
|
|
72
|
-
def push(_hex)
|
|
73
|
-
raise Sibit::NotSupportedError, 'Not implemented yet'
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Gets the hash of the latest block.
|
|
77
|
-
def latest
|
|
78
|
-
raise Sibit::NotSupportedError, 'latest() doesn\'t work here'
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
# This method should fetch a Blockchain block and return as a hash.
|
|
82
|
-
def block(_hash)
|
|
83
|
-
raise Sibit::NotSupportedError, 'block() doesn\'t work here'
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|