|
|
|
@ -9,7 +9,7 @@ from autobahn.twisted.websocket import WebSocketClientFactory, \ |
|
|
|
|
|
|
|
|
|
|
|
from jmbase import get_nontor_agent, hextobin, BytesProducer, get_log |
|
|
|
from jmbase import get_nontor_agent, hextobin, BytesProducer, get_log |
|
|
|
from jmbitcoin import CTransaction |
|
|
|
from jmbitcoin import CTransaction |
|
|
|
from jmclient import (load_test_config, jm_single, |
|
|
|
from jmclient import (load_test_config, jm_single, SegwitWalletFidelityBonds, |
|
|
|
JMWalletDaemon, validate_address, start_reactor) |
|
|
|
JMWalletDaemon, validate_address, start_reactor) |
|
|
|
from jmclient.wallet_rpc import api_version_string |
|
|
|
from jmclient.wallet_rpc import api_version_string |
|
|
|
from commontest import make_wallets |
|
|
|
from commontest import make_wallets |
|
|
|
@ -71,7 +71,7 @@ class WalletRPCTestBase(object): |
|
|
|
# the sync for test, by some means or other. |
|
|
|
# the sync for test, by some means or other. |
|
|
|
self.daemon.wallet_service = make_wallets_to_list(make_wallets( |
|
|
|
self.daemon.wallet_service = make_wallets_to_list(make_wallets( |
|
|
|
1, wallet_structures=[wallet_structures[0]], |
|
|
|
1, wallet_structures=[wallet_structures[0]], |
|
|
|
mean_amt=self.mean_amt))[0] |
|
|
|
mean_amt=self.mean_amt, wallet_cls=SegwitWalletFidelityBonds))[0] |
|
|
|
jm_single().bc_interface.tickchain() |
|
|
|
jm_single().bc_interface.tickchain() |
|
|
|
sync_wallets([self.daemon.wallet_service]) |
|
|
|
sync_wallets([self.daemon.wallet_service]) |
|
|
|
# dummy tx example to force a notification event: |
|
|
|
# dummy tx example to force a notification event: |
|
|
|
@ -173,7 +173,7 @@ class TrialTestWRPC_DisplayWallet(WalletRPCTestBase, unittest.TestCase): |
|
|
|
addr = root + "/wallet/create" |
|
|
|
addr = root + "/wallet/create" |
|
|
|
addr = addr.encode() |
|
|
|
addr = addr.encode() |
|
|
|
body = BytesProducer(json.dumps({"walletname": testfileloc, |
|
|
|
body = BytesProducer(json.dumps({"walletname": testfileloc, |
|
|
|
"password": "hunter2", "wallettype": "sw"}).encode()) |
|
|
|
"password": "hunter2", "wallettype": "sw-fb"}).encode()) |
|
|
|
yield self.do_request(agent, b"POST", addr, body, |
|
|
|
yield self.do_request(agent, b"POST", addr, body, |
|
|
|
self.process_create_wallet_response) |
|
|
|
self.process_create_wallet_response) |
|
|
|
|
|
|
|
|
|
|
|
@ -266,6 +266,18 @@ class TrialTestWRPC_DisplayWallet(WalletRPCTestBase, unittest.TestCase): |
|
|
|
yield self.do_request(agent, b"GET", addr, None, |
|
|
|
yield self.do_request(agent, b"GET", addr, None, |
|
|
|
self.process_new_addr_response) |
|
|
|
self.process_new_addr_response) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
|
|
|
|
def test_gettimelockaddress(self): |
|
|
|
|
|
|
|
self.daemon.auth_disabled = True |
|
|
|
|
|
|
|
agent = get_nontor_agent() |
|
|
|
|
|
|
|
addr = self.get_route_root() |
|
|
|
|
|
|
|
addr += "/wallet/" |
|
|
|
|
|
|
|
addr += self.daemon.wallet_name |
|
|
|
|
|
|
|
addr += "/address/timelock/new/2023-02" |
|
|
|
|
|
|
|
addr = addr.encode() |
|
|
|
|
|
|
|
yield self.do_request(agent, b"GET", addr, None, |
|
|
|
|
|
|
|
self.process_new_addr_response) |
|
|
|
|
|
|
|
|
|
|
|
def process_new_addr_response(self, response): |
|
|
|
def process_new_addr_response(self, response): |
|
|
|
json_body = json.loads(response.decode("utf-8")) |
|
|
|
json_body = json.loads(response.decode("utf-8")) |
|
|
|
assert validate_address(json_body["address"])[0] |
|
|
|
assert validate_address(json_body["address"])[0] |
|
|
|
|