peatio-nexbit 0.1.4 → 2.2.2
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/.gitignore +0 -1
- data/.travis.yml +2 -4
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -3
- data/LICENSE.txt +1 -1
- data/README.md +12 -29
- data/lib/peatio/nexbit.rb +2 -0
- data/lib/peatio/nexbit/version.rb +1 -1
- data/peatio-nexbit.gemspec +16 -16
- metadata +52 -35
- data/Gemfile.lock +0 -112
- 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/lib/peatio/nexbit/blockchain.rb +0 -82
- data/lib/peatio/nexbit/client.rb +0 -48
- data/lib/peatio/nexbit/hooks.rb +0 -42
- data/lib/peatio/nexbit/railtie.rb +0 -13
- data/lib/peatio/nexbit/wallet.rb +0 -58
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9d52c1c5ee7f51697116255a1569fbd5184126a1b7e303b64f618afd42e08dc
|
|
4
|
+
data.tar.gz: 5713a03e5e5d03a3677060b110c60803e37240d24fd17f09e6fedaa4388aeeef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7ee22caeedb36ea9585d8895757debbf5044515eff04c3db6ca9e0e8283fd5f9b3c55c53489ff11515bf73e29277b4eaf3fa05224117fe21a6dfd0a1e92890b1
|
|
7
|
+
data.tar.gz: 9ac23f93cbff833a97370925d68783b2ded0ba30e379c94c0146b43a226a1027f367a39d5e3aeece4e5f40654e3e3a50f7960add64bf9010a86474799c15e526
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at tanvirtex@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: https://contributor-covenant.org
|
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
# Specify your gem's dependencies in peatio-cpuchain.gemspec
|
|
3
|
+
# Specify your gem's dependencies in peatio-nexbit.gemspec
|
|
6
4
|
gemspec
|
|
5
|
+
|
|
6
|
+
gem "rake", "~> 12.0"
|
|
7
|
+
gem "rspec", "~> 3.0"
|
data/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2020 Md Tanvir Rahaman
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Peatio::Nexbit
|
|
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/nexbit`. 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
|
|
|
@@ -12,7 +14,7 @@ gem 'peatio-nexbit'
|
|
|
12
14
|
|
|
13
15
|
And then execute:
|
|
14
16
|
|
|
15
|
-
$ bundle
|
|
17
|
+
$ bundle install
|
|
16
18
|
|
|
17
19
|
Or install it yourself as:
|
|
18
20
|
|
|
@@ -20,42 +22,23 @@ Or install it yourself as:
|
|
|
20
22
|
|
|
21
23
|
## Usage
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Image Build.
|
|
26
|
-
|
|
27
|
-
1. Add peatio-nexbit gem into your Gemfile.plugin
|
|
28
|
-
```ruby
|
|
29
|
-
gem 'peatio-nexbit', '~> 0.1.0'
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
2. Run `bundle install` for updating Gemfile.lock
|
|
33
|
-
|
|
34
|
-
3. Build custom Peatio
|
|
35
|
-
|
|
36
|
-
4. Push your image using `docker push`
|
|
37
|
-
|
|
38
|
-
5. Update your deployment to use image with peatio-nexbit gem
|
|
39
|
-
|
|
40
|
-
### Peatio Configuration.
|
|
25
|
+
TODO: Write usage instructions here
|
|
41
26
|
|
|
42
|
-
|
|
43
|
-
* No additional steps are needed
|
|
27
|
+
## Development
|
|
44
28
|
|
|
45
|
-
|
|
46
|
-
* No additional steps are needed
|
|
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.
|
|
47
30
|
|
|
48
|
-
|
|
49
|
-
* No additional steps are needed
|
|
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).
|
|
50
32
|
|
|
33
|
+
## Contributing
|
|
51
34
|
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/peatio-nexbit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/peatio-nexbit/blob/master/CODE_OF_CONDUCT.md).
|
|
52
36
|
|
|
53
37
|
|
|
54
38
|
## License
|
|
55
39
|
|
|
56
40
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
57
41
|
|
|
58
|
-
##
|
|
42
|
+
## Code of Conduct
|
|
59
43
|
|
|
60
|
-
|
|
61
|
-
[platform.nexbit.io](https://platform.nexbit.io)
|
|
44
|
+
Everyone interacting in the Peatio::Nexbit project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/peatio-nexbit/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/peatio/nexbit.rb
CHANGED
data/peatio-nexbit.gemspec
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
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/nexbit/version"
|
|
5
6
|
|
|
6
7
|
Gem::Specification.new do |spec|
|
|
7
8
|
spec.name = "peatio-nexbit"
|
|
8
9
|
spec.version = Peatio::Nexbit::VERSION
|
|
9
|
-
spec.authors = ["
|
|
10
|
-
spec.email = ["
|
|
10
|
+
spec.authors = ["Md Tanvir Rahaman"]
|
|
11
|
+
spec.email = ["tanvirtex@gmail.com"]
|
|
11
12
|
|
|
12
13
|
spec.summary = %q{Gem for extending Peatio plugable system with Nexbit implementation.}
|
|
13
|
-
spec.description = %q{
|
|
14
|
+
spec.description = %q{Peatio-nexbit gem make nexbit easy to integrate in peatio platform}
|
|
14
15
|
spec.homepage = "https://nexbit.io/"
|
|
15
16
|
spec.license = "MIT"
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
19
|
-
if spec.respond_to?(:metadata)
|
|
20
|
-
|
|
18
|
+
if spec.respond_to?(:metadata)
|
|
21
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
22
20
|
spec.metadata["source_code_uri"] = "https://github.com/ndexnetwork/peatio-ndex"
|
|
23
21
|
spec.metadata["changelog_uri"] = "https://github.com/ndexnetwork/peatio-ndex/blob/master/CHANGELOG.md"
|
|
@@ -25,27 +23,29 @@ Gem::Specification.new do |spec|
|
|
|
25
23
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
26
24
|
"public gem pushes."
|
|
27
25
|
end
|
|
26
|
+
|
|
28
27
|
# Specify which files should be added to the gem when it is released.
|
|
29
28
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
30
|
-
spec.files
|
|
31
|
-
`git ls-files -z`.split("\x0").reject {
|
|
29
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
30
|
+
`git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
|
|
32
31
|
end
|
|
33
32
|
spec.bindir = "exe"
|
|
34
|
-
spec.executables = spec.files.grep(%r{^exe/}) {
|
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
|
35
34
|
spec.require_paths = ["lib"]
|
|
36
35
|
|
|
37
36
|
spec.add_dependency "activesupport", "~> 5.2.3"
|
|
38
37
|
spec.add_dependency "better-faraday", "~> 1.0.5"
|
|
39
38
|
spec.add_dependency "faraday", "~> 0.15.4"
|
|
40
39
|
spec.add_dependency "memoist", "~> 0.16.0"
|
|
41
|
-
spec.add_dependency "peatio", "~> 0.6.
|
|
42
|
-
|
|
40
|
+
spec.add_dependency "peatio", "~> 0.6.1"
|
|
41
|
+
spec.add_dependency 'net-http-persistent', '~> 3.0.1'
|
|
43
42
|
|
|
44
|
-
spec.add_development_dependency "bundler", "~> 1.
|
|
43
|
+
spec.add_development_dependency "bundler", "~> 2.1.4"
|
|
44
|
+
spec.add_development_dependency "irb"
|
|
45
45
|
spec.add_development_dependency "mocha", "~> 1.8"
|
|
46
46
|
spec.add_development_dependency "pry-byebug"
|
|
47
|
-
spec.add_development_dependency "net-http-persistent", "~> 3.0.1"
|
|
48
47
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
49
|
-
spec.add_development_dependency "
|
|
48
|
+
spec.add_development_dependency "rubocop-github"
|
|
49
|
+
spec.add_development_dependency "simplecov"
|
|
50
50
|
spec.add_development_dependency "webmock", "~> 3.5"
|
|
51
51
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: peatio-nexbit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Md Tanvir Rahaman
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-06-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -72,28 +72,56 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.6.
|
|
75
|
+
version: 0.6.1
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.6.
|
|
82
|
+
version: 0.6.1
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: net-http-persistent
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 3.0.1
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 3.0.1
|
|
83
97
|
- !ruby/object:Gem::Dependency
|
|
84
98
|
name: bundler
|
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
|
86
100
|
requirements:
|
|
87
101
|
- - "~>"
|
|
88
102
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
103
|
+
version: 2.1.4
|
|
90
104
|
type: :development
|
|
91
105
|
prerelease: false
|
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
107
|
requirements:
|
|
94
108
|
- - "~>"
|
|
95
109
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
110
|
+
version: 2.1.4
|
|
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'
|
|
97
125
|
- !ruby/object:Gem::Dependency
|
|
98
126
|
name: mocha
|
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -123,47 +151,47 @@ dependencies:
|
|
|
123
151
|
- !ruby/object:Gem::Version
|
|
124
152
|
version: '0'
|
|
125
153
|
- !ruby/object:Gem::Dependency
|
|
126
|
-
name:
|
|
154
|
+
name: rake
|
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
|
128
156
|
requirements:
|
|
129
157
|
- - "~>"
|
|
130
158
|
- !ruby/object:Gem::Version
|
|
131
|
-
version:
|
|
159
|
+
version: '10.0'
|
|
132
160
|
type: :development
|
|
133
161
|
prerelease: false
|
|
134
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
163
|
requirements:
|
|
136
164
|
- - "~>"
|
|
137
165
|
- !ruby/object:Gem::Version
|
|
138
|
-
version:
|
|
166
|
+
version: '10.0'
|
|
139
167
|
- !ruby/object:Gem::Dependency
|
|
140
|
-
name:
|
|
168
|
+
name: rubocop-github
|
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
|
142
170
|
requirements:
|
|
143
|
-
- - "
|
|
171
|
+
- - ">="
|
|
144
172
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: '
|
|
173
|
+
version: '0'
|
|
146
174
|
type: :development
|
|
147
175
|
prerelease: false
|
|
148
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
177
|
requirements:
|
|
150
|
-
- - "
|
|
178
|
+
- - ">="
|
|
151
179
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: '
|
|
180
|
+
version: '0'
|
|
153
181
|
- !ruby/object:Gem::Dependency
|
|
154
|
-
name:
|
|
182
|
+
name: simplecov
|
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
|
156
184
|
requirements:
|
|
157
|
-
- - "
|
|
185
|
+
- - ">="
|
|
158
186
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: '
|
|
187
|
+
version: '0'
|
|
160
188
|
type: :development
|
|
161
189
|
prerelease: false
|
|
162
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
191
|
requirements:
|
|
164
|
-
- - "
|
|
192
|
+
- - ">="
|
|
165
193
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: '
|
|
194
|
+
version: '0'
|
|
167
195
|
- !ruby/object:Gem::Dependency
|
|
168
196
|
name: webmock
|
|
169
197
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -178,10 +206,9 @@ dependencies:
|
|
|
178
206
|
- - "~>"
|
|
179
207
|
- !ruby/object:Gem::Version
|
|
180
208
|
version: '3.5'
|
|
181
|
-
description:
|
|
182
|
-
to make nexbit easy integration in peatio platform
|
|
209
|
+
description: Peatio-nexbit gem make nexbit easy to integrate in peatio platform
|
|
183
210
|
email:
|
|
184
|
-
-
|
|
211
|
+
- tanvirtex@gmail.com
|
|
185
212
|
executables: []
|
|
186
213
|
extensions: []
|
|
187
214
|
extra_rdoc_files: []
|
|
@@ -189,25 +216,15 @@ files:
|
|
|
189
216
|
- ".gitignore"
|
|
190
217
|
- ".rspec"
|
|
191
218
|
- ".travis.yml"
|
|
219
|
+
- CODE_OF_CONDUCT.md
|
|
192
220
|
- Gemfile
|
|
193
|
-
- Gemfile.lock
|
|
194
221
|
- LICENSE.txt
|
|
195
222
|
- README.md
|
|
196
223
|
- Rakefile
|
|
197
224
|
- bin/console
|
|
198
225
|
- bin/setup
|
|
199
|
-
- config/blockchains.yml
|
|
200
|
-
- config/currencies.yml
|
|
201
|
-
- config/wallets.yml
|
|
202
|
-
- docs/integration.md
|
|
203
|
-
- docs/json-rpc.md
|
|
204
226
|
- lib/peatio/nexbit.rb
|
|
205
|
-
- lib/peatio/nexbit/blockchain.rb
|
|
206
|
-
- lib/peatio/nexbit/client.rb
|
|
207
|
-
- lib/peatio/nexbit/hooks.rb
|
|
208
|
-
- lib/peatio/nexbit/railtie.rb
|
|
209
227
|
- lib/peatio/nexbit/version.rb
|
|
210
|
-
- lib/peatio/nexbit/wallet.rb
|
|
211
228
|
- peatio-nexbit.gemspec
|
|
212
229
|
homepage: https://nexbit.io/
|
|
213
230
|
licenses:
|
|
@@ -231,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
231
248
|
- !ruby/object:Gem::Version
|
|
232
249
|
version: '0'
|
|
233
250
|
requirements: []
|
|
234
|
-
rubygems_version: 3.
|
|
251
|
+
rubygems_version: 3.1.3
|
|
235
252
|
signing_key:
|
|
236
253
|
specification_version: 4
|
|
237
254
|
summary: Gem for extending Peatio plugable system with Nexbit implementation.
|
data/Gemfile.lock
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
peatio-nexbit (0.1.4)
|
|
5
|
-
activesupport (~> 5.2.3)
|
|
6
|
-
better-faraday (~> 1.0.5)
|
|
7
|
-
faraday (~> 0.15.4)
|
|
8
|
-
memoist (~> 0.16.0)
|
|
9
|
-
peatio (~> 0.6.3)
|
|
10
|
-
|
|
11
|
-
GEM
|
|
12
|
-
remote: https://rubygems.org/
|
|
13
|
-
specs:
|
|
14
|
-
activemodel (5.2.4.2)
|
|
15
|
-
activesupport (= 5.2.4.2)
|
|
16
|
-
activesupport (5.2.4.2)
|
|
17
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
18
|
-
i18n (>= 0.7, < 2)
|
|
19
|
-
minitest (~> 5.1)
|
|
20
|
-
tzinfo (~> 1.1)
|
|
21
|
-
addressable (2.7.0)
|
|
22
|
-
public_suffix (>= 2.0.2, < 5.0)
|
|
23
|
-
amq-protocol (2.3.0)
|
|
24
|
-
amqp (1.8.0)
|
|
25
|
-
amq-protocol (>= 2.2.0)
|
|
26
|
-
eventmachine
|
|
27
|
-
better-faraday (1.0.8)
|
|
28
|
-
activesupport (>= 4.0, < 6.0)
|
|
29
|
-
faraday (~> 0.12)
|
|
30
|
-
bunny (2.14.4)
|
|
31
|
-
amq-protocol (~> 2.3, >= 2.3.0)
|
|
32
|
-
byebug (11.1.1)
|
|
33
|
-
clamp (1.3.1)
|
|
34
|
-
coderay (1.1.2)
|
|
35
|
-
concurrent-ruby (1.1.6)
|
|
36
|
-
connection_pool (2.2.2)
|
|
37
|
-
crack (0.4.3)
|
|
38
|
-
safe_yaml (~> 1.0.0)
|
|
39
|
-
diff-lcs (1.3)
|
|
40
|
-
em-websocket (0.5.1)
|
|
41
|
-
eventmachine (>= 0.12.9)
|
|
42
|
-
http_parser.rb (~> 0.6.0)
|
|
43
|
-
eventmachine (1.2.7)
|
|
44
|
-
faraday (0.15.4)
|
|
45
|
-
multipart-post (>= 1.2, < 3)
|
|
46
|
-
hashdiff (1.0.1)
|
|
47
|
-
http_parser.rb (0.6.0)
|
|
48
|
-
i18n (1.8.2)
|
|
49
|
-
concurrent-ruby (~> 1.0)
|
|
50
|
-
jwt (2.2.1)
|
|
51
|
-
memoist (0.16.2)
|
|
52
|
-
method_source (1.0.0)
|
|
53
|
-
minitest (5.14.0)
|
|
54
|
-
mocha (1.11.2)
|
|
55
|
-
multipart-post (2.1.1)
|
|
56
|
-
mysql2 (0.5.3)
|
|
57
|
-
net-http-persistent (3.0.1)
|
|
58
|
-
connection_pool (~> 2.2)
|
|
59
|
-
peatio (0.6.3)
|
|
60
|
-
activemodel (> 5.2, <= 6.0.0)
|
|
61
|
-
amqp
|
|
62
|
-
bunny
|
|
63
|
-
clamp
|
|
64
|
-
em-websocket
|
|
65
|
-
eventmachine
|
|
66
|
-
jwt
|
|
67
|
-
mysql2
|
|
68
|
-
pry (0.13.0)
|
|
69
|
-
coderay (~> 1.1)
|
|
70
|
-
method_source (~> 1.0)
|
|
71
|
-
pry-byebug (3.9.0)
|
|
72
|
-
byebug (~> 11.0)
|
|
73
|
-
pry (~> 0.13.0)
|
|
74
|
-
public_suffix (4.0.3)
|
|
75
|
-
rake (10.5.0)
|
|
76
|
-
rspec (3.9.0)
|
|
77
|
-
rspec-core (~> 3.9.0)
|
|
78
|
-
rspec-expectations (~> 3.9.0)
|
|
79
|
-
rspec-mocks (~> 3.9.0)
|
|
80
|
-
rspec-core (3.9.1)
|
|
81
|
-
rspec-support (~> 3.9.1)
|
|
82
|
-
rspec-expectations (3.9.1)
|
|
83
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
84
|
-
rspec-support (~> 3.9.0)
|
|
85
|
-
rspec-mocks (3.9.1)
|
|
86
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
87
|
-
rspec-support (~> 3.9.0)
|
|
88
|
-
rspec-support (3.9.2)
|
|
89
|
-
safe_yaml (1.0.5)
|
|
90
|
-
thread_safe (0.3.6)
|
|
91
|
-
tzinfo (1.2.7)
|
|
92
|
-
thread_safe (~> 0.1)
|
|
93
|
-
webmock (3.8.3)
|
|
94
|
-
addressable (>= 2.3.6)
|
|
95
|
-
crack (>= 0.3.2)
|
|
96
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
|
97
|
-
|
|
98
|
-
PLATFORMS
|
|
99
|
-
ruby
|
|
100
|
-
|
|
101
|
-
DEPENDENCIES
|
|
102
|
-
bundler (~> 1.17)
|
|
103
|
-
mocha (~> 1.8)
|
|
104
|
-
net-http-persistent (~> 3.0.1)
|
|
105
|
-
peatio-nexbit!
|
|
106
|
-
pry-byebug
|
|
107
|
-
rake (~> 10.0)
|
|
108
|
-
rspec (~> 3.0)
|
|
109
|
-
webmock (~> 3.5)
|
|
110
|
-
|
|
111
|
-
BUNDLED WITH
|
|
112
|
-
1.17.2
|
data/config/blockchains.yml
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
- key: nbc-mainnet
|
|
2
|
-
name: Nexbit Mainnet
|
|
3
|
-
client: nexbitd # API client name.
|
|
4
|
-
server: http://user:password@127.0.0.1:13519 # Public Nexbit node endpoint.
|
|
5
|
-
height: 1200 # 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: https://explorer.nexbit.io/address/#{address}
|
|
9
|
-
transaction: https://explorer.nexbit.io/tx/#{txid}
|
|
10
|
-
status: active
|
data/config/currencies.yml
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
- id: nbc
|
|
2
|
-
name: Nexbit
|
|
3
|
-
blockchain_key: nbc-mainnet
|
|
4
|
-
symbol: 'N'
|
|
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.0003
|
|
12
|
-
min_collection_amount: 0.0003
|
|
13
|
-
withdraw_limit_24h: 0.5
|
|
14
|
-
withdraw_limit_72h: 1.2
|
|
15
|
-
deposit_fee: 0
|
|
16
|
-
withdraw_fee: 0
|
|
17
|
-
position: 5
|
|
18
|
-
options: {}
|
data/config/wallets.yml
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
- name: Nexbit Deposit Wallet
|
|
2
|
-
blockchain_key: nbc-mainnet
|
|
3
|
-
currency_id: nbc
|
|
4
|
-
# Address where deposits will be collected to.
|
|
5
|
-
address: 'NyWkTPkNRdpTDSfPw7gxUt9cEaC5PSsP3Y' # 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: nexbitd # Gateway client name.
|
|
11
|
-
settings:
|
|
12
|
-
#
|
|
13
|
-
# Nexbitd gateway client settings.
|
|
14
|
-
uri: http://user:password@127.0.0.1:13519
|
|
15
|
-
|
|
16
|
-
- name: Nexbit Hot Wallet
|
|
17
|
-
blockchain_key: nbc-mainnet
|
|
18
|
-
currency_id: nbc
|
|
19
|
-
# Address where deposits will be collected to.
|
|
20
|
-
address: 'NyWkTPkNRdpTDSfPw7gxUt9cEaC5PSsP3Y' # 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: 5.0
|
|
24
|
-
status: active
|
|
25
|
-
gateway: nexbitd # Gateway client name.
|
|
26
|
-
settings:
|
|
27
|
-
#
|
|
28
|
-
# Nexbitd gateway client settings.
|
|
29
|
-
uri: http://user:password@127.0.0.1:13519
|
|
30
|
-
|
|
31
|
-
- name: Nexbit Warm Wallet
|
|
32
|
-
blockchain_key: nbc-mainnet
|
|
33
|
-
currency_id: nbc
|
|
34
|
-
# Address where deposits will be collected to.
|
|
35
|
-
address: 'NyWkTPkNRdpTDSfPw7gxUt9cEaC5PSsP3Y' # 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: 50.0
|
|
39
|
-
status: active
|
|
40
|
-
gateway: nexbitd # Gateway client name.
|
|
41
|
-
settings:
|
|
42
|
-
#
|
|
43
|
-
# Nexbitd gateway client settings.
|
|
44
|
-
uri: http://user:password@127.0.0.1:13519
|
data/docs/integration.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Integration.
|
|
2
|
-
|
|
3
|
-
For Peatio Nexbit plugin integration you need to do the following steps:
|
|
4
|
-
|
|
5
|
-
## Image Build.
|
|
6
|
-
|
|
7
|
-
1. Add peatio-nexbit gem into your Gemfile.plugin
|
|
8
|
-
```ruby
|
|
9
|
-
gem 'peatio-nexbit', '~> 0.1.0'
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
2. Run `bundle install` for updating Gemfile.lock
|
|
13
|
-
|
|
14
|
-
3. Build custom Peatio
|
|
15
|
-
|
|
16
|
-
4. Push your image using `docker push`
|
|
17
|
-
|
|
18
|
-
5. Update your deployment to use image with peatio-nexbit gem
|
|
19
|
-
|
|
20
|
-
## Peatio Configuration.
|
|
21
|
-
|
|
22
|
-
1. Create CPUchain Blockchain [config example](../config/blockchains.yml).
|
|
23
|
-
* No additional steps are needed
|
|
24
|
-
|
|
25
|
-
2. Create CPUchain Currency [config example](../config/currencies.yml).
|
|
26
|
-
* No additional steps are needed
|
|
27
|
-
|
|
28
|
-
3. Create CPUchain 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:13519`
|
|
9
|
-
* getblock
|
|
10
|
-
|
|
11
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["5a471d4fd13d8bc3351e4d3a618fa55993326014b925346d8e9272e271e97c4e", 2] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:13519`
|
|
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:13519`
|
|
15
|
-
* getblockhash
|
|
16
|
-
|
|
17
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockhash", "params": [40500] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:13519 `
|
|
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:13519 `
|
|
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:13519`
|
|
24
|
-
* sendtoaddress
|
|
25
|
-
|
|
26
|
-
`curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendtoaddress", "params": ["NRnrwkUBQ2E4ZJ3bj8jvn4Nwx4nJ2U7wXF", 0.11] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:13519`
|
|
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:13519`
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
module Nexbit
|
|
2
|
-
# TODO: Processing of unconfirmed transactions from mempool isn't supported now.
|
|
3
|
-
class Blockchain < Peatio::Blockchain::Abstract
|
|
4
|
-
|
|
5
|
-
DEFAULT_FEATURES = {case_sensitive: true, cash_addr_format: false}.freeze
|
|
6
|
-
|
|
7
|
-
def initialize(custom_features = {})
|
|
8
|
-
@features = DEFAULT_FEATURES.merge(custom_features).slice(*SUPPORTED_FEATURES)
|
|
9
|
-
@settings = {}
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def configure(settings = {})
|
|
13
|
-
# Clean client state during configure.
|
|
14
|
-
@client = nil
|
|
15
|
-
@settings.merge!(settings.slice(*SUPPORTED_SETTINGS))
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def fetch_block!(block_number)
|
|
19
|
-
block_hash = client.json_rpc(:getblockhash, [block_number])
|
|
20
|
-
|
|
21
|
-
client.json_rpc(:getblock, [block_hash, 2])
|
|
22
|
-
.fetch('tx').each_with_object([]) do |tx, txs_array|
|
|
23
|
-
txs = build_transaction(tx).map do |ntx|
|
|
24
|
-
Peatio::Transaction.new(ntx.merge(block_number: block_number))
|
|
25
|
-
end
|
|
26
|
-
txs_array.append(*txs)
|
|
27
|
-
end.yield_self { |txs_array| Peatio::Block.new(block_number, txs_array) }
|
|
28
|
-
rescue Nexbit::Client::Error => e
|
|
29
|
-
raise Peatio::Blockchain::ClientError, e
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def latest_block_number
|
|
33
|
-
client.json_rpc(:getblockcount)
|
|
34
|
-
rescue Nexbit::Client::Error => e
|
|
35
|
-
raise Peatio::Blockchain::ClientError, e
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def load_balance_of_address!(address, _currency_id)
|
|
39
|
-
address_with_balance = client.json_rpc(:listaddressgroupings)
|
|
40
|
-
.flatten(1)
|
|
41
|
-
.find { |addr| addr[0] == address }
|
|
42
|
-
|
|
43
|
-
if address_with_balance.blank?
|
|
44
|
-
raise Peatio::Blockchain::UnavailableAddressBalanceError, address
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
address_with_balance[1].to_d
|
|
48
|
-
rescue Nexbit::Client::Error => e
|
|
49
|
-
raise Peatio::Blockchain::ClientError, e
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
private
|
|
53
|
-
|
|
54
|
-
def build_transaction(tx_hash)
|
|
55
|
-
tx_hash.fetch('vout')
|
|
56
|
-
.select do |entry|
|
|
57
|
-
entry.fetch('value').to_d > 0 &&
|
|
58
|
-
entry['scriptPubKey'].has_key?('addresses')
|
|
59
|
-
end
|
|
60
|
-
.each_with_object([]) do |entry, formatted_txs|
|
|
61
|
-
no_currency_tx =
|
|
62
|
-
{ hash: tx_hash['txid'], txout: entry['n'],
|
|
63
|
-
to_address: entry['scriptPubKey']['addresses'][0],
|
|
64
|
-
amount: entry.fetch('value').to_d,
|
|
65
|
-
status: 'success' }
|
|
66
|
-
|
|
67
|
-
# Build transaction for each currency belonging to blockchain.
|
|
68
|
-
settings_fetch(:currencies).pluck(:id).each do |currency_id|
|
|
69
|
-
formatted_txs << no_currency_tx.merge(currency_id: currency_id)
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def client
|
|
75
|
-
@client ||= Nexbit::Client.new(settings_fetch(:server))
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def settings_fetch(key)
|
|
79
|
-
@settings.fetch(key) { raise Peatio::Blockchain::MissingSettingError, key.to_s }
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|
data/lib/peatio/nexbit/client.rb
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module Nexbit
|
|
2
|
-
class Client
|
|
3
|
-
Error = Class.new(StandardError)
|
|
4
|
-
|
|
5
|
-
class ConnectionError < Error; end
|
|
6
|
-
|
|
7
|
-
class ResponseError < Error
|
|
8
|
-
def initialize(code, msg)
|
|
9
|
-
super "#{msg} (#{code})"
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
extend Memoist
|
|
14
|
-
|
|
15
|
-
def initialize(endpoint, idle_timeout: 5)
|
|
16
|
-
@json_rpc_endpoint = URI.parse(endpoint)
|
|
17
|
-
@idle_timeout = idle_timeout
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def json_rpc(method, params = [])
|
|
21
|
-
response = connection.post \
|
|
22
|
-
'/',
|
|
23
|
-
{jsonrpc: '1.0', method: method, params: params}.to_json,
|
|
24
|
-
{'Accept' => 'application/json',
|
|
25
|
-
'Content-Type' => 'application/json'}
|
|
26
|
-
response.assert_success!
|
|
27
|
-
response = JSON.parse(response.body)
|
|
28
|
-
response['error'].tap { |error| raise ResponseError.new(error['code'], error['message']) if error }
|
|
29
|
-
response.fetch('result')
|
|
30
|
-
rescue Faraday::Error => e
|
|
31
|
-
raise ConnectionError, e
|
|
32
|
-
rescue StandardError => e
|
|
33
|
-
raise Error, e
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def connection
|
|
39
|
-
@connection ||= Faraday.new(@json_rpc_endpoint) do |f|
|
|
40
|
-
f.adapter :net_http_persistent, pool_size: 5, idle_timeout: @idle_timeout
|
|
41
|
-
end.tap do |connection|
|
|
42
|
-
unless @json_rpc_endpoint.user.blank?
|
|
43
|
-
connection.basic_auth(@json_rpc_endpoint.user, @json_rpc_endpoint.password)
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
data/lib/peatio/nexbit/hooks.rb
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
module Peatio
|
|
2
|
-
module Nexbit
|
|
3
|
-
module Hooks
|
|
4
|
-
BLOCKCHAIN_VERSION_REQUIREMENT = "~> 1.0.0"
|
|
5
|
-
WALLET_VERSION_REQUIREMENT = "~> 1.0.0"
|
|
6
|
-
|
|
7
|
-
class << self
|
|
8
|
-
def check_compatibility
|
|
9
|
-
unless Gem::Requirement.new(BLOCKCHAIN_VERSION_REQUIREMENT)
|
|
10
|
-
.satisfied_by?(Gem::Version.new(Peatio::Blockchain::VERSION))
|
|
11
|
-
[
|
|
12
|
-
"Nexbit blockchain version requiremnt was not suttisfied by Peatio::Blockchain.",
|
|
13
|
-
"Nexbit blockchain requires #{BLOCKCHAIN_VERSION_REQUIREMENT}.",
|
|
14
|
-
"Peatio::Blockchain version is #{Peatio::Blockchain::VERSION}"
|
|
15
|
-
].join('\n').tap { |s| Kernel.abort s }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
unless Gem::Requirement.new(WALLET_VERSION_REQUIREMENT)
|
|
19
|
-
.satisfied_by?(Gem::Version.new(Peatio::Wallet::VERSION))
|
|
20
|
-
[
|
|
21
|
-
"Nexbit wallet version requiremnt was not suttisfied by Peatio::Wallet.",
|
|
22
|
-
"Nexbit wallet requires #{WALLET_VERSION_REQUIREMENT}.",
|
|
23
|
-
"Peatio::Wallet version is #{Peatio::Wallet::VERSION}"
|
|
24
|
-
].join('\n').tap { |s| Kernel.abort s }
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def register
|
|
29
|
-
Peatio::Blockchain.registry[:nexbit] = Nexbit::Blockchain.new
|
|
30
|
-
Peatio::Wallet.registry[:nexbitd] = Nexbit::Wallet.new
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
if defined?(Rails::Railtie)
|
|
35
|
-
require "peatio/nexbit/railtie"
|
|
36
|
-
else
|
|
37
|
-
check_compatibility
|
|
38
|
-
register
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
data/lib/peatio/nexbit/wallet.rb
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
module Nexbit
|
|
2
|
-
class Wallet < Peatio::Wallet::Abstract
|
|
3
|
-
|
|
4
|
-
def initialize(settings = {})
|
|
5
|
-
@settings = settings
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def configure(settings = {})
|
|
9
|
-
# Clean client state during configure.
|
|
10
|
-
@client = nil
|
|
11
|
-
|
|
12
|
-
@settings.merge!(settings.slice(*SUPPORTED_SETTINGS))
|
|
13
|
-
|
|
14
|
-
@wallet = @settings.fetch(:wallet) do
|
|
15
|
-
raise Peatio::Wallet::MissingSettingError, :wallet
|
|
16
|
-
end.slice(:uri, :address)
|
|
17
|
-
|
|
18
|
-
@currency = @settings.fetch(:currency) do
|
|
19
|
-
raise Peatio::Wallet::MissingSettingError, :currency
|
|
20
|
-
end.slice(:id, :base_factor, :options)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def create_address!(_options = {})
|
|
24
|
-
{ address: client.json_rpc(:getnewaddress) }
|
|
25
|
-
rescue Nexbit::Client::Error => e
|
|
26
|
-
raise Peatio::Wallet::ClientError, e
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def create_transaction!(transaction, options = {})
|
|
30
|
-
txid = client.json_rpc(:sendtoaddress,
|
|
31
|
-
[
|
|
32
|
-
transaction.to_address,
|
|
33
|
-
transaction.amount,
|
|
34
|
-
'',
|
|
35
|
-
'',
|
|
36
|
-
options[:subtract_fee].to_s == 'true' # subtract fee from transaction amount.
|
|
37
|
-
])
|
|
38
|
-
transaction.hash = txid
|
|
39
|
-
transaction
|
|
40
|
-
rescue Nexbit::Client::Error => e
|
|
41
|
-
raise Peatio::Wallet::ClientError, e
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def load_balance!
|
|
45
|
-
client.json_rpc(:getbalance).to_d
|
|
46
|
-
|
|
47
|
-
rescue Nexbit::Client::Error => e
|
|
48
|
-
raise Peatio::Wallet::ClientError, e
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
private
|
|
52
|
-
|
|
53
|
-
def client
|
|
54
|
-
uri = @wallet.fetch(:uri) { raise Peatio::Wallet::MissingSettingError, :uri }
|
|
55
|
-
@client ||= Client.new(uri, idle_timeout: 1)
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|