peatio-ndex 0.1.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/blockchains.yml +11 -0
- data/config/currencies.yml +113 -0
- data/config/wallets.yml +363 -0
- data/lib/peatio/ndex/blockchain.rb +89 -0
- data/lib/peatio/ndex/client.rb +93 -0
- data/lib/peatio/ndex/hooks.rb +42 -0
- data/lib/peatio/ndex/railtie.rb +13 -0
- data/lib/peatio/ndex/version.rb +1 -1
- data/lib/peatio/ndex/wallet.rb +84 -0
- data/peatio-ndex-0.1.0.gem +0 -0
- data/peatio-ndex-0.1.1.gem +0 -0
- data/peatio-ndex-0.1.2.gem +0 -0
- data/peatio-ndex.gemspec +5 -4
- metadata +24 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 900d8cecca4639682cab102f8c534a5a72292ebdcb14b86ceeef12d0f4d934bf
|
4
|
+
data.tar.gz: c701f9e740cdb40ac36c94c92eb41cf8da3f85462518fdf44a32b0b1d9682c49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a1197854db04b71cee67a8576869fa58e8f6ac91b579865c989d07730ecc8cc165b3b62923f49601d95398cc12d8a9f252e1012d27b2d25898ce794cacc15c9
|
7
|
+
data.tar.gz: acc4b4d86112f528b472f5d689ac0a84ba65ac253ed12d1feaefe249b8fe2c8f9dd43002c0eb8d55825ad69969fd0dcca53d3c208a85db841c7a438cfd8bb2a3
|
@@ -0,0 +1,11 @@
|
|
1
|
+
- key: nxt-testnet
|
2
|
+
name: Nxt Testnet
|
3
|
+
client: nxt # API client name.
|
4
|
+
server: http://127.0.0.1:6876 # Public NXT node endpoint.
|
5
|
+
height: 2024646 # Initial block number from which sync will be started.
|
6
|
+
min_confirmations: 1 # Minimal confirmations needed for withdraw and deposit confirmation.
|
7
|
+
explorer:
|
8
|
+
address: https://test.nxtportal.org/accounts/#{address}
|
9
|
+
transaction: https://test.nxtportal.org/transactions/#{txid}
|
10
|
+
status: active
|
11
|
+
<% end %>
|
@@ -0,0 +1,113 @@
|
|
1
|
+
<% if ENV['CURRENCIES_CONFIG'] %>
|
2
|
+
<%= File.read(ENV['CURRENCIES_CONFIG']) %>
|
3
|
+
<% else %>
|
4
|
+
- id: usd
|
5
|
+
symbol: '$'
|
6
|
+
type: fiat
|
7
|
+
precision: 2
|
8
|
+
base_factor: 1
|
9
|
+
enabled: true
|
10
|
+
quick_withdraw_limit: 1000
|
11
|
+
deposit_fee: 0
|
12
|
+
withdraw_fee: 0
|
13
|
+
|
14
|
+
- id: btc
|
15
|
+
blockchain_key: btc-testnet
|
16
|
+
symbol: '฿'
|
17
|
+
type: coin
|
18
|
+
precision: 8
|
19
|
+
base_factor: 100_000_000
|
20
|
+
enabled: true
|
21
|
+
quick_withdraw_limit: 0.1
|
22
|
+
deposit_fee: 0
|
23
|
+
withdraw_fee: 0
|
24
|
+
options: {}
|
25
|
+
|
26
|
+
- id: xrp
|
27
|
+
blockchain_key: xrp-testnet
|
28
|
+
symbol: 'ꭆ'
|
29
|
+
type: coin
|
30
|
+
precision: 8
|
31
|
+
base_factor: 1_000_000
|
32
|
+
enabled: true
|
33
|
+
quick_withdraw_limit: 1000
|
34
|
+
deposit_fee: 0
|
35
|
+
withdraw_fee: 0
|
36
|
+
options: {}
|
37
|
+
|
38
|
+
- id: bch
|
39
|
+
blockchain_key: bch-testnet
|
40
|
+
symbol: '฿'
|
41
|
+
type: coin
|
42
|
+
precision: 8
|
43
|
+
base_factor: 100_000_000
|
44
|
+
enabled: true
|
45
|
+
quick_withdraw_limit: 1
|
46
|
+
deposit_fee: 0
|
47
|
+
withdraw_fee: 0
|
48
|
+
options: {}
|
49
|
+
|
50
|
+
- id: ltc
|
51
|
+
blockchain_key: ltc-testnet
|
52
|
+
symbol: 'Ł'
|
53
|
+
type: coin
|
54
|
+
precision: 8
|
55
|
+
base_factor: 100_000_000
|
56
|
+
enabled: true
|
57
|
+
quick_withdraw_limit: 5
|
58
|
+
deposit_fee: 0
|
59
|
+
withdraw_fee: 0
|
60
|
+
options: {}
|
61
|
+
|
62
|
+
- id: dash
|
63
|
+
blockchain_key: dash-testnet
|
64
|
+
symbol: 'Đ'
|
65
|
+
type: coin
|
66
|
+
precision: 8
|
67
|
+
base_factor: 100_000_000
|
68
|
+
enabled: true
|
69
|
+
quick_withdraw_limit: 2
|
70
|
+
deposit_fee: 0
|
71
|
+
withdraw_fee: 0
|
72
|
+
options: {}
|
73
|
+
|
74
|
+
- id: eth
|
75
|
+
blockchain_key: eth-rinkeby
|
76
|
+
symbol: 'Ξ'
|
77
|
+
type: coin
|
78
|
+
precision: 8
|
79
|
+
base_factor: 1_000_000_000_000_000_000
|
80
|
+
enabled: true
|
81
|
+
quick_withdraw_limit: 2
|
82
|
+
deposit_fee: 0
|
83
|
+
withdraw_fee: 0
|
84
|
+
options: {}
|
85
|
+
|
86
|
+
- id: trst
|
87
|
+
blockchain_key: eth-rinkeby
|
88
|
+
symbol: 'Ξ'
|
89
|
+
type: coin
|
90
|
+
precision: 8
|
91
|
+
base_factor: 1_000_000 # IMPORTANT: Don't forget to update this variable according
|
92
|
+
enabled: true # to your ERC20-based currency requirements
|
93
|
+
quick_withdraw_limit: 3000 # (usually can be found on the official website).
|
94
|
+
deposit_fee: 0
|
95
|
+
withdraw_fee: 0
|
96
|
+
options:
|
97
|
+
#
|
98
|
+
# ERC20 configuration.
|
99
|
+
erc20_contract_address: '0x0000000000000000000000000000000000000000' # Always wrap this value in quotes!
|
100
|
+
|
101
|
+
- id: nxt
|
102
|
+
blockchain_key: nxt-testnet
|
103
|
+
symbol: 'N'
|
104
|
+
type: coin
|
105
|
+
precision: 8
|
106
|
+
base_factor: 100_000_000
|
107
|
+
enabled: true
|
108
|
+
quick_withdraw_limit: 1
|
109
|
+
deposit_fee: 0
|
110
|
+
withdraw_fee: 0
|
111
|
+
options: {}
|
112
|
+
<% end %>
|
113
|
+
|
data/config/wallets.yml
ADDED
@@ -0,0 +1,363 @@
|
|
1
|
+
<% if ENV['WALLETS_CONFIG'] %>
|
2
|
+
<%= File.read(ENV['WALLETS_CONFIG']) %>
|
3
|
+
<% else %>
|
4
|
+
- name: Ethereum Deposit Wallet
|
5
|
+
blockchain_key: eth-rinkeby
|
6
|
+
currency_id: eth
|
7
|
+
# Address where deposits will be collected to.
|
8
|
+
address: '0x2b9fBC10EbAeEc28a8Fc10069C0BC29E45eBEB9C' # IMPORTANT: Always wrap this value in quotes!
|
9
|
+
kind: deposit # Wallet kind (deposit, hot, warm or cold).
|
10
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
11
|
+
max_balance: 0.0
|
12
|
+
status: active
|
13
|
+
gateway: geth # Gateway client name.
|
14
|
+
settings:
|
15
|
+
#
|
16
|
+
# Geth gateway client settings.
|
17
|
+
uri: http://127.0.0.1:8545
|
18
|
+
secret: 'changeme'
|
19
|
+
|
20
|
+
- name: Ethereum Hot Wallet
|
21
|
+
blockchain_key: eth-rinkeby
|
22
|
+
currency_id: eth
|
23
|
+
# Address where deposits will be collected to.
|
24
|
+
address: '0x270704935783087a01c7a28d8f2d8f01670c8050' # IMPORTANT: Always wrap this value in quotes!
|
25
|
+
kind: hot # Wallet kind (deposit, hot, warm or cold).
|
26
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
27
|
+
max_balance: 100.0
|
28
|
+
status: active
|
29
|
+
gateway: geth # Gateway client name.
|
30
|
+
settings:
|
31
|
+
#
|
32
|
+
# Geth gateway client settings.
|
33
|
+
uri: http://127.0.0.1:8545
|
34
|
+
secret: 'test'
|
35
|
+
|
36
|
+
|
37
|
+
- name: Ethereum Warm Wallet
|
38
|
+
blockchain_key: eth-rinkeby
|
39
|
+
currency_id: eth
|
40
|
+
# Address where deposits will be collected to.
|
41
|
+
address: '0x2b9fBC10EbAeEc28a8Fc10069C0BC29E45eBEB9C' # IMPORTANT: Always wrap this value in quotes!
|
42
|
+
kind: warm # Wallet kind (deposit, hot, warm or cold).
|
43
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
44
|
+
max_balance: 1000.0
|
45
|
+
status: active
|
46
|
+
gateway: geth # Gateway client name.
|
47
|
+
settings:
|
48
|
+
#
|
49
|
+
# Geth gateway client settings.
|
50
|
+
uri: http://user:password@127.0.0.1:8545
|
51
|
+
secret: 'changeme'
|
52
|
+
|
53
|
+
- name: Bitcoin Deposit Wallet
|
54
|
+
blockchain_key: btc-testnet
|
55
|
+
currency_id: btc
|
56
|
+
# Address where deposits will be collected to.
|
57
|
+
address: '2N4qYjye5yENLEkz4UkLFxzPaxJatF3kRwf' # IMPORTANT: Always wrap this value in quotes!
|
58
|
+
kind: deposit # Wallet kind (deposit, hot, warm or cold).
|
59
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
60
|
+
max_balance: 0.0
|
61
|
+
status: active
|
62
|
+
gateway: bitcoind # Gateway client name.
|
63
|
+
settings:
|
64
|
+
#
|
65
|
+
# Bitcoind gateway client settings.
|
66
|
+
uri: http://user:password@127.0.0.1:18332
|
67
|
+
|
68
|
+
- name: Bitcoin Hot Wallet
|
69
|
+
blockchain_key: btc-testnet
|
70
|
+
currency_id: btc
|
71
|
+
# Address where deposits will be collected to.
|
72
|
+
address: '2N4qYjye5yENLEkz4UkLFxzPaxJatF3kRwf' # IMPORTANT: Always wrap this value in quotes!
|
73
|
+
kind: hot # Wallet kind (deposit, hot, warm or cold).
|
74
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
75
|
+
max_balance: 5.0
|
76
|
+
status: active
|
77
|
+
gateway: bitgo # Gateway client name.
|
78
|
+
settings:
|
79
|
+
#
|
80
|
+
# BitGo gateway client settings.
|
81
|
+
bitgo_test_net: on
|
82
|
+
bitgo_wallet_id: ~
|
83
|
+
bitgo_wallet_passphrase: ~
|
84
|
+
bitgo_rest_api_root: https://test.bitgo.com/api/v2
|
85
|
+
bitgo_rest_api_access_token: ~
|
86
|
+
|
87
|
+
- name: Bitcoin Warm Wallet
|
88
|
+
blockchain_key: btc-testnet
|
89
|
+
currency_id: btc
|
90
|
+
# Address where deposits will be collected to.
|
91
|
+
address: '2N4qYjye5yENLEkz4UkLFxzPaxJatF3kRwf' # IMPORTANT: Always wrap this value in quotes!
|
92
|
+
kind: warm # Wallet kind (deposit, hot, warm or cold).
|
93
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
94
|
+
max_balance: 50.0
|
95
|
+
status: active
|
96
|
+
gateway: bitgo # Gateway client name.
|
97
|
+
settings:
|
98
|
+
#
|
99
|
+
# BitGo gateway client settings.
|
100
|
+
bitgo_test_net: on
|
101
|
+
bitgo_wallet_id: ~
|
102
|
+
bitgo_wallet_passphrase: ~
|
103
|
+
bitgo_rest_api_root: https://test.bitgo.com/api/v2
|
104
|
+
bitgo_rest_api_access_token: ~
|
105
|
+
|
106
|
+
- name: Bitcoincash Deposit Wallet
|
107
|
+
blockchain_key: bch-testnet
|
108
|
+
currency_id: bch
|
109
|
+
# Address where deposits will be collected to.
|
110
|
+
address: 'n2stP7w1DpSh7N1PzJh7eGjgCk3eTF3DMC' # IMPORTANT: Always wrap this value in quotes!
|
111
|
+
kind: deposit # Wallet kind (deposit, hot, warm or cold).
|
112
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
113
|
+
max_balance: 0.0
|
114
|
+
status: active
|
115
|
+
gateway: bitcoincashd # Gateway client name.
|
116
|
+
settings:
|
117
|
+
#
|
118
|
+
# Bitcoincashd gateway client settings.
|
119
|
+
uri: http://user:password@127.0.0.1:18332
|
120
|
+
|
121
|
+
- name: Bitcoincash Hot Wallet
|
122
|
+
blockchain_key: bch-testnet
|
123
|
+
currency_id: bch
|
124
|
+
# Address where deposits will be collected to.
|
125
|
+
address: 'n2stP7w1DpSh7N1PzJh7eGjgCk3eTF3DMC' # IMPORTANT: Always wrap this value in quotes!
|
126
|
+
kind: hot # Wallet kind (deposit, hot, warm or cold).
|
127
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
128
|
+
max_balance: 5.0
|
129
|
+
status: active
|
130
|
+
gateway: bitgo # Gateway client name.
|
131
|
+
settings:
|
132
|
+
#
|
133
|
+
# BitGo gateway client settings.
|
134
|
+
bitgo_test_net: on
|
135
|
+
bitgo_wallet_id: ~
|
136
|
+
bitgo_wallet_passphrase: ~
|
137
|
+
bitgo_rest_api_root: https://test.bitgo.com/api/v2
|
138
|
+
bitgo_rest_api_access_token: ~
|
139
|
+
|
140
|
+
- name: Bitcoincash Warm Wallet
|
141
|
+
blockchain_key: bch-testnet
|
142
|
+
currency_id: bch
|
143
|
+
# Address where deposits will be collected to.
|
144
|
+
address: 'n2stP7w1DpSh7N1PzJh7eGjgCk3eTF3DMC' # IMPORTANT: Always wrap this value in quotes!
|
145
|
+
kind: warm # Wallet kind (deposit, hot, warm or cold).
|
146
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
147
|
+
max_balance: 50.0
|
148
|
+
status: active
|
149
|
+
gateway: bitgo # Gateway client name.
|
150
|
+
settings:
|
151
|
+
#
|
152
|
+
# BitGo gateway client settings.
|
153
|
+
bitgo_test_net: on
|
154
|
+
bitgo_wallet_id: ~
|
155
|
+
bitgo_wallet_passphrase: ~
|
156
|
+
bitgo_rest_api_root: https://test.bitgo.com/api/v2
|
157
|
+
bitgo_rest_api_access_token: ~
|
158
|
+
|
159
|
+
|
160
|
+
- name: Litecoin Deposit Wallet
|
161
|
+
blockchain_key: ltc-testnet
|
162
|
+
currency_id: ltc
|
163
|
+
# Address where deposits will be collected to.
|
164
|
+
address: 'Qc2BM7gp8mKgJPPxLAadLAHteNQwhFwwuf' # IMPORTANT: Always wrap this value in quotes!
|
165
|
+
kind: deposit # Wallet kind (deposit, hot, warm or cold).
|
166
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
167
|
+
max_balance: 0.0
|
168
|
+
status: active
|
169
|
+
gateway: litecoind # Gateway client name.
|
170
|
+
settings:
|
171
|
+
#
|
172
|
+
# Litecoind gateway client settings.
|
173
|
+
uri: http://user:password@127.0.0.1:19332
|
174
|
+
|
175
|
+
- name: Litecoin Hot Wallet
|
176
|
+
blockchain_key: ltc-testnet
|
177
|
+
currency_id: ltc
|
178
|
+
# Address where deposits will be collected to.
|
179
|
+
address: 'Qc2BM7gp8mKgJPPxLAadLAHteNQwhFwwuf' # IMPORTANT: Always wrap this value in quotes!
|
180
|
+
kind: hot # Wallet kind (deposit, hot, warm or cold).
|
181
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
182
|
+
max_balance: 5.0
|
183
|
+
status: active
|
184
|
+
gateway: bitgo # Gateway client name.
|
185
|
+
settings:
|
186
|
+
#
|
187
|
+
# BitGo gateway client settings.
|
188
|
+
bitgo_test_net: on
|
189
|
+
bitgo_wallet_id: ~
|
190
|
+
bitgo_wallet_passphrase: ~
|
191
|
+
bitgo_rest_api_root: https://test.bitgo.com/api/v2
|
192
|
+
bitgo_rest_api_access_token: ~
|
193
|
+
|
194
|
+
- name: Litecoin Warm Wallet
|
195
|
+
blockchain_key: ltc-testnet
|
196
|
+
currency_id: ltc
|
197
|
+
# Address where deposits will be collected to.
|
198
|
+
address: 'Qc2BM7gp8mKgJPPxLAadLAHteNQwhFwwuf' # IMPORTANT: Always wrap this value in quotes!
|
199
|
+
kind: warm # Wallet kind (deposit, hot, warm or cold).
|
200
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
201
|
+
max_balance: 50.0
|
202
|
+
status: active
|
203
|
+
gateway: bitgo # Gateway client name.
|
204
|
+
settings:
|
205
|
+
#
|
206
|
+
# BitGo gateway client settings.
|
207
|
+
bitgo_test_net: on
|
208
|
+
bitgo_wallet_id: ~
|
209
|
+
bitgo_wallet_passphrase: ~
|
210
|
+
bitgo_rest_api_root: https://test.bitgo.com/api/v2
|
211
|
+
bitgo_rest_api_access_token: ~
|
212
|
+
|
213
|
+
|
214
|
+
- name: Dash Deposit Wallet
|
215
|
+
blockchain_key: dash-testnet
|
216
|
+
currency_id: dash
|
217
|
+
# Address where deposits will be collected to.
|
218
|
+
address: 'yVcZM6oUjfwrREm2CDb9G8BMHwwm5o5UsL' # IMPORTANT: Always wrap this value in quotes!
|
219
|
+
kind: deposit # Wallet kind (deposit, hot, warm or cold).
|
220
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
221
|
+
max_balance: 0.0
|
222
|
+
status: active
|
223
|
+
gateway: dashd # Gateway client name.
|
224
|
+
settings:
|
225
|
+
#
|
226
|
+
# Dashd gateway client settings.
|
227
|
+
uri: http://user:password@127.0.0.1:19998
|
228
|
+
|
229
|
+
- name: Dash Hot Wallet
|
230
|
+
blockchain_key: dash-testnet
|
231
|
+
currency_id: dash
|
232
|
+
# Address where deposits will be collected to.
|
233
|
+
address: 'yVcZM6oUjfwrREm2CDb9G8BMHwwm5o5UsL' # IMPORTANT: Always wrap this value in quotes!
|
234
|
+
kind: hot # Wallet kind (deposit, hot, warm or cold).
|
235
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
236
|
+
max_balance: 5.0
|
237
|
+
status: active
|
238
|
+
gateway: bitgo # Gateway client name.
|
239
|
+
settings:
|
240
|
+
#
|
241
|
+
# BitGo gateway client settings.
|
242
|
+
bitgo_test_net: on
|
243
|
+
bitgo_wallet_id: ~
|
244
|
+
bitgo_wallet_passphrase: ~
|
245
|
+
bitgo_rest_api_root: https://test.bitgo.com/api/v2
|
246
|
+
bitgo_rest_api_access_token: ~
|
247
|
+
|
248
|
+
- name: Dash Warm Wallet
|
249
|
+
blockchain_key: dash-testnet
|
250
|
+
currency_id: dash
|
251
|
+
# Address where deposits will be collected to.
|
252
|
+
address: 'yVcZM6oUjfwrREm2CDb9G8BMHwwm5o5UsL' # IMPORTANT: Always wrap this value in quotes!
|
253
|
+
kind: warm # Wallet kind (deposit, hot, warm or cold).
|
254
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
255
|
+
max_balance: 50.0
|
256
|
+
status: active
|
257
|
+
gateway: bitgo # Gateway client name.
|
258
|
+
settings:
|
259
|
+
#
|
260
|
+
# BitGo gateway client settings.
|
261
|
+
bitgo_test_net: on
|
262
|
+
bitgo_wallet_id: ~
|
263
|
+
bitgo_wallet_passphrase: ~
|
264
|
+
bitgo_rest_api_root: https://test.bitgo.com/api/v2
|
265
|
+
bitgo_rest_api_access_token: ~
|
266
|
+
|
267
|
+
- name: Ripple Deposit Wallet
|
268
|
+
blockchain_key: xrp-testnet
|
269
|
+
currency_id: xrp
|
270
|
+
# Address where deposits will be collected to.
|
271
|
+
address: 'r4kpJtnx4goLYXoRdi7mbkRpZ9Xpx2RyPN' # IMPORTANT: Always wrap this value in quotes!
|
272
|
+
kind: deposit # Wallet kind (deposit, hot, warm or cold).
|
273
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
274
|
+
max_balance: 0.0
|
275
|
+
status: active
|
276
|
+
gateway: rippled # Gateway client name.
|
277
|
+
settings:
|
278
|
+
#
|
279
|
+
# Geth gateway client settings.
|
280
|
+
uri: http://127.0.0.1:5005
|
281
|
+
secret: 'changeme'
|
282
|
+
|
283
|
+
- name: Ripple Hot Wallet
|
284
|
+
blockchain_key: xrp-testnet
|
285
|
+
currency_id: xrp
|
286
|
+
# Address where deposits will be collected to.
|
287
|
+
address: 'r4kpJtnx4goLYXoRdi7mbkRpZ9Xpx2RyPN' # IMPORTANT: Always wrap this value in quotes!
|
288
|
+
kind: hot # Wallet kind (deposit, hot, warm or cold).
|
289
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
290
|
+
max_balance: 100.0
|
291
|
+
status: active
|
292
|
+
gateway: rippled # Gateway client name.
|
293
|
+
settings:
|
294
|
+
#
|
295
|
+
# Geth gateway client settings.
|
296
|
+
uri: http://127.0.0.1:5005
|
297
|
+
secret: 'changeme'
|
298
|
+
|
299
|
+
- name: Ripple Warm Wallet
|
300
|
+
blockchain_key: xrp-testnet
|
301
|
+
currency_id: xrp
|
302
|
+
# Address where deposits will be collected to.
|
303
|
+
address: 'r4kpJtnx4goLYXoRdi7mbkRpZ9Xpx2RyPN' # IMPORTANT: Always wrap this value in quotes!
|
304
|
+
kind: warm # Wallet kind (deposit, hot, warm or cold).
|
305
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
306
|
+
max_balance: 1000.0
|
307
|
+
status: active
|
308
|
+
gateway: rippled # Gateway client name.
|
309
|
+
settings:
|
310
|
+
#
|
311
|
+
# Geth gateway client settings.
|
312
|
+
uri: http://user:password@127.0.0.1:5005
|
313
|
+
secret: 'changeme'
|
314
|
+
|
315
|
+
- name: Nxt Deposit Wallet
|
316
|
+
blockchain_key: nxt-testnet
|
317
|
+
currency_id: nxt
|
318
|
+
# Address where deposits will be collected to.
|
319
|
+
address: 'NXT-Y9NM-7HBT-7A8B-3YUHS' # IMPORTANT: Always wrap this value in quotes!
|
320
|
+
kind: deposit # Wallet kind (deposit, hot, warm or cold).
|
321
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
322
|
+
max_balance: 0.0
|
323
|
+
status: active
|
324
|
+
gateway: nxt # Gateway client name.
|
325
|
+
settings:
|
326
|
+
#
|
327
|
+
# Geth gateway client settings.
|
328
|
+
uri: http://127.0.0.1:6876
|
329
|
+
secret: 'changeme'
|
330
|
+
|
331
|
+
- name: Nxt Hot Wallet
|
332
|
+
blockchain_key: nxt-testnet
|
333
|
+
currency_id: nxt
|
334
|
+
# Address where deposits will be collected to.
|
335
|
+
address: 'NXT-Y9NM-7HBT-7A8B-3YUHS' # IMPORTANT: Always wrap this value in quotes!
|
336
|
+
kind: hot # Wallet kind (deposit, hot, warm or cold).
|
337
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
338
|
+
max_balance: 100.0
|
339
|
+
status: active
|
340
|
+
gateway: nxt # Gateway client name.
|
341
|
+
settings:
|
342
|
+
#
|
343
|
+
# Geth gateway client settings.
|
344
|
+
uri: http://127.0.0.1:6876
|
345
|
+
secret: 'changeme'
|
346
|
+
|
347
|
+
- name: Nxt Warm Wallet
|
348
|
+
blockchain_key: nxt-testnet
|
349
|
+
currency_id: nxt
|
350
|
+
# Address where deposits will be collected to.
|
351
|
+
address: 'NXT-Y9NM-7HBT-7A8B-3YUHS' # IMPORTANT: Always wrap this value in quotes!
|
352
|
+
kind: warm # Wallet kind (deposit, hot, warm or cold).
|
353
|
+
nsig: 1 # Number of signatures required for performing withdraw.
|
354
|
+
max_balance: 1000.0
|
355
|
+
status: active
|
356
|
+
gateway: nxt # Gateway client name.
|
357
|
+
settings:
|
358
|
+
#
|
359
|
+
# Geth gateway client settings.
|
360
|
+
uri: http://127.0.0.1:6876
|
361
|
+
secret: 'changeme'
|
362
|
+
<% end %>
|
363
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
|
2
|
+
module Peatio
|
3
|
+
module Ndex
|
4
|
+
# TODO: Processing of unconfirmed transactions from mempool isn't supported now.
|
5
|
+
class Blockchain < Peatio::Blockchain::Abstract
|
6
|
+
|
7
|
+
DEFAULT_FEATURES = {case_sensitive: true, cash_addr_format: false}.freeze
|
8
|
+
|
9
|
+
def initialize(*)
|
10
|
+
super
|
11
|
+
@json_rpc_call_id = 0
|
12
|
+
@json_rpc_endpoint = URI.parse(blockchain.server)
|
13
|
+
end
|
14
|
+
|
15
|
+
def endpoint
|
16
|
+
@json_rpc_endpoint
|
17
|
+
end
|
18
|
+
|
19
|
+
def latest_block_number
|
20
|
+
Rails.cache.fetch "latest_#{self.class.name.underscore}_block_number", expires_in: 5.seconds do
|
21
|
+
json_rpc({requestType: 'getBlocks', lastIndex: 0}).fetch('blocks')[0].fetch('height')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_block(block_hash)
|
26
|
+
json_rpc({requestType: 'getBlock', block: block_hash, includeTransactions: true})
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_block_hash(height)
|
30
|
+
current_block = height || 0
|
31
|
+
json_rpc({requestType: 'getBlockId', height: current_block}).fetch('block')
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_unconfirmed_txns
|
35
|
+
json_rpc({ requestType: 'getUnconfirmedTransactions'}).fetch('unconfirmedTransactions')
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_raw_transaction(txid)
|
39
|
+
json_rpc({ requestType: 'getTransaction', transaction: txid})
|
40
|
+
end
|
41
|
+
|
42
|
+
def build_transaction(tx, current_block, currency)
|
43
|
+
{ id: normalize_txid(tx.fetch('transaction')),
|
44
|
+
block_number: current_block,
|
45
|
+
entries: [
|
46
|
+
{
|
47
|
+
amount: convert_from_base_unit(tx.fetch('amountNQT'), currency),
|
48
|
+
address: normalize_address(tx['recipientRS'])
|
49
|
+
}
|
50
|
+
]
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_address(tx)
|
55
|
+
[normalize_address(tx.fetch('recipientRS'))]
|
56
|
+
end
|
57
|
+
|
58
|
+
def valid_transaction?(tx)
|
59
|
+
[0, '0'].include?(tx['type'])
|
60
|
+
end
|
61
|
+
|
62
|
+
def invalid_transaction?(tx)
|
63
|
+
!valid_transaction?(tx)
|
64
|
+
end
|
65
|
+
|
66
|
+
protected
|
67
|
+
|
68
|
+
def connection
|
69
|
+
Faraday.new(@json_rpc_endpoint).tap do |connection|
|
70
|
+
unless @json_rpc_endpoint.user.blank?
|
71
|
+
connection.basic_auth(@json_rpc_endpoint.user, @json_rpc_endpoint.password)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
memoize :connection
|
76
|
+
|
77
|
+
def json_rpc(params = {})
|
78
|
+
response = connection.post do |req|
|
79
|
+
req.url '/nxt?',
|
80
|
+
req.body = params
|
81
|
+
end
|
82
|
+
response.assert_success!
|
83
|
+
response = JSON.parse(response.body)
|
84
|
+
response['errorDescription'].tap { |error| raise Error, error.inspect if error }
|
85
|
+
response
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'memoist'
|
2
|
+
require 'faraday'
|
3
|
+
require 'better-faraday'
|
4
|
+
|
5
|
+
module Peatio
|
6
|
+
module Ndex
|
7
|
+
class Client
|
8
|
+
Error = Class.new(StandardError)
|
9
|
+
class ConnectionError < Error; end
|
10
|
+
|
11
|
+
class ResponseError < Error
|
12
|
+
def initialize(code, msg)
|
13
|
+
@code = code
|
14
|
+
@msg = msg
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(*)
|
18
|
+
super
|
19
|
+
@json_rpc_endpoint = URI.parse(wallet.uri)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_address!(options = {})
|
23
|
+
secret = options.fetch(:secret) { Passgen.generate(length: 64, symbols: true) }
|
24
|
+
{
|
25
|
+
address: normalize_address(json_rpc({requestType: 'getAccountId', secretPhrase: secret}).fetch('accountRS')),
|
26
|
+
secret: secret
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_withdrawal!(issuer, recipient, amount, options = {})
|
31
|
+
withdrawal_request(issuer, recipient, amount, options).fetch('transactionJSON').yield_self do |txn|
|
32
|
+
normalize_txid(txn['transaction'])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_txn_fee(issuer, recipient, amount, options = {})
|
37
|
+
withdrawal_request(issuer, recipient, amount, options).fetch('transactionJSON').yield_self do |txn|
|
38
|
+
convert_from_base_unit(txn['feeNQT'])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def inspect_address!(address)
|
43
|
+
{ address: normalize_address(address),
|
44
|
+
is_valid: true }
|
45
|
+
end
|
46
|
+
|
47
|
+
def normalize_address(address)
|
48
|
+
address.upcase
|
49
|
+
end
|
50
|
+
|
51
|
+
def normalize_txid(txid)
|
52
|
+
txid.downcase
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
protected
|
57
|
+
|
58
|
+
def connection
|
59
|
+
Faraday.new(@json_rpc_endpoint).tap do |connection|
|
60
|
+
unless @json_rpc_endpoint.user.blank?
|
61
|
+
connection.basic_auth(@json_rpc_endpoint.user, @json_rpc_endpoint.password)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
memoize :connection
|
66
|
+
|
67
|
+
def json_rpc(params = {})
|
68
|
+
response = connection.post do |req|
|
69
|
+
req.url '/nxt?',
|
70
|
+
req.body = params
|
71
|
+
end
|
72
|
+
response.assert_success!
|
73
|
+
response = JSON.parse(response.body)
|
74
|
+
response['errorDescription'].tap { |error| raise Error, error.inspect if error }
|
75
|
+
response
|
76
|
+
end
|
77
|
+
|
78
|
+
def withdrawal_request(issuer, recipient, amount, options = {})
|
79
|
+
json_rpc(
|
80
|
+
{
|
81
|
+
requestType: 'sendMoney',
|
82
|
+
secretPhrase: issuer.fetch(:secret),
|
83
|
+
recipient: normalize_address(recipient.fetch(:address)),
|
84
|
+
amountNQT: convert_to_base_unit!(amount),
|
85
|
+
deadline: 60,
|
86
|
+
feeNQT: options.has_key?(:feeNQT) ? options[:feeNQT] : 0,
|
87
|
+
broadcast: options.has_key?(:broadcast) ? options[:broadcast] : true
|
88
|
+
}
|
89
|
+
)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Peatio
|
2
|
+
module Ndex
|
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
|
+
"Ndex blockchain version requiremnt was not suttisfied by Peatio::Blockchain.",
|
13
|
+
"Ndex 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
|
+
"Ndex wallet version requiremnt was not suttisfied by Peatio::Wallet.",
|
22
|
+
"Ndex 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[:ndex] = Ndex::Blockchain.new
|
30
|
+
Peatio::Wallet.registry[:ndexd] = Ndex::Wallet.new
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
if defined?(Rails::Railtie)
|
35
|
+
require "peatio/ndex/railtie"
|
36
|
+
else
|
37
|
+
check_compatibility
|
38
|
+
register
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/peatio/ndex/version.rb
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
module Peatio
|
2
|
+
module Ndex
|
3
|
+
class Wallet < Peatio::Wallet::Abstract
|
4
|
+
|
5
|
+
def initialize(*)
|
6
|
+
super
|
7
|
+
@json_rpc_call_id = 0
|
8
|
+
@json_rpc_endpoint = URI.parse(blockchain.server)
|
9
|
+
end
|
10
|
+
|
11
|
+
def endpoint
|
12
|
+
@json_rpc_endpoint
|
13
|
+
end
|
14
|
+
|
15
|
+
def latest_block_number
|
16
|
+
Rails.cache.fetch "latest_#{self.class.name.underscore}_block_number", expires_in: 5.seconds do
|
17
|
+
json_rpc({requestType: 'getBlocks', lastIndex: 0}).fetch('blocks')[0].fetch('height')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_block(block_hash)
|
22
|
+
json_rpc({requestType: 'getBlock', block: block_hash, includeTransactions: true})
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_block_hash(height)
|
26
|
+
current_block = height || 0
|
27
|
+
json_rpc({requestType: 'getBlockId', height: current_block}).fetch('block')
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_unconfirmed_txns
|
31
|
+
json_rpc({ requestType: 'getUnconfirmedTransactions'}).fetch('unconfirmedTransactions')
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_raw_transaction(txid)
|
35
|
+
json_rpc({ requestType: 'getTransaction', transaction: txid})
|
36
|
+
end
|
37
|
+
|
38
|
+
def build_transaction(tx, current_block, currency)
|
39
|
+
{ id: normalize_txid(tx.fetch('transaction')),
|
40
|
+
block_number: current_block,
|
41
|
+
entries: [
|
42
|
+
{
|
43
|
+
amount: convert_from_base_unit(tx.fetch('amountNQT'), currency),
|
44
|
+
address: normalize_address(tx['recipientRS'])
|
45
|
+
}
|
46
|
+
]
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_address(tx)
|
51
|
+
[normalize_address(tx.fetch('recipientRS'))]
|
52
|
+
end
|
53
|
+
|
54
|
+
def valid_transaction?(tx)
|
55
|
+
[0, '0'].include?(tx['type'])
|
56
|
+
end
|
57
|
+
|
58
|
+
def invalid_transaction?(tx)
|
59
|
+
!valid_transaction?(tx)
|
60
|
+
end
|
61
|
+
|
62
|
+
protected
|
63
|
+
|
64
|
+
def connection
|
65
|
+
Faraday.new(@json_rpc_endpoint).tap do |connection|
|
66
|
+
unless @json_rpc_endpoint.user.blank?
|
67
|
+
connection.basic_auth(@json_rpc_endpoint.user, @json_rpc_endpoint.password)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
memoize :connection
|
72
|
+
|
73
|
+
def json_rpc(params = {})
|
74
|
+
response = connection.post do |req|
|
75
|
+
req.url '/nxt?',
|
76
|
+
req.body = params
|
77
|
+
end
|
78
|
+
response.assert_success!
|
79
|
+
response = JSON.parse(response.body)
|
80
|
+
response['errorDescription'].tap { |error| raise Error, error.inspect if error }
|
81
|
+
response
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
data/peatio-ndex.gemspec
CHANGED
@@ -34,15 +34,16 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.bindir = "exe"
|
35
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
36
|
spec.require_paths = ["lib"]
|
37
|
-
|
37
|
+
spec.add_dependency "activesupport", "~> 5.2.3"
|
38
38
|
spec.add_dependency "better-faraday", "~> 1.0.5"
|
39
39
|
spec.add_dependency "faraday", "~> 0.15.4"
|
40
40
|
spec.add_dependency "memoist", "~> 0.16.0"
|
41
|
-
spec.add_dependency "peatio", "
|
41
|
+
spec.add_dependency "peatio", "= 2.4.3"
|
42
|
+
|
42
43
|
|
43
|
-
spec.add_development_dependency "bundler", "~> 1.
|
44
|
+
spec.add_development_dependency "bundler", "~> 1.17.3"
|
44
45
|
spec.add_development_dependency "mocha", "~> 1.8"
|
45
|
-
spec.add_development_dependency "pry-byebug"
|
46
|
+
spec.add_development_dependency "pry-byebug", "~> 3.7"
|
46
47
|
spec.add_development_dependency "rake", "~> 10.0"
|
47
48
|
spec.add_development_dependency "rspec", "~> 3.0"
|
48
49
|
spec.add_development_dependency "webmock", "~> 3.5"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peatio-ndex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BitBD
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -70,30 +70,30 @@ dependencies:
|
|
70
70
|
name: peatio
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.4.3
|
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:
|
82
|
+
version: 2.4.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.17.3
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.17.3
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: mocha
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: pry-byebug
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '3.7'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '3.7'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rake
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,8 +180,19 @@ files:
|
|
180
180
|
- Rakefile
|
181
181
|
- bin/console
|
182
182
|
- bin/setup
|
183
|
+
- config/blockchains.yml
|
184
|
+
- config/currencies.yml
|
185
|
+
- config/wallets.yml
|
183
186
|
- lib/peatio/ndex.rb
|
187
|
+
- lib/peatio/ndex/blockchain.rb
|
188
|
+
- lib/peatio/ndex/client.rb
|
189
|
+
- lib/peatio/ndex/hooks.rb
|
190
|
+
- lib/peatio/ndex/railtie.rb
|
184
191
|
- lib/peatio/ndex/version.rb
|
192
|
+
- lib/peatio/ndex/wallet.rb
|
193
|
+
- peatio-ndex-0.1.0.gem
|
194
|
+
- peatio-ndex-0.1.1.gem
|
195
|
+
- peatio-ndex-0.1.2.gem
|
185
196
|
- peatio-ndex.gemspec
|
186
197
|
homepage: https://www.ndexnetwork.com
|
187
198
|
licenses:
|
@@ -205,8 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
216
|
- !ruby/object:Gem::Version
|
206
217
|
version: '0'
|
207
218
|
requirements: []
|
208
|
-
|
209
|
-
rubygems_version: 2.7.6
|
219
|
+
rubygems_version: 3.0.1
|
210
220
|
signing_key:
|
211
221
|
specification_version: 4
|
212
222
|
summary: Peatio Blockchain Plugin
|