nanook 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +11 -11
- data/lib/nanook/util.rb +2 -2
- data/lib/nanook/version.rb +1 -1
- data/lib/nanook/wallet.rb +2 -3
- data/lib/nanook/wallet_account.rb +1 -1
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d03d4611714f05048845e583058c3d99216e0d7bc4e82994556f7abd6bc94d4e
|
4
|
+
data.tar.gz: 404045d0de5f045400897c648e22267c0981ff9d498e9404f08ef77aaadfbfac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b5a0bf64ca64119b0e692b527677154a291c8080ade14c52624e41d59fb772c9e5f55c0f58bd8a460ea806fdcbbeebd0009f248547771f228f48a4829e2a014
|
7
|
+
data.tar.gz: d78534084ba296713af7e3384222319916d3e6e61977d044d8cd724a46b70469c7df7299ba6ed35118dc491aa9de8cb9766a9fb42ab6a16e4543a95e30d76793
|
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
|
+
## 2.5.1
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- undefined method 'new' for `BigDecimal:Class` (thank you @MihaiVoinea)
|
12
|
+
|
7
13
|
## 2.5.0
|
8
14
|
|
9
15
|
### 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://
|
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)
|
@@ -76,7 +76,7 @@ wallet = Nanook.new.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://
|
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
|
|
@@ -86,7 +86,7 @@ The unit of the `amount` is NANO (which is currently technically Mnano — s
|
|
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://
|
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
|
|
@@ -120,11 +120,11 @@ wallet.receive(block_id, into: account_id)
|
|
120
120
|
|
121
121
|
## All commands
|
122
122
|
|
123
|
-
Below is a quick reference list of commands. See the [full Nanook documentation](https://lukes.github.io/nanook/2.5.
|
123
|
+
Below is a quick reference list of commands. See the [full Nanook documentation](https://lukes.github.io/nanook/2.5.1/) 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).
|
124
124
|
|
125
125
|
### Wallets
|
126
126
|
|
127
|
-
See the [full documentation for Nanook::Wallet](https://lukes.github.io/nanook/2.5.
|
127
|
+
See the [full documentation for Nanook::Wallet](https://lukes.github.io/nanook/2.5.1/Nanook/Wallet.html) for a detailed description of each method and example responses.
|
128
128
|
|
129
129
|
#### Create wallet:
|
130
130
|
|
@@ -191,7 +191,7 @@ Nanook.new.wallet(wallet_id).account.create(5)
|
|
191
191
|
|
192
192
|
#### Working with a single account:
|
193
193
|
|
194
|
-
See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/2.5.
|
194
|
+
See the [full documentation for Nanook::WalletAccount](https://lukes.github.io/nanook/2.5.1/Nanook/WalletAccount.html) for a detailed description of each method and example responses.
|
195
195
|
|
196
196
|
```ruby
|
197
197
|
account = Nanook.new.wallet(wallet_id).account(account_id)
|
@@ -231,7 +231,7 @@ account.destroy
|
|
231
231
|
|
232
232
|
#### Working with any account (not necessarily in your wallet):
|
233
233
|
|
234
|
-
See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/2.5.
|
234
|
+
See the [full documentation for Nanook::Account](https://lukes.github.io/nanook/2.5.1/Nanook/Account.html) for a detailed description of each method and example responses.
|
235
235
|
|
236
236
|
```ruby
|
237
237
|
account = Nanook.new.account(account_id)
|
@@ -264,7 +264,7 @@ account.weight
|
|
264
264
|
|
265
265
|
### Blocks
|
266
266
|
|
267
|
-
See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/2.5.
|
267
|
+
See the [full documentation for Nanook::Block](https://lukes.github.io/nanook/2.5.1/Nanook/Block.html) for a detailed description of each method and example responses.
|
268
268
|
|
269
269
|
```ruby
|
270
270
|
block = Nanook.new.block(block_id)
|
@@ -296,7 +296,7 @@ block.is_valid_work?(work_id)
|
|
296
296
|
|
297
297
|
### Managing your nano node
|
298
298
|
|
299
|
-
See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/2.5.
|
299
|
+
See the [full documentation for Nanook::Node](https://lukes.github.io/nanook/2.5.1/Nanook/Node.html) for a detailed description of each method and example responses.
|
300
300
|
|
301
301
|
```ruby
|
302
302
|
node = Nanook.new.node
|
@@ -353,9 +353,9 @@ key.info
|
|
353
353
|
|
354
354
|
## Nanook Metal
|
355
355
|
|
356
|
-
You can do any call listed in the [Nano RPC](https://
|
356
|
+
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
357
|
|
358
|
-
E.g., the [accounts_create command](https://
|
358
|
+
E.g., the [accounts_create command](https://docs.nano.org/commands/rpc-protocol/#accounts_create) can be called like this:
|
359
359
|
|
360
360
|
```ruby
|
361
361
|
Nanook.new.rpc.call(:accounts_create, wallet: wallet_id, count: 2)
|
data/lib/nanook/util.rb
CHANGED
@@ -6,14 +6,14 @@ class Nanook
|
|
6
6
|
class Util
|
7
7
|
|
8
8
|
# Constant used to convert back and forth between raw and NANO.
|
9
|
-
STEP = BigDecimal
|
9
|
+
STEP = BigDecimal("10")**BigDecimal("30")
|
10
10
|
|
11
11
|
# Converts an amount of NANO to an amount of raw.
|
12
12
|
#
|
13
13
|
# @param nano [Float|Integer] amount in nano
|
14
14
|
# @return [Integer] amount in raw
|
15
15
|
def self.NANO_to_raw(nano)
|
16
|
-
(BigDecimal
|
16
|
+
(BigDecimal(nano.to_s) * STEP).to_i
|
17
17
|
end
|
18
18
|
|
19
19
|
# Converts an amount of raw to an amount of NANO.
|
data/lib/nanook/version.rb
CHANGED
data/lib/nanook/wallet.rb
CHANGED
@@ -33,8 +33,7 @@ class Nanook
|
|
33
33
|
# want to restore the wallet anywhere else on the nano network besides
|
34
34
|
# the node you originally created it on. The nano command line interface
|
35
35
|
# (CLI) is the only method for discovering a wallet's seed. See the
|
36
|
-
# {https://
|
37
|
-
# --wallet_decrypt_unsafe CLI command}.
|
36
|
+
# {https://docs.nano.org/commands/command-line-interface/#-wallet_decrypt_unsafe-walletwallet-passwordpassword}.
|
38
37
|
#
|
39
38
|
# === Initializing
|
40
39
|
#
|
@@ -254,7 +253,7 @@ class Nanook
|
|
254
253
|
# on the nano network.
|
255
254
|
#
|
256
255
|
# Note, there may be a delay in receiving a response due to Proof of
|
257
|
-
# Work being done. From the {Nano RPC}[https://
|
256
|
+
# Work being done. From the {Nano RPC}[https://docs.nano.org/commands/rpc-protocol/#send]:
|
258
257
|
#
|
259
258
|
# <i>Proof of Work is precomputed for one transaction in the
|
260
259
|
# background. If it has been a while since your last transaction it
|
@@ -113,7 +113,7 @@ class Nanook
|
|
113
113
|
# if successful, or a {Nanook::Error} if unsuccessful.
|
114
114
|
#
|
115
115
|
# Note, there may be a delay in receiving a response due to Proof
|
116
|
-
# of Work being done. From the {Nano RPC}[https://
|
116
|
+
# of Work being done. From the {Nano RPC}[https://docs.nano.org/commands/rpc-protocol/#send]:
|
117
117
|
#
|
118
118
|
# <i>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.</i>
|
119
119
|
#
|
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: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Duncalfe
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '12.3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '12.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,7 +166,7 @@ licenses:
|
|
166
166
|
- MIT
|
167
167
|
metadata:
|
168
168
|
yard.run: yri
|
169
|
-
post_install_message:
|
169
|
+
post_install_message:
|
170
170
|
rdoc_options: []
|
171
171
|
require_paths:
|
172
172
|
- lib
|
@@ -181,9 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
|
-
|
185
|
-
|
186
|
-
signing_key:
|
184
|
+
rubygems_version: 3.2.3
|
185
|
+
signing_key:
|
187
186
|
specification_version: 4
|
188
187
|
summary: Library for managing a nano currency node, including making and receiving
|
189
188
|
payments, using the nano RPC protocol
|