@@ -448,14 +448,15 @@ func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args Transactio
448
448
if args .Gas == nil {
449
449
return nil , fmt .Errorf ("gas not specified" )
450
450
}
451
- if args .GasPrice == nil {
452
- return nil , fmt .Errorf ("gasPrice not specified " )
451
+ if args .GasPrice == nil && ( args . MaxFeePerGas == nil || args . MaxPriorityFeePerGas == nil ) {
452
+ return nil , fmt .Errorf ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas " )
453
453
}
454
454
if args .Nonce == nil {
455
455
return nil , fmt .Errorf ("nonce not specified" )
456
456
}
457
457
// Before actually sign the transaction, ensure the transaction fee is reasonable.
458
- if err := checkTxFee (args .GasPrice .ToInt (), uint64 (* args .Gas ), s .b .RPCTxFeeCap ()); err != nil {
458
+ tx := args .toTransaction ()
459
+ if err := checkTxFee (tx .GasPrice (), tx .Gas (), s .b .RPCTxFeeCap ()); err != nil {
459
460
return nil , err
460
461
}
461
462
signed , err := s .signTransaction (ctx , & args , passwd )
@@ -1697,8 +1698,9 @@ func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args Tra
1697
1698
return SubmitTransaction (ctx , s .b , signed )
1698
1699
}
1699
1700
1700
- // FillTransaction fills the defaults (nonce, gas, gasPrice) on a given unsigned transaction,
1701
- // and returns it to the caller for further processing (signing + broadcast)
1701
+ // FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields)
1702
+ // on a given unsigned transaction, and returns it to the caller for further
1703
+ // processing (signing + broadcast).
1702
1704
func (s * PublicTransactionPoolAPI ) FillTransaction (ctx context.Context , args TransactionArgs ) (* SignTransactionResult , error ) {
1703
1705
// Set some sanity defaults and terminate on failure
1704
1706
if err := args .setDefaults (ctx , s .b ); err != nil {
@@ -1761,8 +1763,8 @@ func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args Tra
1761
1763
if args .Gas == nil {
1762
1764
return nil , fmt .Errorf ("gas not specified" )
1763
1765
}
1764
- if args .GasPrice == nil {
1765
- return nil , fmt .Errorf ("gasPrice not specified " )
1766
+ if args .GasPrice == nil && ( args . MaxPriorityFeePerGas == nil || args . MaxFeePerGas == nil ) {
1767
+ return nil , fmt .Errorf ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas " )
1766
1768
}
1767
1769
if args .Nonce == nil {
1768
1770
return nil , fmt .Errorf ("nonce not specified" )
@@ -1771,18 +1773,19 @@ func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args Tra
1771
1773
return nil , err
1772
1774
}
1773
1775
// Before actually sign the transaction, ensure the transaction fee is reasonable.
1774
- if err := checkTxFee (args .GasPrice .ToInt (), uint64 (* args .Gas ), s .b .RPCTxFeeCap ()); err != nil {
1776
+ tx := args .toTransaction ()
1777
+ if err := checkTxFee (tx .GasPrice (), tx .Gas (), s .b .RPCTxFeeCap ()); err != nil {
1775
1778
return nil , err
1776
1779
}
1777
- tx , err := s .sign (args .from (), args . toTransaction () )
1780
+ signed , err := s .sign (args .from (), tx )
1778
1781
if err != nil {
1779
1782
return nil , err
1780
1783
}
1781
- data , err := tx .MarshalBinary ()
1784
+ data , err := signed .MarshalBinary ()
1782
1785
if err != nil {
1783
1786
return nil , err
1784
1787
}
1785
- return & SignTransactionResult {data , tx }, nil
1788
+ return & SignTransactionResult {data , signed }, nil
1786
1789
}
1787
1790
1788
1791
// PendingTransactions returns the transactions that are in the transaction pool
0 commit comments