Skip to content

Commit

Permalink
Convert TransactionArgs to CIP-64/66 transaction
Browse files Browse the repository at this point in the history
Closes #109
  • Loading branch information
ezdac committed May 15, 2024
1 parent 335ae9a commit ee3ac51
Showing 1 changed file with 41 additions and 10 deletions.
51 changes: 41 additions & 10 deletions internal/ethapi/transaction_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,16 +413,47 @@ func (args *TransactionArgs) toTransaction() *types.Transaction {
if args.AccessList != nil {
al = *args.AccessList
}
data = &types.DynamicFeeTx{
To: args.To,
ChainID: (*big.Int)(args.ChainID),
Nonce: uint64(*args.Nonce),
Gas: uint64(*args.Gas),
GasFeeCap: (*big.Int)(args.MaxFeePerGas),
GasTipCap: (*big.Int)(args.MaxPriorityFeePerGas),
Value: (*big.Int)(args.Value),
Data: args.data(),
AccessList: al,
if args.FeeCurrency != nil {
if args.IsFeeCurrencyDenominated() {
data = &types.CeloDynamicFeeTx{
To: args.To,
ChainID: (*big.Int)(args.ChainID),
Nonce: uint64(*args.Nonce),
Gas: uint64(*args.Gas),
GasFeeCap: (*big.Int)(args.MaxFeePerGas),
GasTipCap: (*big.Int)(args.MaxPriorityFeePerGas),
Value: (*big.Int)(args.Value),
Data: args.data(),
AccessList: al,
FeeCurrency: args.FeeCurrency,
}
} else {
data = &types.CeloDenominatedTx{
To: args.To,
ChainID: (*big.Int)(args.ChainID),
Nonce: uint64(*args.Nonce),
Gas: uint64(*args.Gas),
GasFeeCap: (*big.Int)(args.MaxFeePerGas),
GasTipCap: (*big.Int)(args.MaxPriorityFeePerGas),
Value: (*big.Int)(args.Value),
Data: args.data(),
AccessList: al,
FeeCurrency: args.FeeCurrency,
MaxFeeInFeeCurrency: (*big.Int)(args.MaxFeeInFeeCurrency),
}
}
} else {
data = &types.DynamicFeeTx{
To: args.To,
ChainID: (*big.Int)(args.ChainID),
Nonce: uint64(*args.Nonce),
Gas: uint64(*args.Gas),
GasFeeCap: (*big.Int)(args.MaxFeePerGas),
GasTipCap: (*big.Int)(args.MaxPriorityFeePerGas),
Value: (*big.Int)(args.Value),
Data: args.data(),
AccessList: al,
}
}
case args.AccessList != nil:
data = &types.AccessListTx{
Expand Down

0 comments on commit ee3ac51

Please sign in to comment.