Ownable Validator
The Ownable Validator module is a module that allows you to add multiple ECDSA owners to an account. The owners can then be used to sign transactions to be executed on the account.
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.
getInstallOwnableValidator
The getInstallOwnableValidator
function is used to create an instance of the Ownable Validator module. This function returns a module object.
import { getInstallOwnableValidator } from "@rhinestone/module-sdk";
const ownableValidator = getInstallOwnableValidator({
owners: ['0x..', '0x..'] // Addresses of the EOAs that should be the owners of this account.
threshold: 2, // owners threshold
});
getOwnableValidatorMockSignature
The getOwnableValidatorMockSignature
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 { getOwnableValidatorMockSignature } from "@rhinestone/module-sdk";
const mockSignature = getOwnableValidatorMockSignature();
getSetOwnableValidatorThresholdAction
The getSetOwnableValidatorThresholdAction
function is used to set the threshold for the validator. This function returns an execution object
import { getSetOwnableValidatorThresholdAction } from "@rhinestone/module-sdk";
const threshold = 2;
const setOwnableValidatorThresholdAction =
getSetOwnableValidatorThresholdAction({
threshold,
});
getAddOwnableValidatorOwnerAction
The getAddOwnableValidatorOwnerAction
function is used to add an owner to the validator. This function returns an execution object
import { getAddOwnableValidatorOwnerAction } from "@rhinestone/module-sdk";
const owner = "0x...";
const addOwnableValidatorOwnerAction = getAddOwnableValidatorOwnerAction({
owner,
});
getRemoveOwnableValidatorOwnerAction
The getRemoveOwnableValidatorOwnerAction
function is used to remove an owner from the validator. This function returns an execution object
import { getRemoveOwnableValidatorOwnerAction } from "@rhinestone/module-sdk";
const owner = "0x...";
const removeOwnableValidatorOwnerAction = getRemoveOwnableValidatorOwnerAction(
{
owner,
}
);
getOwnableValidatorOwners
The getOwnableValidatorOwners
function is used to return ownable validator owners. This function returns an array of owners addresses.
import { getOwnableValidatorOwners } from "@rhinestone/module-sdk";
const params = {
account,
client,
};
const ownableValidatorOwners = await getOwnableValidatorOwners(params);
OWNABLE_VALIDATOR_ADDRESS
The OWNABLE_VALIDATOR_ADDRESS
is a constant that represents the module address.