Multi Hats Signer Gate

Interact with MHSG instances.

Signers Management

mhsgClaimSigner

Claim signer rights on the safe.

In order to successfully claim:

  • The provided hatId parameter should be a valid Signers Hat and the caller is one of its wearers.

  • Caller must not be already a signer.

  • The current amount of valid signers should be smaller than the configured amount of maximum signers.

const claimSignerResult = await hatsSignerGateClient.mhsgClaimSigner({
    account,
    mhsgInstance,
    hatId,
});

Arguments:

{
    account: Account | Address;
    mhsgInstance: Address;
    hatId: bigint;
}
  • account - Viem account (Address for JSON-RPC accounts or Account for other types).

  • mhsgInstance - MHSG's instance address.

  • hatId - The hat ID to claim signer rights for, must be a valid Signers Hat.

Response:

  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

mhsgIsValidSigner

Check if an account is wearing one of the Signers Hats and also claimed signer rights for it.

Arguments:

  • mhsgInstance - MHSG's instance address.

  • address -The address to check.

Response:

true if valid, false otherwise.

claimedAndStillValid

Check if an account has claimed signer rights and is still valid.

Arguments:

  • instance - HSG's instance address.

  • address -The address to check.

Response:

true if the account is one of the safe's owners and is still valid, false otherwise.

validSignerCount

Tallies the number of existing Safe owners that wear the Signers Hat.

Arguments:

  • instance - MHSG's instance address.

Response:

The number of valid signers on the Safe.

reconcileSignerCount

Tallies the number of existing Safe owners that wear a Signers Hat and updates the Safe's threshold if necessary. Does NOT remove invalid Safe owners.

Arguments:

  • account - Viem account (Address for JSON-RPC accounts or Account for other types).

  • instance - MHSG's instance address.

Response:

  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

removeSigner

Removes an invalid signer from the Safe, updating its threshold if appropriate.

Arguments:

  • account - Viem account (Address for JSON-RPC accounts or Account for other types).

  • instance - MHSG's instance address.

  • signer - The address to remove if not a valid signer.

Response:

  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

MHSG Instance Properties

Getters for the basic properties of a MHSG instance.

mhsgIsValidSignersHat

Check if a given Hat is a valid Signers Hat.

Arguments:

  • mhsgInstance - MHSG's instance address.

  • hatId -The Hat to check.

Response:

true if valid, false otherwise.

getSafe

Get a MHSG's attached Safe

Arguments:

  • hsgInstance - MHSG's instance address.

Response:

Address of the attached Safe.

getMinThreshold

Get a MHSG's minimum threshold.

Arguments:

  • instance - MHSG's instance address.

Response:

The instance's min threshold.

getTargetThreshold

Get a MHSG's target threshold.

Arguments:

  • instance - MHSG's instance address.

Response:

The instance's target threshold.

getMaxSigners

Get a MHSG's maximum amount of signers.

Arguments:

  • instance - MHSG's instance address.

Response:

The instance's max signers.

getOwnerHat

Get a MHSG's Owner Hat.

Arguments:

  • instance - MHSG's instance address.

Response:

The instance's Owner Hat.

HSG Owner

Following functions are only authorized to the wearer(s) of the MHSG instance's Owner Hat.

mhsgAddSignerHats

Add new approved Signers Hats.

In order to successfully execute the function:

  • The caller must be a wearer of the MHSG's Owner Hat.

Arguments:

  • account - Viem account (Address for JSON-RPC accounts or Account for other types).

  • mhsgInstance - MHSG's instance address.

  • newSignerHats - Array of Hat IDs to add as approved Signers Hats.

Response:

  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

setTargetThreshold

Sets a new target threshold, and changes the Safe's threshold if appropriate.

In order to successfully execute the function:

  • The caller must be a wearer of the MHSG's Owner Hat.

  • The new target threshold should not be smaller than the minimum threshold.

  • The new target threshold should not be larger than the maximum amount of signers.

Arguments:

  • account - Viem account (Address for JSON-RPC accounts or Account for other types).

  • instance - HSG's instance address.

  • targetThreshold - The new target threshold to set.

Response:

  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

setMinThreshold

Sets a new minimum threshold.

In order to successfully execute the function:

  • The caller must be a wearer of the MHSG's Owner Hat.

  • The new minimum threshold should not be larger than the target threshold.

  • The new minimum threshold should not be larger than the maximum amount of signers.

Arguments:

  • account - Viem account (Address for JSON-RPC accounts or Account for other types).

  • instance - HSG's instance address.

  • minThreshold - The new minimum threshold to set.

Response:

  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

setOwnerHat

Sets a new Owner Hat.

In order to successfully execute the function:

  • The caller must be a wearer of the current Owner Hat.

Arguments:

  • account - Viem account (Address for JSON-RPC accounts or Account for other types).

  • instance - MHSG's instance address.

  • newOwnerHat - The new Owner Hat to set.

  • hatsContractAddress - The Hats.sol contract address of the new Owner Hat.

Response:

  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

Last updated