Skip to main content
Creates and initializes a new SparkWallet instance.

Method Signature

interface SparkWalletProps {
  mnemonicOrSeed?: Uint8Array | string;
  accountNumber?: number;
  signer?: SparkSigner;
  options?: ConfigOptions;
}

static async initialize(props: SparkWalletProps): Promise<{
  wallet: SparkWallet;
  mnemonic?: string;
}>

Parameters

mnemonicOrSeed
Uint8Array | string
BIP-39 mnemonic phrase or raw seed
accountNumber
number
Number used to generate multiple identity keys from the same mnemonic
signer
SparkSigner
Custom signer implementation for advanced use cases
options
ConfigOptions
Wallet configuration options including network selection

Returns

wallet
SparkWallet
required
The initialized SparkWallet instance
mnemonic
string
The mnemonic if one was generated (undefined for raw seed)

Example

import { SparkWallet } from "@buildonspark/spark-sdk";

// Create a new wallet
const { wallet, mnemonic } = await SparkWallet.initialize({
  options: { network: "REGTEST" } // or "MAINNET"
});

console.log("Wallet initialized:", wallet);
console.log("Generated mnemonic:", mnemonic);