Function getPreviousModule

  • Gets the address of the previous module of the same type as the given module.

    Type Parameters

    • TSmartAccount extends
          | undefined
          | object & Assign_<
              SmartAccountImplementation<Abi, EntryPointVersion, object>,
              {
                  address: `0x${string}`;
                  getNonce: (parameters?: { key?: bigint }) => Promise<bigint>;
                  isDeployed: () => Promise<boolean>;
                  type: "smart";
              },
          > & {
              address: `0x${string}`;
              getNonce: (parameters?: { key?: bigint }) => Promise<bigint>;
              isDeployed: () => Promise<boolean>;
              type: "smart";
          }

    Parameters

    Returns Promise<`0x${string}`>

    The address of the previous module, or the sentinel address if it's the first module.

    If the account is not found.

    If the module type is unknown or the module is not found.

    import { getPreviousModule } from '@biconomy/abstractjs'

    const previousModuleAddress = await getPreviousModule(nexusClient, {
    module: {
    type: 'validator',
    moduleAddress: '0x...',
    }
    })
    console.log(previousModuleAddress) // '0x...'