nanook 2.2.0 → 3.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
- SHA1:
3
- metadata.gz: 5a13b3163d4646a6b2be0f571fff5b848a7bb235
4
- data.tar.gz: 07ecc5c01111b031717e8f2296405598997adda1
2
+ SHA256:
3
+ metadata.gz: 4aa7c4cfb54ead1044be1f2da82f82c0e53e5fbf37750dc8019235071879d8f5
4
+ data.tar.gz: 6be63035a579afddb88c63baa8dba875346f8e8a5bba147a5e89cade033e8a94
5
5
  SHA512:
6
- metadata.gz: 386623ddde38720cb70b25dfb3c24dfbdc05b77ef47f0d977ac0f4e8486a5f0b00b05aee8993f61ece0c47fe1bc827208a1fddf74b5161e149f2e0052d1862b8
7
- data.tar.gz: 3c7911c97fb02a1b8b5b449be32e916abfc6f585f3942546933ef6762528aad1bfed3b09abd35735b5451ec984ad5c7ea6133b6756d5c501ab513ad4fe2ae3e2
6
+ metadata.gz: 4b20db4ba4f60524baa8ced68e9fb821da4ebb0404fcc19f15332c5cbac7b37027fa5b96523e833ed96fcbe2e2700fe6a79a714c57cd1c5bc2558a48e53269b9
7
+ data.tar.gz: f286eb5b4ee747beec160d8c4c97d17a6bf4d0cef08914d425ca5bb630575ae5eb99e39071e230cd1b32571e3cc85e33e81293edf5e12bd3a24b4d6f962fa6fe
data/CHANGELOG.md CHANGED
@@ -4,16 +4,155 @@ 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.0
8
+
9
+ ### Removed
10
+
11
+ - `Nanook::Block#block_count_by_type` Removed, as the RPC no longer supports this command.
12
+ - `Nanook::Block#history` Removed, as the RPC command is deprecated.
13
+ - `Nanook::Block#publish` Removed, as the RPC command expects more data than what we instantiate within `Nanook::Block`.
14
+ - Removed all RPC calls that are not recommended for production:
15
+ - `Nanook::Node#bootstrap_status`.
16
+ - `Nanook::Node#confirmation_history`.
17
+ - `Nanook::Node#confirmed_recently?`.
18
+ - `Nanook::Key` Replaced by `Nanook::PrivateKey`.
19
+ - `Nanook::Account#info` No longer accepts `detailed:` argument.
20
+ - `Nanook::Node#synced?` As this was deprecated for removal in v3.0.
21
+
22
+ ### Added
23
+
24
+ - Added missing `Nanook::WalletAccount#block_count` delegate.
25
+ - Added `Nanook#network_telemetry`.
26
+ - Added `Nanook::Rpc#test`.
27
+ - Added `Nanook::WalletAccount#work`.
28
+ - Added `Nanook::WalletAccount#set_work`.
29
+ - Added `Nanook::Account#blocks`.
30
+ - Added `Nanook::Account#delegators_count`.
31
+ - Added `Nanook::Account#open_block`.
32
+ - Added `Nanook::Node#change_receive_minimum`.
33
+ - Added `Nanook::Node#confirmation_quorum`.
34
+ - Added `Nanook::Node#keepalive`.
35
+ - Added `Nanook::Node#receive_minimum`.
36
+ - Added `Nanook::Node#search_pending`.
37
+ - Added `Nanook::Wallet#history`.
38
+ - Added `Nanook::Wallet#exists?`.
39
+ - Added `Nanook::Wallet#ledger`.
40
+ - Added `Nanook::Wallet#move_accounts`.
41
+ - Added `Nanook::Wallet#remove_account`.
42
+ - Added `Nanook::Wallet#republish_blocks`.
43
+ - Added `Nanook::Wallet#search_pending`.
44
+ - Added `Nanook::Wallet#work`.
45
+ - Added `Nanook::Block#account`.
46
+ - Added `Nanook::Block#amount`.
47
+ - Added `Nanook::Block#balance`.
48
+ - Added `Nanook::Block#change?`.
49
+ - Added `Nanook::Block#confirmed?`.
50
+ - Added `Nanook::Block#epoch?`.
51
+ - Added `Nanook::Block#exists?`.
52
+ - Added `Nanook::Block#height`.
53
+ - Added `Nanook::Block#open?`.
54
+ - Added `Nanook::Block#previous`.
55
+ - Added `Nanook::Block#receive?`.
56
+ - Added `Nanook::Block#representative`.
57
+ - Added `Nanook::Block#send?`.
58
+ - Added `Nanook::Block#signature`.
59
+ - Added `Nanook::Block#timestamp`.
60
+ - Added `Nanook::Block#type`.
61
+ - Added `Nanook::Block#unconfirmed?`.
62
+ - Added `Nanook::Block#work`.
63
+ - Added `Nanook::PrivateKey` with methods `#create`, `#account` and `#public_key`.
64
+ - Added `Nanook::PublicKey` with method `#account`.
65
+ - Added equality testing methods `#==`, `#eql?` and `#hash` for:
66
+ - `Nanook::Account`
67
+ - `Nanook::Block`
68
+ - `Nanook::PrivateKey`
69
+ - `Nanook::PublicKey`
70
+ - `Nanook::Wallet`
71
+ - `Nanook::WalletAccount`
72
+
73
+ ### Changed
74
+
75
+ - New error classes: `Nanook::ConnectionError`, `NanoUnitError`, `NodeRpcError` and `NodeRpcConfigurationError`.
76
+ - `Nanook::Wallet#default_representative` returns a `Nanook::Account`.
77
+ - `Nanook::Wallet#change_representative` returns a `Nanook::Account`.
78
+ - `Nanook::Wallet#unlock` can be passed no argument (`password` will be `nil`).
79
+ - `Nanook::Wallet#info` returns data from `wallet_info` RPC.
80
+ - `Nanook::Block#is_valid_work?` renamed to `#valid_work?`.
81
+ - `Nanook::Block#republish` returns an Array of `Nanook::Block`s.
82
+ - `Nanook::Block#chain` returns an Array of `Nanook::Block`s.
83
+ - `Nanook::Block#successors` returns an Array of `Nanook::Block`s.
84
+ - `Nanook::Block#info`:
85
+ - returns balances in nano, and can optionally be passed `unit: :raw` argument.
86
+ - returns account values as `Nanook::Account` and block values as `Nanook::Block`.
87
+ - `Nanook::Node#peers` returns details as a `Hash` keyed by `Nanook::Account`.
88
+ - `Nanook::Account#pending` returns source as `Nanook::Account` and block as `Nanook::Block` when `detailed: true`.
89
+ - `Nanook::Account#representative` returns a `Nanook::Account`.
90
+ - `Nanook::Account#delegators` returns accounts as `Nanook::Account`s.
91
+ - `Nanook::Account#history` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
92
+ - `Nanook::Account#ledger` returns accounts as `Nanook::Account` and blocks as `Nanook::Block`.
93
+ - `Nanook::Account#public_key` returns a `Nanook::PublicKey`.
94
+ - `Nanook::Account#weight` accepts an optional `unit:` argment.
95
+ - `Nanook::Account#info`:
96
+ - returns the `frontier`, `open_block`, `representative_block` values as `Nanook::Block`s.
97
+ - returns the `representative` as a `Nanook::Account`.
98
+ - `modified_timestamp` key renamed to `last_modified_at` and value is a `Time` in UTC.
99
+ - `Nanook::Key` has become `Nanook::PrivateKey`, `#generate` has been renamed `#create` and returns a `Nanook::PrivateKey`.
100
+
101
+ ### Fixed
102
+
103
+ - A number of errors when node is still bootstrapping and is missing accounts from the ledger.
104
+ - `Nanook::Node#representatives_online` accessing representative list as a `Hash` after RPC change.
105
+
106
+ ## 2.5.1
107
+
108
+ ### Fixed
109
+
110
+ - undefined method 'new' for `BigDecimal:Class` (thank you @MihaiVoinea)
111
+
112
+ ## 2.5.0
113
+
114
+ ### Added
115
+
116
+ - New `Nanook::Node#bootstrap_lazy` method.
117
+ - New `Nanook::Node#bootstrap_status` method.
118
+ - New `Nanook::Node#difficulty` method.
119
+ - New `Nanook::Node#uptime` method.
120
+ - New `Nanook::Wallet#lock` method.
121
+
122
+ ### Changed
123
+
124
+ - `Nanook::Node#chain` now takes optional `offset` argument.
125
+ - `Nanook::Node#successors` now takes optional `offset` argument.
126
+ - `Nanook::Node#successors` now aliased as `Nanook::Node#ancestors`
127
+ - Updated docs to use `nano_` prefixed addresses.
128
+
129
+ ## 2.4.0
130
+
131
+ ### Added
132
+
133
+ - New `Nanook::Node#confirmation_history` method.
134
+ - New `Nanook::Block#confirm` method.
135
+ - New `Nanook::Block#confirmed_recently?` method.
136
+
137
+ ### Changed
138
+
139
+ - `Nanook::Block#generate_work` now can take optional `use_peers` argument.
140
+
141
+ ## 2.3.0
142
+
143
+ ### Added
144
+
145
+ - New `Nanook::Wallet#default_representative` method.
146
+ - New `Nanook::Wallet#change_default_representative` method.
147
+ - New `Nanook::Wallet#info` method.
148
+
7
149
  ## 2.2.0
8
150
 
9
151
  ### Added
10
152
 
11
153
  - New `Nanook::Account#block_count` method returns number of blocks in ledger for an account.
12
- - `Account#delegators` now takes `unit` argument.
13
- - `Account#ledger` now takes `unit` and `modified_since` arguments.
14
154
  - `Nanook::Node#block_count_type` is now an alias to the preferred `#block_count_by_type`
15
155
  method.
16
- - `Nanook::Node#representatives` now takes `unit` argument.
17
156
  - new `Nanook::Node#representatives_online` method.
18
157
  - `Nanook::Node#synchronizing_blocks` aliased by `#unchecked`, for people familiar with
19
158
  what the RPC calls it.
@@ -28,6 +167,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
28
167
 
29
168
  ### Changed
30
169
 
170
+ - `Nanook::Account#delegators` now takes `unit` argument.
171
+ - `Nanook::Account#ledger` now takes `unit` and `modified_since` arguments.
172
+ - `Nanook::Node#representatives` now takes `unit` argument.
31
173
  - `Nanook::Node#synced?` is deprecated with a `warn`. Nodes never seem to reach 100%
32
174
  synchronized, so this method is useless.
33
175
  - `Nanook::Rpc::DEFAULT_TIMEOUT` reduced from 500 to 60.
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.2"
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.2.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.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.2.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.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,15 +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
 
