add paymaster, deployer optional params (#4)

This commit is contained in:
Dror Tirosh 2024-05-30 13:51:47 +03:00 committed by Dror Tirosh
parent c29c3eb9bc
commit 117561451b
2 changed files with 14 additions and 2 deletions

View file

@ -37,7 +37,9 @@ type Rip7560AccountAbstractionTx struct {
// extra fields // extra fields
Sender *common.Address Sender *common.Address
Signature []byte Signature []byte
Paymaster *common.Address `rlp:"nil"`
PaymasterData []byte PaymasterData []byte
Deployer *common.Address `rlp:"nil"`
DeployerData []byte DeployerData []byte
BuilderFee *big.Int BuilderFee *big.Int
ValidationGas uint64 ValidationGas uint64
@ -45,7 +47,7 @@ type Rip7560AccountAbstractionTx struct {
PostOpGas uint64 PostOpGas uint64
// removed fields // removed fields
To *common.Address To *common.Address `rlp:"nil"`
Nonce uint64 Nonce uint64
Value *big.Int Value *big.Int
} }
@ -65,11 +67,14 @@ func (tx *Rip7560AccountAbstractionTx) copy() TxData {
Sender: copyAddressPtr(tx.Sender), Sender: copyAddressPtr(tx.Sender),
Signature: common.CopyBytes(tx.Signature), Signature: common.CopyBytes(tx.Signature),
Paymaster: copyAddressPtr(tx.Paymaster),
PaymasterData: common.CopyBytes(tx.PaymasterData), PaymasterData: common.CopyBytes(tx.PaymasterData),
Deployer: copyAddressPtr(tx.Deployer),
DeployerData: common.CopyBytes(tx.DeployerData), DeployerData: common.CopyBytes(tx.DeployerData),
BuilderFee: new(big.Int), BuilderFee: new(big.Int),
ValidationGas: tx.ValidationGas, ValidationGas: tx.ValidationGas,
PaymasterGas: tx.PaymasterGas, PaymasterGas: tx.PaymasterGas,
PostOpGas: tx.PostOpGas,
} }
copy(cpy.AccessList, tx.AccessList) copy(cpy.AccessList, tx.AccessList)
if tx.Value != nil { if tx.Value != nil {
@ -138,11 +143,14 @@ type Rip7560Transaction struct {
Nonce *big.Int Nonce *big.Int
ValidationGasLimit *big.Int ValidationGasLimit *big.Int
PaymasterGasLimit *big.Int PaymasterGasLimit *big.Int
PostOpGasLimit *big.Int
CallGasLimit *big.Int CallGasLimit *big.Int
MaxFeePerGas *big.Int MaxFeePerGas *big.Int
MaxPriorityFeePerGas *big.Int MaxPriorityFeePerGas *big.Int
BuilderFee *big.Int BuilderFee *big.Int
Paymaster *common.Address
PaymasterData []byte PaymasterData []byte
Deployer *common.Address
DeployerData []byte DeployerData []byte
CallData []byte CallData []byte
Signature []byte Signature []byte

View file

@ -78,7 +78,9 @@ type TransactionArgs struct {
// Introduced by RIP-7560 Transaction // Introduced by RIP-7560 Transaction
Sender *common.Address `json:"sender"` Sender *common.Address `json:"sender"`
Signature *hexutil.Bytes Signature *hexutil.Bytes
Paymaster *common.Address `json:"paymaster,omitempty"`
PaymasterData *hexutil.Bytes `json:"paymasterData"` PaymasterData *hexutil.Bytes `json:"paymasterData"`
Deployer *common.Address `json:"deployer,omitempty"`
DeployerData *hexutil.Bytes DeployerData *hexutil.Bytes
BuilderFee *hexutil.Big BuilderFee *hexutil.Big
ValidationGas *hexutil.Uint64 ValidationGas *hexutil.Uint64
@ -499,7 +501,9 @@ func (args *TransactionArgs) ToTransaction() *types.Transaction {
// RIP-7560 parameters // RIP-7560 parameters
Sender: args.Sender, Sender: args.Sender,
Signature: *args.Signature, Signature: *args.Signature,
Paymaster: args.Paymaster,
PaymasterData: *args.PaymasterData, PaymasterData: *args.PaymasterData,
Deployer: args.Deployer,
DeployerData: *args.DeployerData, DeployerData: *args.DeployerData,
BuilderFee: (*big.Int)(args.BuilderFee), BuilderFee: (*big.Int)(args.BuilderFee),
ValidationGas: uint64(*args.ValidationGas), ValidationGas: uint64(*args.ValidationGas),