Creating New Instances

Create new Instances of a 1 of N Hats Account, and/or predict the addresses of accounts.

createAccount

Create a new 1 of N Hats Account instance.

const createHatsAccountResult = await hatsAccount1ofNClient.createAccount({
    account,
    hatId,
    salt,
});

Arguments:

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

  • hatId - ID of the hat for which to create the account.

  • signersHatId - arbitrary number as "salt".

Response:

An object of type CreateAccountResult, includes:

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

  • transactionHash - transaction's hash.

  • newAccount - In case of success, the address of the new account.

predictAccountAddress

Predict the address of a 1 of N Hats Account instance.

Arguments:

  • hatId - ID of the hat for which to create the account.

  • signersHatId - arbitrary number as "salt".

Response:

The predicted account address.

Last updated