thirdweb 5.79.0 → 5.80.0-nightly-3d6e2a2b8bcec1c11de51c218a39cb1116dd7f22-20241220000331
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/contract/contract.js +10 -0
- package/dist/cjs/contract/contract.js.map +1 -1
- package/dist/cjs/contract/deployment/utils/create-2-factory.js +29 -3
- package/dist/cjs/contract/deployment/utils/create-2-factory.js.map +1 -1
- package/dist/cjs/gas/fee-data.js +1 -0
- package/dist/cjs/gas/fee-data.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +3 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js +2 -4
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/in-app.js +44 -12
- package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/esm/contract/contract.js +10 -0
- package/dist/esm/contract/contract.js.map +1 -1
- package/dist/esm/contract/deployment/utils/create-2-factory.js +29 -3
- package/dist/esm/contract/deployment/utils/create-2-factory.js.map +1 -1
- package/dist/esm/gas/fee-data.js +1 -0
- package/dist/esm/gas/fee-data.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +3 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js +2 -4
- package/dist/esm/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/web/in-app.js +44 -12
- package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/types/contract/contract.d.ts.map +1 -1
- package/dist/types/contract/deployment/utils/create-2-factory.d.ts.map +1 -1
- package/dist/types/gas/fee-data.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +11 -0
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ManageWalletScreen.d.ts +2 -0
- 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/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/in-app.d.ts +44 -12
- package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/contract/contract.ts +16 -0
- package/src/contract/deployment/utils/create-2-factory.test.ts +44 -0
- package/src/contract/deployment/utils/create-2-factory.ts +39 -4
- package/src/gas/fee-data.ts +1 -0
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +12 -0
- package/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.test.tsx +28 -11
- package/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.tsx +6 -1
- package/src/react/web/ui/ConnectWallet/screens/ManageWalletScreen.test.tsx +64 -0
- package/src/react/web/ui/ConnectWallet/screens/ManageWalletScreen.tsx +5 -5
- package/src/version.ts +1 -1
- package/src/wallets/in-app/web/in-app.ts +44 -12
- package/src/wallets/smart/smart-wallet-dev.test.ts +2 -1
@@ -0,0 +1,64 @@
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
2
|
+
import { render, screen } from "../../../../../../test/src/react-render.js";
|
3
|
+
import { TEST_CLIENT } from "../../../../../../test/src/test-clients.js";
|
4
|
+
import { createWallet } from "../../../../../wallets/create-wallet.js";
|
5
|
+
import { useAdminWallet } from "../../../../core/hooks/wallets/useAdminWallet.js";
|
6
|
+
import en from "../locale/en.js";
|
7
|
+
import { ManageWalletScreen } from "./ManageWalletScreen.js";
|
8
|
+
|
9
|
+
vi.mock("../../../../core/hooks/wallets/useAdminWallet");
|
10
|
+
|
11
|
+
describe("ManageWalletScreen", () => {
|
12
|
+
const mockProps = {
|
13
|
+
onBack: vi.fn(),
|
14
|
+
setScreen: vi.fn(),
|
15
|
+
closeModal: vi.fn(),
|
16
|
+
locale: en,
|
17
|
+
client: TEST_CLIENT,
|
18
|
+
};
|
19
|
+
|
20
|
+
beforeEach(() => {
|
21
|
+
vi.mocked(useAdminWallet).mockReturnValue(createWallet("inApp"));
|
22
|
+
});
|
23
|
+
|
24
|
+
it("should render the modal header with the correct title", () => {
|
25
|
+
render(<ManageWalletScreen {...mockProps} />);
|
26
|
+
expect(screen.getByText(en.manageWallet.title)).toBeInTheDocument();
|
27
|
+
});
|
28
|
+
|
29
|
+
it("should render the linked profiles button if allowLinkingProfiles is true", () => {
|
30
|
+
render(
|
31
|
+
<ManageWalletScreen
|
32
|
+
{...mockProps}
|
33
|
+
manageWallet={{ allowLinkingProfiles: true }}
|
34
|
+
/>,
|
35
|
+
);
|
36
|
+
expect(
|
37
|
+
screen.getByText(en.manageWallet.linkedProfiles),
|
38
|
+
).toBeInTheDocument();
|
39
|
+
});
|
40
|
+
|
41
|
+
it("should not render the linked profiles button if allowLinkingProfiles is false", () => {
|
42
|
+
render(
|
43
|
+
<ManageWalletScreen
|
44
|
+
{...mockProps}
|
45
|
+
manageWallet={{ allowLinkingProfiles: false }}
|
46
|
+
/>,
|
47
|
+
);
|
48
|
+
expect(
|
49
|
+
screen.queryByText(en.manageWallet.linkedProfiles),
|
50
|
+
).not.toBeInTheDocument();
|
51
|
+
});
|
52
|
+
|
53
|
+
it("should default to showing linked profiles button", () => {
|
54
|
+
render(<ManageWalletScreen {...mockProps} />);
|
55
|
+
expect(
|
56
|
+
screen.getByText(en.manageWallet.linkedProfiles),
|
57
|
+
).toBeInTheDocument();
|
58
|
+
});
|
59
|
+
|
60
|
+
it("should render the wallet connect receiver button", () => {
|
61
|
+
render(<ManageWalletScreen {...mockProps} />);
|
62
|
+
expect(screen.getByText(en.manageWallet.connectAnApp)).toBeInTheDocument();
|
63
|
+
});
|
64
|
+
});
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use client";
|
2
2
|
import { ShuffleIcon } from "@radix-ui/react-icons";
|
3
3
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
4
|
-
import { isEcosystemWallet } from "../../../../../wallets/ecosystem/is-ecosystem-wallet.js";
|
5
4
|
import { isInAppWallet } from "../../../../../wallets/in-app/core/wallet/index.js";
|
6
5
|
import { injectedProvider } from "../../../../../wallets/injected/mipdStore.js";
|
7
6
|
import { fontSize, iconSize } from "../../../../core/design-system/index.js";
|
7
|
+
import type { ConnectButton_detailsModalOptions } from "../../../../core/hooks/connection/ConnectButtonProps.js";
|
8
8
|
import { useActiveWallet } from "../../../../core/hooks/wallets/useActiveWallet.js";
|
9
9
|
import { useAdminWallet } from "../../../../core/hooks/wallets/useAdminWallet.js";
|
10
10
|
import { Spacer } from "../../components/Spacer.js";
|
@@ -26,6 +26,7 @@ export function ManageWalletScreen(props: {
|
|
26
26
|
closeModal: () => void;
|
27
27
|
locale: ConnectLocale;
|
28
28
|
client: ThirdwebClient;
|
29
|
+
manageWallet?: ConnectButton_detailsModalOptions["manageWallet"];
|
29
30
|
}) {
|
30
31
|
const activeWallet = useAdminWallet();
|
31
32
|
|
@@ -57,10 +58,9 @@ export function ManageWalletScreen(props: {
|
|
57
58
|
connectLocale={props.locale}
|
58
59
|
/>
|
59
60
|
|
60
|
-
{/*
|
61
|
-
{activeWallet &&
|
62
|
-
|
63
|
-
isEcosystemWallet(activeWallet)) && (
|
61
|
+
{/* Unified Identity */}
|
62
|
+
{typeof activeWallet !== "undefined" &&
|
63
|
+
props.manageWallet?.allowLinkingProfiles !== false && (
|
64
64
|
<MenuButton
|
65
65
|
onClick={() => {
|
66
66
|
props.setScreen("linked-profiles");
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.
|
1
|
+
export const version = "5.80.0-nightly-3d6e2a2b8bcec1c11de51c218a39cb1116dd7f22-20241220000331";
|
@@ -29,6 +29,26 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
|
|
29
29
|
*
|
30
30
|
* [View all available social auth methods](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure)
|
31
31
|
*
|
32
|
+
* ### Enable smart accounts and sponsor gas for your users:
|
33
|
+
*
|
34
|
+
* ```ts
|
35
|
+
* import { inAppWallet } from "thirdweb/wallets";
|
36
|
+
* import { sepolia } from "thirdweb/chains";
|
37
|
+
*
|
38
|
+
* const wallet = inAppWallet({
|
39
|
+
* smartAccount: {
|
40
|
+
* chain: sepolia,
|
41
|
+
* sponsorGas: true,
|
42
|
+
* },
|
43
|
+
* });
|
44
|
+
*
|
45
|
+
* // account will be a smart account with sponsored gas enabled
|
46
|
+
* const account = await wallet.connect({
|
47
|
+
* client,
|
48
|
+
* strategy: "google",
|
49
|
+
* });
|
50
|
+
* ```
|
51
|
+
*
|
32
52
|
* ### Login with email
|
33
53
|
*
|
34
54
|
* ```ts
|
@@ -107,27 +127,38 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
|
|
107
127
|
* });
|
108
128
|
* ```
|
109
129
|
*
|
110
|
-
* ###
|
111
|
-
*
|
130
|
+
* ### Connect to a guest account
|
112
131
|
* ```ts
|
113
132
|
* import { inAppWallet } from "thirdweb/wallets";
|
114
|
-
* import { sepolia } from "thirdweb/chains";
|
115
133
|
*
|
116
|
-
* const wallet = inAppWallet(
|
117
|
-
*
|
118
|
-
*
|
119
|
-
*
|
120
|
-
*
|
134
|
+
* const wallet = inAppWallet();
|
135
|
+
*
|
136
|
+
* const account = await wallet.connect({
|
137
|
+
* client,
|
138
|
+
* strategy: "guest",
|
121
139
|
* });
|
140
|
+
* ```
|
141
|
+
*
|
142
|
+
* ### Connect with custom JWT (any OIDC provider)
|
143
|
+
*
|
144
|
+
* You can use any OIDC provider to authenticate your users. Make sure to configure it in your dashboard under in-app wallet settings.
|
145
|
+
*
|
146
|
+
* ```ts
|
147
|
+
* import { inAppWallet } from "thirdweb/wallets";
|
148
|
+
*
|
149
|
+
* const wallet = inAppWallet();
|
122
150
|
*
|
123
|
-
* // account will be a smart account with sponsored gas enabled
|
124
151
|
* const account = await wallet.connect({
|
125
152
|
* client,
|
126
|
-
* strategy: "
|
153
|
+
* strategy: "jwt",
|
154
|
+
* jwt: "your_jwt_here",
|
127
155
|
* });
|
128
156
|
* ```
|
129
157
|
*
|
130
|
-
* ### Connect
|
158
|
+
* ### Connect with custom endpoint
|
159
|
+
*
|
160
|
+
* You can also use your own endpoint to authenticate your users. Make sure to configure it in your dashboard under in-app wallet settings.
|
161
|
+
*
|
131
162
|
* ```ts
|
132
163
|
* import { inAppWallet } from "thirdweb/wallets";
|
133
164
|
*
|
@@ -135,7 +166,8 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
|
|
135
166
|
*
|
136
167
|
* const account = await wallet.connect({
|
137
168
|
* client,
|
138
|
-
* strategy: "
|
169
|
+
* strategy: "auth_endpoint",
|
170
|
+
* payload: "your_auth_payload_here",
|
139
171
|
* });
|
140
172
|
* ```
|
141
173
|
*
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
2
|
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
3
|
-
import { arbitrumSepolia } from "../../chains/chain-definitions/arbitrum.js";
|
3
|
+
import { arbitrumSepolia } from "../../chains/chain-definitions/arbitrum-sepolia.js";
|
4
4
|
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
|
5
5
|
import { balanceOf } from "../../extensions/erc1155/__generated__/IERC1155/read/balanceOf.js";
|
6
6
|
import { claimTo } from "../../extensions/erc1155/drops/write/claimTo.js";
|
@@ -14,6 +14,7 @@ import type { Account, Wallet } from "../interfaces/wallet.js";
|
|
14
14
|
import { generateAccount } from "../utils/generateAccount.js";
|
15
15
|
import { smartWallet } from "./smart-wallet.js";
|
16
16
|
let wallet: Wallet;
|
17
|
+
|
17
18
|
let smartAccount: Account;
|
18
19
|
let smartWalletAddress: Address;
|
19
20
|
let personalAccount: Account;
|