nanook 3.0.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
2
  SHA256:
3
- metadata.gz: 4aa7c4cfb54ead1044be1f2da82f82c0e53e5fbf37750dc8019235071879d8f5
4
- data.tar.gz: 6be63035a579afddb88c63baa8dba875346f8e8a5bba147a5e89cade033e8a94
3
+ metadata.gz: 86e9dced1a4ce9942cd123c262d7ff45fad6e982ce67c6903b6495a2609c29f9
4
+ data.tar.gz: 11d3752a80bc33e41ba7e19c7d4e2ad54b2d4a08212b71e7fd3579092d9b8c55
5
5
  SHA512:
6
- metadata.gz: 4b20db4ba4f60524baa8ced68e9fb821da4ebb0404fcc19f15332c5cbac7b37027fa5b96523e833ed96fcbe2e2700fe6a79a714c57cd1c5bc2558a48e53269b9
7
- data.tar.gz: f286eb5b4ee747beec160d8c4c97d17a6bf4d0cef08914d425ca5bb630575ae5eb99e39071e230cd1b32571e3cc85e33e81293edf5e12bd3a24b4d6f962fa6fe
6
+ metadata.gz: c53742261c03ba53fdcc46ffbcd0c556ccfe3d1b025f593d1b3f1ee9c6f1c1fcacb387b419aac07eefab390356022373dcc2121449097e968f051ac0498d4dfc
7
+ data.tar.gz: d1d4e28e58f28ee5ea161232276454b5eafd8959b63685db3440a6e15e1328e31b6676f5676f94fe0d30420e6e5b0c540a9345033dfb137fbf89d56ccf0de951
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ 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
+
7
13
  ## 3.0.0
8
14
 
9
15
  ### Removed
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.0/) for a searchable detailed description of every class and method, what the arguments mean, and example responses.
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.
128
128
 
129
129
  ### Wallets
130
130
 
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.
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.
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.0/Nanook/Account.html) for a detailed description of each method and example responses.
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
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.0/Nanook/WalletAccount.html) for a detailed description of each method and example responses.
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
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.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.
279
279
 
280
280
  ```ruby
281
281
  block = nanook.block(block_id)
@@ -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.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.
328
328
 
329
329
  ```ruby
330
330
  node = nanook.node
@@ -328,7 +328,9 @@ class Nanook
328
328
  response[:open_block] = as_block(response[:open_block]) if response[:open_block]
329
329
  response[:representative_block] = as_block(response[:representative_block]) if response[:representative_block]
330
330
  response[:representative] = as_account(response[:representative]) if response[:representative]
331
- response[:confirmation_height_frontier] = as_block(response[:confirmation_height_frontier]) if response[:confirmation_height_frontier]
331
+ if response[:confirmation_height_frontier]
332
+ response[:confirmation_height_frontier] = as_block(response[:confirmation_height_frontier])
333
+ end
332
334
  response[:last_modified_at] = as_time(response.delete(:modified_timestamp))
333
335
 
334
336
  if unit == :nano
data/lib/nanook/block.rb CHANGED
@@ -175,6 +175,8 @@ class Nanook
175
175
  parse_info_response(response, unit)
176
176
  end
177
177
 
178
+ # Returns true if work is valid for the block.
179
+ #
178
180
  # ==== Example:
179
181
  #
180
182
  # block.valid_work?("2bf29ef00786a6bc") # => true
@@ -213,6 +215,8 @@ class Nanook
213
215
  end
214
216
  end
215
217
 
218
+ # Returns true if block is a pending block.
219
+ #
216
220
  # ==== Example:
217
221
  #
218
222
  # block.pending? #=> false
@@ -483,9 +487,16 @@ class Nanook
483
487
  response.merge!(contents) if contents
484
488
 
485
489
  response.delete(:block_account) # duplicate of contents.account
486
- response[:type] = response.delete(:subtype) # rename key
487
490
  response[:last_modified_at] = response.delete(:modified_timestamp) # rename key
488
491
 
492
+ # `type` can be "open", "send", "receive", "change", "epoch" or "state".
493
+ # blocks with `type` == "state" may have a `subtype` that gives more information
494
+ # about the block ("send", "receive", "change", "epoch"), in which case replace
495
+ # the `type` with this value.
496
+ if response[:type] == 'state' && (subtype = response.delete(:subtype))
497
+ response[:type] = subtype
498
+ end
499
+
489
500
  response[:account] = as_account(response[:account]) if response[:account]
490
501
  response[:representative] = as_account(response[:representative]) if response[:representative]
491
502
  response[:previous] = as_block(response[:previous]) if response[:previous]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Nanook
4
- VERSION = '3.0.0'
4
+ VERSION = '3.0.1'
5
5
  end
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.0
4
+ version: 3.0.1
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-04-13 00:00:00.000000000 Z
11
+ date: 2021-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler