mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
export toTransaction
This commit is contained in:
parent
bf884eb8b6
commit
b91355bc2b
2 changed files with 10 additions and 16 deletions
|
|
@ -458,7 +458,7 @@ func (s *PersonalAccountAPI) signTransaction(ctx context.Context, args *Transact
|
|||
return nil, err
|
||||
}
|
||||
// Assemble the transaction and sign with the wallet
|
||||
tx := args.toTransaction()
|
||||
tx := args.ToTransaction()
|
||||
|
||||
return wallet.SignTxWithPassphrase(account, passwd, tx, s.b.ChainConfig().ChainID)
|
||||
}
|
||||
|
|
@ -507,7 +507,7 @@ func (s *PersonalAccountAPI) SignTransaction(ctx context.Context, args Transacti
|
|||
return nil, errors.New("nonce not specified")
|
||||
}
|
||||
// Before actually signing the transaction, ensure the transaction fee is reasonable.
|
||||
tx := args.toTransaction()
|
||||
tx := args.ToTransaction()
|
||||
if err := checkTxFee(tx.GasPrice(), tx.Gas(), s.b.RPCTxFeeCap()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -1529,7 +1529,7 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
|
|||
vmenv := b.GetEVM(ctx, msg, statedb, header, &config, nil)
|
||||
res, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit))
|
||||
if err != nil {
|
||||
return nil, 0, nil, fmt.Errorf("failed to apply transaction: %v err: %v", args.toTransaction().Hash(), err)
|
||||
return nil, 0, nil, fmt.Errorf("failed to apply transaction: %v err: %v", args.ToTransaction().Hash(), err)
|
||||
}
|
||||
if tracer.Equal(prevTracer) {
|
||||
return accessList, res.UsedGas, res.Err, nil
|
||||
|
|
@ -1798,7 +1798,7 @@ func (s *TransactionAPI) SendTransaction(ctx context.Context, args TransactionAr
|
|||
return common.Hash{}, err
|
||||
}
|
||||
// Assemble the transaction and sign with the wallet
|
||||
tx := args.toTransaction()
|
||||
tx := args.ToTransaction()
|
||||
|
||||
signed, err := wallet.SignTx(account, tx, s.b.ChainConfig().ChainID)
|
||||
if err != nil {
|
||||
|
|
@ -1818,7 +1818,7 @@ func (s *TransactionAPI) FillTransaction(ctx context.Context, args TransactionAr
|
|||
return nil, err
|
||||
}
|
||||
// Assemble the transaction and obtain rlp
|
||||
tx := args.toTransaction()
|
||||
tx := args.ToTransaction()
|
||||
data, err := tx.MarshalBinary()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -1887,7 +1887,7 @@ func (s *TransactionAPI) SignTransaction(ctx context.Context, args TransactionAr
|
|||
return nil, err
|
||||
}
|
||||
// Before actually sign the transaction, ensure the transaction fee is reasonable.
|
||||
tx := args.toTransaction()
|
||||
tx := args.ToTransaction()
|
||||
if err := checkTxFee(tx.GasPrice(), tx.Gas(), s.b.RPCTxFeeCap()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -1935,7 +1935,7 @@ func (s *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs, g
|
|||
if err := sendArgs.setDefaults(ctx, s.b, false); err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
matchTx := sendArgs.toTransaction()
|
||||
matchTx := sendArgs.ToTransaction()
|
||||
|
||||
// Before replacing the old transaction, ensure the _new_ transaction fee is reasonable.
|
||||
var price = matchTx.GasPrice()
|
||||
|
|
@ -1965,7 +1965,7 @@ func (s *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs, g
|
|||
if gasLimit != nil && *gasLimit != 0 {
|
||||
sendArgs.Gas = gasLimit
|
||||
}
|
||||
signedTx, err := s.sign(sendArgs.from(), sendArgs.toTransaction())
|
||||
signedTx, err := s.sign(sendArgs.from(), sendArgs.ToTransaction())
|
||||
if err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -467,9 +467,9 @@ func (args *TransactionArgs) ToMessage(baseFee *big.Int) *core.Message {
|
|||
}
|
||||
}
|
||||
|
||||
// toTransaction converts the arguments to a transaction.
|
||||
// ToTransaction converts the arguments to a transaction.
|
||||
// This assumes that setDefaults has been called.
|
||||
func (args *TransactionArgs) toTransaction() *types.Transaction {
|
||||
func (args *TransactionArgs) ToTransaction() *types.Transaction {
|
||||
var data types.TxData
|
||||
switch {
|
||||
case args.BlobHashes != nil:
|
||||
|
|
@ -540,12 +540,6 @@ func (args *TransactionArgs) toTransaction() *types.Transaction {
|
|||
return types.NewTx(data)
|
||||
}
|
||||
|
||||
// ToTransaction converts the arguments to a transaction.
|
||||
// This assumes that setDefaults has been called.
|
||||
func (args *TransactionArgs) ToTransaction() *types.Transaction {
|
||||
return args.toTransaction()
|
||||
}
|
||||
|
||||
// IsEIP4844 returns an indicator if the args contains EIP4844 fields.
|
||||
func (args *TransactionArgs) IsEIP4844() bool {
|
||||
return args.BlobHashes != nil || args.BlobFeeCap != nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue