nanocurrency 0.1.0 → 0.2.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
2
  SHA256:
3
- metadata.gz: 31856813e2982b523c6cbd87080416b43d1b1843375af282cce8be90f68f3f8e
4
- data.tar.gz: 4219b7f198944d4a46fe1269382b5909da85c72e30aa8e89c3b30c7aa0e7a0d7
3
+ metadata.gz: 4e67eabc7dbd72b7175424233ffebea1cf7ded01d0428dd7db50dceee5f4ed3c
4
+ data.tar.gz: c9b73d2bfa21bd930083671e6212cae5ce9d32a3bf674b0b0ac6ac41951d0886
5
5
  SHA512:
6
- metadata.gz: 53ef55cfdb31e9585d009f6d404d610369ef89ca71f4c4ebf77dd58c1bd16b38926b4e0cd935020500b5eea8e187819ef8c03c89fd80fce548697b54f8852530
7
- data.tar.gz: 424939d539c3d2a1454eb2c0e7c866a33d3a5ec410e037c07bac5592f2647318a34b0649419854cc27d3a2371c11d9a807532c6a09ff65df2311a569bbf9a761
6
+ metadata.gz: a65e4e4cacf6500c1413079670dcbbfcd4aca85ea73744bca2af7843fac2495f7ff4cc981a81c0b4e5ada4823d85a805f1ba32b21ab55ae39088202293add0f7
7
+ data.tar.gz: 5445d22476c2f46f0b3b7d8545e89b90f420d0522c7bb01fefa5f4ed51c4441c3dccafae348f16ff1b40111d7434a4da69c4eb2b9fb4b4ed3365fae3b8a40e7c
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ *.gem
13
+ *.bundle
@@ -0,0 +1,31 @@
1
+ image: ruby:2.5
2
+
3
+ stages:
4
+ - test
5
+ - deploy
6
+
7
+ before_script:
8
+ - gem install bundler:1.16.6
9
+ - bundler update
10
+
11
+ test:unit:
12
+ stage: test
13
+ script:
14
+ - bundle exec rake full
15
+
16
+ test:tag:
17
+ stage: test
18
+ only:
19
+ - tags
20
+ script:
21
+ - GEM_RELEASE_VERSION=$CI_COMMIT_TAG ruby test/version.rb
22
+
23
+ deploy:rubygems:
24
+ stage: deploy
25
+ only:
26
+ - tags
27
+ script:
28
+ - "echo '---\n:rubygems_api_key: '$RUBYGEMS_API_KEY > ~/.gem/credentials"
29
+ - chmod 0600 ~/.gem/credentials
30
+ - gem build nanocurrency
31
+ - gem push nanocurrency-$CI_COMMIT_TAG.gem
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanocurrency (0.1.0)
4
+ nanocurrency (0.2.0)
5
5
  blake2b
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Nanocurrency
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nanocurrency`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ A Ruby toolkit and library for the Nano cryptocurrency
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ To view documentation:
6
+
7
+ https://www.rubydoc.info/gems/nanocurrency
6
8
 
7
9
  ## Installation
8
10
 
@@ -22,7 +24,7 @@ Or install it yourself as:
22
24
 
23
25
  ## Usage
24
26
 
25
- TODO: Write usage instructions here
27
+ documentation here: https://www.rubydoc.info/gems/nanocurrency
26
28
 
27
29
  ## Development
28
30
 
@@ -2,6 +2,7 @@ require_relative "./hash"
2
2
  require_relative "./work"
3
3
  require_relative "./check"
4
4
  require "nanocurrency_ext"
5
+ require "json"
5
6
 
6
7
  module Nano
7
8
  ##
@@ -36,13 +37,13 @@ module Nano
36
37
 
37
38
  ##
38
39
  # The block initializer, requires certain parameters to be valid.
39
- # @param params [Hash] The block parameters to construct the block with.
40
- # `:previous` - The previous block hash as a string
41
- # `:account` - The associated account address as a string
42
- # `:representative` - The account representative as a string
43
- # `:balance` - The account balance after this block in raw unit
44
- # `:link` - The link hash associated with this block.
45
- # `:work` - The proof of work for the block (optional)
40
+ # @param params [Hash] The block parameters to construct the block with.\n
41
+ # `:previous` - The previous block hash as a string\n
42
+ # `:account` - The associated account address as a string\n
43
+ # `:representative` - The account representative as a string\n
44
+ # `:balance` - The account balance after this block in raw unit\n
45
+ # `:link` - The link hash associated with this block.\n
46
+ # `:work` - The proof of work for the block (optional)\n
46
47
  # `:signature` - The signature for this block (optional)
47
48
  def initialize(params)
48
49
  @type = "state"
@@ -138,5 +139,19 @@ module Nano
138
139
  def hash
139
140
  Nano::Hash.hash_block(self)
140
141
  end
142
+
143
+ def to_json(options = nil)
144
+ {
145
+ type: type,
146
+ account: account,
147
+ previous: previous,
148
+ representative: representative,
149
+ balance: balance,
150
+ link: link,
151
+ link_as_account: link_as_account,
152
+ signature: signature,
153
+ work: work
154
+ }.to_json(options)
155
+ end
141
156
  end
142
157
  end
@@ -1,3 +1,3 @@
1
1
  module Nanocurrency
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = "A toolkit for the Nano cryptocurrency, allowing you to derive keys, generate seeds, hashes, signatures, proofs of work and blocks."
12
12
  spec.description = "A toolkit for the Nano cryptocurrency, allowing you to derive keys, generate seeds, hashes, signatures, proofs of work and blocks."
13
- spec.homepage = "https://github.com/nanotify/nanocurrency"
13
+ spec.homepage = "https://gitlab.com/Nanotify/ruby/nanocurrency"
14
14
  spec.license = "MIT"
15
15
 
16
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
@@ -19,8 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
20
 
21
21
  spec.metadata["homepage_uri"] = spec.homepage
22
- spec.metadata["source_code_uri"] = "https://github.com/nanotify/nanocurrency.git"
23
- spec.metadata["changelog_uri"] = "https://github.com/nanotify/nanocurrency"
22
+ spec.metadata["source_code_uri"] = "https://gitlab.com/Nanotify/ruby/nanocurrency"
23
+ spec.metadata["changelog_uri"] = "https://gitlab.com/Nanotify/ruby/nanocurrency"
24
+ spec.metadata["documentation_uri"] = "https://www.rubydoc.info/gems/nanocurrency"
24
25
  else
25
26
  raise "RubyGems 2.0 or newer is required to protect against " \
26
27
  "public gem pushes."
@@ -34,6 +35,7 @@ Gem::Specification.new do |spec|
34
35
  spec.bindir = "exe"
35
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
37
  spec.require_paths = ["lib"]
38
+ spec.extensions = %w[ext/nanocurrency_ext/extconf.rb]
37
39
 
38
40
  spec.add_dependency "blake2b"
39
41
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanocurrency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliott Minns
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-21 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blake2b
@@ -85,10 +85,12 @@ description: A toolkit for the Nano cryptocurrency, allowing you to derive keys,
85
85
  email:
86
86
  - elliott@nanotify.io
87
87
  executables: []
88
- extensions: []
88
+ extensions:
89
+ - ext/nanocurrency_ext/extconf.rb
89
90
  extra_rdoc_files: []
90
91
  files:
91
92
  - ".gitignore"
93
+ - ".gitlab-ci.yml"
92
94
  - ".rspec"
93
95
  - ".travis.yml"
94
96
  - CODE_OF_CONDUCT.md
@@ -158,16 +160,16 @@ files:
158
160
  - lib/nano/work.rb
159
161
  - lib/nanocurrency.rb
160
162
  - lib/nanocurrency/version.rb
161
- - lib/nanocurrency_ext.bundle
162
163
  - nanocurrency.gemspec
163
- homepage: https://github.com/nanotify/nanocurrency
164
+ homepage: https://gitlab.com/Nanotify/ruby/nanocurrency
164
165
  licenses:
165
166
  - MIT
166
167
  metadata:
167
168
  allowed_push_host: https://rubygems.org
168
- homepage_uri: https://github.com/nanotify/nanocurrency
169
- source_code_uri: https://github.com/nanotify/nanocurrency.git
170
- changelog_uri: https://github.com/nanotify/nanocurrency
169
+ homepage_uri: https://gitlab.com/Nanotify/ruby/nanocurrency
170
+ source_code_uri: https://gitlab.com/Nanotify/ruby/nanocurrency
171
+ changelog_uri: https://gitlab.com/Nanotify/ruby/nanocurrency
172
+ documentation_uri: https://www.rubydoc.info/gems/nanocurrency
171
173
  post_install_message:
172
174
  rdoc_options: []
173
175
  require_paths:
@@ -183,8 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
185
  - !ruby/object:Gem::Version
184
186
  version: '0'
185
187
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.7.9
188
+ rubygems_version: 3.0.3
188
189
  signing_key:
189
190
  specification_version: 4
190
191
  summary: A toolkit for the Nano cryptocurrency, allowing you to derive keys, generate
Binary file