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

View file

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