1 // generated by go run ./genapi/.; DO NOT EDIT
2 //
3 //go:generate go run ./genapi/.
4 5 package wallet
6 7 import (
8 "io"
9 "net/rpc"
10 "time"
11 12 "github.com/p9c/p9/pkg/qu"
13 14 "github.com/p9c/p9/pkg/btcjson"
15 "github.com/p9c/p9/pkg/chainclient"
16 )
17 18 // API stores the channel, parameters and result values from calls via the channel
19 type API struct {
20 Ch interface{}
21 Params interface{}
22 Result interface{}
23 }
24 25 // CAPI is the central structure for configuration and access to a net/rpc API access endpoint for this RPC API
26 type CAPI struct {
27 Timeout time.Duration
28 quit qu.C
29 }
30 31 // NewCAPI returns a new CAPI
32 func NewCAPI(quit qu.C, timeout ...time.Duration) (c *CAPI) {
33 c = &CAPI{quit: quit}
34 if len(timeout)>0 {
35 c.Timeout = timeout[0]
36 } else {
37 c.Timeout = time.Second * 5
38 }
39 return
40 }
41 42 // CAPIClient is a wrapper around RPC calls
43 type CAPIClient struct {
44 *rpc.Client
45 }
46 47 // NewCAPIClient creates a new client for a kopach_worker. Note that any kind of connection can be used here,
48 // other than the StdConn
49 func NewCAPIClient(conn io.ReadWriteCloser) *CAPIClient {
50 return &CAPIClient{rpc.NewClient(conn)}
51 }
52 53 type (
54 // None means no parameters it is not checked so it can be nil
55 None struct{}
56 // AddMultiSigAddressRes is the result from a call to AddMultiSigAddress
57 AddMultiSigAddressRes struct { Res *string; e error }
58 // CreateMultiSigRes is the result from a call to CreateMultiSig
59 CreateMultiSigRes struct { Res *btcjson.CreateMultiSigResult; e error }
60 // CreateNewAccountRes is the result from a call to CreateNewAccount
61 CreateNewAccountRes struct { Res *None; e error }
62 // HandleDropWalletHistoryRes is the result from a call to HandleDropWalletHistory
63 HandleDropWalletHistoryRes struct { Res *string; e error }
64 // DumpPrivKeyRes is the result from a call to DumpPrivKey
65 DumpPrivKeyRes struct { Res *string; e error }
66 // GetAccountRes is the result from a call to GetAccount
67 GetAccountRes struct { Res *string; e error }
68 // GetAccountAddressRes is the result from a call to GetAccountAddress
69 GetAccountAddressRes struct { Res *string; e error }
70 // GetAddressesByAccountRes is the result from a call to GetAddressesByAccount
71 GetAddressesByAccountRes struct { Res *[]string; e error }
72 // GetBalanceRes is the result from a call to GetBalance
73 GetBalanceRes struct { Res *float64; e error }
74 // GetBestBlockRes is the result from a call to GetBestBlock
75 GetBestBlockRes struct { Res *btcjson.GetBestBlockResult; e error }
76 // GetBestBlockHashRes is the result from a call to GetBestBlockHash
77 GetBestBlockHashRes struct { Res *string; e error }
78 // GetBlockCountRes is the result from a call to GetBlockCount
79 GetBlockCountRes struct { Res *int32; e error }
80 // GetInfoRes is the result from a call to GetInfo
81 GetInfoRes struct { Res *btcjson.InfoWalletResult; e error }
82 // GetNewAddressRes is the result from a call to GetNewAddress
83 GetNewAddressRes struct { Res *string; e error }
84 // GetRawChangeAddressRes is the result from a call to GetRawChangeAddress
85 GetRawChangeAddressRes struct { Res *string; e error }
86 // GetReceivedByAccountRes is the result from a call to GetReceivedByAccount
87 GetReceivedByAccountRes struct { Res *float64; e error }
88 // GetReceivedByAddressRes is the result from a call to GetReceivedByAddress
89 GetReceivedByAddressRes struct { Res *float64; e error }
90 // GetTransactionRes is the result from a call to GetTransaction
91 GetTransactionRes struct { Res *btcjson.GetTransactionResult; e error }
92 // GetUnconfirmedBalanceRes is the result from a call to GetUnconfirmedBalance
93 GetUnconfirmedBalanceRes struct { Res *float64; e error }
94 // HelpNoChainRPCRes is the result from a call to HelpNoChainRPC
95 HelpNoChainRPCRes struct { Res *string; e error }
96 // ImportPrivKeyRes is the result from a call to ImportPrivKey
97 ImportPrivKeyRes struct { Res *None; e error }
98 // KeypoolRefillRes is the result from a call to KeypoolRefill
99 KeypoolRefillRes struct { Res *None; e error }
100 // ListAccountsRes is the result from a call to ListAccounts
101 ListAccountsRes struct { Res *map[string]float64; e error }
102 // ListAddressTransactionsRes is the result from a call to ListAddressTransactions
103 ListAddressTransactionsRes struct { Res *[]btcjson.ListTransactionsResult; e error }
104 // ListAllTransactionsRes is the result from a call to ListAllTransactions
105 ListAllTransactionsRes struct { Res *[]btcjson.ListTransactionsResult; e error }
106 // ListLockUnspentRes is the result from a call to ListLockUnspent
107 ListLockUnspentRes struct { Res *[]btcjson.TransactionInput; e error }
108 // ListReceivedByAccountRes is the result from a call to ListReceivedByAccount
109 ListReceivedByAccountRes struct { Res *[]btcjson.ListReceivedByAccountResult; e error }
110 // ListReceivedByAddressRes is the result from a call to ListReceivedByAddress
111 ListReceivedByAddressRes struct { Res *btcjson.ListReceivedByAddressResult; e error }
112 // ListSinceBlockRes is the result from a call to ListSinceBlock
113 ListSinceBlockRes struct { Res *btcjson.ListSinceBlockResult; e error }
114 // ListTransactionsRes is the result from a call to ListTransactions
115 ListTransactionsRes struct { Res *[]btcjson.ListTransactionsResult; e error }
116 // ListUnspentRes is the result from a call to ListUnspent
117 ListUnspentRes struct { Res *[]btcjson.ListUnspentResult; e error }
118 // RenameAccountRes is the result from a call to RenameAccount
119 RenameAccountRes struct { Res *None; e error }
120 // LockUnspentRes is the result from a call to LockUnspent
121 LockUnspentRes struct { Res *bool; e error }
122 // SendManyRes is the result from a call to SendMany
123 SendManyRes struct { Res *string; e error }
124 // SendToAddressRes is the result from a call to SendToAddress
125 SendToAddressRes struct { Res *string; e error }
126 // SetTxFeeRes is the result from a call to SetTxFee
127 SetTxFeeRes struct { Res *bool; e error }
128 // SignMessageRes is the result from a call to SignMessage
129 SignMessageRes struct { Res *string; e error }
130 // SignRawTransactionRes is the result from a call to SignRawTransaction
131 SignRawTransactionRes struct { Res *btcjson.SignRawTransactionResult; e error }
132 // ValidateAddressRes is the result from a call to ValidateAddress
133 ValidateAddressRes struct { Res *btcjson.ValidateAddressWalletResult; e error }
134 // VerifyMessageRes is the result from a call to VerifyMessage
135 VerifyMessageRes struct { Res *bool; e error }
136 // WalletIsLockedRes is the result from a call to WalletIsLocked
137 WalletIsLockedRes struct { Res *bool; e error }
138 // WalletLockRes is the result from a call to WalletLock
139 WalletLockRes struct { Res *None; e error }
140 // WalletPassphraseRes is the result from a call to WalletPassphrase
141 WalletPassphraseRes struct { Res *None; e error }
142 // WalletPassphraseChangeRes is the result from a call to WalletPassphraseChange
143 WalletPassphraseChangeRes struct { Res *None; e error }
144 )
145 146 // RequestHandler is a handler function to handle an unmarshaled and parsed request into a marshalable response. If the
147 // error is a *json.RPCError or any of the above special error classes, the server will respond with the JSON-RPC
148 // appropriate error code. All other errors use the wallet catch-all error code, json.ErrRPCWallet.
149 type RequestHandler func(interface{}, *Wallet,
150 ...*chainclient.RPCClient) (interface{}, error)
151 152 // RPCHandlers is all of the RPC calls available
153 //
154 // - Handler is the handler function
155 //
156 // - Call is a channel carrying a struct containing parameters and error that is listened to in RunAPI to dispatch the
157 // calls
158 //
159 // - Result is a bundle of command parameters and a channel that the result will be sent back on
160 //
161 // Get and save the Result function's return, and you can then call the call functions check, result and wait functions
162 // for asynchronous and synchronous calls to RPC functions
163 var RPCHandlers = map[string]struct {
164 Handler RequestHandler
165 // Function variables cannot be compared against anything but nil, so use a boolean to record whether help
166 // generation is necessary. This is used by the tests to ensure that help can be generated for every implemented
167 // method.
168 //
169 // A single map and this bool is here is used rather than several maps for the unimplemented handlers so every
170 // method has exactly one handler function.
171 //
172 // The Return field returns a new channel of the type returned by this function. This makes it possible to use this
173 // for callers to receive a response in the cpc library which implements the functions as channel pipes
174 NoHelp bool
175 Call chan API
176 Params interface{}
177 Result func() API
178 }{
179 "addmultisigaddress":{
180 Handler: AddMultiSigAddress, Call: make(chan API, 32),
181 Result: func() API { return API{Ch: make(chan AddMultiSigAddressRes)} }},
182 "createmultisig":{
183 Handler: CreateMultiSig, Call: make(chan API, 32),
184 Result: func() API { return API{Ch: make(chan CreateMultiSigRes)} }},
185 "createnewaccount":{
186 Handler: CreateNewAccount, Call: make(chan API, 32),
187 Result: func() API { return API{Ch: make(chan CreateNewAccountRes)} }},
188 "dropwallethistory":{
189 Handler: HandleDropWalletHistory, Call: make(chan API, 32),
190 Result: func() API { return API{Ch: make(chan HandleDropWalletHistoryRes)} }},
191 "dumpprivkey":{
192 Handler: DumpPrivKey, Call: make(chan API, 32),
193 Result: func() API { return API{Ch: make(chan DumpPrivKeyRes)} }},
194 "getaccount":{
195 Handler: GetAccount, Call: make(chan API, 32),
196 Result: func() API { return API{Ch: make(chan GetAccountRes)} }},
197 "getaccountaddress":{
198 Handler: GetAccountAddress, Call: make(chan API, 32),
199 Result: func() API { return API{Ch: make(chan GetAccountAddressRes)} }},
200 "getaddressesbyaccount":{
201 Handler: GetAddressesByAccount, Call: make(chan API, 32),
202 Result: func() API { return API{Ch: make(chan GetAddressesByAccountRes)} }},
203 "getbalance":{
204 Handler: GetBalance, Call: make(chan API, 32),
205 Result: func() API { return API{Ch: make(chan GetBalanceRes)} }},
206 "getbestblock":{
207 Handler: GetBestBlock, Call: make(chan API, 32),
208 Result: func() API { return API{Ch: make(chan GetBestBlockRes)} }},
209 "getbestblockhash":{
210 Handler: GetBestBlockHash, Call: make(chan API, 32),
211 Result: func() API { return API{Ch: make(chan GetBestBlockHashRes)} }},
212 "getblockcount":{
213 Handler: GetBlockCount, Call: make(chan API, 32),
214 Result: func() API { return API{Ch: make(chan GetBlockCountRes)} }},
215 "getinfo":{
216 Handler: GetInfo, Call: make(chan API, 32),
217 Result: func() API { return API{Ch: make(chan GetInfoRes)} }},
218 "getnewaddress":{
219 Handler: GetNewAddress, Call: make(chan API, 32),
220 Result: func() API { return API{Ch: make(chan GetNewAddressRes)} }},
221 "getrawchangeaddress":{
222 Handler: GetRawChangeAddress, Call: make(chan API, 32),
223 Result: func() API { return API{Ch: make(chan GetRawChangeAddressRes)} }},
224 "getreceivedbyaccount":{
225 Handler: GetReceivedByAccount, Call: make(chan API, 32),
226 Result: func() API { return API{Ch: make(chan GetReceivedByAccountRes)} }},
227 "getreceivedbyaddress":{
228 Handler: GetReceivedByAddress, Call: make(chan API, 32),
229 Result: func() API { return API{Ch: make(chan GetReceivedByAddressRes)} }},
230 "gettransaction":{
231 Handler: GetTransaction, Call: make(chan API, 32),
232 Result: func() API { return API{Ch: make(chan GetTransactionRes)} }},
233 "getunconfirmedbalance":{
234 Handler: GetUnconfirmedBalance, Call: make(chan API, 32),
235 Result: func() API { return API{Ch: make(chan GetUnconfirmedBalanceRes)} }},
236 "help":{
237 Handler: HelpNoChainRPC, Call: make(chan API, 32),
238 Result: func() API { return API{Ch: make(chan HelpNoChainRPCRes)} }},
239 "importprivkey":{
240 Handler: ImportPrivKey, Call: make(chan API, 32),
241 Result: func() API { return API{Ch: make(chan ImportPrivKeyRes)} }},
242 "keypoolrefill":{
243 Handler: KeypoolRefill, Call: make(chan API, 32),
244 Result: func() API { return API{Ch: make(chan KeypoolRefillRes)} }},
245 "listaccounts":{
246 Handler: ListAccounts, Call: make(chan API, 32),
247 Result: func() API { return API{Ch: make(chan ListAccountsRes)} }},
248 "listaddresstransactions":{
249 Handler: ListAddressTransactions, Call: make(chan API, 32),
250 Result: func() API { return API{Ch: make(chan ListAddressTransactionsRes)} }},
251 "listalltransactions":{
252 Handler: ListAllTransactions, Call: make(chan API, 32),
253 Result: func() API { return API{Ch: make(chan ListAllTransactionsRes)} }},
254 "listlockunspent":{
255 Handler: ListLockUnspent, Call: make(chan API, 32),
256 Result: func() API { return API{Ch: make(chan ListLockUnspentRes)} }},
257 "listreceivedbyaccount":{
258 Handler: ListReceivedByAccount, Call: make(chan API, 32),
259 Result: func() API { return API{Ch: make(chan ListReceivedByAccountRes)} }},
260 "listreceivedbyaddress":{
261 Handler: ListReceivedByAddress, Call: make(chan API, 32),
262 Result: func() API { return API{Ch: make(chan ListReceivedByAddressRes)} }},
263 "listsinceblock":{
264 Handler: ListSinceBlock, Call: make(chan API, 32),
265 Result: func() API { return API{Ch: make(chan ListSinceBlockRes)} }},
266 "listtransactions":{
267 Handler: ListTransactions, Call: make(chan API, 32),
268 Result: func() API { return API{Ch: make(chan ListTransactionsRes)} }},
269 "listunspent":{
270 Handler: ListUnspent, Call: make(chan API, 32),
271 Result: func() API { return API{Ch: make(chan ListUnspentRes)} }},
272 "renameaccount":{
273 Handler: RenameAccount, Call: make(chan API, 32),
274 Result: func() API { return API{Ch: make(chan RenameAccountRes)} }},
275 "sendfrom":{
276 Handler: LockUnspent, Call: make(chan API, 32),
277 Result: func() API { return API{Ch: make(chan LockUnspentRes)} }},
278 "sendmany":{
279 Handler: SendMany, Call: make(chan API, 32),
280 Result: func() API { return API{Ch: make(chan SendManyRes)} }},
281 "sendtoaddress":{
282 Handler: SendToAddress, Call: make(chan API, 32),
283 Result: func() API { return API{Ch: make(chan SendToAddressRes)} }},
284 "settxfee":{
285 Handler: SetTxFee, Call: make(chan API, 32),
286 Result: func() API { return API{Ch: make(chan SetTxFeeRes)} }},
287 "signmessage":{
288 Handler: SignMessage, Call: make(chan API, 32),
289 Result: func() API { return API{Ch: make(chan SignMessageRes)} }},
290 "signrawtransaction":{
291 Handler: SignRawTransaction, Call: make(chan API, 32),
292 Result: func() API { return API{Ch: make(chan SignRawTransactionRes)} }},
293 "validateaddress":{
294 Handler: ValidateAddress, Call: make(chan API, 32),
295 Result: func() API { return API{Ch: make(chan ValidateAddressRes)} }},
296 "verifymessage":{
297 Handler: VerifyMessage, Call: make(chan API, 32),
298 Result: func() API { return API{Ch: make(chan VerifyMessageRes)} }},
299 "walletislocked":{
300 Handler: WalletIsLocked, Call: make(chan API, 32),
301 Result: func() API { return API{Ch: make(chan WalletIsLockedRes)} }},
302 "walletlock":{
303 Handler: WalletLock, Call: make(chan API, 32),
304 Result: func() API { return API{Ch: make(chan WalletLockRes)} }},
305 "walletpassphrase":{
306 Handler: WalletPassphrase, Call: make(chan API, 32),
307 Result: func() API { return API{Ch: make(chan WalletPassphraseRes)} }},
308 "walletpassphrasechange":{
309 Handler: WalletPassphraseChange, Call: make(chan API, 32),
310 Result: func() API { return API{Ch: make(chan WalletPassphraseChangeRes)} }},
311 312 }
313 314 // API functions
315 //
316 // The functions here provide access to the RPC through a convenient set of functions generated for each call in the RPC
317 // API to request, check for, access the results and wait on results
318 319 320 // AddMultiSigAddress calls the method with the given parameters
321 func (a API) AddMultiSigAddress(cmd *btcjson.AddMultisigAddressCmd) (e error) {
322 RPCHandlers["addmultisigaddress"].Call <- API{a.Ch, cmd, nil}
323 return
324 }
325 326 // AddMultiSigAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as
327 // storing the value in the Result field
328 func (a API) AddMultiSigAddressCheck() (isNew bool) {
329 select {
330 case o := <- a.Ch.(chan AddMultiSigAddressRes):
331 if o.e != nil {
332 a.Result = o.e
333 } else {
334 a.Result = o.Res
335 }
336 isNew = true
337 default:
338 }
339 return
340 }
341 342 // AddMultiSigAddressGetRes returns a pointer to the value in the Result field
343 func (a API) AddMultiSigAddressGetRes() (out *string, e error) {
344 out, _ = a.Result.(*string)
345 e, _ = a.Result.(error)
346 return
347 }
348 349 // AddMultiSigAddressWait calls the method and blocks until it returns or 5 seconds passes
350 func (a API) AddMultiSigAddressWait(cmd *btcjson.AddMultisigAddressCmd) (out *string, e error) {
351 RPCHandlers["addmultisigaddress"].Call <- API{a.Ch, cmd, nil}
352 select {
353 case <-time.After(time.Second*5):
354 break
355 case o := <- a.Ch.(chan AddMultiSigAddressRes):
356 out, e = o.Res, o.e
357 }
358 return
359 }
360 361 // CreateMultiSig calls the method with the given parameters
362 func (a API) CreateMultiSig(cmd *btcjson.CreateMultisigCmd) (e error) {
363 RPCHandlers["createmultisig"].Call <- API{a.Ch, cmd, nil}
364 return
365 }
366 367 // CreateMultiSigCheck checks if a new message arrived on the result channel and returns true if it does, as well as
368 // storing the value in the Result field
369 func (a API) CreateMultiSigCheck() (isNew bool) {
370 select {
371 case o := <- a.Ch.(chan CreateMultiSigRes):
372 if o.e != nil {
373 a.Result = o.e
374 } else {
375 a.Result = o.Res
376 }
377 isNew = true
378 default:
379 }
380 return
381 }
382 383 // CreateMultiSigGetRes returns a pointer to the value in the Result field
384 func (a API) CreateMultiSigGetRes() (out *btcjson.CreateMultiSigResult, e error) {
385 out, _ = a.Result.(*btcjson.CreateMultiSigResult)
386 e, _ = a.Result.(error)
387 return
388 }
389 390 // CreateMultiSigWait calls the method and blocks until it returns or 5 seconds passes
391 func (a API) CreateMultiSigWait(cmd *btcjson.CreateMultisigCmd) (out *btcjson.CreateMultiSigResult, e error) {
392 RPCHandlers["createmultisig"].Call <- API{a.Ch, cmd, nil}
393 select {
394 case <-time.After(time.Second*5):
395 break
396 case o := <- a.Ch.(chan CreateMultiSigRes):
397 out, e = o.Res, o.e
398 }
399 return
400 }
401 402 // CreateNewAccount calls the method with the given parameters
403 func (a API) CreateNewAccount(cmd *btcjson.CreateNewAccountCmd) (e error) {
404 RPCHandlers["createnewaccount"].Call <- API{a.Ch, cmd, nil}
405 return
406 }
407 408 // CreateNewAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as
409 // storing the value in the Result field
410 func (a API) CreateNewAccountCheck() (isNew bool) {
411 select {
412 case o := <- a.Ch.(chan CreateNewAccountRes):
413 if o.e != nil {
414 a.Result = o.e
415 } else {
416 a.Result = o.Res
417 }
418 isNew = true
419 default:
420 }
421 return
422 }
423 424 // CreateNewAccountGetRes returns a pointer to the value in the Result field
425 func (a API) CreateNewAccountGetRes() (out *None, e error) {
426 out, _ = a.Result.(*None)
427 e, _ = a.Result.(error)
428 return
429 }
430 431 // CreateNewAccountWait calls the method and blocks until it returns or 5 seconds passes
432 func (a API) CreateNewAccountWait(cmd *btcjson.CreateNewAccountCmd) (out *None, e error) {
433 RPCHandlers["createnewaccount"].Call <- API{a.Ch, cmd, nil}
434 select {
435 case <-time.After(time.Second*5):
436 break
437 case o := <- a.Ch.(chan CreateNewAccountRes):
438 out, e = o.Res, o.e
439 }
440 return
441 }
442 443 // HandleDropWalletHistory calls the method with the given parameters
444 func (a API) HandleDropWalletHistory(cmd *None) (e error) {
445 RPCHandlers["dropwallethistory"].Call <- API{a.Ch, cmd, nil}
446 return
447 }
448 449 // HandleDropWalletHistoryCheck checks if a new message arrived on the result channel and returns true if it does, as well as
450 // storing the value in the Result field
451 func (a API) HandleDropWalletHistoryCheck() (isNew bool) {
452 select {
453 case o := <- a.Ch.(chan HandleDropWalletHistoryRes):
454 if o.e != nil {
455 a.Result = o.e
456 } else {
457 a.Result = o.Res
458 }
459 isNew = true
460 default:
461 }
462 return
463 }
464 465 // HandleDropWalletHistoryGetRes returns a pointer to the value in the Result field
466 func (a API) HandleDropWalletHistoryGetRes() (out *string, e error) {
467 out, _ = a.Result.(*string)
468 e, _ = a.Result.(error)
469 return
470 }
471 472 // HandleDropWalletHistoryWait calls the method and blocks until it returns or 5 seconds passes
473 func (a API) HandleDropWalletHistoryWait(cmd *None) (out *string, e error) {
474 RPCHandlers["dropwallethistory"].Call <- API{a.Ch, cmd, nil}
475 select {
476 case <-time.After(time.Second*5):
477 break
478 case o := <- a.Ch.(chan HandleDropWalletHistoryRes):
479 out, e = o.Res, o.e
480 }
481 return
482 }
483 484 // DumpPrivKey calls the method with the given parameters
485 func (a API) DumpPrivKey(cmd *btcjson.DumpPrivKeyCmd) (e error) {
486 RPCHandlers["dumpprivkey"].Call <- API{a.Ch, cmd, nil}
487 return
488 }
489 490 // DumpPrivKeyCheck checks if a new message arrived on the result channel and returns true if it does, as well as
491 // storing the value in the Result field
492 func (a API) DumpPrivKeyCheck() (isNew bool) {
493 select {
494 case o := <- a.Ch.(chan DumpPrivKeyRes):
495 if o.e != nil {
496 a.Result = o.e
497 } else {
498 a.Result = o.Res
499 }
500 isNew = true
501 default:
502 }
503 return
504 }
505 506 // DumpPrivKeyGetRes returns a pointer to the value in the Result field
507 func (a API) DumpPrivKeyGetRes() (out *string, e error) {
508 out, _ = a.Result.(*string)
509 e, _ = a.Result.(error)
510 return
511 }
512 513 // DumpPrivKeyWait calls the method and blocks until it returns or 5 seconds passes
514 func (a API) DumpPrivKeyWait(cmd *btcjson.DumpPrivKeyCmd) (out *string, e error) {
515 RPCHandlers["dumpprivkey"].Call <- API{a.Ch, cmd, nil}
516 select {
517 case <-time.After(time.Second*5):
518 break
519 case o := <- a.Ch.(chan DumpPrivKeyRes):
520 out, e = o.Res, o.e
521 }
522 return
523 }
524 525 // GetAccount calls the method with the given parameters
526 func (a API) GetAccount(cmd *btcjson.GetAccountCmd) (e error) {
527 RPCHandlers["getaccount"].Call <- API{a.Ch, cmd, nil}
528 return
529 }
530 531 // GetAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as
532 // storing the value in the Result field
533 func (a API) GetAccountCheck() (isNew bool) {
534 select {
535 case o := <- a.Ch.(chan GetAccountRes):
536 if o.e != nil {
537 a.Result = o.e
538 } else {
539 a.Result = o.Res
540 }
541 isNew = true
542 default:
543 }
544 return
545 }
546 547 // GetAccountGetRes returns a pointer to the value in the Result field
548 func (a API) GetAccountGetRes() (out *string, e error) {
549 out, _ = a.Result.(*string)
550 e, _ = a.Result.(error)
551 return
552 }
553 554 // GetAccountWait calls the method and blocks until it returns or 5 seconds passes
555 func (a API) GetAccountWait(cmd *btcjson.GetAccountCmd) (out *string, e error) {
556 RPCHandlers["getaccount"].Call <- API{a.Ch, cmd, nil}
557 select {
558 case <-time.After(time.Second*5):
559 break
560 case o := <- a.Ch.(chan GetAccountRes):
561 out, e = o.Res, o.e
562 }
563 return
564 }
565 566 // GetAccountAddress calls the method with the given parameters
567 func (a API) GetAccountAddress(cmd *btcjson.GetAccountAddressCmd) (e error) {
568 RPCHandlers["getaccountaddress"].Call <- API{a.Ch, cmd, nil}
569 return
570 }
571 572 // GetAccountAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as
573 // storing the value in the Result field
574 func (a API) GetAccountAddressCheck() (isNew bool) {
575 select {
576 case o := <- a.Ch.(chan GetAccountAddressRes):
577 if o.e != nil {
578 a.Result = o.e
579 } else {
580 a.Result = o.Res
581 }
582 isNew = true
583 default:
584 }
585 return
586 }
587 588 // GetAccountAddressGetRes returns a pointer to the value in the Result field
589 func (a API) GetAccountAddressGetRes() (out *string, e error) {
590 out, _ = a.Result.(*string)
591 e, _ = a.Result.(error)
592 return
593 }
594 595 // GetAccountAddressWait calls the method and blocks until it returns or 5 seconds passes
596 func (a API) GetAccountAddressWait(cmd *btcjson.GetAccountAddressCmd) (out *string, e error) {
597 RPCHandlers["getaccountaddress"].Call <- API{a.Ch, cmd, nil}
598 select {
599 case <-time.After(time.Second*5):
600 break
601 case o := <- a.Ch.(chan GetAccountAddressRes):
602 out, e = o.Res, o.e
603 }
604 return
605 }
606 607 // GetAddressesByAccount calls the method with the given parameters
608 func (a API) GetAddressesByAccount(cmd *btcjson.GetAddressesByAccountCmd) (e error) {
609 RPCHandlers["getaddressesbyaccount"].Call <- API{a.Ch, cmd, nil}
610 return
611 }
612 613 // GetAddressesByAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as
614 // storing the value in the Result field
615 func (a API) GetAddressesByAccountCheck() (isNew bool) {
616 select {
617 case o := <- a.Ch.(chan GetAddressesByAccountRes):
618 if o.e != nil {
619 a.Result = o.e
620 } else {
621 a.Result = o.Res
622 }
623 isNew = true
624 default:
625 }
626 return
627 }
628 629 // GetAddressesByAccountGetRes returns a pointer to the value in the Result field
630 func (a API) GetAddressesByAccountGetRes() (out *[]string, e error) {
631 out, _ = a.Result.(*[]string)
632 e, _ = a.Result.(error)
633 return
634 }
635 636 // GetAddressesByAccountWait calls the method and blocks until it returns or 5 seconds passes
637 func (a API) GetAddressesByAccountWait(cmd *btcjson.GetAddressesByAccountCmd) (out *[]string, e error) {
638 RPCHandlers["getaddressesbyaccount"].Call <- API{a.Ch, cmd, nil}
639 select {
640 case <-time.After(time.Second*5):
641 break
642 case o := <- a.Ch.(chan GetAddressesByAccountRes):
643 out, e = o.Res, o.e
644 }
645 return
646 }
647 648 // GetBalance calls the method with the given parameters
649 func (a API) GetBalance(cmd *btcjson.GetBalanceCmd) (e error) {
650 RPCHandlers["getbalance"].Call <- API{a.Ch, cmd, nil}
651 return
652 }
653 654 // GetBalanceCheck checks if a new message arrived on the result channel and returns true if it does, as well as
655 // storing the value in the Result field
656 func (a API) GetBalanceCheck() (isNew bool) {
657 select {
658 case o := <- a.Ch.(chan GetBalanceRes):
659 if o.e != nil {
660 a.Result = o.e
661 } else {
662 a.Result = o.Res
663 }
664 isNew = true
665 default:
666 }
667 return
668 }
669 670 // GetBalanceGetRes returns a pointer to the value in the Result field
671 func (a API) GetBalanceGetRes() (out *float64, e error) {
672 out, _ = a.Result.(*float64)
673 e, _ = a.Result.(error)
674 return
675 }
676 677 // GetBalanceWait calls the method and blocks until it returns or 5 seconds passes
678 func (a API) GetBalanceWait(cmd *btcjson.GetBalanceCmd) (out *float64, e error) {
679 RPCHandlers["getbalance"].Call <- API{a.Ch, cmd, nil}
680 select {
681 case <-time.After(time.Second*5):
682 break
683 case o := <- a.Ch.(chan GetBalanceRes):
684 out, e = o.Res, o.e
685 }
686 return
687 }
688 689 // GetBestBlock calls the method with the given parameters
690 func (a API) GetBestBlock(cmd *None) (e error) {
691 RPCHandlers["getbestblock"].Call <- API{a.Ch, cmd, nil}
692 return
693 }
694 695 // GetBestBlockCheck checks if a new message arrived on the result channel and returns true if it does, as well as
696 // storing the value in the Result field
697 func (a API) GetBestBlockCheck() (isNew bool) {
698 select {
699 case o := <- a.Ch.(chan GetBestBlockRes):
700 if o.e != nil {
701 a.Result = o.e
702 } else {
703 a.Result = o.Res
704 }
705 isNew = true
706 default:
707 }
708 return
709 }
710 711 // GetBestBlockGetRes returns a pointer to the value in the Result field
712 func (a API) GetBestBlockGetRes() (out *btcjson.GetBestBlockResult, e error) {
713 out, _ = a.Result.(*btcjson.GetBestBlockResult)
714 e, _ = a.Result.(error)
715 return
716 }
717 718 // GetBestBlockWait calls the method and blocks until it returns or 5 seconds passes
719 func (a API) GetBestBlockWait(cmd *None) (out *btcjson.GetBestBlockResult, e error) {
720 RPCHandlers["getbestblock"].Call <- API{a.Ch, cmd, nil}
721 select {
722 case <-time.After(time.Second*5):
723 break
724 case o := <- a.Ch.(chan GetBestBlockRes):
725 out, e = o.Res, o.e
726 }
727 return
728 }
729 730 // GetBestBlockHash calls the method with the given parameters
731 func (a API) GetBestBlockHash(cmd *None) (e error) {
732 RPCHandlers["getbestblockhash"].Call <- API{a.Ch, cmd, nil}
733 return
734 }
735 736 // GetBestBlockHashCheck checks if a new message arrived on the result channel and returns true if it does, as well as
737 // storing the value in the Result field
738 func (a API) GetBestBlockHashCheck() (isNew bool) {
739 select {
740 case o := <- a.Ch.(chan GetBestBlockHashRes):
741 if o.e != nil {
742 a.Result = o.e
743 } else {
744 a.Result = o.Res
745 }
746 isNew = true
747 default:
748 }
749 return
750 }
751 752 // GetBestBlockHashGetRes returns a pointer to the value in the Result field
753 func (a API) GetBestBlockHashGetRes() (out *string, e error) {
754 out, _ = a.Result.(*string)
755 e, _ = a.Result.(error)
756 return
757 }
758 759 // GetBestBlockHashWait calls the method and blocks until it returns or 5 seconds passes
760 func (a API) GetBestBlockHashWait(cmd *None) (out *string, e error) {
761 RPCHandlers["getbestblockhash"].Call <- API{a.Ch, cmd, nil}
762 select {
763 case <-time.After(time.Second*5):
764 break
765 case o := <- a.Ch.(chan GetBestBlockHashRes):
766 out, e = o.Res, o.e
767 }
768 return
769 }
770 771 // GetBlockCount calls the method with the given parameters
772 func (a API) GetBlockCount(cmd *None) (e error) {
773 RPCHandlers["getblockcount"].Call <- API{a.Ch, cmd, nil}
774 return
775 }
776 777 // GetBlockCountCheck checks if a new message arrived on the result channel and returns true if it does, as well as
778 // storing the value in the Result field
779 func (a API) GetBlockCountCheck() (isNew bool) {
780 select {
781 case o := <- a.Ch.(chan GetBlockCountRes):
782 if o.e != nil {
783 a.Result = o.e
784 } else {
785 a.Result = o.Res
786 }
787 isNew = true
788 default:
789 }
790 return
791 }
792 793 // GetBlockCountGetRes returns a pointer to the value in the Result field
794 func (a API) GetBlockCountGetRes() (out *int32, e error) {
795 out, _ = a.Result.(*int32)
796 e, _ = a.Result.(error)
797 return
798 }
799 800 // GetBlockCountWait calls the method and blocks until it returns or 5 seconds passes
801 func (a API) GetBlockCountWait(cmd *None) (out *int32, e error) {
802 RPCHandlers["getblockcount"].Call <- API{a.Ch, cmd, nil}
803 select {
804 case <-time.After(time.Second*5):
805 break
806 case o := <- a.Ch.(chan GetBlockCountRes):
807 out, e = o.Res, o.e
808 }
809 return
810 }
811 812 // GetInfo calls the method with the given parameters
813 func (a API) GetInfo(cmd *None) (e error) {
814 RPCHandlers["getinfo"].Call <- API{a.Ch, cmd, nil}
815 return
816 }
817 818 // GetInfoCheck checks if a new message arrived on the result channel and returns true if it does, as well as
819 // storing the value in the Result field
820 func (a API) GetInfoCheck() (isNew bool) {
821 select {
822 case o := <- a.Ch.(chan GetInfoRes):
823 if o.e != nil {
824 a.Result = o.e
825 } else {
826 a.Result = o.Res
827 }
828 isNew = true
829 default:
830 }
831 return
832 }
833 834 // GetInfoGetRes returns a pointer to the value in the Result field
835 func (a API) GetInfoGetRes() (out *btcjson.InfoWalletResult, e error) {
836 out, _ = a.Result.(*btcjson.InfoWalletResult)
837 e, _ = a.Result.(error)
838 return
839 }
840 841 // GetInfoWait calls the method and blocks until it returns or 5 seconds passes
842 func (a API) GetInfoWait(cmd *None) (out *btcjson.InfoWalletResult, e error) {
843 RPCHandlers["getinfo"].Call <- API{a.Ch, cmd, nil}
844 select {
845 case <-time.After(time.Second*5):
846 break
847 case o := <- a.Ch.(chan GetInfoRes):
848 out, e = o.Res, o.e
849 }
850 return
851 }
852 853 // GetNewAddress calls the method with the given parameters
854 func (a API) GetNewAddress(cmd *btcjson.GetNewAddressCmd) (e error) {
855 RPCHandlers["getnewaddress"].Call <- API{a.Ch, cmd, nil}
856 return
857 }
858 859 // GetNewAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as
860 // storing the value in the Result field
861 func (a API) GetNewAddressCheck() (isNew bool) {
862 select {
863 case o := <- a.Ch.(chan GetNewAddressRes):
864 if o.e != nil {
865 a.Result = o.e
866 } else {
867 a.Result = o.Res
868 }
869 isNew = true
870 default:
871 }
872 return
873 }
874 875 // GetNewAddressGetRes returns a pointer to the value in the Result field
876 func (a API) GetNewAddressGetRes() (out *string, e error) {
877 out, _ = a.Result.(*string)
878 e, _ = a.Result.(error)
879 return
880 }
881 882 // GetNewAddressWait calls the method and blocks until it returns or 5 seconds passes
883 func (a API) GetNewAddressWait(cmd *btcjson.GetNewAddressCmd) (out *string, e error) {
884 RPCHandlers["getnewaddress"].Call <- API{a.Ch, cmd, nil}
885 select {
886 case <-time.After(time.Second*5):
887 break
888 case o := <- a.Ch.(chan GetNewAddressRes):
889 out, e = o.Res, o.e
890 }
891 return
892 }
893 894 // GetRawChangeAddress calls the method with the given parameters
895 func (a API) GetRawChangeAddress(cmd *btcjson.GetRawChangeAddressCmd) (e error) {
896 RPCHandlers["getrawchangeaddress"].Call <- API{a.Ch, cmd, nil}
897 return
898 }
899 900 // GetRawChangeAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as
901 // storing the value in the Result field
902 func (a API) GetRawChangeAddressCheck() (isNew bool) {
903 select {
904 case o := <- a.Ch.(chan GetRawChangeAddressRes):
905 if o.e != nil {
906 a.Result = o.e
907 } else {
908 a.Result = o.Res
909 }
910 isNew = true
911 default:
912 }
913 return
914 }
915 916 // GetRawChangeAddressGetRes returns a pointer to the value in the Result field
917 func (a API) GetRawChangeAddressGetRes() (out *string, e error) {
918 out, _ = a.Result.(*string)
919 e, _ = a.Result.(error)
920 return
921 }
922 923 // GetRawChangeAddressWait calls the method and blocks until it returns or 5 seconds passes
924 func (a API) GetRawChangeAddressWait(cmd *btcjson.GetRawChangeAddressCmd) (out *string, e error) {
925 RPCHandlers["getrawchangeaddress"].Call <- API{a.Ch, cmd, nil}
926 select {
927 case <-time.After(time.Second*5):
928 break
929 case o := <- a.Ch.(chan GetRawChangeAddressRes):
930 out, e = o.Res, o.e
931 }
932 return
933 }
934 935 // GetReceivedByAccount calls the method with the given parameters
936 func (a API) GetReceivedByAccount(cmd *btcjson.GetReceivedByAccountCmd) (e error) {
937 RPCHandlers["getreceivedbyaccount"].Call <- API{a.Ch, cmd, nil}
938 return
939 }
940 941 // GetReceivedByAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as
942 // storing the value in the Result field
943 func (a API) GetReceivedByAccountCheck() (isNew bool) {
944 select {
945 case o := <- a.Ch.(chan GetReceivedByAccountRes):
946 if o.e != nil {
947 a.Result = o.e
948 } else {
949 a.Result = o.Res
950 }
951 isNew = true
952 default:
953 }
954 return
955 }
956 957 // GetReceivedByAccountGetRes returns a pointer to the value in the Result field
958 func (a API) GetReceivedByAccountGetRes() (out *float64, e error) {
959 out, _ = a.Result.(*float64)
960 e, _ = a.Result.(error)
961 return
962 }
963 964 // GetReceivedByAccountWait calls the method and blocks until it returns or 5 seconds passes
965 func (a API) GetReceivedByAccountWait(cmd *btcjson.GetReceivedByAccountCmd) (out *float64, e error) {
966 RPCHandlers["getreceivedbyaccount"].Call <- API{a.Ch, cmd, nil}
967 select {
968 case <-time.After(time.Second*5):
969 break
970 case o := <- a.Ch.(chan GetReceivedByAccountRes):
971 out, e = o.Res, o.e
972 }
973 return
974 }
975 976 // GetReceivedByAddress calls the method with the given parameters
977 func (a API) GetReceivedByAddress(cmd *btcjson.GetReceivedByAddressCmd) (e error) {
978 RPCHandlers["getreceivedbyaddress"].Call <- API{a.Ch, cmd, nil}
979 return
980 }
981 982 // GetReceivedByAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as
983 // storing the value in the Result field
984 func (a API) GetReceivedByAddressCheck() (isNew bool) {
985 select {
986 case o := <- a.Ch.(chan GetReceivedByAddressRes):
987 if o.e != nil {
988 a.Result = o.e
989 } else {
990 a.Result = o.Res
991 }
992 isNew = true
993 default:
994 }
995 return
996 }
997 998 // GetReceivedByAddressGetRes returns a pointer to the value in the Result field
999 func (a API) GetReceivedByAddressGetRes() (out *float64, e error) {
1000 out, _ = a.Result.(*float64)
1001 e, _ = a.Result.(error)
1002 return
1003 }
1004 1005 // GetReceivedByAddressWait calls the method and blocks until it returns or 5 seconds passes
1006 func (a API) GetReceivedByAddressWait(cmd *btcjson.GetReceivedByAddressCmd) (out *float64, e error) {
1007 RPCHandlers["getreceivedbyaddress"].Call <- API{a.Ch, cmd, nil}
1008 select {
1009 case <-time.After(time.Second*5):
1010 break
1011 case o := <- a.Ch.(chan GetReceivedByAddressRes):
1012 out, e = o.Res, o.e
1013 }
1014 return
1015 }
1016 1017 // GetTransaction calls the method with the given parameters
1018 func (a API) GetTransaction(cmd *btcjson.GetTransactionCmd) (e error) {
1019 RPCHandlers["gettransaction"].Call <- API{a.Ch, cmd, nil}
1020 return
1021 }
1022 1023 // GetTransactionCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1024 // storing the value in the Result field
1025 func (a API) GetTransactionCheck() (isNew bool) {
1026 select {
1027 case o := <- a.Ch.(chan GetTransactionRes):
1028 if o.e != nil {
1029 a.Result = o.e
1030 } else {
1031 a.Result = o.Res
1032 }
1033 isNew = true
1034 default:
1035 }
1036 return
1037 }
1038 1039 // GetTransactionGetRes returns a pointer to the value in the Result field
1040 func (a API) GetTransactionGetRes() (out *btcjson.GetTransactionResult, e error) {
1041 out, _ = a.Result.(*btcjson.GetTransactionResult)
1042 e, _ = a.Result.(error)
1043 return
1044 }
1045 1046 // GetTransactionWait calls the method and blocks until it returns or 5 seconds passes
1047 func (a API) GetTransactionWait(cmd *btcjson.GetTransactionCmd) (out *btcjson.GetTransactionResult, e error) {
1048 RPCHandlers["gettransaction"].Call <- API{a.Ch, cmd, nil}
1049 select {
1050 case <-time.After(time.Second*5):
1051 break
1052 case o := <- a.Ch.(chan GetTransactionRes):
1053 out, e = o.Res, o.e
1054 }
1055 return
1056 }
1057 1058 // GetUnconfirmedBalance calls the method with the given parameters
1059 func (a API) GetUnconfirmedBalance(cmd *btcjson.GetUnconfirmedBalanceCmd) (e error) {
1060 RPCHandlers["getunconfirmedbalance"].Call <- API{a.Ch, cmd, nil}
1061 return
1062 }
1063 1064 // GetUnconfirmedBalanceCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1065 // storing the value in the Result field
1066 func (a API) GetUnconfirmedBalanceCheck() (isNew bool) {
1067 select {
1068 case o := <- a.Ch.(chan GetUnconfirmedBalanceRes):
1069 if o.e != nil {
1070 a.Result = o.e
1071 } else {
1072 a.Result = o.Res
1073 }
1074 isNew = true
1075 default:
1076 }
1077 return
1078 }
1079 1080 // GetUnconfirmedBalanceGetRes returns a pointer to the value in the Result field
1081 func (a API) GetUnconfirmedBalanceGetRes() (out *float64, e error) {
1082 out, _ = a.Result.(*float64)
1083 e, _ = a.Result.(error)
1084 return
1085 }
1086 1087 // GetUnconfirmedBalanceWait calls the method and blocks until it returns or 5 seconds passes
1088 func (a API) GetUnconfirmedBalanceWait(cmd *btcjson.GetUnconfirmedBalanceCmd) (out *float64, e error) {
1089 RPCHandlers["getunconfirmedbalance"].Call <- API{a.Ch, cmd, nil}
1090 select {
1091 case <-time.After(time.Second*5):
1092 break
1093 case o := <- a.Ch.(chan GetUnconfirmedBalanceRes):
1094 out, e = o.Res, o.e
1095 }
1096 return
1097 }
1098 1099 // HelpNoChainRPC calls the method with the given parameters
1100 func (a API) HelpNoChainRPC(cmd btcjson.HelpCmd) (e error) {
1101 RPCHandlers["help"].Call <- API{a.Ch, cmd, nil}
1102 return
1103 }
1104 1105 // HelpNoChainRPCCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1106 // storing the value in the Result field
1107 func (a API) HelpNoChainRPCCheck() (isNew bool) {
1108 select {
1109 case o := <- a.Ch.(chan HelpNoChainRPCRes):
1110 if o.e != nil {
1111 a.Result = o.e
1112 } else {
1113 a.Result = o.Res
1114 }
1115 isNew = true
1116 default:
1117 }
1118 return
1119 }
1120 1121 // HelpNoChainRPCGetRes returns a pointer to the value in the Result field
1122 func (a API) HelpNoChainRPCGetRes() (out *string, e error) {
1123 out, _ = a.Result.(*string)
1124 e, _ = a.Result.(error)
1125 return
1126 }
1127 1128 // HelpNoChainRPCWait calls the method and blocks until it returns or 5 seconds passes
1129 func (a API) HelpNoChainRPCWait(cmd btcjson.HelpCmd) (out *string, e error) {
1130 RPCHandlers["help"].Call <- API{a.Ch, cmd, nil}
1131 select {
1132 case <-time.After(time.Second*5):
1133 break
1134 case o := <- a.Ch.(chan HelpNoChainRPCRes):
1135 out, e = o.Res, o.e
1136 }
1137 return
1138 }
1139 1140 // ImportPrivKey calls the method with the given parameters
1141 func (a API) ImportPrivKey(cmd *btcjson.ImportPrivKeyCmd) (e error) {
1142 RPCHandlers["importprivkey"].Call <- API{a.Ch, cmd, nil}
1143 return
1144 }
1145 1146 // ImportPrivKeyCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1147 // storing the value in the Result field
1148 func (a API) ImportPrivKeyCheck() (isNew bool) {
1149 select {
1150 case o := <- a.Ch.(chan ImportPrivKeyRes):
1151 if o.e != nil {
1152 a.Result = o.e
1153 } else {
1154 a.Result = o.Res
1155 }
1156 isNew = true
1157 default:
1158 }
1159 return
1160 }
1161 1162 // ImportPrivKeyGetRes returns a pointer to the value in the Result field
1163 func (a API) ImportPrivKeyGetRes() (out *None, e error) {
1164 out, _ = a.Result.(*None)
1165 e, _ = a.Result.(error)
1166 return
1167 }
1168 1169 // ImportPrivKeyWait calls the method and blocks until it returns or 5 seconds passes
1170 func (a API) ImportPrivKeyWait(cmd *btcjson.ImportPrivKeyCmd) (out *None, e error) {
1171 RPCHandlers["importprivkey"].Call <- API{a.Ch, cmd, nil}
1172 select {
1173 case <-time.After(time.Second*5):
1174 break
1175 case o := <- a.Ch.(chan ImportPrivKeyRes):
1176 out, e = o.Res, o.e
1177 }
1178 return
1179 }
1180 1181 // KeypoolRefill calls the method with the given parameters
1182 func (a API) KeypoolRefill(cmd *None) (e error) {
1183 RPCHandlers["keypoolrefill"].Call <- API{a.Ch, cmd, nil}
1184 return
1185 }
1186 1187 // KeypoolRefillCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1188 // storing the value in the Result field
1189 func (a API) KeypoolRefillCheck() (isNew bool) {
1190 select {
1191 case o := <- a.Ch.(chan KeypoolRefillRes):
1192 if o.e != nil {
1193 a.Result = o.e
1194 } else {
1195 a.Result = o.Res
1196 }
1197 isNew = true
1198 default:
1199 }
1200 return
1201 }
1202 1203 // KeypoolRefillGetRes returns a pointer to the value in the Result field
1204 func (a API) KeypoolRefillGetRes() (out *None, e error) {
1205 out, _ = a.Result.(*None)
1206 e, _ = a.Result.(error)
1207 return
1208 }
1209 1210 // KeypoolRefillWait calls the method and blocks until it returns or 5 seconds passes
1211 func (a API) KeypoolRefillWait(cmd *None) (out *None, e error) {
1212 RPCHandlers["keypoolrefill"].Call <- API{a.Ch, cmd, nil}
1213 select {
1214 case <-time.After(time.Second*5):
1215 break
1216 case o := <- a.Ch.(chan KeypoolRefillRes):
1217 out, e = o.Res, o.e
1218 }
1219 return
1220 }
1221 1222 // ListAccounts calls the method with the given parameters
1223 func (a API) ListAccounts(cmd *btcjson.ListAccountsCmd) (e error) {
1224 RPCHandlers["listaccounts"].Call <- API{a.Ch, cmd, nil}
1225 return
1226 }
1227 1228 // ListAccountsCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1229 // storing the value in the Result field
1230 func (a API) ListAccountsCheck() (isNew bool) {
1231 select {
1232 case o := <- a.Ch.(chan ListAccountsRes):
1233 if o.e != nil {
1234 a.Result = o.e
1235 } else {
1236 a.Result = o.Res
1237 }
1238 isNew = true
1239 default:
1240 }
1241 return
1242 }
1243 1244 // ListAccountsGetRes returns a pointer to the value in the Result field
1245 func (a API) ListAccountsGetRes() (out *map[string]float64, e error) {
1246 out, _ = a.Result.(*map[string]float64)
1247 e, _ = a.Result.(error)
1248 return
1249 }
1250 1251 // ListAccountsWait calls the method and blocks until it returns or 5 seconds passes
1252 func (a API) ListAccountsWait(cmd *btcjson.ListAccountsCmd) (out *map[string]float64, e error) {
1253 RPCHandlers["listaccounts"].Call <- API{a.Ch, cmd, nil}
1254 select {
1255 case <-time.After(time.Second*5):
1256 break
1257 case o := <- a.Ch.(chan ListAccountsRes):
1258 out, e = o.Res, o.e
1259 }
1260 return
1261 }
1262 1263 // ListAddressTransactions calls the method with the given parameters
1264 func (a API) ListAddressTransactions(cmd *btcjson.ListAddressTransactionsCmd) (e error) {
1265 RPCHandlers["listaddresstransactions"].Call <- API{a.Ch, cmd, nil}
1266 return
1267 }
1268 1269 // ListAddressTransactionsCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1270 // storing the value in the Result field
1271 func (a API) ListAddressTransactionsCheck() (isNew bool) {
1272 select {
1273 case o := <- a.Ch.(chan ListAddressTransactionsRes):
1274 if o.e != nil {
1275 a.Result = o.e
1276 } else {
1277 a.Result = o.Res
1278 }
1279 isNew = true
1280 default:
1281 }
1282 return
1283 }
1284 1285 // ListAddressTransactionsGetRes returns a pointer to the value in the Result field
1286 func (a API) ListAddressTransactionsGetRes() (out *[]btcjson.ListTransactionsResult, e error) {
1287 out, _ = a.Result.(*[]btcjson.ListTransactionsResult)
1288 e, _ = a.Result.(error)
1289 return
1290 }
1291 1292 // ListAddressTransactionsWait calls the method and blocks until it returns or 5 seconds passes
1293 func (a API) ListAddressTransactionsWait(cmd *btcjson.ListAddressTransactionsCmd) (out *[]btcjson.ListTransactionsResult, e error) {
1294 RPCHandlers["listaddresstransactions"].Call <- API{a.Ch, cmd, nil}
1295 select {
1296 case <-time.After(time.Second*5):
1297 break
1298 case o := <- a.Ch.(chan ListAddressTransactionsRes):
1299 out, e = o.Res, o.e
1300 }
1301 return
1302 }
1303 1304 // ListAllTransactions calls the method with the given parameters
1305 func (a API) ListAllTransactions(cmd *btcjson.ListAllTransactionsCmd) (e error) {
1306 RPCHandlers["listalltransactions"].Call <- API{a.Ch, cmd, nil}
1307 return
1308 }
1309 1310 // ListAllTransactionsCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1311 // storing the value in the Result field
1312 func (a API) ListAllTransactionsCheck() (isNew bool) {
1313 select {
1314 case o := <- a.Ch.(chan ListAllTransactionsRes):
1315 if o.e != nil {
1316 a.Result = o.e
1317 } else {
1318 a.Result = o.Res
1319 }
1320 isNew = true
1321 default:
1322 }
1323 return
1324 }
1325 1326 // ListAllTransactionsGetRes returns a pointer to the value in the Result field
1327 func (a API) ListAllTransactionsGetRes() (out *[]btcjson.ListTransactionsResult, e error) {
1328 out, _ = a.Result.(*[]btcjson.ListTransactionsResult)
1329 e, _ = a.Result.(error)
1330 return
1331 }
1332 1333 // ListAllTransactionsWait calls the method and blocks until it returns or 5 seconds passes
1334 func (a API) ListAllTransactionsWait(cmd *btcjson.ListAllTransactionsCmd) (out *[]btcjson.ListTransactionsResult, e error) {
1335 RPCHandlers["listalltransactions"].Call <- API{a.Ch, cmd, nil}
1336 select {
1337 case <-time.After(time.Second*5):
1338 break
1339 case o := <- a.Ch.(chan ListAllTransactionsRes):
1340 out, e = o.Res, o.e
1341 }
1342 return
1343 }
1344 1345 // ListLockUnspent calls the method with the given parameters
1346 func (a API) ListLockUnspent(cmd *None) (e error) {
1347 RPCHandlers["listlockunspent"].Call <- API{a.Ch, cmd, nil}
1348 return
1349 }
1350 1351 // ListLockUnspentCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1352 // storing the value in the Result field
1353 func (a API) ListLockUnspentCheck() (isNew bool) {
1354 select {
1355 case o := <- a.Ch.(chan ListLockUnspentRes):
1356 if o.e != nil {
1357 a.Result = o.e
1358 } else {
1359 a.Result = o.Res
1360 }
1361 isNew = true
1362 default:
1363 }
1364 return
1365 }
1366 1367 // ListLockUnspentGetRes returns a pointer to the value in the Result field
1368 func (a API) ListLockUnspentGetRes() (out *[]btcjson.TransactionInput, e error) {
1369 out, _ = a.Result.(*[]btcjson.TransactionInput)
1370 e, _ = a.Result.(error)
1371 return
1372 }
1373 1374 // ListLockUnspentWait calls the method and blocks until it returns or 5 seconds passes
1375 func (a API) ListLockUnspentWait(cmd *None) (out *[]btcjson.TransactionInput, e error) {
1376 RPCHandlers["listlockunspent"].Call <- API{a.Ch, cmd, nil}
1377 select {
1378 case <-time.After(time.Second*5):
1379 break
1380 case o := <- a.Ch.(chan ListLockUnspentRes):
1381 out, e = o.Res, o.e
1382 }
1383 return
1384 }
1385 1386 // ListReceivedByAccount calls the method with the given parameters
1387 func (a API) ListReceivedByAccount(cmd *btcjson.ListReceivedByAccountCmd) (e error) {
1388 RPCHandlers["listreceivedbyaccount"].Call <- API{a.Ch, cmd, nil}
1389 return
1390 }
1391 1392 // ListReceivedByAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1393 // storing the value in the Result field
1394 func (a API) ListReceivedByAccountCheck() (isNew bool) {
1395 select {
1396 case o := <- a.Ch.(chan ListReceivedByAccountRes):
1397 if o.e != nil {
1398 a.Result = o.e
1399 } else {
1400 a.Result = o.Res
1401 }
1402 isNew = true
1403 default:
1404 }
1405 return
1406 }
1407 1408 // ListReceivedByAccountGetRes returns a pointer to the value in the Result field
1409 func (a API) ListReceivedByAccountGetRes() (out *[]btcjson.ListReceivedByAccountResult, e error) {
1410 out, _ = a.Result.(*[]btcjson.ListReceivedByAccountResult)
1411 e, _ = a.Result.(error)
1412 return
1413 }
1414 1415 // ListReceivedByAccountWait calls the method and blocks until it returns or 5 seconds passes
1416 func (a API) ListReceivedByAccountWait(cmd *btcjson.ListReceivedByAccountCmd) (out *[]btcjson.ListReceivedByAccountResult, e error) {
1417 RPCHandlers["listreceivedbyaccount"].Call <- API{a.Ch, cmd, nil}
1418 select {
1419 case <-time.After(time.Second*5):
1420 break
1421 case o := <- a.Ch.(chan ListReceivedByAccountRes):
1422 out, e = o.Res, o.e
1423 }
1424 return
1425 }
1426 1427 // ListReceivedByAddress calls the method with the given parameters
1428 func (a API) ListReceivedByAddress(cmd *btcjson.ListReceivedByAddressCmd) (e error) {
1429 RPCHandlers["listreceivedbyaddress"].Call <- API{a.Ch, cmd, nil}
1430 return
1431 }
1432 1433 // ListReceivedByAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1434 // storing the value in the Result field
1435 func (a API) ListReceivedByAddressCheck() (isNew bool) {
1436 select {
1437 case o := <- a.Ch.(chan ListReceivedByAddressRes):
1438 if o.e != nil {
1439 a.Result = o.e
1440 } else {
1441 a.Result = o.Res
1442 }
1443 isNew = true
1444 default:
1445 }
1446 return
1447 }
1448 1449 // ListReceivedByAddressGetRes returns a pointer to the value in the Result field
1450 func (a API) ListReceivedByAddressGetRes() (out *btcjson.ListReceivedByAddressResult, e error) {
1451 out, _ = a.Result.(*btcjson.ListReceivedByAddressResult)
1452 e, _ = a.Result.(error)
1453 return
1454 }
1455 1456 // ListReceivedByAddressWait calls the method and blocks until it returns or 5 seconds passes
1457 func (a API) ListReceivedByAddressWait(cmd *btcjson.ListReceivedByAddressCmd) (out *btcjson.ListReceivedByAddressResult, e error) {
1458 RPCHandlers["listreceivedbyaddress"].Call <- API{a.Ch, cmd, nil}
1459 select {
1460 case <-time.After(time.Second*5):
1461 break
1462 case o := <- a.Ch.(chan ListReceivedByAddressRes):
1463 out, e = o.Res, o.e
1464 }
1465 return
1466 }
1467 1468 // ListSinceBlock calls the method with the given parameters
1469 func (a API) ListSinceBlock(cmd btcjson.ListSinceBlockCmd) (e error) {
1470 RPCHandlers["listsinceblock"].Call <- API{a.Ch, cmd, nil}
1471 return
1472 }
1473 1474 // ListSinceBlockCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1475 // storing the value in the Result field
1476 func (a API) ListSinceBlockCheck() (isNew bool) {
1477 select {
1478 case o := <- a.Ch.(chan ListSinceBlockRes):
1479 if o.e != nil {
1480 a.Result = o.e
1481 } else {
1482 a.Result = o.Res
1483 }
1484 isNew = true
1485 default:
1486 }
1487 return
1488 }
1489 1490 // ListSinceBlockGetRes returns a pointer to the value in the Result field
1491 func (a API) ListSinceBlockGetRes() (out *btcjson.ListSinceBlockResult, e error) {
1492 out, _ = a.Result.(*btcjson.ListSinceBlockResult)
1493 e, _ = a.Result.(error)
1494 return
1495 }
1496 1497 // ListSinceBlockWait calls the method and blocks until it returns or 5 seconds passes
1498 func (a API) ListSinceBlockWait(cmd btcjson.ListSinceBlockCmd) (out *btcjson.ListSinceBlockResult, e error) {
1499 RPCHandlers["listsinceblock"].Call <- API{a.Ch, cmd, nil}
1500 select {
1501 case <-time.After(time.Second*5):
1502 break
1503 case o := <- a.Ch.(chan ListSinceBlockRes):
1504 out, e = o.Res, o.e
1505 }
1506 return
1507 }
1508 1509 // ListTransactions calls the method with the given parameters
1510 func (a API) ListTransactions(cmd *btcjson.ListTransactionsCmd) (e error) {
1511 RPCHandlers["listtransactions"].Call <- API{a.Ch, cmd, nil}
1512 return
1513 }
1514 1515 // ListTransactionsCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1516 // storing the value in the Result field
1517 func (a API) ListTransactionsCheck() (isNew bool) {
1518 select {
1519 case o := <- a.Ch.(chan ListTransactionsRes):
1520 if o.e != nil {
1521 a.Result = o.e
1522 } else {
1523 a.Result = o.Res
1524 }
1525 isNew = true
1526 default:
1527 }
1528 return
1529 }
1530 1531 // ListTransactionsGetRes returns a pointer to the value in the Result field
1532 func (a API) ListTransactionsGetRes() (out *[]btcjson.ListTransactionsResult, e error) {
1533 out, _ = a.Result.(*[]btcjson.ListTransactionsResult)
1534 e, _ = a.Result.(error)
1535 return
1536 }
1537 1538 // ListTransactionsWait calls the method and blocks until it returns or 5 seconds passes
1539 func (a API) ListTransactionsWait(cmd *btcjson.ListTransactionsCmd) (out *[]btcjson.ListTransactionsResult, e error) {
1540 RPCHandlers["listtransactions"].Call <- API{a.Ch, cmd, nil}
1541 select {
1542 case <-time.After(time.Second*5):
1543 break
1544 case o := <- a.Ch.(chan ListTransactionsRes):
1545 out, e = o.Res, o.e
1546 }
1547 return
1548 }
1549 1550 // ListUnspent calls the method with the given parameters
1551 func (a API) ListUnspent(cmd *btcjson.ListUnspentCmd) (e error) {
1552 RPCHandlers["listunspent"].Call <- API{a.Ch, cmd, nil}
1553 return
1554 }
1555 1556 // ListUnspentCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1557 // storing the value in the Result field
1558 func (a API) ListUnspentCheck() (isNew bool) {
1559 select {
1560 case o := <- a.Ch.(chan ListUnspentRes):
1561 if o.e != nil {
1562 a.Result = o.e
1563 } else {
1564 a.Result = o.Res
1565 }
1566 isNew = true
1567 default:
1568 }
1569 return
1570 }
1571 1572 // ListUnspentGetRes returns a pointer to the value in the Result field
1573 func (a API) ListUnspentGetRes() (out *[]btcjson.ListUnspentResult, e error) {
1574 out, _ = a.Result.(*[]btcjson.ListUnspentResult)
1575 e, _ = a.Result.(error)
1576 return
1577 }
1578 1579 // ListUnspentWait calls the method and blocks until it returns or 5 seconds passes
1580 func (a API) ListUnspentWait(cmd *btcjson.ListUnspentCmd) (out *[]btcjson.ListUnspentResult, e error) {
1581 RPCHandlers["listunspent"].Call <- API{a.Ch, cmd, nil}
1582 select {
1583 case <-time.After(time.Second*5):
1584 break
1585 case o := <- a.Ch.(chan ListUnspentRes):
1586 out, e = o.Res, o.e
1587 }
1588 return
1589 }
1590 1591 // RenameAccount calls the method with the given parameters
1592 func (a API) RenameAccount(cmd *btcjson.RenameAccountCmd) (e error) {
1593 RPCHandlers["renameaccount"].Call <- API{a.Ch, cmd, nil}
1594 return
1595 }
1596 1597 // RenameAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1598 // storing the value in the Result field
1599 func (a API) RenameAccountCheck() (isNew bool) {
1600 select {
1601 case o := <- a.Ch.(chan RenameAccountRes):
1602 if o.e != nil {
1603 a.Result = o.e
1604 } else {
1605 a.Result = o.Res
1606 }
1607 isNew = true
1608 default:
1609 }
1610 return
1611 }
1612 1613 // RenameAccountGetRes returns a pointer to the value in the Result field
1614 func (a API) RenameAccountGetRes() (out *None, e error) {
1615 out, _ = a.Result.(*None)
1616 e, _ = a.Result.(error)
1617 return
1618 }
1619 1620 // RenameAccountWait calls the method and blocks until it returns or 5 seconds passes
1621 func (a API) RenameAccountWait(cmd *btcjson.RenameAccountCmd) (out *None, e error) {
1622 RPCHandlers["renameaccount"].Call <- API{a.Ch, cmd, nil}
1623 select {
1624 case <-time.After(time.Second*5):
1625 break
1626 case o := <- a.Ch.(chan RenameAccountRes):
1627 out, e = o.Res, o.e
1628 }
1629 return
1630 }
1631 1632 // LockUnspent calls the method with the given parameters
1633 func (a API) LockUnspent(cmd btcjson.LockUnspentCmd) (e error) {
1634 RPCHandlers["sendfrom"].Call <- API{a.Ch, cmd, nil}
1635 return
1636 }
1637 1638 // LockUnspentCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1639 // storing the value in the Result field
1640 func (a API) LockUnspentCheck() (isNew bool) {
1641 select {
1642 case o := <- a.Ch.(chan LockUnspentRes):
1643 if o.e != nil {
1644 a.Result = o.e
1645 } else {
1646 a.Result = o.Res
1647 }
1648 isNew = true
1649 default:
1650 }
1651 return
1652 }
1653 1654 // LockUnspentGetRes returns a pointer to the value in the Result field
1655 func (a API) LockUnspentGetRes() (out *bool, e error) {
1656 out, _ = a.Result.(*bool)
1657 e, _ = a.Result.(error)
1658 return
1659 }
1660 1661 // LockUnspentWait calls the method and blocks until it returns or 5 seconds passes
1662 func (a API) LockUnspentWait(cmd btcjson.LockUnspentCmd) (out *bool, e error) {
1663 RPCHandlers["sendfrom"].Call <- API{a.Ch, cmd, nil}
1664 select {
1665 case <-time.After(time.Second*5):
1666 break
1667 case o := <- a.Ch.(chan LockUnspentRes):
1668 out, e = o.Res, o.e
1669 }
1670 return
1671 }
1672 1673 // SendMany calls the method with the given parameters
1674 func (a API) SendMany(cmd *btcjson.SendManyCmd) (e error) {
1675 RPCHandlers["sendmany"].Call <- API{a.Ch, cmd, nil}
1676 return
1677 }
1678 1679 // SendManyCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1680 // storing the value in the Result field
1681 func (a API) SendManyCheck() (isNew bool) {
1682 select {
1683 case o := <- a.Ch.(chan SendManyRes):
1684 if o.e != nil {
1685 a.Result = o.e
1686 } else {
1687 a.Result = o.Res
1688 }
1689 isNew = true
1690 default:
1691 }
1692 return
1693 }
1694 1695 // SendManyGetRes returns a pointer to the value in the Result field
1696 func (a API) SendManyGetRes() (out *string, e error) {
1697 out, _ = a.Result.(*string)
1698 e, _ = a.Result.(error)
1699 return
1700 }
1701 1702 // SendManyWait calls the method and blocks until it returns or 5 seconds passes
1703 func (a API) SendManyWait(cmd *btcjson.SendManyCmd) (out *string, e error) {
1704 RPCHandlers["sendmany"].Call <- API{a.Ch, cmd, nil}
1705 select {
1706 case <-time.After(time.Second*5):
1707 break
1708 case o := <- a.Ch.(chan SendManyRes):
1709 out, e = o.Res, o.e
1710 }
1711 return
1712 }
1713 1714 // SendToAddress calls the method with the given parameters
1715 func (a API) SendToAddress(cmd *btcjson.SendToAddressCmd) (e error) {
1716 RPCHandlers["sendtoaddress"].Call <- API{a.Ch, cmd, nil}
1717 return
1718 }
1719 1720 // SendToAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1721 // storing the value in the Result field
1722 func (a API) SendToAddressCheck() (isNew bool) {
1723 select {
1724 case o := <- a.Ch.(chan SendToAddressRes):
1725 if o.e != nil {
1726 a.Result = o.e
1727 } else {
1728 a.Result = o.Res
1729 }
1730 isNew = true
1731 default:
1732 }
1733 return
1734 }
1735 1736 // SendToAddressGetRes returns a pointer to the value in the Result field
1737 func (a API) SendToAddressGetRes() (out *string, e error) {
1738 out, _ = a.Result.(*string)
1739 e, _ = a.Result.(error)
1740 return
1741 }
1742 1743 // SendToAddressWait calls the method and blocks until it returns or 5 seconds passes
1744 func (a API) SendToAddressWait(cmd *btcjson.SendToAddressCmd) (out *string, e error) {
1745 RPCHandlers["sendtoaddress"].Call <- API{a.Ch, cmd, nil}
1746 select {
1747 case <-time.After(time.Second*5):
1748 break
1749 case o := <- a.Ch.(chan SendToAddressRes):
1750 out, e = o.Res, o.e
1751 }
1752 return
1753 }
1754 1755 // SetTxFee calls the method with the given parameters
1756 func (a API) SetTxFee(cmd *btcjson.SetTxFeeCmd) (e error) {
1757 RPCHandlers["settxfee"].Call <- API{a.Ch, cmd, nil}
1758 return
1759 }
1760 1761 // SetTxFeeCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1762 // storing the value in the Result field
1763 func (a API) SetTxFeeCheck() (isNew bool) {
1764 select {
1765 case o := <- a.Ch.(chan SetTxFeeRes):
1766 if o.e != nil {
1767 a.Result = o.e
1768 } else {
1769 a.Result = o.Res
1770 }
1771 isNew = true
1772 default:
1773 }
1774 return
1775 }
1776 1777 // SetTxFeeGetRes returns a pointer to the value in the Result field
1778 func (a API) SetTxFeeGetRes() (out *bool, e error) {
1779 out, _ = a.Result.(*bool)
1780 e, _ = a.Result.(error)
1781 return
1782 }
1783 1784 // SetTxFeeWait calls the method and blocks until it returns or 5 seconds passes
1785 func (a API) SetTxFeeWait(cmd *btcjson.SetTxFeeCmd) (out *bool, e error) {
1786 RPCHandlers["settxfee"].Call <- API{a.Ch, cmd, nil}
1787 select {
1788 case <-time.After(time.Second*5):
1789 break
1790 case o := <- a.Ch.(chan SetTxFeeRes):
1791 out, e = o.Res, o.e
1792 }
1793 return
1794 }
1795 1796 // SignMessage calls the method with the given parameters
1797 func (a API) SignMessage(cmd *btcjson.SignMessageCmd) (e error) {
1798 RPCHandlers["signmessage"].Call <- API{a.Ch, cmd, nil}
1799 return
1800 }
1801 1802 // SignMessageCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1803 // storing the value in the Result field
1804 func (a API) SignMessageCheck() (isNew bool) {
1805 select {
1806 case o := <- a.Ch.(chan SignMessageRes):
1807 if o.e != nil {
1808 a.Result = o.e
1809 } else {
1810 a.Result = o.Res
1811 }
1812 isNew = true
1813 default:
1814 }
1815 return
1816 }
1817 1818 // SignMessageGetRes returns a pointer to the value in the Result field
1819 func (a API) SignMessageGetRes() (out *string, e error) {
1820 out, _ = a.Result.(*string)
1821 e, _ = a.Result.(error)
1822 return
1823 }
1824 1825 // SignMessageWait calls the method and blocks until it returns or 5 seconds passes
1826 func (a API) SignMessageWait(cmd *btcjson.SignMessageCmd) (out *string, e error) {
1827 RPCHandlers["signmessage"].Call <- API{a.Ch, cmd, nil}
1828 select {
1829 case <-time.After(time.Second*5):
1830 break
1831 case o := <- a.Ch.(chan SignMessageRes):
1832 out, e = o.Res, o.e
1833 }
1834 return
1835 }
1836 1837 // SignRawTransaction calls the method with the given parameters
1838 func (a API) SignRawTransaction(cmd btcjson.SignRawTransactionCmd) (e error) {
1839 RPCHandlers["signrawtransaction"].Call <- API{a.Ch, cmd, nil}
1840 return
1841 }
1842 1843 // SignRawTransactionCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1844 // storing the value in the Result field
1845 func (a API) SignRawTransactionCheck() (isNew bool) {
1846 select {
1847 case o := <- a.Ch.(chan SignRawTransactionRes):
1848 if o.e != nil {
1849 a.Result = o.e
1850 } else {
1851 a.Result = o.Res
1852 }
1853 isNew = true
1854 default:
1855 }
1856 return
1857 }
1858 1859 // SignRawTransactionGetRes returns a pointer to the value in the Result field
1860 func (a API) SignRawTransactionGetRes() (out *btcjson.SignRawTransactionResult, e error) {
1861 out, _ = a.Result.(*btcjson.SignRawTransactionResult)
1862 e, _ = a.Result.(error)
1863 return
1864 }
1865 1866 // SignRawTransactionWait calls the method and blocks until it returns or 5 seconds passes
1867 func (a API) SignRawTransactionWait(cmd btcjson.SignRawTransactionCmd) (out *btcjson.SignRawTransactionResult, e error) {
1868 RPCHandlers["signrawtransaction"].Call <- API{a.Ch, cmd, nil}
1869 select {
1870 case <-time.After(time.Second*5):
1871 break
1872 case o := <- a.Ch.(chan SignRawTransactionRes):
1873 out, e = o.Res, o.e
1874 }
1875 return
1876 }
1877 1878 // ValidateAddress calls the method with the given parameters
1879 func (a API) ValidateAddress(cmd *btcjson.ValidateAddressCmd) (e error) {
1880 RPCHandlers["validateaddress"].Call <- API{a.Ch, cmd, nil}
1881 return
1882 }
1883 1884 // ValidateAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1885 // storing the value in the Result field
1886 func (a API) ValidateAddressCheck() (isNew bool) {
1887 select {
1888 case o := <- a.Ch.(chan ValidateAddressRes):
1889 if o.e != nil {
1890 a.Result = o.e
1891 } else {
1892 a.Result = o.Res
1893 }
1894 isNew = true
1895 default:
1896 }
1897 return
1898 }
1899 1900 // ValidateAddressGetRes returns a pointer to the value in the Result field
1901 func (a API) ValidateAddressGetRes() (out *btcjson.ValidateAddressWalletResult, e error) {
1902 out, _ = a.Result.(*btcjson.ValidateAddressWalletResult)
1903 e, _ = a.Result.(error)
1904 return
1905 }
1906 1907 // ValidateAddressWait calls the method and blocks until it returns or 5 seconds passes
1908 func (a API) ValidateAddressWait(cmd *btcjson.ValidateAddressCmd) (out *btcjson.ValidateAddressWalletResult, e error) {
1909 RPCHandlers["validateaddress"].Call <- API{a.Ch, cmd, nil}
1910 select {
1911 case <-time.After(time.Second*5):
1912 break
1913 case o := <- a.Ch.(chan ValidateAddressRes):
1914 out, e = o.Res, o.e
1915 }
1916 return
1917 }
1918 1919 // VerifyMessage calls the method with the given parameters
1920 func (a API) VerifyMessage(cmd *btcjson.VerifyMessageCmd) (e error) {
1921 RPCHandlers["verifymessage"].Call <- API{a.Ch, cmd, nil}
1922 return
1923 }
1924 1925 // VerifyMessageCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1926 // storing the value in the Result field
1927 func (a API) VerifyMessageCheck() (isNew bool) {
1928 select {
1929 case o := <- a.Ch.(chan VerifyMessageRes):
1930 if o.e != nil {
1931 a.Result = o.e
1932 } else {
1933 a.Result = o.Res
1934 }
1935 isNew = true
1936 default:
1937 }
1938 return
1939 }
1940 1941 // VerifyMessageGetRes returns a pointer to the value in the Result field
1942 func (a API) VerifyMessageGetRes() (out *bool, e error) {
1943 out, _ = a.Result.(*bool)
1944 e, _ = a.Result.(error)
1945 return
1946 }
1947 1948 // VerifyMessageWait calls the method and blocks until it returns or 5 seconds passes
1949 func (a API) VerifyMessageWait(cmd *btcjson.VerifyMessageCmd) (out *bool, e error) {
1950 RPCHandlers["verifymessage"].Call <- API{a.Ch, cmd, nil}
1951 select {
1952 case <-time.After(time.Second*5):
1953 break
1954 case o := <- a.Ch.(chan VerifyMessageRes):
1955 out, e = o.Res, o.e
1956 }
1957 return
1958 }
1959 1960 // WalletIsLocked calls the method with the given parameters
1961 func (a API) WalletIsLocked(cmd *None) (e error) {
1962 RPCHandlers["walletislocked"].Call <- API{a.Ch, cmd, nil}
1963 return
1964 }
1965 1966 // WalletIsLockedCheck checks if a new message arrived on the result channel and returns true if it does, as well as
1967 // storing the value in the Result field
1968 func (a API) WalletIsLockedCheck() (isNew bool) {
1969 select {
1970 case o := <- a.Ch.(chan WalletIsLockedRes):
1971 if o.e != nil {
1972 a.Result = o.e
1973 } else {
1974 a.Result = o.Res
1975 }
1976 isNew = true
1977 default:
1978 }
1979 return
1980 }
1981 1982 // WalletIsLockedGetRes returns a pointer to the value in the Result field
1983 func (a API) WalletIsLockedGetRes() (out *bool, e error) {
1984 out, _ = a.Result.(*bool)
1985 e, _ = a.Result.(error)
1986 return
1987 }
1988 1989 // WalletIsLockedWait calls the method and blocks until it returns or 5 seconds passes
1990 func (a API) WalletIsLockedWait(cmd *None) (out *bool, e error) {
1991 RPCHandlers["walletislocked"].Call <- API{a.Ch, cmd, nil}
1992 select {
1993 case <-time.After(time.Second*5):
1994 break
1995 case o := <- a.Ch.(chan WalletIsLockedRes):
1996 out, e = o.Res, o.e
1997 }
1998 return
1999 }
2000 2001 // WalletLock calls the method with the given parameters
2002 func (a API) WalletLock(cmd *None) (e error) {
2003 RPCHandlers["walletlock"].Call <- API{a.Ch, cmd, nil}
2004 return
2005 }
2006 2007 // WalletLockCheck checks if a new message arrived on the result channel and returns true if it does, as well as
2008 // storing the value in the Result field
2009 func (a API) WalletLockCheck() (isNew bool) {
2010 select {
2011 case o := <- a.Ch.(chan WalletLockRes):
2012 if o.e != nil {
2013 a.Result = o.e
2014 } else {
2015 a.Result = o.Res
2016 }
2017 isNew = true
2018 default:
2019 }
2020 return
2021 }
2022 2023 // WalletLockGetRes returns a pointer to the value in the Result field
2024 func (a API) WalletLockGetRes() (out *None, e error) {
2025 out, _ = a.Result.(*None)
2026 e, _ = a.Result.(error)
2027 return
2028 }
2029 2030 // WalletLockWait calls the method and blocks until it returns or 5 seconds passes
2031 func (a API) WalletLockWait(cmd *None) (out *None, e error) {
2032 RPCHandlers["walletlock"].Call <- API{a.Ch, cmd, nil}
2033 select {
2034 case <-time.After(time.Second*5):
2035 break
2036 case o := <- a.Ch.(chan WalletLockRes):
2037 out, e = o.Res, o.e
2038 }
2039 return
2040 }
2041 2042 // WalletPassphrase calls the method with the given parameters
2043 func (a API) WalletPassphrase(cmd *btcjson.WalletPassphraseCmd) (e error) {
2044 RPCHandlers["walletpassphrase"].Call <- API{a.Ch, cmd, nil}
2045 return
2046 }
2047 2048 // WalletPassphraseCheck checks if a new message arrived on the result channel and returns true if it does, as well as
2049 // storing the value in the Result field
2050 func (a API) WalletPassphraseCheck() (isNew bool) {
2051 select {
2052 case o := <- a.Ch.(chan WalletPassphraseRes):
2053 if o.e != nil {
2054 a.Result = o.e
2055 } else {
2056 a.Result = o.Res
2057 }
2058 isNew = true
2059 default:
2060 }
2061 return
2062 }
2063 2064 // WalletPassphraseGetRes returns a pointer to the value in the Result field
2065 func (a API) WalletPassphraseGetRes() (out *None, e error) {
2066 out, _ = a.Result.(*None)
2067 e, _ = a.Result.(error)
2068 return
2069 }
2070 2071 // WalletPassphraseWait calls the method and blocks until it returns or 5 seconds passes
2072 func (a API) WalletPassphraseWait(cmd *btcjson.WalletPassphraseCmd) (out *None, e error) {
2073 RPCHandlers["walletpassphrase"].Call <- API{a.Ch, cmd, nil}
2074 select {
2075 case <-time.After(time.Second*5):
2076 break
2077 case o := <- a.Ch.(chan WalletPassphraseRes):
2078 out, e = o.Res, o.e
2079 }
2080 return
2081 }
2082 2083 // WalletPassphraseChange calls the method with the given parameters
2084 func (a API) WalletPassphraseChange(cmd *btcjson.WalletPassphraseChangeCmd) (e error) {
2085 RPCHandlers["walletpassphrasechange"].Call <- API{a.Ch, cmd, nil}
2086 return
2087 }
2088 2089 // WalletPassphraseChangeCheck checks if a new message arrived on the result channel and returns true if it does, as well as
2090 // storing the value in the Result field
2091 func (a API) WalletPassphraseChangeCheck() (isNew bool) {
2092 select {
2093 case o := <- a.Ch.(chan WalletPassphraseChangeRes):
2094 if o.e != nil {
2095 a.Result = o.e
2096 } else {
2097 a.Result = o.Res
2098 }
2099 isNew = true
2100 default:
2101 }
2102 return
2103 }
2104 2105 // WalletPassphraseChangeGetRes returns a pointer to the value in the Result field
2106 func (a API) WalletPassphraseChangeGetRes() (out *None, e error) {
2107 out, _ = a.Result.(*None)
2108 e, _ = a.Result.(error)
2109 return
2110 }
2111 2112 // WalletPassphraseChangeWait calls the method and blocks until it returns or 5 seconds passes
2113 func (a API) WalletPassphraseChangeWait(cmd *btcjson.WalletPassphraseChangeCmd) (out *None, e error) {
2114 RPCHandlers["walletpassphrasechange"].Call <- API{a.Ch, cmd, nil}
2115 select {
2116 case <-time.After(time.Second*5):
2117 break
2118 case o := <- a.Ch.(chan WalletPassphraseChangeRes):
2119 out, e = o.Res, o.e
2120 }
2121 return
2122 }
2123 2124 2125 // RunAPI starts up the api handler server that receives rpc.API messages and runs the handler and returns the result
2126 // Note that the parameters are type asserted to prevent the consumer of the API from sending wrong message types not
2127 // because it's necessary since they are interfaces end to end
2128 func RunAPI(chainRPC *chainclient.RPCClient, wallet *Wallet,
2129 quit qu.C) {
2130 nrh := RPCHandlers
2131 go func() {
2132 D.Ln("starting up wallet cAPI")
2133 var e error
2134 var res interface{}
2135 for {
2136 select {
2137 case msg := <-nrh["addmultisigaddress"].Call:
2138 if res, e = nrh["addmultisigaddress"].
2139 Handler(msg.Params.(*btcjson.AddMultisigAddressCmd), wallet,
2140 chainRPC); E.Chk(e) {
2141 }
2142 if r, ok := res.(string); ok {
2143 msg.Ch.(chan AddMultiSigAddressRes) <- AddMultiSigAddressRes{&r, e} }
2144 case msg := <-nrh["createmultisig"].Call:
2145 if res, e = nrh["createmultisig"].
2146 Handler(msg.Params.(*btcjson.CreateMultisigCmd), wallet,
2147 chainRPC); E.Chk(e) {
2148 }
2149 if r, ok := res.(btcjson.CreateMultiSigResult); ok {
2150 msg.Ch.(chan CreateMultiSigRes) <- CreateMultiSigRes{&r, e} }
2151 case msg := <-nrh["createnewaccount"].Call:
2152 if res, e = nrh["createnewaccount"].
2153 Handler(msg.Params.(*btcjson.CreateNewAccountCmd), wallet,
2154 chainRPC); E.Chk(e) {
2155 }
2156 if r, ok := res.(None); ok {
2157 msg.Ch.(chan CreateNewAccountRes) <- CreateNewAccountRes{&r, e} }
2158 case msg := <-nrh["dropwallethistory"].Call:
2159 if res, e = nrh["dropwallethistory"].
2160 Handler(msg.Params.(*None), wallet,
2161 chainRPC); E.Chk(e) {
2162 }
2163 if r, ok := res.(string); ok {
2164 msg.Ch.(chan HandleDropWalletHistoryRes) <- HandleDropWalletHistoryRes{&r, e} }
2165 case msg := <-nrh["dumpprivkey"].Call:
2166 if res, e = nrh["dumpprivkey"].
2167 Handler(msg.Params.(*btcjson.DumpPrivKeyCmd), wallet,
2168 chainRPC); E.Chk(e) {
2169 }
2170 if r, ok := res.(string); ok {
2171 msg.Ch.(chan DumpPrivKeyRes) <- DumpPrivKeyRes{&r, e} }
2172 case msg := <-nrh["getaccount"].Call:
2173 if res, e = nrh["getaccount"].
2174 Handler(msg.Params.(*btcjson.GetAccountCmd), wallet,
2175 chainRPC); E.Chk(e) {
2176 }
2177 if r, ok := res.(string); ok {
2178 msg.Ch.(chan GetAccountRes) <- GetAccountRes{&r, e} }
2179 case msg := <-nrh["getaccountaddress"].Call:
2180 if res, e = nrh["getaccountaddress"].
2181 Handler(msg.Params.(*btcjson.GetAccountAddressCmd), wallet,
2182 chainRPC); E.Chk(e) {
2183 }
2184 if r, ok := res.(string); ok {
2185 msg.Ch.(chan GetAccountAddressRes) <- GetAccountAddressRes{&r, e} }
2186 case msg := <-nrh["getaddressesbyaccount"].Call:
2187 if res, e = nrh["getaddressesbyaccount"].
2188 Handler(msg.Params.(*btcjson.GetAddressesByAccountCmd), wallet,
2189 chainRPC); E.Chk(e) {
2190 }
2191 if r, ok := res.([]string); ok {
2192 msg.Ch.(chan GetAddressesByAccountRes) <- GetAddressesByAccountRes{&r, e} }
2193 case msg := <-nrh["getbalance"].Call:
2194 if res, e = nrh["getbalance"].
2195 Handler(msg.Params.(*btcjson.GetBalanceCmd), wallet,
2196 chainRPC); E.Chk(e) {
2197 }
2198 if r, ok := res.(float64); ok {
2199 msg.Ch.(chan GetBalanceRes) <- GetBalanceRes{&r, e} }
2200 case msg := <-nrh["getbestblock"].Call:
2201 if res, e = nrh["getbestblock"].
2202 Handler(msg.Params.(*None), wallet,
2203 chainRPC); E.Chk(e) {
2204 }
2205 if r, ok := res.(btcjson.GetBestBlockResult); ok {
2206 msg.Ch.(chan GetBestBlockRes) <- GetBestBlockRes{&r, e} }
2207 case msg := <-nrh["getbestblockhash"].Call:
2208 if res, e = nrh["getbestblockhash"].
2209 Handler(msg.Params.(*None), wallet,
2210 chainRPC); E.Chk(e) {
2211 }
2212 if r, ok := res.(string); ok {
2213 msg.Ch.(chan GetBestBlockHashRes) <- GetBestBlockHashRes{&r, e} }
2214 case msg := <-nrh["getblockcount"].Call:
2215 if res, e = nrh["getblockcount"].
2216 Handler(msg.Params.(*None), wallet,
2217 chainRPC); E.Chk(e) {
2218 }
2219 if r, ok := res.(int32); ok {
2220 msg.Ch.(chan GetBlockCountRes) <- GetBlockCountRes{&r, e} }
2221 case msg := <-nrh["getinfo"].Call:
2222 if res, e = nrh["getinfo"].
2223 Handler(msg.Params.(*None), wallet,
2224 chainRPC); E.Chk(e) {
2225 }
2226 if r, ok := res.(btcjson.InfoWalletResult); ok {
2227 msg.Ch.(chan GetInfoRes) <- GetInfoRes{&r, e} }
2228 case msg := <-nrh["getnewaddress"].Call:
2229 if res, e = nrh["getnewaddress"].
2230 Handler(msg.Params.(*btcjson.GetNewAddressCmd), wallet,
2231 chainRPC); E.Chk(e) {
2232 }
2233 if r, ok := res.(string); ok {
2234 msg.Ch.(chan GetNewAddressRes) <- GetNewAddressRes{&r, e} }
2235 case msg := <-nrh["getrawchangeaddress"].Call:
2236 if res, e = nrh["getrawchangeaddress"].
2237 Handler(msg.Params.(*btcjson.GetRawChangeAddressCmd), wallet,
2238 chainRPC); E.Chk(e) {
2239 }
2240 if r, ok := res.(string); ok {
2241 msg.Ch.(chan GetRawChangeAddressRes) <- GetRawChangeAddressRes{&r, e} }
2242 case msg := <-nrh["getreceivedbyaccount"].Call:
2243 if res, e = nrh["getreceivedbyaccount"].
2244 Handler(msg.Params.(*btcjson.GetReceivedByAccountCmd), wallet,
2245 chainRPC); E.Chk(e) {
2246 }
2247 if r, ok := res.(float64); ok {
2248 msg.Ch.(chan GetReceivedByAccountRes) <- GetReceivedByAccountRes{&r, e} }
2249 case msg := <-nrh["getreceivedbyaddress"].Call:
2250 if res, e = nrh["getreceivedbyaddress"].
2251 Handler(msg.Params.(*btcjson.GetReceivedByAddressCmd), wallet,
2252 chainRPC); E.Chk(e) {
2253 }
2254 if r, ok := res.(float64); ok {
2255 msg.Ch.(chan GetReceivedByAddressRes) <- GetReceivedByAddressRes{&r, e} }
2256 case msg := <-nrh["gettransaction"].Call:
2257 if res, e = nrh["gettransaction"].
2258 Handler(msg.Params.(*btcjson.GetTransactionCmd), wallet,
2259 chainRPC); E.Chk(e) {
2260 }
2261 if r, ok := res.(btcjson.GetTransactionResult); ok {
2262 msg.Ch.(chan GetTransactionRes) <- GetTransactionRes{&r, e} }
2263 case msg := <-nrh["getunconfirmedbalance"].Call:
2264 if res, e = nrh["getunconfirmedbalance"].
2265 Handler(msg.Params.(*btcjson.GetUnconfirmedBalanceCmd), wallet,
2266 chainRPC); E.Chk(e) {
2267 }
2268 if r, ok := res.(float64); ok {
2269 msg.Ch.(chan GetUnconfirmedBalanceRes) <- GetUnconfirmedBalanceRes{&r, e} }
2270 case msg := <-nrh["help"].Call:
2271 if res, e = nrh["help"].
2272 Handler(msg.Params.(btcjson.HelpCmd), wallet,
2273 chainRPC); E.Chk(e) {
2274 }
2275 if r, ok := res.(string); ok {
2276 msg.Ch.(chan HelpNoChainRPCRes) <- HelpNoChainRPCRes{&r, e} }
2277 case msg := <-nrh["importprivkey"].Call:
2278 if res, e = nrh["importprivkey"].
2279 Handler(msg.Params.(*btcjson.ImportPrivKeyCmd), wallet,
2280 chainRPC); E.Chk(e) {
2281 }
2282 if r, ok := res.(None); ok {
2283 msg.Ch.(chan ImportPrivKeyRes) <- ImportPrivKeyRes{&r, e} }
2284 case msg := <-nrh["keypoolrefill"].Call:
2285 if res, e = nrh["keypoolrefill"].
2286 Handler(msg.Params.(*None), wallet,
2287 chainRPC); E.Chk(e) {
2288 }
2289 if r, ok := res.(None); ok {
2290 msg.Ch.(chan KeypoolRefillRes) <- KeypoolRefillRes{&r, e} }
2291 case msg := <-nrh["listaccounts"].Call:
2292 if res, e = nrh["listaccounts"].
2293 Handler(msg.Params.(*btcjson.ListAccountsCmd), wallet,
2294 chainRPC); E.Chk(e) {
2295 }
2296 if r, ok := res.(map[string]float64); ok {
2297 msg.Ch.(chan ListAccountsRes) <- ListAccountsRes{&r, e} }
2298 case msg := <-nrh["listaddresstransactions"].Call:
2299 if res, e = nrh["listaddresstransactions"].
2300 Handler(msg.Params.(*btcjson.ListAddressTransactionsCmd), wallet,
2301 chainRPC); E.Chk(e) {
2302 }
2303 if r, ok := res.([]btcjson.ListTransactionsResult); ok {
2304 msg.Ch.(chan ListAddressTransactionsRes) <- ListAddressTransactionsRes{&r, e} }
2305 case msg := <-nrh["listalltransactions"].Call:
2306 if res, e = nrh["listalltransactions"].
2307 Handler(msg.Params.(*btcjson.ListAllTransactionsCmd), wallet,
2308 chainRPC); E.Chk(e) {
2309 }
2310 if r, ok := res.([]btcjson.ListTransactionsResult); ok {
2311 msg.Ch.(chan ListAllTransactionsRes) <- ListAllTransactionsRes{&r, e} }
2312 case msg := <-nrh["listlockunspent"].Call:
2313 if res, e = nrh["listlockunspent"].
2314 Handler(msg.Params.(*None), wallet,
2315 chainRPC); E.Chk(e) {
2316 }
2317 if r, ok := res.([]btcjson.TransactionInput); ok {
2318 msg.Ch.(chan ListLockUnspentRes) <- ListLockUnspentRes{&r, e} }
2319 case msg := <-nrh["listreceivedbyaccount"].Call:
2320 if res, e = nrh["listreceivedbyaccount"].
2321 Handler(msg.Params.(*btcjson.ListReceivedByAccountCmd), wallet,
2322 chainRPC); E.Chk(e) {
2323 }
2324 if r, ok := res.([]btcjson.ListReceivedByAccountResult); ok {
2325 msg.Ch.(chan ListReceivedByAccountRes) <- ListReceivedByAccountRes{&r, e} }
2326 case msg := <-nrh["listreceivedbyaddress"].Call:
2327 if res, e = nrh["listreceivedbyaddress"].
2328 Handler(msg.Params.(*btcjson.ListReceivedByAddressCmd), wallet,
2329 chainRPC); E.Chk(e) {
2330 }
2331 if r, ok := res.(btcjson.ListReceivedByAddressResult); ok {
2332 msg.Ch.(chan ListReceivedByAddressRes) <- ListReceivedByAddressRes{&r, e} }
2333 case msg := <-nrh["listsinceblock"].Call:
2334 if res, e = nrh["listsinceblock"].
2335 Handler(msg.Params.(btcjson.ListSinceBlockCmd), wallet,
2336 chainRPC); E.Chk(e) {
2337 }
2338 if r, ok := res.(btcjson.ListSinceBlockResult); ok {
2339 msg.Ch.(chan ListSinceBlockRes) <- ListSinceBlockRes{&r, e} }
2340 case msg := <-nrh["listtransactions"].Call:
2341 if res, e = nrh["listtransactions"].
2342 Handler(msg.Params.(*btcjson.ListTransactionsCmd), wallet,
2343 chainRPC); E.Chk(e) {
2344 }
2345 if r, ok := res.([]btcjson.ListTransactionsResult); ok {
2346 msg.Ch.(chan ListTransactionsRes) <- ListTransactionsRes{&r, e} }
2347 case msg := <-nrh["listunspent"].Call:
2348 if res, e = nrh["listunspent"].
2349 Handler(msg.Params.(*btcjson.ListUnspentCmd), wallet,
2350 chainRPC); E.Chk(e) {
2351 }
2352 if r, ok := res.([]btcjson.ListUnspentResult); ok {
2353 msg.Ch.(chan ListUnspentRes) <- ListUnspentRes{&r, e} }
2354 case msg := <-nrh["renameaccount"].Call:
2355 if res, e = nrh["renameaccount"].
2356 Handler(msg.Params.(*btcjson.RenameAccountCmd), wallet,
2357 chainRPC); E.Chk(e) {
2358 }
2359 if r, ok := res.(None); ok {
2360 msg.Ch.(chan RenameAccountRes) <- RenameAccountRes{&r, e} }
2361 case msg := <-nrh["sendfrom"].Call:
2362 if res, e = nrh["sendfrom"].
2363 Handler(msg.Params.(btcjson.LockUnspentCmd), wallet,
2364 chainRPC); E.Chk(e) {
2365 }
2366 if r, ok := res.(bool); ok {
2367 msg.Ch.(chan LockUnspentRes) <- LockUnspentRes{&r, e} }
2368 case msg := <-nrh["sendmany"].Call:
2369 if res, e = nrh["sendmany"].
2370 Handler(msg.Params.(*btcjson.SendManyCmd), wallet,
2371 chainRPC); E.Chk(e) {
2372 }
2373 if r, ok := res.(string); ok {
2374 msg.Ch.(chan SendManyRes) <- SendManyRes{&r, e} }
2375 case msg := <-nrh["sendtoaddress"].Call:
2376 if res, e = nrh["sendtoaddress"].
2377 Handler(msg.Params.(*btcjson.SendToAddressCmd), wallet,
2378 chainRPC); E.Chk(e) {
2379 }
2380 if r, ok := res.(string); ok {
2381 msg.Ch.(chan SendToAddressRes) <- SendToAddressRes{&r, e} }
2382 case msg := <-nrh["settxfee"].Call:
2383 if res, e = nrh["settxfee"].
2384 Handler(msg.Params.(*btcjson.SetTxFeeCmd), wallet,
2385 chainRPC); E.Chk(e) {
2386 }
2387 if r, ok := res.(bool); ok {
2388 msg.Ch.(chan SetTxFeeRes) <- SetTxFeeRes{&r, e} }
2389 case msg := <-nrh["signmessage"].Call:
2390 if res, e = nrh["signmessage"].
2391 Handler(msg.Params.(*btcjson.SignMessageCmd), wallet,
2392 chainRPC); E.Chk(e) {
2393 }
2394 if r, ok := res.(string); ok {
2395 msg.Ch.(chan SignMessageRes) <- SignMessageRes{&r, e} }
2396 case msg := <-nrh["signrawtransaction"].Call:
2397 if res, e = nrh["signrawtransaction"].
2398 Handler(msg.Params.(btcjson.SignRawTransactionCmd), wallet,
2399 chainRPC); E.Chk(e) {
2400 }
2401 if r, ok := res.(btcjson.SignRawTransactionResult); ok {
2402 msg.Ch.(chan SignRawTransactionRes) <- SignRawTransactionRes{&r, e} }
2403 case msg := <-nrh["validateaddress"].Call:
2404 if res, e = nrh["validateaddress"].
2405 Handler(msg.Params.(*btcjson.ValidateAddressCmd), wallet,
2406 chainRPC); E.Chk(e) {
2407 }
2408 if r, ok := res.(btcjson.ValidateAddressWalletResult); ok {
2409 msg.Ch.(chan ValidateAddressRes) <- ValidateAddressRes{&r, e} }
2410 case msg := <-nrh["verifymessage"].Call:
2411 if res, e = nrh["verifymessage"].
2412 Handler(msg.Params.(*btcjson.VerifyMessageCmd), wallet,
2413 chainRPC); E.Chk(e) {
2414 }
2415 if r, ok := res.(bool); ok {
2416 msg.Ch.(chan VerifyMessageRes) <- VerifyMessageRes{&r, e} }
2417 case msg := <-nrh["walletislocked"].Call:
2418 if res, e = nrh["walletislocked"].
2419 Handler(msg.Params.(*None), wallet,
2420 chainRPC); E.Chk(e) {
2421 }
2422 if r, ok := res.(bool); ok {
2423 msg.Ch.(chan WalletIsLockedRes) <- WalletIsLockedRes{&r, e} }
2424 case msg := <-nrh["walletlock"].Call:
2425 if res, e = nrh["walletlock"].
2426 Handler(msg.Params.(*None), wallet,
2427 chainRPC); E.Chk(e) {
2428 }
2429 if r, ok := res.(None); ok {
2430 msg.Ch.(chan WalletLockRes) <- WalletLockRes{&r, e} }
2431 case msg := <-nrh["walletpassphrase"].Call:
2432 if res, e = nrh["walletpassphrase"].
2433 Handler(msg.Params.(*btcjson.WalletPassphraseCmd), wallet,
2434 chainRPC); E.Chk(e) {
2435 }
2436 if r, ok := res.(None); ok {
2437 msg.Ch.(chan WalletPassphraseRes) <- WalletPassphraseRes{&r, e} }
2438 case msg := <-nrh["walletpassphrasechange"].Call:
2439 if res, e = nrh["walletpassphrasechange"].
2440 Handler(msg.Params.(*btcjson.WalletPassphraseChangeCmd), wallet,
2441 chainRPC); E.Chk(e) {
2442 }
2443 if r, ok := res.(None); ok {
2444 msg.Ch.(chan WalletPassphraseChangeRes) <- WalletPassphraseChangeRes{&r, e} }
2445 case <-quit.Wait():
2446 D.Ln("stopping wallet cAPI")
2447 return
2448 }
2449 }
2450 }()
2451 }
2452 2453 // RPC API functions to use with net/rpc
2454 2455 func (c *CAPI) AddMultiSigAddress(req *btcjson.AddMultisigAddressCmd, resp string) (e error) {
2456 nrh := RPCHandlers
2457 res := nrh["addmultisigaddress"].Result()
2458 res.Params = req
2459 nrh["addmultisigaddress"].Call <- res
2460 select {
2461 case resp = <-res.Ch.(chan string):
2462 case <-time.After(c.Timeout):
2463 case <-c.quit.Wait():
2464 }
2465 return
2466 }
2467 2468 func (c *CAPI) CreateMultiSig(req *btcjson.CreateMultisigCmd, resp btcjson.CreateMultiSigResult) (e error) {
2469 nrh := RPCHandlers
2470 res := nrh["createmultisig"].Result()
2471 res.Params = req
2472 nrh["createmultisig"].Call <- res
2473 select {
2474 case resp = <-res.Ch.(chan btcjson.CreateMultiSigResult):
2475 case <-time.After(c.Timeout):
2476 case <-c.quit.Wait():
2477 }
2478 return
2479 }
2480 2481 func (c *CAPI) CreateNewAccount(req *btcjson.CreateNewAccountCmd, resp None) (e error) {
2482 nrh := RPCHandlers
2483 res := nrh["createnewaccount"].Result()
2484 res.Params = req
2485 nrh["createnewaccount"].Call <- res
2486 select {
2487 case resp = <-res.Ch.(chan None):
2488 case <-time.After(c.Timeout):
2489 case <-c.quit.Wait():
2490 }
2491 return
2492 }
2493 2494 func (c *CAPI) HandleDropWalletHistory(req *None, resp string) (e error) {
2495 nrh := RPCHandlers
2496 res := nrh["dropwallethistory"].Result()
2497 res.Params = req
2498 nrh["dropwallethistory"].Call <- res
2499 select {
2500 case resp = <-res.Ch.(chan string):
2501 case <-time.After(c.Timeout):
2502 case <-c.quit.Wait():
2503 }
2504 return
2505 }
2506 2507 func (c *CAPI) DumpPrivKey(req *btcjson.DumpPrivKeyCmd, resp string) (e error) {
2508 nrh := RPCHandlers
2509 res := nrh["dumpprivkey"].Result()
2510 res.Params = req
2511 nrh["dumpprivkey"].Call <- res
2512 select {
2513 case resp = <-res.Ch.(chan string):
2514 case <-time.After(c.Timeout):
2515 case <-c.quit.Wait():
2516 }
2517 return
2518 }
2519 2520 func (c *CAPI) GetAccount(req *btcjson.GetAccountCmd, resp string) (e error) {
2521 nrh := RPCHandlers
2522 res := nrh["getaccount"].Result()
2523 res.Params = req
2524 nrh["getaccount"].Call <- res
2525 select {
2526 case resp = <-res.Ch.(chan string):
2527 case <-time.After(c.Timeout):
2528 case <-c.quit.Wait():
2529 }
2530 return
2531 }
2532 2533 func (c *CAPI) GetAccountAddress(req *btcjson.GetAccountAddressCmd, resp string) (e error) {
2534 nrh := RPCHandlers
2535 res := nrh["getaccountaddress"].Result()
2536 res.Params = req
2537 nrh["getaccountaddress"].Call <- res
2538 select {
2539 case resp = <-res.Ch.(chan string):
2540 case <-time.After(c.Timeout):
2541 case <-c.quit.Wait():
2542 }
2543 return
2544 }
2545 2546 func (c *CAPI) GetAddressesByAccount(req *btcjson.GetAddressesByAccountCmd, resp []string) (e error) {
2547 nrh := RPCHandlers
2548 res := nrh["getaddressesbyaccount"].Result()
2549 res.Params = req
2550 nrh["getaddressesbyaccount"].Call <- res
2551 select {
2552 case resp = <-res.Ch.(chan []string):
2553 case <-time.After(c.Timeout):
2554 case <-c.quit.Wait():
2555 }
2556 return
2557 }
2558 2559 func (c *CAPI) GetBalance(req *btcjson.GetBalanceCmd, resp float64) (e error) {
2560 nrh := RPCHandlers
2561 res := nrh["getbalance"].Result()
2562 res.Params = req
2563 nrh["getbalance"].Call <- res
2564 select {
2565 case resp = <-res.Ch.(chan float64):
2566 case <-time.After(c.Timeout):
2567 case <-c.quit.Wait():
2568 }
2569 return
2570 }
2571 2572 func (c *CAPI) GetBestBlock(req *None, resp btcjson.GetBestBlockResult) (e error) {
2573 nrh := RPCHandlers
2574 res := nrh["getbestblock"].Result()
2575 res.Params = req
2576 nrh["getbestblock"].Call <- res
2577 select {
2578 case resp = <-res.Ch.(chan btcjson.GetBestBlockResult):
2579 case <-time.After(c.Timeout):
2580 case <-c.quit.Wait():
2581 }
2582 return
2583 }
2584 2585 func (c *CAPI) GetBestBlockHash(req *None, resp string) (e error) {
2586 nrh := RPCHandlers
2587 res := nrh["getbestblockhash"].Result()
2588 res.Params = req
2589 nrh["getbestblockhash"].Call <- res
2590 select {
2591 case resp = <-res.Ch.(chan string):
2592 case <-time.After(c.Timeout):
2593 case <-c.quit.Wait():
2594 }
2595 return
2596 }
2597 2598 func (c *CAPI) GetBlockCount(req *None, resp int32) (e error) {
2599 nrh := RPCHandlers
2600 res := nrh["getblockcount"].Result()
2601 res.Params = req
2602 nrh["getblockcount"].Call <- res
2603 select {
2604 case resp = <-res.Ch.(chan int32):
2605 case <-time.After(c.Timeout):
2606 case <-c.quit.Wait():
2607 }
2608 return
2609 }
2610 2611 func (c *CAPI) GetInfo(req *None, resp btcjson.InfoWalletResult) (e error) {
2612 nrh := RPCHandlers
2613 res := nrh["getinfo"].Result()
2614 res.Params = req
2615 nrh["getinfo"].Call <- res
2616 select {
2617 case resp = <-res.Ch.(chan btcjson.InfoWalletResult):
2618 case <-time.After(c.Timeout):
2619 case <-c.quit.Wait():
2620 }
2621 return
2622 }
2623 2624 func (c *CAPI) GetNewAddress(req *btcjson.GetNewAddressCmd, resp string) (e error) {
2625 nrh := RPCHandlers
2626 res := nrh["getnewaddress"].Result()
2627 res.Params = req
2628 nrh["getnewaddress"].Call <- res
2629 select {
2630 case resp = <-res.Ch.(chan string):
2631 case <-time.After(c.Timeout):
2632 case <-c.quit.Wait():
2633 }
2634 return
2635 }
2636 2637 func (c *CAPI) GetRawChangeAddress(req *btcjson.GetRawChangeAddressCmd, resp string) (e error) {
2638 nrh := RPCHandlers
2639 res := nrh["getrawchangeaddress"].Result()
2640 res.Params = req
2641 nrh["getrawchangeaddress"].Call <- res
2642 select {
2643 case resp = <-res.Ch.(chan string):
2644 case <-time.After(c.Timeout):
2645 case <-c.quit.Wait():
2646 }
2647 return
2648 }
2649 2650 func (c *CAPI) GetReceivedByAccount(req *btcjson.GetReceivedByAccountCmd, resp float64) (e error) {
2651 nrh := RPCHandlers
2652 res := nrh["getreceivedbyaccount"].Result()
2653 res.Params = req
2654 nrh["getreceivedbyaccount"].Call <- res
2655 select {
2656 case resp = <-res.Ch.(chan float64):
2657 case <-time.After(c.Timeout):
2658 case <-c.quit.Wait():
2659 }
2660 return
2661 }
2662 2663 func (c *CAPI) GetReceivedByAddress(req *btcjson.GetReceivedByAddressCmd, resp float64) (e error) {
2664 nrh := RPCHandlers
2665 res := nrh["getreceivedbyaddress"].Result()
2666 res.Params = req
2667 nrh["getreceivedbyaddress"].Call <- res
2668 select {
2669 case resp = <-res.Ch.(chan float64):
2670 case <-time.After(c.Timeout):
2671 case <-c.quit.Wait():
2672 }
2673 return
2674 }
2675 2676 func (c *CAPI) GetTransaction(req *btcjson.GetTransactionCmd, resp btcjson.GetTransactionResult) (e error) {
2677 nrh := RPCHandlers
2678 res := nrh["gettransaction"].Result()
2679 res.Params = req
2680 nrh["gettransaction"].Call <- res
2681 select {
2682 case resp = <-res.Ch.(chan btcjson.GetTransactionResult):
2683 case <-time.After(c.Timeout):
2684 case <-c.quit.Wait():
2685 }
2686 return
2687 }
2688 2689 func (c *CAPI) GetUnconfirmedBalance(req *btcjson.GetUnconfirmedBalanceCmd, resp float64) (e error) {
2690 nrh := RPCHandlers
2691 res := nrh["getunconfirmedbalance"].Result()
2692 res.Params = req
2693 nrh["getunconfirmedbalance"].Call <- res
2694 select {
2695 case resp = <-res.Ch.(chan float64):
2696 case <-time.After(c.Timeout):
2697 case <-c.quit.Wait():
2698 }
2699 return
2700 }
2701 2702 func (c *CAPI) HelpNoChainRPC(req btcjson.HelpCmd, resp string) (e error) {
2703 nrh := RPCHandlers
2704 res := nrh["help"].Result()
2705 res.Params = req
2706 nrh["help"].Call <- res
2707 select {
2708 case resp = <-res.Ch.(chan string):
2709 case <-time.After(c.Timeout):
2710 case <-c.quit.Wait():
2711 }
2712 return
2713 }
2714 2715 func (c *CAPI) ImportPrivKey(req *btcjson.ImportPrivKeyCmd, resp None) (e error) {
2716 nrh := RPCHandlers
2717 res := nrh["importprivkey"].Result()
2718 res.Params = req
2719 nrh["importprivkey"].Call <- res
2720 select {
2721 case resp = <-res.Ch.(chan None):
2722 case <-time.After(c.Timeout):
2723 case <-c.quit.Wait():
2724 }
2725 return
2726 }
2727 2728 func (c *CAPI) KeypoolRefill(req *None, resp None) (e error) {
2729 nrh := RPCHandlers
2730 res := nrh["keypoolrefill"].Result()
2731 res.Params = req
2732 nrh["keypoolrefill"].Call <- res
2733 select {
2734 case resp = <-res.Ch.(chan None):
2735 case <-time.After(c.Timeout):
2736 case <-c.quit.Wait():
2737 }
2738 return
2739 }
2740 2741 func (c *CAPI) ListAccounts(req *btcjson.ListAccountsCmd, resp map[string]float64) (e error) {
2742 nrh := RPCHandlers
2743 res := nrh["listaccounts"].Result()
2744 res.Params = req
2745 nrh["listaccounts"].Call <- res
2746 select {
2747 case resp = <-res.Ch.(chan map[string]float64):
2748 case <-time.After(c.Timeout):
2749 case <-c.quit.Wait():
2750 }
2751 return
2752 }
2753 2754 func (c *CAPI) ListAddressTransactions(req *btcjson.ListAddressTransactionsCmd, resp []btcjson.ListTransactionsResult) (e error) {
2755 nrh := RPCHandlers
2756 res := nrh["listaddresstransactions"].Result()
2757 res.Params = req
2758 nrh["listaddresstransactions"].Call <- res
2759 select {
2760 case resp = <-res.Ch.(chan []btcjson.ListTransactionsResult):
2761 case <-time.After(c.Timeout):
2762 case <-c.quit.Wait():
2763 }
2764 return
2765 }
2766 2767 func (c *CAPI) ListAllTransactions(req *btcjson.ListAllTransactionsCmd, resp []btcjson.ListTransactionsResult) (e error) {
2768 nrh := RPCHandlers
2769 res := nrh["listalltransactions"].Result()
2770 res.Params = req
2771 nrh["listalltransactions"].Call <- res
2772 select {
2773 case resp = <-res.Ch.(chan []btcjson.ListTransactionsResult):
2774 case <-time.After(c.Timeout):
2775 case <-c.quit.Wait():
2776 }
2777 return
2778 }
2779 2780 func (c *CAPI) ListLockUnspent(req *None, resp []btcjson.TransactionInput) (e error) {
2781 nrh := RPCHandlers
2782 res := nrh["listlockunspent"].Result()
2783 res.Params = req
2784 nrh["listlockunspent"].Call <- res
2785 select {
2786 case resp = <-res.Ch.(chan []btcjson.TransactionInput):
2787 case <-time.After(c.Timeout):
2788 case <-c.quit.Wait():
2789 }
2790 return
2791 }
2792 2793 func (c *CAPI) ListReceivedByAccount(req *btcjson.ListReceivedByAccountCmd, resp []btcjson.ListReceivedByAccountResult) (e error) {
2794 nrh := RPCHandlers
2795 res := nrh["listreceivedbyaccount"].Result()
2796 res.Params = req
2797 nrh["listreceivedbyaccount"].Call <- res
2798 select {
2799 case resp = <-res.Ch.(chan []btcjson.ListReceivedByAccountResult):
2800 case <-time.After(c.Timeout):
2801 case <-c.quit.Wait():
2802 }
2803 return
2804 }
2805 2806 func (c *CAPI) ListReceivedByAddress(req *btcjson.ListReceivedByAddressCmd, resp btcjson.ListReceivedByAddressResult) (e error) {
2807 nrh := RPCHandlers
2808 res := nrh["listreceivedbyaddress"].Result()
2809 res.Params = req
2810 nrh["listreceivedbyaddress"].Call <- res
2811 select {
2812 case resp = <-res.Ch.(chan btcjson.ListReceivedByAddressResult):
2813 case <-time.After(c.Timeout):
2814 case <-c.quit.Wait():
2815 }
2816 return
2817 }
2818 2819 func (c *CAPI) ListSinceBlock(req btcjson.ListSinceBlockCmd, resp btcjson.ListSinceBlockResult) (e error) {
2820 nrh := RPCHandlers
2821 res := nrh["listsinceblock"].Result()
2822 res.Params = req
2823 nrh["listsinceblock"].Call <- res
2824 select {
2825 case resp = <-res.Ch.(chan btcjson.ListSinceBlockResult):
2826 case <-time.After(c.Timeout):
2827 case <-c.quit.Wait():
2828 }
2829 return
2830 }
2831 2832 func (c *CAPI) ListTransactions(req *btcjson.ListTransactionsCmd, resp []btcjson.ListTransactionsResult) (e error) {
2833 nrh := RPCHandlers
2834 res := nrh["listtransactions"].Result()
2835 res.Params = req
2836 nrh["listtransactions"].Call <- res
2837 select {
2838 case resp = <-res.Ch.(chan []btcjson.ListTransactionsResult):
2839 case <-time.After(c.Timeout):
2840 case <-c.quit.Wait():
2841 }
2842 return
2843 }
2844 2845 func (c *CAPI) ListUnspent(req *btcjson.ListUnspentCmd, resp []btcjson.ListUnspentResult) (e error) {
2846 nrh := RPCHandlers
2847 res := nrh["listunspent"].Result()
2848 res.Params = req
2849 nrh["listunspent"].Call <- res
2850 select {
2851 case resp = <-res.Ch.(chan []btcjson.ListUnspentResult):
2852 case <-time.After(c.Timeout):
2853 case <-c.quit.Wait():
2854 }
2855 return
2856 }
2857 2858 func (c *CAPI) RenameAccount(req *btcjson.RenameAccountCmd, resp None) (e error) {
2859 nrh := RPCHandlers
2860 res := nrh["renameaccount"].Result()
2861 res.Params = req
2862 nrh["renameaccount"].Call <- res
2863 select {
2864 case resp = <-res.Ch.(chan None):
2865 case <-time.After(c.Timeout):
2866 case <-c.quit.Wait():
2867 }
2868 return
2869 }
2870 2871 func (c *CAPI) LockUnspent(req btcjson.LockUnspentCmd, resp bool) (e error) {
2872 nrh := RPCHandlers
2873 res := nrh["sendfrom"].Result()
2874 res.Params = req
2875 nrh["sendfrom"].Call <- res
2876 select {
2877 case resp = <-res.Ch.(chan bool):
2878 case <-time.After(c.Timeout):
2879 case <-c.quit.Wait():
2880 }
2881 return
2882 }
2883 2884 func (c *CAPI) SendMany(req *btcjson.SendManyCmd, resp string) (e error) {
2885 nrh := RPCHandlers
2886 res := nrh["sendmany"].Result()
2887 res.Params = req
2888 nrh["sendmany"].Call <- res
2889 select {
2890 case resp = <-res.Ch.(chan string):
2891 case <-time.After(c.Timeout):
2892 case <-c.quit.Wait():
2893 }
2894 return
2895 }
2896 2897 func (c *CAPI) SendToAddress(req *btcjson.SendToAddressCmd, resp string) (e error) {
2898 nrh := RPCHandlers
2899 res := nrh["sendtoaddress"].Result()
2900 res.Params = req
2901 nrh["sendtoaddress"].Call <- res
2902 select {
2903 case resp = <-res.Ch.(chan string):
2904 case <-time.After(c.Timeout):
2905 case <-c.quit.Wait():
2906 }
2907 return
2908 }
2909 2910 func (c *CAPI) SetTxFee(req *btcjson.SetTxFeeCmd, resp bool) (e error) {
2911 nrh := RPCHandlers
2912 res := nrh["settxfee"].Result()
2913 res.Params = req
2914 nrh["settxfee"].Call <- res
2915 select {
2916 case resp = <-res.Ch.(chan bool):
2917 case <-time.After(c.Timeout):
2918 case <-c.quit.Wait():
2919 }
2920 return
2921 }
2922 2923 func (c *CAPI) SignMessage(req *btcjson.SignMessageCmd, resp string) (e error) {
2924 nrh := RPCHandlers
2925 res := nrh["signmessage"].Result()
2926 res.Params = req
2927 nrh["signmessage"].Call <- res
2928 select {
2929 case resp = <-res.Ch.(chan string):
2930 case <-time.After(c.Timeout):
2931 case <-c.quit.Wait():
2932 }
2933 return
2934 }
2935 2936 func (c *CAPI) SignRawTransaction(req btcjson.SignRawTransactionCmd, resp btcjson.SignRawTransactionResult) (e error) {
2937 nrh := RPCHandlers
2938 res := nrh["signrawtransaction"].Result()
2939 res.Params = req
2940 nrh["signrawtransaction"].Call <- res
2941 select {
2942 case resp = <-res.Ch.(chan btcjson.SignRawTransactionResult):
2943 case <-time.After(c.Timeout):
2944 case <-c.quit.Wait():
2945 }
2946 return
2947 }
2948 2949 func (c *CAPI) ValidateAddress(req *btcjson.ValidateAddressCmd, resp btcjson.ValidateAddressWalletResult) (e error) {
2950 nrh := RPCHandlers
2951 res := nrh["validateaddress"].Result()
2952 res.Params = req
2953 nrh["validateaddress"].Call <- res
2954 select {
2955 case resp = <-res.Ch.(chan btcjson.ValidateAddressWalletResult):
2956 case <-time.After(c.Timeout):
2957 case <-c.quit.Wait():
2958 }
2959 return
2960 }
2961 2962 func (c *CAPI) VerifyMessage(req *btcjson.VerifyMessageCmd, resp bool) (e error) {
2963 nrh := RPCHandlers
2964 res := nrh["verifymessage"].Result()
2965 res.Params = req
2966 nrh["verifymessage"].Call <- res
2967 select {
2968 case resp = <-res.Ch.(chan bool):
2969 case <-time.After(c.Timeout):
2970 case <-c.quit.Wait():
2971 }
2972 return
2973 }
2974 2975 func (c *CAPI) WalletIsLocked(req *None, resp bool) (e error) {
2976 nrh := RPCHandlers
2977 res := nrh["walletislocked"].Result()
2978 res.Params = req
2979 nrh["walletislocked"].Call <- res
2980 select {
2981 case resp = <-res.Ch.(chan bool):
2982 case <-time.After(c.Timeout):
2983 case <-c.quit.Wait():
2984 }
2985 return
2986 }
2987 2988 func (c *CAPI) WalletLock(req *None, resp None) (e error) {
2989 nrh := RPCHandlers
2990 res := nrh["walletlock"].Result()
2991 res.Params = req
2992 nrh["walletlock"].Call <- res
2993 select {
2994 case resp = <-res.Ch.(chan None):
2995 case <-time.After(c.Timeout):
2996 case <-c.quit.Wait():
2997 }
2998 return
2999 }
3000 3001 func (c *CAPI) WalletPassphrase(req *btcjson.WalletPassphraseCmd, resp None) (e error) {
3002 nrh := RPCHandlers
3003 res := nrh["walletpassphrase"].Result()
3004 res.Params = req
3005 nrh["walletpassphrase"].Call <- res
3006 select {
3007 case resp = <-res.Ch.(chan None):
3008 case <-time.After(c.Timeout):
3009 case <-c.quit.Wait():
3010 }
3011 return
3012 }
3013 3014 func (c *CAPI) WalletPassphraseChange(req *btcjson.WalletPassphraseChangeCmd, resp None) (e error) {
3015 nrh := RPCHandlers
3016 res := nrh["walletpassphrasechange"].Result()
3017 res.Params = req
3018 nrh["walletpassphrasechange"].Call <- res
3019 select {
3020 case resp = <-res.Ch.(chan None):
3021 case <-time.After(c.Timeout):
3022 case <-c.quit.Wait():
3023 }
3024 return
3025 }
3026 3027 // Client call wrappers for a CAPI client with a given Conn
3028 3029 func (r *CAPIClient) AddMultiSigAddress(cmd ...*btcjson.AddMultisigAddressCmd) (res string, e error) {
3030 var c *btcjson.AddMultisigAddressCmd
3031 if len(cmd) > 0 {
3032 c = cmd[0]
3033 }
3034 if e = r.Call("CAPI.AddMultiSigAddress", c, &res); E.Chk(e) {
3035 }
3036 return
3037 }
3038 3039 func (r *CAPIClient) CreateMultiSig(cmd ...*btcjson.CreateMultisigCmd) (res btcjson.CreateMultiSigResult, e error) {
3040 var c *btcjson.CreateMultisigCmd
3041 if len(cmd) > 0 {
3042 c = cmd[0]
3043 }
3044 if e = r.Call("CAPI.CreateMultiSig", c, &res); E.Chk(e) {
3045 }
3046 return
3047 }
3048 3049 func (r *CAPIClient) CreateNewAccount(cmd ...*btcjson.CreateNewAccountCmd) (res None, e error) {
3050 var c *btcjson.CreateNewAccountCmd
3051 if len(cmd) > 0 {
3052 c = cmd[0]
3053 }
3054 if e = r.Call("CAPI.CreateNewAccount", c, &res); E.Chk(e) {
3055 }
3056 return
3057 }
3058 3059 func (r *CAPIClient) HandleDropWalletHistory(cmd ...*None) (res string, e error) {
3060 var c *None
3061 if len(cmd) > 0 {
3062 c = cmd[0]
3063 }
3064 if e = r.Call("CAPI.HandleDropWalletHistory", c, &res); E.Chk(e) {
3065 }
3066 return
3067 }
3068 3069 func (r *CAPIClient) DumpPrivKey(cmd ...*btcjson.DumpPrivKeyCmd) (res string, e error) {
3070 var c *btcjson.DumpPrivKeyCmd
3071 if len(cmd) > 0 {
3072 c = cmd[0]
3073 }
3074 if e = r.Call("CAPI.DumpPrivKey", c, &res); E.Chk(e) {
3075 }
3076 return
3077 }
3078 3079 func (r *CAPIClient) GetAccount(cmd ...*btcjson.GetAccountCmd) (res string, e error) {
3080 var c *btcjson.GetAccountCmd
3081 if len(cmd) > 0 {
3082 c = cmd[0]
3083 }
3084 if e = r.Call("CAPI.GetAccount", c, &res); E.Chk(e) {
3085 }
3086 return
3087 }
3088 3089 func (r *CAPIClient) GetAccountAddress(cmd ...*btcjson.GetAccountAddressCmd) (res string, e error) {
3090 var c *btcjson.GetAccountAddressCmd
3091 if len(cmd) > 0 {
3092 c = cmd[0]
3093 }
3094 if e = r.Call("CAPI.GetAccountAddress", c, &res); E.Chk(e) {
3095 }
3096 return
3097 }
3098 3099 func (r *CAPIClient) GetAddressesByAccount(cmd ...*btcjson.GetAddressesByAccountCmd) (res []string, e error) {
3100 var c *btcjson.GetAddressesByAccountCmd
3101 if len(cmd) > 0 {
3102 c = cmd[0]
3103 }
3104 if e = r.Call("CAPI.GetAddressesByAccount", c, &res); E.Chk(e) {
3105 }
3106 return
3107 }
3108 3109 func (r *CAPIClient) GetBalance(cmd ...*btcjson.GetBalanceCmd) (res float64, e error) {
3110 var c *btcjson.GetBalanceCmd
3111 if len(cmd) > 0 {
3112 c = cmd[0]
3113 }
3114 if e = r.Call("CAPI.GetBalance", c, &res); E.Chk(e) {
3115 }
3116 return
3117 }
3118 3119 func (r *CAPIClient) GetBestBlock(cmd ...*None) (res btcjson.GetBestBlockResult, e error) {
3120 var c *None
3121 if len(cmd) > 0 {
3122 c = cmd[0]
3123 }
3124 if e = r.Call("CAPI.GetBestBlock", c, &res); E.Chk(e) {
3125 }
3126 return
3127 }
3128 3129 func (r *CAPIClient) GetBestBlockHash(cmd ...*None) (res string, e error) {
3130 var c *None
3131 if len(cmd) > 0 {
3132 c = cmd[0]
3133 }
3134 if e = r.Call("CAPI.GetBestBlockHash", c, &res); E.Chk(e) {
3135 }
3136 return
3137 }
3138 3139 func (r *CAPIClient) GetBlockCount(cmd ...*None) (res int32, e error) {
3140 var c *None
3141 if len(cmd) > 0 {
3142 c = cmd[0]
3143 }
3144 if e = r.Call("CAPI.GetBlockCount", c, &res); E.Chk(e) {
3145 }
3146 return
3147 }
3148 3149 func (r *CAPIClient) GetInfo(cmd ...*None) (res btcjson.InfoWalletResult, e error) {
3150 var c *None
3151 if len(cmd) > 0 {
3152 c = cmd[0]
3153 }
3154 if e = r.Call("CAPI.GetInfo", c, &res); E.Chk(e) {
3155 }
3156 return
3157 }
3158 3159 func (r *CAPIClient) GetNewAddress(cmd ...*btcjson.GetNewAddressCmd) (res string, e error) {
3160 var c *btcjson.GetNewAddressCmd
3161 if len(cmd) > 0 {
3162 c = cmd[0]
3163 }
3164 if e = r.Call("CAPI.GetNewAddress", c, &res); E.Chk(e) {
3165 }
3166 return
3167 }
3168 3169 func (r *CAPIClient) GetRawChangeAddress(cmd ...*btcjson.GetRawChangeAddressCmd) (res string, e error) {
3170 var c *btcjson.GetRawChangeAddressCmd
3171 if len(cmd) > 0 {
3172 c = cmd[0]
3173 }
3174 if e = r.Call("CAPI.GetRawChangeAddress", c, &res); E.Chk(e) {
3175 }
3176 return
3177 }
3178 3179 func (r *CAPIClient) GetReceivedByAccount(cmd ...*btcjson.GetReceivedByAccountCmd) (res float64, e error) {
3180 var c *btcjson.GetReceivedByAccountCmd
3181 if len(cmd) > 0 {
3182 c = cmd[0]
3183 }
3184 if e = r.Call("CAPI.GetReceivedByAccount", c, &res); E.Chk(e) {
3185 }
3186 return
3187 }
3188 3189 func (r *CAPIClient) GetReceivedByAddress(cmd ...*btcjson.GetReceivedByAddressCmd) (res float64, e error) {
3190 var c *btcjson.GetReceivedByAddressCmd
3191 if len(cmd) > 0 {
3192 c = cmd[0]
3193 }
3194 if e = r.Call("CAPI.GetReceivedByAddress", c, &res); E.Chk(e) {
3195 }
3196 return
3197 }
3198 3199 func (r *CAPIClient) GetTransaction(cmd ...*btcjson.GetTransactionCmd) (res btcjson.GetTransactionResult, e error) {
3200 var c *btcjson.GetTransactionCmd
3201 if len(cmd) > 0 {
3202 c = cmd[0]
3203 }
3204 if e = r.Call("CAPI.GetTransaction", c, &res); E.Chk(e) {
3205 }
3206 return
3207 }
3208 3209 func (r *CAPIClient) GetUnconfirmedBalance(cmd ...*btcjson.GetUnconfirmedBalanceCmd) (res float64, e error) {
3210 var c *btcjson.GetUnconfirmedBalanceCmd
3211 if len(cmd) > 0 {
3212 c = cmd[0]
3213 }
3214 if e = r.Call("CAPI.GetUnconfirmedBalance", c, &res); E.Chk(e) {
3215 }
3216 return
3217 }
3218 3219 func (r *CAPIClient) HelpNoChainRPC(cmd ...btcjson.HelpCmd) (res string, e error) {
3220 var c btcjson.HelpCmd
3221 if len(cmd) > 0 {
3222 c = cmd[0]
3223 }
3224 if e = r.Call("CAPI.HelpNoChainRPC", c, &res); E.Chk(e) {
3225 }
3226 return
3227 }
3228 3229 func (r *CAPIClient) ImportPrivKey(cmd ...*btcjson.ImportPrivKeyCmd) (res None, e error) {
3230 var c *btcjson.ImportPrivKeyCmd
3231 if len(cmd) > 0 {
3232 c = cmd[0]
3233 }
3234 if e = r.Call("CAPI.ImportPrivKey", c, &res); E.Chk(e) {
3235 }
3236 return
3237 }
3238 3239 func (r *CAPIClient) KeypoolRefill(cmd ...*None) (res None, e error) {
3240 var c *None
3241 if len(cmd) > 0 {
3242 c = cmd[0]
3243 }
3244 if e = r.Call("CAPI.KeypoolRefill", c, &res); E.Chk(e) {
3245 }
3246 return
3247 }
3248 3249 func (r *CAPIClient) ListAccounts(cmd ...*btcjson.ListAccountsCmd) (res map[string]float64, e error) {
3250 var c *btcjson.ListAccountsCmd
3251 if len(cmd) > 0 {
3252 c = cmd[0]
3253 }
3254 if e = r.Call("CAPI.ListAccounts", c, &res); E.Chk(e) {
3255 }
3256 return
3257 }
3258 3259 func (r *CAPIClient) ListAddressTransactions(cmd ...*btcjson.ListAddressTransactionsCmd) (res []btcjson.ListTransactionsResult, e error) {
3260 var c *btcjson.ListAddressTransactionsCmd
3261 if len(cmd) > 0 {
3262 c = cmd[0]
3263 }
3264 if e = r.Call("CAPI.ListAddressTransactions", c, &res); E.Chk(e) {
3265 }
3266 return
3267 }
3268 3269 func (r *CAPIClient) ListAllTransactions(cmd ...*btcjson.ListAllTransactionsCmd) (res []btcjson.ListTransactionsResult, e error) {
3270 var c *btcjson.ListAllTransactionsCmd
3271 if len(cmd) > 0 {
3272 c = cmd[0]
3273 }
3274 if e = r.Call("CAPI.ListAllTransactions", c, &res); E.Chk(e) {
3275 }
3276 return
3277 }
3278 3279 func (r *CAPIClient) ListLockUnspent(cmd ...*None) (res []btcjson.TransactionInput, e error) {
3280 var c *None
3281 if len(cmd) > 0 {
3282 c = cmd[0]
3283 }
3284 if e = r.Call("CAPI.ListLockUnspent", c, &res); E.Chk(e) {
3285 }
3286 return
3287 }
3288 3289 func (r *CAPIClient) ListReceivedByAccount(cmd ...*btcjson.ListReceivedByAccountCmd) (res []btcjson.ListReceivedByAccountResult, e error) {
3290 var c *btcjson.ListReceivedByAccountCmd
3291 if len(cmd) > 0 {
3292 c = cmd[0]
3293 }
3294 if e = r.Call("CAPI.ListReceivedByAccount", c, &res); E.Chk(e) {
3295 }
3296 return
3297 }
3298 3299 func (r *CAPIClient) ListReceivedByAddress(cmd ...*btcjson.ListReceivedByAddressCmd) (res btcjson.ListReceivedByAddressResult, e error) {
3300 var c *btcjson.ListReceivedByAddressCmd
3301 if len(cmd) > 0 {
3302 c = cmd[0]
3303 }
3304 if e = r.Call("CAPI.ListReceivedByAddress", c, &res); E.Chk(e) {
3305 }
3306 return
3307 }
3308 3309 func (r *CAPIClient) ListSinceBlock(cmd ...btcjson.ListSinceBlockCmd) (res btcjson.ListSinceBlockResult, e error) {
3310 var c btcjson.ListSinceBlockCmd
3311 if len(cmd) > 0 {
3312 c = cmd[0]
3313 }
3314 if e = r.Call("CAPI.ListSinceBlock", c, &res); E.Chk(e) {
3315 }
3316 return
3317 }
3318 3319 func (r *CAPIClient) ListTransactions(cmd ...*btcjson.ListTransactionsCmd) (res []btcjson.ListTransactionsResult, e error) {
3320 var c *btcjson.ListTransactionsCmd
3321 if len(cmd) > 0 {
3322 c = cmd[0]
3323 }
3324 if e = r.Call("CAPI.ListTransactions", c, &res); E.Chk(e) {
3325 }
3326 return
3327 }
3328 3329 func (r *CAPIClient) ListUnspent(cmd ...*btcjson.ListUnspentCmd) (res []btcjson.ListUnspentResult, e error) {
3330 var c *btcjson.ListUnspentCmd
3331 if len(cmd) > 0 {
3332 c = cmd[0]
3333 }
3334 if e = r.Call("CAPI.ListUnspent", c, &res); E.Chk(e) {
3335 }
3336 return
3337 }
3338 3339 func (r *CAPIClient) RenameAccount(cmd ...*btcjson.RenameAccountCmd) (res None, e error) {
3340 var c *btcjson.RenameAccountCmd
3341 if len(cmd) > 0 {
3342 c = cmd[0]
3343 }
3344 if e = r.Call("CAPI.RenameAccount", c, &res); E.Chk(e) {
3345 }
3346 return
3347 }
3348 3349 func (r *CAPIClient) LockUnspent(cmd ...btcjson.LockUnspentCmd) (res bool, e error) {
3350 var c btcjson.LockUnspentCmd
3351 if len(cmd) > 0 {
3352 c = cmd[0]
3353 }
3354 if e = r.Call("CAPI.LockUnspent", c, &res); E.Chk(e) {
3355 }
3356 return
3357 }
3358 3359 func (r *CAPIClient) SendMany(cmd ...*btcjson.SendManyCmd) (res string, e error) {
3360 var c *btcjson.SendManyCmd
3361 if len(cmd) > 0 {
3362 c = cmd[0]
3363 }
3364 if e = r.Call("CAPI.SendMany", c, &res); E.Chk(e) {
3365 }
3366 return
3367 }
3368 3369 func (r *CAPIClient) SendToAddress(cmd ...*btcjson.SendToAddressCmd) (res string, e error) {
3370 var c *btcjson.SendToAddressCmd
3371 if len(cmd) > 0 {
3372 c = cmd[0]
3373 }
3374 if e = r.Call("CAPI.SendToAddress", c, &res); E.Chk(e) {
3375 }
3376 return
3377 }
3378 3379 func (r *CAPIClient) SetTxFee(cmd ...*btcjson.SetTxFeeCmd) (res bool, e error) {
3380 var c *btcjson.SetTxFeeCmd
3381 if len(cmd) > 0 {
3382 c = cmd[0]
3383 }
3384 if e = r.Call("CAPI.SetTxFee", c, &res); E.Chk(e) {
3385 }
3386 return
3387 }
3388 3389 func (r *CAPIClient) SignMessage(cmd ...*btcjson.SignMessageCmd) (res string, e error) {
3390 var c *btcjson.SignMessageCmd
3391 if len(cmd) > 0 {
3392 c = cmd[0]
3393 }
3394 if e = r.Call("CAPI.SignMessage", c, &res); E.Chk(e) {
3395 }
3396 return
3397 }
3398 3399 func (r *CAPIClient) SignRawTransaction(cmd ...btcjson.SignRawTransactionCmd) (res btcjson.SignRawTransactionResult, e error) {
3400 var c btcjson.SignRawTransactionCmd
3401 if len(cmd) > 0 {
3402 c = cmd[0]
3403 }
3404 if e = r.Call("CAPI.SignRawTransaction", c, &res); E.Chk(e) {
3405 }
3406 return
3407 }
3408 3409 func (r *CAPIClient) ValidateAddress(cmd ...*btcjson.ValidateAddressCmd) (res btcjson.ValidateAddressWalletResult, e error) {
3410 var c *btcjson.ValidateAddressCmd
3411 if len(cmd) > 0 {
3412 c = cmd[0]
3413 }
3414 if e = r.Call("CAPI.ValidateAddress", c, &res); E.Chk(e) {
3415 }
3416 return
3417 }
3418 3419 func (r *CAPIClient) VerifyMessage(cmd ...*btcjson.VerifyMessageCmd) (res bool, e error) {
3420 var c *btcjson.VerifyMessageCmd
3421 if len(cmd) > 0 {
3422 c = cmd[0]
3423 }
3424 if e = r.Call("CAPI.VerifyMessage", c, &res); E.Chk(e) {
3425 }
3426 return
3427 }
3428 3429 func (r *CAPIClient) WalletIsLocked(cmd ...*None) (res bool, e error) {
3430 var c *None
3431 if len(cmd) > 0 {
3432 c = cmd[0]
3433 }
3434 if e = r.Call("CAPI.WalletIsLocked", c, &res); E.Chk(e) {
3435 }
3436 return
3437 }
3438 3439 func (r *CAPIClient) WalletLock(cmd ...*None) (res None, e error) {
3440 var c *None
3441 if len(cmd) > 0 {
3442 c = cmd[0]
3443 }
3444 if e = r.Call("CAPI.WalletLock", c, &res); E.Chk(e) {
3445 }
3446 return
3447 }
3448 3449 func (r *CAPIClient) WalletPassphrase(cmd ...*btcjson.WalletPassphraseCmd) (res None, e error) {
3450 var c *btcjson.WalletPassphraseCmd
3451 if len(cmd) > 0 {
3452 c = cmd[0]
3453 }
3454 if e = r.Call("CAPI.WalletPassphrase", c, &res); E.Chk(e) {
3455 }
3456 return
3457 }
3458 3459 func (r *CAPIClient) WalletPassphraseChange(cmd ...*btcjson.WalletPassphraseChangeCmd) (res None, e error) {
3460 var c *btcjson.WalletPassphraseChangeCmd
3461 if len(cmd) > 0 {
3462 c = cmd[0]
3463 }
3464 if e = r.Call("CAPI.WalletPassphraseChange", c, &res); E.Chk(e) {
3465 }
3466 return
3467 }
3468 3469