cleanrpc 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6ba622121edbc58080996cb465fd9330b4c1dbc39aa75f2c89b27c247f8634d6
4
+ data.tar.gz: b3e8099b5e4b43fb9c46c307b3797e9cd3639d6957a0553075ab1fa925c9c31b
5
+ SHA512:
6
+ metadata.gz: fdbe9aab358f4cfbdb61d2ba0c6bdafd13e0aba218f5981846c64792aca3721a78faf1d46023e1744a6dec867ec8200c6345242935af06121dc35e191c74bc7f
7
+ data.tar.gz: 9299ba65e748b885ea0f5862901e71ee3eb1abe97f4b847cdb2327c4d4e2aa628b077edd1a3ab11f74d43f05674f192bc9818ddb894b227615467751be0682fe
data/.rspec_status ADDED
@@ -0,0 +1,3 @@
1
+ example_id | status | run_time |
2
+ ---------------------------- | ------ | --------------- |
3
+ ./spec/cleanrpc_spec.rb[1:1] | passed | 0.00116 seconds |
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'rake', '~> 13.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,93 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cleanrpc (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ansi (1.5.0)
10
+ ast (2.4.2)
11
+ coderay (1.1.3)
12
+ diff-lcs (1.5.0)
13
+ docile (1.4.0)
14
+ json (2.6.3)
15
+ language_server-protocol (3.17.0.3)
16
+ method_source (1.0.0)
17
+ parallel (1.23.0)
18
+ parser (3.2.2.4)
19
+ ast (~> 2.4.1)
20
+ racc
21
+ pry (0.14.2)
22
+ coderay (~> 1.1)
23
+ method_source (~> 1.0)
24
+ racc (1.7.3)
25
+ rainbow (3.1.1)
26
+ rake (13.1.0)
27
+ regexp_parser (2.8.2)
28
+ rexml (3.2.6)
29
+ rspec (3.12.0)
30
+ rspec-core (~> 3.12.0)
31
+ rspec-expectations (~> 3.12.0)
32
+ rspec-mocks (~> 3.12.0)
33
+ rspec-core (3.12.2)
34
+ rspec-support (~> 3.12.0)
35
+ rspec-expectations (3.12.3)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.12.0)
38
+ rspec-mocks (3.12.6)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.12.0)
41
+ rspec-support (3.12.1)
42
+ rubocop (1.57.2)
43
+ json (~> 2.3)
44
+ language_server-protocol (>= 3.17.0)
45
+ parallel (~> 1.10)
46
+ parser (>= 3.2.2.4)
47
+ rainbow (>= 2.2.2, < 4.0)
48
+ regexp_parser (>= 1.8, < 3.0)
49
+ rexml (>= 3.2.5, < 4.0)
50
+ rubocop-ast (>= 1.28.1, < 2.0)
51
+ ruby-progressbar (~> 1.7)
52
+ unicode-display_width (>= 2.4.0, < 3.0)
53
+ rubocop-ast (1.30.0)
54
+ parser (>= 3.2.1.0)
55
+ rubocop-capybara (2.19.0)
56
+ rubocop (~> 1.41)
57
+ rubocop-factory_bot (2.24.0)
58
+ rubocop (~> 1.33)
59
+ rubocop-rspec (2.25.0)
60
+ rubocop (~> 1.40)
61
+ rubocop-capybara (~> 2.17)
62
+ rubocop-factory_bot (~> 2.22)
63
+ ruby-progressbar (1.13.0)
64
+ simplecov (0.22.0)
65
+ docile (~> 1.1)
66
+ simplecov-html (~> 0.11)
67
+ simplecov_json_formatter (~> 0.1)
68
+ simplecov-console (0.9.1)
69
+ ansi
70
+ simplecov
71
+ terminal-table
72
+ simplecov-html (0.12.3)
73
+ simplecov_json_formatter (0.1.4)
74
+ terminal-table (3.0.2)
75
+ unicode-display_width (>= 1.1.1, < 3)
76
+ unicode-display_width (2.5.0)
77
+
78
+ PLATFORMS
79
+ x86_64-darwin-20
80
+ x86_64-darwin-21
81
+
82
+ DEPENDENCIES
83
+ cleanrpc!
84
+ pry
85
+ rake (~> 13.0)
86
+ rspec
87
+ rubocop
88
+ rubocop-rspec
89
+ simplecov
90
+ simplecov-console
91
+
92
+ BUNDLED WITH
93
+ 2.3.7
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Carolina-Bitcoin-Project
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Cleanrpc
2
+
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'cleanrpc'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle install
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install cleanrpc
19
+
20
+ ## Usage
21
+
22
+ ## Development
23
+
24
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
25
+
26
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
27
+
28
+ ```
29
+ rake build # Build cleanrpc-0.0.1.gem i...
30
+ rake build:checksum # Generate SHA512 checksum i...
31
+ rake clean # Remove any temporary products
32
+ rake clobber # Remove any generated files
33
+ rake install # Build and install cleanrpc...
34
+ rake install:local # Build and install cleanrpc...
35
+ rake release[remote] # Create tag v0.0.1 and buil...
36
+ rake rubocop # Run RuboCop
37
+ rake rubocop:autocorrect # Autocorrect RuboCop offens...
38
+ rake rubocop:autocorrect_all # Autocorrect RuboCop offens...
39
+ rake spec # Run RSpec code examples
40
+ ```
41
+
42
+ ## Contributing
43
+
44
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Carolina-Bitcoin-Project/UTXOracle.
45
+
46
+ ## License
47
+
48
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rubocop/rake_task'
5
+ require 'rspec/core/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new(:rubocop) do |t|
9
+ t.options = ['--display-cop-names']
10
+ end
11
+
12
+ task default: %i[]
data/cleanrpc.gemspec ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/cleanrpc/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'cleanrpc'
7
+ spec.version = Cleanrpc::VERSION
8
+ spec.authors = ['Keith Gardner']
9
+
10
+ spec.summary = 'Zero-dependency RPC for Bitcoin Core in Ruby.'
11
+ spec.homepage = 'https://github.com/Carolina-Bitcoin-Project/cleanrpc'
12
+ spec.required_ruby_version = '>= 2.6.0'
13
+
14
+ spec.metadata['homepage_uri'] = spec.homepage
15
+ spec.metadata['source_code_uri'] = 'https://github.com/Carolina-Bitcoin-Project/cleanrpc'
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject do |f|
21
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
22
+ end
23
+ end
24
+ spec.bindir = 'exe'
25
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_development_dependency 'pry'
29
+ spec.add_development_dependency 'rake'
30
+ spec.add_development_dependency 'rspec'
31
+ spec.add_development_dependency 'rubocop'
32
+ spec.add_development_dependency 'rubocop-rspec'
33
+ spec.add_development_dependency 'simplecov'
34
+ spec.add_development_dependency 'simplecov-console'
35
+ end
@@ -0,0 +1,30 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'json'
4
+
5
+ module Cleanrpc
6
+ class Rpc
7
+ def initialize(service_url)
8
+ @uri = URI.parse(service_url)
9
+ end
10
+
11
+ def method_missing(name, *args)
12
+ post_body = { 'method' => name, 'params' => args, 'id' => 'jsonrpc' }.to_json
13
+ resp = JSON.parse(http_post_request(post_body))
14
+ raise JSONRPCError, resp['error'] if resp['error']
15
+
16
+ resp['result']
17
+ end
18
+
19
+ def http_post_request(post_body)
20
+ http = Net::HTTP.new(@uri.host, @uri.port)
21
+ request = Net::HTTP::Post.new(@uri.request_uri)
22
+ request.basic_auth @uri.user, @uri.password
23
+ request.content_type = 'application/json'
24
+ request.body = post_body
25
+ http.request(request).body
26
+ end
27
+
28
+ class JSONRPCError < RuntimeError; end
29
+ end
30
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cleanrpc
4
+ VERSION = '0.0.1'
5
+ end
data/lib/cleanrpc.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'cleanrpc/version'
4
+ require_relative 'cleanrpc/rpc'
5
+
6
+ module Cleanrpc
7
+ end
data/sig/cleanrpc.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Cleanrpc
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cleanrpc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Keith Gardner
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-11-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
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: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov-console
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description:
112
+ email:
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - ".rspec_status"
118
+ - ".ruby-version"
119
+ - Gemfile
120
+ - Gemfile.lock
121
+ - LICENSE
122
+ - README.md
123
+ - Rakefile
124
+ - cleanrpc.gemspec
125
+ - lib/cleanrpc.rb
126
+ - lib/cleanrpc/rpc.rb
127
+ - lib/cleanrpc/version.rb
128
+ - sig/cleanrpc.rbs
129
+ homepage: https://github.com/Carolina-Bitcoin-Project/cleanrpc
130
+ licenses: []
131
+ metadata:
132
+ homepage_uri: https://github.com/Carolina-Bitcoin-Project/cleanrpc
133
+ source_code_uri: https://github.com/Carolina-Bitcoin-Project/cleanrpc
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: 2.6.0
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubygems_version: 3.4.10
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Zero-dependency RPC for Bitcoin Core in Ruby.
153
+ test_files: []