nanook 2.4.0 → 3.1.0

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: 632d341b2aa122d7c5049077fbebf1fd67097abb9bc0a4814ae938d2a5d70356
4
- data.tar.gz: 9e640aadc4074e46b95e2ceafff4a67808aeca2f181dd95d530fb1d52fb5be30
3
+ metadata.gz: fd2278329714fcd1e6778b5cbc85791f67e4fc835a7e6210abedc698f677645f
4
+ data.tar.gz: 074e3d14d1692038016973492c6d7475815e2b67f670ddba8d0e118e6fcbedfa
5
5
  SHA512:
6
- metadata.gz: a697f30061015b19d30075698e7d08fb4c868d886abfb8c420367e929dbf94b800b49f735785f1c6a72cda9ae8287704a90532b553c37c1ac0e8130118197b53
7
- data.tar.gz: 79ecfa816e0c6d2b7b2c671ac99a28bc8840dfff71a5c6e5608a5700a80c3dcf18632141b91d76d9d31219cb111395d220bb05b9ca744513415238cc6003ab1a
6
+ metadata.gz: 2fb9465657aa458639093281da94821ce9b07731c4b44309fa3372416ec2fa928a77e3d1c8260f4013a21cd51335c92d1cf58aa48cdbb0f5629796b46977c814
7
+ data.tar.gz: 3d518590b7433bdce1696ccc5d23fa2fc93d60101649ccb954de813493e51f2535f6d85bc91d841bdb7f54539c6f7f20444daaea877562b240191354bd37d3d9
data/CHANGELOG.md CHANGED
@@ -4,6 +4,145 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 3.1.0
8
+
9
+ ### Added
10
+
11
+ - `Block#next`.
12
+ - `Block#descendants` aliases `Block#successors`
13
+
14
+ ### Changed
15
+
16
+ - `Block.chain` and `Block.successors` no longer return the Block itself in the response.
17
+
18
+ ## 3.0.1
19
+
20
+ ### Fixed
21
+
22
+ - Fix `Block#type` being `nil` when RPC doesn't return a `subtype`.
23
+
24
+ ## 3.0.0
25
+
26
+ ### Removed
27
+
28
+ - `Nanook::Block#block_count_by_type` Removed, as the RPC no longer supports this command.
29
+ - `Nanook::Block#history` Removed, as the RPC command is deprecated.
30
+ - `Nanook::Block#publish` Removed, as the RPC command expects more data than what we instantiate within `Nanook::Block`.
31
+ - Removed all RPC calls that are not recommended for production:
32
+ - `Nanook::Node#bootstrap_status`.
33
+ - `Nanook::Node#confirmation_history`.
34
+ - `Nanook::Node#confirmed_recently?`.
35
+ - `Nanook::Key` Replaced by `Nanook::PrivateKey`.
36
+ - `Nanook::Account#info` No longer accepts `detailed:` argument.
37
+ - `Nanook::Node#synced?` As this was deprecated for removal in v3.0.
38
+
39
+ ### Added
40
+
41
+ - Added missing `Nanook::WalletAccount#block_count` delegate.
42
+ - Added `Nanook#network_telemetry`.
43
+ - Added `Nanook::Rpc#test`.
44
+ - Added `Nanook::WalletAccount#work`.
45
+ - Added `Nanook::WalletAccount#set_work`.
46
+ - Added `Nanook::Account#blocks`.
47
+ - Added `Nanook::Account#delegators_count`.
48
+ - Added `Nanook::Account#open_block`.
49
+ - Added `Nanook::Node#change_receive_minimum`.
50
+ - Added `Nanook::Node#confirmation_quorum`.
51
+ - Added `Nanook::Node#keepalive`.
52
+ - Added `Nanook::Node#receive_minimum`.
53
+ - Added `Nanook::Node#search_pending`.
54
+ - Added `Nanook::Wallet#history`.
55
+ - Added `Nanook::Wallet#exists?`.
56
+ - Added `Nanook::Wallet#ledger`.
57
+ - Added `Nanook::Wallet#move_accounts`.
58
+ - Added `Nanook::Wallet#remove_account`.
59
+ - Added `Nanook::Wallet#republish_blocks`.
60
+ - Added `Nanook::Wallet#search_pending`.
61
+ - Added `Nanook::Wallet#work`.
62
+ - Added `Nanook::Block#account`.
63
+ - Added `Nanook::Block#amount`.
64
+ - Added `Nanook::Block#balance`.
65
+ - Added `Nanook::Block#change?`.
66
+ - Added `Nanook::Block#confirmed?`.
67
+ - Added `Nanook::Block#epoch?`.
68
+ - Added `Nanook::Block#exists?`.
69
+ - Added `Nanook::Block#height`.
70
+ - Added `Nanook::Block#open?`.
71
+ - Added `Nanook::Block#previous`.
72
+ - Added `Nanook::Block#receive?`.
73
+ - Added `Nanook::Block#representative`.
74
+ - Added `Nanook::Block#send?`.
75
+ - Added `Nanook::Block#signature`.
76
+ - Added `Nanook::Block#timestamp`.
77
+ - Added `Nanook::Block#type`.
78
+ - Added `Nanook::Block#unconfirmed?`.
79
+ - Added `Nanook::Block#work`.
80
+ - Added `Nanook::PrivateKey` with methods `#create`, `#account` and `#public_key`.
81
+ - Added `Nanook::PublicKey` with method `#account`.
82
+ - Added equality testing methods `#==`, `#eql?` and `#hash` for:
83
+ - `Nanook::Account`
84
+ - `Nanook::Block`
85
+ - `Nanook::PrivateKey`
86
+ - `Nanook::PublicKey`
87
+ - `Nanook::Wallet`
88
+ - `Nanook::WalletAccount`
89
+
90
+ ### Changed
91
+
92
+ - New error classes: `Nanook::ConnectionError`, `NanoUnitError`, `NodeRpcError` and `NodeRpcConfigurationError`.
93
+ - `Nanook::Wallet#default_representative` returns a `Nanook::Account`.
94
+ - `Nanook::Wallet#change_representative` returns a `Nanook::Account`.
95
+ - `Nanook::Wallet#unlock` can be passed no argument (`password` will be `nil`).
96
+ - `Nanook::Wallet#info` returns data from `wallet_info` RPC.
97
+ - `Nanook::Block#is_valid_work?` renamed to `#valid_work?`.
98
+ - `Nanook::Block#republish` returns an Array of `Nanook::Block`s.
99
+ - `Nanook::Block#chain` returns an Array of `Nanook::Block`s.
100
+ - `Nanook::Block#successors` returns an Array of `Nanook::Block`s.
101
+ - `Nanook::Block#info`:
102
+ - returns balances in nano, and can optionally be passed `unit: :raw` argument.
103
+ - returns account values as `Nanook::Account` and block values as `Nanook::Block`.
104
+ - `Nanook::Node#peers` returns details as a `Hash` keyed by `Nanook::Account`.
105
+ - `Nanook::Account#pending` returns source as `Nanook::Account` and block as `Nanook::Block` when `detailed: true`.
106
+ - `Nanook::Account#representative` returns a `Nanook::Account`.
107
+ - `Nanook::Account#delegators` returns accounts as `Nanook::Account`s.
108
+ - `Nanook::Account#history` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
109
+ - `Nanook::Account#ledger` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
110
+ - `Nanook::Account#public_key` returns a `Nanook::PublicKey`.
111
+ - `Nanook::Account#weight` accepts an optional `unit:` argment.
112
+ - `Nanook::Account#info`:
113
+ - returns the `frontier`, `open_block`, `representative_block` values as `Nanook::Block`s.
114
+ - returns the `representative` as a `Nanook::Account`.
115
+ - `modified_timestamp` key renamed to `last_modified_at` and value is a `Time` in UTC.
116
+ - `Nanook::Key` has become `Nanook::PrivateKey`, `#generate` has been renamed `#create` and returns a `Nanook::PrivateKey`.
117
+
118
+ ### Fixed
119
+
120
+ - A number of errors when node is still bootstrapping and is missing accounts from the ledger.
121
+ - `Nanook::Node#representatives_online` accessing representative list as a `Hash` after RPC change.
122
+
123
+ ## 2.5.1
124
+
125
+ ### Fixed
126
+
127
+ - undefined method 'new' for `BigDecimal:Class` (thank you @MihaiVoinea)
128
+
129
+ ## 2.5.0
130
+
131
+ ### Added
132
+
133
+ - New `Nanook::Node#bootstrap_lazy` method.
134
+ - New `Nanook::Node#bootstrap_status` method.
135
+ - New `Nanook::Node#difficulty` method.
136
+ - New `Nanook::Node#uptime` method.
137
+ - New `Nanook::Wallet#lock` method.
138
+
139
+ ### Changed
140
+
141
+ - `Nanook::Node#chain` now takes optional `offset` argument.
142
+ - `Nanook::Node#successors` now takes optional `offset` argument.
143
+ - `Nanook::Node#successors` now aliased as `Nanook::Node#ancestors`
144
+ - Updated docs to use `nano_` prefixed addresses.
145
+
7
146
  ## 2.4.0
