File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ export class EIP712Signer {
110110 static getSignInput ( transaction : TransactionRequest ) {
111111 const maxFeePerGas = transaction . maxFeePerGas || transaction . gasPrice || 0n ;
112112 const maxPriorityFeePerGas =
113- transaction . maxPriorityFeePerGas || maxFeePerGas ;
113+ transaction . maxPriorityFeePerGas ?? maxFeePerGas ;
114114 const gasPerPubdataByteLimit =
115115 transaction . customData ?. gasPerPubdata || DEFAULT_GAS_PER_PUBDATA_LIMIT ;
116116 return {
Original file line number Diff line number Diff line change @@ -63,7 +63,35 @@ describe('EIP712Signer', () => {
6363 } ) ;
6464 expect ( result ) . to . be . deep . equal ( tx ) ;
6565 } ) ;
66+
67+ it ( 'should correcly handle zero values' , async ( ) => {
68+ const tx = {
69+ txType : utils . EIP712_TX_TYPE ,
70+ from : ADDRESS1 ,
71+ to : ADDRESS2 ,
72+ gasLimit : 0n ,
73+ gasPerPubdataByteLimit : utils . DEFAULT_GAS_PER_PUBDATA_LIMIT ,
74+ maxFeePerGas : 250_000_000n ,
75+ maxPriorityFeePerGas : 0n ,
76+ paymaster : ethers . ZeroAddress ,
77+ nonce : 0 ,
78+ value : 0n ,
79+ data : '0x' ,
80+ factoryDeps : [ ] ,
81+ paymasterInput : '0x' ,
82+ } ;
83+
84+ const result = EIP712Signer . getSignInput ( {
85+ type : utils . EIP712_TX_TYPE ,
86+ to : ADDRESS2 ,
87+ from : ADDRESS1 ,
88+ maxFeePerGas : 250_000_000n ,
89+ maxPriorityFeePerGas : 0n ,
90+ } ) ;
91+ expect ( result ) . to . be . deep . equal ( tx ) ;
92+ } ) ;
6693 } ) ;
94+ } ) ;
6795
6896 describe ( '#getSignedDigest()' , ( ) => {
6997 it ( 'should throw an error when chain ID is not specified' , async ( ) => {
You can’t perform that action at this time.
0 commit comments