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:

{
  status: "success" | "reverted";
  transactionHash: `0x${string}`;
  newAccount: `0x${string}`;
}

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.

const predictedAccount = await hatsAccount1ofNClient.predictAccountAddress({
    hatId,
    salt,
});

Arguments:

{
    hatId: bigint;
    salt: bigint;
}
  • hatId - ID of the hat for which to create the account.

  • signersHatId - arbitrary number as "salt".

Response:

`0x${string}`

The predicted account address.

Last updated