8
147
 
9
148
  ### Added
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Nanook
2
2
 
3
- This is a Ruby library for managing a [nano currency](https://nano.org/) node, including making and receiving payments, using the [nano RPC protocol](https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol). Nano is a fee-less, fast, environmentally-friendly cryptocurrency. It's awesome. See [https://nano.org](https://nano.org/).
3
+ This is a Ruby library for managing a [nano currency](https://nano.org/) node, including making and receiving payments, using the [nano RPC protocol](https://docs.nano.org/commands/rpc-protocol). Nano is a fee-less, fast, environmentally-friendly cryptocurrency. It's awesome. See [https://nano.org](https://nano.org/).
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/nanook.svg)](https://badge.fury.io/rb/nanook)
6
6
  [![CircleCI](https://circleci.com/gh/lukes/nanook/tree/master.svg?style=shield)](https://circleci.com/gh/lukes/nanook/tree/master)
@@ -26,7 +26,7 @@ Or install it yourself as:
26
26
 
27
27
  ## Initializing
28
28
 
29
- Nanook will by default connect to `http://localhost:7076`.
29
+ Nanook will by default connect to `http://[::1]:7076`.
30
30
 
31
31
  ```ruby
32
32
  nanook = Nanook.new
@@ -35,7 +35,7 @@ nanook = Nanook.new
35
35
  To connect to another host instead:
36
36
 
37
37
  ```ruby
38
- nanook = Nanook.new("http://ip6-localhost:7076")
38
+ nanook = Nanook.new("http://localhost:7076")
39
39
  ```
40
40
 
41
41
  ## Basics
@@ -45,19 +45,19 @@ nanook = Nanook.new("http://ip6-localhost:7076")
45
45
  Create a wallet:
46
46
 
47
47
  ```ruby
48
- Nanook.new.wallet.create
48
+ wallet = nanook.wallet.create
49
49
  ```
50
50
 
51
51
  Create an account within a wallet:
52
52
 
53
53
  ```ruby
54
- Nanook.new.wallet(wallet_id).account.create
54
+ account = wallet.account.create
55
55
  ```
56
56
 
57
57
  List accounts within a wallet:
58
58
 
59
59
  ```ruby
60
- Nanook.new.wallet(wallet_id).accounts
60
+ accounts = wallet.accounts
61
61
  ```
62
62
 
63
63
  ### Sending a payment
@@ -65,28 +65,28 @@ Nanook.new.wallet(wallet_id).accounts
65
65
  To send a payment from an account in a wallet:
66
66
 
67
67
  ```ruby
68
- account = Nanook.new.wallet(wallet_id).account(account_id)
68
+ account = nanook.wallet(wallet_id).account(account_id)
69
69
  account.pay(to: recipient_account_id, amount: 0.2, id: unique_id)
70
70
  ```
71
71
 
72
72
  Or, a wallet:
73
73
 
74
74
  ```ruby
75
- wallet = Nanook.new.wallet(wallet_id)
75
+ wallet = nanook.wallet(wallet_id)
76
76
  wallet.pay(from: your_account_id, to: recipient_account_id, amount: 0.2, id: unique_id)
77
77
  ```
78
78
 
79
- The `id` can be any string and needs to be unique per payment. It serves an important purpose; it allows you to make this call multiple times with the same `id` and be reassured that you will only ever send that nano payment once. From the [Nano RPC](https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol#account-create):
79
+ The `id` can be any string and needs to be unique per payment. It serves an important purpose; it allows you to make this call multiple times with the same `id` and be reassured that you will only ever send that nano payment once. From the [Nano RPC](https://docs.nano.org/commands/rpc-protocol/#send):
80
80
 
81
81
  > You can (and should) specify a unique id for each spend to provide idempotency. That means that if you [make the payment call] two times with the same id, the second request won't send any additional Nano.
82
82
 
83
- The unit of the `amount` is NANO (which is currently technically Mnano — see [What are Nano's Units](https://nano.org/en/faq#what-are-nano-units-)). You can pass an amount of raw instead by adding the `unit: :raw` argument:
83
+ The unit of the `amount` is NANO (which is currently technically Mnano — see [What are Nano's Units](https://docs.nano.org/protocol-design/distribution-and-units/#unit-dividers)). You can pass an amount of raw instead by adding the `unit: :raw` argument:
84
84
 
85
85
  ```ruby
86
86
  account.pay(to: recipient_account_id, amount: 999, unit: :raw, id: unique_id)
87
87
  ```
88
88
 
89
- Note, there may be a delay in receiving a response due to Proof of Work being done. From the [Nano RPC](https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol#account-create):
89
+ Note, there may be a delay in receiving a response due to Proof of Work being done. From the [Nano RPC](https://docs.nano.org/commands/rpc-protocol/#send):
90
90
 
91
91
  > Proof of Work is precomputed for one transaction in the background. If it has been a while since your last transaction it will send instantly, the next one will need to wait for Proof of Work to be generated.
92
92
 
@@ -95,12 +95,12 @@ Note, there may be a delay in receiving a response due to Proof of Work being do
95
95
  The simplest way to receive a payment is:
96
96
 
97
97
  ```ruby
98
- account = Nanook.new.wallet(wallet_id).account(account_id)
98
+ account = nanook.wallet(wallet_id).account(account_id)
99
99
  account.receive
100
100
 
101
101
  # or:
102
102
 
103
- wallet = Nanook.new.wallet(wallet_id)
103
+ wallet = nanook.wallet(wallet_id)
104
104
  wallet.receive(into: account_id)
105
105
  ```
106
106
 
@@ -109,42 +109,46 @@ The `receive` method when called as above will receive the latest pending paymen
109
109
  You can also receive a specific pending block if you know it (you may have discovered it through calling `account.pending` for example):
110
110
 
111
111
  ```ruby
112
- account = Nanook.new.wallet(wallet_id).account(account_id)
112
+ account = nanook.wallet(wallet_id).account(account_id)
113
113
  account.receive(block_id)
114
114
 
115
115
  # or:
116
116
 
117
- wallet = Nanook.new.wallet(wallet_id)
117
+ wallet = nanook.wallet(wallet_id)
118
118
  wallet.receive(block_id, into: account_id)
119
119
  ```
120
120
 
121
+ ## Exploring further
122
+
123
+ Read the [Using Nanook](https://github.com/lukes/nanook/wiki/Using-nanook) page for some example uses of Nanook to query the network.
124
+
121
125
  ## All commands
122
126
 
123
- Below is a quick reference list of commands. See the [full Nanook documentation](https://lukes.github.io/nanook/2.4.0/) for a searchable detailed description of every class and method, what the arguments mean, and example responses (Tip: the classes are listed under the "**Nanook** < Object" item in the sidebar).
127
+ Below is a quick reference list of commands. See the [full Nanook documentation](https://lukes.github.io/nanook/3.1.0/) for a searchable detailed description of every class and method, what the arguments mean, and example responses.
124
128
 
125
129
  ### Wallets
126
130
 
127
- See the [full documentation for Nanook::Wallet](https://lukes.github.io/nanook/2.4.0/Nanook/Wallet.html) for a detailed description of each method and example responses.
131
+ See the [full documentation for Nanook::Wallet](https://lukes.github.io/nanook/3.1.0/Nanook/Wallet.html) for a detailed description of each method and example responses.
128
132
 
129
133
  #### Create wallet:
130
134
 
131
135
  ```ruby
132
- Nanook.new.wallet.create
136
+ nanook.wallet.create
133
137
  ```
134
138
  #### Restoring a wallet from a seed
135
139
 
136
140
  ```ruby
137
- Nanook.new.wallet.restore(seed)
141
+ nanook.wallet.restore(seed)
138
142
  ```
139
143
  Optionally also restore the wallet's accounts:
140
144
  ```ruby
141
- Nanook.new.wallet.restore(seed, accounts: 2)
145
+ nanook.wallet.restore(seed, accounts: 2)
142
146
  ```
143
147
 
144
- #### Working with a single wallet:
148
+ #### Working with a wallet:
145
149
 
146
150
  ```ruby
147
- wallet = Nanook.new.wallet(wallet_id)
151
+ wallet = nanook.wallet(wallet_id)
148
152
 
149
153
  wallet.balance
150
154
  wallet.balance(account_break_down: true)
@@ -157,19 +161,32 @@ wallet.pending(detailed: true)
157
161
  wallet.pending(unit: :raw)
158
162
  wallet.receive(into: account_id)
159
163
  wallet.receive(pending_block_id, into: account_id)
164
+ wallet.search_pending
160
165
 
161
166
  wallet.account.create
167
+ wallet.account.create(5)
162
168
  wallet.accounts
163
169
  wallet.contains?(account_id)
170
+ wallet.move_accounts(from_wallet_id, [account_1_id, account_2_id])
171
+ wallet.remove_account(account_id)
164
172
 
165
173
  wallet.default_representative
166
- wallet.change_default_representative(new_representative)
174
+ wallet.change_default_representative(representative_account_id)
175
+ wallet.change_password(password)
176
+ wallet.exists?
177
+ wallet.history
178
+ wallet.history(unit: :raw)
167
179
  wallet.info
168
180
  wallet.info(unit: :raw)
169
181
  wallet.export
182
+ wallet.ledger
183
+ wallet.ledger(unit: :raw)
184
+ wallet.lock
170
185
  wallet.locked?
186
+ wallet.republish_blocks
187
+ wallet.republish_blocks(limit: 5)
171
188
  wallet.unlock(password)
172
- wallet.change_password(password)
189
+ wallet.work
173
190
 
174
191
  wallet.destroy
175
192
  ```
@@ -178,135 +195,159 @@ wallet.destroy
178
195
  #### Create account:
179
196
 
180
197
  ```ruby
181
- Nanook.new.wallet(wallet_id).account.create
198
+ nanook.wallet(wallet_id).account.create
182
199
  ```
183
200
 
184
201
  #### Create multiple accounts:
185
202
 
186
203
  ```ruby
187
- Nanook.new.wallet(wallet_id).account.create(5)
204
+ nanook.wallet(wallet_id).account.create(5)
188
205
  ```
189
206
 
190
- #### Working with a single account:
207
+ #### Working with an account:
191
208
 
192
- See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/2.4.0/Nanook/WalletAccount.html) for a detailed description of each method and example responses.
209
+ Any account on the Nano network that is known by your node can be initialized through `Nanook#account`:
193
210
 
194
211
  ```ruby
195
- account = Nanook.new.wallet(wallet_id).account(account_id)
212
+ account = nanook.account(account_id)
213
+ ```
196
214
 
215
+ See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/3.1.0/Nanook/Account.html) for a detailed description of each method and example responses.
216
+
217
+ ```ruby
197
218
  account.balance
198
219
  account.balance(unit: :raw)
199
- account.pay(to: recipient_account_id, amount: 2, id: unique_id)
200
- account.pay(to: recipient_account_id, amount: 2, id: unique_id, unit: :raw)
201
220
  account.pending
202
221
  account.pending(limit: 1)
203
222
  account.pending(detailed: true)
204
223
  account.pending(unit: :raw)
205
- account.receive
206
- account.receive(pending_block_id)
207
224
 
225
+ account.blocks
226
+ account.blocks(limit: 1)
227
+ account.blocks(sort: :desc)
228
+ account.delegators
229
+ account.delegators(unit: :raw)
230
+ account.delegators_count
208
231
  account.exists?
232
+ account.history
233
+ account.history(limit: 1)
234
+ account.history(unit: :raw)
235
+ account.history(sort: :desc)
209
236
  account.info
210
- account.info(detailed: true)
211
237
  account.info(unit: :raw)
212
238
  account.last_modified_at
213
239
  account.ledger
214
240
  account.ledger(limit: 10)
215
241
  account.ledger(modified_since: Time.now)
216
242
  account.ledger(unit: :raw)
217
- account.history
218
- account.history(limit: 1)
219
- account.history(unit: :raw)
243
+ account.ledger(sort: :desc)
244
+ account.open_block
220
245
  account.public_key
221
- account.delegators
222
- account.delegators(unit: :raw)
223
246
  account.representative
224
- account.change_representative(new_representative)
225
247
  account.weight
226
-
227
- account.destroy
248
+ account.weight(unit: :raw)
228
249
  ```
229
250
 
230
- #### Working with any account (not necessarily in your wallet):
251
+ #### Working with an account created on the node:
231
252
 
232
- See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/2.4.0/Nanook/Account.html) for a detailed description of each method and example responses.
253
+ Accounts that have been created on your node can have
254
+ additional methods when initialized through `Nanook::Wallet#account`:
233
255
 
234
256
  ```ruby
235
- account = Nanook.new.account(account_id)
257
+ wallet = nanook.wallet(wallet_id)
258
+ account = wallet.account(account_id)
259
+ ```
236
260
 
237
- account.balance
238
- account.balance(unit: :raw)
239
- account.pending
240
- account.pending(limit: 1)
241
- account.pending(detailed: true)
242
- account.pending(unit: :raw)
261
+ As well as the following methods, all methods of [regular accounts](#working-with-any-account) can also be called.
243
262
 
244
- account.exists?
245
- account.info
246
- account.info(detailed: true)
247
- account.info(unit: :raw)
248
- account.last_modified_at
249
- account.ledger
250
- account.ledger(limit: 10)
251
- account.ledger(modified_since: Time.now)
252
- account.ledger(unit: :raw)
253
- account.history
254
- account.history(limit: 1)
255
- account.history(unit: :raw)
256
- account.public_key
257
- account.delegators
258
- account.delegators(unit: :raw)
259
- account.representative
260
- account.weight
263
+ See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/3.1.0/Nanook/WalletAccount.html) for a detailed description of each method and example responses.
264
+
265
+ ```ruby
266
+ account.pay(to: recipient_account_id, amount: 2, id: unique_id)
267
+ account.pay(to: recipient_account_id, amount: 2, id: unique_id, unit: :raw)
268
+ account.receive
269
+ account.receive(pending_block_id)
270
+ account.change_representative(new_representative)
271
+ account.set_work(work)
272
+ account.work
273
+ account.destroy
261
274
  ```
262
275
 
263
276
  ### Blocks
264
277
 
265
- See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/2.4.0/Nanook/Block.html) for a detailed description of each method and example responses.
278
+ See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/3.1.0/Nanook/Block.html) for a detailed description of each method and example responses.
266
279
 
