Hats Signer Gate

Interact with HSG instances.

Signers Management

hsgClaimSigner

Claim signer rights on the safe.

In order to successfully claim:

  • The calling account must wear the Signers Hat. Use this function is order to check whether an account is a valid signer.

  • 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.hsgClaimSigner({
    account,
    hsgInstance,
});

Arguments:

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

  • hsgInstance - HSG's instance address.

Response:

{
  status: "success" | "reverted";
  transactionHash: `0x${string}`;
}
  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

hsgIsValidSigner

Check if an account is wearing the Signers Hat (regardless whether the account has claimed signer rights or not).

const isValid = await hatsSignerGateClient.hsgIsValidSigner({
    hsgInstance,
    address    
});

Arguments:

{
    hsgInstance: Address;
    address: Address;
}
  • hsgInstance - HSG'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 - HSG'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 - HSG'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 - HSG'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.

HSG Instance Properties

Getters for the basic properties of a HSG instance.

hsgSignersHatId

Get a HSG's Signers Hat ID.

const signersHat = await hatsSignerGateClient.hsgSignersHatId({
    hsgInstance 
});

Arguments:

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

Response:

bigint

HSG's Signers Hat ID.

getSafe

Get a HSG's attached Safe.

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

Arguments:

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

Response:

Address

Address of the attached Safe.

getMinThreshold

Get a HSG's minimum threshold.

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

Arguments:

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

Response:

bigint

The instance's min threshold.

getTargetThreshold

Get a HSG's target threshold.

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

Arguments:

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

Response:

bigint

The instance's target threshold.

getMaxSigners

Get a HSG's maximum amount of signers.

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

Arguments:

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

Response:

bigint

The instance's max signers.

getOwnerHat

Get a HSG's Owner Hat.

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

Arguments:

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

Response:

bigint

The instance's Owner Hat.

HSG Owner

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

setTargetThreshold

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

In order to successfully execute the function:

  • The caller must be a wearer of the HSG'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 HSG'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 - HSG'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.

Last updated