@@ -225,47 +225,47 @@ func (t *Transaction) Hash(ctx context.Context) common.Hash {
225
225
return t .hash
226
226
}
227
227
228
- func (t * Transaction ) InputData (ctx context.Context ) ( hexutil.Bytes , error ) {
229
- tx , _ , err := t .resolve (ctx )
230
- if err != nil || tx == nil {
231
- return hexutil.Bytes {}, err
228
+ func (t * Transaction ) InputData (ctx context.Context ) hexutil.Bytes {
229
+ tx , _ := t .resolve (ctx )
230
+ if tx == nil {
231
+ return hexutil.Bytes {}
232
232
}
233
- return tx .Data (), nil
233
+ return tx .Data ()
234
234
}
235
235
236
- func (t * Transaction ) Gas (ctx context.Context ) ( hexutil.Uint64 , error ) {
237
- tx , _ , err := t .resolve (ctx )
238
- if err != nil || tx == nil {
239
- return 0 , err
236
+ func (t * Transaction ) Gas (ctx context.Context ) hexutil.Uint64 {
237
+ tx , _ := t .resolve (ctx )
238
+ if tx == nil {
239
+ return 0
240
240
}
241
- return hexutil .Uint64 (tx .Gas ()), nil
241
+ return hexutil .Uint64 (tx .Gas ())
242
242
}
243
243
244
- func (t * Transaction ) GasPrice (ctx context.Context ) ( hexutil.Big , error ) {
245
- tx , block , err := t .resolve (ctx )
246
- if err != nil || tx == nil {
247
- return hexutil.Big {}, err
244
+ func (t * Transaction ) GasPrice (ctx context.Context ) hexutil.Big {
245
+ tx , block := t .resolve (ctx )
246
+ if tx == nil {
247
+ return hexutil.Big {}
248
248
}
249
249
switch tx .Type () {
250
250
case types .AccessListTxType :
251
- return hexutil .Big (* tx .GasPrice ()), nil
251
+ return hexutil .Big (* tx .GasPrice ())
252
252
case types .DynamicFeeTxType :
253
253
if block != nil {
254
254
if baseFee , _ := block .BaseFeePerGas (ctx ); baseFee != nil {
255
255
// price = min(tip, gasFeeCap - baseFee) + baseFee
256
- return (hexutil .Big )(* math .BigMin (new (big.Int ).Add (tx .GasTipCap (), baseFee .ToInt ()), tx .GasFeeCap ())), nil
256
+ return (hexutil .Big )(* math .BigMin (new (big.Int ).Add (tx .GasTipCap (), baseFee .ToInt ()), tx .GasFeeCap ()))
257
257
}
258
258
}
259
- return hexutil .Big (* tx .GasPrice ()), nil
259
+ return hexutil .Big (* tx .GasPrice ())
260
260
default :
261
- return hexutil .Big (* tx .GasPrice ()), nil
261
+ return hexutil .Big (* tx .GasPrice ())
262
262
}
263
263
}
264
264
265
265
func (t * Transaction ) EffectiveGasPrice (ctx context.Context ) (* hexutil.Big , error ) {
266
- tx , block , err := t .resolve (ctx )
267
- if err != nil || tx == nil {
268
- return nil , err
266
+ tx , block := t .resolve (ctx )
267
+ if tx == nil {
268
+ return nil , nil
269
269
}
270
270
// Pending tx
271
271
if block == nil {
@@ -281,40 +281,40 @@ func (t *Transaction) EffectiveGasPrice(ctx context.Context) (*hexutil.Big, erro
281
281
return (* hexutil .Big )(math .BigMin (new (big.Int ).Add (tx .GasTipCap (), header .BaseFee ), tx .GasFeeCap ())), nil
282
282
}
283
283
284
- func (t * Transaction ) MaxFeePerGas (ctx context.Context ) ( * hexutil.Big , error ) {
285
- tx , _ , err := t .resolve (ctx )
286
- if err != nil || tx == nil {
287
- return nil , err
284
+ func (t * Transaction ) MaxFeePerGas (ctx context.Context ) * hexutil.Big {
285
+ tx , _ := t .resolve (ctx )
286
+ if tx == nil {
287
+ return nil
288
288
}
289
289
switch tx .Type () {
290
290
case types .AccessListTxType :
291
- return nil , nil
291
+ return nil
292
292
case types .DynamicFeeTxType :
293
- return (* hexutil .Big )(tx .GasFeeCap ()), nil
293
+ return (* hexutil .Big )(tx .GasFeeCap ())
294
294
default :
295
- return nil , nil
295
+ return nil
296
296
}
297
297
}
298
298
299
- func (t * Transaction ) MaxPriorityFeePerGas (ctx context.Context ) ( * hexutil.Big , error ) {
300
- tx , _ , err := t .resolve (ctx )
301
- if err != nil || tx == nil {
302
- return nil , err
299
+ func (t * Transaction ) MaxPriorityFeePerGas (ctx context.Context ) * hexutil.Big {
300
+ tx , _ := t .resolve (ctx )
301
+ if tx == nil {
302
+ return nil
303
303
}
304
304
switch tx .Type () {
305
305
case types .AccessListTxType :
306
- return nil , nil
306
+ return nil
307
307
case types .DynamicFeeTxType :
308
- return (* hexutil .Big )(tx .GasTipCap ()), nil
308
+ return (* hexutil .Big )(tx .GasTipCap ())
309
309
default :
310
- return nil , nil
310
+ return nil
311
311
}
312
312
}
313
313
314
314
func (t * Transaction ) EffectiveTip (ctx context.Context ) (* hexutil.Big , error ) {
315
- tx , block , err := t .resolve (ctx )
316
- if err != nil || tx == nil {
317
- return nil , err
315
+ tx , block := t .resolve (ctx )
316
+ if tx == nil {
317
+ return nil , nil
318
318
}
319
319
// Pending tx
320
320
if block == nil {
@@ -336,81 +336,72 @@ func (t *Transaction) EffectiveTip(ctx context.Context) (*hexutil.Big, error) {
336
336
}
337
337
338
338
func (t * Transaction ) Value (ctx context.Context ) (hexutil.Big , error ) {
339
- tx , _ , err := t .resolve (ctx )
340
- if err != nil || tx == nil {
341
- return hexutil.Big {}, err
339
+ tx , _ := t .resolve (ctx )
340
+ if tx == nil {
341
+ return hexutil.Big {}, nil
342
342
}
343
343
if tx .Value () == nil {
344
344
return hexutil.Big {}, fmt .Errorf ("invalid transaction value %x" , t .hash )
345
345
}
346
346
return hexutil .Big (* tx .Value ()), nil
347
347
}
348
348
349
- func (t * Transaction ) Nonce (ctx context.Context ) ( hexutil.Uint64 , error ) {
350
- tx , _ , err := t .resolve (ctx )
351
- if err != nil || tx == nil {
352
- return 0 , err
349
+ func (t * Transaction ) Nonce (ctx context.Context ) hexutil.Uint64 {
350
+ tx , _ := t .resolve (ctx )
351
+ if tx == nil {
352
+ return 0
353
353
}
354
- return hexutil .Uint64 (tx .Nonce ()), nil
354
+ return hexutil .Uint64 (tx .Nonce ())
355
355
}
356
356
357
- func (t * Transaction ) To (ctx context.Context , args BlockNumberArgs ) ( * Account , error ) {
358
- tx , _ , err := t .resolve (ctx )
359
- if err != nil || tx == nil {
360
- return nil , err
357
+ func (t * Transaction ) To (ctx context.Context , args BlockNumberArgs ) * Account {
358
+ tx , _ := t .resolve (ctx )
359
+ if tx == nil {
360
+ return nil
361
361
}
362
362
to := tx .To ()
363
363
if to == nil {
364
- return nil , nil
364
+ return nil
365
365
}
366
366
return & Account {
367
367
r : t .r ,
368
368
address : * to ,
369
369
blockNrOrHash : args .NumberOrLatest (),
370
- }, nil
370
+ }
371
371
}
372
372
373
- func (t * Transaction ) From (ctx context.Context , args BlockNumberArgs ) ( * Account , error ) {
374
- tx , _ , err := t .resolve (ctx )
375
- if err != nil || tx == nil {
376
- return nil , err
373
+ func (t * Transaction ) From (ctx context.Context , args BlockNumberArgs ) * Account {
374
+ tx , _ := t .resolve (ctx )
375
+ if tx == nil {
376
+ return nil
377
377
}
378
378
signer := types .LatestSigner (t .r .backend .ChainConfig ())
379
379
from , _ := types .Sender (signer , tx )
380
380
return & Account {
381
381
r : t .r ,
382
382
address : from ,
383
383
blockNrOrHash : args .NumberOrLatest (),
384
- }, nil
384
+ }
385
385
}
386
386
387
- func (t * Transaction ) Block (ctx context.Context ) (* Block , error ) {
388
- _ , block , err := t .resolve (ctx )
389
- if err != nil {
390
- return nil , err
391
- }
392
- return block , nil
387
+ func (t * Transaction ) Block (ctx context.Context ) * Block {
388
+ _ , block := t .resolve (ctx )
389
+ return block
393
390
}
394
391
395
- func (t * Transaction ) Index (ctx context.Context ) (* hexutil.Uint64 , error ) {
396
- _ , block , err := t .resolve (ctx )
397
- if err != nil {
398
- return nil , err
399
- }
392
+ func (t * Transaction ) Index (ctx context.Context ) * hexutil.Uint64 {
393
+ _ , block := t .resolve (ctx )
400
394
// Pending tx
401
395
if block == nil {
402
- return nil , nil
396
+ return nil
403
397
}
404
398
index := hexutil .Uint64 (t .index )
405
- return & index , nil
399
+ return & index
406
400
}
407
401
408
402
// getReceipt returns the receipt associated with this transaction, if any.
409
403
func (t * Transaction ) getReceipt (ctx context.Context ) (* types.Receipt , error ) {
410
- _ , block , err := t .resolve (ctx )
411
- if err != nil {
412
- return nil , err
413
- }
404
+ _ , block := t .resolve (ctx )
414
405
// Pending tx
415
406
if block == nil {
416
407
return nil , nil
@@ -465,10 +456,7 @@ func (t *Transaction) CreatedContract(ctx context.Context, args BlockNumberArgs)
465
456
}
466
457
467
458
func (t * Transaction ) Logs (ctx context.Context ) (* []* Log , error ) {
468
- _ , block , err := t .resolve (ctx )
469
- if err != nil {
470
- return nil , err
471
- }
459
+ _ , block := t .resolve (ctx )
472
460
// Pending tx
473
461
if block == nil {
474
462
return nil , nil
@@ -504,19 +492,16 @@ func (t *Transaction) getLogs(ctx context.Context, hash common.Hash) (*[]*Log, e
504
492
return & ret , nil
505
493
}
506
494
507
- func (t * Transaction ) Type (ctx context.Context ) (* hexutil.Uint64 , error ) {
508
- tx , _ , err := t .resolve (ctx )
509
- if err != nil {
510
- return nil , err
511
- }
495
+ func (t * Transaction ) Type (ctx context.Context ) * hexutil.Uint64 {
496
+ tx , _ := t .resolve (ctx )
512
497
txType := hexutil .Uint64 (tx .Type ())
513
- return & txType , nil
498
+ return & txType
514
499
}
515
500
516
- func (t * Transaction ) AccessList (ctx context.Context ) ( * []* AccessTuple , error ) {
517
- tx , _ , err := t .resolve (ctx )
518
- if err != nil || tx == nil {
519
- return nil , err
501
+ func (t * Transaction ) AccessList (ctx context.Context ) * []* AccessTuple {
502
+ tx , _ := t .resolve (ctx )
503
+ if tx == nil {
504
+ return nil
520
505
}
521
506
accessList := tx .AccessList ()
522
507
ret := make ([]* AccessTuple , 0 , len (accessList ))
@@ -526,40 +511,40 @@ func (t *Transaction) AccessList(ctx context.Context) (*[]*AccessTuple, error) {
526
511
storageKeys : al .StorageKeys ,
527
512
})
528
513
}
529
- return & ret , nil
514
+ return & ret
530
515
}
531
516
532
- func (t * Transaction ) R (ctx context.Context ) ( hexutil.Big , error ) {
533
- tx , _ , err := t .resolve (ctx )
534
- if err != nil || tx == nil {
535
- return hexutil.Big {}, err
517
+ func (t * Transaction ) R (ctx context.Context ) hexutil.Big {
518
+ tx , _ := t .resolve (ctx )
519
+ if tx == nil {
520
+ return hexutil.Big {}
536
521
}
537
522
_ , r , _ := tx .RawSignatureValues ()
538
- return hexutil .Big (* r ), nil
523
+ return hexutil .Big (* r )
539
524
}
540
525
541
- func (t * Transaction ) S (ctx context.Context ) ( hexutil.Big , error ) {
542
- tx , _ , err := t .resolve (ctx )
543
- if err != nil || tx == nil {
544
- return hexutil.Big {}, err
526
+ func (t * Transaction ) S (ctx context.Context ) hexutil.Big {
527
+ tx , _ := t .resolve (ctx )
528
+ if tx == nil {
529
+ return hexutil.Big {}
545
530
}
546
531
_ , _ , s := tx .RawSignatureValues ()
547
- return hexutil .Big (* s ), nil
532
+ return hexutil .Big (* s )
548
533
}
549
534
550
- func (t * Transaction ) V (ctx context.Context ) ( hexutil.Big , error ) {
551
- tx , _ , err := t .resolve (ctx )
552
- if err != nil || tx == nil {
553
- return hexutil.Big {}, err
535
+ func (t * Transaction ) V (ctx context.Context ) hexutil.Big {
536
+ tx , _ := t .resolve (ctx )
537
+ if tx == nil {
538
+ return hexutil.Big {}
554
539
}
555
540
v , _ , _ := tx .RawSignatureValues ()
556
- return hexutil .Big (* v ), nil
541
+ return hexutil .Big (* v )
557
542
}
558
543
559
544
func (t * Transaction ) Raw (ctx context.Context ) (hexutil.Bytes , error ) {
560
- tx , _ , err := t .resolve (ctx )
561
- if err != nil || tx == nil {
562
- return hexutil.Bytes {}, err
545
+ tx , _ := t .resolve (ctx )
546
+ if tx == nil {
547
+ return hexutil.Bytes {}, nil
563
548
}
564
549
return tx .MarshalBinary ()
565
550
}
@@ -1233,19 +1218,17 @@ func (r *Resolver) Pending(ctx context.Context) *Pending {
1233
1218
return & Pending {r }
1234
1219
}
1235
1220
1236
- func (r * Resolver ) Transaction (ctx context.Context , args struct { Hash common.Hash }) ( * Transaction , error ) {
1221
+ func (r * Resolver ) Transaction (ctx context.Context , args struct { Hash common.Hash }) * Transaction {
1237
1222
tx := & Transaction {
1238
1223
r : r ,
1239
1224
hash : args .Hash ,
1240
1225
}
1241
1226
// Resolve the transaction; if it doesn't exist, return nil.
1242
- t , _ , err := tx .resolve (ctx )
1243
- if err != nil {
1244
- return nil , err
1245
- } else if t == nil {
1246
- return nil , nil
1227
+ t , _ := tx .resolve (ctx )
1228
+ if t == nil {
1229
+ return nil
1247
1230
}
1248
- return tx , nil
1231
+ return tx
1249
1232
}
1250
1233
1251
1234
func (r * Resolver ) SendRawTransaction (ctx context.Context , args struct { Data hexutil.Bytes }) (common.Hash , error ) {
0 commit comments