267
280
  ```ruby
268
- block = Nanook.new.block(block_id)
281
+ block = nanook.block(block_id)
269
282
 
270
- block.info # Verified blocks in the ledger
271
- block.info(allow_unchecked: true) # Verified blocks AND unchecked synchronizing blocks
272
283
  block.account
273
- block.chain
274
- block.chain(limit: 10)
284
+ block.amount
285
+ block.amount(unit: :raw)
286
+ block.ancestors
287
+ block.ancestors(limit: 10)
288
+ block.ancestors(offset: 10)
289
+ block.balance
290
+ block.change?
291
+ block.checked?
275
292
  block.confirm
276
- block.confirmed_recently?
277
- block.history
278
- block.history(limit: 10)
293
+ block.descendants
294
+ block.descendants(limit: 10)
295
+ block.descendants(offset: 10)
296
+ block.epoch?
297
+ block.exists?
298
+ block.exists?(allow_unchecked: true)
299
+ block.height
300
+ block.info # Verified blocks in the ledger
301
+ block.info(allow_unchecked: true) # Verified blocks AND unchecked synchronizing blocks
302
+ block.info(unit: :raw)
303
+ block.next
304
+ block.open?
305
+ block.pending?
306
+ block.previous
307
+ block.receive?
308
+ block.representative
279
309
  block.republish
280
310
  block.republish(sources: 2)
281
311
  block.republish(destinations: 2)
282
- block.pending?
283
- block.publish
284
- block.successors
285
- block.successors(limit: 10)
312
+ block.send?
313
+ block.signature
314
+ block.timestamp
315
+ block.type
316
+ block.unchecked?
317
+ block.work
286
318
 
287
319
  block.generate_work
288
320
  block.generate_work(use_peers: true)
289
321
  block.cancel_work
290
- block.is_valid_work?(work_id)
322
+ block.valid_work?(work)
291
323
  ```
292
324
 
293
325
  ### Managing your nano node
294
326
 
295
- See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/2.4.0/Nanook/Node.html) for a detailed description of each method and example responses.
327
+ See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/3.1.0/Nanook/Node.html) for a detailed description of each method and example responses.
296
328
 
297
329
  ```ruby
298
- node = Nanook.new.node
330
+ node = nanook.node
299
331
 
300
332
  node.account_count
301
333
  node.block_count
302
- node.block_count_by_type
303
- node.bootstrap_any
304
334
  node.bootstrap(address: "::ffff:138.201.94.249", port: 7075)
305
- node.confirmation_history
335
+ node.bootstrap_any
336
+ node.bootstrap_lazy(block_id)
337
+ node.bootstrap_lazy(block_id, force: true)
338
+ node.confirmation_quorum
339
+ node.difficulty
340
+ node.difficulty(include_trend: true)
341
+ node.keepalive(address: "::ffff:138.201.94.249", port: 7075)
306
342
  node.peers
343
+ node.receive_minimum
344
+ node.receive_minimum(unit: :raw)
345
+ node.change_receive_minimum(amount)
346
+ node.change_receive_minimum(amount, unit: :raw)
307
347
  node.representatives
308
348
  node.representatives(unit: :raw)
309
349
  node.representatives_online
350
+ node.search_pending
310
351
  node.synchronizing_blocks
311
352
  node.synchronizing_blocks(limit: 1)
312
353
  node.sync_progress
@@ -318,7 +359,7 @@ node.stop
318
359
  ### Work peers
319
360
 
320
361
  ```ruby
