dogecoin-client 0.0.3 → 0.0.4

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
2
  SHA1:
3
- metadata.gz: ed8a191e38c223a2ad66b5743b0a436ce9686775
4
- data.tar.gz: b07d1916800f7c3b8c3b342bc0346b1b5a88fcb6
3
+ metadata.gz: 9cdcc80fe7013ecbcf38fcd0d5c9d4045eb437b9
4
+ data.tar.gz: 3e3cc023e7cdd97d5702dffb4d00503b48f2dd1f
5
5
  SHA512:
6
- metadata.gz: 8c00236aa985180ee251ad90d5588f2a2e2452bd1eeeefda522b792ef77403ea56a60cf79231394b30e1a2ba5ce2a08fb06f9460a7a73516691393af4894b355
7
- data.tar.gz: 37f5fedd23d786e170d018c01026feeb772c3979b2b065f59712b38042441631c544e7f1996f39875068ca64383e7a85762f16fd32f4a91936a2326fa5890c62
6
+ metadata.gz: ac2fefbff407253ada3259fb9f4e34ad948efdeb066e39861fc3fd593f94bbed5d34714e1887d9975af5def36b4d93c31667a8ab774591f67bff5901aecbcf56
7
+ data.tar.gz: eb76816eb08a5c00d951781dfc0ab5cc9098f3a90a038082410f8d725dceb137bfbf3985ae6cca734d0778f6a1872ad30eeaaa1437815e48392942e9b7d46c69
@@ -64,6 +64,11 @@ class Dogecoin::Client
64
64
  @api.request 'getblockcount'
65
65
  end
66
66
 
67
+ # Sets the default transaction fee
68
+ def settxfee(amount)
69
+ @api.request 'settxfee', amount
70
+ end
71
+
67
72
  # Returns the block number of the latest block in the longest block chain.
68
73
  def getblocknumber
69
74
  @api.request 'getblocknumber'
@@ -89,11 +94,11 @@ class Dogecoin::Client
89
94
  @api.request 'gethashespersec'
90
95
  end
91
96
 
92
- # Returns the hash given a block id
97
+ # Returns the hash given a block id
93
98
  def getblockhash(idx)
94
99
  @api.request 'getblockhash', idx
95
100
  end
96
-
101
+
97
102
  # Returns the hash of the best (tip) block in the longest block chain.
98
103
  def getbestblockhash
99
104
  @api.request 'getbestblockhash'
data/lib/dogecoin/dsl.rb CHANGED
@@ -6,84 +6,84 @@ module Dogecoin::DSL
6
6
  @client ||= Dogecoin::Client.new(nil, nil)
7
7
  end
8
8
  end
9
-
9
+
10
10
  def username=(value)
11
11
  dogecoin.user = value
12
12
  end
13
-
13
+
14
14
  def password=(value)
15
15
  dogecoin.pass = value
16
16
  end
17
-
17
+
18
18
  def host=(value)
19
19
  dogecoin.host = value
20
20
  end
21
-
21
+
22
22
  def port=(value)
23
23
  dogecoin.port = value
24
24
  end
25
-
25
+
26
26
  def ssl=(value)
27
27
  dogecoin.ssl = value
28
28
  end
29
-
29
+
30
30
  def username(value = nil)
31
31
  value ? dogecoin.user = value : dogecoin.user
32
32
  end
33
-
33
+
34
34
  def password(value = nil)
35
35
  value ? dogecoin.pass = value : dogecoin.pass
36
36
  end
37
-
37
+
38
38
  def host(value = nil)
39
39
  value ? dogecoin.host = value : dogecoin.host
40
40
  end
41
-
41
+
42
42
  def port(value = nil)
43
43
  value ? dogecoin.port = value : dogecoin.port
44
44
  end
45
-
45
+
46
46
  def ssl(value = nil)
47
47
  value.nil? ? dogecoin.ssl : dogecoin.ssl = value
48
48
  end