173
+ wallet.default_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)
179
+ wallet.info
180
+ wallet.info(unit: :raw)
165
181
  wallet.export
182
+ wallet.ledger
183
+ wallet.ledger(unit: :raw)
184
+ wallet.lock
166
185
  wallet.locked?
186
+ wallet.republish_blocks
187
+ wallet.republish_blocks(limit: 5)
167
188
  wallet.unlock(password)
168
- wallet.change_password(password)
189
+ wallet.work
169
190
 
170
191
  wallet.destroy
171
192
  ```
@@ -174,131 +195,159 @@ wallet.destroy
174
195
  #### Create account:
175
196
 
176
197
  ```ruby
177
- Nanook.new.wallet(wallet_id).account.create
198
+ nanook.wallet(wallet_id).account.create
178
199
  ```
179
200
 
180
201
  #### Create multiple accounts:
181
202
 
182
203
  ```ruby
183
- Nanook.new.wallet(wallet_id).account.create(5)
204
+ nanook.wallet(wallet_id).account.create(5)
184
205
  ```
185
206
 
186
- #### Working with a single account:
207
+ #### Working with an account:
187
208
 
188
- See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/2.2.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`:
189
210
 
190
211
  ```ruby
191
- account = Nanook.new.wallet(wallet_id).account(account_id)
212
+ account = nanook.account(account_id)
213
+ ```
192
214
 
215
+ See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/3.0.0/Nanook/Account.html) for a detailed description of each method and example responses.
216
+
217
+ ```ruby
193
218
  account.balance
194
219
  account.balance(unit: :raw)
195
- account.pay(to: recipient_account_id, amount: 2, id: unique_id)
196
- account.pay(to: recipient_account_id, amount: 2, id: unique_id, unit: :raw)
197
220
  account.pending
198
221
  account.pending(limit: 1)
199
222
  account.pending(detailed: true)
200
223
  account.pending(unit: :raw)
201
- account.receive
202
- account.receive(pending_block_id)
203
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
204
231
  account.exists?
232
+ account.history
233
+ account.history(limit: 1)
234
+ account.history(unit: :raw)
235
+ account.history(sort: :desc)
205
236
  account.info
206
- account.info(detailed: true)
207
237
  account.info(unit: :raw)
208
238
  account.last_modified_at
209
239
  account.ledger
210
240
  account.ledger(limit: 10)
211
241
  account.ledger(modified_since: Time.now)
212
242
  account.ledger(unit: :raw)
213
- account.history
214
- account.history(limit: 1)
215
- account.history(unit: :raw)
243
+ account.ledger(sort: :desc)
244
+ account.open_block
216
245
  account.public_key
217
- account.delegators
218
- account.delegators(unit: :raw)
219
246
  account.representative
220
- account.change_representative(new_representative)
221
247
  account.weight
222
-
223
- account.destroy
248
+ account.weight(unit: :raw)
224
249
  ```
225
250
 
226
- #### Working with any account (not necessarily in your wallet):
251
+ #### Working with an account created on the node:
227
252
 
228
- See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/2.2.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`:
229
255
 
230
256
  ```ruby
