PageSourceSearch

https://axir-infra-docs.netlify.app/assets/js/f44cd4de.528f4368.js

js axir-infra-docs.netlify.app collected 2026-10-03 10:29:05 UTC 10,298 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkaxir_wallet=self.webpackChunkaxir_wallet||[]).push([[3523],{1097:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>t,metadata:()=>o,toc:()=>r});var i=l(4848),s=l(8453);const t={title:"Module Manager"},a=void 0,o={id:"Base/ModuleManager",title:"Module Manager",description:"This document explains the ModuleManager contract, a core component of the Axir Smart Account system. It facilitates the installation, management, and execution of various modules that extend the functionalities of a smart account.",source:"@site/docs/Base/ModuleManager.md",sourceDirName:"Base",slug:"/Base/ModuleManager",permalink:"/Base/ModuleManager",draft:!1,unlisted:!1,editUrl:"https://github.com/chiranjeev13/axir-docs/tree/main/docs/Base/ModuleManager.md",tags:[],version:"current",frontMatter:{title:"Module Manager"},sidebar:"tutorialSidebar",previous:{title:"EntryPoint Manager",permalink:"/Base/EntrypointManager"},next:{title:"OwnerManager",permalink:"/Base/OwnerManager"}},d={},r=[{value:"Purpose",id:"purpose",level:2},{value:"Components",id:"components",level:2},{value:"Functionalities",id:"functionalities",level:2},{value:"Interface Overview",id:"interface-overview",level:3},{value:"Module Installation",id:"module-installation",level:3},{value:"Module Uninstallation",id:"module-uninstallation",level:3},{value:"Module Management",id:"module-management",level:3},{value:"Fallback Handling",id:"fallback-handling",level:3},{value:"Key Points",id:"key-points",level:2},{value:"Benefits",id:"benefits",level:2},{value:"Further Considerations",id:"further-considerations",level:2},{value:"Example Usage",id:"example-usage",level:2}];function c(e){const n={code:"code",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:["This document explains the ",(0,i.jsx)(n.code,{children:"ModuleManager"})," contract, a core component of the ",(0,i.jsx)("span",{style:{color:"#FFB200"},children:(0,i.jsx)(n.strong,{children:"Axir Smart Account"})})," system. It facilitates the installation, management, and execution of various modules that extend the functionalities of a smart account."]}),"\n",(0,i.jsx)(n.h2,{id:"purpose",children:"Purpose"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Manages the lifecycle of ERC-7579 compliant modules within a smart account."}),"\n",(0,i.jsx)(n.li,{children:"Provides functionalities for installing, uninstalling, and interacting with validators, executors, and fallback modules."}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"components",children:"Components"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Validators:"})," Modules responsible for validating user operations before execution."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Executors:"})," Modules that carry out authorized actions on behalf of the smart account."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Fallback:"})," A single module that serves as a default handler for unrecognized function calls."]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"functionalities",children:"Functionalities"}),"\n",(0,i.jsx)(n.h3,{id:"interface-overview",children:"Interface Overview"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"IModuleManager"})," interface defines the core functionalities required for managing modules within the smart account system. Below is a brief explanation of its key functions:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:[(0,i.jsx)(n.code,{children:"addModule(bytes calldata moduleAndData)"}),":"]})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Adds a module to the list of installed modules and initializes it with the provided data. This function can only be called by the account itself or an already installed module."}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:[(0,i.jsx)(n.code,{children:"removeModule(address module)"}),":"]})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Removes a module from the list of installed modules and de-initializes it using its specific disable function. Only callable by the account or an installed module."}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:[(0,i.jsx)(n.code,{children:"executeFromModule(address to, uint256 value, bytes memory data)"}),":"]})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Allows installed modules to execute arbitrary calls on behalf of the account. This function enables modules to perform actions such as sending funds or interacting with other contracts."}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:[(0,i.jsx)(n.code,{children:"isModule(address addr)"}),":"]})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Checks if a specific address is currently installed as a module. Returns ",(0,i.jsx)(n.code,{children:"true"})," if the address is recognized as a module, ",(0,i.jsx)(n.code,{children:"false"})," otherwise."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:[(0,i.jsx)(n.code,{children:"listModules()"}),":"]})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Retrieves the full list of currently installed modules. This function helps manage and track active modules within the smart account."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"module-installation",children:"Module Installation"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Allows the installation of validators, executors, and the fallback module with initialization data."}),"\n",(0,i.jsxs)(n.li,{children:["Initializes the installed module using the ",(0,i.jsx)(n.code,{children:"onInstall"})," function."]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"module-uninstallation",children:"Module Uninstallation"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Enables the removal of installed modules with de-initialization data."}),"\n",(0,i.jsxs)(n.li,{children:["Calls the ",(0,i.jsx)(n.code,{children:"onUninstall"})," function of the module being removed."]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"module-management",children:"Module Management"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Provides functions to check if a specific module is installed."}),"\n",(0,i.jsx)(n.li,{children:"Retrieves a list of installed modules (paginated for larger sets)."}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"fallback-handling",children:"Fallback Handling"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Defines a fallback handler to manage unrecognized function calls to the smart account."}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"key-points",children:"Key Points"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"ModuleManager"}
1)," utilizes linked lists to efficiently track installed validators and executors."]}),"\n",(0,i.jsx)(n.li,{children:"Access control mechanisms ensure only authorized modules can be installed or removed."}),"\n",(0,i.jsx)(n.li,{children:"The fallback handler offers a safety net for unexpected function calls."}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"benefits",children:"Benefits"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Extends the capabilities of smart accounts through modular functionalities."}),"\n",(0,i.jsx)(n.li,{children:"Enhances flexibility and customization for users."}),"\n",(0,i.jsx)(n.li,{children:"Promotes secure and controlled interaction with external services."}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"further-considerations",children:"Further Considerations"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Refer to the specific implementation of the ",(0,i.jsx)(n.code,{children:"ModuleManager"})," contract for detailed function calls and usage instructions."]}),"\n",(0,i.jsx)(n.li,{children:"Carefully evaluate the trustworthiness of modules before installation."}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"example-usage",children:"Example Usage"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsx)(n.li,{children:"Install a Validator Module:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"   address validatorModule = 0x...;\n   bytes memory initData = abi.encode(...); // Module specific initialization data\n   AxirWallet.installValidator(validatorModule, initData);\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsx)(n.li,{children:"Check if a validator is installed:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"address validatorModule = 0x...;\n\nbool isInstalled = AxirWallet.isValidatorInstalled(validatorModule);\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"3",children:["\n",(0,i.jsx)(n.li,{children:"Uninstall a module (similar for executors and fallback):"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"address module = 0x...;\nbytes memory data = abi.encode(...); // Module specific de-initialization data\n\nAxirWallet.uninstallModule(module, data);\n"})}),"\n",(0,i.jsxs)(n.p,{children:["By understanding the ModuleManager contract, you can effectively manage the modules within your",(0,i.jsxs)("span",{style:{color:"#FFB200"},children:[" ",(0,i.jsx)(n.strong,{children:"Axir Smart Account"})]})," and leverage their functionalities to suit your needs."]})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,n,l)=>{l.d(n,{R:()=>a,x:()=>o});var i=l(6540);const s={},t=i.createContext(s);function a(e){const n=i.useContext(t);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),i.createElement(t.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.