@@ -696,38 +696,20 @@ export class ChainSessionManager {
696696 }
697697
698698 /**
699- * Checks if the current session has permission to execute a set of transactions.
700- * @param transactions The transactions to check permissions for.
701- * @returns A promise that resolves to true if the session has permission, false otherwise.
699+ * Checks if the current session has a valid signer.
700+ * @returns A promise that resolves to true if the session has a valid signer, false otherwise.
702701 */
703- async hasPermission ( transactions : Transaction [ ] ) : Promise < boolean > {
702+ async hasValidSigner ( ) : Promise < boolean > {
704703 if ( ! this . wallet || ! this . sessionManager || ! this . provider || ! this . isInitialized ) {
705704 return false
706705 }
707706
708- try {
709- const calls : Payload . Call [ ] = transactions . map ( ( tx ) => ( {
710- to : tx . to ,
711- value : tx . value ?? 0n ,
712- data : tx . data ?? '0x' ,
713- gasLimit : tx . gasLimit ?? 0n ,
714- delegateCall : tx . delegateCall ?? false ,
715- onlyFallback : tx . onlyFallback ?? false ,
716- behaviorOnError : tx . behaviorOnError ?? ( 'revert' as const ) ,
717- } ) )
718-
719- // Directly check if there are signers with the necessary permissions for all calls.
720- // This will throw an error if any call is not supported.
721- await this . sessionManager . findSignersForCalls ( this . wallet . address , this . chainId , calls )
707+ const signerValidity = await this . sessionManager . listSignerValidity ( this . chainId )
708+ if ( signerValidity . some ( ( s ) => s . isValid ) ) {
722709 return true
723- } catch ( error ) {
724- // An error from findSignersForCalls indicates a permission failure.
725- console . warn (
726- `Permission check failed for chain ${ this . chainId } :` ,
727- error instanceof Error ? error . message : String ( error ) ,
728- )
729- return false
730710 }
711+ // SessionSignerInvalidReason available here
712+ return false
731713 }
732714
733715 /**
0 commit comments