Skip to content

Fireblocks Signer

FireblocksSigner is a signer implementation which extends SmartAccountAuthenticator to leverage the Fireblocks SDK. It supports features such as authentication, message and typed data signing, and authentication details retrieval.

FireblocksSigner provides implementations for all methods on SmartAccountAuthenticator:

  1. authenticate -- supports user authentication.
  2. getAddress -- gets the address of the the smart contract account's connected EOA signer account.
  3. signMessage -- supports message signatures.
  4. signTypedData -- supports typed data signatures.
  5. getAuthDetails -- supports authentication details retrieval.

Install Dependencies

FireblocksSigner requires installation of the @fireblocks/fireblocks-web3-provider SDK. aa-signers lists it as an optional dependency.

bash
npm i -s @fireblocks/fireblocks-web3-provider
bash
yarn add @fireblocks/fireblocks-web3-provider

Usage

ts
import { createFireblocksSigner } from "./fireblocks";

const fireblocksSigner = await createFireblocksSigner();

const address = await fireblocksSigner.getAddress();

const details = await fireblocksSigner.getAuthDetails();

const signedMessage = await fireblocksSigner.signMessage("test");

const typedData = {
  types: {
    Request: [{ name: "hello", type: "string" }],
  },
  primaryType: "Request",
  message: {
    hello: "world",
  },
};
const signTypedData = await fireblocksSigner.signTypedData(typedData);
ts
import { FireblocksSigner } from "@alchemy/aa-signers/fireblocks";
import { ChainId } from "@fireblocks/fireblocks-web3-provider";

export const createFireblocksSigner = async () => {
  const fireblocksSigner = new FireblocksSigner({
    privateKey: process.env.FIREBLOCKS_API_PRIVATE_KEY_PATH!,
    apiKey: process.env.FIREBLOCKS_API_KEY!,
    vaultAccountIds: process.env.FIREBLOCKS_VAULT_ACCOUNT_IDS,
    chainId: ChainId.SEPOLIA,
  });

  await fireblocksSigner.authenticate();

  return fireblocksSigner;
};