minter 0.5.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9f82c0e58ece67accaabf56e1159401fa3dc73719579f97f117089db5b8ad50
4
- data.tar.gz: 5e51d21092dc4e34c089027a34609d4fe8e5b7f7ad1ebac6f57b09b34575e088
3
+ metadata.gz: e10891bf917d27419af0d90b52cc7d4d5a2de676da0b7be134b0bddf50df6a2c
4
+ data.tar.gz: 939bba264597e2812c07af37a2b4d73ddf1a2feb0564cfada331c72ce7b96d4c
5
5
  SHA512:
6
- metadata.gz: afda78859539b8f238922b97fa4ee523541c3c0516076577ff26fccaf4d9ef5c8a4ad285da3f394c26451088a2b364a769ed2de1aafadd939427ce549b8e93e7
7
- data.tar.gz: b9419dd6548010405d5ce2cce06a29836cc36a8ba4886bff039c5f87446b80c07a66ff9068dbddd2795e7aa3d69078ac984615de4a24593f930a4de0695b6db1
6
+ metadata.gz: 802ddfd9fffc238d336c4f1e5467e08cbbc43d45f9e903d4bfda8d61ae68a2cb18869c23cd95e0907241e41f8a2010c96a02bd424683d9f1aa5985003e5d71a4
7
+ data.tar.gz: 628e29cc4b4f5c41d573bbb75b5b3af1ec5b251c60588bd4f19e26eab560d2caace416c85de6fbe67a37dba7cc20b79b89cecfce5c25b6f93b8ec2d31bf7b0c0
data/README.md CHANGED
@@ -92,7 +92,7 @@ Create Minter::Api client
92
92
  require "minter"
93
93
 
94
94
  client = Minter::Api::Client.new
95
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
95
+ client.node_url = "https://node-api.testnet.minter.network/v2"
96
96
  ```
97
97
 
98
98
  ### Address
@@ -101,14 +101,14 @@ Returns coins list, balance and transaction count (for nonce) of an address.
101
101
 
102
102
  ```ruby
103
103
  client = Minter::Api::Client.new
104
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
104
+ client.node_url = "https://node-api.testnet.minter.network/v2"
105
105
 
106
106
  address = "Mx251cb0043a0240779103aa7c210f638f887699f8"
107
107
  response = client.address(address: address)
108
108
  response.status
109
109
  #=> 200
110
110
  response.body
111
- #=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>{"balance"=>{"DEVDEV"=>"1000000000000002000", "DEVTWO"=>"1000000000000000000", "MNT"=>"66565140000000800001000"}, "transaction_count"=>"31"}}
111
+ #=> {"balance"=>[{"coin"=>{"id"=>"0", "symbol"=>"MNT"}, "value"=>"29999857000000000000000", "bip_value"=>"29999857000000000000000"}], "delegated"=>[], "total"=>[], "transaction_count"=>"13", "bip_value"=>"29999857000000000000000"}
112
112
  ````
113
113
 
114
114
  ### Address at height
@@ -117,14 +117,14 @@ Returns coins list, balance and transaction count (for nonce) of an address.
117
117
 
118
118
  ```ruby
119
119
  client = Minter::Api::Client.new
120
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
120
+ client.node_url = "https://node-api.testnet.minter.network/v2"
121
121
 
122
122
  address = "Mx251cb0043a0240779103aa7c210f638f887699f8"
123
123
  response = client.address(address: address, height: 1)
124
124
  response.status
125
125
  #=> 200
126
126
  response.body
127
- #=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>{"balance"=>{"MNT"=>"0"}, "transaction_count"=>"0"}}
127
+ #=> {"balance"=>[], "delegated"=>[], "total"=>[], "transaction_count"=>"0", "bip_value"=>"0"}
128
128
 
129
129
  ````
130
130
 
@@ -134,14 +134,14 @@ Returns coins list, balance and transaction count (for nonce) of an address.
134
134
 
135
135
  ```ruby
136
136
  client = Minter::Api::Client.new
137
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
137
+ client.node_url = "https://node-api.testnet.minter.network/v2"
138
138
 
139
139
  address = "Mx251cb0043a0240779103aa7c210f638f887699f8"
140
140
  response = client.balance(address: address)
141
141
  response.status
142
142
  #=> 200
143
143
  response.body
144
- #=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>{"balance"=>{"DEVDEV"=>"1000000000000002000", "DEVTWO"=>"1000000000000000000", "MNT"=>"66565140000000800001000"}, "transaction_count"=>"31"}}
144
+ #=> {"balance"=>[{"coin"=>{"id"=>"0", "symbol"=>"MNT"}, "value"=>"29999857000000000000000", "bip_value"=>"29999857000000000000000"}], "delegated"=>[], "total"=>[], "transaction_count"=>"13", "bip_value"=>"29999857000000000000000"}
145
145
  ````
146
146
 
147
147
 
@@ -152,11 +152,11 @@ Returns next transaction number (nonce) of an address.
152
152
 
153
153
  ```ruby
154
154
  client = Minter::Api::Client.new
155
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
155
+ client.node_url = "https://node-api.testnet.minter.network/v2"
156
156
 
157
157
  address = "Mx251cb0043a0240779103aa7c210f638f887699f8"
158
158
  nonce = client.nonce(address: address)
159
- #=> 28
159
+ #=> 14
160
160
  ```
161
161
 
162
162
  ### Block
@@ -165,22 +165,14 @@ Returns block data at given height.
165
165
 
166
166
  ```ruby
167
167
  client = Minter::Api::Client.new
168
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
168
+ client.node_url = "https://node-api.testnet.minter.network/v2"
169
169
 
170
170
  response = client.block(height: 1)
171
171
  response.status
172
172
  #=> 200
173
173
  response.body
174
- #=> {"jsonrpc"=>"2.0",
175
- # "id"=>"",
176
- # "result"=>
177
- # {"hash"=>"499a3ba23ec8a046eb7d1eecdf4123b795e2ba3df0e57122f75fa656144553ea",
178
- # "height"=>"1",
179
- # "time"=>"2020-04-08T13:00:00Z",
180
- # "num_txs"=>"0",
181
- # "transactions"=>[],
182
- # "block_reward"=>"331000000000000000000",
183
- # "size"=>"280"}}
174
+ #=> {"hash"=>"8e2534065f3fb281b3834ae79383cd75cb06245b33bd96a0d87370340039f7bc", "height"=>"1", "time"=>"1970-01-01T00:00:00Z", "transaction_count"=>"0", "transactions"=>[], "block_reward"=>"333000000000000000000", "size"=>"270", "proposer"=>"Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5", "validators"=>[{"public_key"=>"Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5", "signed"=>false}], "evidence"=>{"evidence"=>[]}, "missed"=>[]}
175
+
184
176
 
185
177
  ```
186
178
 
@@ -190,23 +182,14 @@ Returns candidate’s info by provided public_key. It will respond with 404 code
190
182
 
191
183
  ```ruby
192
184
  client = Minter::Api::Client.new
193
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
185
+ client.node_url = "https://node-api.testnet.minter.network/v2"
194
186
 
195
- public_key = "Mp4d2900d19ee3ce815bdb38daa3bc8d15c2bbe4945c3cdfac80df3ae6da31464b"
187
+ public_key = "Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5"
196
188
  response = client.candidate(public_key: public_key)
197
189
  response.status
198
190
  #=> 200
199
191
  response.body
200
- #=> {"jsonrpc"=>"2.0",
201
- # "id"=>"",
202
- # "result"=>
203
- # {"reward_address"=>"Mx251cb0043a0240779103aa7c210f638f887699f8",
204
- # "owner_address"=>"Mx251cb0043a0240779103aa7c210f638f887699f8",
205
- # "total_stake"=>"4950000000000000000",
206
- # "pub_key"=>"Mp4d2900d19ee3ce815bdb38daa3bc8d15c2bbe4945c3cdfac80df3ae6da31464b",
207
- # "commission"=>"10",
208
- # "stakes"=>[{"owner"=>"Mx251cb0043a0240779103aa7c210f638f887699f8", "coin"=>"MNT", "value"=>"4950000000000000000", "bip_value"=>"4950000000000000000"}],
209
- # "status"=>1}}
192
+ #=> {"reward_address"=>"Mxa83d8ebbe688b853775a698683b77afa305a661e", "owner_address"=>"Mxa83d8ebbe688b853775a698683b77afa305a661e", "control_address"=>"Mxa83d8ebbe688b853775a698683b77afa305a661e", "total_stake"=>"2444011225306401876946221", "public_key"=>"Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5", "commission"=>"5", "used_slots"=>"10", "uniq_users"=>"6", "min_stake"=>"0", "stakes"=>[{"owner"=>"Mxa83d8ebbe688b853775a698683b77afa305a661e", "coin"=>{"id"=>"0", "symbol"=>"MNT"}, "value"=>"1000000000000000000000000", "bip_value"=>"1000000000000000000000000"}, {"owner"=>"Mx69ebd94f75444b22953c7a439f7ccef6d9e9be5a", "coin"=>{"id"=>"0", "symbol"=>"MNT"}, "value"=>"10000000000000000000", "bip_value"=>"10000000000000000000"}, {"owner"=>"Mx3e3b5d6087f58f2592623a62da9618a2ee020d2d", "coin"=>{"id"=>"0", "symbol"=>"MNT"}, "value"=>"824272819147233530716891", "bip_value"=>"824272819147233530716891"}, {"owner"=>"Mxeb92ae39b84012968f63b2dd260a94d791fe79bd", "coin"=>{"id"=>"0", "symbol"=>"MNT"}, "value"=>"609007403767000000000000", "bip_value"=>"609007403767000000000000"}, {"owner"=>"Mxeb92ae39b84012968f63b2dd260a94d791fe79bd", "coin"=>{"id"=>"5", "symbol"=>"SMALCOIN-1"}, "value"=>"27704575686000000000000", "bip_value"=>"163214040105490477218"}, {"owner"=>"Mxeb92ae39b84012968f63b2dd260a94d791fe79bd", "coin"=>{"id"=>"6", "symbol"=>"SMALCOIN"}, "value"=>"23500946264000000000000", "bip_value"=>"5258446493070597814637"}, {"owner"=>"Mxeb92ae39b84012968f63b2dd260a94d791fe79bd", "coin"=>{"id"=>"1", "symbol"=>"CUSTOM"}, "value"=>"7648158824000000000000", "bip_value"=>"1530873792242471521"}, {"owner"=>"Mxeb92ae39b84012968f63b2dd260a94d791fe79bd", "coin"=>{"id"=>"4", "symbol"=>"BIGCOIN"}, "value"=>"22993066314000000000000", "bip_value"=>"5286810985200015465954"}, {"owner"=>"Mxeeda61bbe9929bf883af6b22f5796e4b92563ba4", "coin"=>{"id"=>"0", "symbol"=>"MNT"}, "value"=>"5000000000000000000", "bip_value"=>"5000000000000000000"}, {"owner"=>"Mx0004ae43810ac75200a0c681487d1748a4f1e0b3", "coin"=>{"id"=>"0", "symbol"=>"MNT"}, "value"=>"6000000000000000000", "bip_value"=>"6000000000000000000"}], "status"=>"2"}
210
193
  ```
211
194
  ### Candidates
212
195
 
@@ -214,29 +197,27 @@ Returns list of candidates.
214
197
 
215
198
  ```ruby
216
199
  client = Minter::Api::Client.new
217
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
200
+ client.node_url = "https://node-api.testnet.minter.network/v2"
218
201
 
219
202
  response = client.candidates
220
203
  response.status
221
204
  #=> 200
222
205
  response.body
223
- #=> {"jsonrpc"=>"2.0",
224
- # "id"=>"",
225
- # "result"=>
226
- # [
227
- # {"reward_address"=>"Mx9816046484c7c50fc43d5a564cadb494910a27b7",
228
- # "owner_address"=>"Mx9816046484c7c50fc43d5a564cadb494910a27b7",
229
- # "total_stake"=>"100019333250000000000000",
230
- # "pub_key"=>"Mpf17328239cd81453b9e9393f66137e5442fb108c7b4fc36b6acfd838f7e6e0c4",
231
- # "commission"=>"85",
232
- # "status"=>2},
233
- # {"reward_address"=>"Mx69ebd94f75444b22953c7a439f7ccef6d9e9be5a",
234
- # "owner_address"=>"Mx3b3af9a8520910b29735ca44a64f52f09f057d64",
235
- # "total_stake"=>"49500000000000000000",
236
- # "pub_key"=>"Mpab7a9b763569a45b3221d4276e72466c225524354eee6c7d2e12858ac0eef864",
237
- # "commission"=>"1",
238
- # "status"=>1}
239
- # ]
206
+ {
207
+ "candidates" => [{
208
+ "reward_address" => "Mxa83d8ebbe688b853775a698683b77afa305a661e",
209
+ "owner_address" => "Mxa83d8ebbe688b853775a698683b77afa305a661e",
210
+ "control_address" => "Mxa83d8ebbe688b853775a698683b77afa305a661e",
211
+ "total_stake" => "1000000000000000000000000",
212
+ "public_key" => "Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5",
213
+ "commission" => "5",
214
+ "used_slots" => nil,
215
+ "uniq_users" => nil,
216
+ "min_stake" => nil,
217
+ "stakes" => [],
218
+ "status" => "2"
219
+ }]
220
+ }
240
221
  ```
