nanook 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +17 -17
- data/lib/nanook/block.rb +32 -16
- data/lib/nanook/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd2278329714fcd1e6778b5cbc85791f67e4fc835a7e6210abedc698f677645f
|
4
|
+
data.tar.gz: 074e3d14d1692038016973492c6d7475815e2b67f670ddba8d0e118e6fcbedfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fb9465657aa458639093281da94821ce9b07731c4b44309fa3372416ec2fa928a77e3d1c8260f4013a21cd51335c92d1cf58aa48cdbb0f5629796b46977c814
|
7
|
+
data.tar.gz: 3d518590b7433bdce1696ccc5d23fa2fc93d60101649ccb954de813493e51f2535f6d85bc91d841bdb7f54539c6f7f20444daaea877562b240191354bd37d3d9
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,17 @@ 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
|
+
|
7
18
|
## 3.0.1
|
8
19
|
|
9
20
|
### Fixed
|
data/README.md
CHANGED
@@ -124,11 +124,11 @@ Read the [Using Nanook](https://github.com/lukes/nanook/wiki/Using-nanook) page
|
|
124
124
|
|
125
125
|
## All commands
|
126
126
|
|
127
|
-
Below is a quick reference list of commands. See the [full Nanook documentation](https://lukes.github.io/nanook/3.0
|
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.
|
128
128
|
|
129
129
|
### Wallets
|
130
130
|
|
131
|
-
See the [full documentation for Nanook::Wallet](https://lukes.github.io/nanook/3.0
|
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.
|
132
132
|
|
133
133
|
#### Create wallet:
|
134
134
|
|
@@ -212,7 +212,7 @@ Any account on the Nano network that is known by your node can be initialized th
|
|
212
212
|
account = nanook.account(account_id)
|
213
213
|
```
|
214
214
|
|
215
|
-
See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/3.0
|
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
216
|
|
217
217
|
```ruby
|
218
218
|
account.balance
|
@@ -260,7 +260,7 @@ account = wallet.account(account_id)
|
|
260
260
|
|
261
261
|
As well as the following methods, all methods of [regular accounts](#working-with-any-account) can also be called.
|
262
262
|
|
263
|
-
See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/3.0
|
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
264
|
|
265
265
|
```ruby
|
266
266
|
account.pay(to: recipient_account_id, amount: 2, id: unique_id)
|
@@ -275,7 +275,7 @@ account.destroy
|
|
275
275
|
|
276
276
|
### Blocks
|
277
277
|
|
278
|
-
See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/3.0
|
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.
|
279
279
|
|
280
280
|
```ruby
|
281
281
|
block = nanook.block(block_id)
|
@@ -283,9 +283,16 @@ block = nanook.block(block_id)
|
|
283
283
|
block.account
|
284
284
|
block.amount
|
285
285
|
block.amount(unit: :raw)
|
286
|
+
block.ancestors
|
287
|
+
block.ancestors(limit: 10)
|
288
|
+
block.ancestors(offset: 10)
|
286
289
|
block.balance
|
287
290
|
block.change?
|
288
291
|
block.checked?
|
292
|
+
block.confirm
|
293
|
+
block.descendants
|
294
|
+
block.descendants(limit: 10)
|
295
|
+
block.descendants(offset: 10)
|
289
296
|
block.epoch?
|
290
297
|
block.exists?
|
291
298
|
block.exists?(allow_unchecked: true)
|
@@ -293,24 +300,17 @@ block.height
|
|
293
300
|
block.info # Verified blocks in the ledger
|
294
301
|
block.info(allow_unchecked: true) # Verified blocks AND unchecked synchronizing blocks
|
295
302
|
block.info(unit: :raw)
|
296
|
-
block.
|
297
|
-
block.chain
|
298
|
-
block.chain(limit: 10)
|
299
|
-
block.chain(offset: 10)
|
300
|
-
block.confirm
|
301
|
-
block.republish
|
302
|
-
block.republish(sources: 2)
|
303
|
-
block.republish(destinations: 2)
|
303
|
+
block.next
|
304
304
|
block.open?
|
305
305
|
block.pending?
|
306
306
|
block.previous
|
307
307
|
block.receive?
|
308
308
|
block.representative
|
309
|
+
block.republish
|
310
|
+
block.republish(sources: 2)
|
311
|
+
block.republish(destinations: 2)
|
309
312
|
block.send?
|
310
313
|
block.signature
|
311
|
-
block.successors
|
312
|
-
block.successors(limit: 10)
|
313
|
-
block.successors(offset: 10)
|
314
314
|
block.timestamp
|
315
315
|
block.type
|
316
316
|
block.unchecked?
|
@@ -324,7 +324,7 @@ block.valid_work?(work)
|
|
324
324
|
|
325
325
|
### Managing your nano node
|
326
326
|
|
327
|
-
See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/3.0
|
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.
|
328
328
|
|
329
329
|
```ruby
|
330
330
|
node = nanook.node
|
data/lib/nanook/block.rb
CHANGED
@@ -66,16 +66,15 @@ class Nanook
|
|
66
66
|
end
|
67
67
|
|
68
68
|
# Returns a consecutive list of block hashes in the account chain
|
69
|
-
#
|
69
|
+
# from (but not including) block back to +count+ (direction from frontier back to
|
70
70
|
# open block, from newer blocks to older). Will list all blocks back
|
71
71
|
# to the open block of this chain when count is set to "-1".
|
72
|
-
# The requested block hash is included in the answer.
|
73
72
|
#
|
74
|
-
# See also #
|
73
|
+
# See also #descendants.
|
75
74
|
#
|
76
75
|
# ==== Example:
|
77
76
|
#
|
78
|
-
# block.
|
77
|
+
# block.ancestors(limit: 2)
|
79
78
|
#
|
80
79
|
# ==== Example reponse:
|
81
80
|
#
|
@@ -84,6 +83,9 @@ class Nanook
|
|
84
83
|
# @param limit [Integer] maximum number of block hashes to return (default is 1000)
|
85
84
|
# @param offset [Integer] return the account chain block hashes offset by the specified number of blocks (default is 0)
|
86
85
|
def chain(limit: 1000, offset: 0)
|
86
|
+
# The RPC includes this block in its response, and Nanook will remove it from the results.
|
87
|
+
# Increment the limit by 1 to account for this (a limit of -1 is valid and means no limit).
|
88
|
+
limit += 1 if limit > 0
|
87
89
|
params = {
|
88
90
|
count: limit,
|
89
91
|
offset: offset,
|
@@ -91,9 +93,8 @@ class Nanook
|
|
91
93
|
_coerce: Array
|
92
94
|
}
|
93
95
|
|
94
|
-
rpc(:chain, :block, params).
|
95
|
-
|
96
|
-
end
|
96
|
+
response = rpc(:chain, :block, params)[1..].to_a
|
97
|
+
response.map { |block| as_block(block) }
|
97
98
|
end
|
98
99
|
alias ancestors chain
|
99
100
|
|
@@ -226,14 +227,15 @@ class Nanook
|
|
226
227
|
rpc(:pending_exists, :hash, _access: :exists) == 1
|
227
228
|
end
|
228
229
|
|
229
|
-
# Returns an Array of block hashes in the account chain
|
230
|
-
#
|
230
|
+
# Returns an Array of block hashes in the account chain from (but not including) this block up to +count+
|
231
|
+
# (direction from open block up to frontier, from older blocks to newer). Will list all
|
232
|
+
# blocks up to frontier (latest block) of this chain when +count+ is set to +-1+.
|
231
233
|
#
|
232
|
-
# See also #
|
234
|
+
# See also #ancestors.
|
233
235
|
#
|
234
236
|
# ==== Example:
|
235
237
|
#
|
236
|
-
# block.
|
238
|
+
# block.descendants # => [Nanook::Block, .. ]
|
237
239
|
#
|
238
240
|
# @param limit [Integer] maximum number of send/receive block hashes
|
239
241
|
# to return in the chain (default is 1000)
|
@@ -241,6 +243,10 @@ class Nanook
|
|
241
243
|
# by the specified number of blocks (default is 0)
|
242
244
|
# @return [Array<Nanook::Block>] blocks in the account chain ending at this block
|
243
245
|
def successors(limit: 1000, offset: 0)
|
246
|
+
# The RPC includes this block in its response, and Nanook will remove it from the results.
|
247
|
+
# Increment the limit by 1 to account for this (a limit of -1 is valid and means no limit).
|
248
|
+
limit += 1 if limit > 0
|
249
|
+
|
244
250
|
params = {
|
245
251
|
count: limit,
|
246
252
|
offset: offset,
|
@@ -248,10 +254,10 @@ class Nanook
|
|
248
254
|
_coerce: Array
|
249
255
|
}
|
250
256
|
|
251
|
-
rpc(:successors, :block, params).
|
252
|
-
|
253
|
-
end
|
257
|
+
response = rpc(:successors, :block, params)[1..].to_a
|
258
|
+
response.map { |block| as_block(block) }
|
254
259
|
end
|
260
|
+
alias descendants successors
|
255
261
|
|
256
262
|
# Returns the {Nanook::Account} of the block representative.
|
257
263
|
#
|
@@ -350,6 +356,16 @@ class Nanook
|
|
350
356
|
true
|
351
357
|
end
|
352
358
|
|
359
|
+
# Returns the {Nanook::Block} of the next (newer) block in the account chain.
|
360
|
+
#
|
361
|
+
# ==== Example:
|
362
|
+
# block.next # => Nanook::Block
|
363
|
+
#
|
364
|
+
# @return [Nanook::Block] next (newer) block in the account chain. Can be nil.
|
365
|
+
def next
|
366
|
+
successors(limit: 1).first
|
367
|
+
end
|
368
|
+
|
353
369
|
# Returns the height of the block.
|
354
370
|
#
|
355
371
|
# ==== Example:
|
@@ -390,12 +406,12 @@ class Nanook
|
|
390
406
|
memoized_info[:local_timestamp]
|
391
407
|
end
|
392
408
|
|
393
|
-
# Returns the {Nanook::Block} of the previous block in the chain.
|
409
|
+
# Returns the {Nanook::Block} of the previous (older) block in the account chain.
|
394
410
|
#
|
395
411
|
# ==== Example:
|
396
412
|
# block.previous # => Nanook::Block
|
397
413
|
#
|
398
|
-
# @return [Nanook::Block] previous block in the chain. Can be nil.
|
414
|
+
# @return [Nanook::Block] previous (older) block in the account chain. Can be nil.
|
399
415
|
def previous
|
400
416
|
memoized_info[:previous]
|
401
417
|
end
|
data/lib/nanook/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Duncalfe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|