@@ -478,16 +478,16 @@ func (s *PersonalAccountAPI) SignTransaction(ctx context.Context, args Transacti
478478 // No need to obtain the noncelock mutex, since we won't be sending this
479479 // tx into the transaction pool, but right back to the user
480480 if args .From == nil {
481- return nil , errors . New ("sender not specified" )
481+ return nil , fmt . Errorf ("sender not specified" )
482482 }
483483 if args .Gas == nil {
484- return nil , errors . New ("gas not specified" )
484+ return nil , fmt . Errorf ("gas not specified" )
485485 }
486486 if args .GasPrice == nil && (args .MaxFeePerGas == nil || args .MaxPriorityFeePerGas == nil ) {
487- return nil , errors . New ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas" )
487+ return nil , fmt . Errorf ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas" )
488488 }
489489 if args .Nonce == nil {
490- return nil , errors . New ("nonce not specified" )
490+ return nil , fmt . Errorf ("nonce not specified" )
491491 }
492492 // Before actually signing the transaction, ensure the transaction fee is reasonable.
493493 tx := args .toTransaction ()
@@ -548,7 +548,7 @@ func (s *PersonalAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.By
548548 return common.Address {}, fmt .Errorf ("signature must be %d bytes long" , crypto .SignatureLength )
549549 }
550550 if sig [crypto .RecoveryIDOffset ] != 27 && sig [crypto .RecoveryIDOffset ] != 28 {
551- return common.Address {}, errors . New ("invalid Ethereum signature (V is not 27 or 28)" )
551+ return common.Address {}, fmt . Errorf ("invalid Ethereum signature (V is not 27 or 28)" )
552552 }
553553 sig [crypto .RecoveryIDOffset ] -= 27 // Transform yellow paper V from 27/28 to 0/1
554554
@@ -582,7 +582,7 @@ func (s *PersonalAccountAPI) InitializeWallet(ctx context.Context, url string) (
582582 case * scwallet.Wallet :
583583 return mnemonic , wallet .Initialize (seed )
584584 default :
585- return "" , errors . New ("specified wallet does not support initialization" )
585+ return "" , fmt . Errorf ("specified wallet does not support initialization" )
586586 }
587587}
588588
@@ -597,7 +597,7 @@ func (s *PersonalAccountAPI) Unpair(ctx context.Context, url string, pin string)
597597 case * scwallet.Wallet :
598598 return wallet .Unpair ([]byte (pin ))
599599 default :
600- return errors . New ("specified wallet does not support pairing" )
600+ return fmt . Errorf ("specified wallet does not support pairing" )
601601 }
602602}
603603
@@ -722,10 +722,10 @@ func decodeHash(s string) (common.Hash, error) {
722722 }
723723 b , err := hex .DecodeString (s )
724724 if err != nil {
725- return common.Hash {}, errors . New ("hex string invalid" )
725+ return common.Hash {}, fmt . Errorf ("hex string invalid" )
726726 }
727727 if len (b ) > 32 {
728- return common.Hash {}, errors . New ("hex string too long, want at most 32 bytes" )
728+ return common.Hash {}, fmt . Errorf ("hex string too long, want at most 32 bytes" )
729729 }
730730 return common .BytesToHash (b ), nil
731731}
@@ -1833,13 +1833,13 @@ type SignTransactionResult struct {
18331833// the given from address and it needs to be unlocked.
18341834func (s * TransactionAPI ) SignTransaction (ctx context.Context , args TransactionArgs ) (* SignTransactionResult , error ) {
18351835 if args .Gas == nil {
1836- return nil , errors . New ("gas not specified" )
1836+ return nil , fmt . Errorf ("gas not specified" )
18371837 }
18381838 if args .GasPrice == nil && (args .MaxPriorityFeePerGas == nil || args .MaxFeePerGas == nil ) {
1839- return nil , errors . New ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas" )
1839+ return nil , fmt . Errorf ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas" )
18401840 }
18411841 if args .Nonce == nil {
1842- return nil , errors . New ("nonce not specified" )
1842+ return nil , fmt . Errorf ("nonce not specified" )
18431843 }
18441844 if err := args .setDefaults (ctx , s .b ); err != nil {
18451845 return nil , err
@@ -1888,7 +1888,7 @@ func (s *TransactionAPI) PendingTransactions() ([]*RPCTransaction, error) {
18881888// the given transaction from the pool and reinsert it with the new gas price and limit.
18891889func (s * TransactionAPI ) Resend (ctx context.Context , sendArgs TransactionArgs , gasPrice * hexutil.Big , gasLimit * hexutil.Uint64 ) (common.Hash , error ) {
18901890 if sendArgs .Nonce == nil {
1891- return common.Hash {}, errors . New ("missing transaction nonce in transaction spec" )
1891+ return common.Hash {}, fmt . Errorf ("missing transaction nonce in transaction spec" )
18921892 }
18931893 if err := sendArgs .setDefaults (ctx , s .b ); err != nil {
18941894 return common.Hash {}, err
0 commit comments