241
222
 
242
223
  ### CoinInfo
@@ -246,7 +227,7 @@ Note: this method does not return information about base coins (MNT and BIP).
246
227
 
247
228
  ```ruby
248
229
  client = Minter::Api::Client.new
249
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
230
+ client.node_url = "https://node-api.testnet.minter.network/v2"
250
231
 
251
232
  response = client.coin_info("CAPITAL")
252
233
  response.status
@@ -269,7 +250,7 @@ Return estimate of buy coin transaction.
269
250
 
270
251
  ```ruby
271
252
  client = Minter::Api::Client.new
272
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
253
+ client.node_url = "https://node-api.testnet.minter.network/v2"
273
254
 
274
255
  response = client.estimate_coin_buy(coinToSell: "BIP", valueToBuy: 1, coinToBuy: "MNT")
275
256
  response.status
@@ -282,7 +263,7 @@ Return estimate of sell coin transaction.
282
263
 
283
264
  ```ruby
284
265
  client = Minter::Api::Client.new
285
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
266
+ client.node_url = "https://node-api.testnet.minter.network/v2"
286
267
 
287
268
  response = client.estimate_coin_sell(coinToSell: "BIP", valueToSell: 1, coinToBuy: "MNT")
288
269
  response.status
@@ -294,7 +275,7 @@ Return estimate of transaction.
294
275
 
295
276
  ```ruby
296
277
  client = Minter::Api::Client.new
297
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
278
+ client.node_url = "https://node-api.testnet.minter.network/v2"
298
279
 
299
280
  response = client.estimate_tx_comission(transaction: "0xf88522020a8a4d4e540000000000000001abea8a4d4e540000000000000094e7812ab98ac5ac37e2ab20da3136ad91bb22d49789014d1120d7b1600000808001b845f8431ba07424d88d612132c847c1c92c1f471471fa8034914260223cb547f097e2bd7587a0201fa4d869ba564538996a71e6aa1e2b069d746b8fa0a563e023989986ae91a7")
300
281
  ```
@@ -305,7 +286,7 @@ Returns events at given height.
305
286
 
306
287
  ```ruby
307
288
  client = Minter::Api::Client.new
308
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
289
+ client.node_url = "https://node-api.testnet.minter.network/v2"
309
290
 
310
291
  response = client.events(height: 1)
311
292
  ```
@@ -317,13 +298,13 @@ Returns current max gas.
317
298
 
318
299
  ```ruby
319
300
  client = Minter::Api::Client.new
320
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
301
+ client.node_url = "https://node-api.testnet.minter.network/v2"
321
302
 
322
303
  response = client.max_gas
323
304
  response.status
324
305
  #=>200
325
306
  response.body
326
- #=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>"100000"}
307
+ #=> {"max_gas_price"=>"100000"}
327
308
  ```
328
309
 
329
310
  ### MinGasPrice
@@ -332,13 +313,13 @@ Returns current min gas price.
332
313
 
333
314
  ```ruby
334
315
  client = Minter::Api::Client.new
335
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
316
+ client.node_url = "https://node-api.testnet.minter.network/v2"
336
317
 
337
318
  response = client.min_gas_price
338
319
  response.status
339
320
  #=>200
340
321
  response.body
341
- #=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>"1"}
322
+ #=> {"min_gas_price"=>"1"}
342
323
 
343
324
  ```
344
325
 
@@ -348,7 +329,7 @@ Returns missed blocks by validator public key.
348
329
 
349
330
  ```ruby
350
331
  client = Minter::Api::Client.new
351
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
332
+ client.node_url = "https://node-api.testnet.minter.network/v2"
352
333
 
353
334
  response = client.missed_block(public_key: public_key)
354
335
  ```
@@ -366,7 +347,7 @@ response.status
366
347
  #=> 200
367
348
  response.body
368
349
  #=>
369
- {"jsonrpc"=>"2.0", "id"=>"", "result"=>{"code"=>0, "data"=>"", "log"=>"", "hash"=>"9219C1FA06D72C2A4ACDFB4D20F52E3F536C6134E20F485F1E2EA6D71C0DFA20"}}
350
+ {"code"=>"0", "log"=>"", "hash"=>"Mt0cfac66950c621db243fcdd68530b455f2c579dda7a7c602822355a80e9815d2"}
370
351
  ```
371
352
 
372
353
  ### Status
@@ -375,40 +356,26 @@ Returns node status info.
375
356
 
376
357
  ```ruby
377
358
  client = Minter::Api::Client.new
378
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
359
+ client.node_url = "https://node-api.testnet.minter.network/v2"
379
360
 
380
361
  response = client.status
381
362
  response.status
382
363
  #=>200
383
364
  response.body
384
365
  #=>
385
- {"jsonrpc"=>"2.0",
386
- "id"=>"",
387
- "result"=>
388
- {"version"=>"1.1.6-testnet",
389
- "latest_block_hash"=>"E20E0B26DAB8CEE5AC1CB46B5184C63565522978EDF153DA3017C7D34F2D3F30",
390
- "latest_app_hash"=>"995C21A980D4E0A7649E56252CB4E279A5820655B717A017FC09FE2E9D841554",
391
- "latest_block_height"=>"702448",
392
- "latest_block_time"=>"2020-05-12T20:59:23.252868652Z",
393
- "keep_last_states"=>"120",
394
- "tm_status"=>
395
- {"node_info"=>
396
- {"protocol_version"=>{"p2p"=>"7", "block"=>"10", "app"=>"6"},
397
- "id"=>"4735e67924e611b89fbd3f951441b5e912e226d3",
398
- "listen_addr"=>"tcp://0.0.0.0:26656",
399
- "network"=>"minter-testnet-08-04",
400
- "version"=>"0.33.2",
401
- "channels"=>"4020212223303800",
402
- "moniker"=>"minter-node-1.testnet.minter.network",
403
- "other"=>{"tx_index"=>"on", "rpc_address"=>"tcp://127.0.0.1:26657"}},
404
- "sync_info"=>
405
- {"latest_block_hash"=>"E20E0B26DAB8CEE5AC1CB46B5184C63565522978EDF153DA3017C7D34F2D3F30",
406
- "latest_app_hash"=>"995C21A980D4E0A7649E56252CB4E279A5820655B717A017FC09FE2E9D841554",
407
- "latest_block_height"=>"702448",
408
- "latest_block_time"=>"2020-05-12T20:59:23.252868652Z",
409
- "catching_up"=>false},
410
- "validator_info"=>
411
- {"address"=>"43253BE55C58BCA3045BEFABEF873944B56E3555", "pub_key"=>{"type"=>"tendermint/PubKeyEd25519", "value"=>"DSmoPlRlOh1fNOVh4BNfHoHLyuFS8fMnqzaFen4y3kw="}, "voting_power"=>"98784385"}}}}
366
+ {
367
+ "version" => "1.2.0-a7c02e42-testnet",
368
+ "network" => "minter-1-2-testnet",
369
+ "latest_block_hash" => "553F412E3BDD05932F96AFC79C750ACCB6C6D65D253D627A9D8A88D5C893CD1A",
370
+ "latest_app_hash" => "4337152D2F002F604CF338C29BC4AA1AF1729A93228E074153FDFF722CE33324",
371
+ "latest_block_height" => "281797",
372
+ "latest_block_time" => "2020-11-05T06:05:39.586760081Z",
373
+ "keep_last_states" => "1000000",
374
+ "total_slashed" => "433000000000000015854",
375
+ "catching_up" => false,
376
+ "public_key" => "Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5",
377
+ "node_id" => "95fa41d84670bc98691101406d62aed9d64459f4"
378
+ }
412
379
 
413
380
  ```
