Commit graph

65 commits

Author SHA1 Message Date
John C. Vernaleo
766d571317 Replace common error with defined value. 2014-07-24 10:06:25 -04:00
David Hill
2e0a243383 Support gettxout 2014-07-04 10:46:21 -04:00
Josh Rickmar
93f5aab0db Update test coverage report. 2014-06-11 12:02:35 -05:00
David Hill
39b09f7be1 Add support for estimatefee and estimatepriority. 2014-06-11 11:05:13 -04:00
John C. Vernaleo
92c7716dd4 Update coverage report. 2014-06-10 16:29:56 -04:00
David Hill
529036ec2b Implement getnetworkinfo 2014-05-14 11:45:13 -04:00
David Hill
4f0eb662c8 Support getblockchaininfo 2014-05-12 12:53:34 -04:00
Josh Rickmar
3fd5904859 Always return unparsableCmds when possible.
This change overrides the cmd return value of custom registered
methods to always return an unparsableCmd if the marshaling as a
JSON-RPC request succeeded, but the request was an invalid structure
for the custom method.
2014-04-25 01:04:24 -05:00
Dave Collins
4595c9d90d Add listreceivedbyaccount concrete result.
ok @jcvernaleo.
2014-04-23 15:47:25 -05:00
David Hill
ea7947f74e Add support for decodescript concrete result. 2014-04-12 10:41:32 -04:00
David Hill
372e8c1926 Add support for ListSinceBlockResult
ok @davecgh
2014-04-11 20:17:21 -04:00
Dave Collins
31a354e585 Add support for registering custom reply parsers.
This commit extends the RegisterCustomCmd function to also accept a reply
parser which will be invoked for replies to the custom command via
ReadResultCmd.  This allows replies to custom commands to be returned a
concrete structs instead of map[string]interface{}.

ok @jcvernaleo, @jrick
2014-04-11 14:27:59 -05:00
David Hill
c2dd398b1e Add support for GetTransactionResult.
ok @jcvernaleo
2014-04-11 14:06:44 -04:00
Dave Collins
48bcbc5a22 Move result structs and funcs to jsonresults.go.
This commit moves all of the structs which deal with command results and
related functions to a new file named jsonresults.go.

This is in preparation of allowing custom results to be registered.

ok @jcvernaleo
2014-04-11 11:09:40 -05:00
Dave Collins
3513654933 Add new (Tls)RpcSend funcs to send a Cmd.
The existing RpcCommand and TlsRpcCommand were build with
CreateMessage(WithID) in mind since they return an already marshalled
command.  The approach was changed to use concrete commands created via
the New<command>Cmd family of functions.  However, this means the caller
had to manually marshal the command before calling (Tls)RpcCommand which
was not very user friendly.

This commit adds two new functions named RpcSend and TlsRpcSend which
directly accepts a btcjson.Cmd and handles the marshalling itself.

ok @jcvernaleo
2014-04-11 10:49:49 -05:00
Dave Collins
1ff465ae88 Remove RegisterCustomCmdGenerator.
This is no longer required since the RawCmd params now consist of a slice
of raw JSON messages which the registered parser can directly unmarshal.

ok @jcvernaleo
2014-04-11 09:38:15 -05:00
David Hill
75a237bc0d Add support for GetTransactionResult.
ok @jcvernaleo
2014-04-11 09:39:08 -04:00
Dave Collins
016e69cd51 Convert RawCmd to use raw messages for params.
This commit modifies the RawCmd type to use a slice of json.RawMessages so
that unmarshalling each individual parameter can be deferred to the
handler for the command.

This is superior to the old method of using a []interface{} because it
means that each parameter is now unmarshalled into the expected concrete
type directly instead of whatever it happens to be in the JSON.  Due to
this, the old behavior where every number was unmarshlled as a float64 and
converted to the appropriate final type, which could lead to odd behavior
when going through marshal/unmarshal cycles, has been eliminated.  This
change also means each individual parameter can now be full blown structs
(JSON objects) that marshal and unmarshal themselves which greatly
simplifies complex parameters and removes the need for additional and
error prone code.

This commit contains a lot of changes because every command needed its
MarshalJSON and UnmarshalJSON methods updated to support the new
mechanism.  As a part of changing these functions, a new common creation
function for the the RawCmd struct was added to avoid the previous
duplication of the common fields.  Also, rather than repeating the method
string in each MarshJSON functon, it makes use of cmd.Method().

Finally, some of the error messages were incorrect and have been corrected
as well as made consistent.

