bcoin-client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,52 @@
1
+ require "bcoin/client/collection"
2
+ require "bcoin/client/wallet"
3
+
4
+ module Bcoin
5
+ class Client
6
+ class Wallets < Collection
7
+
8
+ attr_reader :client
9
+
10
+ # The base path for the wallets collection must be
11
+ # set to '/' since the bcoin API breaks from the
12
+ # RESTful standard for the retrieval of the wallet
13
+ # collection. The list of wallets is located at
14
+ # '/wallets/_admin/wallets'. The base path for all
15
+ # other wallet operations is the expected '/wallet'.
16
+ def base_path
17
+ '/'
18
+ end
19
+
20
+ def refresh!
21
+ # Preceeding slash in the GET operation intentionally omitted
22
+ # due to wonkiness with the wallets base path. See the
23
+ # Wallets#base_path comment above.
24
+ @collection = super('wallet/_admin/wallets').collect { |w|
25
+ Wallet.new(client, id: w).refresh!
26
+ }
27
+ self
28
+ end
29
+
30
+ def find attr
31
+ Wallet.new(client, attr).refresh!
32
+ end
33
+
34
+ # Create a new Wallet.
35
+ # @params [Hash] opts The options for creating the wallet.
36
+ # @option opts [String] :id The ID for the new wallet.
37
+ # @option opts [String] :type The type for the wallet.
38
+ # :pubkeyhash, :witness etc...
39
+ # @options opts [String] :mnemonic The wallet mnemonic.
40
+ # @return [Bcoin::Client::Wallet] The new wallet object.
41
+ def create options = {}
42
+ # The path in this post operation intentionally omits
43
+ # the preceeding slash due to wonkiness with the wallets
44
+ # base path breaking standards. See Wallets#base_path
45
+ # comment above.
46
+ response = post 'wallet/', options
47
+ Wallet.new(client, response)
48
+ end
49
+
50
+ end
51
+ end
52
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bcoin-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dan Knox
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-08-24 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.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.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: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.10'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.10'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-doc
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.11'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.11'
97
+ - !ruby/object:Gem::Dependency
98
+ name: httparty
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.15'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.15'
111
+ description: Client for the bcoin.io bitcoin node including their wallet API.
112
+ email:
113
+ - dknox@threedotloft.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".env"
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".travis.yml"
122
+ - CODE_OF_CONDUCT.md
123
+ - Gemfile
124
+ - Guardfile
125
+ - LICENSE.txt
126
+ - README.md
127
+ - Rakefile
128
+ - bcoin-client.gemspec
129
+ - bin/console
130
+ - bin/setup
131
+ - config/Guardfile
132
+ - config/containers/bcoin/Dockerfile
133
+ - config/containers/bcoin/bcoin.conf
134
+ - config/containers/bcoin/package-lock.json
135
+ - config/containers/bcoin/package.json
136
+ - config/containers/ruby/Dockerfile
137
+ - docker-compose.yml
138
+ - lib/bcoin/client.rb
139
+ - lib/bcoin/client/account.rb
140
+ - lib/bcoin/client/accounts.rb
141
+ - lib/bcoin/client/balance.rb
142
+ - lib/bcoin/client/base.rb
143
+ - lib/bcoin/client/collection.rb
144
+ - lib/bcoin/client/http_methods.rb
145
+ - lib/bcoin/client/master.rb
146
+ - lib/bcoin/client/version.rb
147
+ - lib/bcoin/client/wallet.rb
148
+ - lib/bcoin/client/wallets.rb
149
+ homepage: http://github.com/DanKnox-BitFS/bcoin-ruby
150
+ licenses:
151
+ - MIT
152
+ metadata:
153
+ allowed_push_host: https://rubygems.org
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.6.11
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Client for the bcoin.io bitcoin node.
174
+ test_files: []