nanook 2.5.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7431dc051a61aef23d118372d17df3c833e0963f05279a246c60b65eea10d478
4
- data.tar.gz: cadd03df615dca28120483b30720215d15f357ac3afa57dcf226938a17ca45af
3
+ metadata.gz: c6a8de62127c895a74b956a2b24a7619e526ef0050c34639edd4eeec20bac187
4
+ data.tar.gz: a2ac4e3e26838a04e33156d38a892623fa2ba893ca1ec02707caf07c72a1b955
5
5
  SHA512:
6
- metadata.gz: c6249a2d0e98a38d38058c11f50a6b3677d014e35600792d3c18609532f7b97399320d004523eb730863f4bc9bbdab378e3349122e16caa66c394b717be73442
7
- data.tar.gz: ba7494dc21db212d20dae2d7a436c5a0766675a76086fa35e9cbc0a98fac4249f451e99f145f8033f77bd1a3966d319a4d3d4d83f2eaf9d9793281100b2875d3
6
+ metadata.gz: f6bc6c116aac59f7f3a124ef8e4c6db3377fb8d4c944be240576260ff985503c0b05d131b2f644abbc655ba2c741e057c9344654993dad9ed20f03622a604485
7
+ data.tar.gz: a2bb0a64d566613fa5c7e29ff454afd95491ccaac3233b1647f90c0d89afeac83d921748327ea417747e8675afd1f4978ca1ce9f1cb39603b50f3870a6dabaa0
data/CHANGELOG.md CHANGED
@@ -1,9 +1,146 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
7
 