414
381
 
@@ -418,32 +385,30 @@ Returns transaction info.
418
385
 
419
386
  ```ruby
420
387
  client = Minter::Api::Client.new
421
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
388
+ client.node_url = "https://node-api.testnet.minter.network/v2"
422
389
 
423
- transaction_hash = "Mt56c1957d15bf4143f7cd180f837bce51564a054cfbdaf5c5e179f9b0aad8e8b2"
390
+ transaction_hash = "Mt0cfac66950c621db243fcdd68530b455f2c579dda7a7c602822355a80e9815d2"
424
391
 
425
392
  response = client.transaction_info(transaction_hash: transaction_hash)
426
393
  response.status
427
394
  #=>200
428
395
  response.body
429
396
  #=>
430
- {"jsonrpc"=>"2.0",
431
- "id"=>"",
432
- "result"=>
433
- {"hash"=>"56C1957D15BF4143F7CD180F837BCE51564A054CFBDAF5C5E179F9B0AAD8E8B2",
434
- "raw_tx"=>
435
- "f88522020a8a4d4e540000000000000001abea8a4d4e540000000000000094e7812ab98ac5ac37e2ab20da3136ad91bb22d49789014d1120d7b1600000808001b845f8431ba07424d88d612132c847c1c92c1f471471fa8034914260223cb547f097e2bd7587a0201fa4d869ba564538996a71e6aa1e2b069d746b8fa0a563e023989986ae91a7",
436
- "height"=>"701284",
437
- "index"=>0,
438
- "from"=>"Mx251cb0043a0240779103aa7c210f638f887699f8",
439
- "nonce"=>"34",
440
- "gas"=>"10",
441
- "gas_price"=>10,
442
- "gas_coin"=>"MNT",
443
- "type"=>1,
444
- "data"=>{"coin"=>"MNT", "to"=>"Mxe7812ab98ac5ac37e2ab20da3136ad91bb22d497", "value"=>"24000000000000000000"},
445
- "payload"=>"",
446
- "tags"=>{"tx.type"=>"01", "tx.from"=>"251cb0043a0240779103aa7c210f638f887699f8", "tx.to"=>"e7812ab98ac5ac37e2ab20da3136ad91bb22d497", "tx.coin"=>"MNT"}}}
397
+ {
398
+ "hash" => "Mt0cfac66950c621db243fcdd68530b455f2c579dda7a7c602822355a80e9815d2", "raw_tx" => "f86f0e020180019fde8094eeee1973381ab793719fff497b9a516719fcd5a287038d7ea4c68000808001b845f8431ba0b4f6ef634625c12a7cb08ca568dca87fec2ca696bde99f2669c4e297748ce7a2a00ba8fab69667b0d849054ac8d21c3194f1dfcfca01ddafacd19d0e7f708933bd", "height" => "281792", "index" => "0", "from" => "Mx251cb0043a0240779103aa7c210f638f887699f8", "nonce" => "14", "gas" => "10", "gas_price" => "1", "gas_coin" => {
399
+ "id" => "0", "symbol" => "MNT"
400
+ },
401
+ "type" => "1", "data" => {
402
+ "@type" => "type.googleapis.com/api_pb.SendData", "coin" => {
403
+ "id" => "0", "symbol" => "MNT"
404
+ }, "to" => "Mxeeee1973381ab793719fff497b9a516719fcd5a2", "value" => "1000000000000000"
405
+ },
406
+ "payload" => nil, "tags" => {
407
+ "tx.coin_id" => "0", "tx.from" => "251cb0043a0240779103aa7c210f638f887699f8", "tx.to" => "eeee1973381ab793719fff497b9a516719fcd5a2", "tx.type" => "01"
408
+ },
409
+ "code" => "0",
410
+ "log" => ""
411
+ }
447
412
  ```
448
413
 
449
414
  ### Transactions
@@ -452,34 +417,14 @@ Return transactions by query.
452
417
 
453
418
  ```ruby
454
419
  client = Minter::Api::Client.new
455
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
420
+ client.node_url = "https://node-api.testnet.minter.network/v2"
456
421
 
457
- query = "tags.tx.coin='MNT'"
422
+ query = "tags.tx.coin='0'"
458
423
  page = 1
459
424
  per_page = 1
460
425
  response = client.transactions(query: query, per_page: per_page, page: page)
461
426
  response.status
462
427
  #=> 200
463
- response.body
464
- #=>
465
- {"jsonrpc"=>"2.0",
466
- "id"=>"",
467
- "result"=>
468
- [{"hash"=>"9398DB947BC1397212C3F7FBE3D4131E68DDD1CA5AD36860DF5D7700E1C279EB",
469
- "raw_tx"=>
470
- "f87e82229102018a4d4e540000000000000001a2e18a4d4e540000000000000094a1f103c242237370d409ff5ff9f1817d42f94dda80808001b845f8431ba0a377be8dcab2a0cd005a8b392876724ed97aea4c312dc1081f581384ec938a1da01851f86f174c6d104ebb61cdab4e38056641147777e12e1184d8140c2b85d080",
471
- "height"=>"702308",
472
- "index"=>0,
473
- "from"=>"Mxa1f103c242237370d409ff5ff9f1817d42f94dda",
474
- "nonce"=>"8849",
475
- "gas"=>"10",
476
- "gas_price"=>1,
477
- "gas_coin"=>"MNT",
478
- "type"=>1,
479
- "data"=>{"coin"=>"MNT", "to"=>"Mxa1f103c242237370d409ff5ff9f1817d42f94dda", "value"=>"0"},
480
- "payload"=>"",
481
- "tags"=>{"tx.type"=>"01", "tx.from"=>"a1f103c242237370d409ff5ff9f1817d42f94dda", "tx.to"=>"a1f103c242237370d409ff5ff9f1817d42f94dda", "tx.coin"=>"MNT"}}]}
482
-
483
428
  ```
