Skip to content

feat(wallets): map backend recovery signer error codes to SDK errors - #2038

Merged
panosinthezone merged 2 commits into
devin/1788197979-recovery-openapi-typesfrom
devin/1788197979-recovery-errors
Sep 1, 2026
Merged

feat(wallets): map backend recovery signer error codes to SDK errors#2038
panosinthezone merged 2 commits into
devin/1788197979-recovery-openapi-typesfrom
devin/1788197979-recovery-errors

Conversation

@panosinthezone

Copy link
Copy Markdown
Contributor

Description

Part 2/4 of splitting #2035 into a reviewable stack (stacked on #2037).

Adds SDK error classes for the backend's stable recovery error codes, plus throwIfRecoverySignerApiError(response) which maps an API error body to the right class:

Backend code SDK error
SIGNER_LIMIT_EXCEEDED RecoverySignerLimitExceededError
RECOVERY_DUPLICATE_SIGNER DuplicateRecoverySignerError
RECOVERY_SIGNER_CONFLICT RecoverySignerConflictError
SIGNER_REQUIRED SignerRequiredError
RECOVERY_NOT_SUPPORTED_ON_CHAIN RecoveryNotSupportedOnChainError
NOT_SUPPORTED_ON_API_VERSION NotSupportedOnApiVersionError
RECOVERY_ADMIN_SIGNER_CONFLICT RecoveryAdminSignerConflictError

Also adds InvalidRecoveryConfigError and MAX_RECOVERY_SIGNERS = 10 for client-side validation, and exports everything from the package index. Nothing calls the mapping yet — the wallet factory wires it up in the next PR of the stack.

Test plan

  • New unit tests in src/utils/errors.test.ts cover every code above, fallback messages, API error details, and that unrelated API bodies are not swallowed.
  • pnpm --filter @crossmint/wallets-sdk test:vitest passes.

Package updates

  • @crossmint/wallets-sdk (patch) — changeset recovery-errors added.

Link to Devin session: https://crossmint.devinenterprise.com/sessions/520c831e21b04f9f9d2fbb524107c536
Open in Devin Desktop: https://crossmint.devinenterprise.com/desktop/session/520c831e21b04f9f9d2fbb524107c536?variant=devin
Requested by: @panosinthezone

@devin-ai-integration

Copy link
Copy Markdown
Contributor
Original prompt from Panayiotis

Enable passing a list of recovery signers when creating wallets in ``@crossmint/wallets-sdk (repo `Crossmint/crossmint-sdk`), starting with Solana and Stellar (the backend already accepts a `recovery` list for those chains; EVM still accepts only a single admin signer in the backend DTO so keep EVM single for now). Currently the SDK only accepts and sends a single `recovery` signer mapped to the deprecated singular `adminSigner` field.

#``# Background / current state

  • packages/wallets/src/wallets/types.ts (around lines 236-242): WalletCreateArgs<C> declares recovery: Exclude<SignerConfigForChain<C>, DeviceSignerConfig> — a single signer.
  • packages/wallets/src/wallets/wallet-factory.ts:
    • createWallet (around lines 143-156) resolves validatedArgs.recovery into a single adminSigner value, deriving server/passkey addresses as needed.
    • buildParams/createSmartWallet (around lines 186-197) puts that scalar into the request config.adminSigner (no recovery array).
    • createWalletInstance (around lines 249-253) reads the recovery signer back from config.adminSigner (singular).
  • packages/wallets/src/api/types.ts (lines 36-43): CreateWalletParams = CreateWalletV2025DtoClass; RecoverySignerConfig is derived from the generated DTO's config.adminSigner.
  • The backend (Paella-Labs/crossbit-main, libraries/products/wallets/v2/src/dto-v2025/wallets.dto.ts) exposes a recovery field: single admin signer for EVM, a list (up to 10) for Solana and Stellar. The backend adapter folds recovery onto adminSigner/adminSigners, and rejects sending both adminSigner and recovery.

#``# Changes to make

  1. Types (packages/wallets/src/wallets/types.ts): Allow WalletCreateArgs.recovery to accept either a single signer or an array of signers, gated per-chain so that Solana and Stellar accept SignerConfigForChain<C> | Array<...> while EVM remains single until the backend supports a list. Continue excluding DeviceSignerConfig. Keep `re... (2901 chars truncated...)

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6f20777

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@crossmint/wallets-sdk Patch
@crossmint/wallets-quickstart-devkit Patch
@crossmint/wallets-playground-react Patch
@crossmint/client-sdk-react-base Patch
@crossmint/client-sdk-react-native-ui Patch
@crossmint/client-sdk-react-ui Patch
@crossmint/wallets-playground-expo Patch
@crossmint/auth-ssr-nextjs-demo Patch
@crossmint/client-sdk-nextjs-starter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
packages/wallets/src/utils/errors.ts:335
**Unused recovery error mapper**

`throwIfRecoverySignerApiError` is compiled into this package but is only referenced by its unit tests and is not available through the package entry point. Shipping it before the wallet factory integration leaves unused implementation that must remain synchronized with the backend contract until the next PR lands.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(wallets): map backend recovery sign..." | Re-trigger Greptile

Comment thread packages/wallets/src/utils/errors.ts
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🔥 Smoke Test Results

Status: Failed

Statistics

  • Total Tests: 5
  • Passed: 3 ✅
  • Failed: 1 ❌
  • Skipped: 1 ⚠️
  • Duration: 4.46 min

Test Details


This is a non-blocking smoke test. Full regression tests run separately.

Comment thread packages/wallets/src/utils/errors.ts Outdated
devin-ai-integration Bot and others added 2 commits September 1, 2026 16:56
Co-Authored-By: Panayiotis Halios <panos@paella.dev>
…sage

Co-Authored-By: Panayiotis Halios <panos@paella.dev>
@panosinthezone
panosinthezone force-pushed the devin/1788197979-recovery-errors branch from 2f22c5b to 6f20777 Compare September 1, 2026 13:57
@panosinthezone
panosinthezone merged commit 0fb459c into main Sep 1, 2026
5 of 6 checks passed
@panosinthezone
panosinthezone deleted the devin/1788197979-recovery-errors branch September 1, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants