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
BIP-39 mnemonic phrase or raw seed
Number used to generate multiple identity keys from the same mnemonic
Custom signer implementation for advanced use cases
Wallet configuration options including network selection
Returns
The initialized SparkWallet instance
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);