484
429
 
485
430
  ### Unconfirmed Transactions
@@ -489,7 +434,7 @@ Returns unconfirmed transactions.
489
434
 
490
435
  ```ruby
491
436
  client = Minter::Api::Client.new
492
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
437
+ client.node_url = "https://node-api.testnet.minter.network/v2"
493
438
 
494
439
  query = "tags.tx.coin='MNT'"
495
440
  page = 1
@@ -497,9 +442,6 @@ per_page = 1
497
442
  response = client.unconfirmed_transactions
498
443
  response.status
499
444
  #=> 200
500
- response.body
501
- #=>
502
- {"jsonrpc"=>"2.0", "id"=>"", "result"=>{"n_txs"=>"0", "total"=>"0", "total_bytes"=>"0", "txs"=>[]}}
503
445
  ```
504
446
 
505
447
  ### Validators
@@ -508,21 +450,14 @@ Returns list of active validators.
508
450
 
509
451
  ```ruby
510
452
  client = Minter::Api::Client.new
511
- client.node_url = "https://minter-node-1.testnet.minter.network:8841"
453
+ client.node_url = "https://node-api.testnet.minter.network/v2"
512
454
 
513
455
  response = client.validators
514
456
  response.status
515
457
  #=>200
516
458
  response.body
517
459
  #=>
518
- {"jsonrpc"=>"2.0",
519
- "id"=>"",
520
- "result"=>
521
- [{"pub_key"=>"Mp0d29a83e54653a1d5f34e561e0135f1e81cbcae152f1f327ab36857a7e32de4c", "voting_power"=>"99121402"},
522
- {"pub_key"=>"Mpa3c16ffc2af26f199dd23c52932ce22441f848aa3ab2b7015de01e2f9c293464", "voting_power"=>"49661"},
523
- {"pub_key"=>"Mpf17328239cd81453b9e9393f66137e5442fb108c7b4fc36b6acfd838f7e6e0c4", "voting_power"=>"9911"},
524
- {"pub_key"=>"Mp14c93843ca40a62b9e7d02a824e7ffe83b49e3329ae963afdd7e500071ab9bfc", "voting_power"=>"819024"}]}
525
-
460
+ {"validators"=>[{"public_key"=>"Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5", "voting_power"=>"100000000"}]}
526
461
 
527
462
  ```
528
463
 
@@ -535,19 +470,26 @@ Returns a signed tx.
535
470
  #### Single signature
536
471
 
537
472
  ```ruby
473
+ mnemonic = "oppose gym crucial devote skin robust exile antique split clean bright move"
474
+ sender_address = Minter::Key.address_from_mnemonic(mnemonic)
475
+ sender_private_key = Minter::Key.private_key_from_mnemonic(mnemonic)
476
+ nonce = client.nonce(address: sender_address)
477
+
478
+ receiver_address = "Mxeeee1973381ab793719fff497b9a516719fcd5a2"
479
+
538
480
  transaction = Minter::SendCoinTx.new(
539
- address_to: "Mxe7812ab98ac5ac37e2ab20da3136ad91bb22d497",
540
- value: 24_000_000_000_000_000_000,
541
- coin: "MNT",
542
- nonce: 1,
543
- chain_id: 2,
544
- gas_coin: "MNT",
545
- gas_price: 10
481
+ address_to: receiver_address,
482
+ value: 1_000_000_000_000_000,
483
+ coin: 0,
484
+ nonce: nonce,
485
+ chain_id: 2,
486
+ gas_coin: 0,
487
+ gas_price: 1
546
488
  )
547
489
 
548
- signed_tx = transaction.sign(private_key)
490
+ signed_tx = transaction.sign(sender_private_key)
549
491
  signed_tx.tx_hash
550
- #=> "0xf88501020a8a4d4e540000000000000001abea8a4d4e540000000000000094e7812ab98ac5ac37e2ab20da3136ad91bb22d49789014d1120d7b1600000808001b845f8431ba07fde3c0e8d9ffb5fd7025099c9f3672deffab0b784787f5d45ea8f27b0ffe989a02f7cd63ac0d75e559f540d8b33464b11da4605e623d62a5b2ddce5adf70c35cb"
492
+ #=> "0xf86f0f020180019fde8094eeee1973381ab793719fff497b9a516719fcd5a287038d7ea4c68000808001b845f8431ca029870ea74e51ca5f89749860875ce69d7afd8b9bff6debebf127d14a27a83043a044f8b98aaa128f8cf41f5556d7b8fddd224021ac7d28024daafed2362d4144b6"
551
493
  ```
552
494
 
553
495
  #### Multi signatures
@@ -558,18 +500,14 @@ private_key2 = "49e48cd0f81e7aabfc840301c66f00318f50b25c79664c3f337d7ad4f919638e
558
500
  transaction = Minter::SendCoinTx.new(
559
501
  address_to: "Mxe7812ab98ac5ac37e2ab20da3136ad91bb22d497",
560
502
  value: 4_000_000_000_000_000_000,
561
- coin: "MNT",
503
+ coin: 0,
562
504
  nonce: 2,
563
505
  chain_id: 2,
564
- gas_coin: "MNT",
506
+ gas_coin: 0,
565
507
  gas_price: 10
566
508
  )
567
509
  signed_tx = transaction.multisign(multisig_address, private_key1, private_key2)
