hyperledger_cli 0.0.8 → 0.0.9
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 +4 -4
- data/README.md +9 -12
- data/bin/hyperledger +7 -15
- data/lib/hyperledger_cli/error_printer.rb +11 -0
- data/lib/hyperledger_cli/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd1a6f8db5c8d80f45ca8049da4e89d0dc55299
|
4
|
+
data.tar.gz: 3ae8718067ec33e95fab1bad8227a7ab0a6b092f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10312b4eb8a2cd46586e1eb35dc3f367041265eb07c204f1f8844ee58fdc3acc2bdcd2398d3852cafcaf2097c6756d8bcee54db175b1ce7ebb9d2f82da1a00f8
|
7
|
+
data.tar.gz: 6dba23ae4875b636b80207f0775e3d918c51109516c2c1e514fe0fb554ded6e912e8d6d2b8eb9e0a231dc146af9b1bfaa9950931f9a735864bc6c8d72d9d257e
|
data/README.md
CHANGED
@@ -1,24 +1,17 @@
|
|
1
1
|
# HyperledgerCli
|
2
2
|
|
3
|
-
|
3
|
+
This is a simple CLI for the hyperledger protocol. It is young software
|
4
|
+
under active development.
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
7
|
-
|
8
|
+
Hyperledger CLI can be installed with Rubygems:
|
8
9
|
|
9
10
|
gem 'hyperledger_cli'
|
10
11
|
|
11
|
-
|
12
|
+
You will then be able to access hyperledger from the command line:
|
12
13
|
|
13
|
-
$
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install hyperledger_cli
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
14
|
+
$ hyperledger
|
22
15
|
|
23
16
|
## Contributing
|
24
17
|
|
@@ -27,3 +20,7 @@ TODO: Write usage instructions here
|
|
27
20
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
21
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
22
|
5. Create a new Pull Request
|
23
|
+
|
24
|
+
## License
|
25
|
+
|
26
|
+
hyperledger CLI is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
data/bin/hyperledger
CHANGED
@@ -6,19 +6,11 @@ require 'openssl'
|
|
6
6
|
require 'rest_client'
|
7
7
|
require 'base64'
|
8
8
|
require 'json'
|
9
|
-
|
10
|
-
|
11
|
-
def print_error(err)
|
12
|
-
puts "Error: #{err}"
|
13
|
-
errors = JSON.parse(err.response, symbolize_names: true)[:errors]
|
14
|
-
if errors
|
15
|
-
errors.each do |k, v| puts "#{k}:\t#{v.join(', ')}" end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
9
|
+
require 'securerandom'
|
10
|
+
require './lib/hyperledger_cli/error_printer'
|
19
11
|
|
20
12
|
class Ledger < Thor
|
21
|
-
include ErrorPrinter
|
13
|
+
include HyperledgerCli::ErrorPrinter
|
22
14
|
|
23
15
|
desc 'list', 'List all known ledgers'
|
24
16
|
def list
|
@@ -53,7 +45,7 @@ class Ledger < Thor
|
|
53
45
|
end
|
54
46
|
|
55
47
|
class Account < Thor
|
56
|
-
include ErrorPrinter
|
48
|
+
include HyperledgerCli::ErrorPrinter
|
57
49
|
|
58
50
|
desc 'list', 'List all known accounts'
|
59
51
|
def list
|
@@ -89,7 +81,7 @@ class Account < Thor
|
|
89
81
|
end
|
90
82
|
|
91
83
|
class Hyperledger < Thor
|
92
|
-
include ErrorPrinter
|
84
|
+
include HyperledgerCli::ErrorPrinter
|
93
85
|
|
94
86
|
class_option :server, type: :string, default: 'http://hyperledger-staging-1.herokuapp.com'
|
95
87
|
|
@@ -101,7 +93,7 @@ class Hyperledger < Thor
|
|
101
93
|
|
102
94
|
desc 'issue <amount> <ledger>', 'Issue <amount> new units to <ledger>.'
|
103
95
|
def issue(amount, ledger)
|
104
|
-
data = { ledger: ledger, amount: amount.to_i }
|
96
|
+
data = { ledger: ledger, amount: amount.to_i, uuid: SecureRandom.uuid }
|
105
97
|
|
106
98
|
key = OpenSSL::PKey::RSA.new File.read("#{ENV['HOME']}/.hyperledger/#{ledger.downcase}.pem")
|
107
99
|
sign = Base64.encode64 key.sign(OpenSSL::Digest::SHA256.new, data.to_json)
|
@@ -118,7 +110,7 @@ class Hyperledger < Thor
|
|
118
110
|
def transfer(amount, source, destination)
|
119
111
|
key = OpenSSL::PKey::RSA.new File.read("#{ENV['HOME']}/.hyperledger/#{source}.pem")
|
120
112
|
|
121
|
-
data = { source: source, destination: destination, amount: amount.to_i }
|
113
|
+
data = { source: source, destination: destination, amount: amount.to_i, uuid: SecureRandom.uuid }
|
122
114
|
sign = Base64.encode64 key.sign(OpenSSL::Digest::SHA256.new, data.to_json)
|
123
115
|
|
124
116
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyperledger_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Feichtinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- bin/hyperledger
|
83
83
|
- hyperledger_cli.gemspec
|
84
84
|
- lib/hyperledger_cli.rb
|
85
|
+
- lib/hyperledger_cli/error_printer.rb
|
85
86
|
- lib/hyperledger_cli/version.rb
|
86
87
|
homepage:
|
87
88
|
licenses:
|