Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

createWallet

Creates a smart-account wallet for a signer. The signer's key lives wherever you keep it (env var, OS keychain, hardware wallet). Functor never sees it.

import { createWallet, signerFromPrivateKey } from "@functornetwork/agentic-wallet";
 
const signer = signerFromPrivateKey("0x...");
const wallet = await createWallet({ signer });

The wallet is counterfactual. Its address is deterministic, but it isn't a smart account on-chain until the first execute. That first execute is what registers the admin key in Keystore.

Parameters

type CreateWalletOptions = {
  /** Bring your own signer. If omitted, the SDK generates a fresh private-key signer. */
  signer?: Signer;
  /** Override the default network (Sepolia). */
  network?: NetworkConfig;
  /** Skip the testnet faucet step. Use this on mainnet or when funding yourself. */
  skipFaucet?: boolean;
};

Returns

type CreateWalletResult = {
  address: Address;            // the wallet's smart-account address
  network: { chainId: number };
  signer: Signer;              // same reference if you passed one in
};

Notes

  • On Sepolia with skipFaucet: false (default), the SDK faucets enough native ETH to cover the first transaction. On mainnet, fund result.address yourself before calling execute.
  • If you omit signer, the SDK generates a fresh private-key signer and returns it on the result. Persist result.signer however your app stores keys.

Example: generate a fresh wallet

import { createWallet } from "@functornetwork/agentic-wallet";
 
const wallet = await createWallet();
console.log("Address:", wallet.address);
console.log("Save this:", wallet.signer);