568
- #=> #<Minter::SignedTx:0x00007fe340120090
569
- # @transaction=
570
- # #<Minter::SendCoinTx:0x00007fe3411da908 @address_to="Mxe7812ab98ac5ac37e2ab20da3136ad91bb22d497", @chain_id=2, @coin="MNT", @gas_coin="MNT", @gas_price=10, @nonce=2, @value=4000000000000000000>,
571
- # @tx_hash=
572
- # "0xf8e202020a8a4d4e540000000000000001aae98a4d4e540000000000000094e7812ab98ac5ac37e2ab20da3136ad91bb22d497883782dace9d900000808002b8a3f8a194eda4bb5456f5eb8a19f57c8c6ec844d05feae879f88af8431ba0287dd3956acae624abc25e6ba60018f60a80e144f5678ceb35c35613fcd363bfa01886706c7ffa0e6ccfc7c3dda186d3e8beea5214c30502ad9a24d8a29ced685af8431ba0302a560b420ed0da95f4f8425ac605a2462d35449e44557f152c4308845e1710a04cd1b834752e3a26b0fd543a20e3ef99ca233b049e064146c6a8cdf19d895552">
510
+ #=> #<Minter::SignedTx:0x00007f97f0249ca0 @tx_hash="0xf8ce02020a8001a0df8094e7812ab98ac5ac37e2ab20da3136ad91bb22d497883782dace9d900000808002b8a3f8a194eda4bb5456f5eb8a19f57c8c6ec844d05feae879f88af8431ca04613dae08d6d729a2cb55cd1ef508fcabbd516c219cca15cff61bd5cff0dca2fa06dd29d4fa41517b1701520412f2892b82a10b0fd9b7ddf00060105d418e78f3bf8431ba0d13870020138ae7d6bc14dff8a720c97767af19b648facddb997a8c7baa771c2a01879cee21cd8e315752eae1190981541418fe49ff3def116fd123a2fd066ba84", @transaction=#<Minter::SendCoinTx:0x00007f97f11b2a48 @address_to="Mxe7812ab98ac5ac37e2ab20da3136ad91bb22d497", @value=4000000000000000000, @coin=0, @nonce=2, @chain_id=2, @gas_coin=0, @gas_price=10>>
573
511
  ```
574
512
 
575
513
  ### Create transaction
@@ -585,15 +523,15 @@ value - Amount of Coin to send.
585
523
  ##### Example
586
524
 
587
525
  ```ruby
588
- Minter::SendCoinTx.new(
589
- address_to: "Mxe7812ab98ac5ac37e2ab20da3136ad91bb22d497",
590
- value: 24_000_000_000_000_000_000,
591
- coin: "MNT",
592
- nonce: 1,
593
- chain_id: 2,
594
- gas_coin: "MNT",
595
- gas_price: 10
596
- )
526
+ transaction = Minter::SendCoinTx.new(
527
+ address_to: "Mx1b685a7c1e78726c48f619c497a07ed75fe00483",
528
+ value: 1_000_000_000_000_000_000,
529
+ coin: 1,
530
+ nonce: 1,
531
+ chain_id: 2,
532
+ gas_coin: 1,
533
+ gas_price: 1
534
+ )
597
535
  ```
598
536
 
599
537
  #### Sell coin transaction
@@ -609,13 +547,13 @@ minimum_value_to_buy - Minimum value of coins to get.
609
547
 
610
548
  ```ruby
611
549
  Minter::SellCoinTx.new(
612
- coin_to_sell: "MNT",
550
+ coin_to_sell: 1,
613
551
  value_to_sell: 1_000_000_000_000_000_000,
614
- coin_to_buy: "TEST",
552
+ coin_to_buy: 2,
615
553
  minimum_value_to_buy: 1_000_000_000_000_000_000,
616
554
  nonce: 1,
617
555
  chain_id: 2,
618
- gas_coin: "MNT",
556
+ gas_coin: 1,
619
557
  gas_price: 1
620
558
  )
621
559
  ```
@@ -632,14 +570,14 @@ minimum_value_to_buy - Minimum value of coins to get.
632
570
 
633
571
  ```ruby
634
572
  Minter::SellAllCoinTx.new(
635
- coin_to_sell: "MNT",
636
- coin_to_buy: "TEST",
637
- minimum_value_to_buy: 1_000_000_000_000_000_000,
638
- nonce: 1,
639
- chain_id: 2,
640
- gas_coin: "MNT",
641
- gas_price: 1
642
- )
573
+ coin_to_sell: 1,
574
+ coin_to_buy: 2,
575
+ minimum_value_to_buy: 1_000_000_000_000_000_000,
576
+ nonce: 1,
577
+ chain_id: 2,
578
+ gas_coin: 1,
579
+ gas_price: 1
580
+ )
643
581
  ```
644
582
 
645
583
  #### Buy coin transaction
@@ -654,16 +592,16 @@ maximum_value_to_sell - Maximum value of coins to sell.
654
592
  ##### Example
655
593
 
656
594
  ```ruby
657
- transaction = Minter::BuyCoinTx.new(
658
- coin_to_buy: "TEST",
659
- value_to_buy: 1_000_000_000_000_000_000,
660
- coin_to_sell: "MNT",
661
- maximum_value_to_sell: 1_000_000_000_000_000_000,
662
- nonce: 1,
663
- chain_id: 2,
664
- gas_coin: "MNT",
665
- gas_price: 1
666
- )
595
+ Minter::BuyCoinTx.new(
596
+ coin_to_buy: 2,
597
+ value_to_buy: 1_000_000_000_000_000_000,
598
+ coin_to_sell: 1,
599
+ maximum_value_to_sell: 1_000_000_000_000_000_000,
600
+ nonce: 1,
601
+ chain_id: 2,
602
+ gas_coin: 1,
603
+ gas_price: 1
604
+ )
667
605
  ```
668
606
 
669
607
  #### Create coin transaction
@@ -679,17 +617,17 @@ initial_reserve - Initial reserve in BIP's. ConstantReserveRatio - CRR, uint, sh
679
617
 
680
618
  ```ruby
681
619
  Minter::CreateCoinTx.new(
682
- name: "SUPER TEST",
683
- symbol: "SPRTEST",
684
- initial_amount: 100_000_000_000_000_000_000,
685
- initial_reserve: 10_000_000_000_000_000_000,
686
- reserve_ratio: 10,
687
- max_supply: 1_000_000_000_000_000_000_000,
688
- nonce: 1,
689
- chain_id: 2,
690
- gas_coin: "MNT",
691
- gas_price: 1
692
- )
620
+ name: "SUPER TEST",
621
+ symbol: "SPRTEST",
622
+ initial_amount: 100_000_000_000_000_000_000,
623
+ initial_reserve: 20_000_000_000_000_000_000_000,
624
+ reserve_ratio: 10,
625
+ max_supply: 1_000_000_000_000_000_000_000,
626
+ nonce: 1,
627
+ chain_id: 2,
628
+ gas_coin: 1,
629
+ gas_price: 1
630
+ )
693
631
  ```
694
632
 
695
633
  #### Declare candidacy transaction
@@ -705,16 +643,16 @@ coin - Symbol of coin to stake. Stake - Amount of coins to stake.
705
643
 
706
644
  ```ruby