49
-
49
+
50
50
  def ssl?
51
51
  dogecoin.ssl?
52
52
  end
53
-
54
-
55
- # Safely copies wallet.dat to destination, which can be a directory or a path with filename.
53
+
54
+
55
+ # Safely copies wallet.dat to destination, which can be a directory or a path with filename.
56
56
  def backupwallet(destination)
57
57
  dogecoin.backupwallet destination
58
58
  end
59
-
60
- # Returns the account associated with the given address.
59
+
60
+ # Returns the account associated with the given address.
61
61
  def getaccount(dogecoinaddress)
62
62
  dogecoin.getaccount dogecoinaddress
63
63
  end
64
-
65
- # Returns the current dogecoin address for receiving payments to this account.
64
+
65
+ # Returns the current dogecoin address for receiving payments to this account.
66
66
  def getaccountaddress(account)
67
67
  dogecoin.getaccountaddress account
68
68
  end
69
-
70
- # Returns the list of addresses for the given account.
69
+
70
+ # Returns the list of addresses for the given account.
71
71
  def getaddressesbyaccount(account)
72
72
  dogecoin.getaddressesbyaccount account
73
73
  end
74
-
74
+
75
75
  # If +account+ is not specified, returns the server's total available balance.
76
76
  # If +account+ is specified, returns the balance in the account.
77
77
  def getbalance(account = nil, minconf = 1)
78
78
  dogecoin.getbalance account, minconf
79
79
  end
80
-
80
+
81
81
  # Dumps the block existing at specified height.
82
82
  # Note: this is not available in the official release
83
83
  def getblockbycount(height)
84
84
  dogecoin.getblockbycount height
85
85
  end
86
-
86
+
87
87
  # Dumps the block existing with specified hash.
88
88
  def getblock(hash)
89
89
  dogecoin.getblock hash
@@ -93,33 +93,33 @@ module Dogecoin::DSL
93
93
  def getblockcount
94
94
  dogecoin.getblockcount
95
95
  end
96
-
97
- # Returns the block number of the latest block in the longest block chain.
96
+
97
+ # Returns the block number of the latest block in the longest block chain.
98
98
  def getblocknumber
99
99
  dogecoin.getblocknumber
100
100
  end
101
-
101
+
102
102
  # Returns the number of connections to other nodes.
103
103
  def getconnectioncount
104
104
  dogecoin.getconnectioncount
105
105
  end
106
-
107
- # Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
106
+
107
+ # Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
108
108
  def getdifficulty
109
109
  dogecoin.getdifficulty
110
110
  end
111
-
112
- # Returns true or false whether dogecoind is currently generating hashes
111
+
112
+ # Returns true or false whether dogecoind is currently generating hashes
113
113
  def getgenerate
114
114
  dogecoin.getgenerate
115
115
  end
116
-
117
- # Returns a recent hashes per second performance measurement while generating.
116
+
117
+ # Returns a recent hashes per second performance measurement while generating.
118
118
  def gethashespersec
119
119
  dogecoin.gethashespersec
120
120
  end
121
121
 
122
- # Returns an object containing various state info.
122
+ # Returns an object containing various state info.
123
123
  def getinfo
124
124
  dogecoin.getinfo
125
125
  end
@@ -134,47 +134,47 @@ module Dogecoin::DSL
134
134
  def getnewaddress(account = nil)
135
135
  dogecoin.getnewaddress account
136
136
  end
137
-
137
+
138
138
  # Returns the total amount received by addresses with +account+ in transactions
139
- # with at least +minconf+ confirmations.
139
+ # with at least +minconf+ confirmations.
140
140
  def getreceivedbyaccount(account, minconf = 1)
141
141
  dogecoin.getreceivedbyaccount account, minconf
142
142
  end
143
-
144
- # Returns the total amount received by +dogecoinaddress+ in transactions with at least +minconf+ confirmations.
143
+
144
+ # Returns the total amount received by +dogecoinaddress+ in transactions with at least +minconf+ confirmations.
145
145
  def getreceivedbyaddress(dogecoinaddress, minconf = 1)
146
146
  dogecoin.getreceivedbyaddress dogecoinaddress, minconf
147
147
  end
148
-
149
- # Get detailed information about +txid+
148
+
149
+ # Get detailed information about +txid+
150
150
  def gettransaction(txid)
151
151
  dogecoin.gettransaction txid
152
152
  end
153
-
153
+
154
154
  # If +data+ is not specified, returns formatted hash data to work on:
155
155
  #
156
156
  # :midstate => precomputed hash state after hashing the first half of the data
157
157
  # :data => block data
158
158
  # :hash1 => formatted hash buffer for second hash
159
- # :target => little endian hash target
159
+ # :target => little endian hash target
160
160
  #
161
161
  # If +data+ is specified, tries to solve the block and returns true if it was successful.
162
162
  def getwork(data = nil)
163
163
  dogecoin.getwork data
164
164
  end
165
-
166
- # List commands, or get help for a command.
165
+
166
+ # List commands, or get help for a command.
167
167
  def help(command = nil)
168
168
  dogecoin.help command
169
169
  end
170
-
171
- # Returns Object that has account names as keys, account balances as values.
170
+
171
+ # Returns Object that has account names as keys, account balances as values.
172
172
  def listaccounts(minconf = 1)
173
173
  dogecoin.listaccounts minconf
174
174
  end
175
-
175
+
176
176
  # Returns an array of objects containing:
177
- #
177
+ #
178
178
  # :account => the account of the receiving addresses
179
179
  # :amount => total amount received by addresses with this account
180
180
  # :confirmations => number of confirmations of the most recent transaction included
@@ -182,60 +182,65 @@ module Dogecoin::DSL
182
182
  def listreceivedbyaccount(minconf = 1, includeempty = false)
183
183
  dogecoin.listreceivedbyaccount minconf, includeempty
184
184
  end
185
-
185
+
186
186
  # Returns an array of objects containing:
187
- #
187
+ #
188
188
  # :address => receiving address
189
189
  # :account => the account of the receiving address
190
190
  # :amount => total amount received by the address
191
- # :confirmations => number of confirmations of the most recent transaction included
192
- #
191
+ # :confirmations => number of confirmations of the most recent transaction included
192
+ #
193
193
  # To get a list of accounts on the system, execute dogecoind listreceivedbyaddress 0 true
194
194
  def listreceivedbyaddress(minconf = 1, includeempty = false)
195
195
  dogecoin.listreceivedbyaddress minconf, includeempty
196
196
  end
197
-
198
- # Returns up to +count+ most recent transactions for account +account+.
197
+
198
+ # Returns up to +count+ most recent transactions for account +account+.
199
199
  def listtransactions(account, count = 10)
200
200
  dogecoin.listtransactions account, count
201
201
  end
202
-
203
- # Move from one account in your wallet to another.
202
+
203
+ # Move from one account in your wallet to another.
204
204
  def move(fromaccount, toaccount, amount, minconf = 1, comment = nil)
205
205
  dogecoin.move fromaccount, toaccount, amount, minconf, comment
206
206
  end
207
-
208
- # +amount+ is a real and is rounded to 8 decimal places. Returns the transaction ID if successful.
207
+
208
+ # +amount+ is a real and is rounded to 8 decimal places. Returns the transaction ID if successful.
209
209
  def sendfrom(fromaccount, todogecoinaddress, amount, minconf = 1, comment = nil, comment_to = nil)
210
210
  dogecoin.sendfrom fromaccount, todogecoinaddress, amount, minconf, comment, comment_to
211
211
  end
212
-
213
- # +amount+ is a real and is rounded to 8 decimal places
212
+
213
+ # +amount+ is a real and is rounded to 8 decimal places
214
214
  def sendtoaddress(dogecoinaddress, amount, comment = nil, comment_to = nil)
