Skip to content

Commit 13fca23

Browse files
committed
chore: amend connect kit docs
1 parent 64a27ff commit 13fca23

File tree

2 files changed

+17
-43
lines changed

2 files changed

+17
-43
lines changed

docs/pages/library/react-connect-kit/extension-accounts.mdx

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,17 @@ import {
3535
} from '@w3ux/react-connect-kit';
3636

3737
const AppWithProviders = () => {
38-
39-
// Dapp identifier.
38+
// Dapp identifier
4039
const dappName = "My Dapp Name";
41-
// Active network, in lower case.
42-
const network = "polkadot";
43-
// SS58 prefix of the current network.
40+
41+
// SS58 prefix of the current network
4442
const ss58 = 0;
45-
// Active account, if any.
46-
const activeAccount = null;
47-
// Setter for Dapp active account.
48-
const setActiveAccount = (a: string | null) => {
49-
setState({ ...state, activeAccount: a });
50-
};
5143

5244
return (
5345
<ExtensionsProvider>
5446
<ExtensionAccountsProvider
5547
dappName={dappName}
56-
network={network}
5748
ss58={ss58}
58-
activeAccount={activeAccount}
59-
setActiveAccount={setActiveAccount}
6049
>
6150
<App />
6251
</ExtensionAccountsProvider>
@@ -66,22 +55,22 @@ const AppWithProviders = () => {
6655

6756
### Connecting Extensions
6857

69-
With the providers in place, you can call `connectExtensionAccounts` to connect to an extension. The following example attempts to find and connect to Subwallet JS upon a button click.
58+
With the providers in place, you can call `connectExtension` to connect to an extension. The following example attempts to find and connect to Subwallet JS upon a button click.
7059

7160
```tsx
7261
import {
7362
useExtensionAccounts,
7463
} from '@w3ux/react-connect-kit';
7564

7665
const ConnectAccounts = () => {
77-
const { connectExtensionAccounts } = useExtensionAccounts();
66+
const { connectExtension } = useExtensionAccounts();
7867

7968
return (
8069
<>
8170
<button
8271
type="button"
8372
onClick={() => {
84-
if (extension) connectExtensionAccounts('subwallet-js');
73+
if (extension) connectExtension('subwallet-js');
8574
}}
8675
>
8776
Connect to Subwallet JS
@@ -97,34 +86,20 @@ const ConnectAccounts = () => {
9786
#### dappName
9887
`string`
9988
100-
A Dapp identifier that is provided to the web3 extension(s) being connected to.
101-
102-
#### network
103-
`string`
104-
105-
The active network, in lower-case.
106-
10789
#### ss58
10890
`number`
10991
11092
The SS58 prefix of the current network.
11193
112-
_Planned to be derived from network in a future release._
113-
114-
#### activeAccount
115-
`string | null`
116-
117-
The current active account on your Dapp, if any. `ExtensionAccountsProvider` will automatically connect to this active account, if found, when subscribing to extension account. See the next prop for more details.
118-
119-
#### setActiveAccount
120-
`(address: string): void`
94+
## Values
12195
122-
Provide a setter function to call if the active account is found when subscribing to extension accounts.
96+
#### extensionsInitialised
97+
`string[]`
12398
99+
A record of the extensions that have been initialised along with their status.
124100
125-
## Values
126101
127-
#### connectExtensionAccounts
102+
#### connectExtension
128103
`(id: string): Promise<boolean>`
129104
130105
Call this function to connect to the provided extension id and subscribe to its accounts.
@@ -134,8 +109,7 @@ Call this function to connect to the provided extension id and subscribe to its
134109
135110
Geta a list of available extension accounts, formatted by the provided ss58 prefix.
136111
137-
#### extensionAccountsSynced
138-
`boolean`
139-
140-
Signals whether extensions are still being connected to and subscribed to. A value of true means that the process is complete.
112+
#### extensionsSynced
113+
`'unsynced' | 'syncing' | 'synced'`
141114
115+
Signals whether extensions are still being synced upon being initialised.

docs/pages/library/react-connect-kit/extensions.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ const { extensions } = useExtensions();
4141

4242
## Syncing Extensions
4343

44-
Web3 extensions are injected into the `window.injectedWeb3` object, which is an asynchronous process that happens when the window loads. For this reason, `ExtensionsProvider` also provides a `checkingInjectedWeb3` boolean value, that signals whether the initial check for injectedWeb3 is underway.
44+
Web3 extensions are injected into the `window.injectedWeb3` object, which is an asynchronous process that happens when the window loads. For this reason, `ExtensionsProvider` also provides a `gettingExtensions` boolean value, that signals whether the initial check for injectedWeb3 is underway.
4545

46-
`checkingInjectedWeb3` will initially be true, and updated to false once `window.injectedWeb3` is present, or if injectedWeb3 is not found after a 5 second timeout.
46+
`gettingExtensions` will initially be true, and updated to false once `window.injectedWeb3` is present, or if injectedWeb3 is not found after a 5 second timeout.
4747

4848
## Provider Values
4949

50-
#### checkingInjectedWeb3
50+
#### gettingExtensions
5151
`boolean`
5252

5353
Returns a boolean reflecting whether `window.injectedWeb3` is being checked.

0 commit comments

Comments
 (0)