thirdweb 5.58.0 → 5.58.1
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/cjs/react/core/hooks/others/useProfiles.js +2 -1
- package/dist/cjs/react/core/hooks/others/useProfiles.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js +11 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js +4 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js +6 -5
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/linkAccount.js +14 -13
- package/dist/cjs/wallets/in-app/core/authentication/linkAccount.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/ecosystem-core.js +27 -12
- package/dist/cjs/wallets/in-app/core/wallet/ecosystem-core.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/profiles.js +3 -2
- package/dist/cjs/wallets/in-app/core/wallet/profiles.js.map +1 -1
- package/dist/esm/react/core/hooks/others/useProfiles.js +2 -1
- package/dist/esm/react/core/hooks/others/useProfiles.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js +11 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js +4 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js +6 -5
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/core/authentication/linkAccount.js +14 -13
- package/dist/esm/wallets/in-app/core/authentication/linkAccount.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/ecosystem-core.js +27 -12
- package/dist/esm/wallets/in-app/core/wallet/ecosystem-core.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/profiles.js +3 -2
- package/dist/esm/wallets/in-app/core/wallet/profiles.js.map +1 -1
- package/dist/types/react/core/hooks/others/useProfiles.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/LinkProfileScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ManageWalletScreen.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/linkAccount.d.ts +5 -2
- package/dist/types/wallets/in-app/core/authentication/linkAccount.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/ecosystem-core.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/profiles.d.ts +3 -2
- package/dist/types/wallets/in-app/core/wallet/profiles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/react/core/hooks/others/useProfiles.ts +2 -1
- package/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx +27 -0
- package/src/react/web/ui/ConnectWallet/screens/ManageWalletScreen.tsx +18 -15
- package/src/react/web/wallets/ecosystem/EcosystemWalletConnectUI.tsx +6 -6
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +1 -1
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/authentication/linkAccount.ts +17 -14
- package/src/wallets/in-app/core/wallet/ecosystem-core.ts +47 -13
- package/src/wallets/in-app/core/wallet/profiles.ts +6 -4
- package/dist/cjs/react/web/wallets/in-app/LinkButton.js +0 -23
- package/dist/cjs/react/web/wallets/in-app/LinkButton.js.map +0 -1
- package/dist/esm/react/web/wallets/in-app/LinkButton.js +0 -20
- package/dist/esm/react/web/wallets/in-app/LinkButton.js.map +0 -1
- package/dist/types/react/web/wallets/in-app/LinkButton.d.ts +0 -5
- package/dist/types/react/web/wallets/in-app/LinkButton.d.ts.map +0 -1
- package/src/react/web/wallets/in-app/LinkButton.tsx +0 -20
@@ -8,6 +8,16 @@ import type {
|
|
8
8
|
CreateWalletArgs,
|
9
9
|
EcosystemWalletId,
|
10
10
|
} from "../../../wallet-types.js";
|
11
|
+
import type { Ecosystem } from "../../web/types.js";
|
12
|
+
import {
|
13
|
+
getLinkedProfilesInternal,
|
14
|
+
linkAccount as linkProfileWithToken,
|
15
|
+
} from "../authentication/linkAccount.js";
|
16
|
+
import type {
|
17
|
+
MultiStepAuthArgsType,
|
18
|
+
Profile,
|
19
|
+
SingleStepAuthArgsType,
|
20
|
+
} from "../authentication/types.js";
|
11
21
|
import type { InAppConnector } from "../interfaces/connector.js";
|
12
22
|
import { getOrCreateInAppWalletConnector } from "./in-app-core.js";
|
13
23
|
|
@@ -25,6 +35,10 @@ export function createEcosystemWallet(args: {
|
|
25
35
|
let account: Account | undefined = undefined;
|
26
36
|
let chain: Chain | undefined = undefined;
|
27
37
|
let client: ThirdwebClient | undefined;
|
38
|
+
const ecosystem: Ecosystem = {
|
39
|
+
id,
|
40
|
+
partnerId: createOptions?.partnerId,
|
41
|
+
};
|
28
42
|
|
29
43
|
return {
|
30
44
|
id,
|
@@ -38,7 +52,13 @@ export function createEcosystemWallet(args: {
|
|
38
52
|
return chain;
|
39
53
|
},
|
40
54
|
getConfig: () => createOptions,
|
55
|
+
getProfiles: async () => {
|
56
|
+
if (!client) {
|
57
|
+
return [];
|
58
|
+
}
|
41
59
|
|
60
|
+
return getLinkedProfilesInternal({ client, ecosystem });
|
61
|
+
},
|
42
62
|
getAccount: () => account,
|
43
63
|
autoConnect: async (options) => {
|
44
64
|
const { autoConnectInAppWallet } = await import("./index.js");
|
@@ -46,10 +66,7 @@ export function createEcosystemWallet(args: {
|
|
46
66
|
const connector = await getOrCreateInAppWalletConnector(
|
47
67
|
options.client,
|
48
68
|
connectorFactory,
|
49
|
-
|
50
|
-
id,
|
51
|
-
partnerId: createOptions?.partnerId,
|
52
|
-
},
|
69
|
+
ecosystem,
|
53
70
|
);
|
54
71
|
|
55
72
|
const [connectedAccount, connectedChain] = await autoConnectInAppWallet(
|
@@ -75,10 +92,7 @@ export function createEcosystemWallet(args: {
|
|
75
92
|
const connector = await getOrCreateInAppWalletConnector(
|
76
93
|
options.client,
|
77
94
|
connectorFactory,
|
78
|
-
|
79
|
-
id,
|
80
|
-
partnerId: createOptions?.partnerId,
|
81
|
-
},
|
95
|
+
ecosystem,
|
82
96
|
);
|
83
97
|
|
84
98
|
const [connectedAccount, connectedChain] = await connectInAppWallet(
|
@@ -104,10 +118,7 @@ export function createEcosystemWallet(args: {
|
|
104
118
|
const connector = await getOrCreateInAppWalletConnector(
|
105
119
|
client,
|
106
120
|
connectorFactory,
|
107
|
-
|
108
|
-
id,
|
109
|
-
partnerId: createOptions?.partnerId,
|
110
|
-
},
|
121
|
+
ecosystem,
|
111
122
|
);
|
112
123
|
const result = await connector.logout();
|
113
124
|
if (!result.success) {
|
@@ -122,5 +133,28 @@ export function createEcosystemWallet(args: {
|
|
122
133
|
chain = newChain;
|
123
134
|
emitter.emit("chainChanged", newChain);
|
124
135
|
},
|
125
|
-
|
136
|
+
// This is not included on the global interface but is force-resolved in linkProfile
|
137
|
+
linkProfile: async (
|
138
|
+
options: SingleStepAuthArgsType | MultiStepAuthArgsType,
|
139
|
+
): Promise<Profile[]> => {
|
140
|
+
if (!client) {
|
141
|
+
throw new Error(
|
142
|
+
"No client found, please connect the wallet before linking a profile",
|
143
|
+
);
|
144
|
+
}
|
145
|
+
|
146
|
+
const connector = await getOrCreateInAppWalletConnector(
|
147
|
+
client,
|
148
|
+
connectorFactory,
|
149
|
+
ecosystem,
|
150
|
+
);
|
151
|
+
|
152
|
+
const { storedToken } = await connector.authenticate(options);
|
153
|
+
return await linkProfileWithToken({
|
154
|
+
client,
|
155
|
+
ecosystem,
|
156
|
+
tokenToLink: storedToken.cookieString,
|
157
|
+
});
|
158
|
+
},
|
159
|
+
} as Wallet<EcosystemWalletId>;
|
126
160
|
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wallet.js";
|
2
|
+
import type { EcosystemWalletId } from "../../../../wallets/wallet-types.js";
|
1
3
|
import type { Wallet } from "../../../interfaces/wallet.js";
|
2
4
|
import type {
|
3
5
|
MultiStepAuthArgsType,
|
@@ -25,8 +27,8 @@ import type {
|
|
25
27
|
* ```
|
26
28
|
* @wallet
|
27
29
|
*/
|
28
|
-
export async function getProfiles(wallet: Wallet<"inApp">) {
|
29
|
-
if (wallet.id !== "inApp") {
|
30
|
+
export async function getProfiles(wallet: Wallet<"inApp" | EcosystemWalletId>) {
|
31
|
+
if (wallet.id !== "inApp" && !isEcosystemWallet(wallet)) {
|
30
32
|
throw new Error("Multi-auth currently only supports in-app wallets");
|
31
33
|
}
|
32
34
|
|
@@ -59,10 +61,10 @@ export async function getProfiles(wallet: Wallet<"inApp">) {
|
|
59
61
|
* @wallet
|
60
62
|
*/
|
61
63
|
export async function linkProfile(
|
62
|
-
wallet: Wallet<"inApp">,
|
64
|
+
wallet: Wallet<"inApp" | EcosystemWalletId>,
|
63
65
|
auth: MultiStepAuthArgsType | SingleStepAuthArgsType,
|
64
66
|
): Promise<Profile[]> {
|
65
|
-
if (wallet.id !== "inApp") {
|
67
|
+
if (wallet.id !== "inApp" && !isEcosystemWallet(wallet)) {
|
66
68
|
throw new Error("Multi-auth currently only supports in-app wallets");
|
67
69
|
}
|
68
70
|
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
"use client";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.LinkButton = void 0;
|
5
|
-
const CustomThemeProvider_js_1 = require("../../../core/design-system/CustomThemeProvider.js");
|
6
|
-
const index_js_1 = require("../../../core/design-system/index.js");
|
7
|
-
const elements_js_1 = require("../../ui/design-system/elements.js");
|
8
|
-
exports.LinkButton = (0, elements_js_1.StyledButton)((_) => {
|
9
|
-
const theme = (0, CustomThemeProvider_js_1.useCustomTheme)();
|
10
|
-
return {
|
11
|
-
all: "unset",
|
12
|
-
color: theme.colors.accentText,
|
13
|
-
fontSize: index_js_1.fontSize.sm,
|
14
|
-
cursor: "pointer",
|
15
|
-
textAlign: "center",
|
16
|
-
fontWeight: 500,
|
17
|
-
width: "100%",
|
18
|
-
"&:hover": {
|
19
|
-
color: theme.colors.primaryText,
|
20
|
-
},
|
21
|
-
};
|
22
|
-
});
|
23
|
-
//# sourceMappingURL=LinkButton.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"LinkButton.js","sourceRoot":"","sources":["../../../../../../src/react/web/wallets/in-app/LinkButton.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,+FAAoF;AACpF,mEAAgE;AAChE,oEAAkE;AAErD,QAAA,UAAU,GAAmB,IAAA,0BAAY,EAAC,CAAC,CAAC,EAAE,EAAE;IAC3D,MAAM,KAAK,GAAG,IAAA,uCAAc,GAAE,CAAC;IAC/B,OAAO;QACL,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU;QAC9B,QAAQ,EAAE,mBAAQ,CAAC,EAAE;QACrB,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,GAAG;QACf,KAAK,EAAE,MAAM;QACb,SAAS,EAAE;YACT,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW;SAChC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js";
|
3
|
-
import { fontSize } from "../../../core/design-system/index.js";
|
4
|
-
import { StyledButton } from "../../ui/design-system/elements.js";
|
5
|
-
export const LinkButton = /* @__PURE__ */ StyledButton((_) => {
|
6
|
-
const theme = useCustomTheme();
|
7
|
-
return {
|
8
|
-
all: "unset",
|
9
|
-
color: theme.colors.accentText,
|
10
|
-
fontSize: fontSize.sm,
|
11
|
-
cursor: "pointer",
|
12
|
-
textAlign: "center",
|
13
|
-
fontWeight: 500,
|
14
|
-
width: "100%",
|
15
|
-
"&:hover": {
|
16
|
-
color: theme.colors.primaryText,
|
17
|
-
},
|
18
|
-
};
|
19
|
-
});
|
20
|
-
//# sourceMappingURL=LinkButton.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"LinkButton.js","sourceRoot":"","sources":["../../../../../../src/react/web/wallets/in-app/LinkButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE;IAC3D,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAC/B,OAAO;QACL,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU;QAC9B,QAAQ,EAAE,QAAQ,CAAC,EAAE;QACrB,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,GAAG;QACf,KAAK,EAAE,MAAM;QACb,SAAS,EAAE;YACT,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW;SAChC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
export declare const LinkButton: import("@emotion/styled").StyledComponent<{
|
2
|
-
theme?: import("@emotion/react").Theme;
|
3
|
-
as?: React.ElementType;
|
4
|
-
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
5
|
-
//# sourceMappingURL=LinkButton.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"LinkButton.d.ts","sourceRoot":"","sources":["../../../../../../src/react/web/wallets/in-app/LinkButton.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;SAeW,MAAO,WAAW;qHADlD,CAAC"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js";
|
3
|
-
import { fontSize } from "../../../core/design-system/index.js";
|
4
|
-
import { StyledButton } from "../../ui/design-system/elements.js";
|
5
|
-
|
6
|
-
export const LinkButton = /* @__PURE__ */ StyledButton((_) => {
|
7
|
-
const theme = useCustomTheme();
|
8
|
-
return {
|
9
|
-
all: "unset",
|
10
|
-
color: theme.colors.accentText,
|
11
|
-
fontSize: fontSize.sm,
|
12
|
-
cursor: "pointer",
|
13
|
-
textAlign: "center",
|
14
|
-
fontWeight: 500,
|
15
|
-
width: "100%",
|
16
|
-
"&:hover": {
|
17
|
-
color: theme.colors.primaryText,
|
18
|
-
},
|
19
|
-
};
|
20
|
-
});
|