Skip to content

Commit 7882b22

Browse files
feat: coinbase wallet sdk v4 with SW support (#2875)
1 parent 429f2d3 commit 7882b22

File tree

19 files changed

+194
-139
lines changed

19 files changed

+194
-139
lines changed

.changeset/poor-melons-promise.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+
Support for Coinbase Smart Wallet

legacy_packages/auth/test/smart-wallet.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ describe.runIf(process.env.TW_SECRET_KEY)(
1717
let auth: ThirdwebAuth;
1818

1919
beforeAll(async () => {
20-
const factoryAddress = "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052";
21-
const chain = 421614;
20+
const factoryAddress = "0x7b5ba9D46b53aae55e2c2E9b38d9AfF9a0b158F8";
21+
const chain = 84532;
2222
const localWallet = new LocalWallet();
2323
await localWallet.generate();
2424
const smartWallet = new SmartWallet({
@@ -54,12 +54,12 @@ describe.runIf(process.env.TW_SECRET_KEY)(
5454
it("Should verify logged in wallet with chain ID and expiration", async () => {
5555
const payload = await auth.login({
5656
expirationTime: new Date(Date.now() + 1000 * 60 * 5),
57-
chainId: "421614",
57+
chainId: "84532",
5858
});
5959

6060
auth.updateWallet(adminWallet);
6161
const address = await auth.verify(payload, {
62-
chainId: "421614",
62+
chainId: "84532",
6363
});
6464

6565
expect(address).to.equal(await signerWallet.getAddress());

legacy_packages/contracts-js/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
"./dist/abis/PermissionsLogic.json": "./dist/abis/PermissionsLogic.json",
148148
"./dist/abis/Staking20Base.json": "./dist/abis/Staking20Base.json",
149149
"./dist/abis/IContext.json": "./dist/abis/IContext.json",
150+
"./dist/abis/AccountSeaportBulkSigSupport.json": "./dist/abis/AccountSeaportBulkSigSupport.json",
150151
"./dist/abis/Staking20Upgradeable.json": "./dist/abis/Staking20Upgradeable.json",
151152
"./dist/abis/Proxy.json": "./dist/abis/Proxy.json",
152153
"./dist/abis/ERC1967Proxy.json": "./dist/abis/ERC1967Proxy.json",
@@ -194,8 +195,10 @@
194195
"./dist/abis/SignatureMintERC20.json": "./dist/abis/SignatureMintERC20.json",
195196
"./dist/abis/Staking1155Upgradeable.json": "./dist/abis/Staking1155Upgradeable.json",
196197
"./dist/abis/IEntryPoint.json": "./dist/abis/IEntryPoint.json",
198+
"./dist/abis/SeaportOrderParser.json": "./dist/abis/SeaportOrderParser.json",
197199
"./dist/abis/EnglishAuctionsStorage.json": "./dist/abis/EnglishAuctionsStorage.json",
198200
"./dist/abis/IDropERC721_V3.json": "./dist/abis/IDropERC721_V3.json",
201+
"./dist/abis/EIP712.json": "./dist/abis/EIP712.json",
199202
"./dist/abis/DelayedReveal.json": "./dist/abis/DelayedReveal.json",
200203
"./dist/abis/IAccount.json": "./dist/abis/IAccount.json",
201204
"./dist/abis/OffersStorage.json": "./dist/abis/OffersStorage.json",
@@ -230,6 +233,7 @@
230233
"./dist/abis/IAirdropERC1155.json": "./dist/abis/IAirdropERC1155.json",
231234
"./dist/abis/OffersLogic.json": "./dist/abis/OffersLogic.json",
232235
"./dist/abis/Marketplace.json": "./dist/abis/Marketplace.json",
236+
"./dist/abis/Airdrop.json": "./dist/abis/Airdrop.json",
233237
"./dist/abis/DirectListingsStorage.json": "./dist/abis/DirectListingsStorage.json",
234238
"./dist/abis/TieredDrop.json": "./dist/abis/TieredDrop.json",
235239
"./dist/abis/ERC1155Receiver.json": "./dist/abis/ERC1155Receiver.json",
@@ -267,6 +271,7 @@
267271
"./dist/abis/IERC721Metadata.json": "./dist/abis/IERC721Metadata.json",
268272
"./dist/abis/DropSinglePhase_V1.json": "./dist/abis/DropSinglePhase_V1.json",
269273
"./dist/abis/PermissionsEnumerable.json": "./dist/abis/PermissionsEnumerable.json",
274+
"./dist/abis/SeaportEIP1271.json": "./dist/abis/SeaportEIP1271.json",
270275
"./dist/abis/IAccountFactoryCore.json": "./dist/abis/IAccountFactoryCore.json",
271276
"./dist/abis/TokenStake.json": "./dist/abis/TokenStake.json",
272277
"./dist/abis/AppURI.json": "./dist/abis/AppURI.json",
@@ -324,6 +329,7 @@
324329
"./dist/abis/IAirdropERC1155Claimable.json": "./dist/abis/IAirdropERC1155Claimable.json",
325330
"./dist/abis/IVotes.json": "./dist/abis/IVotes.json",
326331
"./dist/abis/PluginMap.json": "./dist/abis/PluginMap.json",
332+
"./dist/abis/ECDSA.json": "./dist/abis/ECDSA.json",
327333
"./dist/abis/PermissionsEnumerableLogic.json": "./dist/abis/PermissionsEnumerableLogic.json",
328334
"./dist/abis/IContractMetadata.json": "./dist/abis/IContractMetadata.json",
329335
"./dist/abis/IDropClaimCondition.json": "./dist/abis/IDropClaimCondition.json",

packages/thirdweb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
"!tsconfig.build.json"
175175
],
176176
"dependencies": {
177-
"@coinbase/wallet-sdk": "3.7.2",
177+
"@coinbase/wallet-sdk": "4.0.0-rc.1",
178178
"@emotion/react": "11.11.4",
179179
"@emotion/styled": "11.11.0",
180180
"@google/model-viewer": "2.1.1",

packages/thirdweb/src/exports/react.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export type {
44
ThemeOverrides,
55
} from "../react/web/ui/design-system/index.js";
66

7-
export { ConnectButton } from "../react/web/ui/ConnectWallet/ConnectWallet.js";
7+
export { ConnectButton } from "../react/web/ui/ConnectWallet/ConnectButton.js";
88
export {
99
ConnectEmbed,
1010
type ConnectEmbedProps,
@@ -16,7 +16,7 @@ export type {
1616
ConnectButton_connectModalOptions,
1717
ConnectButton_detailsButtonOptions,
1818
ConnectButton_detailsModalOptions,
19-
} from "../react/web/ui/ConnectWallet/ConnectWalletProps.js";
19+
} from "../react/web/ui/ConnectWallet/ConnectButtonProps.js";
2020
export type { NetworkSelectorProps } from "../react/web/ui/ConnectWallet/NetworkSelector.js";
2121
export type { WelcomeScreen } from "../react/web/ui/ConnectWallet/screens/types.js";
2222
export type { LocaleId } from "../react/web/ui/types.js";

packages/thirdweb/src/react/core/providers/wallet-connection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
44
import type { Wallet } from "../../../wallets/interfaces/wallet.js";
55
import type { SmartWalletOptions } from "../../../wallets/smart/types.js";
66
import type { AppMetadata } from "../../../wallets/types.js";
7-
import type { ConnectButton_connectModalOptions } from "../../web/ui/ConnectWallet/ConnectWalletProps.js";
7+
import type { ConnectButton_connectModalOptions } from "../../web/ui/ConnectWallet/ConnectButtonProps.js";
88
import type { ConnectLocale } from "../../web/ui/ConnectWallet/locale/types.js";
99
import type { LocaleId } from "../../web/ui/types.js";
1010
import type { SiweAuthOptions } from "../hooks/auth/useSiweAuth.js";

packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectWallet.tsx renamed to packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Container } from "../components/basic.js";
1919
import { Button } from "../components/buttons.js";
2020
import { fadeInAnimation } from "../design-system/animations.js";
2121
import { iconSize } from "../design-system/index.js";
22-
import type { ConnectButtonProps } from "./ConnectWalletProps.js";
22+
import type { ConnectButtonProps } from "./ConnectButtonProps.js";
2323
import { ConnectedWalletDetails } from "./Details.js";
2424
import ConnectModal from "./Modal/ConnectModal.js";
2525
import { defaultTokens } from "./defaultTokens.js";
@@ -47,8 +47,13 @@ const TW_CONNECT_WALLET = "tw-connect-wallet";
4747
*/
4848
export function ConnectButton(props: ConnectButtonProps) {
4949
const wallets = useMemo(
50-
() => props.wallets || getDefaultWallets(),
51-
[props.wallets],
50+
() =>
51+
props.wallets ||
52+
getDefaultWallets({
53+
appMetadata: props.appMetadata,
54+
chains: props.chains,
55+
}),
56+
[props.wallets, props.appMetadata, props.chains],
5257
);
5358
const localeQuery = useConnectLocale(props.locale || "en_US");
5459

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import type {
5555
ConnectButtonProps,
5656
ConnectButton_detailsButtonOptions,
5757
ConnectButton_detailsModalOptions,
58-
} from "./ConnectWalletProps.js";
58+
} from "./ConnectButtonProps.js";
5959
import { NetworkSelectorContent } from "./NetworkSelector.js";
6060
import { onModalUnmount } from "./constants.js";
6161
import type { SupportedTokens } from "./defaultTokens.js";

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect } from "react";
1+
import { useEffect, useMemo } from "react";
22
import type { Chain } from "../../../../../chains/types.js";
33
import type { ThirdwebClient } from "../../../../../client/client.js";
44
import type { SiweAuthOptions } from "../../../../../exports/react.js";
@@ -336,7 +336,15 @@ export function ConnectEmbed(props: ConnectEmbedProps) {
336336
const show =
337337
!activeAccount || (siweAuth.requiresAuth && !siweAuth.isLoggedIn);
338338

339-
const wallets = props.wallets || getDefaultWallets();
339+
const wallets = useMemo(
340+
() =>
341+
props.wallets ||
342+
getDefaultWallets({
343+
appMetadata: props.appMetadata,
344+
chains: props.chains,
345+
}),
346+
[props.wallets, props.appMetadata, props.chains],
347+
);
340348
const localeId = props.locale || "en_US";
341349
const localeQuery = useConnectLocale(localeId);
342350

0 commit comments

Comments
 (0)