HSG & MHSG Handlers
The following section describes a different way of interacting with HSG and MHSG instances, than documented in the previous sections. In particular, in the previous sections, for each operation on the HSG and MHSG contracts, there's a matching function in the SDK.
In addition to these individual functions, the SDK also includes a single handler for calling the write operations of both HSG and MHSG instances. This enables HSG/MHSG interactions to be optionally handled in a similar way to Hats Modules interactions, by working with the HSG and MHSG metadata objects and the single write functions handler.
Handlers
callInstanceWriteFunction
Call a HSG/MHSG instance's write function.
Arguments:
account
- Viem account (Address for JSON-RPC accounts or Account for other types).type
- 'HSG' or 'MHSG'.instance
- The MHSG/HSG instance address.func
- The write function to call, provided as an object of type WriteFunction.args
- The arguments with which to call the function, as objects of type WriteFunctionArg.
Response:
status
- "success" if transaction was successful, "reverted" if transaction reverted.transactionHash
- transaction's hash.
getInstanceParameters
Get a HSG or MHSG instance live parameters:
Safe address
Min threshold
Target threshold
Max signers
Owner Hat
Arguments:
instance
- Instance's address.
Response:
An array of objects, each containing a parameter's information:
label
- The parameter's name/description.value
- The parameter's value, as was returned from the instance contract.solidityType
- The parameter's Solidity type.displayType
- The parameter's display type. Its purpose is for UIs to be able to render an appropriate component for the parameter
Metadata
Both the HSG and MHSG metadata objects include their ABIs, all their write functions together with the metadata of each function and the custom roles that are associated with them.
getMetadata
Get the metadata object of HSG or MHSG.
Arguments:
"HSG" or "MHSG"
Response:
An object of type HsgMetadata.
Types
HsgMetadata
Represents a HSG or MHSG metadata object.
Role
A custom HSG/MHSG role. Each role is associated with a hat and grants permissions to the hat's wearer(s) to call certain functions on the contract.
There are two special roles with a reserved ID:
public
role, associated with functions that are permitted to any caller.hatAdmins
role, associated with functions that are permitted to the target hat's admins.
WriteFunction
The HSG/MHSG write functions. Each write function is associated with a role that grants permissions to the role's wearer(s) to call the function on the contract.
WriteFunctionArg
HSG/MHSG write function argument.
Last updated