@@ -45,9 +45,9 @@ def payable_tester_contract(web3, PayableTesterContract, address_conversion_func
45
45
def test_build_transaction_not_paying_to_nonpayable_function (
46
46
web3 ,
47
47
payable_tester_contract ,
48
- buildTransaction ):
49
- txn = buildTransaction (contract = payable_tester_contract ,
50
- contract_function = 'doNoValueCall' )
48
+ build_transaction ):
49
+ txn = build_transaction (contract = payable_tester_contract ,
50
+ contract_function = 'doNoValueCall' )
51
51
assert dissoc (txn , 'gas' ) == {
52
52
'to' : payable_tester_contract .address ,
53
53
'data' : '0xe4cb8f5c' ,
@@ -61,15 +61,15 @@ def test_build_transaction_not_paying_to_nonpayable_function(
61
61
def test_build_transaction_paying_to_nonpayable_function (
62
62
web3 ,
63
63
payable_tester_contract ,
64
- buildTransaction ):
64
+ build_transaction ):
65
65
with pytest .raises (ValidationError ):
66
- buildTransaction (contract = payable_tester_contract ,
67
- contract_function = 'doNoValueCall' ,
68
- tx_params = {'value' : 1 })
66
+ build_transaction (contract = payable_tester_contract ,
67
+ contract_function = 'doNoValueCall' ,
68
+ tx_params = {'value' : 1 })
69
69
70
70
71
- def test_build_transaction_with_contract_no_arguments (web3 , math_contract , buildTransaction ):
72
- txn = buildTransaction (contract = math_contract , contract_function = 'increment' )
71
+ def test_build_transaction_with_contract_no_arguments (web3 , math_contract , build_transaction ):
72
+ txn = build_transaction (contract = math_contract , contract_function = 'increment' )
73
73
assert dissoc (txn , 'gas' ) == {
74
74
'to' : math_contract .address ,
75
75
'data' : '0xd09de08a' ,
@@ -81,7 +81,7 @@ def test_build_transaction_with_contract_no_arguments(web3, math_contract, build
81
81
82
82
83
83
def test_build_transaction_with_contract_fallback_function (web3 , fallback_function_contract ):
84
- txn = fallback_function_contract .fallback .buildTransaction ()
84
+ txn = fallback_function_contract .fallback .build_transaction ()
85
85
assert dissoc (txn , 'gas' ) == {
86
86
'to' : fallback_function_contract .address ,
87
87
'data' : '0x' ,
@@ -96,8 +96,8 @@ def test_build_transaction_with_contract_class_method(
96
96
web3 ,
97
97
MathContract ,
98
98
math_contract ,
99
- buildTransaction ):
100
- txn = buildTransaction (
99
+ build_transaction ):
100
+ txn = build_transaction (
101
101
contract = MathContract ,
102
102
contract_function = 'increment' ,
103
103
tx_params = {'to' : math_contract .address },
@@ -115,8 +115,8 @@ def test_build_transaction_with_contract_class_method(
115
115
def test_build_transaction_with_contract_default_account_is_set (
116
116
web3 ,
117
117
math_contract ,
118
- buildTransaction ):
119
- txn = buildTransaction (contract = math_contract , contract_function = 'increment' )
118
+ build_transaction ):
119
+ txn = build_transaction (contract = math_contract , contract_function = 'increment' )
120
120
assert dissoc (txn , 'gas' ) == {
121
121
'to' : math_contract .address ,
122
122
'data' : '0xd09de08a' ,
@@ -127,11 +127,11 @@ def test_build_transaction_with_contract_default_account_is_set(
127
127
}
128
128
129
129
130
- def test_build_transaction_with_gas_price_strategy_set (web3 , math_contract , buildTransaction ):
130
+ def test_build_transaction_with_gas_price_strategy_set (web3 , math_contract , build_transaction ):
131
131
def my_gas_price_strategy (web3 , transaction_params ):
132
132
return 5
133
133
web3 .eth .set_gas_price_strategy (my_gas_price_strategy )
134
- txn = buildTransaction (contract = math_contract , contract_function = 'increment' )
134
+ txn = build_transaction (contract = math_contract , contract_function = 'increment' )
135
135
assert dissoc (txn , 'gas' ) == {
136
136
'to' : math_contract .address ,
137
137
'data' : '0xd09de08a' ,
@@ -143,20 +143,20 @@ def my_gas_price_strategy(web3, transaction_params):
143
143
144
144
def test_build_transaction_with_contract_data_supplied_errors (web3 ,
145
145
math_contract ,
146
- buildTransaction ):
146
+ build_transaction ):
147
147
with pytest .raises (ValueError ):
148
- buildTransaction (contract = math_contract ,
149
- contract_function = 'increment' ,
150
- tx_params = {'data' : '0x000' })
148
+ build_transaction (contract = math_contract ,
149
+ contract_function = 'increment' ,
150
+ tx_params = {'data' : '0x000' })
151
151
152
152
153
153
def test_build_transaction_with_contract_to_address_supplied_errors (web3 ,
154
154
math_contract ,
155
- buildTransaction ):
155
+ build_transaction ):
156
156
with pytest .raises (ValueError ):
157
- buildTransaction (contract = math_contract ,
158
- contract_function = 'increment' ,
159
- tx_params = {'to' : '0xb2930B35844a230f00E51431aCAe96Fe543a0347' })
157
+ build_transaction (contract = math_contract ,
158
+ contract_function = 'increment' ,
159
+ tx_params = {'to' : '0xb2930B35844a230f00E51431aCAe96Fe543a0347' })
160
160
161
161
162
162
@pytest .mark .parametrize (
@@ -219,19 +219,24 @@ def test_build_transaction_with_contract_with_arguments(web3, skip_if_testrpc, m
219
219
method_kwargs ,
220
220
expected ,
221
221
skip_testrpc ,
222
- buildTransaction ):
222
+ build_transaction ):
223
223
if skip_testrpc :
224
224
skip_if_testrpc (web3 )
225
225
226
- txn = buildTransaction (contract = math_contract ,
227
- contract_function = 'increment' ,
228
- func_args = method_args ,
229
- func_kwargs = method_kwargs ,
230
- tx_params = transaction_args )
226
+ txn = build_transaction (contract = math_contract ,
227
+ contract_function = 'increment' ,
228
+ func_args = method_args ,
229
+ func_kwargs = method_kwargs ,
230
+ tx_params = transaction_args )
231
231
expected ['to' ] = math_contract .address
232
232
assert txn is not None
233
233
if 'gas' in transaction_args :
234
234
assert txn ['gas' ] == transaction_args ['gas' ]
235
235
else :
236
236
assert 'gas' in txn
237
237
assert dissoc (txn , 'gas' ) == expected
238
+
239
+
240
+ def test_buildTransaction_deprecated (math_contract ):
241
+ with pytest .warns (DeprecationWarning , match = "deprecated in favor of build_transaction" ):
242
+ math_contract .functions .counter ().buildTransaction ()
0 commit comments