|
@@ -49,8 +49,9 @@ class CallSigs:
|
|
|
|
|
|
|
|
class bitcoin_core:
|
|
class bitcoin_core:
|
|
|
|
|
|
|
|
- def __init__(self, cfg):
|
|
|
|
|
|
|
+ def __init__(self, cfg, rpc):
|
|
|
self.cfg = cfg
|
|
self.cfg = cfg
|
|
|
|
|
+ self.rpc = rpc
|
|
|
|
|
|
|
|
def createwallet(
|
|
def createwallet(
|
|
|
self,
|
|
self,
|
|
@@ -75,13 +76,84 @@ class CallSigs:
|
|
|
descriptors, # 6. descriptors (native descriptor wallet)
|
|
descriptors, # 6. descriptors (native descriptor wallet)
|
|
|
load_on_startup) # 7. load_on_startup
|
|
load_on_startup) # 7. load_on_startup
|
|
|
|
|
|
|
|
|
|
+ # Get detailed information about in-wallet transaction <txid>
|
|
|
|
|
+ # Arguments:
|
|
|
|
|
+ # 1. txid (string, required) The transaction id
|
|
|
|
|
+ # 2. include_watchonly (boolean, optional, default=true for watch-only wallets, otherwise
|
|
|
|
|
+ # false) Whether to include watch-only addresses in balance calculation
|
|
|
|
|
+ # and details[]
|
|
|
|
|
+ # 3. verbose (boolean, optional, default=false) Whether to include a `decoded`
|
|
|
|
|
+ # field containing the decoded transaction (equivalent to RPC
|
|
|
|
|
+ # decoderawtransaction)
|
|
|
def gettransaction(self, txid, include_watchonly, verbose):
|
|
def gettransaction(self, txid, include_watchonly, verbose):
|
|
|
return (
|
|
return (
|
|
|
'gettransaction',
|
|
'gettransaction',
|
|
|
- txid, # 1. transaction id
|
|
|
|
|
- include_watchonly, # 2. optional, default=true for watch-only wallets, otherwise false
|
|
|
|
|
- verbose) # 3. optional, default=false -- include a `decoded` field containing
|
|
|
|
|
- # => the decoded transaction (equivalent to RPC decoderawtransaction)
|
|
|
|
|
|
|
+ txid,
|
|
|
|
|
+ verbose
|
|
|
|
|
+ ) if 'descriptor_wallet_only' in self.rpc.caps else (
|
|
|
|
|
+ 'gettransaction',
|
|
|
|
|
+ txid,
|
|
|
|
|
+ include_watchonly,
|
|
|
|
|
+ verbose)
|
|
|
|
|
+
|
|
|
|
|
+ # List received transactions by label.
|
|
|
|
|
+ # 1. minconf (numeric, optional, default=1) The minimum number of
|
|
|
|
|
+ # confirmations before payments are included.
|
|
|
|
|
+ # 2. include_empty (boolean, optional, default=false) Whether to include labels
|
|
|
|
|
+ # that haven't received any payments.
|
|
|
|
|
+ # 3. include_watchonly (boolean, optional, default=true for watch-only wallets,
|
|
|
|
|
+ # otherwise false) Whether to include watch-only addresses
|
|
|
|
|
+ # (see 'importaddress')
|
|
|
|
|
+ # 4. include_immature_coinbase (boolean, optional, default=false) Include immature coinbase
|
|
|
|
|
+ # transactions.
|
|
|
|
|
+ def listreceivedbylabel(
|
|
|
|
|
+ self,
|
|
|
|
|
+ *,
|
|
|
|
|
+ minconf = 1,
|
|
|
|
|
+ include_empty = False,
|
|
|
|
|
+ include_watchonly = True,
|
|
|
|
|
+ include_immature_coinbase = False):
|
|
|
|
|
+ return (
|
|
|
|
|
+ 'listreceivedbylabel',
|
|
|
|
|
+ minconf,
|
|
|
|
|
+ include_empty,
|
|
|
|
|
+ include_immature_coinbase
|
|
|
|
|
+ ) if 'descriptor_wallet_only' in self.rpc.caps else (
|
|
|
|
|
+ 'listreceivedbylabel',
|
|
|
|
|
+ minconf,
|
|
|
|
|
+ include_empty,
|
|
|
|
|
+ include_watchonly,
|
|
|
|
|
+ include_immature_coinbase)
|
|
|
|
|
+
|
|
|
|
|
+ # Get all transactions in blocks since block [blockhash], or all transactions if omitted.
|
|
|
|
|
+ # 1. blockhash (string, optional) If set, the block hash to list transactions since,
|
|
|
|
|
+ # otherwise list all transactions.
|
|
|
|
|
+ # 2. target_confirmations (numeric, optional, default=1) Return the nth block hash from the main
|
|
|
|
|
+ # chain. e.g. 1 would mean the best block hash. Note: this is not used
|
|
|
|
|
+ # as a filter, but only affects [lastblock] in the return value
|
|
|
|
|
+ # 3. include_watchonly (boolean, optional, default=true for watch-only wallets, otherwise
|
|
|
|
|
+ # false) Include transactions to watch-only addresses
|
|
|
|
|
+ # 4. include_removed (boolean, optional, default=true) Show transactions that were removed
|
|
|
|
|
+ # due to a reorg in the "removed" array (not guaranteed to work on
|
|
|
|
|
+ # pruned nodes)
|
|
|
|
|
+ def listsinceblock(
|
|
|
|
|
+ self,
|
|
|
|
|
+ *,
|
|
|
|
|
+ blockhash = '',
|
|
|
|
|
+ target_confirmations = 1,
|
|
|
|
|
+ include_watchonly = True,
|
|
|
|
|
+ include_removed = True):
|
|
|
|
|
+ return (
|
|
|
|
|
+ 'listsinceblock',
|
|
|
|
|
+ blockhash,
|
|
|
|
|
+ target_confirmations,
|
|
|
|
|
+ include_removed
|
|
|
|
|
+ ) if 'descriptor_wallet_only' in self.rpc.caps else (
|
|
|
|
|
+ 'listsinceblock',
|
|
|
|
|
+ blockhash,
|
|
|
|
|
+ target_confirmations,
|
|
|
|
|
+ include_watchonly,
|
|
|
|
|
+ include_removed)
|
|
|
|
|
|
|
|
class litecoin_core(bitcoin_core):
|
|
class litecoin_core(bitcoin_core):
|
|
|
|
|
|
|
@@ -106,6 +178,19 @@ class CallSigs:
|
|
|
txid, # 1. transaction id
|
|
txid, # 1. transaction id
|
|
|
include_watchonly) # 2. optional, default=true for watch-only wallets, otherwise false
|
|
include_watchonly) # 2. optional, default=true for watch-only wallets, otherwise false
|
|
|
|
|
|
|
|
|
|
+ def listreceivedbylabel(
|
|
|
|
|
+ self,
|
|
|
|
|
+ *,
|
|
|
|
|
+ minconf = 1,
|
|
|
|
|
+ include_empty = False,
|
|
|
|
|
+ include_watchonly = True,
|
|
|
|
|
+ include_immature_coinbase = False):
|
|
|
|
|
+ return (
|
|
|
|
|
+ 'listreceivedbylabel',
|
|
|
|
|
+ minconf,
|
|
|
|
|
+ include_empty,
|
|
|
|
|
+ include_watchonly)
|
|
|
|
|
+
|
|
|
class bitcoin_cash_node(litecoin_core):
|
|
class bitcoin_cash_node(litecoin_core):
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
@@ -127,7 +212,7 @@ class BitcoinRPCClient(RPCClient, metaclass=AsyncInit):
|
|
|
|
|
|
|
|
self.proto = proto
|
|
self.proto = proto
|
|
|
self.daemon = daemon
|
|
self.daemon = daemon
|
|
|
- self.call_sigs = getattr(CallSigs, daemon.id)(cfg)
|
|
|
|
|
|
|
+ self.call_sigs = getattr(CallSigs, daemon.id)(cfg, self)
|
|
|
self.twname = TrackingWalletName(cfg.regtest_user or proto.tw_name or cfg.tw_name or self.dfl_twname)
|
|
self.twname = TrackingWalletName(cfg.regtest_user or proto.tw_name or cfg.tw_name or self.dfl_twname)
|
|
|
|
|
|
|
|
super().__init__(
|
|
super().__init__(
|
|
@@ -174,6 +259,9 @@ class BitcoinRPCClient(RPCClient, metaclass=AsyncInit):
|
|
|
self.daemon_version_str = self.cached['networkinfo']['subversion']
|
|
self.daemon_version_str = self.cached['networkinfo']['subversion']
|
|
|
self.chain = self.cached['blockchaininfo']['chain']
|
|
self.chain = self.cached['blockchaininfo']['chain']
|
|
|
|
|
|
|
|
|
|
+ if self.daemon.id == 'bitcoin_core' and self.daemon_version >= 300000:
|
|
|
|
|
+ self.caps += ('descriptor_wallet_only',)
|
|
|
|
|
+
|
|
|
tip = await self.call('getblockhash', self.blockcount)
|
|
tip = await self.call('getblockhash', self.blockcount)
|
|
|
self.cur_date = (await self.call('getblockheader', tip))['time']
|
|
self.cur_date = (await self.call('getblockheader', tip))['time']
|
|
|
if self.chain != 'regtest':
|
|
if self.chain != 'regtest':
|