@aptos-labs/wallet-adapter-react 7.2.9-xchaininit3.0 → 7.2.9-xchaininit3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-labs/wallet-adapter-react",
3
- "version": "7.2.9-xchaininit3.0",
3
+ "version": "7.2.9-xchaininit3.2",
4
4
  "description": "Aptos Wallet Adapter React Provider",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -35,12 +35,12 @@
35
35
  "tsup": "^8.4.0",
36
36
  "typescript": "^5.8.3",
37
37
  "@aptos-labs/wallet-adapter-tsconfig": "0.0.2",
38
- "@aptos-labs/derived-wallet-solana": "^0.9.1",
39
- "@aptos-labs/derived-wallet-ethereum": "^0.8.4"
38
+ "@aptos-labs/derived-wallet-ethereum": "^0.8.4",
39
+ "@aptos-labs/derived-wallet-solana": "^0.9.1"
40
40
  },
41
41
  "dependencies": {
42
42
  "@radix-ui/react-slot": "^1.0.2",
43
- "@aptos-labs/wallet-adapter-core": "7.10.3-xchaininit3.0"
43
+ "@aptos-labs/wallet-adapter-core": "7.10.3-xchaininit3.2"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": "^18.0.0 || ^19.0.0",
@@ -151,25 +151,37 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
151
151
  // If it's safe to call multiple times, this is fine.
152
152
  // Usually, these setup functions are idempotent or replace previous listeners.
153
153
  if (!derivationInitialized.current) {
154
+ // Use a wrapper function to prevent bundlers from statically analyzing the import
155
+ const dynamicImport = (moduleName: string) =>
156
+ new Function("m", "return import(m)")(moduleName) as Promise<any>;
157
+
154
158
  if (dappConfig?.crossChainWallets?.solana) {
155
- const solanaModule = "@aptos-labs/derived-wallet-solana";
156
- import(solanaModule).then(
157
- ({ setupAutomaticSolanaWalletDerivation }) => {
159
+ dynamicImport("@aptos-labs/derived-wallet-solana")
160
+ .then(({ setupAutomaticSolanaWalletDerivation }) => {
158
161
  setupAutomaticSolanaWalletDerivation({
159
162
  defaultNetwork: dappConfig?.network,
160
163
  });
161
- }
162
- );
164
+ })
165
+ .catch(() => {
166
+ console.warn(
167
+ "Cross-chain Solana support enabled but @aptos-labs/derived-wallet-solana is not installed. " +
168
+ "Install it with: npm install @aptos-labs/derived-wallet-solana"
169
+ );
170
+ });
163
171
  }
164
172
  if (dappConfig?.crossChainWallets?.evm) {
165
- const ethereumModule = "@aptos-labs/derived-wallet-ethereum";
166
- import(ethereumModule).then(
167
- ({ setupAutomaticEthereumWalletDerivation }) => {
173
+ dynamicImport("@aptos-labs/derived-wallet-ethereum")
174
+ .then(({ setupAutomaticEthereumWalletDerivation }) => {
168
175
  setupAutomaticEthereumWalletDerivation({
169
176
  defaultNetwork: dappConfig?.network,
170
177
  });
171
- }
172
- );
178
+ })
179
+ .catch(() => {
180
+ console.warn(
181
+ "Cross-chain EVM support enabled but @aptos-labs/derived-wallet-ethereum is not installed. " +
182
+ "Install it with: npm install @aptos-labs/derived-wallet-ethereum"
183
+ );
184
+ });
173
185
  }
174
186
  derivationInitialized.current = true;
175
187
  }
package/src/index.tsx CHANGED
@@ -1,6 +1,4 @@
1
1
  export * from "@aptos-labs/wallet-adapter-core";
2
- export * from "@aptos-labs/derived-wallet-solana";
3
- export * from "@aptos-labs/derived-wallet-ethereum";
4
2
  export * from "./WalletProvider";
5
3
  export * from "./components/AboutAptosConnect";
6
4
  export * from "./components/AboutPetraWeb";