@@ -40,7 +40,7 @@ suite "JSON Conversions":
40
40
}
41
41
42
42
without blk =? Block .fromJson (blkJson[" result" ]):
43
- fail
43
+ unittest. fail
44
44
check blk.hash.isNone
45
45
46
46
test " missing block number in TransactionReceipt isNone" :
@@ -71,12 +71,12 @@ suite "JSON Conversions":
71
71
}
72
72
73
73
without receipt1 =? TransactionReceipt .fromJson (json):
74
- fail
74
+ unittest. fail
75
75
check receipt1.blockNumber.isNone
76
76
77
77
json[" blockNumber" ] = newJString (" " )
78
78
without receipt2 =? TransactionReceipt .fromJson (json):
79
- fail
79
+ unittest. fail
80
80
check receipt2.blockNumber.isNone
81
81
82
82
test " missing block hash in TransactionReceipt isNone" :
@@ -107,7 +107,7 @@ suite "JSON Conversions":
107
107
}
108
108
109
109
without receipt =? TransactionReceipt .fromJson (json):
110
- fail
110
+ unittest. fail
111
111
check receipt.blockHash.isNone
112
112
113
113
test " correctly deserializes PastTransaction" :
@@ -131,7 +131,7 @@ suite "JSON Conversions":
131
131
}
132
132
133
133
without tx =? PastTransaction .fromJson (json):
134
- fail
134
+ unittest. fail
135
135
check tx.blockHash == BlockHash .fromHex (" 0x595bffbe897e025ea2df3213c4cc52c3f3d69bc04b49011d558f1b0e70038922" )
136
136
check tx.blockNumber == 0x 22e .u256
137
137
check tx.sender == Address .init (" 0xe00b677c29ff8d8fe6068530e2bc36158c54dd34" ).get
@@ -210,7 +210,7 @@ suite "JSON Conversions":
210
210
}
211
211
212
212
without past =? PastTransaction .fromJson (json):
213
- fail
213
+ unittest. fail
214
214
check % past.toTransaction == %* {
215
215
" to" : ! Address .init (" 0x92f09aa59dccb892a9f5406ddd9c0b98f02ea57e" ),
216
216
" data" : hexToSeqByte (" 0x6368a471d26ff5c7f835c1a8203235e88846ce1a196d6e79df0eaedd1b8ed3deec2ae5c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000012a00000000000000000000000000000000000000000000000000000000000000" ),
@@ -232,3 +232,23 @@ suite "JSON Conversions":
232
232
let res = BlockTag .fromJson (newJString (" " ))
233
233
check res.error of SerializationError
234
234
check res.error.msg == " Failed to convert '\"\" ' to BlockTag: must be one of 'earliest', 'latest', 'pending'"
235
+
236
+ test " correctly deserializes TransactionType" :
237
+ check ! TransactionType .fromJson (newJString (" 0x0" )) == TransactionType .Legacy
238
+ check ! TransactionType .fromJson (newJString (" 0x1" )) == TransactionType .AccessList
239
+ check ! TransactionType .fromJson (newJString (" 0x2" )) == TransactionType .Dynamic
240
+
241
+ test " correctly serializes TransactionType" :
242
+ check TransactionType .Legacy .toJson == " \" 0x0\" "
243
+ check TransactionType .AccessList .toJson == " \" 0x1\" "
244
+ check TransactionType .Dynamic .toJson == " \" 0x2\" "
245
+
246
+ test " correctly deserializes TransactionStatus" :
247
+ check ! TransactionStatus .fromJson (newJString (" 0x0" )) == TransactionStatus .Failure
248
+ check ! TransactionStatus .fromJson (newJString (" 0x1" )) == TransactionStatus .Success
249
+ check ! TransactionStatus .fromJson (newJString (" 0x2" )) == TransactionStatus .Invalid
250
+
251
+ test " correctly serializes TransactionStatus" :
252
+ check TransactionStatus .Failure .toJson == " \" 0x0\" "
253
+ check TransactionStatus .Success .toJson == " \" 0x1\" "
254
+ check TransactionStatus .Invalid .toJson == " \" 0x2\" "
0 commit comments