@@ -1371,7 +1371,10 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
13711371 const { r, s, recoveryParam } = await client . sign ( hashedData . toString ( "base64" ) , true , "" , "keccak256" , {
13721372 signatures,
13731373 } ) ;
1374- await client . cleanup ( { signatures, server_coeffs : serverCoeffs } ) ;
1374+ // intentionally not awaiting cleanup
1375+ // since it eventually cleaned by server so optimistically not waiting for it
1376+ // in order to reduce latency in returning the response
1377+ client . cleanup ( { signatures, server_coeffs : serverCoeffs } ) ;
13751378 return { v : recoveryParam , r : scalarBNToBufferSEC1 ( r ) , s : scalarBNToBufferSEC1 ( s ) } ;
13761379 } ;
13771380 if ( ! hashed ) {
@@ -1404,7 +1407,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
14041407 // TODO: See comments in this function, these are bugs that need fixing throughout by the original author.
14051408
14061409 if ( data . length <= 1 ) {
1407- throw CoreKitError . default ( "Not a batch " ) ;
1410+ throw CoreKitError . default ( "Batch signing requires at least 2 messages. For single message, use sign() instead. " ) ;
14081411 }
14091412
14101413 if ( data . length > 5 ) {
@@ -1434,7 +1437,10 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
14341437
14351438 const executeBatchSign = async ( client : Client , serverCoeffs : Record < string , string > , hashedData : BatchSignParams [ ] , signatures : string [ ] ) => {
14361439 const sigs = await client . batch_sign ( hashedData , { signatures } ) ;
1437- await client . cleanup ( { signatures, server_coeffs : serverCoeffs } ) ; // server_coeffs are only needed in precompute, nowhere else.
1440+ // intentionally not awaiting cleanup
1441+ // since it eventually cleaned by server so optimistically not waiting for it
1442+ // in order to reduce latency in returning the response
1443+ client . cleanup ( { signatures, server_coeffs : serverCoeffs } ) ; // server_coeffs are only needed in precompute, nowhere else.
14381444
14391445 const results = [ ] ;
14401446 for ( let i = 0 ; i < sigs . length ; i ++ ) {
0 commit comments