peatio-goldcash 2.6.6 → 2.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/Gemfile +2 -0
- data/Gemfile.lock +34 -2
- data/LICENSE.txt +12 -21
- data/README.md +7 -35
- data/Rakefile +3 -1
- data/bin/console +1 -0
- data/lib/peatio/goldcash.rb +2 -0
- data/lib/peatio/goldcash/blockchain.rb +23 -22
- data/lib/peatio/goldcash/client.rb +18 -14
- data/lib/peatio/goldcash/hooks.rb +7 -5
- data/lib/peatio/goldcash/railtie.rb +2 -0
- data/lib/peatio/goldcash/version.rb +3 -1
- data/lib/peatio/goldcash/wallet.rb +13 -13
- data/peatio-goldcash.gemspec +27 -11
- metadata +56 -17
- data/config/blockchains.yml +0 -10
- data/config/currencies.yml +0 -18
- data/config/wallets.yml +0 -44
- data/docs/integration.md +0 -29
- data/docs/json-rpc.md +0 -29
- data/docs/testnet.md +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9db4bc932d1550620cc776437a5f175a675a66be0fa34a1aaf6740b8676b22a6
|
4
|
+
data.tar.gz: 42f2bc359bf19000c843381c059e5f5c70b0072ffe426b07f6b03ebd2265ec8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8741622686943516252f10fcd6b11c49835865cc78f182b3fa80645b35fc9a39fbbe1b0b39c867bc7abb2292e0b3b700226a278cd03ff3eda7d66da1fa02a78f
|
7
|
+
data.tar.gz: eea49aef9ff7c1acd8c02d48365fa7e2ea455b9545d6314b7ededc31fe8a3a7a7fe85e05f3293ea7efe1f6be1ece75ed7cc406a9abbe58b7c0da04158473dc22
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
peatio-goldcash (2.6.
|
4
|
+
peatio-goldcash (2.6.7)
|
5
5
|
activesupport (~> 5.2.3)
|
6
6
|
better-faraday (~> 1.0.5)
|
7
7
|
faraday (~> 0.17)
|
@@ -25,6 +25,7 @@ GEM
|
|
25
25
|
amqp (1.8.0)
|
26
26
|
amq-protocol (>= 2.2.0)
|
27
27
|
eventmachine
|
28
|
+
ast (2.4.0)
|
28
29
|
better-faraday (1.0.8)
|
29
30
|
activesupport (>= 4.0, < 6.0)
|
30
31
|
faraday (~> 0.12)
|
@@ -40,6 +41,7 @@ GEM
|
|
40
41
|
safe_yaml (~> 1.0.0)
|
41
42
|
daemons (1.3.1)
|
42
43
|
diff-lcs (1.3)
|
44
|
+
docile (1.3.2)
|
43
45
|
em-http-request (1.1.6)
|
44
46
|
addressable (>= 2.3.4)
|
45
47
|
cookiejar (!= 0.3.1)
|
@@ -73,6 +75,10 @@ GEM
|
|
73
75
|
http_parser.rb (0.6.0)
|
74
76
|
i18n (1.8.3)
|
75
77
|
concurrent-ruby (~> 1.0)
|
78
|
+
io-console (0.5.6)
|
79
|
+
irb (1.2.3)
|
80
|
+
reline (>= 0.0.1)
|
81
|
+
jaro_winkler (1.5.4)
|
76
82
|
jwt (2.2.1)
|
77
83
|
memoist (0.16.2)
|
78
84
|
method_source (1.0.0)
|
@@ -83,6 +89,9 @@ GEM
|
|
83
89
|
mysql2 (0.5.3)
|
84
90
|
net-http-persistent (3.0.1)
|
85
91
|
connection_pool (~> 2.2)
|
92
|
+
parallel (1.19.1)
|
93
|
+
parser (2.7.0.5)
|
94
|
+
ast (~> 2.4.0)
|
86
95
|
peatio (2.6.1)
|
87
96
|
activemodel (> 5.2, <= 6.0.0)
|
88
97
|
amqp
|
@@ -106,7 +115,11 @@ GEM
|
|
106
115
|
pry (~> 0.13.0)
|
107
116
|
public_suffix (4.0.4)
|
108
117
|
rack (2.2.3)
|
118
|
+
rainbow (3.0.0)
|
109
119
|
rake (13.0.1)
|
120
|
+
reline (0.1.3)
|
121
|
+
io-console (~> 0.5)
|
122
|
+
rexml (3.2.4)
|
110
123
|
rspec (3.9.0)
|
111
124
|
rspec-core (~> 3.9.0)
|
112
125
|
rspec-expectations (~> 3.9.0)
|
@@ -120,7 +133,22 @@ GEM
|
|
120
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
121
134
|
rspec-support (~> 3.9.0)
|
122
135
|
rspec-support (3.9.2)
|
136
|
+
rubocop (0.80.1)
|
137
|
+
jaro_winkler (~> 1.5.1)
|
138
|
+
parallel (~> 1.10)
|
139
|
+
parser (>= 2.7.0.1)
|
140
|
+
rainbow (>= 2.2.2, < 4.0)
|
141
|
+
rexml
|
142
|
+
ruby-progressbar (~> 1.7)
|
143
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
144
|
+
rubocop-github (0.14.0)
|
145
|
+
rubocop (~> 0.59)
|
146
|
+
ruby-progressbar (1.10.1)
|
123
147
|
safe_yaml (1.0.5)
|
148
|
+
simplecov (0.18.5)
|
149
|
+
docile (~> 1.1)
|
150
|
+
simplecov-html (~> 0.11)
|
151
|
+
simplecov-html (0.12.2)
|
124
152
|
thin (1.7.2)
|
125
153
|
daemons (~> 1.0, >= 1.0.9)
|
126
154
|
eventmachine (~> 1.0, >= 1.0.4)
|
@@ -128,6 +156,7 @@ GEM
|
|
128
156
|
thread_safe (0.3.6)
|
129
157
|
tzinfo (1.2.7)
|
130
158
|
thread_safe (~> 0.1)
|
159
|
+
unicode-display_width (1.6.1)
|
131
160
|
webmock (3.8.3)
|
132
161
|
addressable (>= 2.3.6)
|
133
162
|
crack (>= 0.3.2)
|
@@ -140,12 +169,15 @@ PLATFORMS
|
|
140
169
|
ruby
|
141
170
|
|
142
171
|
DEPENDENCIES
|
143
|
-
bundler (~> 1.
|
172
|
+
bundler (~> 1.17)
|
173
|
+
irb
|
144
174
|
mocha (~> 1.8)
|
145
175
|
peatio-goldcash!
|
146
176
|
pry-byebug
|
147
177
|
rake (~> 13.0)
|
148
178
|
rspec (~> 3.0)
|
179
|
+
rubocop-github
|
180
|
+
simplecov
|
149
181
|
webmock (~> 3.5)
|
150
182
|
|
151
183
|
BUNDLED WITH
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
in
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
1
|
+
Copyright (C) Alcox.biz - All Rights Reserved
|
2
|
+
|
3
|
+
NOTICE: All information contained herein is, and remains
|
4
|
+
the property of Alcox.biz and its suppliers, if any.
|
5
|
+
The intellectual and technical concepts contained herein are proprietary to Alcox.biz
|
6
|
+
and its suppliers and may be covered by U.S. and Foreign Patents,
|
7
|
+
patents in process, and are protected by trade secret or copyright law.
|
8
|
+
Dissemination of this information or reproduction of this material
|
9
|
+
is strictly forbidden unless prior written permission is obtained
|
10
|
+
from Alcox.biz.
|
11
|
+
|
12
|
+
Proprietary and confidential
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Peatio::Goldcash
|
2
2
|
|
3
|
-
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/peatio/goldcash`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -20,38 +22,13 @@ Or install it yourself as:
|
|
20
22
|
|
21
23
|
## Usage
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
### Image Build.
|
26
|
-
|
27
|
-
1. Add peatio-goldcash gem into your Gemfile.plugin
|
28
|
-
```ruby
|
29
|
-
gem 'peatio-goldcash', '~> 0.2.0'
|
30
|
-
```
|
31
|
-
|
32
|
-
2. Run `bundle install` for updating Gemfile.lock
|
33
|
-
|
34
|
-
3. Build custom Peatio [docker image with Goldcash plugin](https://github.com/rubykube/peatio/blob/master/docs/plugins.md#build)
|
35
|
-
|
36
|
-
4. Push your image using `docker push`
|
37
|
-
|
38
|
-
5. Update your deployment to use image with peatio-goldcash gem
|
39
|
-
|
40
|
-
### Peatio Configuration.
|
41
|
-
|
42
|
-
1. Create Goldcash Blockchain [config example](../config/blockchains.yml).
|
43
|
-
* No additional steps are needed
|
44
|
-
|
45
|
-
2. Create Goldcash Currency [config example](../config/currencies.yml).
|
46
|
-
* No additional steps are needed
|
47
|
-
|
48
|
-
3. Create Goldcash Wallets [config example](../config/wallets.yml)(deposit and hot wallets are required).
|
49
|
-
* No additional steps are needed
|
50
|
-
|
25
|
+
TODO: Write usage instructions here
|
51
26
|
|
52
27
|
## Development
|
53
28
|
|
54
|
-
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
55
32
|
|
56
33
|
## Contributing
|
57
34
|
|
@@ -60,8 +37,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/alcoxb
|
|
60
37
|
## License
|
61
38
|
|
62
39
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
63
|
-
|
64
|
-
## Consulting
|
65
|
-
|
66
|
-
You can contact Openware for finding certified vendors:
|
67
|
-
[Openware.com](https://www.openware.com)
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/lib/peatio/goldcash.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Peatio
|
2
4
|
module Goldcash
|
3
5
|
# TODO: Processing of unconfirmed transactions from mempool isn't supported now.
|
4
6
|
class Blockchain < Peatio::Blockchain::Abstract
|
5
|
-
|
6
7
|
DEFAULT_FEATURES = {case_sensitive: true, cash_addr_format: false}.freeze
|
7
8
|
|
8
|
-
def initialize(custom_features
|
9
|
+
def initialize(custom_features={})
|
9
10
|
@features = DEFAULT_FEATURES.merge(custom_features).slice(*SUPPORTED_FEATURES)
|
10
11
|
@settings = {}
|
11
12
|
end
|
12
13
|
|
13
|
-
def configure(settings
|
14
|
+
def configure(settings={})
|
14
15
|
# Clean client state during configure.
|
15
16
|
@client = nil
|
16
17
|
@settings.merge!(settings.slice(*SUPPORTED_SETTINGS))
|
@@ -19,13 +20,15 @@ module Peatio
|
|
19
20
|
def fetch_block!(block_number)
|
20
21
|
block_hash = client.json_rpc(:getblockhash, [block_number])
|
21
22
|
|
22
|
-
client.json_rpc(:getblock, [block_hash])
|
23
|
-
|
23
|
+
block_txs = client.json_rpc(:getblock, [block_hash])
|
24
|
+
.fetch("tx").each_with_object([]) do |tx, txs_array|
|
24
25
|
txs = build_transaction(tx).map do |ntx|
|
25
26
|
Peatio::Transaction.new(ntx.merge(block_number: block_number))
|
26
27
|
end
|
27
28
|
txs_array.append(*txs)
|
28
|
-
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Peatio::Block.new(block_number, block_txs)
|
29
32
|
rescue Client::Error => e
|
30
33
|
raise Peatio::Blockchain::ClientError, e
|
31
34
|
end
|
@@ -38,12 +41,10 @@ module Peatio
|
|
38
41
|
|
39
42
|
def load_balance_of_address!(address, _currency_id)
|
40
43
|
address_with_balance = client.json_rpc(:listaddressgroupings)
|
41
|
-
|
42
|
-
|
44
|
+
.flatten(1)
|
45
|
+
.find {|addr| addr[0] == address }
|
43
46
|
|
44
|
-
if address_with_balance.blank?
|
45
|
-
raise Peatio::Blockchain::UnavailableAddressBalanceError, address
|
46
|
-
end
|
47
|
+
raise Peatio::Blockchain::UnavailableAddressBalanceError, address if address_with_balance.blank?
|
47
48
|
|
48
49
|
address_with_balance[1].to_d
|
49
50
|
rescue Client::Error => e
|
@@ -52,18 +53,18 @@ module Peatio
|
|
52
53
|
|
53
54
|
private
|
54
55
|
|
55
|
-
def
|
56
|
-
tx_hash.fetch(
|
57
|
-
.
|
58
|
-
entry.fetch('value').to_d > 0 &&
|
59
|
-
entry['scriptPubKey'].has_key?('addresses')
|
56
|
+
def filter_vout(tx_hash)
|
57
|
+
tx_hash.fetch("vout").select do |entry|
|
58
|
+
entry.fetch("value").to_d.positive? && entry["scriptPubKey"].has_key?("addresses")
|
60
59
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
end
|
61
|
+
|
62
|
+
def build_transaction(tx_hash)
|
63
|
+
filter_vout(tx_hash).each_with_object([]) do |entry, formatted_txs|
|
64
|
+
no_currency_tx = {hash: tx_hash["txid"], txout: entry["n"],
|
65
|
+
to_address: entry["scriptPubKey"]["addresses"][0],
|
66
|
+
amount: entry.fetch("value").to_d,
|
67
|
+
status: "success"}
|
67
68
|
|
68
69
|
# Build transaction for each currency belonging to blockchain.
|
69
70
|
settings_fetch(:currencies).pluck(:id).each do |currency_id|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "memoist"
|
4
|
+
require "faraday"
|
5
|
+
require "better-faraday"
|
6
6
|
|
7
7
|
module Peatio
|
8
8
|
module Goldcash
|
@@ -27,28 +27,32 @@ module Peatio
|
|
27
27
|
@json_rpc_endpoint = URI.parse(endpoint)
|
28
28
|
end
|
29
29
|
|
30
|
-
def json_rpc(method, params
|
31
|
-
response =
|
32
|
-
|
33
|
-
{ jsonrpc: '1.0', method: method, params: params }.to_json,
|
34
|
-
{ 'Accept' => 'application/json',
|
35
|
-
'Content-Type' => 'application/json' }
|
30
|
+
def json_rpc(method, params=[])
|
31
|
+
response = post(method, params)
|
32
|
+
|
36
33
|
response.assert_2xx!
|
37
34
|
response = JSON.parse(response.body)
|
38
|
-
|
39
|
-
|
35
|
+
|
36
|
+
response["error"].tap do |e|
|
37
|
+
raise ResponseError.new(e["code"], e["message"]) if e
|
40
38
|
end
|
41
|
-
|
39
|
+
|
40
|
+
response.fetch("result")
|
42
41
|
rescue Faraday::Error => e
|
43
42
|
raise ConnectionError, e
|
44
43
|
end
|
45
44
|
|
46
45
|
private
|
47
46
|
|
47
|
+
def post(method, params)
|
48
|
+
connection.post("/", {jsonrpc: "1.0", method: method, params: params}.to_json,
|
49
|
+
"Accept" => "application/json", "Content-Type" => "application/json")
|
50
|
+
end
|
51
|
+
|
48
52
|
def connection
|
49
53
|
@connection ||= Faraday.new(@json_rpc_endpoint) do |f|
|
50
|
-
|
51
|
-
|
54
|
+
f.adapter :net_http_persistent, pool_size: 5
|
55
|
+
end.tap do |connection|
|
52
56
|
unless @json_rpc_endpoint.user.blank?
|
53
57
|
connection.basic_auth(@json_rpc_endpoint.user,
|
54
58
|
@json_rpc_endpoint.password)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Peatio
|
2
4
|
module Goldcash
|
3
5
|
module Hooks
|
@@ -12,7 +14,7 @@ module Peatio
|
|
12
14
|
"Goldcash blockchain version requiremnt was not suttisfied by Peatio::Blockchain.",
|
13
15
|
"Goldcash blockchain requires #{BLOCKCHAIN_VERSION_REQUIREMENT}.",
|
14
16
|
"Peatio::Blockchain version is #{Peatio::Blockchain::VERSION}"
|
15
|
-
].join('\n').tap {
|
17
|
+
].join('\n').tap {|s| Kernel.abort s }
|
16
18
|
end
|
17
19
|
|
18
20
|
unless Gem::Requirement.new(WALLET_VERSION_REQUIREMENT)
|
@@ -21,18 +23,18 @@ module Peatio
|
|
21
23
|
"Goldcash wallet version requiremnt was not suttisfied by Peatio::Wallet.",
|
22
24
|
"Goldcash wallet requires #{WALLET_VERSION_REQUIREMENT}.",
|
23
25
|
"Peatio::Wallet version is #{Peatio::Wallet::VERSION}"
|
24
|
-
].join('\n').tap {
|
26
|
+
].join('\n').tap {|s| Kernel.abort s }
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
def register
|
29
|
-
Peatio::Blockchain.registry[:
|
30
|
-
Peatio::Wallet.registry[:
|
31
|
+
Peatio::Blockchain.registry[:goldcashcash] = Goldcash::Blockchain
|
32
|
+
Peatio::Wallet.registry[:goldcashcashd] = Goldcash::Wallet
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
36
|
if defined?(Rails::Railtie)
|
35
|
-
require "peatio/
|
37
|
+
require "peatio/goldcashcash/railtie"
|
36
38
|
else
|
37
39
|
check_compatibility
|
38
40
|
register
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Peatio
|
2
4
|
module Goldcash
|
3
5
|
class Wallet < Peatio::Wallet::Abstract
|
4
|
-
|
5
6
|
DEFAULT_FEATURES = { skip_deposit_collection: false }.freeze
|
6
7
|
|
7
8
|
def initialize(custom_features = {})
|
@@ -9,35 +10,35 @@ module Peatio
|
|
9
10
|
@settings = {}
|
10
11
|
end
|
11
12
|
|
12
|
-
def configure(settings
|
13
|
+
def configure(settings={})
|
13
14
|
# Clean client state during configure.
|
14
15
|
@client = nil
|
15
16
|
|
16
17
|
@settings.merge!(settings.slice(*SUPPORTED_SETTINGS))
|
17
18
|
|
18
|
-
@wallet = @settings.fetch(:wallet)
|
19
|
+
@wallet = @settings.fetch(:wallet) {
|
19
20
|
raise Peatio::Wallet::MissingSettingError, :wallet
|
20
|
-
|
21
|
+
}.slice(:uri, :address)
|
21
22
|
|
22
|
-
@currency = @settings.fetch(:currency)
|
23
|
+
@currency = @settings.fetch(:currency) {
|
23
24
|
raise Peatio::Wallet::MissingSettingError, :currency
|
24
|
-
|
25
|
+
}.slice(:id, :base_factor, :options)
|
25
26
|
end
|
26
27
|
|
27
|
-
def create_address!(_options
|
28
|
-
{
|
28
|
+
def create_address!(_options={})
|
29
|
+
{address: client.json_rpc(:getnewaddress)}
|
29
30
|
rescue Goldcash::Client::Error => e
|
30
31
|
raise Peatio::Wallet::ClientError, e
|
31
32
|
end
|
32
33
|
|
33
|
-
def create_transaction!(transaction, options
|
34
|
+
def create_transaction!(transaction, options={})
|
34
35
|
txid = client.json_rpc(:sendtoaddress,
|
35
36
|
[
|
36
37
|
transaction.to_address,
|
37
38
|
transaction.amount,
|
38
|
-
|
39
|
-
|
40
|
-
options[:subtract_fee].to_s ==
|
39
|
+
"",
|
40
|
+
"",
|
41
|
+
options[:subtract_fee].to_s == "true" # subtract fee from transaction amount.
|
41
42
|
])
|
42
43
|
transaction.hash = txid
|
43
44
|
transaction
|
@@ -47,7 +48,6 @@ module Peatio
|
|
47
48
|
|
48
49
|
def load_balance!
|
49
50
|
client.json_rpc(:getbalance).to_d
|
50
|
-
|
51
51
|
rescue Goldcash::Client::Error => e
|
52
52
|
raise Peatio::Wallet::ClientError, e
|
53
53
|
end
|
data/peatio-goldcash.gemspec
CHANGED
@@ -1,26 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
lib = File.expand_path("
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require "peatio/goldcash/version"
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = "peatio-goldcash"
|
8
9
|
spec.version = Peatio::Goldcash::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
10
|
+
spec.authors = ["D.H."]
|
11
|
+
spec.email = ["dh@alcox.biz"]
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage = "https://alcox.biz
|
15
|
-
spec.license = "
|
13
|
+
spec.summary = "Peatio Blockchain Plugin"
|
14
|
+
spec.description = "Peatio Blockchain Plugin for Rubykube"
|
15
|
+
spec.homepage = "https://www.alcox.biz"
|
16
|
+
spec.license = "Proprietary"
|
17
|
+
|
18
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
|
+
if spec.respond_to?(:metadata)
|
21
|
+
|
22
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
spec.metadata["source_code_uri"] = "https://github.com/alcoxbiz/peatio-goldcash"
|
24
|
+
spec.metadata["changelog_uri"] = "https://github.com/alcoxbiz/peatio-goldcash/blob/master/CHANGELOG.md"
|
25
|
+
else
|
26
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
27
|
+
"public gem pushes."
|
28
|
+
end
|
16
29
|
|
17
30
|
# Specify which files should be added to the gem when it is released.
|
18
31
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
-
spec.files
|
20
|
-
`git ls-files -z`.split("\x0").reject {
|
32
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
33
|
+
`git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
|
21
34
|
end
|
22
35
|
spec.bindir = "exe"
|
23
|
-
spec.executables = spec.files.grep(%r{^exe/}) {
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
24
37
|
spec.require_paths = ["lib"]
|
25
38
|
|
26
39
|
spec.add_dependency "activesupport", "~> 5.2.3"
|
@@ -30,10 +43,13 @@ Gem::Specification.new do |spec|
|
|
30
43
|
spec.add_dependency "peatio", ">= 0.6.3"
|
31
44
|
spec.add_dependency 'net-http-persistent', '~> 3.0.1'
|
32
45
|
|
33
|
-
spec.add_development_dependency "bundler", "~> 1.
|
46
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
47
|
+
spec.add_development_dependency "irb"
|
34
48
|
spec.add_development_dependency "mocha", "~> 1.8"
|
35
49
|
spec.add_development_dependency "pry-byebug"
|
36
50
|
spec.add_development_dependency "rake", "~> 13.0"
|
37
51
|
spec.add_development_dependency "rspec", "~> 3.0"
|
52
|
+
spec.add_development_dependency "rubocop-github"
|
53
|
+
spec.add_development_dependency "simplecov"
|
38
54
|
spec.add_development_dependency "webmock", "~> 3.5"
|
39
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peatio-goldcash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- D.H.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -100,14 +100,28 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.17'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
110
|
+
version: '1.17'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: irb
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: mocha
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +178,34 @@ dependencies:
|
|
164
178
|
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '3.0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rubocop-github
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: simplecov
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
167
209
|
- !ruby/object:Gem::Dependency
|
168
210
|
name: webmock
|
169
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,9 +220,9 @@ dependencies:
|
|
178
220
|
- - "~>"
|
179
221
|
- !ruby/object:Gem::Version
|
180
222
|
version: '3.5'
|
181
|
-
description:
|
223
|
+
description: Peatio Blockchain Plugin for Rubykube
|
182
224
|
email:
|
183
|
-
-
|
225
|
+
- dh@alcox.biz
|
184
226
|
executables: []
|
185
227
|
extensions: []
|
186
228
|
extra_rdoc_files: []
|
@@ -196,12 +238,6 @@ files:
|
|
196
238
|
- Rakefile
|
197
239
|
- bin/console
|
198
240
|
- bin/setup
|
199
|
-
- config/blockchains.yml
|
200
|
-
- config/currencies.yml
|
201
|
-
- config/wallets.yml
|
202
|
-
- docs/integration.md
|
203
|
-
- docs/json-rpc.md
|
204
|
-
- docs/testnet.md
|
205
241
|
- lib/peatio/goldcash.rb
|
206
242
|
- lib/peatio/goldcash/blockchain.rb
|
207
243
|
- lib/peatio/goldcash/client.rb
|
@@ -210,10 +246,13 @@ files:
|
|
210
246
|
- lib/peatio/goldcash/version.rb
|
211
247
|
- lib/peatio/goldcash/wallet.rb
|
212
248
|
- peatio-goldcash.gemspec
|
213
|
-
homepage: https://alcox.biz
|
249
|
+
homepage: https://www.alcox.biz
|
214
250
|
licenses:
|
215
|
-
-
|
216
|
-
metadata:
|
251
|
+
- Proprietary
|
252
|
+
metadata:
|
253
|
+
homepage_uri: https://www.alcox.biz
|
254
|
+
source_code_uri: https://github.com/alcoxbiz/peatio-goldcash
|
255
|
+
changelog_uri: https://github.com/alcoxbiz/peatio-goldcash/blob/master/CHANGELOG.md
|
217
256
|
post_install_message:
|
218
257
|
rdoc_options: []
|
219
258
|
require_paths:
|
@@ -232,5 +271,5 @@ requirements: []
|
|
232
271
|
rubygems_version: 3.0.6
|
233
272
|
signing_key:
|
234
273
|
specification_version: 4
|
235
|
-
summary:
|
274
|
+
summary: Peatio Blockchain Plugin
|
236
275
|
test_files: []
|
data/config/blockchains.yml
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
- key: gold-mainnet
|
2
|
-
name: Goldcash Mainnet
|
3
|
-
client: goldcash # API client name.
|
4
|
-
server: http://user:password@127.0.0.1:8345 # Public Goldcash node endpoint.
|
5
|
-
height: 10000 # Initial block number from which sync will be started.
|
6
|
-
min_confirmations: 6 # Minimal confirmations needed for withdraw and deposit confirmation.
|
7
|
-
explorer:
|
8
|
-
address: http://goldcashblockexplorer.co.uk/address/#{address}
|
9
|
-
transaction: http://goldcashblockexplorer.co.uk/tx/#{txid}
|
10
|
-
status: active
|
data/config/currencies.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
- id: gold
|
2
|
-
name: Goldcash
|
3
|
-
blockchain_key: gold-mainnet
|
4
|
-
symbol: 'G'
|
5
|
-
type: coin
|
6
|
-
precision: 8
|
7
|
-
base_factor: 100_000_000
|
8
|
-
enabled: true
|
9
|
-
# Deposits with less amount are skipped during blockchain synchronization.
|
10
|
-
# We advise to set value 10 times bigger than the network fee to prevent losses.
|
11
|
-
min_deposit_amount: 0.0004488
|
12
|
-
min_collection_amount: 0.0004488
|
13
|
-
withdraw_limit_24h: 100.0
|
14
|
-
withdraw_limit_72h: 300.0
|
15
|
-
deposit_fee: 0
|
16
|
-
withdraw_fee: 0
|
17
|
-
position: 6
|
18
|
-
options: {}
|
data/config/wallets.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
- name: Goldcash Deposit Wallet
|
2
|
-
blockchain_key: gold-mainnet
|
3
|
-
currency_id: gold
|
4
|
-
# Address where deposits will be collected to.
|
5
|
-
address: 'GNVfBQ8nnuktSYspWzY3H5SbFhizSzi28F' # IMPORTANT: Always wrap this value in quotes!
|
6
|
-
kind: deposit # Wallet kind (deposit, hot, warm, cold or fee).
|
7
|
-
nsig: 1 # Number of signatures required for performing withdraw.
|
8
|
-
max_balance: 0.0
|
9
|
-
status: active
|
10
|
-
gateway: goldcashd # Gateway client name.
|
11
|
-
settings:
|
12
|
-
#
|
13
|
-
# Goldcashd gateway client settings.
|
14
|
-
uri: http://user:password@127.0.0.1:8345
|
15
|
-
|
16
|
-
- name: Goldcash Hot Wallet
|
17
|
-
blockchain_key: gold-mainnet
|
18
|
-
currency_id: gold
|
19
|
-
# Address where deposits will be collected to.
|
20
|
-
address: 'GNVfBQ8nnuktSYspWzY3H5SbFhizSzi28F' # IMPORTANT: Always wrap this value in quotes!
|
21
|
-
kind: hot # Wallet kind (deposit, hot, warm, cold or fee).
|
22
|
-
nsig: 1 # Number of signatures required for performing withdraw.
|
23
|
-
max_balance: 100.0
|
24
|
-
status: active
|
25
|
-
gateway: goldcashd # Gateway client name.
|
26
|
-
settings:
|
27
|
-
#
|
28
|
-
# Goldcashd gateway client settings.
|
29
|
-
uri: http://user:password@127.0.0.1:8345
|
30
|
-
|
31
|
-
- name: Goldcash Warm Wallet
|
32
|
-
blockchain_key: gold-mainnet
|
33
|
-
currency_id: gold
|
34
|
-
# Address where deposits will be collected to.
|
35
|
-
address: 'GNVfBQ8nnuktSYspWzY3H5SbFhizSzi28F' # IMPORTANT: Always wrap this value in quotes!
|
36
|
-
kind: warm # Wallet kind (deposit, hot, warm, cold or fee).
|
37
|
-
nsig: 1 # Number of signatures required for performing withdraw.
|
38
|
-
max_balance: 500.0
|
39
|
-
status: active
|
40
|
-
gateway: goldcashd # Gateway client name.
|
41
|
-
settings:
|
42
|
-
#
|
43
|
-
# Goldcashd gateway client settings.
|
44
|
-
uri: http://user:password@127.0.0.1:8345
|
data/docs/integration.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# Integration.
|
2
|
-
|
3
|
-
For Peatio Goldcash plugin integration you need to do the following steps:
|
4
|
-
|
5
|
-
## Image Build.
|
6
|
-
|
7
|
-
1. Add peatio-litecoin gem into your Gemfile.plugin
|
8
|
-
```ruby
|
9
|
-
gem 'peatio-goldcash', '~> 0.2.0'
|
10
|
-
```
|
11
|
-
|
12
|
-
2. Run `bundle install` for updating Gemfile.lock
|
13
|
-
|
14
|
-
3. Build custom Peatio [docker image with Goldcash plugin](https://github.com/rubykube/peatio/blob/master/docs/plugins.md#build)
|
15
|
-
|
16
|
-
4. Push your image using `docker push`
|
17
|
-
|
18
|
-
5. Update your deployment to use image with peatio-goldcash gem
|
19
|
-
|
20
|
-
## Peatio Configuration.
|
21
|
-
|
22
|
-
1. Create Goldcash Blockchain [config example](../config/blockchains.yml).
|
23
|
-
* No additional steps are needed
|
24
|
-
|
25
|
-
2. Create Goldcash Currency [config example](../config/currencies.yml).
|
26
|
-
* No additional steps are needed
|
27
|
-
|
28
|
-
3. Create Goldcash Wallets [config example](../config/wallets.yml)(deposit and hot wallets are required).
|
29
|
-
* No additional steps are needed
|
data/docs/json-rpc.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# JSON RPC
|
2
|
-
|
3
|
-
The next list of JSON RPC calls where used for plugin development.
|
4
|
-
For response examples see spec/resources:
|
5
|
-
|
6
|
-
* getbalance
|
7
|
-
|
8
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbalance", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8345`
|
9
|
-
* getblock
|
10
|
-
|
11
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["754d4a0d346a84d710985935f9d403e346e6d889cf89fe45b37168791ad0d9c6"] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8345`
|
12
|
-
* getblockcount
|
13
|
-
|
14
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8345`
|
15
|
-
* getblockhash
|
16
|
-
|
17
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockhash", "params": [11576] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8345 `
|
18
|
-
* getnewaddress
|
19
|
-
|
20
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8345 `
|
21
|
-
* listaddressgroupings
|
22
|
-
|
23
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listaddressgroupings", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8345`
|
24
|
-
* sendtoaddress
|
25
|
-
|
26
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendtoaddress", "params": ["GTeo8ZGtKfn1Q2qSB5mpcJZPBaHTAifanw", 0.5] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8345`
|
27
|
-
* methodnotfound
|
28
|
-
|
29
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "methodnotfound", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8345`
|