8
+ ## 4.0.0 (v22 compatible)
9
+
10
+ ### Changed
11
+
12
+ - `Node#bootstrap_lazy` now returns the v22 node response of a `Hash` of keys `started` and `key_inserted` with boolean values.
13
+ - `Node#bootstrap_any` now optionally takes `account` argument.
14
+ - `Account#pending` and `WalletAccount#pending`:
15
+ - now optionally takes `sorted` argument.
16
+ - now optionally takes `allow_unconfirmed` argument.
17
+ - `Account#balance` and `WalletAccount#balance` now optionally takes `allow_unconfirmed` argument.
18
+ - `Account#info` and `WalletAccount#info` now optionally takes `allow_unconfirmed` argument.
19
+ - `Block#pending?` now optionally takes `allow_unconfirmed` argument.
20
+ - `Wallet#pending` now optionally takes `allow_unconfirmed` argument.
21
+
22
+ ## 3.1.0 (v21 compatible)
23
+
24
+ ### Added
25
+
26
+ - `Block#next`.
27
+ - `Block#descendants` aliases `Block#successors`
28
+
29
+ ### Changed
30
+
31
+ - `Block.chain` and `Block.successors` no longer return the Block itself in the response.
32
+
33
+ ## 3.0.1 (v21 compatible)
34
+
35
+ ### Fixed
36
+
37
+ - Fix `Block#type` being `nil` when RPC doesn't return a `subtype`.
38
+
39
+ ## 3.0.0 (v21 compatible)
40
+
41
+ ### Removed
42
+
43
+ - `Nanook::Block#block_count_by_type` Removed, as the RPC no longer supports this command.
44
+ - `Nanook::Block#history` Removed, as the RPC command is deprecated.
45
+ - `Nanook::Block#publish` Removed, as the RPC command expects more data than what we instantiate within `Nanook::Block`.
46
+ - Removed all RPC calls that are not recommended for production:
47
+ - `Nanook::Node#bootstrap_status`.
48
+ - `Nanook::Node#confirmation_history`.
49
+ - `Nanook::Node#confirmed_recently?`.
50
+ - `Nanook::Key` Replaced by `Nanook::PrivateKey`.
51
+ - `Nanook::Account#info` No longer accepts `detailed:` argument.
52
+ - `Nanook::Node#synced?` As this was deprecated for removal in v3.0.
53
+
54
+ ### Added
55
+
56
+ - Added missing `Nanook::WalletAccount#block_count` delegate.
57
+ - Added `Nanook#network_telemetry`.
58
+ - Added `Nanook::Rpc#test`.
59
+ - Added `Nanook::WalletAccount#work`.
60
+ - Added `Nanook::WalletAccount#set_work`.
61
+ - Added `Nanook::Account#blocks`.
62
+ - Added `Nanook::Account#delegators_count`.
63
+ - Added `Nanook::Account#open_block`.
64
+ - Added `Nanook::Node#change_receive_minimum`.
65
+ - Added `Nanook::Node#confirmation_quorum`.
66
+ - Added `Nanook::Node#keepalive`.
67
+ - Added `Nanook::Node#receive_minimum`.
68
+ - Added `Nanook::Node#search_pending`.
69
+ - Added `Nanook::Wallet#history`.
70
+ - Added `Nanook::Wallet#exists?`.
71
+ - Added `Nanook::Wallet#ledger`.
72
+ - Added `Nanook::Wallet#move_accounts`.
73
+ - Added `Nanook::Wallet#remove_account`.
74
+ - Added `Nanook::Wallet#republish_blocks`.
75
+ - Added `Nanook::Wallet#search_pending`.
76
+ - Added `Nanook::Wallet#work`.
77
+ - Added `Nanook::Block#account`.
78
+ - Added `Nanook::Block#amount`.
79
+ - Added `Nanook::Block#balance`.
80
+ - Added `Nanook::Block#change?`.
81
+ - Added `Nanook::Block#confirmed?`.
82
+ - Added `Nanook::Block#epoch?`.
83
+ - Added `Nanook::Block#exists?`.
84
+ - Added `Nanook::Block#height`.
85
+ - Added `Nanook::Block#open?`.
86
+ - Added `Nanook::Block#previous`.
87
+ - Added `Nanook::Block#receive?`.
88
+ - Added `Nanook::Block#representative`.
89
+ - Added `Nanook::Block#send?`.
90
+ - Added `Nanook::Block#signature`.
91
+ - Added `Nanook::Block#timestamp`.
92
+ - Added `Nanook::Block#type`.
93
+ - Added `Nanook::Block#unconfirmed?`.
94
+ - Added `Nanook::Block#work`.
95
+ - Added `Nanook::PrivateKey` with methods `#create`, `#account` and `#public_key`.
96
+ - Added `Nanook::PublicKey` with method `#account`.
97
+ - Added equality testing methods `#==`, `#eql?` and `#hash` for:
98
+ - `Nanook::Account`
99
+ - `Nanook::Block`
100
+ - `Nanook::PrivateKey`
101
+ - `Nanook::PublicKey`
102
+ - `Nanook::Wallet`
103
+ - `Nanook::WalletAccount`
104
+
105
+ ### Changed
106
+
107
+ - New error classes: `Nanook::ConnectionError`, `NanoUnitError`, `NodeRpcError` and `NodeRpcConfigurationError`.
108
+ - `Nanook::Wallet#default_representative` returns a `Nanook::Account`.
109
+ - `Nanook::Wallet#change_representative` returns a `Nanook::Account`.
110
+ - `Nanook::Wallet#unlock` can be passed no argument (`password` will be `nil`).
111
+ - `Nanook::Wallet#info` returns data from `wallet_info` RPC.
112
+ - `Nanook::Block#is_valid_work?` renamed to `#valid_work?`.
113
+ - `Nanook::Block#republish` returns an Array of `Nanook::Block`s.
114
+ - `Nanook::Block#chain` returns an Array of `Nanook::Block`s.
115
+ - `Nanook::Block#successors` returns an Array of `Nanook::Block`s.
116
+ - `Nanook::Block#info`:
117
+ - returns balances in nano, and can optionally be passed `unit: :raw` argument.
118
+ - returns account values as `Nanook::Account` and block values as `Nanook::Block`.
119
+ - `Nanook::Node#peers` returns details as a `Hash` keyed by `Nanook::Account`.
120
+ - `Nanook::Account#pending` returns source as `Nanook::Account` and block as `Nanook::Block` when `detailed: true`.
121
+ - `Nanook::Account#representative` returns a `Nanook::Account`.
122
+ - `Nanook::Account#delegators` returns accounts as `Nanook::Account`s.
123
+ - `Nanook::Account#history` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
124
+ - `Nanook::Account#ledger` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
125
+ - `Nanook::Account#public_key` returns a `Nanook::PublicKey`.
126
+ - `Nanook::Account#weight` accepts an optional `unit:` argment.
127
+ - `Nanook::Account#info`:
128
+ - returns the `frontier`, `open_block`, `representative_block` values as `Nanook::Block`s.
129
+ - returns the `representative` as a `Nanook::Account`.
130
+ - `modified_timestamp` key renamed to `last_modified_at` and value is a `Time` in UTC.
131
+ - `Nanook::Key` has become `Nanook::PrivateKey`, `#generate` has been renamed `#create` and returns a `Nanook::PrivateKey`.
132
+
133
+ ### Fixed
134
+
135
+ - A number of errors when node is still bootstrapping and is missing accounts from the ledger.
136
+ - `Nanook::Node#representatives_online` accessing representative list as a `Hash` after RPC change.
137
+
138
+ ## 2.5.1
139
+
140
+ ### Fixed
141
+
142
+ - undefined method 'new' for `BigDecimal:Class` (thank you @MihaiVoinea)
143
+
7
144
  ## 2.5.0
8
145
 
9
146
  ### 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://developers.nano.org/docs/rpc). 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://developers.nano.org/docs/rpc#send):
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://developers.nano.org/docs/rpc#send):
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.5.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/4.0.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.5.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/4.0.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)
@@ -154,24 +158,36 @@ wallet.pay(from: your_account_id, to: recipient_account_id, amount: 2, id: uniqu
154
158
  wallet.pending
155
159
  wallet.pending(limit: 1)
156
160
  wallet.pending(detailed: true)
161
+ wallet.pending(allow_unconfirmed: true)
157
162
  wallet.pending(unit: :raw)
158
163
  wallet.receive(into: account_id)
159
164
  wallet.receive(pending_block_id, into: account_id)
165
+ wallet.search_pending
160
166
 
161
167
  wallet.account.create
162
168
  wallet.account.create(5)
163
169
  wallet.accounts
164
170
  wallet.contains?(account_id)
171
+ wallet.move_accounts(from_wallet_id, [account_1_id, account_2_id])
172
+ wallet.remove_account(account_id)
165
173
 
166
174
  wallet.default_representative
167
- wallet.change_default_representative(new_representative)
175
+ wallet.change_default_representative(representative_account_id)
176
+ wallet.change_password(password)
177
+ wallet.exists?
178
+ wallet.history
179
+ wallet.history(unit: :raw)
168
180
  wallet.info
169
181
  wallet.info(unit: :raw)
170
182
  wallet.export
183
+ wallet.ledger
184
+ wallet.ledger(unit: :raw)
171
185
  wallet.lock
172
186
  wallet.locked?
187
+ wallet.republish_blocks
188
+ wallet.republish_blocks(limit: 5)
173
189
  wallet.unlock(password)
174
- wallet.change_password(password)
190
+ wallet.work
175
191
 
176
192
  wallet.destroy
177
193
  ```
@@ -180,142 +196,165 @@ wallet.destroy
180
196
  #### Create account:
181
197
 
182
198
  ```ruby
183
- Nanook.new.wallet(wallet_id).account.create
199
+ nanook.wallet(wallet_id).account.create
184
200
  ```
185
201
 
186
202
  #### Create multiple accounts:
187
203
 
188
204
  ```ruby
189
- Nanook.new.wallet(wallet_id).account.create(5)
205
+ nanook.wallet(wallet_id).account.create(5)
190
206
  ```
191
207
 
192
- #### Working with a single account:
208
+ #### Working with an account:
193
209
 
194
- See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/2.5.0/Nanook/WalletAccount.html) for a detailed description of each method and example responses.
210
+ Any account on the Nano network that is known by your node can be initialized through `Nanook#account`:
195
211
 
196
212
  ```ruby
197
- account = Nanook.new.wallet(wallet_id).account(account_id)
213
+ account = nanook.account(account_id)
214
+ ```
198
215
 
216
+ See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/4.0.0/Nanook/Account.html) for a detailed description of each method and example responses.
217
+
218
+ ```ruby
199
219
  account.balance
220
+ account.balance(allow_unconfirmed: true)
200
221
  account.balance(unit: :raw)
201
- account.pay(to: recipient_account_id, amount: 2, id: unique_id)
202
- account.pay(to: recipient_account_id, amount: 2, id: unique_id, unit: :raw)
203
222
  account.pending
204
223
  account.pending(limit: 1)
224
+ account.pending(allow_unconfirmed: true)
205
225
  account.pending(detailed: true)
226
+ account.pending(sorted: true)
206
227
  account.pending(unit: :raw)
207
- account.receive
208
- account.receive(pending_block_id)
209
228
 
229
+ account.blocks
230
+ account.blocks(limit: 1)
231
+ account.blocks(sort: :desc)
232
+ account.delegators
233
+ account.delegators(unit: :raw)
234
+ account.delegators_count
210
235
  account.exists?
236
+ account.history
237
+ account.history(limit: 1)
238
+ account.history(unit: :raw)
239
+ account.history(sort: :desc)
211
240
  account.info
212
- account.info(detailed: true)
241
+ account.info(allow_unconfirmed: true)
213
242
  account.info(unit: :raw)
214
243
  account.last_modified_at
215
244
  account.ledger
216
245
  account.ledger(limit: 10)
217
246
  account.ledger(modified_since: Time.now)
218
247
  account.ledger(unit: :raw)
219
- account.history
220
- account.history(limit: 1)
221
- account.history(unit: :raw)
248
+ account.ledger(sort: :desc)
249
+ account.open_block
222
250
  account.public_key
223
- account.delegators
224
- account.delegators(unit: :raw)
225
251
  account.representative
226
- account.change_representative(new_representative)
227
252
  account.weight
228
-
229
- account.destroy
253
+ account.weight(unit: :raw)
230
254
  ```
231
255
 
232
- #### Working with any account (not necessarily in your wallet):
256
+ #### Working with an account created on the node:
233
257
 
234
- See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/2.5.0/Nanook/Account.html) for a detailed description of each method and example responses.
258
+ Accounts that have been created on your node can have
259
+ additional methods when initialized through `Nanook::Wallet#account`:
235
260
 
236
261
  ```ruby
237
- account = Nanook.new.account(account_id)
262
+ wallet = nanook.wallet(wallet_id)
263
+ account = wallet.account(account_id)
264
+ ```
238
265
 
239
- account.balance
240
- account.balance(unit: :raw)
241
- account.pending
242
- account.pending(limit: 1)
243
- account.pending(detailed: true)
244
- account.pending(unit: :raw)
266
+ As well as the following methods, all methods of [regular accounts](#working-with-any-account) can also be called.
245
267
 
246
- account.exists?
247
- account.info
248
- account.info(detailed: true)
249
- account.info(unit: :raw)
250
- account.last_modified_at
251
- account.ledger
252
- account.ledger(limit: 10)
253
- account.ledger(modified_since: Time.now)
254
- account.ledger(unit: :raw)
255
- account.history
256
- account.history(limit: 1)
257
- account.history(unit: :raw)
258
- account.public_key
259
- account.delegators
260
- account.delegators(unit: :raw)
261
- account.representative
262
- account.weight
268
+ See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/4.0.0/Nanook/WalletAccount.html) for a detailed description of each method and example responses.
269
+
270
+ ```ruby
271
+ account.pay(to: recipient_account_id, amount: 2, id: unique_id)
272
+ account.pay(to: recipient_account_id, amount: 2, id: unique_id, unit: :raw)
273
+ account.receive
274
+ account.receive(pending_block_id)
275
+ account.change_representative(new_representative)
276
+ account.set_work(work)
277
+ account.work
278
+ account.destroy
263
279
  ```
264
280
 
265
281
  ### Blocks
266
282
 
267
- See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/2.5.0/Nanook/Block.html) for a detailed description of each method and example responses.
283
+ See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/4.0.0/Nanook/Block.html) for a detailed description of each method and example responses.
268
284
 
269
285
  ```ruby
270
- block = Nanook.new.block(block_id)
286
+ block = nanook.block(block_id)
271
287
 
272
- block.info # Verified blocks in the ledger
273
- block.info(allow_unchecked: true) # Verified blocks AND unchecked synchronizing blocks
274
288
  block.account
275
- block.chain
276
- block.chain(limit: 10)
277
- block.chain(offset: 10)
289
+ block.amount
290
+ block.amount(unit: :raw)
291
+ block.ancestors
292
+ block.ancestors(limit: 10)
293
+ block.ancestors(offset: 10)
294
+ block.balance
295
+ block.change?
296
+ block.checked?
278
297
  block.confirm
279
- block.confirmed_recently?
280
- block.history
281
- block.history(limit: 10)
298
+ block.descendants
299
+ block.descendants(limit: 10)
300
+ block.descendants(offset: 10)
301
+ block.epoch?
302
+ block.exists?
303
+ block.exists?(allow_unchecked: true)
304
+ block.height
305
+ block.info # Verified blocks in the ledger
306
+ block.info(allow_unchecked: true) # Verified blocks AND unchecked synchronizing blocks
307
+ block.info(unit: :raw)
308
+ block.next
309
+ block.open?
310
+ block.pending?
311
+ block.pending?(allow_unconfirmed: true)
312
+ block.previous
313
+ block.receive?
314
+ block.representative
282
315
  block.republish
283
316
  block.republish(sources: 2)
284
317
  block.republish(destinations: 2)
285
- block.pending?
286
- block.publish
287
- block.successors
288
- block.successors(limit: 10)
289
- block.successors(offset: 10)
318
+ block.send?
319
+ block.signature
320
+ block.timestamp
321
+ block.type
322
+ block.unchecked?
323
+ block.work
290
324
 
291
325
  block.generate_work
292
326
  block.generate_work(use_peers: true)
293
327
  block.cancel_work
294
- block.is_valid_work?(work_id)
328
+ block.valid_work?(work)
295
329
  ```
296
330
 
297
331
  ### Managing your nano node
298
332
 
299
- See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/2.5.0/Nanook/Node.html) for a detailed description of each method and example responses.
333
+ See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/4.0.0/Nanook/Node.html) for a detailed description of each method and example responses.
300
334
 
301
335
  ```ruby
302
- node = Nanook.new.node
336
+ node = nanook.node
303
337
 
304
338
  node.account_count
305
339
  node.block_count
306
- node.block_count_by_type
307
340
  node.bootstrap(address: "::ffff:138.201.94.249", port: 7075)
308
341
  node.bootstrap_any
342
+ node.bootstrap_any(account: account_id)
309
343
  node.bootstrap_lazy(block_id)
310
344
  node.bootstrap_lazy(block_id, force: true)
311
- node.bootstrap_status
312
- node.confirmation_history
345
+ node.confirmation_quorum
313
346
  node.difficulty
314
347
  node.difficulty(include_trend: true)
348
+ node.keepalive(address: "::ffff:138.201.94.249", port: 7075)
315
349
  node.peers
350
+ node.receive_minimum
351
+ node.receive_minimum(unit: :raw)
352
+ node.change_receive_minimum(amount)
353
+ node.change_receive_minimum(amount, unit: :raw)
316
354
  node.representatives
317
355
  node.representatives(unit: :raw)
318
356
  node.representatives_online
357
+ node.search_pending
319
358
  node.synchronizing_blocks
320
359
  node.synchronizing_blocks(limit: 1)
321
360
  node.sync_progress
@@ -327,7 +366,7 @@ node.stop
327
366
  ### Work peers
328
367
 
329
368
  ```ruby
330
- work_peers = Nanook.new.work_peers
369
+ work_peers = nanook.work_peers
331
370
 
332
371
  work_peers.add(address: "::ffff:172.17.0.1:7076", port: 7076)
333
372
  work_peers.clear
@@ -339,26 +378,44 @@ work_peers.list
339
378
  #### Create private public key pair:
340
379
 
341
380
  ```ruby
342
- Nanook.new.key.generate
343
- Nanook.new.key.generate(seed: seed, index: 0)
381
+ private_key = nanook.private_key.create
382
+ private_key = nanook.private_key.create(seed: seed, index: 0)
383
+ private_key.public_key # => Nanook::PublicKey
344
384
  ```
345
385
 
346
- #### Working with a single key
386
+ #### Working with a private key
347
387
 
348
388
  ```ruby
349
- key = Nanook.new.key(private_key)
389
+ key = nanook.private_key(private_key)
390
+
391
+ key.account
392
+ key.public_key
393
+ ```
350
394
 
351
- key.info
395
+ #### Working with a public key
396
+
397
+ ```ruby
398
+ key = nanook.public_key(public_key)
399
+
400
+ key.account
401
+ ```
402
+
403
+ ### Network
404
+
405
+ A summarized overview of the Nano network:
406
+
407
+ ```ruby
408
+ nanook.network_telemetry
352
409
  ```
353
410
 
354
411
  ## Nanook Metal
355
412
 
356
- You can do any call listed in the [Nano RPC](https://developers.nano.org/docs/rpc) 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.
413
+ 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.
357
414
 
358
- E.g., the [accounts_create command](https://developers.nano.org/docs/rpc#accounts-create) can be called like this:
415
+ E.g., the [accounts_create command](https://docs.nano.org/commands/rpc-protocol/#accounts_create) can be called like this:
359
416
 
360
417
  ```ruby
361
- Nanook.new.rpc.call(:accounts_create, wallet: wallet_id, count: 2)
418
+ nanook.rpc.call(:accounts_create, wallet: wallet_id, count: 2)
362
419
  ```
363
420
 
364
421
  ## Contributing
@@ -379,7 +436,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
379
436
 
380
437
  ## Buy me a nano coffee
381
438
 
382
- This library is totally free to use, but feel free to send some nano [my way](https://www.nanode.co/account/nano_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j) if you'd like to!
439
+ 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!
383
440
 
384
441
  nano_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j
385
442