Skip to content

Commit 8aedda1

Browse files
committed
Update web sdk reference
1 parent 10867b8 commit 8aedda1

File tree

79 files changed

+1149
-775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1149
-775
lines changed
File renamed without changes.

docs/sdk/pnp/web/modal/advanced/custom-authentication.mdx renamed to docs/sdk/pnp/web/advanced/custom-authentication.mdx

File renamed without changes.

docs/sdk/pnp/web/modal/advanced/other-chains.mdx renamed to docs/sdk/pnp/web/advanced/other-chains.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
### Adding a Custom Chain Configuration
22

3-
#### `chainConfig`
4-
5-
<ChainConfig />
6-
73
:::tip
84

95
Get the **Chain Config** for your preferred Blockchain from the
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/sdk/pnp/web/js/events.mdx

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
---
2+
title: Web3Auth Events & Status
3+
sidebar_label: SDK Events
4+
description: "@web3auth/no-modal Native Account Abstraction | Documentation - Web3Auth"
5+
---
6+
7+
import Tabs from "@theme/Tabs";
8+
import TabItem from "@theme/TabItem";
9+
import ChainConfig from "@site/src/common/sdk/pnp/web/_chain-config.mdx";
10+
11+
# Web3Auth Events & Status
12+
13+
This page documents the key properties and lifecycle events available from a Web3Auth instance.
14+
These allow you to track the connection status, react to changes, and build responsive user
15+
experiences.
16+
17+
## `connected`
18+
19+
Returns `true` if a wallet is connected, otherwise `false`.
20+
21+
#### Interface
22+
23+
```ts
24+
get connected(): boolean;
25+
```
26+
27+
#### Usage
28+
29+
```js
30+
const isConnected = web3auth.connected;
31+
```
32+
33+
## `provider`
34+
35+
Returns the current provider instance if connected.
36+
37+
#### Interface
38+
39+
```ts
40+
get provider(): IProvider | null;
41+
```
42+
43+
#### Usage
44+
45+
```js
46+
const provider = web3auth.provider;
47+
```
48+
49+
## `connectedConnectorName`
50+
51+
Name of the currently connected wallet connector, or `null` if not connected.
52+
53+
#### Interface
54+
55+
```ts
56+
connectedConnectorName: WALLET_CONNECTOR_TYPE | null;
57+
```
58+
59+
##### `WALLET_CONNECTOR_TYPE`
60+
61+
<Tabs>
62+
<TabItem value="table" label="Table">
63+
64+
| Event | Description |
65+
| ------------------- | ---------------------------- |
66+
| `AUTH` | Web3Auth connector. |
67+
| `WALLET_CONNECT_V2` | Wallet Connect V2 connector. |
68+
| `COINBASE` | Coinbase connector. |
69+
| `METAMASK` | Metamask connector. |
70+
71+
</TabItem>
72+
<TabItem value="interface" label="Interface">
73+
74+
```ts
75+
export type WALLET_CONNECTOR_TYPE = (typeof WALLET_CONNECTORS)[keyof typeof WALLET_CONNECTORS];
76+
export declare const WALLET_CONNECTORS: {
77+
readonly AUTH: "auth";
78+
readonly WALLET_CONNECT_V2: "wallet-connect-v2";
79+
readonly COINBASE: "coinbase";
80+
readonly METAMASK: "metamask";
81+
};
82+
```
83+
84+
</TabItem>
85+
</Tabs>
86+
87+
#### Usage
88+
89+
```js
90+
const connectorName = web3auth.connectedConnectorName;
91+
```
92+
93+
## `status`
94+
95+
Current status of the Web3Auth instance. Emits status change events.
96+
97+
#### Interface
98+
99+
```ts
100+
status: CONNECTOR_STATUS_TYPE;
101+
```
102+
103+
##### `CONNECTOR_STATUS_TYPE`
104+
105+
<Tabs>
106+
<TabItem value="table" label="Table">
107+
108+
| Event | Description |
109+
| --------------- | --------------------------------------------------------------- |
110+
| `NOT_READY` | Triggered when the connector is not ready. |
111+
| `READY` | Triggered when the connector is ready. |
112+
| `CONNECTING` | Triggered when a connection is being established. |
113+
| `CONNECTED` | Triggered when a wallet is successfully connected. |
114+
| `DISCONNECTING` | Triggered when the wallet is in the process of disconnecting. |
115+
| `DISCONNECTED` | Triggered when the wallet is disconnected. |
116+
| `ERRORED` | Triggered when an error occurs during the connection lifecycle. |
117+
118+
</TabItem>
119+
<TabItem value="interface" label="Interface">
120+
121+
```ts
122+
export type CONNECTOR_STATUS_TYPE = (typeof CONNECTOR_STATUS)[keyof typeof CONNECTOR_STATUS];
123+
export declare const CONNECTOR_STATUS: {
124+
readonly NOT_READY: "not_ready";
125+
readonly READY: "ready";
126+
readonly CONNECTING: "connecting";
127+
readonly CONNECTED: "connected";
128+
readonly DISCONNECTING: "disconnecting";
129+
readonly DISCONNECTED: "disconnected";
130+
readonly ERRORED: "errored";
131+
};
132+
```
133+
134+
</TabItem>
135+
</Tabs>
136+
137+
#### Usage
138+
139+
```js
140+
const status = web3auth.status;
141+
```
142+
143+
## `currentChain`
144+
145+
Returns the current chain configuration if connected.
146+
147+
#### Interface
148+
149+
```ts
150+
get currentChain(): CustomChainConfig | undefined;
151+
```
152+
153+
#### `chainConfig`
154+
155+
<ChainConfig />
156+
157+
#### Usage
158+
159+
```js
160+
const chain = web3auth.currentChain;
161+
```
162+
163+
## `connectedConnector`
164+
165+
Returns the connector instance for the connected wallet, or `null`.
166+
167+
#### Interface
168+
169+
```ts
170+
get connectedConnector(): IConnector<unknown> | null;
171+
```
172+
173+
#### Usage
174+
175+
```js
176+
const connector = web3auth.connectedConnector;
177+
```
178+
179+
## `accountAbstractionProvider`
180+
181+
Returns the account abstraction provider if available.
182+
183+
#### Interface
184+
185+
```ts
186+
get accountAbstractionProvider(): AccountAbstractionProvider | null;
187+
```
188+
189+
#### Usage
190+
191+
```js
192+
const aaProvider = web3auth.accountAbstractionProvider;
193+
```
194+
195+
## `getConnector`
196+
197+
Returns a connector instance for a given connector name and chain namespace.
198+
199+
#### Interface
200+
201+
```ts
202+
getConnector(connectorName: WALLET_CONNECTOR_TYPE, chainNamespace?: ChainNamespaceType): IConnector<unknown> | null;
203+
204+
export type WALLET_CONNECTOR_TYPE = (typeof WALLET_CONNECTORS)[keyof typeof WALLET_CONNECTORS];
205+
export declare const WALLET_CONNECTORS: {
206+
readonly AUTH: "auth";
207+
readonly WALLET_CONNECT_V2: "wallet-connect-v2";
208+
readonly COINBASE: "coinbase";
209+
readonly METAMASK: "metamask";
210+
};
211+
export type ChainNamespaceType = (typeof CHAIN_NAMESPACES)[keyof typeof CHAIN_NAMESPACES];
212+
```
213+
214+
#### Usage
215+
216+
```js
217+
const connector = web3auth.getConnector("WALLET_CONNECT_V2", "eip155");
218+
```
219+
220+
## `getPlugin`
221+
222+
Returns a plugin instance by name, or `null` if not found.
223+
224+
#### Interface
225+
226+
```ts
227+
getPlugin(name: string): IPlugin | null;
228+
229+
export interface IPlugin extends SafeEventEmitter {
230+
name: string;
231+
status: PLUGIN_STATUS_TYPE;
232+
SUPPORTED_CONNECTORS: WALLET_CONNECTOR_TYPE[];
233+
pluginNamespace: PluginNamespace;
234+
initWithWeb3Auth(web3auth: IWeb3AuthCore, whiteLabel?: WhiteLabelData): Promise<void>;
235+
connect(): Promise<void>;
236+
disconnect(): Promise<void>;
237+
cleanup(): Promise<void>;
238+
}
239+
```
240+
241+
#### Usage
242+
243+
```js
244+
const plugin = web3auth.getPlugin("walletServices");
245+
```

0 commit comments

Comments
 (0)