Hats Protocol Docs
hatsprotocol.xyzGithub
  • 👋Welcome to Hats Protocol
  • 🧢Getting Started with Hats
  • ⭐Quick Start
  • Using The Hats App
    • 🤠Essentials For Hat Wearers
    • 🎩Creating My First Hat
    • 🧙Admins: Creating, Issuing, and Revising Hats
    • 👥What Hats Do I Need?
    • 🌳Drafting, Exporting, and Deploying Tree Changes
    • 🏗️Setting a Hat's Basic Properties
    • 🥳Adding Wearers
    • 🔐Connecting Hats w/ Permissions & Authorities
      • Types of Hat-Powered Authorities
      • Connecting Hats to Token Gates
        • Hats Protocol Contract Addresses
        • Finding a Hat's Token ID
      • Documenting Hat Powers & Responsibilities
    • 🌟Revocation & Eligibility: Requirements for Wearers
    • ⚡Deactivating & Reactivating Hats
    • ✅Making Hats Claimable
    • 🔗Linking Trees Together
    • ⛓️Hats Protocol Supported Chains
    • ❓Glossary & FAQ
  • Hats Integrations
    • 🔐Permissions & Authorities
      • Coordinape
      • Council Voting Vault
      • Charmverse
      • Discord
        • Collab.Land --> Discord
        • Guild.xyz --> Discord
      • Farcaster Casting Rights
      • Fileverse
      • Google Workspace
      • Hats Account
      • Role-Based Compensation
      • Safe Multisig Signing Authority
      • Telegram
        • Collab.Land --> Telegram
        • Guild.xyz --> Telegram
      • Snapshot: Voting, Weight & Proposal Creation
      • Wonderverse
    • 🌟Eligibility & Accountability Criteria
      • Agreement Eligibility
      • Allow-List Eligibility
      • CoLinks Eligibility
      • ERC20 Eligibility
      • ERC721 Eligibility
      • ERC1155 Eligibility
      • Hat-Wearing Eligibility
      • Hats Election Eligibility
      • JokeRace Eligibility
      • Pass-Through (Hat-Based) Eligibility
      • Staking Eligibility
      • Subscription or Membership Fee (Unlock Protocol)
      • Gitcoin Passport Eligibility
    • ⚡Activation & Deactivation Criteria
      • Seasonal/ Time-Expiry Toggle
      • Pass-Through (Hat-Based) Toggle
    • 👷Hatter Modules
      • Multi Claims Hatter
      • DAOhaus Moloch v3 Membership & Share Allocation
  • For Developers
    • 👷Hats Protocol, for Developers
      • Hat Properties
      • Wearing a Hat
      • Hat Admins & Hatter Contracts
      • Hats Trees
      • Hat IDs
      • Linking Hats Trees
      • Eligibility Modules
      • Toggle Modules
      • Hat Mutability and Editing
      • Creating Hats
      • Minting Hats
      • Transfering Hats
      • Renouncing Hats
      • Batch Actions
      • Hat Image URIs
      • ERC1155 Compatibility
      • ⛓️Supported Chains
    • 🤖v1 Protocol Spec
      • Hats.sol
      • HatsEvents.sol
      • HatsErrors.sol
      • HatsIdUtilities.sol
      • Interfaces
        • IHats.sol
        • IHatsIdUtilities.sol
        • IHatsEligibility.sol
        • IHatsToggle.sol
    • 🖥️v1 SDK
      • Core
        • Getting Started
        • Onchain Reads
        • Onchain Writes
        • Multicall
        • Claiming Hats
        • Utilities
      • Subgraph
        • Getting Started
        • Fetching Hats
        • Fetching Wearers
        • Fetching Trees
        • Misc
        • Types
      • Hat Details
        • Getting Started
        • Usage
    • 🔭v1 Subgraphs
    • 🧩Hats Modules
      • 🔌Modules SDK
        • Getting Started
        • Get Available Modules
        • Create New Instance/s
        • Composing Modules
        • Interact With Instances
        • Utilities
        • Types
      • ⚒️Building Hats Modules
        • Inside a Hats Module
          • Immutable Arguments
          • Module Setup
          • Versioning
        • Creating New Modules
        • How Module Instances Are Deployed
        • Modules Registry
        • About Module Chains
    • 🔏Hats Signer Gate v2
    • 👒Hats Signer Gate SDK
      • Getting Started
      • Creating New Instances
      • Hats Signer Gate
      • Multi Hats Signer Gate
      • HSG & MHSG Handlers
    • 💼Hats Account SDK
      • 1 of N Hats Account
        • Getting Started
        • Creating New Instances
        • Executing From An Instance
        • Constants
        • Types
    • 🌐Hats Security Audits
  • Legal
    • Terms
      • Terms of Service
      • Acceptable Use
      • Privacy Policy
      • Cookie Policy
      • Attribution
