121
121
DIDTransferDID ,
122
122
DIDUpdateMetadata ,
123
123
FungibleAsset ,
124
+ GetCoinRecordsByNames ,
124
125
GetNextAddress ,
125
126
GetNotifications ,
126
127
GetPrivateKey ,
@@ -1504,13 +1505,17 @@ async def test_offer_endpoints(wallet_environments: WalletTestFramework, wallet_
1504
1505
]
1505
1506
)
1506
1507
1507
- test_crs : list [CoinRecord ] = await env_1 .rpc_client .get_coin_records_by_names (
1508
- [a .name () for a in spend_bundle .additions () if a .amount != 4 ]
1509
- )
1508
+ test_crs : list [CoinRecord ] = (
1509
+ await env_1 .rpc_client .get_coin_records_by_names (
1510
+ GetCoinRecordsByNames ([a .name () for a in spend_bundle .additions () if a .amount != 4 ])
1511
+ )
1512
+ ).coin_records
1510
1513
for cr in test_crs :
1511
1514
assert cr .coin in spend_bundle .additions ()
1512
1515
with pytest .raises (ValueError ):
1513
- await env_1 .rpc_client .get_coin_records_by_names ([a .name () for a in spend_bundle .additions () if a .amount == 4 ])
1516
+ await env_1 .rpc_client .get_coin_records_by_names (
1517
+ GetCoinRecordsByNames ([a .name () for a in spend_bundle .additions () if a .amount == 4 ])
1518
+ )
1514
1519
# Create an offer of 5 chia for one CAT
1515
1520
await env_1 .rpc_client .create_offer_for_ids (
1516
1521
{uint32 (1 ): - 5 , cat_asset_id .hex (): 1 }, wallet_environments .tx_config , validate_only = True
@@ -1855,16 +1860,18 @@ async def test_get_coin_records_by_names(wallet_rpc_environment: WalletRpcTestEn
1855
1860
assert len (coin_ids_unspent ) > 0
1856
1861
# Do some queries to trigger all parameters
1857
1862
# 1. Empty coin_ids
1858
- assert await client .get_coin_records_by_names ([]) == []
1863
+ assert ( await client .get_coin_records_by_names (GetCoinRecordsByNames ( []))). coin_records == []
1859
1864
# 2. All coins
1860
- rpc_result = await client .get_coin_records_by_names (coin_ids + coin_ids_unspent )
1861
- assert {record .coin for record in rpc_result } == {* coins , * coins_unspent }
1865
+ rpc_result = await client .get_coin_records_by_names (GetCoinRecordsByNames ( coin_ids + coin_ids_unspent ) )
1866
+ assert {record .coin for record in rpc_result . coin_records } == {* coins , * coins_unspent }
1862
1867
# 3. All spent coins
1863
- rpc_result = await client .get_coin_records_by_names (coin_ids , include_spent_coins = True )
1864
- assert {record .coin for record in rpc_result } == coins
1868
+ rpc_result = await client .get_coin_records_by_names (GetCoinRecordsByNames ( coin_ids , include_spent_coins = True ) )
1869
+ assert {record .coin for record in rpc_result . coin_records } == coins
1865
1870
# 4. All unspent coins
1866
- rpc_result = await client .get_coin_records_by_names (coin_ids_unspent , include_spent_coins = False )
1867
- assert {record .coin for record in rpc_result } == coins_unspent
1871
+ rpc_result = await client .get_coin_records_by_names (
1872
+ GetCoinRecordsByNames (coin_ids_unspent , include_spent_coins = False )
1873
+ )
1874
+ assert {record .coin for record in rpc_result .coin_records } == coins_unspent
1868
1875
# 5. Filter start/end height
1869
1876
filter_records = result .records [:10 ]
1870
1877
assert len (filter_records ) == 10
@@ -1873,11 +1880,13 @@ async def test_get_coin_records_by_names(wallet_rpc_environment: WalletRpcTestEn
1873
1880
min_height = min (record .confirmed_block_height for record in filter_records )
1874
1881
max_height = max (record .confirmed_block_height for record in filter_records )
1875
1882
assert min_height != max_height
1876
- rpc_result = await client .get_coin_records_by_names (filter_coin_ids , start_height = min_height , end_height = max_height )
1877
- assert {record .coin for record in rpc_result } == filter_coins
1883
+ rpc_result = await client .get_coin_records_by_names (
1884
+ GetCoinRecordsByNames (filter_coin_ids , start_height = min_height , end_height = max_height )
1885
+ )
1886
+ assert {record .coin for record in rpc_result .coin_records } == filter_coins
1878
1887
# 8. Test the failure case
1879
1888
with pytest .raises (ValueError , match = "not found" ):
1880
- await client .get_coin_records_by_names (coin_ids , include_spent_coins = False )
1889
+ await client .get_coin_records_by_names (GetCoinRecordsByNames ( coin_ids , include_spent_coins = False ) )
1881
1890
1882
1891
1883
1892
@pytest .mark .anyio
0 commit comments