Skip to content

Commit a246805

Browse files
authored
Merge branch 'main' into yash/ref-constructor-params
2 parents 0e7bad0 + 7bbe60f commit a246805

File tree

2 files changed

+48
-38
lines changed

2 files changed

+48
-38
lines changed

apps/dashboard/src/@/constants/thirdweb.server.ts

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ import {
1212
THIRDWEB_STORAGE_DOMAIN,
1313
} from "constants/urls";
1414
import { createThirdwebClient } from "thirdweb";
15-
import { getChainMetadata } from "thirdweb/chains";
1615
import { populateEip712Transaction } from "thirdweb/transaction";
1716
import {
1817
getTransactionDecorator,
19-
isZkSyncChain,
2018
setThirdwebDomains,
2119
setTransactionDecorator,
2220
} from "thirdweb/utils";
@@ -39,43 +37,32 @@ export function getThirdwebClient(jwt?: string) {
3937

4038
if (!getTransactionDecorator()) {
4139
setTransactionDecorator(async ({ account, transaction }) => {
42-
// use paymaster for zk chains on testnets
43-
const chainMeta = await getChainMetadata(transaction.chain);
44-
if (chainMeta.testnet) {
45-
const isZkChain = await isZkSyncChain(transaction.chain);
46-
if (isZkChain) {
47-
const serializedTx = await populateEip712Transaction({
48-
transaction,
49-
account,
50-
});
51-
const pmData = await getZkPaymasterData({
52-
options: {
53-
client: transaction.client,
54-
chain: transaction.chain,
40+
// special override for sophon testnet (zk chain)
41+
// sophon only allows transactions through their paymaster
42+
// so always use eip712 tx + paymaster
43+
if (transaction.chain.id === 531050104) {
44+
const serializedTx = await populateEip712Transaction({
45+
transaction,
46+
account,
47+
});
48+
const pmData = await getZkPaymasterData({
49+
options: {
50+
client: transaction.client,
51+
chain: transaction.chain,
52+
},
53+
transaction: serializedTx,
54+
});
55+
return {
56+
account,
57+
transaction: {
58+
...transaction,
59+
eip712: {
60+
...transaction.eip712,
61+
paymaster: pmData.paymaster,
62+
paymasterInput: pmData.paymasterInput,
5563
},
56-
transaction: serializedTx,
57-
}).catch((e) => {
58-
console.warn(
59-
"No zk paymaster data available on chain ",
60-
transaction.chain.id,
61-
e,
62-
);
63-
return undefined;
64-
});
65-
return {
66-
account,
67-
transaction: {
68-
...transaction,
69-
eip712: pmData
70-
? {
71-
...transaction.eip712,
72-
paymaster: pmData.paymaster,
73-
paymasterInput: pmData.paymasterInput,
74-
}
75-
: transaction.eip712,
76-
},
77-
};
78-
}
64+
},
65+
};
7966
}
8067
return { account, transaction };
8168
});

apps/dashboard/src/app/login/page.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,32 @@ import { useTheme } from "next-themes";
77
import { useSearchParams } from "next/navigation";
88
import { Suspense, useEffect, useState } from "react";
99
import { ConnectEmbed } from "thirdweb/react";
10+
import { createWallet, inAppWallet } from "thirdweb/wallets";
1011
import { ThirdwebMiniLogo } from "../components/ThirdwebMiniLogo";
1112
import { getSDKTheme } from "../components/sdk-component-theme";
1213
import { doLogin, doLogout, getLoginPayload, isLoggedIn } from "./auth-actions";
1314

15+
const wallets = [
16+
inAppWallet({
17+
auth: {
18+
options: [
19+
"google",
20+
"apple",
21+
"facebook",
22+
"github",
23+
"email",
24+
"phone",
25+
"passkey",
26+
],
27+
},
28+
}),
29+
createWallet("io.metamask"),
30+
createWallet("com.coinbase.wallet"),
31+
createWallet("io.rabby"),
32+
createWallet("me.rainbow"),
33+
createWallet("io.zerion.wallet"),
34+
];
35+
1436
export default function LoginPage() {
1537
return (
1638
<div className="relative grid h-screen place-items-center bg-muted/30">
@@ -74,6 +96,7 @@ function CustomConnectEmmbed() {
7496
return isLoggedInResult;
7597
},
7698
}}
99+
wallets={wallets}
77100
client={client}
78101
modalSize={isLG ? "wide" : "compact"}
79102
theme={getSDKTheme(theme === "light" ? "light" : "dark")}

0 commit comments

Comments
 (0)