Skip to content

Commit c2eba49

Browse files
refactor: rename embeddedWallet to inAppWallet (#2697)
Co-authored-by: Jonas Daniels <jonas.daniels@outlook.com>
1 parent 0ebd220 commit c2eba49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+310
-304
lines changed

.changeset/dirty-lies-boil.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": minor
3+
---
4+
5+
Deprecate `embeddedWallet` in favor of `inAppWallet` (same functionality)

packages/thirdweb/scripts/wallets/generate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ const customWalletInfos = [
9595
name: "Smart Wallet",
9696
},
9797
{
98-
id: "embedded",
99-
name: "Embedded Wallet",
98+
id: "inApp",
99+
name: "In-App Wallet",
100100
},
101101
{
102102
id: "walletConnect",
@@ -237,7 +237,7 @@ const walletImports = allSupportedWallets
237237
)
238238
.join("\n");
239239

240-
const customWalletImports = ["smart", "embedded", "walletConnect"]
240+
const customWalletImports = ["smart", "inApp", "walletConnect"]
241241
.map(
242242
(walletId) =>
243243
`case "${walletId}": {

packages/thirdweb/src/exports/wallets.ts

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
export {
22
createWallet,
33
smartWallet,
4-
embeddedWallet,
4+
inAppWallet,
5+
/**
6+
* @deprecated use inAppWallet instead
7+
*/
8+
inAppWallet as embeddedWallet,
59
walletConnect,
610
} from "../wallets/create-wallet.js";
711

@@ -30,7 +34,11 @@ export { injectedProvider } from "../wallets/injected/mipdStore.js";
3034

3135
export type {
3236
WalletId,
33-
EmbeddedWalletCreationOptions,
37+
InAppWalletCreationOptions,
38+
/**
39+
* @deprecated use InAppWalletCreationOptions instead
40+
*/
41+
InAppWalletCreationOptions as EmbeddedWalletCreationOptions,
3442
WalletAutoConnectionOption,
3543
WalletCreationOptions,
3644
WalletConnectionOption,
@@ -53,11 +61,27 @@ export type {
5361
} from "../wallets/smart/types.js";
5462

5563
export type {
56-
EmbeddedWalletAuth,
57-
EmbeddedWalletAutoConnectOptions,
58-
EmbeddedWalletConnectionOptions,
59-
EmbeddedWalletSocialAuth,
60-
} from "../wallets/embedded/core/wallet/index.js";
64+
InAppWalletAuth,
65+
/**
66+
* @deprecated use InAppWalletAuth instead
67+
*/
68+
InAppWalletAuth as EmbeddedWalletAuth,
69+
InAppWalletAutoConnectOptions,
70+
/**
71+
* @deprecated use InAppWalletAutoConnectOptions instead
72+
*/
73+
InAppWalletAutoConnectOptions as EmbeddedWalletAutoConnectOptions,
74+
InAppWalletConnectionOptions,
75+
/**
76+
* @deprecated use InAppWalletConnectionOptions instead
77+
*/
78+
InAppWalletConnectionOptions as EmbeddedWalletConnectionOptions,
79+
InAppWalletSocialAuth,
80+
/**
81+
* @deprecated use InAppWalletSocialAuth instead
82+
*/
83+
InAppWalletSocialAuth as EmbeddedWalletSocialAuth,
84+
} from "../wallets/in-app/core/wallet/index.js";
6185

6286
export type { CoinbaseSDKWalletConnectionOptions } from "../wallets/coinbase/coinbaseSDKWallet.js";
6387

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
export { embeddedWallet } from "../../wallets/create-wallet.js";
1+
export {
2+
inAppWallet,
3+
/**
4+
* @deprecated use inAppWallet instead
5+
*/
6+
inAppWallet as embeddedWallet,
7+
} from "../../wallets/create-wallet.js";
28

39
export {
410
preAuthenticate,
511
authenticate,
612
getUserEmail,
713
type GetAuthenticatedUserParams,
8-
} from "../../wallets/embedded/core/authentication/index.js";
14+
} from "../../wallets/in-app/core/authentication/index.js";
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export { inAppWallet } from "../../wallets/create-wallet.js";
2+
3+
export {
4+
preAuthenticate,
5+
authenticate,
6+
getUserEmail,
7+
type GetAuthenticatedUserParams,
8+
} from "../../wallets/in-app/core/authentication/index.js";

packages/thirdweb/src/exports/wallets/local._ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/thirdweb/src/react/core/hooks/connection/useAutoConnect.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export type AutoConnectProps = {
3333
* @example
3434
* ```tsx
3535
* import { AutoConnect } from "thirdweb/react";
36-
* import { createWallet, embeddedWallet } from "thirdweb/wallets";
36+
* import { createWallet, inAppWallet } from "thirdweb/wallets";
3737
*
3838
* const wallets = [
39-
* embeddedWallet(),
39+
* inAppWallet(),
4040
* createWallet("io.metamask"),
4141
* createWallet("com.coinbase.wallet"),
4242
* createWallet("me.rainbow"),
@@ -129,13 +129,13 @@ export type AutoConnectProps = {
129129
* @example
130130
* ```tsx
131131
* import { AutoConnect } from "thirdweb/react";
132-
* import { createWallet, embeddedWallet } from "thirdweb/wallets";
132+
* import { createWallet, inAppWallet } from "thirdweb/wallets";
133133
*
134134
*
135135
* // list of wallets that your app uses
136136
* const wallets = [
137+
* inAppWallet(),
137138
* createWallet('io.metamask'),
138-
* embeddedWallet(),
139139
* createWallet("me.rainbow"),
140140
* ]
141141
*

packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectWalletProps.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ export type ConnectButtonProps = {
300300
* @example
301301
* ```tsx
302302
* import { AutoConnect } from "thirdweb/react";
303-
* import { createWallet, embeddedWallet } from "thirdweb/wallets";
303+
* import { createWallet, inAppWallet } from "thirdweb/wallets";
304304
*
305305
* const wallets = [
306-
* embeddedWallet(),
306+
* inAppWallet(),
307307
* createWallet("io.metamask"),
308308
* createWallet("com.coinbase.wallet"),
309309
* createWallet("me.rainbow"),
@@ -323,7 +323,7 @@ export type ConnectButtonProps = {
323323
*
324324
* ```tsx
325325
* const defaultWallets = [
326-
* embeddedWallet(),
326+
* inAppWallet(),
327327
* createWallet("io.metamask"),
328328
* createWallet("com.coinbase.wallet"),
329329
* createWallet("me.rainbow"),

packages/thirdweb/src/react/web/ui/ConnectWallet/Details.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,15 @@ import type {
4949
ConnectButton_detailsButtonOptions,
5050
ConnectButton_detailsModalOptions,
5151
} from "./ConnectWalletProps.js";
52-
// import { connectionManager } from "../../../core/connectionManager.js";
5352
import { SendFunds } from "./screens/SendFunds.js";
5453
import { ReceiveFunds } from "./screens/ReceiveFunds.js";
5554
import type { Chain } from "../../../../chains/types.js";
56-
// import type {
57-
// Wallet,
58-
// WalletWithPersonalAccount,
59-
// } from "../../../../wallets/interfaces/wallet.js";
60-
// import {
61-
// // personalAccountToSmartAccountMap,
62-
// smartWalletMetadata,
63-
// } from "../../../../wallets/smart/index._ts";
64-
// import type { EmbeddedWallet } from "../../../../wallets/embedded/core/wallet/index._ts";
65-
// import { localWalletMetadata } from "../../../../wallets/local/index._ts";
66-
// import { ExportLocalWallet } from "./screens/ExportLocalWallet._tsx";
6755
import { swapTransactionsStore } from "./screens/Buy/swap/pendingSwapTx.js";
6856
import { SwapScreen } from "./screens/Buy/SwapScreen.js";
6957
import { SwapTransactionsScreen } from "./screens/SwapTransactionsScreen.js";
7058
import { useWalletConnectionCtx } from "../../../core/hooks/others/useWalletConnectionCtx.js";
7159
import { WalletImage } from "../components/WalletImage.js";
72-
import { getUserEmail } from "../../../../wallets/embedded/core/authentication/index.js";
60+
import { getUserEmail } from "../../../../wallets/in-app/core/authentication/index.js";
7361
import { useQuery } from "@tanstack/react-query";
7462
import { getContract } from "../../../../contract/contract.js";
7563
import { isContractDeployed } from "../../../../utils/bytecode/is-contract-deployed.js";
@@ -324,7 +312,7 @@ export const ConnectedWalletDetails: React.FC<{
324312

325313
<Container px="lg">
326314
<ConnectedToSmartWallet />
327-
<EmbeddedWalletEmail />
315+
<InAppWalletEmail />
328316

329317
{/* Send, Receive, Swap */}
330318
<Container
@@ -815,10 +803,10 @@ function ConnectedToSmartWallet() {
815803
return null;
816804
}
817805

818-
function EmbeddedWalletEmail() {
806+
function InAppWalletEmail() {
819807
const { client } = useWalletConnectionCtx();
820808
const emailQuery = useQuery({
821-
queryKey: ["embedded-wallet-user", client],
809+
queryKey: ["in-app-wallet-user", client],
822810
queryFn: async () => {
823811
const data = await getUserEmail({
824812
client: client,

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import {
2020
const CoinbaseSDKWalletConnectUI = /* @__PURE__ */ lazy(
2121
() => import("../../../wallets/shared/CoinbaseSDKConnection.js"),
2222
);
23-
const EmbeddedWalletConnectUI = /* @__PURE__ */ lazy(
24-
() => import("../../../wallets/embedded/EmbeddedWalletConnectUI.js"),
23+
const InAppWalletConnectUI = /* @__PURE__ */ lazy(
24+
() => import("../../../wallets/in-app/InAppWalletConnectUI.js"),
2525
);
2626

2727
/**
@@ -132,11 +132,11 @@ export function AnyWalletConnectUI(props: {
132132
);
133133
}
134134

135-
if (props.wallet.id === "embedded") {
135+
if (props.wallet.id === "inApp") {
136136
return (
137137
<Suspense fallback={<LoadingScreen />}>
138-
<EmbeddedWalletConnectUI
139-
wallet={props.wallet as Wallet<"embedded">}
138+
<InAppWalletConnectUI
139+
wallet={props.wallet as Wallet<"inApp">}
140140
done={props.done}
141141
goBack={props.onBack}
142142
/>

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ export type ConnectEmbedProps = {
8585
* @example
8686
* ```tsx
8787
* import { AutoConnect } from "thirdweb/react";
88-
* import { createWallet, embeddedWallet } from "thirdweb/wallets";
88+
* import { createWallet, inAppWallet } from "thirdweb/wallets";
8989
*
9090
* const wallets = [
91-
* embeddedWallet(),
91+
* inAppWallet(),
9292
* createWallet("io.metamask"),
9393
* createWallet("com.coinbase.wallet"),
9494
* createWallet("me.rainbow"),
@@ -108,7 +108,7 @@ export type ConnectEmbedProps = {
108108
*
109109
* ```tsx
110110
* const defaultWallets = [
111-
* embeddedWallet(),
111+
* inAppWallet(),
112112
* createWallet("io.metamask"),
113113
* createWallet("com.coinbase.wallet"),
114114
* createWallet("me.rainbow"),

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/screen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
88

99
type Screen = string | Wallet;
1010

11-
const embeddedWalletId = "embedded";
11+
const inAppWalletId = "inApp";
1212

1313
export type ScreenSetup = {
1414
screen: Screen;
@@ -29,7 +29,7 @@ export function useSetupScreen() {
2929

3030
let initialScreen: Screen = reservedScreens.main;
3131

32-
const socialLogin = wallets.find((w) => w.id === embeddedWalletId);
32+
const socialLogin = wallets.find((w) => w.id === inAppWalletId);
3333

3434
if (wallets.length === 1 && wallets[0]) {
3535
initialScreen = wallets[0];

packages/thirdweb/src/react/web/ui/ConnectWallet/WalletSelector.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ import { WalletButton, WalletEntryButton } from "./WalletEntryButton.js";
3636
import { sortWallets } from "../../utils/sortWallets.js";
3737
import { useCustomTheme } from "../design-system/CustomThemeProvider.js";
3838

39-
const EmbeddedWalletSelectionUI = /* @__PURE__ */ lazy(
40-
() => import("../../wallets/embedded/EmbeddedWalletSelectionUI.js"),
39+
const InAppWalletSelectionUI = /* @__PURE__ */ lazy(
40+
() => import("../../wallets/in-app/InAppWalletSelectionUI.js"),
4141
);
4242

4343
// const localWalletId = "local";
44-
const embeddedWalletId: WalletId = "embedded";
44+
const inAppWalletId: WalletId = "inApp";
4545

4646
/**
4747
* @internal
@@ -80,11 +80,11 @@ export const WalletSelector: React.FC<{
8080
const nonLocalWalletConfigs = _wallets; // _wallets.filter((w) => w.id !== localWalletId);
8181

8282
const socialWallets = nonLocalWalletConfigs.filter(
83-
(w) => w.id === embeddedWalletId,
83+
(w) => w.id === inAppWalletId,
8484
);
8585

8686
const eoaWallets = sortWallets(
87-
nonLocalWalletConfigs.filter((w) => w.id !== embeddedWalletId),
87+
nonLocalWalletConfigs.filter((w) => w.id !== inAppWalletId),
8888
recommendedWallets,
8989
);
9090

@@ -517,12 +517,12 @@ const WalletSelection: React.FC<{
517517
key={wallet.id}
518518
// data-full-width={!!walletConfig.selectUI}
519519
>
520-
{wallet.id === "embedded" && modalSize === "compact" ? (
520+
{wallet.id === "inApp" && modalSize === "compact" ? (
521521
<Suspense fallback={<LoadingScreen height="195px" />}>
522-
<EmbeddedWalletSelectionUI
522+
<InAppWalletSelectionUI
523523
done={() => props.done(wallet)}
524524
select={() => props.selectWallet(wallet)}
525-
wallet={wallet as Wallet<"embedded">}
525+
wallet={wallet as Wallet<"inApp">}
526526
goBack={props.goBack}
527527
/>
528528
</Suspense>

packages/thirdweb/src/react/web/utils/sortWallets.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ export function sortWallets<T extends { id: string }>(
3838
}
3939
return 0;
4040
})
41-
// show wallets with select ui first ( currently only embedded )
41+
// show wallets with select ui first ( currently only in-app )
4242
.sort((a, b) => {
43-
const aIsEmbedded = a.id === "embedded";
44-
const bIsEmbedded = b.id === "embedded";
45-
if (aIsEmbedded && !bIsEmbedded) {
43+
const aIsInApp = a.id === "inApp";
44+
const bIsInApp = b.id === "inApp";
45+
if (aIsInApp && !bIsInApp) {
4646
return -1;
4747
}
48-
if (!aIsEmbedded && bIsEmbedded) {
48+
if (!aIsInApp && bIsInApp) {
4949
return 1;
5050
}
5151
return 0;

packages/thirdweb/src/react/web/wallets/defaultWallets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createWallet } from "../../../wallets/create-wallet.js";
66
*/
77
export function getDefaultWallets(): Wallet[] {
88
return [
9-
createWallet("embedded"),
9+
createWallet("inApp"),
1010
createWallet("io.metamask"),
1111
createWallet("com.coinbase.wallet"),
1212
createWallet("me.rainbow"),

0 commit comments

Comments
 (0)