Skip to main content
Creates a SparkReadonlyClient authenticated with a custom SparkSigner. Designed for partners (e.g., Privy) who provide their own signer implementation without exposing a mnemonic.

Method Signature

static createWithSigner(
  config: ConfigOptions | undefined,
  signer: SparkSigner,
): SparkReadonlyClient

Parameters

config
ConfigOptions | undefined
required
Configuration options including network selection. Pass undefined for defaults.
signer
SparkSigner
required
A pre-initialized SparkSigner implementation. The signer’s identity key is used for authentication.

Returns

client
SparkReadonlyClient
required
An authenticated wallet viewer using the provided signer for identity verification.

Example

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

const client = SparkReadonlyClient.createWithSigner(
  { network: "MAINNET" },
  myCustomSigner,
);

const balance = await client.getAvailableBalance("sp1...");
See the Spark Signer Interface docs for implementing a custom SparkSigner.