ok @jcvernaleo, @jrick, @owainga
2014-04-10 20:59:46 -05:00
David Hill
50473f6ed3 Add support for CreateMultiSigResult.
ok @jcvernaleo
2014-04-09 13:45:55 -04:00
Dave Collins
dd926bfdf9 Add support for ListTransactionsResult.
ok @jcvernaleo.
2014-04-09 09:07:53 -05:00
Dave Collins
7c39a02ed1 Correct ReadResultCmd for getaddednodeinfo.
The returned result was previously a []interface{} instead of a
[]GetAddedNodeInfoResult.  This commit resolves that issue.

ok @jcvernaleo
2014-04-08 07:57:31 -05:00
John C. Vernaleo
71e31f03a2 Update coverage report. 2014-03-16 14:18:43 -04:00
Owain G. Ainsworth
3c1bcb86ee add newsize parameter to keypoolrefill 2014-01-22 16:20:08 +00:00
Owain G. Ainsworth
99fdcf5d09 Add allowhighfees to SendRawTransactionCmd 2014-01-22 16:20:08 +00:00
Owain G. Ainsworth
5619604c21 Add addresses member to ListUnspentCmd 2014-01-22 16:20:08 +00:00
John C. Vernaleo
6747e36f51 Slight increase in test coverage. 2014-01-08 10:31:54 -05:00
John C. Vernaleo
d1efe0c109 Add SetId() to Cmd along with tests. 2014-01-08 09:36:43 -05:00
John C. Vernaleo
ee378dc0c0 Add additional tests for listreceivedbyaccount.
Fix bug caught by tests.
2014-01-07 13:49:45 -05:00
John C. Vernaleo
cea1120a0a Add tests for listreceivebyaddress.
Fix bug with minconf type caught by test (thanks oga).
2014-01-07 13:44:12 -05:00
John C. Vernaleo
5ced990c22 Add test for listsinceblock.
Fix bug in listsinceblock found by test.
2014-01-06 11:02:32 -05:00
John C. Vernaleo
0ef1452247 Improve test coverage a bit.
Fix bug in a json command caught by new test.
2014-01-06 10:40:23 -05:00
John C. Vernaleo
258e9ef4c6 Add test for the Cmd.Id() functions. 2014-01-03 17:50:17 -05:00
John C. Vernaleo
2944ccb86b Update coverage report. 2014-01-03 12:02:41 -05:00
John C. Vernaleo
1f52db626d Update test coverage. 2013-12-11 13:43:18 -05:00
Josh Rickmar
6325bd9df2 Update test coverage file. 2013-11-27 19:30:13 -05:00
Josh Rickmar
97a4ab6a47 Update test coverage file. 2013-11-26 16:12:54 -05:00
Dave Collins
a645c36f45 Add new extension command named debuglevel.
ok @jcvernaleo.
2013-11-22 10:16:45 -06:00
John C. Vernaleo
94e74e7cc7 Increase test coverage for Cmd. 2013-11-12 16:33:58 -05:00
John C. Vernaleo
d341468b87 Add a test that was missed. 2013-11-12 12:49:22 -05:00
John C. Vernaleo
815a0b0a84 Improve test coverage. 2013-11-01 15:27:17 -04:00
John C. Vernaleo
3f33e419a9 Improve test coverage and fix bug found by tests.
Spell receive the same way all the time so things work.
2013-10-31 14:51:35 -04:00
John C. Vernaleo
e1dd773e7c Improve test coverage and fix some bugs found by tests.
Fix move need to convert amount to btc from satoshi

Fix settxfee need to convert amount to btc from satoshi

Fix for optional arg off by one in move.

Fix for gettxout in optional args along with typo in error message.

And lots of new tests.
2013-10-30 17:22:56 -04:00
John C. Vernaleo
07de6ea013 Add additional tests for jsoncmd code.
Test stop, signrawtransaction, setaccount, sendtoaddress, and a few
others.

Fix off by one error in the optional arguments for sendtoaddress.

Rename occurances of Minconf to MinConf for constitancy.
2013-10-30 08:29:59 -04:00
Owain G. Ainsworth
e396121192 More info commands. 2013-10-25 20:02:13 +01:00
Owain G. Ainsworth
0daf04f9bd More get commands. 2013-10-25 19:42:25 +01:00
John C. Vernaleo
00382bed8d Adding to tests.
Fix typo in a test name.

Update coverage report.
2013-10-25 14:16:29 -04:00
John C. Vernaleo
5444d262b8 Fix for signrawtransaction.
Add sendrawtransaction to list of commands we know the return type
for.
2013-10-04 13:18:49 -04:00
John C. Vernaleo
dc9618c9ab Add a Error() to the Error struct.
Resolves #6
2013-10-01 12:50:50 -04:00
John C. Vernaleo
5d40d51672 Correct bug in walletpassphrase arguements.
Thanks to pureveg and hngchiming for pointing it out.
2013-08-14 10:15:16 -04:00
John C. Vernaleo
2e77f0bb0e Add CreateMessageWithId to allow custom id to be sent with message. 2013-08-13 14:39:56 -04:00