counterparty_client 0.1.1
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +1 -0
- data/counterparty_client.gemspec +25 -0
- data/lib/counterparty_client.rb +5 -0
- data/lib/counterparty_client/counterparty_rpc.rb +31 -0
- data/lib/counterparty_client/version.rb +3 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2be8679132c71bbd96f86362568fd9dd807227a6
|
4
|
+
data.tar.gz: 74dfd00978c2fb48ddaa7ad865201fa9f92becd2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a8ff0a24d2a07e716b0be0abb2f70dc7acdc4ef4f0f79a8cdcea473c1b3657383d0834fc232e0e152557af7296429e614c355d7d040a9c0c45139fa54b23f5fa
|
7
|
+
data.tar.gz: 373fcd7de3f368eef3351159bac3f4adb8138234e177552c4e33faf17400fb6bbba514bbdbd3350a9d45e02c91fd61ddd4bdd065fa2b1d7d0b59b2dfaaf4e80b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Bart Koopmans
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# CounterpartyClient
|
2
|
+
|
3
|
+
client for counterparty.
|
4
|
+
|
5
|
+
It includes:
|
6
|
+
|
7
|
+
- Counterparty RPC
|
8
|
+
|
9
|
+
Todo:
|
10
|
+
|
11
|
+
- Other userfull counterparty tools, ideas?
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
$ gem install counterparty_client
|
16
|
+
|
17
|
+
or
|
18
|
+
|
19
|
+
$ rake build
|
20
|
+
$ gem install pkg/counterparty_client-X.X.X.gem
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Example for the RPC:
|
25
|
+
|
26
|
+
```
|
27
|
+
require 'counterparty_client'
|
28
|
+
|
29
|
+
cp = CounterpartyRPC.new('http://rpc:1234@public.coindaddy.io:4000')
|
30
|
+
p cp.get_running_info # this outputs counterparty running info
|
31
|
+
p cp.get_supply('asset' => 'XCP') # 262582873057850
|
32
|
+
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
1. Fork it
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
+
5. Create new Pull Request
|
41
|
+
|
42
|
+
If someone has some suggestions for this gem let me know.
|
43
|
+
|
44
|
+
## Donations
|
45
|
+
|
46
|
+
Bitcoin address : 136aHpRdd7eezbEusAKS2GyWx9eXZsEuMz
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'counterparty_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "counterparty_client"
|
8
|
+
spec.version = CounterpartyClient::VERSION
|
9
|
+
spec.authors = ["Yuma Wakimoto"]
|
10
|
+
spec.email = ["ywakimoto2s@gmail.com"]
|
11
|
+
spec.description = %q{Counterparty client for ruby}
|
12
|
+
spec.summary = %q{This gem provides counterparty client}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
spec.homepage = 'https://github.com/yuma300/counterparty_client'
|
25
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
class CounterpartyRPC
|
6
|
+
def initialize(service_url)
|
7
|
+
@uri = URI.parse(service_url)
|
8
|
+
end
|
9
|
+
|
10
|
+
def method_missing(name, *args)
|
11
|
+
args = args.nil? ? nil : args.first
|
12
|
+
post_body = { 'method' => name, 'params' => args, 'jsonrpc' => '2.0', 'id' => '0' }.to_json
|
13
|
+
resp = JSON.parse( http_post_request(post_body) )
|
14
|
+
raise JSONRPCError, resp['error'] if resp['error']
|
15
|
+
resp['result']
|
16
|
+
end
|
17
|
+
|
18
|
+
def http_post_request(post_body)
|
19
|
+
http = Net::HTTP.new(@uri.host, @uri.port)
|
20
|
+
http = http.start
|
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
|
+
ret = http.request(request).body
|
26
|
+
http.finish
|
27
|
+
return ret
|
28
|
+
end
|
29
|
+
|
30
|
+
class JSONRPCError < RuntimeError; end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: counterparty_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuma Wakimoto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
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
|
+
description: Counterparty client for ruby
|
42
|
+
email:
|
43
|
+
- ywakimoto2s@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- counterparty_client.gemspec
|
54
|
+
- lib/counterparty_client.rb
|
55
|
+
- lib/counterparty_client/counterparty_rpc.rb
|
56
|
+
- lib/counterparty_client/version.rb
|
57
|
+
homepage: https://github.com/yuma300/counterparty_client
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.5.1
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: This gem provides counterparty client
|
81
|
+
test_files: []
|