@@ -10,6 +10,7 @@ defmodule Ethers.CounterContractTest do
10
10
import Ethers.TestHelpers
11
11
12
12
alias Ethers.Event
13
+ alias Ethers.Utils
13
14
14
15
alias Ethers.Contract.Test.CounterContract
15
16
@@ -122,7 +123,7 @@ defmodule Ethers.CounterContractTest do
122
123
test "calling view functions" , % { address: address } do
123
124
assert % Ethers.TxData {
124
125
base_module: CounterContract ,
125
- data: "0x6d4ce63c" ,
126
+ data: Utils . hex_decode! ( "0x6d4ce63c" ) ,
126
127
selector: % ABI.FunctionSelector {
127
128
function: "get" ,
128
129
method_id: << 109 , 76 , 230 , 60 >> ,
@@ -142,7 +143,9 @@ defmodule Ethers.CounterContractTest do
142
143
end
143
144
144
145
test "sending transaction with state mutating functions" , % { address: address } do
145
- { :ok , tx_hash } = CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from , to: address )
146
+ { :ok , tx_hash } =
147
+ CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from , to: address )
148
+
146
149
wait_for_transaction! ( tx_hash )
147
150
148
151
{ :ok , 101 } = CounterContract . get ( ) |> Ethers . call ( to: address )
@@ -160,7 +163,9 @@ defmodule Ethers.CounterContractTest do
160
163
161
164
test "returns error if to address is not given" do
162
165
assert { :error , :no_to_address } = CounterContract . get ( ) |> Ethers . call ( )
163
- assert { :error , :no_to_address } = CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from )
166
+
167
+ assert { :error , :no_to_address } =
168
+ CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from )
164
169
165
170
assert { :error , :no_to_address } =
166
171
CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from , gas: 100 )
@@ -203,7 +208,10 @@ defmodule Ethers.CounterContractTest do
203
208
test "returns the params when called" do
204
209
assert % Ethers.TxData {
205
210
base_module: CounterContract ,
206
- data: "0x60fe47b10000000000000000000000000000000000000000000000000000000000000065" ,
211
+ data:
212
+ Utils . hex_decode! (
213
+ "0x60fe47b10000000000000000000000000000000000000000000000000000000000000065"
214
+ ) ,
207
215
selector: % ABI.FunctionSelector {
208
216
function: "set" ,
209
217
method_id: << 96 , 254 , 71 , 177 >> ,
@@ -223,7 +231,8 @@ defmodule Ethers.CounterContractTest do
223
231
setup :deploy_counter_contract
224
232
225
233
test "can get the emitted event with the correct filter" , % { address: address } do
226
- { :ok , tx_hash } = CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from , to: address )
234
+ { :ok , tx_hash } =
235
+ CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from , to: address )
227
236
228
237
wait_for_transaction! ( tx_hash )
229
238
@@ -245,7 +254,8 @@ defmodule Ethers.CounterContractTest do
245
254
end
246
255
247
256
test "cat get the emitted events with get_logs! function" , % { address: address } do
248
- { :ok , tx_hash } = CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from , to: address )
257
+ { :ok , tx_hash } =
258
+ CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from , to: address )
249
259
250
260
wait_for_transaction! ( tx_hash )
251
261
@@ -275,7 +285,8 @@ defmodule Ethers.CounterContractTest do
275
285
end
276
286
277
287
test "can filter logs with from_block and to_block options" , % { address: address } do
278
- { :ok , tx_hash } = CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from , to: address )
288
+ { :ok , tx_hash } =
289
+ CounterContract . set ( 101 ) |> Ethers . send_transaction ( from: @ from , to: address )
279
290
280
291
wait_for_transaction! ( tx_hash )
281
292
0 commit comments