Powered by GitBook
On this page
  • Signers Management
  • mhsgClaimSigner
  • mhsgIsValidSigner
  • claimedAndStillValid
  • validSignerCount
  • reconcileSignerCount
  • removeSigner
  • MHSG Instance Properties
  • mhsgIsValidSignersHat
  • getSafe
  • getMinThreshold
  • getTargetThreshold
  • getMaxSigners
  • getOwnerHat
  • HSG Owner
  • mhsgAddSignerHats
  • setTargetThreshold
  • setMinThreshold
  • setOwnerHat
  1. For Developers
  2. Hats Signer Gate SDK

Multi Hats Signer Gate

PreviousHats Signer GateNextHSG & MHSG Handlers

Last updated 1 year ago

Interact with instances.

Signers Management

mhsgClaimSigner

Claim signer rights on the safe.

In order to successfully claim:

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

  • 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" | "reverted";
  transactionHash: `0x${string}`;
}
  • 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.

const isValid = await hatsSignerGateClient.mhsgIsValidSigner({
    mhsgInstance,
    address    
});

Arguments:

{
    mhsgInstance: Address;
    address: Address;
}
  • mhsgInstance - MHSG's instance address.

  • address -The address to check.

Response:

boolean

true if valid, false otherwise.

claimedAndStillValid

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

const claimedAndValid = await hatsSignerGateClient.claimedAndStillValid({
    instance,
    address    
});

Arguments:

{
    instance: Address;
    address: Address;
}
  • instance - HSG's instance address.

  • address -The address to check.

Response:

boolean

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.

const count = await hatsSignerGateClient.validSignerCount({
    instance 
});

Arguments:

{
    instance: Address;
}
  • instance - MHSG's instance address.

Response:

bigint

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.

const res = await hatsSignerGateClient.reconcileSignerCount({
    account,
    instance,
});

Arguments:

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

  • instance - MHSG's instance address.

Response:

{
  status: "success" | "reverted";
  transactionHash: `0x${string}`;
}
  • 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.

const res = await hatsSignerGateClient.removeSigner({
    account,
    instance,
    signer,
});

Arguments:

{
    account: Account | Address;
    instance: Address;
    signer: Address;
}
  • 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" | "reverted";
  transactionHash: `0x${string}`;
}
  • 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.

const isValid = await hatsSignerGateClient.mhsgIsValidSignersHat({
    mhsgInstance,
    hatId    
});

Arguments:

{
    mhsgInstance: Address;
    hatId: bigint;
}
  • mhsgInstance - MHSG's instance address.

  • hatId -The Hat to check.

Response:

boolean

true if valid, false otherwise.

getSafe

Get a MHSG's attached Safe

const safe = await hatsSignerGateClient.getSafe({
    instance 
});

Arguments:

{
    instance: Address;
}
  • hsgInstance - MHSG's instance address.

Response:

Address

Address of the attached Safe.

getMinThreshold

Get a MHSG's minimum threshold.

const minThreshold = await hatsSignerGateClient.getMinThresholde({
    instance 
});

Arguments:

{
    instance: Address;
}
  • instance - MHSG's instance address.

Response:

bigint

The instance's min threshold.

getTargetThreshold

Get a MHSG's target threshold.

const targetThreshold = await hatsSignerGateClient.getTargetThreshold({
    instance 
});

Arguments:

{
    instance: Address;
}
  • instance - MHSG's instance address.

Response:

bigint

The instance's target threshold.

getMaxSigners

Get a MHSG's maximum amount of signers.

const maxSigners = await hatsSignerGateClient.getMaxSigners({
    instance 
});

Arguments:

{
    instance: Address;
}
  • instance - MHSG's instance address.

Response:

bigint

The instance's max signers.

getOwnerHat

Get a MHSG's Owner Hat.

const ownerHat = await hatsSignerGateClient.getOwnerHat({
    instance 
});

Arguments:

{
    instance: Address;
}
  • instance - MHSG's instance address.

Response:

bigint

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.

const res = await hatsSignerGateClient.mhsgAddSignerHats({
    account,
    mhsgInstance,
    newSignerHats,
});

Arguments:

{
    account: Account | Address;
    mhsgInstance: Address;
    newSignerHats: bigint[];
}
  • 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" | "reverted";
  transactionHash: `0x${string}`;
}
  • 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.

const res = await hatsSignerGateClient.setTargetThreshold({
    account,
    instance,
    targetThreshold,
});

Arguments:

{
    account: Account | Address;
    instance: Address;
    targetThreshold: bigint;
}
  • 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" | "reverted";
  transactionHash: `0x${string}`;
}
  • 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.

const res = await hatsSignerGateClient.setMinThreshold({
    account,
    instance,
    minThreshold,
});

Arguments:

{
    account: Account | Address;
    instance: Address;
    minThreshold: bigint;
}
  • 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" | "reverted";
  transactionHash: `0x${string}`;
}
  • 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.

const res = await hatsSignerGateClient.setOwnerHat({
    account,
    instance,
    newOwnerHat,
    hatsContractAddress,
});

Arguments:

{
    account: Account | Address;
    instance: Address;
    newOwnerHat: bigint;
    hatsContractAddress: Address;
}
  • 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" | "reverted";
  transactionHash: `0x${string}`;
}
  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

👒
MHSG
valid Signers Hat
wearers