105
105
from chia .wallet .wallet_request_types import (
106
106
AddKey ,
107
107
CheckDeleteKey ,
108
+ ClawbackPuzzleDecoratorOverride ,
108
109
CombineCoins ,
109
110
DefaultCAT ,
110
111
DeleteKey ,
140
141
PushTransactions ,
141
142
PushTX ,
142
143
RoyaltyAsset ,
144
+ SendTransaction ,
143
145
SetWalletResyncOnStartup ,
144
146
SplitCoins ,
145
147
VerifySignature ,
@@ -382,24 +384,25 @@ async def test_send_transaction(wallet_rpc_environment: WalletRpcTestEnvironment
382
384
addr = encode_puzzle_hash (await action_scope .get_puzzle_hash (wallet_2 .wallet_state_manager ), "txch" )
383
385
tx_amount = uint64 (15600000 )
384
386
with pytest .raises (ValueError ):
385
- await client .send_transaction (1 , uint64 (100000000000000001 ), addr , DEFAULT_TX_CONFIG )
387
+ await client .send_transaction (
388
+ SendTransaction (wallet_id = uint32 (1 ), amount = uint64 (100000000000000001 ), address = addr , push = True ),
389
+ DEFAULT_TX_CONFIG ,
390
+ )
386
391
387
392
# Tests sending a basic transaction
388
393
extra_conditions = (Remark (Program .to (("test" , None ))),)
389
394
non_existent_coin = Coin (bytes32 .zeros , bytes32 .zeros , uint64 (0 ))
390
395
tx_no_push = (
391
396
await client .send_transaction (
392
- 1 ,
393
- tx_amount ,
394
- addr ,
395
- memos = ["this is a basic tx" ],
397
+ SendTransaction (
398
+ wallet_id = uint32 (1 ), amount = tx_amount , address = addr , memos = ["this is a basic tx" ], push = False
399
+ ),
396
400
tx_config = DEFAULT_TX_CONFIG .override (
397
401
excluded_coin_amounts = [uint64 (250000000000 )],
398
402
excluded_coin_ids = [non_existent_coin .name ()],
399
403
reuse_puzhash = True ,
400
404
),
401
405
extra_conditions = extra_conditions ,
402
- push = False ,
403
406
)
404
407
).transaction
405
408
response = await client .fetch (
@@ -841,12 +844,14 @@ async def test_spend_clawback_coins(wallet_rpc_environment: WalletRpcTestEnviron
841
844
wallet_2_puzhash = await action_scope .get_puzzle_hash (wallet_2 .wallet_state_manager )
842
845
tx = (
843
846
await wallet_1_rpc .send_transaction (
844
- wallet_id = 1 ,
845
- amount = uint64 (500 ),
846
- address = encode_puzzle_hash (wallet_2_puzhash , "txch" ),
847
+ SendTransaction (
848
+ wallet_id = uint32 (1 ),
849
+ amount = uint64 (500 ),
850
+ address = encode_puzzle_hash (wallet_2_puzhash , "txch" ),
851
+ puzzle_decorator = [ClawbackPuzzleDecoratorOverride (decorator = "CLAWBACK" , clawback_timelock = uint64 (5 ))],
852
+ push = True ,
853
+ ),
847
854
tx_config = DEFAULT_TX_CONFIG ,
848
- fee = uint64 (0 ),
849
- puzzle_decorator_override = [{"decorator" : "CLAWBACK" , "clawback_timelock" : 5 }],
850
855
)
851
856
).transaction
852
857
clawback_coin_id_1 = tx .additions [0 ].name ()
@@ -855,12 +860,14 @@ async def test_spend_clawback_coins(wallet_rpc_environment: WalletRpcTestEnviron
855
860
await full_node_api .wait_for_wallet_synced (wallet_node = wallet_2_node , timeout = 20 )
856
861
tx = (
857
862
await wallet_2_rpc .send_transaction (
858
- wallet_id = 1 ,
859
- amount = uint64 (500 ),
860
- address = encode_puzzle_hash (wallet_1_puzhash , "txch" ),
863
+ SendTransaction (
864
+ wallet_id = uint32 (1 ),
865
+ amount = uint64 (500 ),
866
+ address = encode_puzzle_hash (wallet_1_puzhash , "txch" ),
867
+ puzzle_decorator = [ClawbackPuzzleDecoratorOverride (decorator = "CLAWBACK" , clawback_timelock = uint64 (5 ))],
868
+ push = True ,
869
+ ),
861
870
tx_config = DEFAULT_TX_CONFIG ,
862
- fee = uint64 (0 ),
863
- puzzle_decorator_override = [{"decorator" : "CLAWBACK" , "clawback_timelock" : 5 }],
864
871
)
865
872
).transaction
866
873
assert tx .spend_bundle is not None
@@ -1023,7 +1030,8 @@ async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment
1023
1030
puzhash = await action_scope .get_puzzle_hash (wallet .wallet_state_manager )
1024
1031
await full_node_api .wait_for_wallet_synced (wallet_node = wallet_node , timeout = 20 )
1025
1032
await client .send_transaction (
1026
- 1 , uint64 (1 ), encode_puzzle_hash (puzhash , "txch" ), DEFAULT_TX_CONFIG
1033
+ SendTransaction (wallet_id = uint32 (1 ), amount = uint64 (1 ), address = encode_puzzle_hash (puzhash , "txch" ), push = True ),
1034
+ DEFAULT_TX_CONFIG ,
1027
1035
) # Create a pending tx
1028
1036
1029
1037
with pytest .raises (ValueError , match = "There is no known sort foo" ):
@@ -1049,7 +1057,12 @@ async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment
1049
1057
async with wallet .wallet_state_manager .new_action_scope (DEFAULT_TX_CONFIG , push = True ) as action_scope :
1050
1058
ph_by_addr = await action_scope .get_puzzle_hash (wallet .wallet_state_manager )
1051
1059
await full_node_api .wait_for_wallet_synced (wallet_node = wallet_node , timeout = 20 )
1052
- await client .send_transaction (1 , uint64 (1 ), encode_puzzle_hash (ph_by_addr , "txch" ), DEFAULT_TX_CONFIG )
1060
+ await client .send_transaction (
1061
+ SendTransaction (
1062
+ wallet_id = uint32 (1 ), amount = uint64 (1 ), address = encode_puzzle_hash (ph_by_addr , "txch" ), push = True
1063
+ ),
1064
+ DEFAULT_TX_CONFIG ,
1065
+ )
1053
1066
await full_node_api .wait_for_wallet_synced (wallet_node = wallet_node , timeout = 20 )
1054
1067
tx_for_address = (
1055
1068
await client .get_transactions (GetTransactions (uint32 (1 ), to_address = encode_puzzle_hash (ph_by_addr , "txch" )))
@@ -1801,7 +1814,12 @@ async def test_get_coin_records_by_names(wallet_rpc_environment: WalletRpcTestEn
1801
1814
await full_node_api .wait_for_wallet_synced (wallet_node = wallet_node , timeout = 20 )
1802
1815
1803
1816
# Spend half of it back to the same wallet get some spent coins in the wallet
1804
- tx = (await client .send_transaction (1 , uint64 (generated_funds / 2 ), address , DEFAULT_TX_CONFIG )).transaction
1817
+ tx = (
1818
+ await client .send_transaction (
1819
+ SendTransaction (wallet_id = uint32 (1 ), amount = uint64 (generated_funds / 2 ), address = address , push = True ),
1820
+ DEFAULT_TX_CONFIG ,
1821
+ )
1822
+ ).transaction
1805
1823
assert tx .spend_bundle is not None
1806
1824
await time_out_assert (20 , tx_in_mempool , True , client , tx .name )
1807
1825
await farm_transaction (full_node_api , wallet_node , tx .spend_bundle )
@@ -2167,7 +2185,11 @@ async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEn
2167
2185
addr = encode_puzzle_hash (ph , "txch" )
2168
2186
tx_amount = uint64 (15600000 )
2169
2187
await env .full_node .api .wait_for_wallet_synced (wallet_node = wallet_node , timeout = 20 )
2170
- created_tx = (await client .send_transaction (1 , tx_amount , addr , DEFAULT_TX_CONFIG )).transaction
2188
+ created_tx = (
2189
+ await client .send_transaction (
2190
+ SendTransaction (wallet_id = uint32 (1 ), amount = tx_amount , address = addr , push = True ), DEFAULT_TX_CONFIG
2191
+ )
2192
+ ).transaction
2171
2193
2172
2194
await time_out_assert (20 , tx_in_mempool , True , client , created_tx .name )
2173
2195
assert len (await wallet .wallet_state_manager .tx_store .get_unconfirmed_for_wallet (1 )) == 1
@@ -2230,7 +2252,10 @@ async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEn
2230
2252
assert await get_unconfirmed_balance (client , int (wallets [0 ].id )) == 0
2231
2253
2232
2254
with pytest .raises (ValueError ):
2233
- await client .send_transaction (wallets [0 ].id , uint64 (100 ), addr , DEFAULT_TX_CONFIG )
2255
+ await client .send_transaction (
2256
+ SendTransaction (wallet_id = uint32 (wallets [0 ].id ), amount = uint64 (100 ), address = addr , push = True ),
2257
+ DEFAULT_TX_CONFIG ,
2258
+ )
2234
2259
2235
2260
# Delete all keys
2236
2261
await client .delete_all_keys ()
@@ -2256,7 +2281,11 @@ async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment
2256
2281
for tx_amount in tx_amounts :
2257
2282
funds -= tx_amount
2258
2283
# create coins for tests
2259
- tx = (await client .send_transaction (1 , tx_amount , addr , DEFAULT_TX_CONFIG )).transaction
2284
+ tx = (
2285
+ await client .send_transaction (
2286
+ SendTransaction (wallet_id = uint32 (1 ), amount = tx_amount , address = addr , push = True ), DEFAULT_TX_CONFIG
2287
+ )
2288
+ ).transaction
2260
2289
spend_bundle = tx .spend_bundle
2261
2290
assert spend_bundle is not None
2262
2291
for coin in spend_bundle .additions ():
@@ -2817,12 +2846,14 @@ async def test_set_wallet_resync_on_startup(wallet_rpc_environment: WalletRpcTes
2817
2846
# Test Clawback resync
2818
2847
tx = (
2819
2848
await wc .send_transaction (
2820
- wallet_id = 1 ,
2821
- amount = uint64 (500 ),
2822
- address = address ,
2849
+ SendTransaction (
2850
+ wallet_id = uint32 (1 ),
2851
+ amount = uint64 (500 ),
2852
+ address = address ,
2853
+ puzzle_decorator = [ClawbackPuzzleDecoratorOverride (decorator = "CLAWBACK" , clawback_timelock = uint64 (5 ))],
2854
+ push = True ,
2855
+ ),
2823
2856
tx_config = DEFAULT_TX_CONFIG ,
2824
- fee = uint64 (0 ),
2825
- puzzle_decorator_override = [{"decorator" : "CLAWBACK" , "clawback_timelock" : 5 }],
2826
2857
)
2827
2858
).transaction
2828
2859
clawback_coin_id = tx .additions [0 ].name ()
@@ -2965,7 +2996,11 @@ async def test_cat_spend_run_tail(wallet_rpc_environment: WalletRpcTestEnvironme
2965
2996
)
2966
2997
tx_amount = uint64 (100 )
2967
2998
2968
- tx = (await client .send_transaction (1 , tx_amount , addr , DEFAULT_TX_CONFIG )).transaction
2999
+ tx = (
3000
+ await client .send_transaction (
3001
+ SendTransaction (wallet_id = uint32 (1 ), amount = tx_amount , address = addr , push = True ), DEFAULT_TX_CONFIG
3002
+ )
3003
+ ).transaction
2969
3004
transaction_id = tx .name
2970
3005
spend_bundle = tx .spend_bundle
2971
3006
assert spend_bundle is not None
0 commit comments