Skip to content

Commit 07954bb

Browse files
MananTankjnsdls
andauthored
[v5] types/jsdoc cleanup (#2570)
Signed-off-by: Manan Tank <manantankm@gmail.com> Co-authored-by: Jonas Daniels <jonas.daniels@outlook.com>
1 parent 275af27 commit 07954bb

File tree

21 files changed

+175
-245
lines changed

21 files changed

+175
-245
lines changed

packages/thirdweb/src/adapters/ethers5.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const ethers5Adapter = /* @__PURE__ */ (() => {
5757
* @returns The ethers.js provider.
5858
* @example
5959
* ```ts
60-
* import { ethers5Adapter } from "@thirdweb/adapters";
60+
* import { ethers5Adapter } from "thirdweb/adapters/ethers5";
6161
* const provider = ethers5Adapter.provider.toEthers(client, chainId);
6262
* ```
6363
*/
@@ -71,7 +71,7 @@ export const ethers5Adapter = /* @__PURE__ */ (() => {
7171
* @returns A Promise that resolves to an ethers.js Contract.
7272
* @example
7373
* ```ts
74-
* import { ethers5Adapter } from "@thirdweb/adapters";
74+
* import { ethers5Adapter } from "thirdweb/adapters/ethers5";
7575
* const ethersContract = await ethers5Adapter.contract.toEthers(twContract);
7676
* ```
7777
*/
@@ -83,7 +83,7 @@ export const ethers5Adapter = /* @__PURE__ */ (() => {
8383
* @returns A promise that resolves to a ThirdwebContract instance.
8484
* @example
8585
* ```ts
86-
* import { ethers5Adapter } from "@thirdweb/adapters";
86+
* import { ethers5Adapter } from "thirdweb/adapters/ethers5";
8787
*
8888
* const twContract = await ethers5Adapter.contract.fromEthersContract({
8989
* client,
@@ -102,7 +102,7 @@ export const ethers5Adapter = /* @__PURE__ */ (() => {
102102
* @returns - A Promise that resolves to aa Wallet object.
103103
* @example
104104
* ```ts
105-
* import { ethers5Adapter } from "@thirdweb/adapters";
105+
* import { ethers5Adapter } from "thirdweb/adapters/ethers5";
106106
* const wallet = await ethers5Adapter.signer.fromEthersSigner(signer);
107107
* ```
108108
*/
@@ -115,7 +115,7 @@ export const ethers5Adapter = /* @__PURE__ */ (() => {
115115
* @returns A promise that resolves to an ethers.js signer.
116116
* @example
117117
* ```ts
118-
* import { ethers5Adapter } from "@thirdweb/adapters";
118+
* import { ethers5Adapter } from "thirdweb/adapters/ethers5";
119119
* const signer = await ethers5Adapter.signer.toEthers(client, chain, account);
120120
* ```
121121
*/

packages/thirdweb/src/adapters/ethers6.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const ethers6Adapter = /* @__PURE__ */ (() => {
5555
* @returns The ethers.js provider.
5656
* @example
5757
* ```ts
58-
* import { ethers6Adapter } from "@thirdweb/adapters";
58+
* import { ethers6Adapter } from "thirdweb/adapters/ethers6";
5959
* const provider = ethers6Adapter.provider.toEthers(client, chainId);
6060
* ```
6161
*/
@@ -71,7 +71,7 @@ export const ethers6Adapter = /* @__PURE__ */ (() => {
7171
* @returns A Promise that resolves to an ethers.js Contract.
7272
* @example
7373
* ```ts
74-
* import { ethers6Adapter } from "@thirdweb/adapters";
74+
* import { ethers6Adapter } from "thirdweb/adapters/ethers6";
7575
* const ethersContract = await ethers6Adapter.contract.toEthers(twContract);
7676
* ```
7777
*/
@@ -85,7 +85,7 @@ export const ethers6Adapter = /* @__PURE__ */ (() => {
8585
* @returns A promise that resolves to a ThirdwebContract instance.
8686
* @example
8787
* ```ts
88-
* import { ethers6Adapter } from "@thirdweb/adapters";
88+
* import { ethers6Adapter } from "thirdweb/adapters/ethers6";
8989
*
9090
* const twContract = await ethers6Adapter.contract.fromEthersContract({
9191
* client,
@@ -106,7 +106,7 @@ export const ethers6Adapter = /* @__PURE__ */ (() => {
106106
* @returns - A Promise that resolves to an Wallet object.
107107
* @example
108108
* ```ts
109-
* import { ethers6Adapter } from "@thirdweb/adapters";
109+
* import { ethers6Adapter } from "thirdweb/adapters/ethers6";
110110
* const wallet = await ethers6Adapter.signer.fromEthersSigner(signer);
111111
* ```
112112
*/
@@ -123,7 +123,7 @@ export const ethers6Adapter = /* @__PURE__ */ (() => {
123123
* @returns A promise that resolves to an ethers.js signer.
124124
* @example
125125
* ```ts
126-
* import { ethers6Adapter } from "@thirdweb/adapters";
126+
* import { ethers6Adapter } from "thirdweb/adapters/ethers6";
127127
* const signer = await ethers6Adapter.signer.toEthers(client, chain, account);
128128
* ```
129129
*/

packages/thirdweb/src/exports/wallets.ts

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ export {
55
} from "../wallets/create-wallet.js";
66

77
export type { Wallet, Account } from "../wallets/interfaces/wallet.js";
8-
export type { WalletEventListener } from "../wallets/interfaces/listeners.js";
9-
export type { WalletMetadata } from "../wallets/types.js";
10-
118
export type { ConnectionStatus } from "../wallets/manager/index.js";
12-
export { createConnectionManager } from "../wallets/manager/index.js";
139

1410
export {
1511
getWalletBalance,
@@ -23,11 +19,45 @@ export {
2319
} from "../wallets/private-key.js";
2420

2521
// injected
26-
export { getMIPDStore } from "../wallets/injected/mipdStore.js";
27-
2822
export { injectedProvider } from "../wallets/injected/mipdStore.js";
2923

30-
export {
31-
getStoredActiveWalletId,
32-
getStoredConnectedWalletIds,
33-
} from "../wallets/manager/index.js";
24+
export type {
25+
WalletId,
26+
EmbeddedWalletCreationOptions,
27+
WalletAutoConnectionOption,
28+
WalletCreationOptions,
29+
WalletConnectionOption,
30+
CreateWalletArgs,
31+
} from "../wallets/wallet-types.js";
32+
33+
export type {
34+
WCSupportedWalletIds,
35+
InjectedSupportedWalletIds,
36+
} from "../wallets/__generated__/wallet-ids.js";
37+
38+
export type {
39+
WCConnectOptions,
40+
WCAutoConnectOptions,
41+
} from "../wallets/wallet-connect/types.js";
42+
43+
export type {
44+
SmartWalletConnectionOptions,
45+
SmartWalletOptions,
46+
} from "../wallets/smart/types.js";
47+
48+
export type {
49+
EmbeddedWalletAuth,
50+
EmbeddedWalletAutoConnectOptions,
51+
EmbeddedWalletConnectionOptions,
52+
EmbeddedWalletSocialAuth,
53+
} from "../wallets/embedded/core/wallet/index.js";
54+
55+
export type { CoinbaseSDKWalletConnectionOptions } from "../wallets/coinbase/coinbaseSDKWallet.js";
56+
57+
export type {
58+
WalletEmitter,
59+
WalletEmitterEvents,
60+
} from "../wallets/wallet-emitter.js";
61+
62+
export { getAllWalletsList } from "../wallets/getAllWalletsList.js";
63+
export { getWalletInfo } from "../wallets/__generated__/getWalletInfo.js";

packages/thirdweb/src/react/core/hooks/connection/useAutoConnect.tsx

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,28 @@ export type AutoConnectProps = {
3232
* Array of wallets that your app uses
3333
* @example
3434
* ```tsx
35-
* import { metamaskConfig, coinbaseConfig, walletConnectConfig } from "thirdweb/react";
35+
* import { AutoConnect } from "thirdweb/react";
36+
* import { createWallet, embeddedWallet } from "thirdweb/wallets";
37+
*
38+
* const wallets = [
39+
* embeddedWallet(),
40+
* createWallet("io.metamask"),
41+
* createWallet("com.coinbase.wallet"),
42+
* createWallet("me.rainbow"),
43+
* ];
3644
*
3745
* function Example() {
3846
* return (
3947
* <AutoConnect
4048
* client={client}
41-
* wallets={[
42-
* metamaskConfig(),
43-
* coinbaseConfig(),
44-
* walletConnectConfig(),
45-
* ]}
49+
* wallets={wallets}
4650
* />
4751
* )
4852
* }
4953
* ```
5054
*/
5155
wallets: Wallet[];
56+
5257
/**
5358
* A client is the entry point to the thirdweb SDK.
5459
* It is required for all other actions.
@@ -65,18 +70,18 @@ export type AutoConnectProps = {
6570
* ```
6671
*/
6772
client: ThirdwebClient;
73+
6874
/**
69-
* Metadata of the app that will be passed to connected wallet.
75+
* Metadata of the app that will be passed to connected wallet. Setting this is highly recommended.
7076
*
7177
* Some wallets display this information to the user when they connect to your app.
72-
*
73-
*
78+
* @example
7479
* ```ts
7580
* {
76-
* name: "thirdweb powered dApp",
77-
* url: "https://thirdweb.com",
78-
* description: "thirdweb powered dApp",
79-
* logoUrl: "https://thirdweb.com/favicon.ico",
81+
* name: "My App",
82+
* url: "https://my-app.com",
83+
* description: "some description about your app",
84+
* logoUrl: "https://path/to/my-app/logo.svg",
8085
* };
8186
* ```
8287
*/
@@ -123,12 +128,15 @@ export type AutoConnectProps = {
123128
* @param props - Object of type `AutoConnectProps`. Refer to [`AutoConnectProps`](https://portal.thirdweb.com/references/typescript/v5/AutoConnectProps)
124129
* @example
125130
* ```tsx
126-
* import { AutoConnect } from "@thirdweb/react";
131+
* import { AutoConnect } from "thirdweb/react";
132+
* import { createWallet, embeddedWallet } from "thirdweb/wallets";
133+
*
127134
*
128135
* // list of wallets that your app uses
129136
* const wallets = [
130-
* metamaskConfig(),
131-
* coinbaseConfig(),
137+
* createWallet('io.metamask'),
138+
* embeddedWallet(),
139+
* createWallet("me.rainbow"),
132140
* ]
133141
*
134142
* function Example() {
@@ -287,13 +295,3 @@ export function NoAutoConnect() {
287295

288296
return null;
289297
}
290-
291-
// function isValidWithPersonalWalletConnectionOptions(
292-
// options: any,
293-
// ): options is WithPersonalWalletConnectionOptions {
294-
// return (
295-
// typeof options === "object" &&
296-
// options !== null &&
297-
// typeof options.personalWalletId === "string"
298-
// );
299-
// }

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ const TW_CONNECT_WALLET = "tw-connect-wallet";
4040
* ```tsx
4141
* <ConnectButton
4242
* client={client}
43-
* appMetadata={{
44-
* name: "Example",
45-
* url: "https://example.com",
46-
* }}
4743
* />
4844
* ```
4945
* @param props
@@ -57,12 +53,6 @@ export function ConnectButton(props: ConnectButtonProps) {
5753
const localeId = props.locale || "en_US";
5854
const [locale, setLocale] = useState<ConnectLocale | undefined>();
5955

60-
// useEffect(() => {
61-
// wallets.forEach((w) => {
62-
// w.prefetch?.(localeId);
63-
// });
64-
// }, [wallets, localeId]);
65-
6656
useEffect(() => {
6757
getConnectLocale(localeId).then(setLocale);
6858
}, [localeId]);

packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectWalletProps.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ export type ConnectButtonProps = {
299299
* Array of supported wallets. If not provided, default wallets will be used.
300300
* @example
301301
* ```tsx
302-
* import { createWallet, embeddedWallet } from "thirdweb/react";
302+
* import { AutoConnect } from "thirdweb/react";
303+
* import { createWallet, embeddedWallet } from "thirdweb/wallets";
303304
*
304305
* const wallets = [
305306
* embeddedWallet(),
@@ -318,14 +319,19 @@ export type ConnectButtonProps = {
318319
* }
319320
* ```
320321
*
321-
* If no wallets are specified. The component will show any EIP-6963 compliant wallet installed, as well as these default wallets:
322+
* If no wallets are specified. The component will show All the EIP-6963 compliant installed wallet extensions, as well as below default wallets:
322323
*
323-
* - [Embedded Wallet](https://portal.thirdweb.com/references/typescript/v5/embeddedWalletConfig)
324-
* - [MataMask Wallet](https://portal.thirdweb.com/references/typescript/v5/metamaskConfig)
325-
* - [Coinbase Wallet](https://portal.thirdweb.com/references/typescript/v5/coinbaseConfig)
326-
* - [WalletConnect](https://portal.thirdweb.com/references/typescript/v5/walletConnectConfig)
327-
* - [rainbowConfig](https://portal.thirdweb.com/references/typescript/v5/rainbowConfig)
328-
* - [zerionConfig](https://portal.thirdweb.com/references/typescript/v5/zerionConfig)
324+
* ```tsx
325+
* const defaultWallets = [
326+
* embeddedWallet(),
327+
* createWallet("io.metamask"),
328+
* createWallet("com.coinbase.wallet"),
329+
* createWallet("me.rainbow"),
330+
* createWallet("io.zerion.wallet"),
331+
* ]
332+
* ```
333+
*
334+
* The `ConnectButton` also shows a "All wallets" button at the end of wallet list which allows user to connect to any of the 350+ wallets
329335
*/
330336
wallets?: Wallet[];
331337

@@ -348,16 +354,16 @@ export type ConnectButtonProps = {
348354
| boolean;
349355

350356
/**
351-
* Metadata of the app that will be passed to connected wallet.
357+
* Metadata of the app that will be passed to connected wallet. Setting this is highly recommended.
352358
*
353359
* Some wallets display this information to the user when they connect to your app.
354360
* @example
355361
* ```ts
356362
* {
357-
* name: "thirdweb powered dApp",
358-
* url: "https://thirdweb.com",
359-
* description: "thirdweb powered dApp",
360-
* logoUrl: "https://thirdweb.com/favicon.ico",
363+
* name: "My App",
364+
* url: "https://my-app.com",
365+
* description: "some description about your app",
366+
* logoUrl: "https://path/to/my-app/logo.svg",
361367
* };
362368
* ```
363369
*/

0 commit comments

Comments
 (0)