File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -87,16 +87,19 @@ const checkAuthorization = async ({
8787 const signerAddress = recoverAddressEIP712 ( typedData , signature ) ;
8888 if ( signerAddress === NULL_ADDRESS ) throw Error ( 'Null signerAddress' ) ;
8989 log ( 'signerAddress' , signerAddress ) ;
90- if ( signerAddress . toLowerCase ( ) !== address . toLowerCase ( ) )
90+
91+ if ( signerAddress . toLowerCase ( ) !== address . toLowerCase ( ) ) {
9192 throw new AuthError ( 'Failed to verify signer, addresses mismatch.' ) ;
92- await current . remove ( ) ;
93- return {
94- address ,
95- chainId ,
96- } ;
93+ }
94+
95+ await ChallengeModel . deleteOne ( { _id : current . _id } ) ;
96+
97+ return { address , chainId } ;
9798 } catch ( e ) {
9899 log ( 'checkAuthorization() error' , e ) ;
99- throw e ;
100+ throw e instanceof AuthError
101+ ? e
102+ : new AuthError ( 'Authorization check failed' ) ;
100103 }
101104} ;
102105
Original file line number Diff line number Diff line change @@ -1347,7 +1347,7 @@ const unpublishOrders = async ({
13471347 default :
13481348 throw new InternalError ( 'unsupported target' ) ;
13491349 }
1350- await Promise . all ( ordersToUnpublish . map ( ( e ) => e . delete ( ) ) ) ;
1350+ await Promise . all ( ordersToUnpublish . map ( ( e ) => e . deleteOne ( ) ) ) ;
13511351 return ordersToUnpublish . map ( ( e ) => e . toJSON ( ) ) ;
13521352} ;
13531353
You can’t perform that action at this time.
0 commit comments