@swype-org/react-sdk 0.2.323 → 0.2.357

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.
package/dist/index.d.cts CHANGED
@@ -77,6 +77,21 @@ interface Account {
77
77
  nickname?: string | null;
78
78
  /** Optional display logo URL, e.g. the selected Reown wallet icon. */
79
79
  logoURI?: string;
80
+ /**
81
+ * WalletConnect identity recovered server-side from the account's session
82
+ * configs. Present only for WalletConnect-typed accounts — used to
83
+ * pre-check chain support before any reauthorization session exists (e.g.
84
+ * "Not supported" rows on the deposit-source sheet). `approvedChainIds` is
85
+ * the EIP-155 set the wallet approved at its most recent pairing — ground
86
+ * truth that overrides a stale Reown registry entry (registry listings lag
87
+ * the chains wallets actually support, e.g. newly launched mainnets).
88
+ */
89
+ walletConnect?: {
90
+ name: string;
91
+ reownWalletId?: string;
92
+ imageUrl?: string;
93
+ approvedChainIds?: number[];
94
+ };
80
95
  wallets: Wallet[];
81
96
  /** Remaining One-Tap allowance in USD, or null when not configured. */
82
97
  remainingAllowance?: number | null;
@@ -993,6 +1008,29 @@ interface ExecuteActionOptions {
993
1008
  sessionId?: string;
994
1009
  /** WalletConnect account/runtime key that owns this action. */
995
1010
  walletConnectRuntimeKey?: string;
1011
+ /**
1012
+ * Chain id the WalletConnect OPEN_PROVIDER pairing must include (e.g. the
1013
+ * reauth target token's chain). Overrides `action.metadata.requiredChainId`.
1014
+ * A session reuse that doesn't approve this chain re-pairs with it required,
1015
+ * and a pairing that comes back without it fails with a clear error instead
1016
+ * of letting SELECT_SOURCE hit the backend's approved-chain validation.
1017
+ */
1018
+ walletConnectRequiredChainId?: number;
1019
+ /**
1020
+ * Human-readable name for `walletConnectRequiredChainId` (e.g. "HyperEVM"),
1021
+ * used in the missing-required-chain error so users see the network name
1022
+ * rather than a bare numeric chain id.
1023
+ */
1024
+ walletConnectRequiredChainLabel?: string;
1025
+ /**
1026
+ * EVM chain ids (from the backend's `/v1/chains`) proposed as optional
1027
+ * namespaces in the WalletConnect pairing, on top of the runtime's
1028
+ * hardcoded fallback. Keeps the proposal in sync with admin-managed source
1029
+ * chains so a supporting wallet can approve them — chains missing from the
1030
+ * proposal can never land in `approvedChainIds` and would be falsely
1031
+ * reported as unsupported. The runtime remembers the list for re-pairs.
1032
+ */
1033
+ walletConnectOptionalChainIds?: number[];
996
1034
  /**
997
1035
  * Forwarded to APPROVE_SPL: invoked once after the Phantom signature is
998
1036
  * returned and before client-side on-chain confirmation begins. The
@@ -1002,6 +1040,16 @@ interface ExecuteActionOptions {
1002
1040
  onApproveSplConfirming?: (action: AuthorizationAction) => void;
1003
1041
  /** Emits the WalletConnect pairing URI so UI can render a QR/deeplink while connect is pending. */
1004
1042
  onWalletConnectDisplayUri?: (uri: string) => void;
1043
+ /**
1044
+ * Mobile only: foreground the ALREADY-CONNECTED WalletConnect wallet so the
1045
+ * pending signing prompt surfaces, WITHOUT re-pairing. Fired immediately
1046
+ * before each WC signing RPC (APPROVE_PERMIT2 / SIGN_PERMIT2 / EXECUTE_BRIDGE).
1047
+ * The executor has no wallet-deeplink metadata, so the caller supplies this
1048
+ * side-effect (e.g. `triggerDeeplink('rainbow://')`). No-op on desktop, where
1049
+ * the caller passes `undefined` (signing happens in the same paired wallet /
1050
+ * extension and a QR is shown for cross-device).
1051
+ */
1052
+ onWalletConnectForegroundWallet?: () => void;
1005
1053
  /**
1006
1054
  * Optional Promise resolved by an external (non-WC) connection that races the
1007
1055
  * WalletConnect pairing for `OPEN_PROVIDER`. Currently used by
@@ -1055,6 +1103,7 @@ interface UseAuthorizationExecutorResult {
1055
1103
  paymasterUrl?: string;
1056
1104
  walletConnectRuntimeKey?: string;
1057
1105
  onWalletConnectDisplayUri?: (uri: string) => void;
1106
+ onWalletConnectForegroundWallet?: () => void;
1058
1107
  }) => Promise<BatchedWalletCallsResult>;
1059
1108
  /** Refresh wallet capabilities and return whether atomicBatch is supported. */
1060
1109
  canBatch: () => Promise<boolean>;
@@ -1178,6 +1227,51 @@ interface OrchestratorRunOptions {
1178
1227
  onApproveSplConfirming?: (action: AuthorizationAction) => void;
1179
1228
  /** Emits the direct WalletConnect pairing URI while OPEN_PROVIDER is connecting. */
1180
1229
  onWalletConnectDisplayUri?: (uri: string) => void;
1230
+ /**
1231
+ * Mobile only: foreground the ALREADY-CONNECTED WalletConnect wallet before
1232
+ * each signing prompt (APPROVE_PERMIT2 / SIGN_PERMIT2 / EXECUTE_BRIDGE) via a
1233
+ * bare deeplink — over the live session, NOT a re-pair. Supplied by
1234
+ * `handleSelectWalletConnectWallet` / the reauth handlers, which hold the
1235
+ * wallet's deeplink metadata. Omitted on desktop (QR + same-wallet signing).
1236
+ */
1237
+ onWalletConnectForegroundWallet?: () => void;
1238
+ /**
1239
+ * Pins ONE WalletConnect runtime key for the entire run, overriding the
1240
+ * per-action resolution (`action.metadata.walletConnectAccountId` / tracked
1241
+ * `session.accountId`). Supplied by the handler that performed the pairing
1242
+ * (it knows the client `accountId` it paired under). Guarantees pairing
1243
+ * (OPEN_PROVIDER) and signing (APPROVE_PERMIT2 / SIGN_PERMIT2 / EXECUTE_BRIDGE)
1244
+ * use the SAME module-level runtime Map entry — closing the gap where
1245
+ * `session.accountId` is null at OPEN_PROVIDER but non-null by APPROVE_PERMIT2,
1246
+ * which otherwise makes signing look up a fresh, unpaired runtime and re-pair
1247
+ * (a second QR / connection approval).
1248
+ */
1249
+ walletConnectRuntimeKey?: string;
1250
+ /**
1251
+ * Chain id the WalletConnect OPEN_PROVIDER pairing must include — the
1252
+ * reauth target token's chain, supplied by the token-authorization
1253
+ * handlers. Overrides `action.metadata.requiredChainId` so the SDK can
1254
+ * require the right chain even when the backend didn't stamp it. A
1255
+ * session that doesn't approve this chain re-pairs with it required; a
1256
+ * pairing that still comes back without it fails OPEN_PROVIDER with a
1257
+ * clear error instead of crashing SELECT_SOURCE auto-resolve on the
1258
+ * backend's approved-chain validation (422 INVALID_SELECT_SOURCE_SELECTION).
1259
+ */
1260
+ walletConnectRequiredChainId?: number;
1261
+ /**
1262
+ * EVM chain ids from the backend's `/v1/chains`, proposed as optional
1263
+ * namespaces at the WalletConnect pairing on top of the runtime's hardcoded
1264
+ * fallback. Source chains are admin-managed server-side, so deriving the
1265
+ * proposal from this list keeps newly-enabled chains approvable without an
1266
+ * SDK release — a chain absent from the proposal can never be approved and
1267
+ * would surface as a false "Not supported" row.
1268
+ */
1269
+ walletConnectOptionalChainIds?: number[];
1270
+ /**
1271
+ * Human-readable name for `walletConnectRequiredChainId` (e.g. "HyperEVM"),
1272
+ * surfaced in the missing-required-chain error instead of a bare chain id.
1273
+ */
1274
+ walletConnectRequiredChainName?: string;
1181
1275
  /**
1182
1276
  * Optional Promise that races the WalletConnect pairing for OPEN_PROVIDER.
1183
1277
  * Used by `handleSelectWalletConnectWallet` when the picked Reown wallet is
@@ -1220,6 +1314,18 @@ interface UseAuthorizationOrchestratorResult {
1220
1314
  pendingSelectSourceAction: AuthorizationAction | null;
1221
1315
  /** Complete the pending SELECT_SOURCE action with a chosen source. */
1222
1316
  resolveSelectSource: (selection: SourceSelection) => void;
1317
+ /**
1318
+ * True once an INTERACTIVE SELECT_SOURCE has been resolved during the
1319
+ * current run (i.e. the user picked a token on LinkTokensScreen and tapped
1320
+ * Approve via `resolveSelectSource`). Reset to false at the start of each
1321
+ * `run` and on `cancelPendingFlow`. The `autoResolveSource` path (WC
1322
+ * reauthorization / token authorization) never sets this, because it
1323
+ * resolves SELECT_SOURCE without pausing for the user. Consumed by
1324
+ * StepRenderer to distinguish the post-Approve transient (where the
1325
+ * executor's `currentAction` is still the stale OPEN_PROVIDER from pairing)
1326
+ * from genuine pairing — so OpenWalletScreen doesn't flash after Approve.
1327
+ */
1328
+ sourceSelectionResolved: boolean;
1223
1329
  /** True after the most recent run drained all authorization actions. */
1224
1330
  orchestratorCompleted: boolean;
1225
1331
  /** Cancel any paused setup flow and reject the current orchestrator run. */
@@ -1276,6 +1382,20 @@ interface PreparedTokenAuthorization {
1276
1382
  providerId: string | null;
1277
1383
  providerName: string;
1278
1384
  depositAmount: number;
1385
+ /**
1386
+ * Present when the target account is WalletConnect-typed. There is no
1387
+ * native wallet deeplink for WC, and the auth-app session URI cannot
1388
+ * execute a WalletConnect session (it would strand the user on a loading
1389
+ * LinkTokensScreen) — committing such a prepared authorization must run
1390
+ * the inline WC orchestrator path in this tab instead. `deeplinkUri` is
1391
+ * empty in this case and must not be navigated to.
1392
+ */
1393
+ walletConnect?: {
1394
+ /** Reown metadata recovered from the session's OPEN_PROVIDER action. */
1395
+ metadata: WalletConnectAccountMetadata | null;
1396
+ /** Wallet name used for open-wallet branding and button copy. */
1397
+ displayName: string;
1398
+ };
1279
1399
  }
1280
1400
 
1281
1401
  /** Snapshot for restoring deposit source after cancelling token reauth / increase-limit subflows. */
@@ -1345,6 +1465,13 @@ interface PaymentState {
1345
1465
  providerId: string | null;
1346
1466
  walletName?: string;
1347
1467
  walletLogoUrl?: string;
1468
+ /**
1469
+ * Bare WalletConnect wallet deeplink (no `wc:` pairing URI) used to
1470
+ * FOREGROUND the already-connected wallet for a signing prompt on mobile.
1471
+ * Powers the manual "Open {wallet}" button on `ApprovingInWalletScreen`.
1472
+ * Distinct from `sessionUri` (the pairing QR/deeplink).
1473
+ */
1474
+ walletForegroundLink?: string;
1348
1475
  } | null;
1349
1476
  /**
1350
1477
  * Active authorization session id for the in-progress wallet-setup flow.
@@ -1519,6 +1646,13 @@ interface StepHandlers {
1519
1646
  onFinalizeAmount: () => void;
1520
1647
  onSetDepositToken: (symbol: string, chainName: string, walletId?: string, tokenAddress?: string, chainId?: number) => void;
1521
1648
  onConfirmSetupDeposit: () => void | Promise<void>;
1649
+ /**
1650
+ * Mobile only: foreground the already-connected WalletConnect wallet from the
1651
+ * signing screen's manual "Open {wallet}" button. Opens the bare wallet
1652
+ * deeplink (no `wc:` URI) so the pending Permit2 prompt surfaces without
1653
+ * re-pairing. Undefined on desktop / when no foreground link is available.
1654
+ */
1655
+ onOpenWalletForeground?: () => void;
1522
1656
  }
1523
1657
  /** Flow identity: reducer state, auth, layout. */
1524
1658
  interface StepRendererFlowProps {
@@ -1566,10 +1700,25 @@ interface StepRendererRemoteProps {
1566
1700
  /** True while `executeSessionById` is running (desktop inline wallet steps). */
1567
1701
  authExecutorExecuting: boolean;
1568
1702
  authExecutorCurrentAction?: AuthorizationAction | null;
1703
+ /** True once a run has drained all authorization actions (orchestrator
1704
+ * completed). Stays true through the post-sign settling window — when
1705
+ * `currentAction` is already null — until the next run resets it. Lets the
1706
+ * approving checklist render all items complete instead of reverting to the
1707
+ * default active state while the next screen loads. */
1708
+ authExecutorCompleted: boolean;
1569
1709
  transferSigningSigning: boolean;
1570
1710
  transferSigningError: string | null;
1571
1711
  transferSigningPasskeyDismissed?: boolean;
1572
1712
  pendingSelectSource: AuthorizationAction | null;
1713
+ /**
1714
+ * True once the user interactively resolved a SELECT_SOURCE this run (picked
1715
+ * a token on LinkTokensScreen and tapped Approve). Distinguishes the
1716
+ * post-Approve transient — where the executor's `currentAction` is still the
1717
+ * stale OPEN_PROVIDER from pairing — from genuine pairing, so OpenWalletScreen
1718
+ * is not re-shown after Approve. False during WC reauthorization auto-resolve
1719
+ * pairing, which keeps OpenWalletScreen visible until the wallet pairs.
1720
+ */
1721
+ sourceSelectionResolved: boolean;
1573
1722
  }
1574
1723
  /** Values derived from accounts / selection (plus select-source picker data). */
1575
1724
  interface StepRendererDerivedProps {
@@ -1581,11 +1730,19 @@ interface StepRendererDerivedProps {
1581
1730
  selectedAccount: Account | undefined;
1582
1731
  selectedSource: WalletSource | null;
1583
1732
  selectSourceChoices: SelectSourceChainChoice[];
1733
+ /** Balances on chains the WalletConnect session did not approve — rendered as disabled "Not supported" rows. */
1734
+ selectSourceUnsupportedChoices: SelectSourceChainChoice[];
1584
1735
  selectSourceRecommended: {
1585
1736
  chainName: string;
1586
1737
  tokenSymbol: string;
1587
1738
  } | null;
1588
1739
  selectSourceAvailableBalance: number;
1740
+ /**
1741
+ * Reown registry chain ids per WalletConnect-typed account id (null =
1742
+ * registry has no opinion, fail open). Used to badge requires-auth deposit
1743
+ * sources on chains the backing wallet cannot authorize.
1744
+ */
1745
+ walletConnectChainIdsByAccount: Record<string, number[] | null>;
1589
1746
  }
1590
1747
  /** Ephemeral form UI state. */
1591
1748
  interface StepRendererFormProps {
@@ -1753,8 +1910,25 @@ interface ScreenLayoutProps {
1753
1910
  * surrounding chrome (heading, banners, CTA) stays pinned. Defaults to true.
1754
1911
  */
1755
1912
  scrollableBody?: boolean;
1913
+ /**
1914
+ * When true, the footer floats over the body instead of taking its own band
1915
+ * at the bottom of the sheet. Its background is a gradient that is
1916
+ * transparent across the top half and fades to the solid sheet color for the
1917
+ * bottom half, so the scroll content peeks through above the CTA while the
1918
+ * button itself sits on a solid base. Only the footer's own children are
1919
+ * interactive — the transparent gutter passes taps and scroll through to the
1920
+ * list below. Screens that opt in must reserve bottom padding in their scroll
1921
+ * container so the last row clears the floating footer. Defaults to false.
1922
+ */
1923
+ floatingFooter?: boolean;
1924
+ /**
1925
+ * When true, the body still scrolls but its scrollbar is visually hidden
1926
+ * (overflow behaviour is unchanged). Use for screens that should never show
1927
+ * scrollbar chrome. Defaults to false.
1928
+ */
1929
+ hideScrollbar?: boolean;
1756
1930
  }
1757
- declare function ScreenLayout({ children, footer, scrollableBody }: ScreenLayoutProps): react_jsx_runtime.JSX.Element;
1931
+ declare function ScreenLayout({ children, footer, scrollableBody, floatingFooter, hideScrollbar }: ScreenLayoutProps): react_jsx_runtime.JSX.Element;
1758
1932
 
1759
1933
  interface ScreenHeaderProps {
1760
1934
  /** Center title text */
@@ -1997,13 +2171,18 @@ interface PasskeyScreenProps {
1997
2171
  declare function PasskeyScreen({ onCreatePasskey, onBack, onLogout, creating, error, popupFallback, onCreatePasskeyViaPopup, onCreateNewPasskey, onCreateNewPasskeyViaPopup, createNewPopupFallback, creatingNewPasskey, }: PasskeyScreenProps): react_jsx_runtime.JSX.Element;
1998
2172
 
1999
2173
  interface PasskeyPopupWelcomeScreenProps {
2174
+ /** Begins passkey creation (Privy signup). */
2000
2175
  onCreatePasskey: () => void;
2176
+ /** When set, renders an "or Sign in with passkey" secondary action for users who already have a passkey. */
2177
+ onSignInWithPasskey?: () => void;
2178
+ /** Disables the actions and shows the primary button's loading state. */
2001
2179
  creating?: boolean;
2180
+ /** Error copy shown in a banner below the hero. */
2002
2181
  error?: string | null;
2003
2182
  onBack?: () => void;
2004
2183
  onLogout?: () => void;
2005
2184
  }
2006
- declare function PasskeyPopupWelcomeScreen({ onCreatePasskey, creating, error, onBack, onLogout, }: PasskeyPopupWelcomeScreenProps): react_jsx_runtime.JSX.Element;
2185
+ declare function PasskeyPopupWelcomeScreen({ onCreatePasskey, onSignInWithPasskey, creating, error, onBack, onLogout, }: PasskeyPopupWelcomeScreenProps): react_jsx_runtime.JSX.Element;
2007
2186
 
2008
2187
  interface VerifyPasskeyScreenProps {
2009
2188
  onVerify: () => void;
@@ -2072,12 +2251,27 @@ interface SetupTokenOption {
2072
2251
  walletAddress?: string;
2073
2252
  /** Server-provided token logo URI from the catalog. Preferred over the local `TOKEN_LOGOS` map. */
2074
2253
  logoURI?: string | null;
2254
+ /**
2255
+ * WalletConnect-typed account only: the Reown registry says the backing
2256
+ * wallet does not support this token's chain, so authorizing it would
2257
+ * dead-end (the prepare/authorize handlers' pre-filter rejects it).
2258
+ * Rendered as a disabled "Not supported, deposit manually" row. Never set
2259
+ * on AUTHORIZED rows — those deposit via passkey without the wallet.
2260
+ */
2261
+ notSupported?: boolean;
2075
2262
  }
2076
2263
 
2077
2264
  interface LinkTokenEntry {
2078
2265
  tokenSymbol: string;
2079
2266
  chainName: string;
2080
2267
  balanceUsd: number;
2268
+ /**
2269
+ * WalletConnect-only: the connected wallet cannot sign on this token's
2270
+ * chain (missing from both the session's approved chains and the Reown
2271
+ * registry). Renders the "Not supported, deposit manually" pill and makes
2272
+ * the row unselectable.
2273
+ */
2274
+ notSupported?: boolean;
2081
2275
  }
2082
2276
  interface LinkTokensScreenProps {
2083
2277
  entries: LinkTokenEntry[];
@@ -2384,12 +2578,27 @@ interface ApprovingInWalletScreenProps {
2384
2578
  * 'sign' = approval done (this session or previously) → step 1 checked, step 2 active;
2385
2579
  * 'spl' = single Solana delegate approval (one item). */
2386
2580
  step: 'approve' | 'sign' | 'spl';
2581
+ /** When true, every checklist item renders complete (checked). Set during the
2582
+ * post-sign settling window so the checkmarks persist until the next screen
2583
+ * loads, rather than reverting to the active/pending default. `step` still
2584
+ * selects the shape (one SPL item vs. two EVM items). */
2585
+ complete?: boolean;
2387
2586
  error?: string | null;
2388
2587
  onRetry?: () => void;
2389
2588
  /** Desktop-only escape hatch back to the previous screen. */
2390
2589
  onBack?: () => void;
2391
2590
  /** Desktop-only settings/logout action. */
2392
2591
  onLogout?: () => void;
2592
+ /** Mobile WalletConnect: connected wallet name, for the "Open {wallet}" button. */
2593
+ walletName?: string | null;
2594
+ /**
2595
+ * Mobile WalletConnect: bare wallet deeplink (no `wc:` URI) for the manual
2596
+ * "Open {wallet}" button. Foregrounds the already-connected wallet so the
2597
+ * pending signing prompt surfaces — does NOT re-pair. Absent on desktop.
2598
+ */
2599
+ foregroundDeeplink?: string | null;
2600
+ /** Fires when the user taps "Open {wallet}" (opens `foregroundDeeplink`). */
2601
+ onOpenWallet?: () => void;
2393
2602
  }
2394
2603
  /**
2395
2604
  * Activation surface rendered while the user signs the Permit2 / SPL
@@ -2397,7 +2606,7 @@ interface ApprovingInWalletScreenProps {
2397
2606
  * Shares chrome with LinkTokensScreen (header wordmark, h2 heading, recessed
2398
2607
  * card, footer lock banner) so the link → authorize steps read as one page.
2399
2608
  */
2400
- declare function ApprovingInWalletScreen({ tokenSymbol, chainName, step, error, onRetry, onBack, onLogout, }: ApprovingInWalletScreenProps): react_jsx_runtime.JSX.Element;
2609
+ declare function ApprovingInWalletScreen({ tokenSymbol, chainName, step, complete, error, onRetry, onBack, onLogout, walletName, foregroundDeeplink, onOpenWallet, }: ApprovingInWalletScreenProps): react_jsx_runtime.JSX.Element;
2401
2610
 
2402
2611
  interface ConfirmSignScreenProps {
2403
2612
  walletName: string | null;