Commit graph

218 commits

Author SHA1 Message Date
David Hill
4f0eb662c8 Support getblockchaininfo 2014-05-12 12:53:34 -04:00
Josh Rickmar
2e126ef597 Rename ListUnspentResult, use correct integer types. 2014-05-09 15:53:50 -05:00
Dave Collins
b993af04b9 Correct misspelled contributor name. 2014-05-05 22:15:37 -05:00
Dave Collins
67abae0dbf Add CONTRIBUTORS file.
Since the github contributors list only lasts for a period of time, it's
better to also maintain a contributors list in the repository rather than
solely relying on github.
2014-05-05 18:29:31 -05:00
GeertJohan
9965019da0 Return pointers to structs
Update doc.go to use proper btcjson result type

Return pointers to structs

Update doc.go to use proper btcjson result type
2014-05-05 17:18:22 -04:00
John C. Vernaleo
a5169bd880 Remove extraneous character that got added to comment. 2014-05-05 09:08:45 -04:00
Geert-Johan Riemer
94451d7a9c Changed strings.Contains(?, "{") to bytes.IndexOf(?, '{')>-1 2014-05-05 13:28:48 +02:00
GeertJohan
4fb5272063 Return pointer to TxRawResult and use bytes.IndexByte instead of Strings.Contains 2014-05-04 17:12:32 +02:00
Dave Collins
4202bf2e93 Make TestNet field name consistent.
The commit makes the TestNet field in GetMiningInfoResult consistent with
InfoResult.
2014-05-03 23:38:47 -05:00
Dave Collins
d443b48994 Improve InfoResult.
This commit modifies InfoResult to remove all of the omitempty tags since
the fields should be present in the marshalled JSON regardless of them
being zero values or not.
2014-05-03 14:05:37 -05:00
Dave Collins
d0a2506a96 Improve GetMiningInfoResult.
This commit modifies the types of the GetMiningInfoResult to better match
their underlying types.  While the information was all available and
accurate, it's nicer to treat numeric values as proper types instead of
all float64s.

Also, a new networkhashps field has been added for compatibility with the
reference implementation.
2014-05-03 12:28:04 -05: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
Dave Collins
1349f96d8e Correct GetRawMempoolResult types.
The StartingPriority and CurrentPriority fields of the GetRawMempoolResult
are float64s instead of ints.
2014-04-18 12:37:23 -05:00
David Hill
997d98bddf add a few missing and fix misspelled commands. 2014-04-12 10:47:07 -04:00
David Hill
ea7947f74e Add support for decodescript concrete result. 2014-04-12 10:41:32 -04:00
Dave Collins
0ca3d386ed Add support for listaccounts concrete result. 2014-04-12 02:40:06 -05:00
David Hill
372e8c1926 Add support for ListSinceBlockResult
ok @davecgh
2014-04-11 20:17:21 -04:00
David Hill
e6dca4de6f Add UnlockedUntil to InfoResult. 2014-04-11 18:59:10 -04:00
Dave Collins
0a14b19276 Redo ListTransactionsResult fix.
This was also lost in the move to jsonresults.go.
2014-04-11 14:56:55 -05: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
Josh Rickmar
c6149949a2 Redo the ListTransactionsResult amount->txid fix.
This likely got lost in a merge or the move to the jsonresults.go
file.
2014-04-11 12:39:18 -05:00
Dave Collins
fbe04b73ab Rename jsonresult_test.go -> jsonresults_test.go.
This matches the name of the file that contains the code it is testing.
2014-04-11 11:11:42 -05: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
95f8e5d6d8 Deprecate CreateMessage(WithId) and update docs.
This commit marks the CreateMessage and CreateMessageWithId functions as
deprecated as they are no longer maintained due to the new concrete
command approach.

It also updates the package documentation to show the new preferred method
as well as add details about btcd.

ok @jcvernaleo
2014-04-11 11:01:02 -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
Dave Collins
0512ddd8f8 Correct ListTransactionsResult.
This commit tweaks the ListTransactions result a bit so it is compatible
with the reference implementation.
2014-04-11 08:45:01 -05:00
David Hill
75a237bc0d Add support for GetTransactionResult.
ok @jcvernaleo
2014-04-11 09:39:08 -04:00
Dave Collins
d211c4c6c8 Correct TxID JSON key of ListTransactionsResult. 2014-04-10 22:26:44 -05: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
8a503c6148 Add addrlocal to GetPeerInfoResult.
ok @davecgh
2014-04-09 22:39:25 -04: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
David Hill
b0242a8793 Add missing fields to ValidateAddressResult structure
ok @jrick
2014-04-07 14:07:38 -04:00
John C. Vernaleo
71e31f03a2 Update coverage report. 2014-03-16 14:18:43 -04:00
Francis Lam
8f69a0bf69 Added new RelayFee field and missing TimeOffset field to InfoResult 2014-03-15 15:34:55 -04:00
jolan
1bc63bfd5d recieve->receive 2014-03-14 15:08:51 -05:00
Dave Collins
f65ea832de Export a couple of peer-to-peer client errors.
ok @jcvernaleo
2014-03-12 10:11:18 -05:00
John C. Vernaleo
21b974e271 Fix missing ) in comment. 2014-02-20 10:52:06 -05:00
Dave Collins
81843d269f Add support for GetRawMempoolResult. 2014-02-16 14:02:24 -06:00
Dave Collins
6a2b93e622 Add support for GetPeerInfoResult. 2014-02-16 13:45:04 -06:00
Dave Collins
5135fd3203 Allow getwork result to be a bool or JSON object.
The getwork command alters the output depending on whether or not the
optional data parameter was specified.  It is a JSON object when no data
was provided, and a boolean indicating whether a solution was found
when data was provided.
2014-02-11 17:44:48 -06:00
Dave Collins
a733633685 Correct GetWorkCmd.
The getwork RPC now only accepts a single optional parameter which, if
present, is a string containing the hex-encoded block data to solve.

Also update the tests for the new correct parameters.

ok @jcvernaleo
2014-02-11 16:45:48 -06:00
Dave Collins
cace9187d7 Correct typo in CmdGenerator comment. 2014-02-09 22:30:22 -06:00
Francis Lam
bfe374e735 Added comments for CmdGenerator and RegisterCustomCmdGenerator 2014-02-08 17:55:11 -05:00
Francis Lam
773efd633d Added RegisterCustomCmdGenerator to btcjson package
Allows for addition of custom Cmd classes that implement UnmarshalJSON
directly as opposed to via RawCmd object and RawCmdParser
2014-02-08 16:41:36 -05:00
Dave Collins
7623d13c37 Make getnetworkhashps result an int64. 2014-02-07 12:10:10 -06:00