minter 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +925 -6
- data/bin/console +6 -5
- data/lib/ffi/go/compile.rb +14 -0
- data/lib/ffi/transaction_ffi.rb +94 -0
- data/lib/ffi/wallet_ffi.rb +16 -0
- data/lib/minter.rb +11 -4
- data/lib/minter/api/client.rb +53 -0
- data/lib/minter/api/connection.rb +50 -0
- data/lib/minter/api/errors.rb +18 -0
- data/lib/minter/api/resources/address_resource.rb +21 -0
- data/lib/minter/api/resources/block_resource.rb +14 -0
- data/lib/minter/api/resources/candidate_resource.rb +19 -0
- data/lib/minter/api/resources/coin_resource.rb +13 -0
- data/lib/minter/api/resources/estimate_resource.rb +31 -0
- data/lib/minter/api/resources/events_resource.rb +14 -0
- data/lib/minter/api/resources/max_gas_resource.rb +12 -0
- data/lib/minter/api/resources/min_gas_price_resource.rb +12 -0
- data/lib/minter/api/resources/missed_blocks_resource.rb +13 -0
- data/lib/minter/api/resources/nonce_resource.rb +14 -0
- data/lib/minter/api/resources/send_transaction_resource.rb +13 -0
- data/lib/minter/api/resources/status_resource.rb +12 -0
- data/lib/minter/api/resources/transactions_resource.rb +25 -0
- data/lib/minter/api/resources/validators_resource.rb +13 -0
- data/lib/minter/api/result.rb +54 -0
- data/lib/minter/key.rb +29 -0
- data/lib/minter/transactions/buy_coin_tx.rb +36 -0
- data/lib/minter/transactions/create_coin_tx.rb +40 -0
- data/lib/minter/transactions/declare_candidacy_tx.rb +38 -0
- data/lib/minter/transactions/delegate_tx.rb +34 -0
- data/lib/minter/transactions/edit_candidate_tx.rb +34 -0
- data/lib/minter/transactions/redeem_check_tx.rb +32 -0
- data/lib/minter/transactions/sell_all_coin_tx.rb +34 -0
- data/lib/minter/transactions/sell_coin_tx.rb +36 -0
- data/lib/minter/transactions/send_coin_tx.rb +34 -0
- data/lib/minter/transactions/set_candidate_off_tx.rb +30 -0
- data/lib/minter/transactions/set_candidate_on_tx.rb +30 -0
- data/lib/minter/transactions/signed_tx.rb +16 -0
- data/lib/minter/transactions/unbond_tx.rb +34 -0
- data/lib/minter/version.rb +2 -2
- data/lib/minter/wallet.rb +13 -0
- metadata +129 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d075be7e9155a7dfd8a0ecd57b8ea46d4e6dd85527f9e1c2ab7144542a6bd3fc
|
4
|
+
data.tar.gz: d1ab0b0a1c16cc7153f4e033609ada0ab3069e78c18572a53b9fda098b39c7a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5face07e9d58aa1e7ed849e2453a0cfc81626c0277848a7c5ea892400c09978f1af8e3b15d6284a7ef1992bbe6a86f87cf7aefa21cf3c72a3337ee9f799fda5b
|
7
|
+
data.tar.gz: 9776d8a6e964dbb1fc4df8e44f395df35ee15986dd7dfb3bed529059ec7c8b9ecc335146d4b360e954d74a54a45709bf9b85afd0bf970962e9c252d325d4f2d6
|
data/README.md
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
# Minter
|
4
4
|
|
5
|
-
|
5
|
+
This is a Ruby SDK based on Golang SDK for working with Minter blockchain
|
6
|
+
|
6
7
|
|
7
|
-
TODO: Delete this and the text above, and describe your gem
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'minter
|
14
|
+
gem 'minter'
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -20,11 +20,930 @@ And then execute:
|
|
20
20
|
|
21
21
|
Or install it yourself as:
|
22
22
|
|
23
|
-
$ gem install minter
|
23
|
+
$ gem install minter
|
24
|
+
|
25
|
+
## Using Minter API
|
26
|
+
|
27
|
+
* [Minter Api](#using-minterapi)
|
28
|
+
- Methods:
|
29
|
+
- [Address](#address)
|
30
|
+
- [Address at height](#address-at-height)
|
31
|
+
- [Balance](#balance)
|
32
|
+
- [Nonce](#nonce)
|
33
|
+
- [Block](#block)
|
34
|
+
- [Candidate](#candidate)
|
35
|
+
- [Candidates](#candidates)
|
36
|
+
- [CoinInfo](#coininfo)
|
37
|
+
- [EstimateCoinBuy](#estimatecoinbuy)
|
38
|
+
- [EstimateCoinSell](#estimatecoinsell)
|
39
|
+
- [EstimateTxCommission](#estimatetxcommission)
|
40
|
+
- [Events](#events)
|
41
|
+
- [MaxGas](#maxgas)
|
42
|
+
- [MinGasPrice](#mingasprice)
|
43
|
+
- [MissedBlocks](#missedblocks)
|
44
|
+
- [Send](#send)
|
45
|
+
- [Status](#status)
|
46
|
+
- [Validators](#validators)
|
47
|
+
- [Transaction](#transaction)
|
48
|
+
- [Transactions](#transactions)
|
49
|
+
- [Unconfirmed Transactions](#unconfirmed-transactions)
|
50
|
+
* [Minter SDK](#using-mintersdk)
|
51
|
+
- [Create Transaction](#create-transaction)
|
52
|
+
- [Send](#send-transaction)
|
53
|
+
- [SellCoin](#sell-coin-transaction)
|
54
|
+
- [SellAllCoin](#sell-all-coin-transaction)
|
55
|
+
- [BuyCoin](#buy-coin-transaction)
|
56
|
+
- [CreateCoin](#create-coin-transaction)
|
57
|
+
- [DeclareCandidacy](#declare-candidacy-transaction)
|
58
|
+
- [Delegate](#delegate-transaction)
|
59
|
+
- [SetCandidateOn](#set-candidate-online-transaction)
|
60
|
+
- [SetCandidateOff](#set-candidate-offline-transaction)
|
61
|
+
- [RedeemCheck](#redeem-check-transaction)
|
62
|
+
- [Unbond](#unbond-transaction)
|
63
|
+
- [Multisend](#multisend-transaction)
|
64
|
+
- [EditCandidate](#edit-candidate-transaction)
|
65
|
+
- [Sign transaction](#sign-transaction)
|
66
|
+
- [Single signature](#single-signature)
|
67
|
+
- [Multi signature](#multi-signatures)
|
68
|
+
- [Get fee of transaction](#get-fee-of-transaction)
|
69
|
+
- [Get hash of transaction](#get-hash-of-transaction)
|
70
|
+
- [Decode Transaction](#decode-transaction)
|
71
|
+
- [Minter Deep Links](#minter-deep-links)
|
72
|
+
- [Minter Check](#minter-check)
|
73
|
+
- [Minter Wallet](#minter-wallet)
|
74
|
+
- [Create wallet](#create-wallet)
|
75
|
+
- [Minter Key](#minter-key)
|
76
|
+
- [Generate mnemonic](#generate-mnemonic)
|
77
|
+
- [Get private key from mnemonic](#get-private-key-from-mnemonic)
|
78
|
+
- [Get public key from private key](#get-public-key-from-private-key)
|
79
|
+
- [Get Minter address from public key](#get-minter-address-from-public-key)
|
80
|
+
- [Get Minter address from private key](#get-minter-address-from-private-key)
|
81
|
+
- [Get Minter address from mnemonic](#get-minter-address-from-mnemonic)
|
82
|
+
* [Tests](#tests)
|
83
|
+
|
84
|
+
|
85
|
+
### Minter API
|
86
|
+
You can get all valid responses and full documentation at [Minter Node Api](https://docs.minter.network)
|
87
|
+
|
88
|
+
Create Minter::Api client
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
require "minter"
|
92
|
+
|
93
|
+
client = Minter::Api::Client.new
|
94
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
95
|
+
```
|
96
|
+
|
97
|
+
### Address
|
98
|
+
|
99
|
+
Returns coins list, balance and transaction count (for nonce) of an address.
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
client = Minter::Api::Client.new
|
103
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
104
|
+
|
105
|
+
address = "Mx251cb0043a0240779103aa7c210f638f887699f8"
|
106
|
+
response = client.address(address: address)
|
107
|
+
response.status
|
108
|
+
#=> 200
|
109
|
+
response.body
|
110
|
+
#=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>{"balance"=>{"DEVDEV"=>"1000000000000002000", "DEVTWO"=>"1000000000000000000", "MNT"=>"66565140000000800001000"}, "transaction_count"=>"31"}}
|
111
|
+
````
|
112
|
+
|
113
|
+
### Address at height
|
114
|
+
|
115
|
+
Returns coins list, balance and transaction count (for nonce) of an address.
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
client = Minter::Api::Client.new
|
119
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
120
|
+
|
121
|
+
address = "Mx251cb0043a0240779103aa7c210f638f887699f8"
|
122
|
+
response = client.address(address: address, height: 1)
|
123
|
+
response.status
|
124
|
+
#=> 200
|
125
|
+
response.body
|
126
|
+
#=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>{"balance"=>{"MNT"=>"0"}, "transaction_count"=>"0"}}
|
127
|
+
|
128
|
+
````
|
129
|
+
|
130
|
+
### Balance
|
131
|
+
|
132
|
+
Returns coins list, balance and transaction count (for nonce) of an address.
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
client = Minter::Api::Client.new
|
136
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
137
|
+
|
138
|
+
address = "Mx251cb0043a0240779103aa7c210f638f887699f8"
|
139
|
+
response = client.balance(address: address)
|
140
|
+
response.status
|
141
|
+
#=> 200
|
142
|
+
response.body
|
143
|
+
#=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>{"balance"=>{"DEVDEV"=>"1000000000000002000", "DEVTWO"=>"1000000000000000000", "MNT"=>"66565140000000800001000"}, "transaction_count"=>"31"}}
|
144
|
+
````
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
### Nonce
|
149
|
+
|
150
|
+
Returns next transaction number (nonce) of an address.
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
client = Minter::Api::Client.new
|
154
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
155
|
+
|
156
|
+
address = "Mx251cb0043a0240779103aa7c210f638f887699f8"
|
157
|
+
nonce = client.nonce(address: address)
|
158
|
+
#=> 28
|
159
|
+
```
|
160
|
+
|
161
|
+
### Block
|
162
|
+
|
163
|
+
Returns block data at given height.
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
client = Minter::Api::Client.new
|
167
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
168
|
+
|
169
|
+
response = client.block(height: 1)
|
170
|
+
response.status
|
171
|
+
#=> 200
|
172
|
+
response.body
|
173
|
+
#=> {"jsonrpc"=>"2.0",
|
174
|
+
# "id"=>"",
|
175
|
+
# "result"=>
|
176
|
+
# {"hash"=>"499a3ba23ec8a046eb7d1eecdf4123b795e2ba3df0e57122f75fa656144553ea",
|
177
|
+
# "height"=>"1",
|
178
|
+
# "time"=>"2020-04-08T13:00:00Z",
|
179
|
+
# "num_txs"=>"0",
|
180
|
+
# "transactions"=>[],
|
181
|
+
# "block_reward"=>"331000000000000000000",
|
182
|
+
# "size"=>"280"}}
|
183
|
+
|
184
|
+
```
|
185
|
+
|
186
|
+
### Candidate
|
187
|
+
|
188
|
+
Returns candidate’s info by provided public_key. It will respond with 404 code if candidate is not found.
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
client = Minter::Api::Client.new
|
192
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
193
|
+
|
194
|
+
public_key = "Mp4d2900d19ee3ce815bdb38daa3bc8d15c2bbe4945c3cdfac80df3ae6da31464b"
|
195
|
+
response = client.candidate(public_key: public_key)
|
196
|
+
response.status
|
197
|
+
#=> 200
|
198
|
+
response.body
|
199
|
+
#=> {"jsonrpc"=>"2.0",
|
200
|
+
# "id"=>"",
|
201
|
+
# "result"=>
|
202
|
+
# {"reward_address"=>"Mx251cb0043a0240779103aa7c210f638f887699f8",
|
203
|
+
# "owner_address"=>"Mx251cb0043a0240779103aa7c210f638f887699f8",
|
204
|
+
# "total_stake"=>"4950000000000000000",
|
205
|
+
# "pub_key"=>"Mp4d2900d19ee3ce815bdb38daa3bc8d15c2bbe4945c3cdfac80df3ae6da31464b",
|
206
|
+
# "commission"=>"10",
|
207
|
+
# "stakes"=>[{"owner"=>"Mx251cb0043a0240779103aa7c210f638f887699f8", "coin"=>"MNT", "value"=>"4950000000000000000", "bip_value"=>"4950000000000000000"}],
|
208
|
+
# "status"=>1}}
|
209
|
+
```
|
210
|
+
### Candidates
|
211
|
+
|
212
|
+
Returns list of candidates.
|
213
|
+
|
214
|
+
```ruby
|
215
|
+
client = Minter::Api::Client.new
|
216
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
217
|
+
|
218
|
+
response = client.candidates
|
219
|
+
response.status
|
220
|
+
#=> 200
|
221
|
+
response.body
|
222
|
+
#=> {"jsonrpc"=>"2.0",
|
223
|
+
# "id"=>"",
|
224
|
+
# "result"=>
|
225
|
+
# [
|
226
|
+
# {"reward_address"=>"Mx9816046484c7c50fc43d5a564cadb494910a27b7",
|
227
|
+
# "owner_address"=>"Mx9816046484c7c50fc43d5a564cadb494910a27b7",
|
228
|
+
# "total_stake"=>"100019333250000000000000",
|
229
|
+
# "pub_key"=>"Mpf17328239cd81453b9e9393f66137e5442fb108c7b4fc36b6acfd838f7e6e0c4",
|
230
|
+
# "commission"=>"85",
|
231
|
+
# "status"=>2},
|
232
|
+
# {"reward_address"=>"Mx69ebd94f75444b22953c7a439f7ccef6d9e9be5a",
|
233
|
+
# "owner_address"=>"Mx3b3af9a8520910b29735ca44a64f52f09f057d64",
|
234
|
+
# "total_stake"=>"49500000000000000000",
|
235
|
+
# "pub_key"=>"Mpab7a9b763569a45b3221d4276e72466c225524354eee6c7d2e12858ac0eef864",
|
236
|
+
# "commission"=>"1",
|
237
|
+
# "status"=>1}
|
238
|
+
# ]
|
239
|
+
```
|
240
|
+
|
241
|
+
### CoinInfo
|
242
|
+
|
243
|
+
Returns information about coin.
|
244
|
+
Note: this method does not return information about base coins (MNT and BIP).
|
245
|
+
|
246
|
+
```ruby
|
247
|
+
client = Minter::Api::Client.new
|
248
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
249
|
+
|
250
|
+
response = client.coin_info("CAPITAL")
|
251
|
+
response.status
|
252
|
+
#=> 200
|
253
|
+
response.body
|
254
|
+
#=> {"jsonrpc"=>"2.0",
|
255
|
+
# "id"=>"",
|
256
|
+
# "result"=>
|
257
|
+
# {"name"=>"CAPITAL",
|
258
|
+
# "symbol"=>"CAPITAL",
|
259
|
+
# "volume"=>"10004406818749673124164086",
|
260
|
+
# "crr"=>"80",
|
261
|
+
# "reserve_balance"=>"100055088268419724781795",
|
262
|
+
# "max_supply"=>"1000000000000000000000000000000000"}}
|
263
|
+
```
|
264
|
+
|
265
|
+
### EstimateCoinBuy
|
266
|
+
|
267
|
+
Return estimate of buy coin transaction.
|
268
|
+
|
269
|
+
```ruby
|
270
|
+
client = Minter::Api::Client.new
|
271
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
272
|
+
|
273
|
+
response = client.estimate_coin_buy(coinToSell: "BIP", valueToBuy: 1, coinToBuy: "MNT")
|
274
|
+
response.status
|
275
|
+
#=> 200
|
276
|
+
```
|
277
|
+
|
278
|
+
### EstimateCoinSell
|
279
|
+
|
280
|
+
Return estimate of sell coin transaction.
|
281
|
+
|
282
|
+
```ruby
|
283
|
+
client = Minter::Api::Client.new
|
284
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
285
|
+
|
286
|
+
response = client.estimate_coin_sell(coinToSell: "BIP", valueToSell: 1, coinToBuy: "MNT")
|
287
|
+
response.status
|
288
|
+
#=> 200
|
289
|
+
```
|
290
|
+
### EstimateTxCommission
|
291
|
+
|
292
|
+
Return estimate of transaction.
|
293
|
+
|
294
|
+
```ruby
|
295
|
+
client = Minter::Api::Client.new
|
296
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
297
|
+
|
298
|
+
response = client.estimate_tx_comission(transaction: "0xf88522020a8a4d4e540000000000000001abea8a4d4e540000000000000094e7812ab98ac5ac37e2ab20da3136ad91bb22d49789014d1120d7b1600000808001b845f8431ba07424d88d612132c847c1c92c1f471471fa8034914260223cb547f097e2bd7587a0201fa4d869ba564538996a71e6aa1e2b069d746b8fa0a563e023989986ae91a7")
|
299
|
+
```
|
300
|
+
|
301
|
+
### Events
|
302
|
+
|
303
|
+
Returns events at given height.
|
304
|
+
|
305
|
+
```ruby
|
306
|
+
client = Minter::Api::Client.new
|
307
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
308
|
+
|
309
|
+
response = client.events(height: 1)
|
310
|
+
```
|
311
|
+
|
312
|
+
|
313
|
+
### MaxGas
|
314
|
+
|
315
|
+
Returns current max gas.
|
316
|
+
|
317
|
+
```ruby
|
318
|
+
client = Minter::Api::Client.new
|
319
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
320
|
+
|
321
|
+
response = client.max_gas
|
322
|
+
response.status
|
323
|
+
#=>200
|
324
|
+
response.body
|
325
|
+
#=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>"100000"}
|
326
|
+
```
|
327
|
+
|
328
|
+
### MinGasPrice
|
329
|
+
|
330
|
+
Returns current min gas price.
|
331
|
+
|
332
|
+
```ruby
|
333
|
+
client = Minter::Api::Client.new
|
334
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
335
|
+
|
336
|
+
response = client.min_gas_price
|
337
|
+
response.status
|
338
|
+
#=>200
|
339
|
+
response.body
|
340
|
+
#=> {"jsonrpc"=>"2.0", "id"=>"", "result"=>"1"}
|
341
|
+
|
342
|
+
```
|
343
|
+
|
344
|
+
### MissedBlocks
|
345
|
+
|
346
|
+
Returns missed blocks by validator public key.
|
347
|
+
|
348
|
+
```ruby
|
349
|
+
client = Minter::Api::Client.new
|
350
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
351
|
+
|
352
|
+
response = client.missed_block(public_key: public_key)
|
353
|
+
```
|
354
|
+
|
355
|
+
### Send
|
356
|
+
|
357
|
+
Returns the result of sending __signed__ tx.
|
358
|
+
|
359
|
+
```ruby
|
360
|
+
signed_transaction = transaction.sign(privateKey)
|
361
|
+
response = signed_transaction.send
|
362
|
+
# or
|
363
|
+
response = client.send_transaction(transaction: signed_transaction.tx_hash)
|
364
|
+
response.status
|
365
|
+
#=> 200
|
366
|
+
response.body
|
367
|
+
#=>
|
368
|
+
{"jsonrpc"=>"2.0", "id"=>"", "result"=>{"code"=>0, "data"=>"", "log"=>"", "hash"=>"9219C1FA06D72C2A4ACDFB4D20F52E3F536C6134E20F485F1E2EA6D71C0DFA20"}}
|
369
|
+
```
|
370
|
+
|
371
|
+
### Status
|
372
|
+
|
373
|
+
Returns node status info.
|
374
|
+
|
375
|
+
```ruby
|
376
|
+
client = Minter::Api::Client.new
|
377
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
378
|
+
|
379
|
+
response = client.status
|
380
|
+
response.status
|
381
|
+
#=>200
|
382
|
+
response.body
|
383
|
+
#=>
|
384
|
+
{"jsonrpc"=>"2.0",
|
385
|
+
"id"=>"",
|
386
|
+
"result"=>
|
387
|
+
{"version"=>"1.1.6-testnet",
|
388
|
+
"latest_block_hash"=>"E20E0B26DAB8CEE5AC1CB46B5184C63565522978EDF153DA3017C7D34F2D3F30",
|
389
|
+
"latest_app_hash"=>"995C21A980D4E0A7649E56252CB4E279A5820655B717A017FC09FE2E9D841554",
|
390
|
+
"latest_block_height"=>"702448",
|
391
|
+
"latest_block_time"=>"2020-05-12T20:59:23.252868652Z",
|
392
|
+
"keep_last_states"=>"120",
|
393
|
+
"tm_status"=>
|
394
|
+
{"node_info"=>
|
395
|
+
{"protocol_version"=>{"p2p"=>"7", "block"=>"10", "app"=>"6"},
|
396
|
+
"id"=>"4735e67924e611b89fbd3f951441b5e912e226d3",
|
397
|
+
"listen_addr"=>"tcp://0.0.0.0:26656",
|
398
|
+
"network"=>"minter-testnet-08-04",
|
399
|
+
"version"=>"0.33.2",
|
400
|
+
"channels"=>"4020212223303800",
|
401
|
+
"moniker"=>"minter-node-1.testnet.minter.network",
|
402
|
+
"other"=>{"tx_index"=>"on", "rpc_address"=>"tcp://127.0.0.1:26657"}},
|
403
|
+
"sync_info"=>
|
404
|
+
{"latest_block_hash"=>"E20E0B26DAB8CEE5AC1CB46B5184C63565522978EDF153DA3017C7D34F2D3F30",
|
405
|
+
"latest_app_hash"=>"995C21A980D4E0A7649E56252CB4E279A5820655B717A017FC09FE2E9D841554",
|
406
|
+
"latest_block_height"=>"702448",
|
407
|
+
"latest_block_time"=>"2020-05-12T20:59:23.252868652Z",
|
408
|
+
"catching_up"=>false},
|
409
|
+
"validator_info"=>
|
410
|
+
{"address"=>"43253BE55C58BCA3045BEFABEF873944B56E3555", "pub_key"=>{"type"=>"tendermint/PubKeyEd25519", "value"=>"DSmoPlRlOh1fNOVh4BNfHoHLyuFS8fMnqzaFen4y3kw="}, "voting_power"=>"98784385"}}}}
|
411
|
+
|
412
|
+
```
|
413
|
+
|
414
|
+
### Transaction
|
415
|
+
|
416
|
+
Returns transaction info.
|
417
|
+
|
418
|
+
```ruby
|
419
|
+
client = Minter::Api::Client.new
|
420
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
421
|
+
|
422
|
+
transaction_hash = "Mt56c1957d15bf4143f7cd180f837bce51564a054cfbdaf5c5e179f9b0aad8e8b2"
|
423
|
+
|
424
|
+
response = client.transaction_info(transaction_hash: transaction_hash)
|
425
|
+
response.status
|
426
|
+
#=>200
|
427
|
+
response.body
|
428
|
+
#=>
|
429
|
+
{"jsonrpc"=>"2.0",
|
430
|
+
"id"=>"",
|
431
|
+
"result"=>
|
432
|
+
{"hash"=>"56C1957D15BF4143F7CD180F837BCE51564A054CFBDAF5C5E179F9B0AAD8E8B2",
|
433
|
+
"raw_tx"=>
|
434
|
+
"f88522020a8a4d4e540000000000000001abea8a4d4e540000000000000094e7812ab98ac5ac37e2ab20da3136ad91bb22d49789014d1120d7b1600000808001b845f8431ba07424d88d612132c847c1c92c1f471471fa8034914260223cb547f097e2bd7587a0201fa4d869ba564538996a71e6aa1e2b069d746b8fa0a563e023989986ae91a7",
|
435
|
+
"height"=>"701284",
|
436
|
+
"index"=>0,
|
437
|
+
"from"=>"Mx251cb0043a0240779103aa7c210f638f887699f8",
|
438
|
+
"nonce"=>"34",
|
439
|
+
"gas"=>"10",
|
440
|
+
"gas_price"=>10,
|
441
|
+
"gas_coin"=>"MNT",
|
442
|
+
"type"=>1,
|
443
|
+
"data"=>{"coin"=>"MNT", "to"=>"Mxe7812ab98ac5ac37e2ab20da3136ad91bb22d497", "value"=>"24000000000000000000"},
|
444
|
+
"payload"=>"",
|
445
|
+
"tags"=>{"tx.type"=>"01", "tx.from"=>"251cb0043a0240779103aa7c210f638f887699f8", "tx.to"=>"e7812ab98ac5ac37e2ab20da3136ad91bb22d497", "tx.coin"=>"MNT"}}}
|
446
|
+
```
|
447
|
+
|
448
|
+
### Transactions
|
449
|
+
|
450
|
+
Return transactions by query.
|
451
|
+
|
452
|
+
```ruby
|
453
|
+
client = Minter::Api::Client.new
|
454
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
455
|
+
|
456
|
+
query = "tags.tx.coin='MNT'"
|
457
|
+
page = 1
|
458
|
+
per_page = 1
|
459
|
+
response = client.transactions(query: query, per_page: per_page, page: page)
|
460
|
+
response.status
|
461
|
+
#=> 200
|
462
|
+
response.body
|
463
|
+
#=>
|
464
|
+
{"jsonrpc"=>"2.0",
|
465
|
+
"id"=>"",
|
466
|
+
"result"=>
|
467
|
+
[{"hash"=>"9398DB947BC1397212C3F7FBE3D4131E68DDD1CA5AD36860DF5D7700E1C279EB",
|
468
|
+
"raw_tx"=>
|
469
|
+
"f87e82229102018a4d4e540000000000000001a2e18a4d4e540000000000000094a1f103c242237370d409ff5ff9f1817d42f94dda80808001b845f8431ba0a377be8dcab2a0cd005a8b392876724ed97aea4c312dc1081f581384ec938a1da01851f86f174c6d104ebb61cdab4e38056641147777e12e1184d8140c2b85d080",
|
470
|
+
"height"=>"702308",
|
471
|
+
"index"=>0,
|
472
|
+
"from"=>"Mxa1f103c242237370d409ff5ff9f1817d42f94dda",
|
473
|
+
"nonce"=>"8849",
|
474
|
+
"gas"=>"10",
|
475
|
+
"gas_price"=>1,
|
476
|
+
"gas_coin"=>"MNT",
|
477
|
+
"type"=>1,
|
478
|
+
"data"=>{"coin"=>"MNT", "to"=>"Mxa1f103c242237370d409ff5ff9f1817d42f94dda", "value"=>"0"},
|
479
|
+
"payload"=>"",
|
480
|
+
"tags"=>{"tx.type"=>"01", "tx.from"=>"a1f103c242237370d409ff5ff9f1817d42f94dda", "tx.to"=>"a1f103c242237370d409ff5ff9f1817d42f94dda", "tx.coin"=>"MNT"}}]}
|
481
|
+
|
482
|
+
```
|
483
|
+
|
484
|
+
### Unconfirmed Transactions
|
485
|
+
|
486
|
+
Returns unconfirmed transactions.
|
487
|
+
|
488
|
+
|
489
|
+
```ruby
|
490
|
+
client = Minter::Api::Client.new
|
491
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
492
|
+
|
493
|
+
query = "tags.tx.coin='MNT'"
|
494
|
+
page = 1
|
495
|
+
per_page = 1
|
496
|
+
response = client.unconfirmed_transactions
|
497
|
+
response.status
|
498
|
+
#=> 200
|
499
|
+
response.body
|
500
|
+
#=>
|
501
|
+
{"jsonrpc"=>"2.0", "id"=>"", "result"=>{"n_txs"=>"0", "total"=>"0", "total_bytes"=>"0", "txs"=>[]}}
|
502
|
+
```
|
503
|
+
|
504
|
+
### Validators
|
505
|
+
|
506
|
+
Returns list of active validators.
|
507
|
+
|
508
|
+
```ruby
|
509
|
+
client = Minter::Api::Client.new
|
510
|
+
client.node_url = "https://minter-node-1.testnet.minter.network:8841"
|
511
|
+
|
512
|
+
response = client.validators
|
513
|
+
response.status
|
514
|
+
#=>200
|
515
|
+
response.body
|
516
|
+
#=>
|
517
|
+
{"jsonrpc"=>"2.0",
|
518
|
+
"id"=>"",
|
519
|
+
"result"=>
|
520
|
+
[{"pub_key"=>"Mp0d29a83e54653a1d5f34e561e0135f1e81cbcae152f1f327ab36857a7e32de4c", "voting_power"=>"99121402"},
|
521
|
+
{"pub_key"=>"Mpa3c16ffc2af26f199dd23c52932ce22441f848aa3ab2b7015de01e2f9c293464", "voting_power"=>"49661"},
|
522
|
+
{"pub_key"=>"Mpf17328239cd81453b9e9393f66137e5442fb108c7b4fc36b6acfd838f7e6e0c4", "voting_power"=>"9911"},
|
523
|
+
{"pub_key"=>"Mp14c93843ca40a62b9e7d02a824e7ffe83b49e3329ae963afdd7e500071ab9bfc", "voting_power"=>"819024"}]}
|
524
|
+
|
525
|
+
|
526
|
+
```
|
527
|
+
|
528
|
+
## Using Minter SDK
|
529
|
+
|
530
|
+
### Sign transaction
|
531
|
+
|
532
|
+
Returns a signed tx.
|
533
|
+
|
534
|
+
#### Single signature
|
535
|
+
|
536
|
+
```ruby
|
537
|
+
transaction = Minter::SendCoinTx.new(
|
538
|
+
address_to: "Mxe7812ab98ac5ac37e2ab20da3136ad91bb22d497",
|
539
|
+
value: 24_000_000_000_000_000_000,
|
540
|
+
coin: "MNT",
|
541
|
+
nonce: 1,
|
542
|
+
chain_id: 2,
|
543
|
+
gas_coin: "MNT",
|
544
|
+
gas_price: 10
|
545
|
+
)
|
546
|
+
|
547
|
+
signed_tx = sign(private_key)
|
548
|
+
signed_tx.tx_hash
|
549
|
+
#=> "0xf88501020a8a4d4e540000000000000001abea8a4d4e540000000000000094e7812ab98ac5ac37e2ab20da3136ad91bb22d49789014d1120d7b1600000808001b845f8431ba07fde3c0e8d9ffb5fd7025099c9f3672deffab0b784787f5d45ea8f27b0ffe989a02f7cd63ac0d75e559f540d8b33464b11da4605e623d62a5b2ddce5adf70c35cb"
|
550
|
+
```
|
551
|
+
|
552
|
+
#### Multi signatures
|
553
|
+
```ruby
|
554
|
+
# IN PROGRESS
|
555
|
+
```
|
556
|
+
|
557
|
+
### Create transaction
|
558
|
+
|
559
|
+
#### Send transaction
|
560
|
+
|
561
|
+
Transaction for sending arbitrary coin.
|
562
|
+
|
563
|
+
coin - Symbol of a coin.
|
564
|
+
address_to - Recipient address in Minter Network.
|
565
|
+
value - Amount of Coin to send.
|
566
|
+
|
567
|
+
##### Example
|
568
|
+
|
569
|
+
```ruby
|
570
|
+
Minter::SendCoinTx.new(
|
571
|
+
address_to: "Mxe7812ab98ac5ac37e2ab20da3136ad91bb22d497",
|
572
|
+
value: 24_000_000_000_000_000_000,
|
573
|
+
coin: "MNT",
|
574
|
+
nonce: 1,
|
575
|
+
chain_id: 2,
|
576
|
+
gas_coin: "MNT",
|
577
|
+
gas_price: 10
|
578
|
+
)
|
579
|
+
```
|
580
|
+
|
581
|
+
#### Sell coin transaction
|
582
|
+
|
583
|
+
Transaction for selling one coin (owned by sender) in favour of another coin in a system.
|
584
|
+
|
585
|
+
coin_to_sell - Symbol of a coin to give.
|
586
|
+
value_to_sell - Amount of CoinToSell to give.
|
587
|
+
coin_to_buy - Symbol of a coin to get.
|
588
|
+
minimum_value_to_buy - Minimum value of coins to get.
|
589
|
+
|
590
|
+
##### Example
|
591
|
+
|
592
|
+
```ruby
|
593
|
+
Minter::SellCoinTx.new(
|
594
|
+
coin_to_sell: "MNT",
|
595
|
+
value_to_sell: 1_000_000_000_000_000_000,
|
596
|
+
coin_to_buy: "TEST",
|
597
|
+
minimum_value_to_buy: 1_000_000_000_000_000_000,
|
598
|
+
nonce: 1,
|
599
|
+
chain_id: 2,
|
600
|
+
gas_coin: "MNT",
|
601
|
+
gas_price: 1
|
602
|
+
)
|
603
|
+
```
|
604
|
+
|
605
|
+
#### Sell all coin transaction
|
606
|
+
|
607
|
+
Transaction for selling one coin (owned by sender) in favour of another coin in a system.
|
608
|
+
|
609
|
+
coin_to_sell - Symbol of a coin to give.
|
610
|
+
coin_to_buy - Symbol of a coin to get.
|
611
|
+
minimum_value_to_buy - Minimum value of coins to get.
|
612
|
+
|
613
|
+
##### Example
|
614
|
+
|
615
|
+
```ruby
|
616
|
+
Minter::SellAllCoinTx.new(
|
617
|
+
coin_to_sell: "MNT",
|
618
|
+
coin_to_buy: "TEST",
|
619
|
+
minimum_value_to_buy: 1_000_000_000_000_000_000,
|
620
|
+
nonce: 1,
|
621
|
+
chain_id: 2,
|
622
|
+
gas_coin: "MNT",
|
623
|
+
gas_price: 1
|
624
|
+
)
|
625
|
+
```
|
626
|
+
|
627
|
+
#### Buy coin transaction
|
628
|
+
|
629
|
+
Transaction for buy a coin paying another coin (owned by sender).
|
630
|
+
|
631
|
+
coin_to_buy - Symbol of a coin to get.
|
632
|
+
value_to_buy - Amount of CoinToBuy to get.
|
633
|
+
coin_to_sell - Symbol of a coin to give.
|
634
|
+
maximum_value_to_sell - Maximum value of coins to sell.
|
635
|
+
|
636
|
+
##### Example
|
637
|
+
|
638
|
+
```ruby
|
639
|
+
transaction = Minter::BuyCoinTx.new(
|
640
|
+
coin_to_buy: "TEST",
|
641
|
+
value_to_buy: 1_000_000_000_000_000_000,
|
642
|
+
coin_to_sell: "MNT",
|
643
|
+
maximum_value_to_sell: 1_000_000_000_000_000_000,
|
644
|
+
nonce: 1,
|
645
|
+
chain_id: 2,
|
646
|
+
gas_coin: "MNT",
|
647
|
+
gas_price: 1
|
648
|
+
)
|
649
|
+
```
|
650
|
+
|
651
|
+
#### Create coin transaction
|
652
|
+
|
653
|
+
Transaction for creating new coin in a system.
|
654
|
+
|
655
|
+
name - Name of a coin. Arbitrary string up to 64 letters length.
|
656
|
+
symbol - Symbol of a coin. Must be unique, alphabetic, uppercase, 3 to 10 symbols length.
|
657
|
+
initial_amount - Amount of coins to issue. Issued coins will be available to sender account.
|
658
|
+
initial_reserve - Initial reserve in BIP's. ConstantReserveRatio - CRR, uint, should be from 10 to 100.
|
659
|
+
|
660
|
+
##### Example
|
661
|
+
|
662
|
+
```ruby
|
663
|
+
Minter::CreateCoinTx.new(
|
664
|
+
name: "SUPER TEST",
|
665
|
+
symbol: "SPRTEST",
|
666
|
+
initial_amount: 100_000_000_000_000_000_000,
|
667
|
+
initial_reserve: 10_000_000_000_000_000_000,
|
668
|
+
reserve_ratio: 10,
|
669
|
+
max_supply: 1_000_000_000_000_000_000_000,
|
670
|
+
nonce: 1,
|
671
|
+
chain_id: 2,
|
672
|
+
gas_coin: "MNT",
|
673
|
+
gas_price: 1
|
674
|
+
)
|
675
|
+
```
|
676
|
+
|
677
|
+
#### Declare candidacy transaction
|
678
|
+
|
679
|
+
Transaction for declaring new validator candidacy.
|
680
|
+
|
681
|
+
address - Address of candidate in Minter Network. This address would be able to control candidate. Also all rewards will be sent to this address.
|
682
|
+
pubkey - Public key of a validator.
|
683
|
+
commission - Commission (from 0 to 100) from rewards which delegators will pay to validator.
|
684
|
+
coin - Symbol of coin to stake. Stake - Amount of coins to stake.
|
685
|
+
|
686
|
+
##### Example
|
687
|
+
|
688
|
+
```ruby
|
689
|
+
Minter::DeclareCandidacyTx.new(
|
690
|
+
address: "Mx9f7fd953c2c69044b901426831ed03ee0bd0597a",
|
691
|
+
pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
|
692
|
+
commission: 10,
|
693
|
+
coin: "MNT",
|
694
|
+
stake: 5_000_000_000_000_000_000,
|
695
|
+
nonce: 1,
|
696
|
+
chain_id: 2,
|
697
|
+
gas_coin: "MNT",
|
698
|
+
gas_price: 1
|
699
|
+
)
|
700
|
+
```
|
701
|
+
|
702
|
+
#### Delegate transaction
|
703
|
+
|
704
|
+
Transaction for delegating funds to validator.
|
705
|
+
|
706
|
+
pubkey - Public key of a validator.
|
707
|
+
coin - Symbol of coin to stake.
|
708
|
+
value - Amount of coins to stake.
|
709
|
+
|
710
|
+
##### Example
|
711
|
+
|
712
|
+
```ruby
|
713
|
+
Minter::DelegateTx.new(
|
714
|
+
pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
|
715
|
+
coin: "MNT",
|
716
|
+
value: 10_000_000_000_000_000_000,
|
717
|
+
nonce: 1,
|
718
|
+
chain_id: 2,
|
719
|
+
gas_coin: "MNT",
|
720
|
+
gas_price: 1
|
721
|
+
)
|
722
|
+
```
|
723
|
+
|
724
|
+
#### Unbond transaction
|
725
|
+
|
726
|
+
Transaction for unbonding funds from validator's stake.
|
727
|
+
|
728
|
+
pubkey - Public key of a validator.
|
729
|
+
coin - Symbol of coin to stake.
|
730
|
+
value - Amount of coins to stake.
|
731
|
+
|
732
|
+
##### Example
|
733
|
+
|
734
|
+
```ruby
|
735
|
+
Minter::UnbondTx.new(
|
736
|
+
pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
|
737
|
+
coin: "MNT",
|
738
|
+
value: 10_000_000_000_000_000_000,
|
739
|
+
nonce: 1,
|
740
|
+
chain_id: 2,
|
741
|
+
gas_coin: "MNT",
|
742
|
+
gas_price: 1
|
743
|
+
)
|
744
|
+
```
|
745
|
+
|
746
|
+
#### Redeem check transaction
|
747
|
+
|
748
|
+
Transaction for redeeming a check.
|
749
|
+
|
750
|
+
RawCheck - Raw check received from sender. Proof - Proof of owning a check.
|
751
|
+
|
752
|
+
Note that maximum GasPrice is limited to 1 to prevent fraud, because GasPrice is set by redeem tx sender but commission is charded from check issuer.
|
753
|
+
|
754
|
+
##### Example
|
755
|
+
|
756
|
+
```ruby
|
757
|
+
Minter::RedeemCheckTx.new(
|
758
|
+
check: check,
|
759
|
+
proof: proof,
|
760
|
+
nonce: 1,
|
761
|
+
chain_id: 2,
|
762
|
+
gas_coin: "MNT",
|
763
|
+
gas_price: 1
|
764
|
+
)
|
765
|
+
```
|
766
|
+
|
767
|
+
#### Set candidate online transaction
|
768
|
+
|
769
|
+
Transaction for turning candidate on. This transaction should be sent from address which is set in the "Declare candidacy transaction".
|
770
|
+
|
771
|
+
PubKey - Public key of a validator.
|
772
|
+
|
773
|
+
##### Example
|
774
|
+
|
775
|
+
```ruby
|
776
|
+
Minter::SetCandidateOnTx.new(
|
777
|
+
pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
|
778
|
+
nonce: 1,
|
779
|
+
chain_id: 2,
|
780
|
+
gas_coin: "MNT",
|
781
|
+
gas_price: 1
|
782
|
+
)
|
783
|
+
```
|
784
|
+
|
785
|
+
#### Set candidate offline transaction
|
786
|
+
|
787
|
+
Transaction for turning candidate off. This transaction should be sent from address which is set in the "Declare candidacy transaction".
|
24
788
|
|
25
|
-
|
789
|
+
PubKey - Public key of a validator.
|
26
790
|
|
27
|
-
|
791
|
+
##### Example
|
792
|
+
|
793
|
+
```ruby
|
794
|
+
Minter::SetCandidateOffTx.new(
|
795
|
+
pubkey: "Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43",
|
796
|
+
nonce: 1,
|
797
|
+
chain_id: 2,
|
798
|
+
gas_coin: "MNT",
|
799
|
+
gas_price: 1
|
800
|
+
)
|
801
|
+
```
|
802
|
+
|
803
|
+
#### Edit candidate transaction
|
804
|
+
|
805
|
+
Transaction for editing existing candidate.
|
806
|
+
|
807
|
+
##### Example
|
808
|
+
```ruby
|
809
|
+
Minter::EditCandidateTx.new(
|
810
|
+
pubkey: "Mp4ae1ee73e6136c85b0ca933a9a1347758a334885f10b3238398a67ac2eb153b8",
|
811
|
+
reward_address: "Mx89e5dc185e6bab772ac8e00cf3fb3f4cb0931c47",
|
812
|
+
owner_address: "Mxe731fcddd37bb6e72286597d22516c8ba3ddffa0",
|
813
|
+
nonce: 1,
|
814
|
+
chain_id: 2,
|
815
|
+
gas_coin: "MNT",
|
816
|
+
gas_price: 1
|
817
|
+
)
|
818
|
+
```
|
819
|
+
|
820
|
+
#### Create multisig address
|
821
|
+
|
822
|
+
Transaction for creating multisignature address.
|
823
|
+
|
824
|
+
```ruby
|
825
|
+
# IN PROGRESS
|
826
|
+
```
|
827
|
+
#### Multisend transaction
|
828
|
+
|
829
|
+
Transaction for sending coins to multiple addresses.
|
830
|
+
|
831
|
+
##### Example
|
832
|
+
|
833
|
+
```ruby
|
834
|
+
# IN PROGRESS
|
835
|
+
```
|
836
|
+
### Get fee of transaction
|
837
|
+
```ruby
|
838
|
+
# IN PROGRESS
|
839
|
+
```
|
840
|
+
|
841
|
+
### Decode Transaction
|
842
|
+
|
843
|
+
```ruby
|
844
|
+
# IN PROGRESS
|
845
|
+
```
|
846
|
+
### Minter Deep Links
|
847
|
+
|
848
|
+
```ruby
|
849
|
+
# IN PROGRESS
|
850
|
+
```
|
851
|
+
More info about [Minter Link Protocol](https://github.com/MinterTeam/minter-link-protocol)
|
852
|
+
|
853
|
+
### Minter Check
|
854
|
+
|
855
|
+
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.
|
856
|
+
|
857
|
+
* 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.
|
858
|
+
|
859
|
+
```ruby
|
860
|
+
# IN PROGRESS
|
861
|
+
```
|
862
|
+
|
863
|
+
* Sign Issue Check
|
864
|
+
|
865
|
+
```ruby
|
866
|
+
# IN PROGRESS
|
867
|
+
```
|
868
|
+
|
869
|
+
* Prepare check string and convert to data
|
870
|
+
|
871
|
+
```ruby
|
872
|
+
# IN PROGRESS
|
873
|
+
```
|
874
|
+
|
875
|
+
* Proof check
|
876
|
+
|
877
|
+
```ruby
|
878
|
+
# IN PROGRESS
|
879
|
+
```
|
880
|
+
|
881
|
+
### Minter Wallet
|
882
|
+
|
883
|
+
#### Create wallet
|
884
|
+
* This method returns generated seed, private key, public key, mnemonic and Minter address.
|
885
|
+
|
886
|
+
```ruby
|
887
|
+
wallet = Minter::Wallet.new
|
888
|
+
# => #<Minter::Wallet:0x00007fa168c31f48
|
889
|
+
# @address="Mx02b065d31b57511279f5b4d6ddb4c35a5ab0ebff",
|
890
|
+
# @mnemonic=
|
891
|
+
# "you random jacket limit ship vacuum mango various penalty imitate swallow second",
|
892
|
+
# @private_key=
|
893
|
+
# "7ced83b93186ff8d4c20f6b8b6f4a610eafd64d12024105f68796120dd3e7bce",
|
894
|
+
# @public_key=
|
895
|
+
# "Mp961589ae817659c6bb323587faa9a92a91b5e8481dd3b73ad0dc680464dac5adbc2d498064598bc36e158436fb1861245ef909a1776e5cb50221db718c82a483">
|
896
|
+
```
|
897
|
+
|
898
|
+
|
899
|
+
### Minter Key
|
900
|
+
#### Generate mnemonic.
|
901
|
+
|
902
|
+
```ruby
|
903
|
+
mnemonic = Minter::Key.new_mnemonic
|
904
|
+
#=> "rice joy gift diamond wisdom scout junk keen math page firm regular"
|
905
|
+
```
|
906
|
+
|
907
|
+
#### Get private key from mnemonic.
|
908
|
+
|
909
|
+
```ruby
|
910
|
+
private_key = Minter::Key.private_key_from_mnemonic(mnemonic)
|
911
|
+
# => "4f9706c0fa8f63a9481379579b4e6ab2d1e41ae8adab0885f58dc6a4859451be"
|
912
|
+
```
|
913
|
+
|
914
|
+
#### Get public key from private key.
|
915
|
+
|
916
|
+
```ruby
|
917
|
+
public_key = Minter::Key.public_key_from_private_key(private_key)
|
918
|
+
#=> "Mp4357760042c69a3414b9f66236e0cf0cc583c2bb49dff7c3cf68968df1e131bfa54483d0da3291dcba8980cf86ebe8c4d38186efe7322d5d7a3d5501149e6fb0"
|
919
|
+
```
|
920
|
+
|
921
|
+
#### Get Minter address from public key.
|
922
|
+
|
923
|
+
```ruby
|
924
|
+
address = Minter::Key.address_from_public_key(public_key)
|
925
|
+
#=> "Mx703323dfeabdffc976c62fb156c58ea41606831e"
|
926
|
+
```
|
927
|
+
|
928
|
+
#### Get Minter address from private key.
|
929
|
+
```ruby
|
930
|
+
address = Minter::Key.address_from_private_key(private_key)
|
931
|
+
#=> "Mx703323dfeabdffc976c62fb156c58ea41606831e"
|
932
|
+
```
|
933
|
+
#### Get Minter address from mnemonic.
|
934
|
+
```ruby
|
935
|
+
address = Minter::Key.address_from_mnemonic(mnemonic)
|
936
|
+
#=> "Mx703323dfeabdffc976c62fb156c58ea41606831e"
|
937
|
+
```
|
938
|
+
|
939
|
+
## Tests
|
940
|
+
|
941
|
+
To run tests:
|
942
|
+
|
943
|
+
```shell script
|
944
|
+
bundle install
|
945
|
+
rpsec
|
946
|
+
```
|
28
947
|
|
29
948
|
## Development
|
30
949
|
|