707
645
  Minter::DeclareCandidacyTx.new(
708
- address: "Mx9f7fd953c2c69044b901426831ed03ee0bd0597a",
709
- pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
710
- commission: 10,
711
- coin: "MNT",
712
- stake: 5_000_000_000_000_000_000,
713
- nonce: 1,
714
- chain_id: 2,
715
- gas_coin: "MNT",
716
- gas_price: 1
717
- )
646
+ address: "Mx9f7fd953c2c69044b901426831ed03ee0bd0597a",
647
+ pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
648
+ commission: 10,
649
+ coin: 1,
650
+ stake: 5_000_000_000_000_000_000,
651
+ nonce: 1,
652
+ chain_id: 2,
653
+ gas_coin: 1,
654
+ gas_price: 1
655
+ )
718
656
  ```
719
657
 
720
658
  #### Delegate transaction
@@ -729,14 +667,14 @@ value - Amount of coins to stake.
729
667
 
730
668
  ```ruby
731
669
  Minter::DelegateTx.new(
732
- pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
733
- coin: "MNT",
734
- value: 10_000_000_000_000_000_000,
735
- nonce: 1,
736
- chain_id: 2,
737
- gas_coin: "MNT",
738
- gas_price: 1
739
- )
670
+ pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
671
+ coin: 1,
672
+ value: 10_000_000_000_000_000_000,
673
+ nonce: 1,
674
+ chain_id: 2,
675
+ gas_coin: 1,
676
+ gas_price: 1
677
+ )
740
678
  ```
741
679
 
742
680
  #### Unbond transaction
@@ -751,14 +689,14 @@ value - Amount of coins to stake.
751
689
 
752
690
  ```ruby
753
691
  Minter::UnbondTx.new(
754
- pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
755
- coin: "MNT",
756
- value: 10_000_000_000_000_000_000,
757
- nonce: 1,
758
- chain_id: 2,
759
- gas_coin: "MNT",
760
- gas_price: 1
761
- )
692
+ pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
693
+ coin: 1,
694
+ value: 10_000_000_000_000_000_000,
695
+ nonce: 1,
696
+ chain_id: 2,
697
+ gas_coin: 1,
698
+ gas_price: 1
699
+ )
762
700
  ```
763
701
 
764
702
  #### Redeem check transaction
@@ -777,7 +715,7 @@ Minter::RedeemCheckTx.new(
777
715
  proof: proof,
778
716
  nonce: 1,
779
717
  chain_id: 2,
780
- gas_coin: "MNT",
718
+ gas_coin: 1,
781
719
  gas_price: 1
782
720
  )
783
721
  ```
@@ -795,7 +733,7 @@ Minter::SetCandidateOnTx.new(
795
733
  pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
796
734
  nonce: 1,
797
735
  chain_id: 2,
798
- gas_coin: "MNT",
736
+ gas_coin: 1,
799
737
  gas_price: 1
800
738
  )
801
739
  ```
@@ -813,7 +751,7 @@ Minter::SetCandidateOffTx.new(
813
751
  pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
814
752
  nonce: 1,
815
753
  chain_id: 2,
816
- gas_coin: "MNT",
754
+ gas_coin: 1,
817
755
  gas_price: 1
818
756
  )
819
757
  ```
@@ -828,62 +766,41 @@ Minter::EditCandidateTx.new(
828
766
  pubkey: "Mp4ae1ee73e6136c85b0ca933a9a1347758a334885f10b3238398a67ac2eb153b8",
829
767
  reward_address: "Mx89e5dc185e6bab772ac8e00cf3fb3f4cb0931c47",
830
768
  owner_address: "Mxe731fcddd37bb6e72286597d22516c8ba3ddffa0",
769
+ control_address: "Mx1b685a7c1e78726c48f619c497a07ed75fe00483",
831
770
  nonce: 1,
832
771
  chain_id: 2,
833
- gas_coin: "MNT",
772
+ gas_coin: 1,
834
773
  gas_price: 1
835
774
  )
836
775
  ```
837
776
 
838
- #### Create multisig address
839
-
840
- Transaction for creating multisignature address.
841
-
842
- ```ruby
843
- address1 = "Mx08d920c5d93dbf23038fe1a54bbb34f41f77677c"
844
- address2 = "Mx9c7f68ff71b5819c41e8f87cc99bdf6359da3d75"
845
- address3 = "Mx9c7f68ff71b5819c41e8f87cc99bdf6359da3d75"
846
- private_key = "ae089b32e4e0976ca6888cb1023148bd1a9f1cc28c5d442e52e586754ff48d63"
847
-
848
- transaction = Minter::CreateMultisigAddressTx.new(
849
- threshold: 7,
850
- nonce: 11,
851
- chain_id: 2,
852
- gas_coin: "MNT",
853
- gas_price: 1
854
- )
855
-
856
- transaction.add_address(address: address1, weight: 1)
857
- transaction.add_address(address: address2, weight: 3)
858
- transaction.add_address(address: address3, weight: 5)
859
-
860
- transaction.multisig_address
861
- => "Mxc0edeaee8750330d01bcefcbd34198b2ef7b1167"
862
- ```
863
777
  #### Multisend transaction
864
778
 
865
779
  Transaction for sending coins to multiple addresses.
866
780
 
867
781
  ```ruby
868
782
  transaction = Minter::MultiSendTx.new(
869
- nonce: 1,
870
- chain_id: 2,
871
- gas_coin: "MNT",
872
- gas_price: 1
783
+ nonce: 1,
784
+ chain_id: 2,
785
+ gas_coin: 1,
786
+ gas_price: 1
873
787
  )
874
-
788
+
875
789
  transaction.add_item(
876
- symbol: "MNT",
877
- address_to: "Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99",
878
- value: 100_000_000_000_000_000
790
+ coin_id: 1,
791
+ address_to: "Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99",
792
+ value: 100_000_000_000_000_000
879
793
  )
880
-
794
+
881
795
  transaction.add_item(
882
- symbol: "MNT",
883
- address_to: "Mxddab6281766ad86497741ff91b6b48fe85012e3c",
884
- value: 200_000_000_000_000_000
796
+ coin_id: 1,
797
+ address_to: "Mxddab6281766ad86497741ff91b6b48fe85012e3c",
798
+ value: 200_000_000_000_000_000
885
799
  )
800
+
801
+ signed_tx = transaction.sign(private_key)
886
802
  ```
803
+
887
804
  ### Get fee of transaction
888
805
  ```ruby