321
- work_peers = Nanook.new.work_peers
362
+ work_peers = nanook.work_peers
322
363
 
323
364
  work_peers.add(address: "::ffff:172.17.0.1:7076", port: 7076)
324
365
  work_peers.clear
@@ -330,26 +371,44 @@ work_peers.list
330
371
  #### Create private public key pair:
331
372
 
332
373
  ```ruby
333
- Nanook.new.key.generate
334
- Nanook.new.key.generate(seed: seed, index: 0)
374
+ private_key = nanook.private_key.create
375
+ private_key = nanook.private_key.create(seed: seed, index: 0)
376
+ private_key.public_key # => Nanook::PublicKey
377
+ ```
378
+
379
+ #### Working with a private key
380
+
381
+ ```ruby
382
+ key = nanook.private_key(private_key)
383
+
384
+ key.account
385
+ key.public_key
335
386
  ```
336
387
 
337
- #### Working with a single key
388
+ #### Working with a public key
338
389
 
339
390
  ```ruby
340
- key = Nanook.new.key(private_key)
391
+ key = nanook.public_key(public_key)
341
392
 
342
- key.info
393
+ key.account
394
+ ```
395
+
396
+ ### Network
397
+
398
+ A summarized overview of the Nano network:
399
+
400
+ ```ruby
401
+ nanook.network_telemetry
343
402
  ```
