coloredcoins 0.0.6 → 0.0.7

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
- SHA1:
3
- metadata.gz: 84d5926b64d7efae7c1c201a3c1dc9fba0d25445
4
- data.tar.gz: 9706a6127d028e6f9a2dc8cf62eb388575518b2e
2
+ SHA256:
3
+ metadata.gz: 92a18aef5eb8322db0151ee58ffa4bc9186a588dff4c8ec4a337cef92f6c4fdb
4
+ data.tar.gz: 86e8b54187040121bcd5532743472298a48d474368bb151d726d572740601395
5
5
  SHA512:
6
- metadata.gz: 1e2eb620763e3286910ad88135f91e57ab3efc70c5cc7e60669bd6718bc9b95ad221bc7b3279c7bd0d8d1b4e65dac01c1d0e6fcdd344e41df10d7ad808acc649
7
- data.tar.gz: 6f4de3d9b90dbc00c5006ea7f80b836042edd9467e273e562d971300e020b5e566a3bf5be149837147d9764e7909948e109fd9ba15ce5daf572b435ecf1f4ef2
6
+ metadata.gz: f411812a0a5ed2899afa787d10f5cea096af81be8b7910ebac5e61d30ad9b3d404f3ec4df3575aa5ddfab988adbc2f9f7bc0977f24c1d95a1da46658631c143c
7
+ data.tar.gz: 5e1531f7d5caae8ec561de3f28312b2db14f09f26f73f2ceb1a96444f4fe44abe04b878c619e34373afeb670629e2f78ffde9b8dc1d45e346290d4459e314b2f
data/.gitignore CHANGED
@@ -21,3 +21,5 @@ tmp
21
21
  *.a
22
22
  mkmf.log
23
23
  *.sublime-workspace
24
+ .ruby-version
25
+ .ruby-gemset
@@ -13,3 +13,6 @@ Style/HashSyntax:
13
13
  Metrics/BlockLength:
14
14
  Exclude:
15
15
  - 'spec/**/*'
16
+
17
+ Style/UnpackFirst:
18
+ Enabled: false
@@ -1,10 +1,9 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 2.0
5
- - 2.1
6
- - 2.2
7
- - 2.3.0
4
+ - 2.3
5
+ - 2.4
6
+ - 2.5
8
7
  notifications:
9
8
  email:
10
9
  on_success: change
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in coloredcoins.gemspec
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  notification :terminal_notifier
2
4
 
