@@ -29,38 +29,39 @@ import (
2929)
3030
3131const (
32- methodGetBalances = "getbalances"
33- methodGetBalance = "getbalance"
34- methodListUnspent = "listunspent"
35- methodLockUnspent = "lockunspent"
36- methodListLockUnspent = "listlockunspent"
37- methodChangeAddress = "getrawchangeaddress"
38- methodNewAddress = "getnewaddress"
39- methodSignTx = "signrawtransactionwithwallet"
40- methodSignTxLegacy = "signrawtransaction"
41- methodUnlock = "walletpassphrase"
42- methodLock = "walletlock"
43- methodPrivKeyForAddress = "dumpprivkey"
44- methodGetTransaction = "gettransaction"
45- methodSendToAddress = "sendtoaddress"
46- methodSetTxFee = "settxfee"
47- methodGetWalletInfo = "getwalletinfo"
48- methodGetAddressInfo = "getaddressinfo"
49- methodListDescriptors = "listdescriptors"
50- methodValidateAddress = "validateaddress"
51- methodEstimateSmartFee = "estimatesmartfee"
52- methodSendRawTransaction = "sendrawtransaction"
53- methodGetTxOut = "gettxout"
54- methodGetBlock = "getblock"
55- methodGetBlockHash = "getblockhash"
56- methodGetBestBlockHash = "getbestblockhash"
57- methodGetRawMempool = "getrawmempool"
58- methodGetRawTransaction = "getrawtransaction"
59- methodGetBlockHeader = "getblockheader"
60- methodGetNetworkInfo = "getnetworkinfo"
61- methodGetBlockchainInfo = "getblockchaininfo"
62- methodFundRawTransaction = "fundrawtransaction"
63- methodListSinceBlock = "listsinceblock"
32+ methodGetBalances = "getbalances"
33+ methodGetBalance = "getbalance"
34+ methodListUnspent = "listunspent"
35+ methodLockUnspent = "lockunspent"
36+ methodListLockUnspent = "listlockunspent"
37+ methodChangeAddress = "getrawchangeaddress"
38+ methodNewAddress = "getnewaddress"
39+ methodSignTx = "signrawtransactionwithwallet"
40+ methodSignTxLegacy = "signrawtransaction"
41+ methodUnlock = "walletpassphrase"
42+ methodLock = "walletlock"
43+ methodPrivKeyForAddress = "dumpprivkey"
44+ methodGetTransaction = "gettransaction"
45+ methodSendToAddress = "sendtoaddress"
46+ methodSetTxFee = "settxfee"
47+ methodGetWalletInfo = "getwalletinfo"
48+ methodGetAddressInfo = "getaddressinfo"
49+ methodListDescriptors = "listdescriptors"
50+ methodValidateAddress = "validateaddress"
51+ methodEstimateSmartFee = "estimatesmartfee"
52+ methodSendRawTransaction = "sendrawtransaction"
53+ methodGetTxOut = "gettxout"
54+ methodGetBlock = "getblock"
55+ methodGetBlockHash = "getblockhash"
56+ methodGetBestBlockHash = "getbestblockhash"
57+ methodGetRawMempool = "getrawmempool"
58+ methodGetRawTransaction = "getrawtransaction"
59+ methodGetBlockHeader = "getblockheader"
60+ methodGetNetworkInfo = "getnetworkinfo"
61+ methodGetBlockchainInfo = "getblockchaininfo"
62+ methodFundRawTransaction = "fundrawtransaction"
63+ methodListSinceBlock = "listsinceblock"
64+ methodGetReceivedByAddress = "getreceivedbyaddress"
6465)
6566
6667// IsTxNotFoundErr will return true if the error indicates that the requested
@@ -1180,6 +1181,15 @@ func SearchBlockForRedemptions(
11801181 return
11811182}
11821183
1184+ func (wc * rpcClient ) AddressUsed (addr string ) (bool , error ) {
1185+ var recv float64
1186+ const minConf = 0
1187+ if err := wc .call (methodGetReceivedByAddress , []any {addr , minConf }, & recv ); err != nil {
1188+ return false , err
1189+ }
1190+ return recv != 0 , nil
1191+ }
1192+
11831193// call is used internally to marshal parameters and send requests to the RPC
11841194// server via (*rpcclient.Client).RawRequest. If thing is non-nil, the result
11851195// will be marshaled into thing.
0 commit comments