889
806
  transaction = Minter::SendCoinTx.new(
@@ -900,45 +817,10 @@ transaction.fee
900
817
  #=> ""
901
818
 
902
819
  ```
903
- ### Decode Transaction
904
820
 
905
- ```ruby
906
- # IN PROGRESS
907
- ```
908
- ### Minter Deep Links
909
-
910
- ```ruby
911
- # IN PROGRESS
912
- ```
913
821
  More info about [Minter Link Protocol](https://github.com/MinterTeam/minter-link-protocol)
914
822
 
915
- ### Minter Check
916
823
 
917
- Minter Check is like an ordinary bank check. Each user of network can issue check with any amount of coins and pass it to another person. Receiver will be able to cash a check from arbitrary account.
918
-
919
- * Create Issue Check. Nonce - unique "id" of the check. Coin Symbol - symbol of coin. Value - amount of coins. Due Block - defines last block height in which the check can be used.
920
-
921
- ```ruby
922
- # IN PROGRESS
923
- ```
924
-
925
- * Sign Issue Check
926
-
927
- ```ruby
928
- # IN PROGRESS
929
- ```
930
-
931
- * Prepare check string and convert to data
932
-
933
- ```ruby
934
- # IN PROGRESS
935
- ```
936
-
937
- * Proof check
938
-
939
- ```ruby
940
- # IN PROGRESS
941
- ```
942
824
 
943
825
  ### Minter Wallet
944
826
 
@@ -1014,7 +896,7 @@ To run tests:
1014
896
 
1015
897
  ```shell script
1016
898
  bundle install
1017
- rpsec
899
+ rspec
1018
900
  ```
1019
901
 
1020
902
  ## Development
@@ -8,6 +8,9 @@ require_relative "connection"
8
8
  module Minter
9
9
  module Api
10
10
  class Client
11
+
12
+ DEFAULT_NODE_URL = "https://node-api.testnet.minter.network/v2"
13
+
11
14
  attr_accessor :node_url, :authenticated_api_url, :api_version
12
15
  attr_accessor :proxy, :connect_timeout, :read_timeout, :write_timeout
13
16
 
@@ -31,7 +34,7 @@ module Minter
31
34
  API_VERSION = 2
32
35
 
33
36
  def initialize(args = {})
34
- self.node_url = ENV["NODE_URL"]
37
+ self.node_url = ENV["NODE_URL"] || DEFAULT_NODE_URL
35
38
  self.connect_timeout = args[:connect_timeout] || DEFAULT_TIMEOUT
36
39
  self.read_timeout = args[:read_timeout] || DEFAULT_TIMEOUT
37
40
  self.write_timeout = args[:write_timeout] || DEFAULT_TIMEOUT
@@ -26,6 +26,12 @@ module Minter
26
26
  Minter::Api::Result.new(response)
27
27
  end
28
28
 
29
+ def post(path, params = {})
30
+ response = connection.post(build_url(config[:node_url], path), params: params)
31
+
32
+ Minter::Api::Result.new(response)
33
+ end
34
+
29
35
  def connection
30
36
  @connection ||= new_connection
31
37
  end
@@ -4,18 +4,14 @@ module Minter
4
4
  module Api
5
5
  module AddressResource
6
6
  def address(address:, height: nil)
7
- params = { address: address, height: height }.compact
8
- path = "/address"
7
+ params = { height: height }.compact
8
+ path = "/address/#{address}"
9
9
 
10
10
  get(path, params)
11
11
  end
12
12
 
13
13
  alias balance address
14
14
 
15
- def addresses(_params = {})
16
- path = "/address"
17
- get(path)
18
- end
19
15
  end
20
16
  end
21
17
  end
@@ -4,10 +4,9 @@ module Minter
4
4
  module Api
5
5
  module BlockResource
6
6
  def block(height:)
7
- params = { height: height }
8
- path = "/block"
7
+ path = "/block/#{height}"
9
8
 
10
- get(path, params)
9
+ get(path)
11
10
  end
12
11
  end
13
12
  end
@@ -4,8 +4,8 @@ module Minter
4
4
  module Api
5
5
  module CandidateResource
6
6
  def candidate(public_key:, height: nil)
7
- path = "/candidate"
8
- params = { pub_key: public_key, height: height }.compact
7
+ path = "/candidate/#{public_key}"
8
+ params = { height: height }.compact
9
9
  get(path, params)
10
10
  end
11
11
 
@@ -4,8 +4,8 @@ module Minter
4
4
  module Api
5
5
  module CoinResource
6
6
  def coin_info(symbol:, height:)
7
- params = { symbol: symbol, height: height }
8
- path = "/coin_info"
7
+ params = { height: height }
8
+ path = "/coin_info/#{symbol}"
9
9
  get(path, params)
10
10
  end
11
11
  end
@@ -5,9 +5,8 @@ module Minter
5
5
  module EventsResource
6
6
  def events(height: nil)
7
7
  height ||= 1
8
- params = { height: height }
9
- path = "/events"
10
- get(path, params)
8
+ path = "/events/#{height}"
9
+ get(path)
11
10
  end
12
11
  end
13
12
  end
@@ -4,7 +4,7 @@ module Minter
4
4
  module Api
5
5
  module MaxGasResource
6
6
  def max_gas
7
- path = "/max_gas"
7
+ path = "/max_gas_price"
8
8
  get(path)
9
9
  end
10
10
  end
@@ -4,10 +4,9 @@ module Minter
4
4
  module Api
5
5
  module NonceResource
6
6
  def nonce(address:)
7
- params = { address: address }.compact
8
- path = "/address"
9
- response = get(path, params)
10
- response.body["result"]["transaction_count"].to_i + 1
7
+ path = "/address/#{address}"
8
+ response = get(path)
9
+ response.body["transaction_count"].to_i + 1
11
10
  end
12
11
  end
13
12
  end
@@ -4,9 +4,8 @@ module Minter
4
4
  module Api
5
5
  module SendTransactionResource
6
6
  def send_transaction(transaction:)
7
- params = { tx: transaction }
8
- path = "/send_transaction"
9
- get(path, params)
7
+ path = "/send_transaction/#{transaction}"
8
+ get(path)
10
9
  end
11
10
  end
12
11
  end
@@ -4,9 +4,8 @@ module Minter
4
4
  module Api
5
5
  module TransactionsResource
6
6
  def transaction_info(transaction_hash:)
7
- params = { hash: transaction_hash }
8
- path = "/transaction"
9
- get(path, params)
7
+ path = "/transaction/#{transaction_hash}"
8
+ get(path)
10
9
  end
11
10
 
12
11
  def transactions(query:, page: 1, per_page: 10)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Minter
4
- VERSION = "0.5.0"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Nikolaev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-23 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv