nanook 2.3.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4453793303eb12685b219bed3586cfe92f09909f
4
- data.tar.gz: 0b4a3a21470ba6b7916a8fe7304234be89fd6234
2
+ SHA256:
3
+ metadata.gz: 86e9dced1a4ce9942cd123c262d7ff45fad6e982ce67c6903b6495a2609c29f9
4
+ data.tar.gz: 11d3752a80bc33e41ba7e19c7d4e2ad54b2d4a08212b71e7fd3579092d9b8c55
5
5
  SHA512:
6
- metadata.gz: 1dc885c8cf50d2773de155e3b970cdf3f400641d9cc5a378996cc544ba18b96eab0a97dfc01592a33bf027fac2df6fa3f29bdf886e8c7fecaf827f4bcc848968
7
- data.tar.gz: ff5a87c994fa30e96730336a9ea5ee6c14939302ee2dd329dd83faa01a4479cbd0dfcd79dc0374a44d9c7562813e6799038d532b0c0f05c75fd30aa5c3214ebc
6
+ metadata.gz: c53742261c03ba53fdcc46ffbcd0c556ccfe3d1b025f593d1b3f1ee9c6f1c1fcacb387b419aac07eefab390356022373dcc2121449097e968f051ac0498d4dfc
7
+ data.tar.gz: d1d4e28e58f28ee5ea161232276454b5eafd8959b63685db3440a6e15e1328e31b6676f5676f94fe0d30420e6e5b0c540a9345033dfb137fbf89d56ccf0de951
data/CHANGELOG.md CHANGED
@@ -4,6 +4,146 @@ 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.0.1
8
+
9
+ ### Fixed
10
+
11
+ - Fix `Block#type` being `nil` when RPC doesn't return a `subtype`.
12
+
13
+ ## 3.0.0
14
+
15
+ ### Removed
16
+
17
+ - `Nanook::Block#block_count_by_type` Removed, as the RPC no longer supports this command.
18
+ - `Nanook::Block#history` Removed, as the RPC command is deprecated.
19
+ - `Nanook::Block#publish` Removed, as the RPC command expects more data than what we instantiate within `Nanook::Block`.
20
+ - Removed all RPC calls that are not recommended for production:
21
+ - `Nanook::Node#bootstrap_status`.
22
+ - `Nanook::Node#confirmation_history`.
23
+ - `Nanook::Node#confirmed_recently?`.
24
+ - `Nanook::Key` Replaced by `Nanook::PrivateKey`.
25
+ - `Nanook::Account#info` No longer accepts `detailed:` argument.
26
+ - `Nanook::Node#synced?` As this was deprecated for removal in v3.0.
27
+
28
+ ### Added
29
+
30
+ - Added missing `Nanook::WalletAccount#block_count` delegate.
31
+ - Added `Nanook#network_telemetry`.
32
+ - Added `Nanook::Rpc#test`.
33
+ - Added `Nanook::WalletAccount#work`.
34
+ - Added `Nanook::WalletAccount#set_work`.
35
+ - Added `Nanook::Account#blocks`.
36
+ - Added `Nanook::Account#delegators_count`.
37
+ - Added `Nanook::Account#open_block`.
38
+ - Added `Nanook::Node#change_receive_minimum`.
39
+ - Added `Nanook::Node#confirmation_quorum`.
40
+ - Added `Nanook::Node#keepalive`.
41
+ - Added `Nanook::Node#receive_minimum`.
42
+ - Added `Nanook::Node#search_pending`.
43
+ - Added `Nanook::Wallet#history`.
44
+ - Added `Nanook::Wallet#exists?`.
45
+ - Added `Nanook::Wallet#ledger`.
46
+ - Added `Nanook::Wallet#move_accounts`.
47
+ - Added `Nanook::Wallet#remove_account`.
48
+ - Added `Nanook::Wallet#republish_blocks`.
49
+ - Added `Nanook::Wallet#search_pending`.
50
+ - Added `Nanook::Wallet#work`.
51
+ - Added `Nanook::Block#account`.
52
+ - Added `Nanook::Block#amount`.
53
+ - Added `Nanook::Block#balance`.
54
+ - Added `Nanook::Block#change?`.
55
+ - Added `Nanook::Block#confirmed?`.
56
+ - Added `Nanook::Block#epoch?`.
57
+ - Added `Nanook::Block#exists?`.
58
+ - Added `Nanook::Block#height`.
59
+ - Added `Nanook::Block#open?`.
60
+ - Added `Nanook::Block#previous`.
61
+ - Added `Nanook::Block#receive?`.
62
+ - Added `Nanook::Block#representative`.
63
+ - Added `Nanook::Block#send?`.
64
+ - Added `Nanook::Block#signature`.
65
+ - Added `Nanook::Block#timestamp`.
66
+ - Added `Nanook::Block#type`.
67
+ - Added `Nanook::Block#unconfirmed?`.
68
+ - Added `Nanook::Block#work`.
69
+ - Added `Nanook::PrivateKey` with methods `#create`, `#account` and `#public_key`.
70
+ - Added `Nanook::PublicKey` with method `#account`.
71
+ - Added equality testing methods `#==`, `#eql?` and `#hash` for:
72
+ - `Nanook::Account`
73
+ - `Nanook::Block`
74
+ - `Nanook::PrivateKey`
75
+ - `Nanook::PublicKey`
76
+ - `Nanook::Wallet`
77
+ - `Nanook::WalletAccount`
78
+
79
+ ### Changed
80
+
81
+ - New error classes: `Nanook::ConnectionError`, `NanoUnitError`, `NodeRpcError` and `NodeRpcConfigurationError`.
82
+ - `Nanook::Wallet#default_representative` returns a `Nanook::Account`.
83
+ - `Nanook::Wallet#change_representative` returns a `Nanook::Account`.
84
+ - `Nanook::Wallet#unlock` can be passed no argument (`password` will be `nil`).
85
+ - `Nanook::Wallet#info` returns data from `wallet_info` RPC.
86
+ - `Nanook::Block#is_valid_work?` renamed to `#valid_work?`.
87
+ - `Nanook::Block#republish` returns an Array of `Nanook::Block`s.
88
+ - `Nanook::Block#chain` returns an Array of `Nanook::Block`s.
89
+ - `Nanook::Block#successors` returns an Array of `Nanook::Block`s.
90
+ - `Nanook::Block#info`:
91
+ - returns balances in nano, and can optionally be passed `unit: :raw` argument.
92
+ - returns account values as `Nanook::Account` and block values as `Nanook::Block`.
93
+ - `Nanook::Node#peers` returns details as a `Hash` keyed by `Nanook::Account`.
94
+ - `Nanook::Account#pending` returns source as `Nanook::Account` and block as `Nanook::Block` when `detailed: true`.
95
+ - `Nanook::Account#representative` returns a `Nanook::Account`.
96
+ - `Nanook::Account#delegators` returns accounts as `Nanook::Account`s.
97
+ - `Nanook::Account#history` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
98
+ - `Nanook::Account#ledger` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
99
+ - `Nanook::Account#public_key` returns a `Nanook::PublicKey`.
100
+ - `Nanook::Account#weight` accepts an optional `unit:` argment.
101
+ - `Nanook::Account#info`:
102
+ - returns the `frontier`, `open_block`, `representative_block` values as `Nanook::Block`s.
103
+ - returns the `representative` as a `Nanook::Account`.
104
+ - `modified_timestamp` key renamed to `last_modified_at` and value is a `Time` in UTC.
105
+ - `Nanook::Key` has become `Nanook::PrivateKey`, `#generate` has been renamed `#create` and returns a `Nanook::PrivateKey`.
106
+
107
+ ### Fixed
108
+
109
+ - A number of errors when node is still bootstrapping and is missing accounts from the ledger.
110
+ - `Nanook::Node#representatives_online` accessing representative list as a `Hash` after RPC change.
111
+
112
+ ## 2.5.1
113
+
114
+ ### Fixed
115
+
116
+ - undefined method 'new' for `BigDecimal:Class` (thank you @MihaiVoinea)
117
+
118
+ ## 2.5.0
119
+
120
+ ### Added
121
+
122
+ - New `Nanook::Node#bootstrap_lazy` method.
123
+ - New `Nanook::Node#bootstrap_status` method.
124
+ - New `Nanook::Node#difficulty` method.
125
+ - New `Nanook::Node#uptime` method.
126
+ - New `Nanook::Wallet#lock` method.
127
+
128
+ ### Changed
129
+
130
+ - `Nanook::Node#chain` now takes optional `offset` argument.
131
+ - `Nanook::Node#successors` now takes optional `offset` argument.
132
+ - `Nanook::Node#successors` now aliased as `Nanook::Node#ancestors`
133
+ - Updated docs to use `nano_` prefixed addresses.
134
+
135
+ ## 2.4.0
136
+
137
+ ### Added
138
+
139
+ - New `Nanook::Node#confirmation_history` method.
140
+ - New `Nanook::Block#confirm` method.
141
+ - New `Nanook::Block#confirmed_recently?` method.
142
+
143
+ ### Changed
144
+
145
+ - `Nanook::Block#generate_work` now can take optional `use_peers` argument.
146
+
7
147
  ## 2.3.0
8
148
 
9
149
  ### 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)
@@ -11,7 +11,7 @@ This is a Ruby library for managing a [nano currency](https://nano.org/) node, i
11
11
  Add this line to your application's Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'nanook', "~> 2.3"
14
+ gem 'nanook'
15
15
  ```
16
16
 
17
17
  And then execute:
@@ -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.3.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.0.1/) 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.3.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.0.1/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,131 +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.3.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.0.1/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.3.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.0.1/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.3.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.0.1/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
 
283
+ block.account
284
+ block.amount
285
+ block.amount(unit: :raw)
286
+ block.balance
287
+ block.change?
288
+ block.checked?
289
+ block.epoch?
290
+ block.exists?
291
+ block.exists?(allow_unchecked: true)
292
+ block.height
270
293
  block.info # Verified blocks in the ledger
271
294
  block.info(allow_unchecked: true) # Verified blocks AND unchecked synchronizing blocks
295
+ block.info(unit: :raw)
272
296
  block.account
273
297
  block.chain
274
298
  block.chain(limit: 10)
275
- block.history
276
- block.history(limit: 10)
299
+ block.chain(offset: 10)
300
+ block.confirm
277
301
  block.republish
278
302
  block.republish(sources: 2)
279
303
  block.republish(destinations: 2)
304
+ block.open?
280
305
  block.pending?
281
- block.publish
306
+ block.previous
307
+ block.receive?
308
+ block.representative
309
+ block.send?
310
+ block.signature
282
311
  block.successors
283
312
  block.successors(limit: 10)
313
+ block.successors(offset: 10)
314
+ block.timestamp
315
+ block.type
316
+ block.unchecked?
317
+ block.work
284
318
 
285
319
  block.generate_work
320
+ block.generate_work(use_peers: true)
286
321
  block.cancel_work
287
- block.is_valid_work?(work_id)
322
+ block.valid_work?(work)
288
323
  ```
289
324
 
290
325
  ### Managing your nano node
291
326
 
292
- See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/2.3.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.0.1/Nanook/Node.html) for a detailed description of each method and example responses.
293
328
 
294
329
  ```ruby
295
- node = Nanook.new.node
330
+ node = nanook.node
296
331
 
297
332
  node.account_count
298
333
  node.block_count
299
- node.block_count_by_type
300
- node.bootstrap_any
301
334
  node.bootstrap(address: "::ffff:138.201.94.249", port: 7075)
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)
302
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)
303
347
  node.representatives
304
348
  node.representatives(unit: :raw)
305
349
  node.representatives_online
350
+ node.search_pending
306
351
  node.synchronizing_blocks
307
352
  node.synchronizing_blocks(limit: 1)
308
353
  node.sync_progress
@@ -314,7 +359,7 @@ node.stop
314
359
  ### Work peers
315
360
 
316
361
  ```ruby
317
- work_peers = Nanook.new.work_peers
362
+ work_peers = nanook.work_peers
318
363
 
319
364
  work_peers.add(address: "::ffff:172.17.0.1:7076", port: 7076)
320
365
  work_peers.clear
@@ -326,26 +371,44 @@ work_peers.list
326
371
  #### Create private public key pair:
327
372
 
328
373
  ```ruby
329
- Nanook.new.key.generate
330
- 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
331
377
  ```
332
378
 
333
- #### Working with a single key
379
+ #### Working with a private key
334
380
 
335
381
  ```ruby
336
- key = Nanook.new.key(private_key)
382
+ key = nanook.private_key(private_key)
383
+
384
+ key.account
385
+ key.public_key
386
+ ```
337
387
 
338
- key.info
388
+ #### Working with a public key
389
+
390
+ ```ruby
391
+ key = nanook.public_key(public_key)
392
+
393
+ key.account
394
+ ```
395
+
396
+ ### Network
397
+
398
+ A summarized overview of the Nano network:
399
+
400
+ ```ruby
401
+ nanook.network_telemetry
339
402
  ```
340
403
 
341
404
  ## Nanook Metal
342
405
 
343
- 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.
344
407
 
345
- 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:
346
409
 
347
410
  ```ruby
348
- Nano.new.rpc(:accounts_create, wallet: wallet_id, count: 2)
411
+ nanook.rpc.call(:accounts_create, wallet: wallet_id, count: 2)
349
412
  ```
350
413
 
351
414
  ## Contributing
@@ -366,11 +429,11 @@ The gem is available as open source under the terms of the [MIT License](https:/
366
429
 
367
430
  ## Buy me a nano coffee
368
431
 
369
- 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!
370
433
 
371
- xrb_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j
434
+ nano_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j
372
435
 
373
- ![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)
374
437
 
375
438
 
376
439