sibit 0.26.0 → 0.27.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/README.md +0 -2
- data/bin/sibit +2 -5
- 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: e8969169f4a0ed8a12f015d3e66cd7a4e74cf2e3e1210828370eab0dc2680b99
|
|
4
|
+
data.tar.gz: 296a09009b913387406c1f285916b6a33ef3fd1871c07951f703e1f187937f9a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de21c1b789b8bc2c4671e303aa8c613fb9d6b88b9a28ba7787d82212cbda08cad277c74d2c655c14dd21e3f462ad5b9a26275da3f45fc246fa8e837d177cf743
|
|
7
|
+
data.tar.gz: c737bc8c538266bb00c2be64c0604da1035065a6fe1a0fa094be0f6180c46ab5df9f3483d577511c45d43b215423fd0c04971e54bcfacb4f8a945c93182cace1
|
data/README.md
CHANGED
|
@@ -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:
|
|
@@ -196,7 +195,6 @@ If it's clean and you don't see any error messages, submit your pull request.
|
|
|
196
195
|
[Bundler]: https://bundler.io/
|
|
197
196
|
[Cex.io]: https://cex.io/rest-api
|
|
198
197
|
[Cryptoapis.io]: https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index
|
|
199
|
-
[Earn.com]: https://bitcoinfees.earn.com/api
|
|
200
198
|
[Electrum]: https://electrum.org/
|
|
201
199
|
[miner fee]: https://en.bitcoin.it/wiki/Miner_fees
|
|
202
200
|
[private key]: https://en.bitcoin.it/wiki/Private_key
|
data/bin/sibit
CHANGED
|
@@ -21,7 +21,6 @@ require_relative '../lib/sibit/blockchain'
|
|
|
21
21
|
require_relative '../lib/sibit/blockchair'
|
|
22
22
|
require_relative '../lib/sibit/btc'
|
|
23
23
|
require_relative '../lib/sibit/cex'
|
|
24
|
-
require_relative '../lib/sibit/earn'
|
|
25
24
|
require_relative '../lib/sibit/fake'
|
|
26
25
|
require_relative '../lib/sibit/firstof'
|
|
27
26
|
require_relative '../lib/sibit/version'
|
|
@@ -53,8 +52,8 @@ Options are:"
|
|
|
53
52
|
o.bool '--verbose', 'Print all possible debug messages'
|
|
54
53
|
o.array(
|
|
55
54
|
'--api',
|
|
56
|
-
'Ordered List of APIs to use, e.g. "
|
|
57
|
-
default: %w[
|
|
55
|
+
'Ordered List of APIs to use, e.g. "eblockchain,btc,bitcoinchain"',
|
|
56
|
+
default: %w[blockchain btc bitcoinchain blockchair cex]
|
|
58
57
|
)
|
|
59
58
|
o.array(
|
|
60
59
|
'--skip-utxo',
|
|
@@ -83,8 +82,6 @@ Options are:"
|
|
|
83
82
|
api = Sibit::Cex.new(http: http, log: log, dry: opts[:dry])
|
|
84
83
|
when 'fake'
|
|
85
84
|
api = Sibit::Fake.new
|
|
86
|
-
when 'earn'
|
|
87
|
-
api = Sibit::Earn.new(http: http, log: log, dry: opts[:dry])
|
|
88
85
|
else
|
|
89
86
|
raise Sibit::Error, "Unknown API \"#{a}\""
|
|
90
87
|
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.0
|
|
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
|