344
403
 
345
404
  ## Nanook Metal
346
405
 
347
- You can do any call listed in the [Nano RPC](https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol) directly through the `rpc` method. The first argument should match the `action` of the RPC call, and then all remaining parameters are passed in as arguments.
406
+ You can do any call listed in the [Nano RPC](https://docs.nano.org/commands/rpc-protocol) directly through the `rpc` method. The first argument should match the `action` of the RPC call, and then all remaining parameters are passed in as arguments.
348
407
 
349
- E.g., the [accounts_create command](https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol#accounts-create) can be called like this:
408
+ E.g., the [accounts_create command](https://docs.nano.org/commands/rpc-protocol/#accounts_create) can be called like this:
350
409
 
351
410
  ```ruby
352
- Nano.new.rpc(:accounts_create, wallet: wallet_id, count: 2)
411
+ nanook.rpc.call(:accounts_create, wallet: wallet_id, count: 2)
353
412
  ```
354
413
 
355
414
  ## Contributing
@@ -370,11 +429,11 @@ The gem is available as open source under the terms of the [MIT License](https:/
370
429
 
371
430
  ## Buy me a nano coffee
372
431
 
373
- This library is totally free to use, but feel free to send some nano [my way](https://www.nanode.co/account/xrb_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j) if you'd like to!
432
+ This library is always free to use, but feel free to send some nano [my way](https://www.nanode.co/account/nano_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j) if you'd like to!
374
433
 
375
- xrb_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j
434
+ nano_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j
376
435
 
377
- ![alt xrb_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j](https://raw.githubusercontent.com/lukes/nanook/master/img/qr.png)
436
+ ![alt nano_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j](https://raw.githubusercontent.com/lukes/nanook/master/img/qr.png)
378
437
 
379
438
 
380
439