ModuleSDK
Modules
Deadman Switch

Deadman Switch

The Deadman Switch module is a Module that allows users to set a nominee that can recover their account if they are inactive for a certain period of time.

You can find the source code for the module in the Core Modules repo (opens in a new tab) and the deployment address in the address book.

getDeadmanSwitch

The getDeadmanSwitch function is used to create an instance of the Deadman Switch module. This function returns a module object.

Note: The Deadman Switch needs to be installed as both a validator and a hook. When this function is called and the module is already installed, then the initData will be empty, which is expected.

import { getDeadmanSwitch } from "@rhinestone/module-sdk";
 
const moduleType = "validator" | "hook";
const nominee = "0x..."; // nominee address
const timeout = 100; // inactive period
 
const deadmanSwitch = getDeadmanSwitch({
  moduleType,
  nominee,
  timeout,
});

getDeadmanSwitchValidatorMockSignature

The getDeadmanSwitchValidatorMockSignature function is used to get a mock signature for the validator. This is used to calculate the gas of an ERC-4337 UserOperation. This function returns a hex-encoded signature.

import { getDeadmanSwitchValidatorMockSignature } from "@rhinestone/module-sdk";
 
const mockSignature = getDeadmanSwitchValidatorMockSignature();

getDeadmanSwitchConfig

The getDeadmanSwitchConfig function is used to get config of deadman switch module.

import { getDeadmanSwitchConfig } from "@rhinestone/module-sdk";
 
const deadmanSwitchConfig = await getDeadmanSwitchConfig({
  account,
  client,
});

DEADMAN_SWITCH_ADDRESS

The DEADMAN_SWITCH_ADDRESS is a constant that represents the module address.