@dynamic-labs-sdk/legacy-embedded-wallet-upgrade

中文文档
1.51.0发布于 2026/11/11TypeScriptESM + CJS近 30 天下载 3394

Helpers to upgrade a user's legacy Dynamic embedded wallets to Dynamic WaaS. Wraps the URL contract, the redirect round-trip, the iframe/WebView completion handshake, and the session refresh behind a small set of functions, so you only call functions — yo

原始使用文档
文档目录7 节
  1. Installation
  2. Detecting wallets that require an upgrade
  3. Redirect path
  4. Iframe path
  5. React Native / custom mounts
  6. React
  7. Multiple clients

@dynamic-labs-sdk/legacy-embedded-wallet-upgrade

Helpers to upgrade a user's legacy Dynamic embedded wallets to Dynamic WaaS. Wraps the URL contract, the redirect round-trip, the iframe/WebView completion handshake, and the session refresh behind a small set of functions, so you only call functions — you never assemble the flow yourself.

The core entry point is framework-agnostic (no React). React hooks live in a separate /react subpath so non-React consumers never load them.

Installation

npm install @dynamic-labs-sdk/legacy-embedded-wallet-upgrade @dynamic-labs-sdk/client

Detecting wallets that require an upgrade

import {
  getWalletsRequiringUpgrade,
  hasWalletsRequiringUpgrade,
} from '@dynamic-labs-sdk/legacy-embedded-wallet-upgrade';

if (hasWalletsRequiringUpgrade()) {
  const wallets = getWalletsRequiringUpgrade();
  // show an upgrade entry point for these wallets
}

Redirect path

Navigate the top-level window to the hosted upgrade app, then handle the result when it returns. The return leg is two steps — detectUpgradeRedirect tells you whether the current URL is a return from the upgrade app, and completeUpgradeRedirect finishes it (refreshing the session on success) — mirroring how OAuth and device registration consume their redirects. You always pass the URL yourself (window.location.href in the browser, the deep-link URL in React Native).

import {
  startUpgradeRedirect,
  detectUpgradeRedirect,
  completeUpgradeRedirect,
} from '@dynamic-labs-sdk/legacy-embedded-wallet-upgrade';

// on the "Upgrade via redirect" button
startUpgradeRedirect();

// once, on app load
if (detectUpgradeRedirect({ url: window.location.href })) {
  const result = await completeUpgradeRedirect({ url: window.location.href });
  if (result?.status === 'error') {
    showErrorToast();
  }
}

Iframe path

The package renders no UI of its own — you own the container (e.g. a bottom sheet). openUpgradeIframe appends the iframe into your container, listens for the origin-checked completion message, refreshes the session on success, and resolves.

import { openUpgradeIframe } from '@dynamic-labs-sdk/legacy-embedded-wallet-upgrade';

const session = openUpgradeIframe({ container: sheetBodyElement });
const { status } = await session.completed;
closeSheet();

// if the user dismisses the sheet first:
session.close();

React Native / custom mounts

Use the DOM-agnostic primitives when you mount the upgrade app yourself (e.g. a React Native WebView):

import {
  buildUpgradeUrl,
  subscribeToUpgradeCompletion,
} from '@dynamic-labs-sdk/legacy-embedded-wallet-upgrade';

const src = buildUpgradeUrl();
const unsubscribe = subscribeToUpgradeCompletion({
  onComplete: ({ status }) => handleOutcome(status),
});

React

React hooks are exported from the /react subpath, with react as an optional peer dependency:

import {
  useWalletsRequiringUpgrade,
  useHasWalletsRequiringUpgrade,
  useUpgradeRedirectResult,
  useUpgradeIframe,
} from '@dynamic-labs-sdk/legacy-embedded-wallet-upgrade/react';

const needsUpgrade = useHasWalletsRequiringUpgrade();

useUpgradeRedirectResult({ onComplete: ({ status }) => handleOutcome(status) });

const { upgradeUrl } = useUpgradeIframe({
  active: isSheetOpen,
  onComplete: ({ status }) => closeSheet(status),
});

Multiple clients

Every function accepts the Dynamic client as an optional second argument and defaults to getDefaultClient(); pass it explicitly only when you use more than one client.

版本与发布记录

@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 共发布 57 个版本,首次发布于 2026/07/22;过去 12 个月发布了 57 个版本。

版本发布日期距今
1.51.0latest2026/11/112 天前
1.50.02026/11/058 天前
1.49.12026/11/0210 天前
1.49.02026/10/3113 天前
1.48.02026/10/3014 天前
1.47.02026/10/2816 天前

关于 @dynamic-labs-sdk/legacy-embedded-wallet-upgrade 的常见问题

@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 是什么?

Helpers to upgrade a user's legacy Dynamic embedded wallets to Dynamic WaaS. Wraps the URL contract, the redirect round-trip, the iframe/WebView completion handshake, and the session refresh behind a small set of functions, so you only call functions — yo

如何安装 @dynamic-labs-sdk/legacy-embedded-wallet-upgrade?

在项目目录运行 npm install @dynamic-labs-sdk/legacy-embedded-wallet-upgrade,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@dynamic-labs-sdk/client(1.51.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 可以商用吗?

@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 的下载量有多少?

根据 npm 官方下载统计,@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 在 2026/10/13 – 2026/11/11 这 30 天内被下载 3,394 次,日均约 113 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dynamic-labs-sdk/legacy-embedded-wallet-upgrade 还在维护吗?

最新版本 1.51.0 发布于 2026/11/11(2 天前);至今共发布 57 个版本,其中过去 12 个月发布了 57 个;首次发布于 2026/07/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。