231
- account = Nanook.new.account(account_id)
257
+ wallet = nanook.wallet(wallet_id)
258
+ account = wallet.account(account_id)
259
+ ```
232
260
 
233
- account.balance
234
- account.balance(unit: :raw)
235
- account.pending
236
- account.pending(limit: 1)
237
- account.pending(detailed: true)
238
- account.pending(unit: :raw)
261
+ As well as the following methods, all methods of [regular accounts](#working-with-any-account) can also be called.
239
262
 
240
- account.exists?
241
- account.info
242
- account.info(detailed: true)
243
- account.info(unit: :raw)
244
- account.last_modified_at
245
- account.ledger
246
- account.ledger(limit: 10)
247
- account.ledger(modified_since: Time.now)
248
- account.ledger(unit: :raw)
249
- account.history
250
- account.history(limit: 1)
251
- account.history(unit: :raw)
252
- account.public_key
253
- account.delegators
254
- account.delegators(unit: :raw)
255
- account.representative
256
- account.weight
263
+ See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/3.0.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
257
274
  ```
258
275
 
259
276
  ### Blocks
260
277
 
261
- See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/2.2.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.0/Nanook/Block.html) for a detailed description of each method and example responses.
262
279
 
263
280
  ```ruby
264
- block = Nanook.new.block(block_id)
281
+ block = nanook.block(block_id)
265
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
266
293
  block.info # Verified blocks in the ledger
267
294
  block.info(allow_unchecked: true) # Verified blocks AND unchecked synchronizing blocks
295
+ block.info(unit: :raw)
268
296
  block.account
269
297
  block.chain
270
298
  block.chain(limit: 10)
271
- block.history
272
- block.history(limit: 10)
299
+ block.chain(offset: 10)
300
+ block.confirm
273
301
  block.republish
274
302
  block.republish(sources: 2)
275
303
  block.republish(destinations: 2)
304
+ block.open?
276
305
  block.pending?
277
- block.publish
306
+ block.previous
307
+ block.receive?
308
+ block.representative
309
+ block.send?
310
+ block.signature
278
311
  block.successors
279
312
  block.successors(limit: 10)
313
+ block.successors(offset: 10)
314
+ block.timestamp
315
+ block.type
316
+ block.unchecked?
317
+ block.work
280
318
 
281
319
  block.generate_work
320
+ block.generate_work(use_peers: true)
282
321
  block.cancel_work
283
- block.is_valid_work?(work_id)
322
+ block.valid_work?(work)
284
323
  ```
285
324
 
286
325
  ### Managing your nano node
287
326
 
288
- See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/2.2.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.0/Nanook/Node.html) for a detailed description of each method and example responses.
289
328
 
290
329
  ```ruby
291
- node = Nanook.new.node
330
+ node = nanook.node
292
331
 
293
332
  node.account_count
294
333
  node.block_count
295
- node.block_count_by_type
296
- node.bootstrap_any
297
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)
298
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)
299
347
  node.representatives
300
348
  node.representatives(unit: :raw)
301
349
  node.representatives_online
350
+ node.search_pending
302
351
  node.synchronizing_blocks
303
352
  node.synchronizing_blocks(limit: 1)
304
353
  node.sync_progress
@@ -310,7 +359,7 @@ node.stop
310
359
  ### Work peers
311
360
 
312
361
  ```ruby
313
- work_peers = Nanook.new.work_peers
362
+ work_peers = nanook.work_peers
314
363
 
315
364
  work_peers.add(address: "::ffff:172.17.0.1:7076", port: 7076)
316
365
  work_peers.clear
@@ -322,26 +371,44 @@ work_peers.list
322
371
  #### Create private public key pair:
323
372
 
324
373
  ```ruby
325
- Nanook.new.key.generate
326
- 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
327
377
  ```
328
378
 
329
- #### Working with a single key
379
+ #### Working with a private key
330
380
 
331
381
  ```ruby
332
- key = Nanook.new.key(private_key)
382
+ key = nanook.private_key(private_key)
383
+
384
+ key.account
385
+ key.public_key
386
+ ```
333
387
 
334
- 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
335
402
  ```
336
403
 
337
404
  ## Nanook Metal
338
405
 
339
- 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.
340
407
 
341
- 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:
342
409
 
343
410
  ```ruby
344
- Nano.new.rpc(:accounts_create, wallet: wallet_id, count: 2)
411
+ nanook.rpc.call(:accounts_create, wallet: wallet_id, count: 2)
345
412
  ```
346
413
 
347
414
  ## Contributing
@@ -362,11 +429,11 @@ The gem is available as open source under the terms of the [MIT License](https:/
362
429
 
363
430
  ## Buy me a nano coffee
364
431
 
365
- 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!
366
433
 
367
- xrb_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j
434
+ nano_3c3ek3k8135f6e8qtfy8eruk9q3yzmpebes7btzncccdest8ymzhjmnr196j
368
435
 
369
- ![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)
370
437
 
371
438
 
372
439