Commit graph

50 commits

Author SHA1 Message Date
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
John C. Vernaleo
96a68227bd Add RpcRawCommand and export ReadResultCommand.
Add new RpcRawCommand to get []byte represtation of reply instead of
btcjson.Result.

Export ReadResultCommand to allow caller of RpcRawCommand to deal with
the reply in the same way RpcCommand does.

Adjust test code to for the above changes.
2013-08-13 09:03:22 -04:00
John C. Vernaleo
da7e872354 Add proper result type for listunspent. 2013-08-09 15:49:31 -04:00
John C. Vernaleo
b28cded23e Add return types for additional commands and bug fixes.
Add return types for serveral additional commands.

Fix required vs. optional arguments for createrawtransaction.

Update tests and test coverage for all changes.
2013-08-09 14:06:45 -04:00
John C. Vernaleo
3b6c9b6d78 Simplify some code and increase test coverage. 2013-07-16 16:05:38 -04:00
John C. Vernaleo
ed7214afda Add types for a few more commands.
Add types for getmininginfo, getrawmempool, stop, and settxfee along
with tests.
2013-07-16 15:49:31 -04:00
John C. Vernaleo
a0dd367cd9 Add a few more commands with known types. 2013-07-12 12:39:12 -04:00
John C. Vernaleo
796df5b105 Tests and typos.
Increase test coverage.

Fix spelling and typos in a comment.

Minor update to todo in README.md
2013-07-12 11:04:00 -04:00
John C. Vernaleo
e3c9ebd26f Add more concrete types.
Add concrete return type for getaddressesbyaccount and make some of
the other command type handeling more explicit in the code.
2013-07-11 10:40:02 -04:00
John C. Vernaleo
39a1be8682 Increase test coverage. 2013-07-11 10:15:27 -04:00
John C. Vernaleo
86f848ddd4 Convert floats to int64.
Following the example of bitcoind and the bitcoin wiki, provide a
function to convert floats (which are returned by the json-rpc server)
to int64 (which is the normal representation for most values involving
bitcoins).
2013-07-08 17:20:41 -04:00
Dave Collins
10542e0573 Optimize and improve credential stripping code.
Since we already have the specific username and password we want to strip
from errors, use a specific search string rather than a generic regular
expression.  This is quite a bit more efficient than using regular
expressions and also has the benefit of being more accurate.

Also, rather than using the added overhead of fmt to convert the error to
a string, just call Error() directly on it to get the string.

Finally, instead of just stripping it, replace it with the literal
string "<username>:<password>" to avoid any possible confusion in the
error messages where it might otherwise appear the url was being
constructed incorrectly.

ok jcv@
2013-06-14 11:32:50 -05:00
John C. Vernaleo
2a475d7299 Need to test for nil before regex. 2013-06-14 11:47:09 -04:00
John C. Vernaleo
21d1240502 Update test_coverage.txt 2013-06-14 11:36:44 -04:00
John C. Vernaleo
2fc8982be5 Add tests for MarshallAndSend function. 2013-05-15 10:08:05 -04:00
John C. Vernaleo
d0d58c54db Initial implementation. 2013-05-13 12:25:41 -04:00