215
215
  dogecoin.sendtoaddress dogecoinaddress, amount, comment, comment_to
216
216
  end
217
-
218
- # Sets the account associated with the given address.
217
+
218
+ #
219
+ def settxfee(amount = 0.0001)
220
+ dogecoin.settxfee(amount)
221
+ end
222
+
223
+ # Sets the account associated with the given address.
219
224
  def setaccount(dogecoinaddress, account)
220
225
  dogecoin.setaccount dogecoinaddress, account
221
226
  end
222
-
227
+
223
228
  # +generate+ is true or false to turn generation on or off.
224
229
  # Generation is limited to +genproclimit+ processors, -1 is unlimited.
225
230
  def setgenerate(generate, genproclimit = -1)
226
231
  dogecoin.setgenerate generate, genproclimit
227
232
  end
228
-
229
- # Stop dogecoin server.
233
+
234
+ # Stop dogecoin server.
230
235
  def stop
231
236
  dogecoin.stop
232
237
  end
233
-
234
- # Return information about +dogecoinaddress+.
238
+
239
+ # Return information about +dogecoinaddress+.
235
240
  def validateaddress(dogecoinaddress)
236
241
  dogecoin.validateaddress
237
242
  end
238
-
243
+
239
244
  alias account getaccount
240
245
  alias account_address getaccountaddress
241
246
  alias addresses_by_account getaddressesbyaccount
@@ -2,11 +2,11 @@ module Dogecoin
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 3
5
+ PATCH = 4
6
6
  REL = nil
7
-
7
+
8
8
  STRING = REL ? [MAJOR, MINOR, PATCH, REL].join('.') : [MAJOR, MINOR, PATCH].join('.')
9
9
  end
10
-
10
+
11
11
  VERSION = Version::STRING
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dogecoin-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Eufemio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-01 00:00:00.000000000 Z
11
+ date: 2014-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -170,4 +170,34 @@ rubygems_version: 2.2.2
170
170
  signing_key:
171
171
  specification_version: 4
172
172
  summary: Provides a Ruby library to the complete Dogecoin JSON-RPC API.
173
- test_files: []
173
+ test_files:
174
+ - spec/fixtures/backupwallet_without_params.json
175
+ - spec/fixtures/build_fixture.rb
176
+ - spec/fixtures/getbalance.json
177
+ - spec/fixtures/getbestblockhash.json
178
+ - spec/fixtures/getblock.json
179
+ - spec/fixtures/getblockcount.json
180
+ - spec/fixtures/getblockhash.json
181
+ - spec/fixtures/getblocknumber.json
182
+ - spec/fixtures/getconnectioncount.json
183
+ - spec/fixtures/getdifficulty.json
184
+ - spec/fixtures/getgenerate.json
185
+ - spec/fixtures/gethashespersec.json
186
+ - spec/fixtures/getinfo.json
187
+ - spec/fixtures/getmininginfo.json
188
+ - spec/fixtures/help.json
189
+ - spec/fixtures/listreceivedbyaddress_with_minconf_0.json
190
+ - spec/fixtures/listreceivedbyaddress_with_minconf_0_and_includeempty_true.json
191
+ - spec/fixtures/listreceivedbyaddress_without_params.json
192
+ - spec/fixtures/setaccount.json
193
+ - spec/fixtures/signmessage_invalid_address.json
194
+ - spec/fixtures/signmessage_success.json
195
+ - spec/fixtures/verifymessage_failure.json
196
+ - spec/fixtures/verifymessage_success.json
197
+ - spec/lib/dogecoin/api_spec.rb
198
+ - spec/lib/dogecoin/client_spec.rb
199
+ - spec/lib/dogecoin/request_spec.rb
200
+ - spec/lib/dogecoin_spec.rb
201
+ - spec/spec_helper.rb
202
+ - spec/support/fixtures_helper.rb
203
+ - spec/support/rpc_service_helper.rb