Skip to content

Commit 47b1bbb

Browse files
feat: enable sign in with wallet for ecosystems (#5153)
1 parent 53e9d8b commit 47b1bbb

File tree

24 files changed

+85
-27
lines changed

24 files changed

+85
-27
lines changed

.changeset/fifty-houses-punch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Enable Sign in with Wallet for ecosystems

apps/dashboard/src/app/(dashboard)/dashboard/connect/ecosystem/[slug]/(active)/components/client/auth-options-form.client.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ export function AuthOptionsForm({ ecosystem }: { ecosystem: Ecosystem }) {
227227
className="h-6 w-6"
228228
/>
229229
<p className="text-center font-normal">
230-
{option.slice(0, 1).toUpperCase() + option.slice(1)}
230+
{option === "siwe"
231+
? "Wallet"
232+
: option.slice(0, 1).toUpperCase() +
233+
option.slice(1)}
231234
</p>
232235
<div className="flex-1" />
233236
<FormControl>

apps/dashboard/src/app/(dashboard)/dashboard/connect/ecosystem/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
export const authOptions = [
22
"email",
33
"phone",
4+
"passkey",
5+
"siwe",
6+
"guest",
47
"google",
58
"facebook",
69
"x",
@@ -12,7 +15,6 @@ export const authOptions = [
1215
"apple",
1316
"coinbase",
1417
"line",
15-
"guest",
1618
] as const;
1719

1820
export type Ecosystem = {

apps/dashboard/src/components/wallets/ConnectWalletMiniPlayground/MiniPlayground.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function usePlaygroundWallets() {
7979
github: false,
8080
coinbase: false,
8181
guest: false,
82+
wallet: false,
8283
});
8384

8485
const [enabledWallets, setEnabledWallets] = useState<WalletRecord>({

apps/playground-web/src/components/in-app-wallet/ecosystem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const getEcosystem = () => {
88
process.env.NEXT_PUBLIC_IN_APP_WALLET_URL?.endsWith(".thirdweb-dev.com")
99
) {
1010
// dev ecosystem
11-
return "ecosystem.bonfire-development";
11+
return "ecosystem.catlovers";
1212
}
1313
// prod ecosystem
1414
return "ecosystem.new-age";

packages/thirdweb/src/extensions/prebuilts/deploy-erc1155.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { describe, expect, it } from "vitest";
22
import { ANVIL_CHAIN } from "../../../test/src/chains.js";
33
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
4-
import { TEST_ACCOUNT_A } from "../../../test/src/test-wallets.js";
4+
import { TEST_ACCOUNT_B } from "../../../test/src/test-wallets.js";
55
import { getContract } from "../../contract/contract.js";
66
import { name } from "../common/read/name.js";
77
import { deployERC1155Contract } from "./deploy-erc1155.js";
88

9-
// skip this test suite if there is no secret key available to test with
10-
// TODO: remove reliance on secret key during unit tests entirely
9+
const account = TEST_ACCOUNT_B;
10+
1111
describe.runIf(process.env.TW_SECRET_KEY)("deployERC1155", () => {
1212
it("should deploy ERC1155 drop", async () => {
1313
const address = await deployERC1155Contract({
1414
client: TEST_CLIENT,
1515
chain: ANVIL_CHAIN,
16-
account: TEST_ACCOUNT_A,
16+
account,
1717
type: "DropERC1155",
1818
params: {
1919
name: "EditionDrop",
@@ -35,7 +35,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC1155", () => {
3535
const address = await deployERC1155Contract({
3636
client: TEST_CLIENT,
3737
chain: ANVIL_CHAIN,
38-
account: TEST_ACCOUNT_A,
38+
account,
3939
type: "TokenERC1155",
4040
params: {
4141
name: "Edition",

packages/thirdweb/src/extensions/prebuilts/deploy-pack.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { describe, expect, it } from "vitest";
22
import { ANVIL_CHAIN } from "~test/chains.js";
33
import { TEST_CLIENT } from "~test/test-clients.js";
4-
import { TEST_ACCOUNT_A } from "~test/test-wallets.js";
4+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
55
import { isAddress } from "../../utils/address.js";
66
import { deployPackContract } from "./deploy-pack.js";
77

8+
const account = TEST_ACCOUNT_C;
9+
810
describe.runIf(process.env.TW_SECRET_KEY)("deploy-pack contract", () => {
911
it("should deploy Pack contract", async () => {
1012
const address = await deployPackContract({
11-
account: TEST_ACCOUNT_A,
13+
account,
1214
client: TEST_CLIENT,
1315
chain: ANVIL_CHAIN,
1416
params: {

packages/thirdweb/src/react/web/wallets/ecosystem/EcosystemWalletConnectUI.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ function EcosystemWalletConnectUI(props: {
129129
done={done}
130130
onBack={goBackToMain || (() => setSelectionData({}))}
131131
locale={props.connectLocale}
132+
isLinking={state.walletLogin.linking}
132133
/>
133134
);
134135
}

packages/thirdweb/src/react/web/wallets/in-app/InAppWalletConnectUI.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ function InAppWalletConnectUI(props: {
116116
done={done}
117117
onBack={goBackToMain || (() => setSelectionData({}))}
118118
locale={props.connectLocale}
119+
isLinking={state.walletLogin.linking}
119120
/>
120121
);
121122
}

packages/thirdweb/src/react/web/wallets/in-app/WalletAuth.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function WalletAuth(props: {
2828
inAppLocale: InAppWalletLocale;
2929
onBack: () => void;
3030
walletConnect: { projectId?: string } | undefined;
31+
isLinking: boolean;
3132
meta?: {
3233
title?: string;
3334
titleIconUrl?: string;
@@ -61,16 +62,25 @@ export function WalletAuth(props: {
6162
setStatus("loading");
6263
walletToConnect.current = walletToLink;
6364
try {
64-
await linkProfile({
65-
client: props.client,
66-
strategy: "wallet",
67-
wallet: walletToLink,
68-
chain: wallet.getChain() || defineChain(1),
69-
ecosystem,
70-
}).catch((e) => {
71-
setError(e.message);
72-
throw e;
73-
});
65+
if (props.isLinking) {
66+
await linkProfile({
67+
client: props.client,
68+
strategy: "wallet",
69+
wallet: walletToLink,
70+
chain: wallet.getChain() || defineChain(1),
71+
ecosystem,
72+
}).catch((e) => {
73+
setError(e.message);
74+
throw e;
75+
});
76+
} else {
77+
await wallet.connect({
78+
client: props.client,
79+
strategy: "wallet",
80+
wallet: walletToLink,
81+
chain: walletToLink.getChain() || defineChain(1),
82+
});
83+
}
7484
addConnectedWallet(walletToLink);
7585
done();
7686
} catch {

0 commit comments

Comments
 (0)