3
5
  rspec_options = {
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
 
3
5
  task :console do
@@ -1,5 +1,6 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'coloredcoins/version'
5
6
 
@@ -17,15 +18,15 @@ Gem::Specification.new do |spec|
17
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
19
  spec.require_paths = ['lib']
19
20
 
20
- spec.add_runtime_dependency 'rest-client', '~> 1.7'
21
- spec.add_runtime_dependency 'json', '~> 1.8'
22
- spec.add_runtime_dependency 'bitcoin-ruby', '~> 0.0.8'
21
+ spec.add_runtime_dependency 'bitcoin-ruby', '>= 0.0.8'
22
+ spec.add_runtime_dependency 'json'
23
+ spec.add_runtime_dependency 'rest-client'
23
24
 
25
+ spec.add_development_dependency 'bump', '~> 0.5', '>= 0.5.3'
24
26
  spec.add_development_dependency 'bundler', '~> 1.6'
25
27
  spec.add_development_dependency 'rake', '~> 10.0'
26
28
  spec.add_development_dependency 'rspec', '3.1'
27
- spec.add_development_dependency 'bump', '~> 0.5', '>= 0.5.3'
28
- spec.add_development_dependency 'rubocop', '~> 0.36'
29
+ spec.add_development_dependency 'rubocop', '~> 0.49'
29
30
  spec.add_development_dependency 'simplecov', '~> 0.11'
30
31
  spec.add_development_dependency 'webmock'
31
32
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bitcoin'
2
4
  require 'coloredcoins/version'
3
5
 
@@ -10,14 +12,14 @@ module Coloredcoins
10
12
 
11
13
  attr_writer :api
12
14
 
13
- InvalidSignatureError = Class.new SecurityError
15
+ InvalidSignatureError = Class.new RuntimeError
14
16
  ConnectionError = Class.new StandardError
15
17
  InvalidKeyError = Class.new RuntimeError
16
18
 
17
- API_VERSION = 'v3'.freeze
19
+ API_VERSION = 'v3'
18
20
  NETS = [
19
- MAINNET = 'mainnet'.freeze,
20
- TESTNET = 'testnet'.freeze
21
+ MAINNET = 'mainnet',
22
+ TESTNET = 'testnet'
21
23
  ].freeze
22
24
 
23
25
  def self.api
@@ -35,6 +37,7 @@ module Coloredcoins
35
37
 
36
38
  def self.method_missing(sym, *args, &block)
37
39
  return api.send(sym, *args, &block) if api.respond_to?(sym)
40
+
38
41
  super
39
42
  end
40
43
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Coloredcoins
2
4
  class API
3
5
  attr_reader :network,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rest-client'
2
4
 
3
5
  module Coloredcoins
@@ -36,8 +38,7 @@ module Coloredcoins
36
38
  private
37
39
 
38
40
  def endpoint_uri(path = '')
39
- path[0] = '' if path[0] == '/'
40
- "#{@url}/#{path}"
41
+ "#{@url}/#{path.gsub(%r{^\/}, '')}"
41
42
  end
42
43
  end
43
44
  end
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Naming/UncommunicativeMethodParamName
1
4
  module Coloredcoins
2
5
  class Multisig
3
6
  attr_reader :m, :pub_keys
4
- attr_accessor :redeem_script
7
+ attr_writer :redeem_script
5
8
 
6
9
  def initialize(m = nil, pub_keys = nil)
7
10
  @m = m
@@ -47,3 +50,4 @@ module Coloredcoins
47
50
  end
48
51
  end
49
52
  end
53
+ # rubocop:enable Naming/UncommunicativeMethodParamName
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Coloredcoins
2
4
  class MultisigTx < Transaction
3
5
  attr_accessor :m,
4
- :pub_keys,
5
- :multisig
6
+ :pub_keys
7
+ attr_writer :multisig
6
8
 
7
9
  def self.build(tx_hex)
8
10
  transaction = MultisigTx.new(tx_hex)
@@ -33,6 +35,7 @@ module Coloredcoins
33
35
  def check
34
36
  raise ArgumentError, 'Set "m" before signing' unless multisig.m
35
37
  return true if multisig.pub_keys || multisig.redeem_script
38
+
36
39
  raise ArgumentError, 'Set "pub_keys" or "redeem_script" before signing'
37
40
  end
38
41
  end
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Coloredcoins
2
4
  class Transaction
3
5
  attr_reader :tx
4
6
 
5
7
  def self.build_key(key)
6
8
  return key if key.is_a?(Array)
9
+
7
10
  key = Bitcoin::Key.from_base58(key) unless key.is_a?(Bitcoin::Key)
8
11
  key
9
12
  rescue RuntimeError => e
@@ -36,6 +39,7 @@ module Coloredcoins
36
39
  def broadcast
37
40
  response = Coloredcoins.broadcast(to_hex)
38
41
  return response unless response[:txid]
42
+
39
43
  txid = response[:txid]
40
44
  txid.is_a?(Array) ? txid.first[:txid] : txid
41
45
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Coloredcoins
2
- VERSION = '0.0.6'.freeze
4
+ VERSION = '0.0.7'
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe Coloredcoins::API do
2
4
  describe 'changing network' do
3
5
  Coloredcoins::NETS.each do |network|
@@ -93,14 +95,14 @@ describe Coloredcoins::API do
93
95
  allow(@api).to receive(:send).and_return true
94
96
  end
95
97
 
96
- %w(
98
+ %w[
97
99
  issue_asset
98
100
  send_asset
99
101
  broadcast
100
102
  address_info
101
103
  asset_holders
102
104
  asset_metadata
103
- ).each do |method|
105
+ ].each do |method|
104
106
  it do
105
107
  Coloredcoins.send(method)
106
108
  expect(@api).to have_received(:send)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe Coloredcoins::Connection do
2
4
  let!(:base_url) { 'http://example.com/api/v1' }
3
5
  let!(:path) { '/some/path' }
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bitcoin'
2
4
 
3
5
  describe Coloredcoins::MultisigTx do
4
6
  let!(:tx_hex) do
5
- %w(
7
+ %w[
6
8
  010000000125b956a45ff3c6927ab85aaed92d88cdbea00a0d81
7
9
  341cfe535b982ab50cf9f70000000000ffffffff03ac02000000
8
10
  00000047512103ffffffffffffffffffffffffffffffffffffff
@@ -11,10 +13,10 @@ describe Coloredcoins::MultisigTx do
11
13
  00000000001c6a1a4343020287d1e95ca859b73cda02c81c772b
12
14
  a186dc1a12a00110e45c01000000000017a914e1088f81edc427
13
15
  ec81f128e2eac8e2f0e62465cd8700000000
14
- ).join
16
+ ].join
15
17
  end
16
18
  let!(:pre_signed_tx_hex) do
17
- %w(
19
+ %w[
18
20
  010000000125b956a45ff3c6927ab85aaed92d88cdbea00a0d813
19
21
  41cfe535b982ab50cf9f700000000fd150100483045022100d57f
20
22
  6d91ce7475d0e47e8ec76f486d1c6a24a04caad93b484b7d0dc3d7
@@ -33,10 +35,10 @@ describe Coloredcoins::MultisigTx do
33
35
  52ae00000000000000001c6a1a4343020287d1e95ca859b73cda02
34
36
  c81c772ba186dc1a12a00110e45c01000000000017a914e1088f81
35
37
  edc427ec81f128e2eac8e2f0e62465cd8700000000
36
- ).join
38
+ ].join
37
39
  end
38
40
  let!(:prev_tx_hex) do
39
- %w(
41
+ %w[
40
42
  0100000001463e1b35f72a4e978f2b7fb82f95823e90e4f50b30
41
43
  a1372f92fee0694fc92159020000006a47304402202f5b00e3fc
42
44
  0879488196c394283245f8f6d4b310b61fd14cc4bc38dbb2fb7e
@@ -47,23 +49,23 @@ describe Coloredcoins::MultisigTx do
47
49
  65cd8710270000000000001976a914c854b52234e57ac254ae35
48
50
  ef6b3dd7ead98ce14288ac9cc71200000000001976a914eed95b
49
51
  73ccde2019ef1da4c6e9b4062c5cda881988ac00000000
50
- ).join
52
+ ].join
51
53
  end
52
54
  let!(:prev_tx) { Bitcoin::P::Tx.new([prev_tx_hex].pack('H*')) }
53
55
  let!(:priv_keys) do
54
- %w(
56
+ %w[
55
57
  44159687da678ccc3374cd63a8be34727bb34a9a7ce02e1de0bb2c0a2c0a9ca8
56
58
  7ac707d5cf0198fd10b0aa267367c09feae8cf8cbe008b4b9840c67c3d0af4a1
57
59
  eb3ed894a8ea4f897884a65b9ef8d9f4d1704b9fe88f4133bb0c9d66d6420a7a
58
- )
60
+ ]
59
61
  end
60
62
  # rubocop:disable Metrics/LineLength
61
63
  let!(:pub_keys) do
62
- %w(
64
+ %w[
63
65
  047a130127056525587eac13ad69f23c5e198d596025f65ac33d769e54fa3e3094b7aa4bad47aec9a0b1d487fd2b4f41eed468079de70f4526c721924ac3bfd121
64
66
  0442dbb77ea49ebe546982d2ad1cb0bea3ff3abfe8fb636858295622f8c5cbfd07b5a66e811e5178d8971a5f352299c163258aa6d81b56c980b679f1644b1dfd80
65
67
  0499df3d55d5741a2222d9a5d175e3bbd9124e61b4c7f5830356c0d8082861a0e3c61ee29ec2eaabd693f5f83568dfea0add98b1c3e971b9da7b01ed97ab3b74fb
66
- )
68
+ ]
67
69
  end
68
70
  # rubocop:enable Metrics/LineLength
69
71
  let!(:m) { 2 }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe Coloredcoins do
2
4
  describe '#issue_asset' do
3
5
  it 'should call the API' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simplecov'
2
4
  require 'coveralls'
3
5
  SimpleCov.start do
metadata CHANGED
@@ -1,57 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coloredcoins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genaro Madrid
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2019-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rest-client
14
+ name: bitcoin-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: 0.0.8
20
20
  type: :runtime
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: '1.7'
26
+ version: 0.0.8
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.8'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.8'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bitcoin-ruby
42
+ name: rest-client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.8
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bump
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
59
  - - "~>"
53
60
  - !ruby/object:Gem::Version
54
- version: 0.0.8
61
+ version: '0.5'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.5.3
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '0.5'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.5.3
55
75
  - !ruby/object:Gem::Dependency
56
76
  name: bundler
57
77
  requirement: !ruby/object:Gem::Requirement
@@ -94,40 +114,20 @@ dependencies:
94
114
  - - '='
95
115
  - !ruby/object:Gem::Version
96
116
  version: '3.1'
97
- - !ruby/object:Gem::Dependency
98
- name: bump
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0.5'
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: 0.5.3
107
- type: :development
108
- prerelease: false
109
- version_requirements: !ruby/object:Gem::Requirement
110
- requirements:
111
- - - "~>"
112
- - !ruby/object:Gem::Version
113
- version: '0.5'
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: 0.5.3
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rubocop
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0.36'
123
+ version: '0.49'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '0.36'
130
+ version: '0.49'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: simplecov
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  version: '0'
209
209
  requirements: []
210
210
  rubyforge_project:
211
- rubygems_version: 2.2.2
211
+ rubygems_version: 2.7.6
212
212
  signing_key:
213
213
  specification_version: 4
214
214
  summary: Ruby wrapper for coloredcoins.org