File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
packages/apps/app-dashboard/src/hooks/user-dashboard/connect Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -49,15 +49,19 @@ export const useAddPermittedActions = () => {
4949 ) ;
5050
5151 setLoadingStatus ( 'Granting App Permissions' ) ;
52- // Process ability IPFS CIDs
53- for ( const ipfsCid of abilityIpfsCids ) {
54- if ( ! permittedActionSet . has ( ipfsCid ) ) {
55- await litContracts . addPermittedAction ( {
56- ipfsId : ipfsCid ,
57- pkpTokenId : agentPKPTokenId ,
58- authMethodScopes : [ AUTH_METHOD_SCOPE . SignAnything ] ,
59- } ) ;
60- }
52+ // Process ability IPFS CIDs in parallel
53+ const actionsToAdd = abilityIpfsCids . filter ( ( ipfsCid ) => ! permittedActionSet . has ( ipfsCid ) ) ;
54+
55+ if ( actionsToAdd . length > 0 ) {
56+ await Promise . all (
57+ actionsToAdd . map ( ( ipfsCid ) =>
58+ litContracts . addPermittedAction ( {
59+ ipfsId : ipfsCid ,
60+ pkpTokenId : agentPKPTokenId ,
61+ authMethodScopes : [ AUTH_METHOD_SCOPE . SignAnything ] ,
62+ } ) ,
63+ ) ,
64+ ) ;
6165 }
6266
6367 setLoadingStatus ( 'Permissions Added Successfully' ) ;
You can’t perform that action at this time.
0 commit comments