Class: WalletsResource#

Defined in: sdk-js/src/v4/resources/wallets.ts:15

client.wallets.* — smart-wallet CRUD plus the UserOp-driven withdraw action. A "wallet" here is an ERC-6900 / ERC-4337 smart account derived deterministically from (owner, factory, salt) — the SDK never creates an EOA, it ensures-and-registers smart accounts owned by the authenticated user's EOA.

All endpoints require auth and operate on wallets owned by the JWT's subject EOA.

Constructors#

Constructor#

new WalletsResource(transport: Transport): WalletsResource;

Defined in: sdk-js/src/v4/resources/wallets.ts:16

Parameters#

ParameterType
transportTransport

Returns#

WalletsResource

Methods#

list()#

list(): Promise<{
  data: readonly object[];
}>;

Defined in: sdk-js/src/v4/resources/wallets.ts:25

GET /wallets — every smart wallet owned by the authenticated EOA on the JWT's audience chain.

Hidden wallets (isHidden=true) are excluded by default. The response is an envelope { data: Wallet[] }, not a bare array.

Returns#

Promise<{ data: readonly object[]; }>


create()#

create(req: object): Promise<{
  address: string;
  salt: string;
  factoryAddress?: string;
  isHidden?: boolean;
  totalWorkflowCount?: number;
  enabledWorkflowCount?: number;
  completedWorkflowCount?: number;
  failedWorkflowCount?: number;
  disabledWorkflowCount?: number;
}>;

Defined in: sdk-js/src/v4/resources/wallets.ts:43

POST /wallets — idempotent "ensure exists". Derives the CREATE2 address from (owner, salt, factory) and persists the record; calling twice with the same triple returns the same address.

The on-chain account is not deployed by this call — deployment happens lazily as part of the first UserOp (workflow execution or withdraw) via the initCode field, so the smart wallet costs zero gas until it's first used.

Per-owner cap is enforced by max_wallets_per_owner in the aggregator config; the call returns 429 WALLETS_LIMIT_REACHED when exceeded.

Parameters#

ParameterTypeDescription
req{ salt: string; factoryAddress?: string; }-
req.saltstringDescription Salt as a decimal string (big-int). Determines the derived address together with the factory.
req.factoryAddress?stringDescription Optional factory override. Defaults to the aggregator's configured factory.

Returns#

Promise<{ address: string; salt: string; factoryAddress?: string; isHidden?: boolean; totalWorkflowCount?: number; enabledWorkflowCount?: number; completedWorkflowCount?: number; failedWorkflowCount?: number; disabledWorkflowCount?: number; }>


update()#

update(address: string, body: object): Promise<{
  address: string;
  salt: string;
  factoryAddress?: string;
  isHidden?: boolean;
  totalWorkflowCount?: number;
  enabledWorkflowCount?: number;
  completedWorkflowCount?: number;
  failedWorkflowCount?: number;
  disabledWorkflowCount?: number;
}>;

Defined in: sdk-js/src/v4/resources/wallets.ts:58

PATCH /wallets/ — partial update. The only mutable field today is isHidden, used by the Studio UI's hide/unhide wallet action. Keyed by address, not salt — callers that still think in salts must look up the address first via create({ salt }).

Parameters#

ParameterType
addressstring
body{ isHidden?: boolean; }
body.isHidden?boolean

Returns#

Promise<{ address: string; salt: string; factoryAddress?: string; isHidden?: boolean; totalWorkflowCount?: number; enabledWorkflowCount?: number; completedWorkflowCount?: number; failedWorkflowCount?: number; disabledWorkflowCount?: number; }>


withdraw()#

withdraw(address: string, req: object): Promise<{
  status: "failed" | "pending" | "confirmed";
  message?: string;
  userOpHash?: string;
  transactionHash?: string;
  submittedAt?: number;
  smartWalletAddress?: string;
  recipientAddress?: string;
  amount?: string;
  token?: string;
}>;

Defined in: sdk-js/src/v4/resources/wallets.ts:78

POST /wallets/:withdraw — transfer ETH or an ERC-20 out of the smart wallet via a UserOp through the bundler + paymaster.

Per-chain config (bundler URL, paymaster address, RPC) is resolved by the gateway from the JWT's aud claim or body.chainId. The response's status is one of pending | confirmed | failed: confirmed means the bundler returned a receipt synchronously, pending means it accepted the UserOp but the receipt hasn't landed yet, failed means the bundler rejected the op or it reverted before inclusion.

Parameters#

ParameterTypeDescription
addressstring-
req{ recipientAddress: string; amount: string; token: string; chainId?: number; }-
req.recipientAddressstring-
req.amountstringDescription Amount in wei (decimal string) or max for the full balance.
req.tokenstringDescription ETH for native token, or an ERC-20 contract address.
req.chainId?numberDescription Chain to execute the withdrawal on. 0 = aggregator default.

Returns#

Promise<{ status: "failed" | "pending" | "confirmed"; message?: string; userOpHash?: string; transactionHash?: string; submittedAt?: number; smartWalletAddress?: string; recipientAddress?: string; amount?: string; token?: string; }>


getNonce()#

getNonce(address: string): Promise<{
  nonce: string;
}>;

Defined in: sdk-js/src/v4/resources/wallets.ts:94

GET /wallets/:getNonce — current AA nonce for the wallet.

Used when an external signer needs to assemble a UserOp outside the SDK's bundler path. Most callers don't need this directly — workflows.simulate and wallets.withdraw handle nonce sourcing internally.

Parameters#

ParameterType
addressstring

Returns#

Promise<{ nonce: string; }>