@reown/appkit-controllers 1.8.23-prefer-universal-fix.0 → 1.8.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ export { ChainController } from '../src/controllers/ChainController.js';
6
6
  export type { ChainControllerState, AccountState } from '../src/controllers/ChainController.js';
7
7
  export { ProviderController } from '../src/controllers/ProviderController.js';
8
8
  export type { ProviderControllerState } from '../src/controllers/ProviderController.js';
9
+ export { isCoinbaseConnectorId, isUnauthorizedProviderError, maybeWrapCoinbaseProvider, withCoinbaseReauth } from '../src/utils/ProviderReauthUtil.js';
9
10
  export { OnRampController } from '../src/controllers/OnRampController.js';
10
11
  export type { OnRampControllerState, OnRampProvider } from '../src/controllers/OnRampController.js';
11
12
  export { AdapterController } from '../src/controllers/AdapterController/index.js';
@@ -0,0 +1,45 @@
1
+ import type { ChainNamespace } from '@reown/appkit-common';
2
+ /**
3
+ * True when `connectorId` is a Coinbase connector.
4
+ *
5
+ * The connector id (not the provider "type") is the reliable signal: it is a
6
+ * stable `'coinbaseWallet'` / `'coinbaseWalletSDK'` across every adapter and
7
+ * registration path, whereas the provider type is remapped to `'EXTERNAL'` by
8
+ * `PresetsUtil.ConnectorTypesMap` on most paths. Matched case-insensitively by
9
+ * substring to also tolerate the wagmi restore path's uppercased
10
+ * `connector.type` (`'COINBASEWALLET'`).
11
+ */
12
+ export declare function isCoinbaseConnectorId(connectorId: string | undefined): boolean;
13
+ /**
14
+ * EIP-1193 `4100` unauthorized error, matched by code or by the SDK's
15
+ * `eth_requestAccounts` wording, walking the `cause` chain (viem/provider
16
+ * wrappers nest the original error) with bounded depth.
17
+ */
18
+ export declare function isUnauthorizedProviderError(err: unknown, depth?: number): boolean;
19
+ /**
20
+ * Wrap a Coinbase provider so any signing RPC that fails with `4100` triggers a
21
+ * one-shot recovery: a single `eth_requestAccounts` re-authorization, an active-
22
+ * chain re-assert for state-changing calls, then exactly one retry.
23
+ *
24
+ * - Non-`4100` failures pass through untouched (no re-auth attempt).
25
+ * - A rejected re-auth prompt propagates and classifies as a user rejection.
26
+ * - A still-unauthorized retry fails once (no loop) — the recovery calls the raw
27
+ * provider, never the wrapper, so it cannot recurse.
28
+ *
29
+ * Non-`request` members are delegated to the raw provider bound to the raw
30
+ * instance, so private class fields and EIP-1193 event emitters keep working.
31
+ * The wrapper is cached per raw instance so repeated `setProvider` calls with
32
+ * the same provider return a stable reference (no consumer identity churn).
33
+ */
34
+ export declare function withCoinbaseReauth<T extends object>(provider: T): T;
35
+ /**
36
+ * Apply {@link withCoinbaseReauth} to an eip155 Coinbase provider, returning
37
+ * every other provider untouched. This is the single decision the provider
38
+ * registration seam (`syncProvider`) needs — keeping the guard here (keyed on
39
+ * the reliable connector id) rather than in the state setter.
40
+ */
41
+ export declare function maybeWrapCoinbaseProvider<T>(params: {
42
+ connectorId: string | undefined;
43
+ chainNamespace: ChainNamespace | undefined;
44
+ provider: T;
45
+ }): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reown/appkit-controllers",
3
- "version": "1.8.23-prefer-universal-fix.0",
3
+ "version": "1.8.23",
4
4
  "sideEffects": false,
5
5
  "type": "module",
6
6
  "main": "./dist/esm/exports/index.js",
@@ -56,8 +56,8 @@
56
56
  "@walletconnect/universal-provider": "2.23.7",
57
57
  "valtio": "2.1.7",
58
58
  "viem": ">=2.45.0",
59
- "@reown/appkit-common": "1.8.23-prefer-universal-fix.0",
60
- "@reown/appkit-wallet": "1.8.23-prefer-universal-fix.0"
59
+ "@reown/appkit-common": "1.8.23",
60
+ "@reown/appkit-wallet": "1.8.23"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@vitest/coverage-v8": "2.1.9",