Skip to content

Commit 0d36011

Browse files
authored
Merge branch 'master' into add-guide-multiple-chains
2 parents f60e597 + f9e25a3 commit 0d36011

131 files changed

Lines changed: 4227 additions & 1576 deletions

File tree

Some content is hidden

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

docs/auth-provider-setup/social-providers/twitter.mdx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,27 @@ import TabItem from "@theme/TabItem";
1111

1212
:::note
1313

14-
Twitter login can be performed in various ways, depending on the use case. We have demonstrated this with Auth0 & Firebase, but this can be done with
15-
any other Federated/JWT providers.
14+
Twitter login can be performed in various ways, depending on the use case. We have demonstrated this
15+
with Auth0 & Firebase, but this can be done with any other Federated/JWT providers.
1616

1717
:::
1818

1919
## Set up [Twitter via Auth0](https://auth0.com/blog/how-to-add-a-twitter-social-connection-in-auth0/#Setup-Twitter-connection)
2020

21-
1. Create an Auth0 verifier for your application by selecting `Auth0` as the Login provider from this modal.
21+
1. Create an Auth0 verifier for your application by selecting `Auth0` as the Login provider from
22+
this modal.
2223
![Twitter - Login Providers list on Web3Auth Dashboard](/images/dashboard/create-verifier-auth0.png)
2324
2. Select `Twitter` as the **Authentication Type** based on the dropdown.
2425
![Twitter - Auth0 Authentication Type list on Web3Auth Dashboard](/images/dashboard/create-verifier-google.png)
25-
3. Enter the `Auth0 Client ID` and `Auth0 Domain` from your Auth0 application. See how to create a new Auth0 application
26-
[here](https://auth0.com/docs/quickstart/webapp/).
26+
3. Enter the `Auth0 Client ID` and `Auth0 Domain` from your Auth0 application. See how to create a
27+
new Auth0 application [here](https://auth0.com/docs/quickstart/webapp/).
2728

2829
![Twitter - Domain and Client ID from Auth0 Dashboard](/images/dashboard/create-verifier-auth0-filled-common.png)
2930
![Twitter - Auth0 Client ID and Auth0 Domain on Web3Auth Dashboard](/images/dashboard/create-verifier-auth0-unfilled.png)
3031

31-
4. Add the [Twitter Social Connection](https://marketplace.auth0.com/integrations/twitter-social-connection) to your Auth0 application.
32+
4. Add the
33+
[Twitter Social Connection](https://marketplace.auth0.com/integrations/twitter-social-connection)
34+
to your Auth0 application.
3235
5. Click on the `Create` button to create `Twitter` Custom Authentication via Auth0 verifier.
3336

3437
### Example
@@ -38,7 +41,8 @@ import { Web3AuthNoModal } from "@web3auth/no-modal";
3841
import { OpenloginAdapter } from "@web3auth/openlogin-adapter";
3942
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
4043

41-
const clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ";
44+
const clientId =
45+
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ";
4246
// get it from https://dashboard.web3auth.io by creating a project.
4347

4448
const chainConfig = {
@@ -214,7 +218,8 @@ import { ADAPTER_EVENTS, CHAIN_NAMESPACES, IProvider } from "@web3auth/base";
214218
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
215219
import { TwitterAuthProvider, getAuth, signInWithPopup, UserCredential } from "firebase/auth";
216220

217-
const clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ"; // get from https://dashboard.web3auth.io
221+
const clientId =
222+
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ"; // get from https://dashboard.web3auth.io
218223

219224
const verifier = "w3a-firebase-demo";
220225

@@ -223,7 +228,7 @@ const chainConfig = {
223228
chainId: "0x1", // Please use 0x1 for Mainnet
224229
rpcTarget: "https://rpc.ankr.com/eth",
225230
displayName: "Ethereum Mainnet",
226-
blockExplorer: "https://etherscan.io/",
231+
blockExplorerUrl: "https://etherscan.io/",
227232
ticker: "ETH",
228233
tickerName: "Ethereum",
229234
};
@@ -283,7 +288,8 @@ import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
283288
import { IProvider } from "@web3auth/base";
284289
import { TwitterAuthProvider, getAuth, signInWithPopup, UserCredential } from "firebase/auth";
285290

286-
const clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ"; // get from https://dashboard.web3auth.io
291+
const clientId =
292+
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ"; // get from https://dashboard.web3auth.io
287293

288294
const verifier = "w3a-firebase-demo";
289295

docs/connect-blockchain/xrpl.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ import GetUserInfoSnippet from "@site/src/common/docs/_get-userinfo.mdx";
1111
import TabItem from "@theme/TabItem";
1212
import Tabs from "@theme/Tabs";
1313

14-
The Web3Auth Web SDK offers a standard provider for accessing the user's private key on non-EVM chains like [XRPL](https://xrpl.org/). You can use our
15-
native `@web3auth/xrpl-provider` for making direct connections with XRPL Blockchain. This will provide an xrplProvider that can be injected back into
16-
the Web3Auth instance, allowing you to perform actions such as retrieving account information, obtaining balances, signing and sending transactions,
17-
and reading from and writing to smart contracts. Here are some methods to help you quickly get started.
14+
The Web3Auth Web SDK offers a standard provider for accessing the user's private key on non-EVM
15+
chains like [XRPL](https://xrpl.org/). You can use our native `@web3auth/xrpl-provider` for making
16+
direct connections with XRPL Blockchain. This will provide an xrplProvider that can be injected back
17+
into the Web3Auth instance, allowing you to perform actions such as retrieving account information,
18+
obtaining balances, signing and sending transactions, and reading from and writing to smart
19+
contracts. Here are some methods to help you quickly get started.
1820

1921
## Installation
2022

@@ -49,7 +51,7 @@ const chainConfig = {
4951
ticker: "XRP",
5052
tickerName: "XRPL",
5153
displayName: "xrpl mainnet",
52-
blockExplorer: "https://livenet.xrpl.org",
54+
blockExplorerUrl: "https://livenet.xrpl.org",
5355
};
5456
```
5557

@@ -70,7 +72,7 @@ const chainConfig = {
7072
ticker: "XRP",
7173
tickerName: "XRPL",
7274
displayName: "xrpl testnet",
73-
blockExplorer: "https://testnet.xrpl.org",
75+
blockExplorerUrl: "https://testnet.xrpl.org",
7476
};
7577
```
7678

@@ -91,7 +93,7 @@ const chainConfig = {
9193
ticker: "XRP",
9294
tickerName: "XRPL",
9395
displayName: "xrpl devnet",
94-
blockExplorer: "https://devnet.xrpl.org",
96+
blockExplorerUrl: "https://devnet.xrpl.org",
9597
};
9698
```
9799

docs/sdk/core-kit/mpc-core-kit/authentication.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: "Authentication in MPC Core Kit Web SDK"
2+
title: "Authentication in MPC Core Kit JS SDK"
33
sidebar_label: "Authentication"
44
displayed_sidebar: sdk
5-
description: "Web3Auth MPC Core Kit Web SDK - Authentication | Documentation - Web3Auth"
5+
description: "Web3Auth MPC Core Kit JS SDK - Authentication | Documentation - Web3Auth"
66
---
77

88
import ServiceWorkerCode from "@site/src/common/sdk/core-kit/tkey/_sw-js.mdx";
@@ -53,6 +53,15 @@ MPC functionalities.
5353
| ------------- | -------- | ---------------- | --------- |
5454
| `loginParams` | `object` | Login Parameters | Yes |
5555

56+
:::tip React Native
57+
58+
While using the application in React Native, you can use the `ux_mode` as `react-native`, this helps
59+
you to use the SDK in a React Native environment. However, the implicit login flow doesn't work in
60+
React Native, you need to manually call the login with JWT function for it after getting the JWT
61+
token from the auth provider.
62+
63+
:::
64+
5665
### `OauthLoginParams`
5766

5867
<Tabs

docs/sdk/core-kit/mpc-core-kit/initialize.mdx

Lines changed: 122 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: "Initializing MPC Core Kit Web SDK"
2+
title: "Initializing MPC Core Kit JS SDK"
33
sidebar_label: "Initialize"
44
displayed_sidebar: sdk
5-
description: "Web3Auth MPC Core Kit Web SDK - Initialize | Documentation - Web3Auth"
5+
description: "Web3Auth MPC Core Kit JS SDK - Initialize | Documentation - Web3Auth"
66
---
77

88
import ChainConfig from "@site/src/common/sdk/pnp/web/_chain-config.mdx";
@@ -15,6 +15,7 @@ After Installation, the next step to use Web3Auth MPC Core Kit is to Initialize
1515
However, the Initialization is a two step process, ie.
1616

1717
- [Instantiation of `Web3AuthMPCCoreKit`](#instantiating-web3auth)
18+
- [Instantiation of the Signing Provider package](#instantiating-provider)
1819
- [Initialization of `Web3AuthMPCCoreKit`](#initializing-web3auth)
1920

2021
## Instantiating Web3Auth
@@ -25,6 +26,38 @@ However, the Initialization is a two step process, ie.
2526
import { Web3AuthMPCCoreKit, WEB3AUTH_NETWORK } from "@web3auth/mpc-core-kit";
2627
```
2728

29+
:::info Additional imports needed for React Native
30+
31+
In order to make this SDK compatible with the React Native development environment, you need to
32+
additionally import the following packages:
33+
34+
```tsx
35+
import EncryptedStorage from "react-native-encrypted-storage"; // Used to store the session & device factor keys
36+
import * as TssLibRN from "@toruslabs/react-native-tss-lib-bridge"; // The TSS library for React Native
37+
import { Bridge } from "@toruslabs/react-native-tss-lib-bridge"; // A bridge to be imported to the React Native environment
38+
```
39+
40+
While initializing the SDK, you need to pass the `EncryptedStorage` and `TssLibRN` as arguments to
41+
the `Web3AuthOptions` object. The `Bridge` is used to bridge the TSS library to the React Native
42+
environment, it has to be imported in the React Native environment, at the end of the page.
43+
44+
```tsx title="App.tsx"
45+
import { Bridge } from "@toruslabs/react-native-tss-lib-bridge";
46+
47+
export default function App() {
48+
// Misc App related functions
49+
return (
50+
<View>
51+
{/* <YOUR APP GOES HERE> */}
52+
// highlight-next-line
53+
<Bridge /> // <- Add this line
54+
</View>
55+
);
56+
}
57+
```
58+
59+
:::
60+
2861
#### Assign the `Web3AuthMPCCoreKit` class to a variable
2962

3063
```javascript
@@ -202,18 +235,6 @@ export declare const UX_MODE: {
202235

203236
</Tabs>
204237

205-
#### Adding a Custom Chain Configuration
206-
207-
:::warning
208-
209-
Currently Web3Auth MPC Core Kit supports **only EVM Compatible Chains**. We're constantly working on adding support for more chains.
210-
211-
:::
212-
213-
#### `chainConfig`
214-
215-
<ChainConfig />
216-
217238
##### Usage
218239

219240
```javascript
@@ -232,14 +253,98 @@ chainConfig: {
232253

233254
### Example
234255

256+
#### Web
257+
235258
```javascript
259+
import { Web3AuthMPCCoreKit, WEB3AUTH_NETWORK } from "@web3auth/mpc-core-kit";
260+
236261
const coreKitInstance = new Web3AuthMPCCoreKit({
237-
web3AuthClientId: "BILuyqFCuDXAqVmAuMbD3c4oWEFd7PUENVPyVC-zmsF9euHAvUjqbTCpKw6gO05DBif1YImIVtyaxmEbcLLlb6w",
262+
web3AuthClientId:
263+
"BILuyqFCuDXAqVmAuMbD3c4oWEFd7PUENVPyVC-zmsF9euHAvUjqbTCpKw6gO05DBif1YImIVtyaxmEbcLLlb6w",
238264
web3AuthNetwork: WEB3AUTH_NETWORK.MAINNET,
239265
uxMode: "popup",
266+
manualSync: true, // This is the recommended approach
267+
});
268+
```
269+
270+
#### React Native
271+
272+
```ts
273+
import { Web3AuthMPCCoreKit, WEB3AUTH_NETWORK } from "@web3auth/mpc-core-kit";
274+
import EncryptedStorage from "react-native-encrypted-storage"; // Used to store the session & device factor keys
275+
import * as TssLibRN from "@toruslabs/react-native-tss-lib-bridge"; // The TSS library for React Native
276+
277+
const coreKitInstance = new Web3AuthMPCCoreKit({
278+
web3AuthClientId:
279+
"BILuyqFCuDXAqVmAuMbD3c4oWEFd7PUENVPyVC-zmsF9euHAvUjqbTCpKw6gO05DBif1YImIVtyaxmEbcLLlb6w",
280+
web3AuthNetwork: WEB3AUTH_NETWORK.MAINNET,
281+
chainConfig,
282+
setupProviderOnInit: false,
283+
uxMode: "react-native",
284+
asyncStorageKey: {
285+
getItem: async (key: string) => {
286+
return EncryptedStorage.getItem(key);
287+
},
288+
setItem: async (key: string, value: string) => {
289+
return EncryptedStorage.setItem(key, value);
290+
},
291+
},
292+
tssLib: TssLibRN,
293+
manualSync: true, // This is the recommended approach
240294
});
241295
```
242296

297+
## Instantiating Provider
298+
299+
As a next step, you need to set up the particular signing provider from Web3Auth and pass the
300+
`coreKitInstance` into it. This provider is used to make calls to the selected blockchain.
301+
Currently, Web3Auth exposes the following signing provider packages to be integrated within the SDK:
302+
303+
- [EthereumSigningProvider](/sdk/providers/evm-mpc)
304+
305+
#### Adding a Custom Chain Configuration
306+
307+
:::warning
308+
309+
Currently Web3Auth MPC Core Kit supports **only EVM Compatible Chains**. We're constantly working on
310+
adding support for more chains.
311+
312+
:::
313+
314+
#### `chainConfig`
315+
316+
<ChainConfig />
317+
318+
<Tabs
319+
defaultValue="eth"
320+
values={[
321+
{ label: "ETH", value: "eth" },
322+
]}
323+
>
324+
325+
<TabItem value="eth">
326+
327+
```javascript title="Usage"
328+
import { EthereumSigningProvider } from "@web3auth/ethereum-mpc-provider";
329+
import { CHAIN_NAMESPACES } from "@web3auth/base";
330+
331+
const chainConfig = {
332+
chainNamespace: CHAIN_NAMESPACES.EIP155,
333+
chainId: "0xaa36a7", // Please use 0x1 for Mainnet
334+
rpcTarget: "https://rpc.ankr.com/eth_sepolia",
335+
displayName: "Ethereum Sepolia Testnet",
336+
blockExplorerUrl: "https://sepolia.etherscan.io/",
337+
ticker: "ETH",
338+
tickerName: "Ethereum",
339+
};
340+
341+
const evmProvider = new EthereumSigningProvider({ config: { chainConfig } });
342+
evmProvider.setupProvider(coreKitInstance);
343+
```
344+
345+
</TabItem>
346+
</Tabs>
347+
243348
## Initializing Web3Auth
244349

245350
#### `init(params?: InitParams)`
@@ -282,7 +387,8 @@ export interface InitParams {
282387

283388
</Tabs>
284389

285-
The final step in the initialization process is to initialize the `Web3AuthMPCCoreKit` instance, ie. `coreKitInstance` in our case.
390+
The final step in the initialization process is to initialize the `Web3AuthMPCCoreKit` instance, ie.
391+
`coreKitInstance` in our case.
286392

287393
This is done by calling the `init()` function of `coreKitInstance`.
288394

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,53 @@
11
---
2-
title: "Installing MPC Core Kit Web SDK"
2+
title: "Installing MPC Core Kit JS SDK"
33
sidebar_label: "Install"
44
displayed_sidebar: sdk
5-
description: "Web3Auth MPC Core Kit Web SDK - Install | Documentation - Web3Auth"
5+
description: "Web3Auth MPC Core Kit JS SDK - Install | Documentation - Web3Auth"
66
---
77

8-
98
## [`@web3auth/mpc-core-kit`](https://npmjs.com/package/@web3auth/mpc-core-kit)
109

1110
```bash npm2yarn
1211
npm install --save @web3auth/mpc-core-kit
1312
```
1413

15-
## Consider adding `@web3auth/base` to your project
14+
This package gives access to common types and interfaces for Web3Auth. This comes in handy by
15+
providing you a standard way of importing the values you need to work with the SDKs. We highly
16+
recommend using it while working with `Typescript`.
1617

17-
```bash npm2yarn
18-
npm install --save @web3auth/base
19-
```
18+
## Helper SDKs
19+
20+
### Provider packages
21+
22+
For making RPC calls within your dApp, Web3Auth exposes respective providers for different chains.
23+
This provider can be used to interact with the connected chain using exposed functions within the
24+
provider.
25+
26+
:::tip
27+
28+
Checkout the [Providers SDK Reference](/sdk/providers) to learn more.
29+
30+
- [For EVM based Chains `@web3auth/ethereum-mpc-provider`](/sdk/providers/evm-mpc)
31+
32+
:::
33+
34+
### Common Types and Interfaces
35+
36+
#### [`@web3auth/base`](https://npmjs.com/package/@web3auth/base)
2037

21-
This package gives access to common types and interfaces for Web3Auth. This comes in handy by providing you a standard way of importing the values you
22-
need to work with the SDKs. We highly recommend using it while working with `Typescript`.
38+
This package gives access to common types and interfaces for Web3Auth. This comes in handy by
39+
providing you a standard way of importing the values you need to work with the SDKs. We highly
40+
recommend using it while working with Typescript.
2341

2442
## Troubleshooting
2543

2644
### Bundler Issues: Missing Dependencies
2745

28-
You might face issues mentioning that certain dependencies are missing within the browser environment. These are node dependencies that need to be
29-
polyfilled in your application, to enable Web3Auth functionalities. Furthermore, your bundler needs to be reconfigured to use them while building the
30-
app. We have created guides for different bundlers to help you with this issue:
46+
You might face issues mentioning that certain dependencies are missing within the browser
47+
environment. These are node dependencies that need to be polyfilled in your application, to enable
48+
Web3Auth functionalities. Furthermore, your bundler needs to be reconfigured to use them while
49+
building the app. We have created guides for different bundlers to help you with this issue:
3150

3251
- Please check out our **[Webpack 5 Troubleshooting Guide](/troubleshooting/webpack-issues)**
3352
- Please check out our **[Vite Troubleshooting Guide](/troubleshooting/vite-issues)**
53+
- Please check out our **[React Native Troubleshooting Guide](/troubleshooting/metro-issues-mpc)**

0 commit comments

Comments
 (0)