Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit 907c47b

Browse files
committed
add useConnect and useDisconnect hooks
1 parent c182cd8 commit 907c47b

File tree

4 files changed

+59
-18
lines changed

4 files changed

+59
-18
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
],
1818
"private": false,
1919
"scripts": {
20-
"build": "tsup --env.NODE_ENV production --minify --dts --format esm,cjs",
20+
"build:lib": "tsup --env.NODE_ENV production --minify --dts --format esm,cjs",
2121
"lint": "eslint src/",
2222
"fix": "eslint src/ --fix",
23-
"typedoc": "typedoc --theme github-wiki"
23+
"typedoc": "typedoc --theme github-wiki",
24+
"build": "yarn build:lib && yarn typedoc"
2425
},
2526
"sideEffects:": false,
2627
"devDependencies": {

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
export * from "./Provider";
22
export * from "./hooks/modules";
3+
export * from "./hooks/useDisconnect";
4+
export * from "./hooks/useConnect";

wiki/Exports.md

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
- [useBundleDropModule](../wiki/Exports#usebundledropmodule)
1616
- [useBundleModule](../wiki/Exports#usebundlemodule)
1717
- [useBundleSignatureModule](../wiki/Exports#usebundlesignaturemodule)
18+
- [useConnect](../wiki/Exports#useconnect)
19+
- [useDisconnect](../wiki/Exports#usedisconnect)
1820
- [useDropModule](../wiki/Exports#usedropmodule)
1921
- [useMarketModule](../wiki/Exports#usemarketmodule)
2022
- [useMarketplaceModule](../wiki/Exports#usemarketplacemodule)
@@ -32,7 +34,7 @@
3234

3335
#### Defined in
3436

35-
Provider.tsx:88
37+
[src/Provider.tsx:88](https://github.com/thirdweb-dev/react/blob/c182cd8/src/Provider.tsx#L88)
3638

3739
## Functions
3840

@@ -52,7 +54,7 @@ Provider.tsx:88
5254

5355
#### Defined in
5456

55-
hooks/modules/useBundleDropModule.ts:4
57+
[src/hooks/modules/useBundleDropModule.ts:4](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/useBundleDropModule.ts#L4)
5658

5759
___
5860

@@ -72,7 +74,7 @@ ___
7274

7375
#### Defined in
7476

75-
hooks/modules/useBundleModule.ts:4
77+
[src/hooks/modules/useBundleModule.ts:4](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/useBundleModule.ts#L4)
7678

7779
___
7880

@@ -92,7 +94,43 @@ ___
9294

9395
#### Defined in
9496

95-
hooks/modules/useBundleSignatureModule.ts:4
97+
[src/hooks/modules/useBundleSignatureModule.ts:4](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/useBundleSignatureModule.ts#L4)
98+
99+
___
100+
101+
### useConnect
102+
103+
**useConnect**(): readonly [{ `data`: { `connected`: `boolean` ; `connector`: `undefined` \| `Connector`<`any`, `any`\> ; `connectors`: `Connector`<`any`, `any`\>[] } ; `error`: `undefined` \| `Error` ; `loading`: `undefined` \| `boolean` }, (`connector`: `Connector`<`any`, `any`\>) => `Promise`<{ `data?`: `ConnectorData`<`any`\> ; `error?`: `Error` }\>]
104+
105+
for now just re-exported
106+
107+
#### Returns
108+
109+
readonly [{ `data`: { `connected`: `boolean` ; `connector`: `undefined` \| `Connector`<`any`, `any`\> ; `connectors`: `Connector`<`any`, `any`\>[] } ; `error`: `undefined` \| `Error` ; `loading`: `undefined` \| `boolean` }, (`connector`: `Connector`<`any`, `any`\>) => `Promise`<{ `data?`: `ConnectorData`<`any`\> ; `error?`: `Error` }\>]
110+
111+
#### Defined in
112+
113+
src/hooks/useConnect.ts:6
114+
115+
___
116+
117+
### useDisconnect
118+
119+
**useDisconnect**(): () => `void`
120+
121+
#### Returns
122+
123+
`fn`
124+
125+
▸ (): `void`
126+
127+
##### Returns
128+
129+
`void`
130+
131+
#### Defined in
132+
133+
src/hooks/useDisconnect.ts:3
96134

97135
___
98136

@@ -112,7 +150,7 @@ ___
112150

113151
#### Defined in
114152

115-
hooks/modules/useDropModule.ts:4
153+
[src/hooks/modules/useDropModule.ts:4](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/useDropModule.ts#L4)
116154

117155
___
118156

@@ -136,7 +174,7 @@ the {@link MarketModule} instance
136174

137175
#### Defined in
138176

139-
hooks/modules/useMarketModule.ts:11
177+
[src/hooks/modules/useMarketModule.ts:11](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/useMarketModule.ts#L11)
140178

141179
___
142180

@@ -156,7 +194,7 @@ ___
156194

157195
#### Defined in
158196

159-
hooks/modules/useMarketplaceModule.ts:4
197+
[src/hooks/modules/useMarketplaceModule.ts:4](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/useMarketplaceModule.ts#L4)
160198

161199
___
162200

@@ -176,7 +214,7 @@ ___
176214

177215
#### Defined in
178216

179-
hooks/modules/useNFTModule.ts:4
217+
[src/hooks/modules/useNFTModule.ts:4](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/useNFTModule.ts#L4)
180218

181219
___
182220

@@ -196,7 +234,7 @@ ___
196234

197235
#### Defined in
198236

199-
hooks/modules/usePackModule.ts:4
237+
[src/hooks/modules/usePackModule.ts:4](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/usePackModule.ts#L4)
200238

201239
___
202240

@@ -210,7 +248,7 @@ ___
210248

211249
#### Defined in
212250

213-
Provider.tsx:214
251+
[src/Provider.tsx:214](https://github.com/thirdweb-dev/react/blob/c182cd8/src/Provider.tsx#L214)
214252

215253
___
216254

@@ -230,7 +268,7 @@ ___
230268

231269
#### Defined in
232270

233-
hooks/modules/useTokenModule.ts:4
271+
[src/hooks/modules/useTokenModule.ts:4](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/useTokenModule.ts#L4)
234272

235273
___
236274

@@ -250,4 +288,4 @@ ___
250288

251289
#### Defined in
252290

253-
hooks/modules/useVoteModule.ts:4
291+
[src/hooks/modules/useVoteModule.ts:4](https://github.com/thirdweb-dev/react/blob/c182cd8/src/hooks/modules/useVoteModule.ts#L4)

wiki/ThirdwebPoviderProps.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Advanced options.
2929

3030
#### Defined in
3131

32-
Provider.tsx:60
32+
[src/Provider.tsx:60](https://github.com/thirdweb-dev/react/blob/c182cd8/src/Provider.tsx#L60)
3333

3434
___
3535

@@ -41,7 +41,7 @@ The name of your dApp. This will show up in the wallet connect / wallet link flo
4141

4242
#### Defined in
4343

44-
Provider.tsx:49
44+
[src/Provider.tsx:49](https://github.com/thirdweb-dev/react/blob/c182cd8/src/Provider.tsx#L49)
4545

4646
___
4747

@@ -53,7 +53,7 @@ The chain id / network you want the client to connect to
5353

5454
#### Defined in
5555

56-
Provider.tsx:45
56+
[src/Provider.tsx:45](https://github.com/thirdweb-dev/react/blob/c182cd8/src/Provider.tsx#L45)
5757

5858
___
5959

@@ -67,4 +67,4 @@ The Thirdweb SDK options.
6767

6868
#### Defined in
6969

70-
Provider.tsx:55
70+
[src/Provider.tsx:55](https://github.com/thirdweb-dev/react/blob/c182cd8/src/Provider.tsx#L55)

0 commit comments

Comments
 (0)