Core SDKHow-to guides

Choose Account readiness

Select none, counterfactual, or deployed readiness when creating an SDK client.

Set requirement once when you create the client:

const created = await createCapxulClient({
  publishableKey,
  requirement: "counterfactual",
});

Choose the smallest state your workflow needs:

RequirementUse it when
"none"You need authentication or profile reads but no Account setup. This is the default.
"counterfactual"The user needs a receivable Account without immediate deployed activation.
"deployed"The workflow requires full on-chain activation. Node callers must supply a signer.

After sign-in, inspect the product lifecycle:

const lifecycle = await client.account.getLifecycle();
if (!lifecycle.ok) throw lifecycle.error;

if (lifecycle.value.status === "failed") {
  const retried = await client.account.retrySetup();
  if (!retried.ok) throw retried.error;
}

Do not call private provision/deploy arms directly. The client owns the readiness lane and bootstrap-supplied chain configuration.

Pass { signal, timeoutMs } to retrySetup to bound recovery. Cancellation stops the Account work and prevents a late signer result from starting a claim. It cannot undo a submitted transaction or close resources owned by your signer. Retry applies to a retryable failure held by this client. After you restore an authenticated session in a new client, it can also resume that person's existing Account. It reads durable readiness first and does not claim again when the configured requirement is already met. A missing Account returns SMART_ACCOUNT_MISSING; use signup for initial setup. Retry does not change the Profile.

For deployed readiness in Node, create a signer from the packed Node entry:

import { localPrivateKeySigner } from "@capxul/sdk/node";

const signer = localPrivateKeySigner({
  privateKey: process.env.CAPXUL_SIGNER_PRIVATE_KEY! as `0x${string}`,
});

const created = await createCapxulClient({
  publishableKey,
  requirement: "deployed",
  signer,
});

Keep private keys out of source, logs, and client-side bundles.