46
46
CreateOfferForIDsResponse ,
47
47
FungibleAsset ,
48
48
GetHeightInfoResponse ,
49
+ GetWallets ,
50
+ GetWalletsResponse ,
49
51
NFTCalculateRoyalties ,
50
52
NFTGetWalletDID ,
51
53
NFTGetWalletDIDResponse ,
52
54
RoyaltyAsset ,
53
55
SendTransactionResponse ,
54
56
TakeOfferResponse ,
57
+ WalletInfoResponse ,
55
58
)
56
59
from chia .wallet .wallet_spend_bundle import WalletSpendBundle
57
60
@@ -91,7 +94,7 @@ def test_get_transaction(capsys: object, get_test_cli_clients: tuple[TestRpcClie
91
94
run_cli_command_and_assert (capsys , root_dir , [* command_args , CAT_FINGERPRINT_ARG ], cat_assert_list )
92
95
# these are various things that should be in the output
93
96
expected_calls : logType = {
94
- "get_wallets" : [(None ,), ( None ,), ( None ,)] ,
97
+ "get_wallets" : [(GetWallets ( type = None , include_data = True ),)] * 3 ,
95
98
"get_cat_name" : [(1 ,)],
96
99
"get_transaction" : [
97
100
(bytes32 .from_hexstr (bytes32_hexstr ),),
@@ -192,7 +195,7 @@ async def get_coin_records(self, request: GetCoinRecords) -> dict[str, Any]:
192
195
# these are various things that should be in the output
193
196
expected_coin_id = Coin (get_bytes32 (4 ), get_bytes32 (5 ), uint64 (12345678 )).name ()
194
197
expected_calls : logType = {
195
- "get_wallets" : [(None ,), ( None ,)] ,
198
+ "get_wallets" : [(GetWallets ( type = None , include_data = True ),)] * 2 ,
196
199
"get_transactions" : [
197
200
(1 , 2 , 4 , SortKey .RELEVANCE , True , None , None , None ),
198
201
(1 , 2 , 4 , SortKey .RELEVANCE , True , None , None , None ),
@@ -210,28 +213,30 @@ def test_show(capsys: object, get_test_cli_clients: tuple[TestRpcClients, Path])
210
213
211
214
# set RPC Client
212
215
class ShowRpcClient (TestWalletRpcClient ):
213
- async def get_wallets (self , wallet_type : Optional [WalletType ] = None ) -> list [dict [str , Union [str , int ]]]:
214
- self .add_to_log ("get_wallets" , (wallet_type ,))
215
- wallet_list : list [dict [str , Union [str , int ]]] = [
216
- {"data" : "" , "id" : 1 , "name" : "Chia Wallet" , "type" : WalletType .STANDARD_WALLET },
217
- {
218
- "data" : "dc59bcd60ce5fc9c93a5d3b11875486b03efb53a53da61e453f5cf61a774686001ff02ffff01ff02ffff03ff2f"
216
+ async def get_wallets (self , request : GetWallets ) -> GetWalletsResponse :
217
+ self .add_to_log ("get_wallets" , (request ,))
218
+ wallet_list : list [WalletInfoResponse ] = [
219
+ WalletInfoResponse (
220
+ data = "" , id = uint32 (1 ), name = "Chia Wallet" , type = uint8 (WalletType .STANDARD_WALLET .value )
221
+ ),
222
+ WalletInfoResponse (
223
+ data = "dc59bcd60ce5fc9c93a5d3b11875486b03efb53a53da61e453f5cf61a774686001ff02ffff01ff02ffff03ff2f"
219
224
"ffff01ff0880ffff01ff02ffff03ffff09ff2dff0280ff80ffff01ff088080ff018080ff0180ffff04ffff01a09848f0ef"
220
225
"6587565c48ee225cc837abbe406b91946c938e1739da49fc26c04286ff018080" ,
221
- "id" : 2 ,
222
- " name" : "test2" ,
223
- " type" : WalletType .CAT ,
224
- } ,
225
- {
226
- " data" : '{"did_id": "0xcee228b8638c67cb66a55085be99fa3b457ae5b56915896f581990f600b2c652"}' ,
227
- "id" : 3 ,
228
- " name" : "NFT Wallet" ,
229
- " type" : WalletType .NFT ,
230
- } ,
226
+ id = uint32 ( 2 ) ,
227
+ name = "test2" ,
228
+ type = uint8 ( WalletType .CAT . value ) ,
229
+ ) ,
230
+ WalletInfoResponse (
231
+ data = '{"did_id": "0xcee228b8638c67cb66a55085be99fa3b457ae5b56915896f581990f600b2c652"}' ,
232
+ id = uint32 ( 3 ) ,
233
+ name = "NFT Wallet" ,
234
+ type = uint8 ( WalletType .NFT . value ) ,
235
+ ) ,
231
236
]
232
- if wallet_type is WalletType .CAT :
233
- return [wallet_list [1 ]]
234
- return wallet_list
237
+ if request . type is not None and WalletType ( request . type ) is WalletType .CAT :
238
+ return GetWalletsResponse ( [wallet_list [1 ]])
239
+ return GetWalletsResponse ( wallet_list )
235
240
236
241
async def get_height_info (self ) -> GetHeightInfoResponse :
237
242
self .add_to_log ("get_height_info" , ())
@@ -296,7 +301,10 @@ async def get_connections(
296
301
run_cli_command_and_assert (capsys , root_dir , [* command_args , "--wallet_type" , "cat" ], other_assert_list )
297
302
# these are various things that should be in the output
298
303
expected_calls : logType = {
299
- "get_wallets" : [(None ,), (WalletType .CAT ,)],
304
+ "get_wallets" : [
305
+ (GetWallets (type = None , include_data = True ),),
306
+ (GetWallets (type = uint16 (WalletType .CAT .value ), include_data = True ),),
307
+ ],
300
308
"get_sync_status" : [(), ()],
301
309
"get_height_info" : [(), ()],
302
310
"get_wallet_balance" : [(1 ,), (2 ,), (3 ,), (2 ,)],
@@ -427,7 +435,7 @@ async def cat_spend(
427
435
428
436
# these are various things that should be in the output
429
437
expected_calls : logType = {
430
- "get_wallets" : [(None ,), ( None ,)] ,
438
+ "get_wallets" : [(GetWallets ( type = None , include_data = True ),)] * 2 ,
431
439
"send_transaction" : [
432
440
(
433
441
1 ,
0 commit comments