peatio-dao 3.1.3
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 +7 -0
- data/.drone.yml +30 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/.rubocop.yml +148 -0
- data/.simplecov +17 -0
- data/.travis.yml +18 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +242 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/peatio +12 -0
- data/bin/setup +8 -0
- data/lib/peatio/adapter_registry.rb +25 -0
- data/lib/peatio/auth/error.rb +18 -0
- data/lib/peatio/auth/jwt_authenticator.rb +127 -0
- data/lib/peatio/block.rb +29 -0
- data/lib/peatio/blockchain/abstract.rb +161 -0
- data/lib/peatio/blockchain/error.rb +37 -0
- data/lib/peatio/blockchain/registry.rb +16 -0
- data/lib/peatio/command/base.rb +11 -0
- data/lib/peatio/command/db.rb +20 -0
- data/lib/peatio/command/inject.rb +13 -0
- data/lib/peatio/command/root.rb +14 -0
- data/lib/peatio/command/security.rb +29 -0
- data/lib/peatio/command/service.rb +40 -0
- data/lib/peatio/error.rb +18 -0
- data/lib/peatio/executor.rb +64 -0
- data/lib/peatio/injectors/peatio_events.rb +240 -0
- data/lib/peatio/logger.rb +39 -0
- data/lib/peatio/metrics/server.rb +15 -0
- data/lib/peatio/mq/client.rb +51 -0
- data/lib/peatio/ranger/connection.rb +117 -0
- data/lib/peatio/ranger/events.rb +11 -0
- data/lib/peatio/ranger/router.rb +234 -0
- data/lib/peatio/ranger/web_socket.rb +68 -0
- data/lib/peatio/security/key_generator.rb +26 -0
- data/lib/peatio/sql/client.rb +19 -0
- data/lib/peatio/sql/schema.rb +72 -0
- data/lib/peatio/transaction.rb +137 -0
- data/lib/peatio/upstream/base.rb +116 -0
- data/lib/peatio/upstream/registry.rb +14 -0
- data/lib/peatio/version.rb +3 -0
- data/lib/peatio/wallet/abstract.rb +189 -0
- data/lib/peatio/wallet/error.rb +37 -0
- data/lib/peatio/wallet/registry.rb +16 -0
- data/lib/peatio.rb +47 -0
- data/peatio-dao.gemspec +53 -0
- metadata +455 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 64549fbc967067db383cd890fec6e9d9f182ec6b7df09d754f481ce12e476d96
|
4
|
+
data.tar.gz: d663715a4c4daf4824b98a681ac94a816f9abd5872873acb1c4eb975c18bf5cb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cbec2b5fdee7cb6f7304ac5de8f51137bf3a872f5ce6352d1785fcfc9073b6399432b6e2c19c8643ca4d6d1963f5efbbff6c7770f06942b68316b46e034dd2cb
|
7
|
+
data.tar.gz: cde034e9ea789004f7e34e48affbd526d4b508fa7a068576c3066f49580d0c43c6aaf791e29f9d0400660e911f0527aac70803b76c03b06647643317907a2028
|
data/.drone.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
kind: pipeline
|
3
|
+
name: default
|
4
|
+
|
5
|
+
steps:
|
6
|
+
- name: Run rspec for each library
|
7
|
+
image: ruby:2.6
|
8
|
+
commands:
|
9
|
+
- gem install bundler:2.4.7
|
10
|
+
- bundle install
|
11
|
+
- bundle exec rspec
|
12
|
+
|
13
|
+
- name: Release gems
|
14
|
+
image: ruby:2.6
|
15
|
+
environment:
|
16
|
+
GEM_CREDENTIALS:
|
17
|
+
from_secret: gem_credentials
|
18
|
+
commands:
|
19
|
+
- mkdir -p ~/.gem
|
20
|
+
- echo $GEM_CREDENTIALS | base64 -d > ~/.gem/credentials
|
21
|
+
- chmod 0600 ~/.gem/credentials
|
22
|
+
- gem build peatio-dao.gemspec
|
23
|
+
- gem push peatio-*.gem
|
24
|
+
when:
|
25
|
+
branch:
|
26
|
+
- master
|
27
|
+
|
28
|
+
trigger:
|
29
|
+
event:
|
30
|
+
- push
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# Commonly used screens these days easily fit more than 80 characters.
|
2
|
+
Metrics/LineLength:
|
3
|
+
Max: 120
|
4
|
+
|
5
|
+
# Too short methods lead to extraction of single-use methods, which can make
|
6
|
+
# the code easier to read (by naming things), but can also clutter the class
|
7
|
+
Metrics/MethodLength:
|
8
|
+
Max: 20
|
9
|
+
|
10
|
+
# The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
|
11
|
+
Metrics/ClassLength:
|
12
|
+
Max: 1500
|
13
|
+
|
14
|
+
# No space makes the method definition shorter and differentiates
|
15
|
+
# from a regular assignment.
|
16
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
17
|
+
EnforcedStyle: no_space
|
18
|
+
|
19
|
+
# Single quotes being faster is hardly measurable and only affects parse time.
|
20
|
+
# Enforcing double quotes reduces the times where you need to change them
|
21
|
+
# when introducing an interpolation. Use single quotes only if their semantics
|
22
|
+
# are needed.
|
23
|
+
Style/StringLiterals:
|
24
|
+
EnforcedStyle: double_quotes
|
25
|
+
|
26
|
+
# We do not need to support Ruby 1.9, so this is good to use.
|
27
|
+
Style/SymbolArray:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
# Most readable form.
|
31
|
+
Layout/AlignHash:
|
32
|
+
EnforcedHashRocketStyle: table
|
33
|
+
EnforcedColonStyle: table
|
34
|
+
|
35
|
+
# Mixing the styles looks just silly.
|
36
|
+
Style/HashSyntax:
|
37
|
+
EnforcedStyle: ruby19_no_mixed_keys
|
38
|
+
|
39
|
+
# has_key? and has_value? are far more readable than key? and value?
|
40
|
+
Style/PreferredHashMethods:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
# String#% is by far the least verbose and only object oriented variant.
|
44
|
+
Style/FormatString:
|
45
|
+
EnforcedStyle: percent
|
46
|
+
|
47
|
+
Style/CollectionMethods:
|
48
|
+
Enabled: true
|
49
|
+
PreferredMethods:
|
50
|
+
# inject seems more common in the community.
|
51
|
+
reduce: "inject"
|
52
|
+
|
53
|
+
|
54
|
+
# Either allow this style or don't. Marking it as safe with parenthesis
|
55
|
+
# is silly. Let's try to live without them for now.
|
56
|
+
Style/ParenthesesAroundCondition:
|
57
|
+
AllowSafeAssignment: false
|
58
|
+
Lint/AssignmentInCondition:
|
59
|
+
AllowSafeAssignment: false
|
60
|
+
|
61
|
+
# A specialized exception class will take one or more arguments and construct the message from it.
|
62
|
+
# So both variants make sense.
|
63
|
+
Style/RaiseArgs:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
# Indenting the chained dots beneath each other is not supported by this cop,
|
67
|
+
# see https://github.com/bbatsov/rubocop/issues/1633
|
68
|
+
Layout/MultilineOperationIndentation:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
# Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
|
72
|
+
# The argument that fail should be used to abort the program is wrong too,
|
73
|
+
# there's Kernel#abort for that.
|
74
|
+
Style/SignalException:
|
75
|
+
EnforcedStyle: only_raise
|
76
|
+
|
77
|
+
# Suppressing exceptions can be perfectly fine, and be it to avoid to
|
78
|
+
# explicitly type nil into the rescue since that's what you want to return,
|
79
|
+
# or suppressing LoadError for optional dependencies
|
80
|
+
Lint/HandleExceptions:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
Layout/SpaceInsideBlockBraces:
|
84
|
+
# The space here provides no real gain in readability while consuming
|
85
|
+
# horizontal space that could be used for a better parameter name.
|
86
|
+
# Also {| differentiates better from a hash than { | does.
|
87
|
+
SpaceBeforeBlockParameters: false
|
88
|
+
|
89
|
+
# No trailing space differentiates better from the block:
|
90
|
+
# foo} means hash, foo } means block.
|
91
|
+
Layout/SpaceInsideHashLiteralBraces:
|
92
|
+
EnforcedStyle: no_space
|
93
|
+
|
94
|
+
# { ... } for multi-line blocks is okay, follow Weirichs rule instead:
|
95
|
+
# https://web.archive.org/web/20140221124509/http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc
|
96
|
+
Style/BlockDelimiters:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
# do / end blocks should be used for side effects,
|
100
|
+
# methods that run a block for side effects and have
|
101
|
+
# a useful return value are rare, assign the return
|
102
|
+
# value to a local variable for those cases.
|
103
|
+
Style/MethodCalledOnDoEndBlock:
|
104
|
+
Enabled: true
|
105
|
+
|
106
|
+
# Enforcing the names of variables? To single letter ones? Just no.
|
107
|
+
Style/SingleLineBlockParams:
|
108
|
+
Enabled: false
|
109
|
+
|
110
|
+
# Shadowing outer local variables with block parameters is often useful
|
111
|
+
# to not reinvent a new name for the same thing, it highlights the relation
|
112
|
+
# between the outer variable and the parameter. The cases where it's actually
|
113
|
+
# confusing are rare, and usually bad for other reasons already, for example
|
114
|
+
# because the method is too long.
|
115
|
+
Lint/ShadowingOuterLocalVariable:
|
116
|
+
Enabled: false
|
117
|
+
|
118
|
+
# Check with yard instead.
|
119
|
+
Style/Documentation:
|
120
|
+
Enabled: false
|
121
|
+
|
122
|
+
# This is just silly. Calling the argument `other` in all cases makes no sense.
|
123
|
+
Naming/BinaryOperatorParameterName:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
# There are valid cases, for example debugging Cucumber steps,
|
127
|
+
# also they'll fail CI anyway
|
128
|
+
Lint/Debugger:
|
129
|
+
Enabled: false
|
130
|
+
|
131
|
+
# Style preference
|
132
|
+
Style/MethodDefParentheses:
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
Style/TrailingCommaInArrayLiteral:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
Style/TrailingCommaInHashLiteral:
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
Style/ClassAndModuleChildren:
|
142
|
+
EnforcedStyle: compact
|
143
|
+
|
144
|
+
Layout/IndentHeredoc:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
Style/MethodCallWithoutArgsParentheses:
|
148
|
+
Enabled: false
|
data/.simplecov
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
require 'simplecov-json'
|
3
|
+
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter '/spec/'
|
6
|
+
end
|
7
|
+
|
8
|
+
SimpleCov.formatters = [
|
9
|
+
SimpleCov::Formatter::HTMLFormatter,
|
10
|
+
SimpleCov::Formatter::JSONFormatter,
|
11
|
+
]
|
12
|
+
|
13
|
+
# save to CircleCI's artifacts directory if we're on CircleCI
|
14
|
+
if ENV['CIRCLE_ARTIFACTS']
|
15
|
+
dir = File.join(ENV['CIRCLE_ARTIFACTS'], "coverage")
|
16
|
+
SimpleCov.coverage_dir(dir)
|
17
|
+
end
|
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
rvm:
|
5
|
+
- 2.5.1
|
6
|
+
- 2.5.3
|
7
|
+
before_install: gem install bundler -v 1.17.3
|
8
|
+
env:
|
9
|
+
- WEBSOCKET_HOST: localhost
|
10
|
+
WEBSOCKET_PORT: 8081
|
11
|
+
deploy:
|
12
|
+
provider: rubygems
|
13
|
+
api_key:
|
14
|
+
secure: MTlSs+/1/+djQBx9UpZBoPdkLb9j9tx31CxoJ2uw3a429cj9qhJc+qZL9Gbim4kqdDhWAlfIFKDn2aeVPHIcd3VAP3dBUkG2gMxC440gx7rBJXSGpo+zwS9pnsFNQb9RnFZ4OI0dDr0VvYyctZh2h4VVTKhP2m7U59A6yNeNhW8K5HzUZ3+QvykiEQVQUrT29BRpf+9vEISVDPk3o0S0HO+RRvWXOBe5F2M/5hhJUdxUZ2/Pikg3PFJGhS1+g23YhLiEvMN6TiHz/PbUdLN1hnAVgmE86t/DU2lRzhDHNX3CetEhEhtElkTlbpIitmfy8309G0lUMZkN4Z6qKjuYKjuGYXYjXS6nEq6oy5U0HK2Ljo6ka4WZC5u08t5+I12jzCJ5Nq3kdqJkYZwMODgzvcyw4EKNHejyYLGGIbrXgbuYtR6wwvIYz7hz/j/fFxFDawBYC9s92/gvthtHNTzosBi/I07DYYhdF7Rt4TMfdPpasctV8ijTQ+ePH76cNPaDBqupemZUMSJRuuPOXS8SXS1xLDrPviffok/a3zmHDHgYWjqqBzktjCZ5C2PIeVo3o+ClSiWu8tJ3UquqdQ2ug60LK6ttbKxvDk/De3JcV4SEpqJBroSWD84hp0IiyQMEAhl/SxCVLXn9m5xF3evqH168p/Tgr5pklFUDw/tpSh8=
|
15
|
+
gem: peatio
|
16
|
+
on:
|
17
|
+
tags: true
|
18
|
+
repo: rubykube/peatio-core
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,242 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
peatio-dao (3.1.2)
|
5
|
+
activemodel (> 5.2)
|
6
|
+
amqp
|
7
|
+
bunny
|
8
|
+
clamp
|
9
|
+
em-synchrony (~> 1.0)
|
10
|
+
em-websocket
|
11
|
+
eventmachine
|
12
|
+
faraday (~> 1.10)
|
13
|
+
jwt
|
14
|
+
mysql2
|
15
|
+
prometheus-client
|
16
|
+
thin
|
17
|
+
websocket-client-simple (~> 0.9.0)
|
18
|
+
|
19
|
+
GEM
|
20
|
+
remote: https://rubygems.org/
|
21
|
+
specs:
|
22
|
+
activemodel (8.0.2)
|
23
|
+
activesupport (= 8.0.2)
|
24
|
+
activesupport (8.0.2)
|
25
|
+
base64
|
26
|
+
benchmark (>= 0.3)
|
27
|
+
bigdecimal
|
28
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
29
|
+
connection_pool (>= 2.2.5)
|
30
|
+
drb
|
31
|
+
i18n (>= 1.6, < 2)
|
32
|
+
logger (>= 1.4.2)
|
33
|
+
minitest (>= 5.1)
|
34
|
+
securerandom (>= 0.3)
|
35
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
36
|
+
uri (>= 0.13.1)
|
37
|
+
amq-protocol (2.3.3)
|
38
|
+
amqp (1.8.0)
|
39
|
+
amq-protocol (>= 2.2.0)
|
40
|
+
eventmachine
|
41
|
+
ast (2.4.3)
|
42
|
+
base64 (0.2.0)
|
43
|
+
benchmark (0.4.0)
|
44
|
+
bigdecimal (3.1.9)
|
45
|
+
bump (0.10.0)
|
46
|
+
bunny (2.24.0)
|
47
|
+
amq-protocol (~> 2.3)
|
48
|
+
sorted_set (~> 1, >= 1.0.2)
|
49
|
+
bunny-mock (1.7.0)
|
50
|
+
bunny (>= 1.7)
|
51
|
+
byebug (12.0.0)
|
52
|
+
clamp (1.3.2)
|
53
|
+
coderay (1.1.3)
|
54
|
+
concurrent-ruby (1.3.5)
|
55
|
+
connection_pool (2.5.1)
|
56
|
+
daemons (1.4.1)
|
57
|
+
date (3.4.1)
|
58
|
+
diff-lcs (1.6.1)
|
59
|
+
docile (1.4.1)
|
60
|
+
drb (2.2.1)
|
61
|
+
em-spec (0.2.7)
|
62
|
+
eventmachine
|
63
|
+
em-synchrony (1.0.6)
|
64
|
+
eventmachine (>= 1.0.0.beta.1)
|
65
|
+
em-websocket (0.5.3)
|
66
|
+
eventmachine (>= 0.12.9)
|
67
|
+
http_parser.rb (~> 0)
|
68
|
+
em-websocket-client (0.1.2)
|
69
|
+
eventmachine
|
70
|
+
websocket
|
71
|
+
event_emitter (0.2.6)
|
72
|
+
eventmachine (1.2.7)
|
73
|
+
faraday (1.10.4)
|
74
|
+
faraday-em_http (~> 1.0)
|
75
|
+
faraday-em_synchrony (~> 1.0)
|
76
|
+
faraday-excon (~> 1.1)
|
77
|
+
faraday-httpclient (~> 1.0)
|
78
|
+
faraday-multipart (~> 1.0)
|
79
|
+
faraday-net_http (~> 1.0)
|
80
|
+
faraday-net_http_persistent (~> 1.0)
|
81
|
+
faraday-patron (~> 1.0)
|
82
|
+
faraday-rack (~> 1.0)
|
83
|
+
faraday-retry (~> 1.0)
|
84
|
+
ruby2_keywords (>= 0.0.4)
|
85
|
+
faraday-em_http (1.0.0)
|
86
|
+
faraday-em_synchrony (1.0.0)
|
87
|
+
faraday-excon (1.1.0)
|
88
|
+
faraday-httpclient (1.0.1)
|
89
|
+
faraday-multipart (1.1.0)
|
90
|
+
multipart-post (~> 2.0)
|
91
|
+
faraday-net_http (1.0.2)
|
92
|
+
faraday-net_http_persistent (1.2.0)
|
93
|
+
faraday-patron (1.0.0)
|
94
|
+
faraday-rack (1.0.0)
|
95
|
+
faraday-retry (1.0.3)
|
96
|
+
http_parser.rb (0.8.0)
|
97
|
+
i18n (1.14.7)
|
98
|
+
concurrent-ruby (~> 1.0)
|
99
|
+
io-console (0.8.0)
|
100
|
+
irb (1.15.2)
|
101
|
+
pp (>= 0.6.0)
|
102
|
+
rdoc (>= 4.0.0)
|
103
|
+
reline (>= 0.4.2)
|
104
|
+
json (2.10.2)
|
105
|
+
jwt (2.10.1)
|
106
|
+
base64
|
107
|
+
language_server-protocol (3.17.0.4)
|
108
|
+
lint_roller (1.1.0)
|
109
|
+
logger (1.7.0)
|
110
|
+
method_source (1.1.0)
|
111
|
+
minitest (5.25.5)
|
112
|
+
multipart-post (2.4.1)
|
113
|
+
mutex_m (0.3.0)
|
114
|
+
mysql2 (0.5.6)
|
115
|
+
parallel (1.27.0)
|
116
|
+
parser (3.3.8.0)
|
117
|
+
ast (~> 2.4.1)
|
118
|
+
racc
|
119
|
+
pp (0.6.2)
|
120
|
+
prettyprint
|
121
|
+
prettyprint (0.2.0)
|
122
|
+
prism (1.4.0)
|
123
|
+
prometheus-client (4.2.4)
|
124
|
+
base64
|
125
|
+
pry (0.15.2)
|
126
|
+
coderay (~> 1.1)
|
127
|
+
method_source (~> 1.0)
|
128
|
+
pry-byebug (3.11.0)
|
129
|
+
byebug (~> 12.0)
|
130
|
+
pry (>= 0.13, < 0.16)
|
131
|
+
psych (5.2.3)
|
132
|
+
date
|
133
|
+
stringio
|
134
|
+
racc (1.8.1)
|
135
|
+
rack (2.2.13)
|
136
|
+
rainbow (3.1.1)
|
137
|
+
rake (13.2.1)
|
138
|
+
rbtree (0.4.6)
|
139
|
+
rdoc (6.13.1)
|
140
|
+
psych (>= 4.0.0)
|
141
|
+
regexp_parser (2.10.0)
|
142
|
+
reline (0.6.1)
|
143
|
+
io-console (~> 0.5)
|
144
|
+
rspec (3.13.0)
|
145
|
+
rspec-core (~> 3.13.0)
|
146
|
+
rspec-expectations (~> 3.13.0)
|
147
|
+
rspec-mocks (~> 3.13.0)
|
148
|
+
rspec-core (3.13.3)
|
149
|
+
rspec-support (~> 3.13.0)
|
150
|
+
rspec-expectations (3.13.3)
|
151
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
152
|
+
rspec-support (~> 3.13.0)
|
153
|
+
rspec-mocks (3.13.2)
|
154
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
155
|
+
rspec-support (~> 3.13.0)
|
156
|
+
rspec-support (3.13.2)
|
157
|
+
rspec_junit_formatter (0.6.0)
|
158
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
159
|
+
rubocop (1.75.2)
|
160
|
+
json (~> 2.3)
|
161
|
+
language_server-protocol (~> 3.17.0.2)
|
162
|
+
lint_roller (~> 1.1.0)
|
163
|
+
parallel (~> 1.10)
|
164
|
+
parser (>= 3.3.0.2)
|
165
|
+
rainbow (>= 2.2.2, < 4.0)
|
166
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
167
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
168
|
+
ruby-progressbar (~> 1.7)
|
169
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
170
|
+
rubocop-ast (1.44.1)
|
171
|
+
parser (>= 3.3.7.2)
|
172
|
+
prism (~> 1.4)
|
173
|
+
rubocop-github (0.23.0)
|
174
|
+
rubocop (>= 1.72)
|
175
|
+
rubocop-performance (>= 1.24)
|
176
|
+
rubocop-rails (>= 2.23)
|
177
|
+
rubocop-performance (1.25.0)
|
178
|
+
lint_roller (~> 1.1)
|
179
|
+
rubocop (>= 1.75.0, < 2.0)
|
180
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
181
|
+
rubocop-rails (2.31.0)
|
182
|
+
activesupport (>= 4.2.0)
|
183
|
+
lint_roller (~> 1.1)
|
184
|
+
rack (>= 1.1)
|
185
|
+
rubocop (>= 1.75.0, < 2.0)
|
186
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
187
|
+
ruby-progressbar (1.13.0)
|
188
|
+
ruby2_keywords (0.0.5)
|
189
|
+
securerandom (0.4.1)
|
190
|
+
set (1.1.1)
|
191
|
+
simplecov (0.22.0)
|
192
|
+
docile (~> 1.1)
|
193
|
+
simplecov-html (~> 0.11)
|
194
|
+
simplecov_json_formatter (~> 0.1)
|
195
|
+
simplecov-html (0.13.1)
|
196
|
+
simplecov-json (0.2.3)
|
197
|
+
json
|
198
|
+
simplecov
|
199
|
+
simplecov_json_formatter (0.1.4)
|
200
|
+
sorted_set (1.0.3)
|
201
|
+
rbtree
|
202
|
+
set (~> 1.0)
|
203
|
+
stringio (3.1.6)
|
204
|
+
thin (1.8.2)
|
205
|
+
daemons (~> 1.0, >= 1.0.9)
|
206
|
+
eventmachine (~> 1.0, >= 1.0.4)
|
207
|
+
rack (>= 1, < 3)
|
208
|
+
tzinfo (2.0.6)
|
209
|
+
concurrent-ruby (~> 1.0)
|
210
|
+
unicode-display_width (3.1.4)
|
211
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
212
|
+
unicode-emoji (4.0.4)
|
213
|
+
uri (1.0.3)
|
214
|
+
websocket (1.2.11)
|
215
|
+
websocket-client-simple (0.9.0)
|
216
|
+
base64
|
217
|
+
event_emitter
|
218
|
+
mutex_m
|
219
|
+
websocket
|
220
|
+
|
221
|
+
PLATFORMS
|
222
|
+
ruby
|
223
|
+
x86_64-linux
|
224
|
+
|
225
|
+
DEPENDENCIES
|
226
|
+
bump
|
227
|
+
bundler (~> 2.6.6)
|
228
|
+
bunny-mock
|
229
|
+
em-spec
|
230
|
+
em-websocket-client
|
231
|
+
irb
|
232
|
+
peatio-dao!
|
233
|
+
pry-byebug
|
234
|
+
rake (~> 13.0)
|
235
|
+
rspec (~> 3.0)
|
236
|
+
rspec_junit_formatter
|
237
|
+
rubocop-github
|
238
|
+
simplecov
|
239
|
+
simplecov-json
|
240
|
+
|
241
|
+
BUNDLED WITH
|
242
|
+
2.6.6
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
<h3 align="center">
|
4
|
+
<a href="https://www.openware.com/sdk">Guide</a> <span>|</span>
|
5
|
+
<a href="https://www.openware.com/sdk/api.html">API Docs</a> <span>|</span>
|
6
|
+
<a href="https://www.openware.com/">Consulting</a> <span>|</span>
|
7
|
+
<a href="https://t.me/peatio">Community</a>
|
8
|
+
</h3>
|
9
|
+
<h6 align="center">Peatio is part of <a href="https://github.com/openware/opendax">OpenDAX Trading Platform</a></h6>
|
10
|
+
|
11
|
+
---
|
12
|
+
|
13
|
+
# Peatio
|
14
|
+
|
15
|
+
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`. To experiment with that code, run `bin/console` for an interactive prompt.
|
16
|
+
|
17
|
+
TODO: Delete this and the text above, and describe your gem
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'peatio'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install peatio
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
TODO: Write usage instructions here
|
38
|
+
|
39
|
+
## Development
|
40
|
+
|
41
|
+
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.
|
42
|
+
|
43
|
+
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).
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/peatio.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "peatio"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/peatio
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- RUBY -*-
|
3
|
+
|
4
|
+
PEATIO_CORE = ENV["PEATIO_CORE"] || File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
5
|
+
$: << File.join(PEATIO_CORE, "lib")
|
6
|
+
|
7
|
+
require "clamp"
|
8
|
+
|
9
|
+
require "peatio"
|
10
|
+
require "peatio/command/root"
|
11
|
+
|
12
|
+
Peatio::Root.run
|
data/bin/setup
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Peatio
|
2
|
+
class AdapterRegistry
|
3
|
+
Error = Class.new(StandardError)
|
4
|
+
DuplicatedAdapterError = Class.new(Error)
|
5
|
+
NotRegisteredAdapterError = Class.new(Error)
|
6
|
+
|
7
|
+
def []=(name, instance)
|
8
|
+
name = name.to_sym
|
9
|
+
raise DuplicatedAdapterError, name if adapters.key?(name)
|
10
|
+
adapters[name] = instance
|
11
|
+
end
|
12
|
+
|
13
|
+
def [](name)
|
14
|
+
adapters.fetch(name.to_sym) { raise NotRegisteredAdapterError, name }
|
15
|
+
end
|
16
|
+
|
17
|
+
def adapters
|
18
|
+
@adapters ||= {}
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapters=(h)
|
22
|
+
@adapters = h
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Peatio::Auth
|
2
|
+
# Error repesent all errors that can be returned from Auth module.
|
3
|
+
class Error < Peatio::Error
|
4
|
+
# @return [String, JWT::*] Reason store underlying reason for given error.
|
5
|
+
#
|
6
|
+
# @see https://github.com/jwt/ruby-jwt/blob/master/lib/jwt/error.rb List of JWT::* errors.
|
7
|
+
attr_reader :reason
|
8
|
+
|
9
|
+
def initialize(reason = nil)
|
10
|
+
@reason = reason
|
11
|
+
|
12
|
+
super(
|
13
|
+
code: 2001,
|
14
|
+
text: "Authorization failed".tap { |t| t << ": #{reason}" if reason },
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|