Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Tabs from '@theme/Tabs'
>

- Chain Namespace: SOLANA
- Chain ID: 0x1 (Use 0x1 for Mainnet, 0x2 for Testnet, 0x3 for Devnet)
- Chain ID: 0x65 (Use 0x65 for Mainnet, 0x66 for Testnet, 0x67 for Devnet)
- Public RPC URL: `https://api.mainnet-beta.solana.com` (Avoid using public rpcTarget in production,
use services like Infura)
- Display Name: Solana Mainnet
Expand All @@ -31,11 +31,11 @@ import Tabs from '@theme/Tabs'
>

- Chain Namespace: SOLANA
- Chain ID: 0x2 (Use 0x1 for Mainnet, 0x2 for Testnet, 0x3 for Devnet)
- Chain ID: 0x66 (Use 0x65 for Mainnet, 0x66 for Testnet, 0x67 for Devnet)
- Public RPC URL: `https://api.testnet.solana.com` (Avoid using public rpcTarget in production, use
services like Infura)
- Display Name: Solana Testnet
- Block Explorer Link: `https://explorer.solana.com`
- Block Explorer Link: `https://explorer.solana.com?cluster=testnet`
- Ticker: SOL
- Ticker Name: Solana
- Logo: https://images.toruswallet.io/solana.svg
Expand All @@ -49,7 +49,7 @@ From v11 onward, the Embedded Wallets Web SDK does not need any additional setup
Solana. All is handled on the dashboard.

```tsx
import { Web3Auth, WEB3AUTH_NETWORK } from '@web3auth/modal'
import { WEB3AUTH_NETWORK, type Web3AuthOptions } from '@web3auth/modal'

const web3AuthOptions: Web3AuthOptions = {
clientId,
Expand Down
6 changes: 4 additions & 2 deletions embedded-wallets/connect-blockchain/evm/tron/web.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ npm install @web3auth/modal tronweb

## Initialize Embedded Wallets

Configure chains on the [Embedded Wallets dashboard](/embedded-wallets/dashboard/chains-and-networks/).
For Tron Shasta testnet, use a dashboard chain with RPC `https://api.shasta.trongrid.io`.
You don't need Tron-specific chain configuration in the SDK. Keep the default chains from the
[Embedded Wallets dashboard](/embedded-wallets/dashboard/chains-and-networks/). TronWeb connects to
the Tron network directly through its own `fullHost` RPC URL (for example, Shasta testnet at
`https://api.shasta.trongrid.io`).

```typescript
import { Web3Auth, WEB3AUTH_NETWORK } from '@web3auth/modal'
Expand Down
5 changes: 3 additions & 2 deletions embedded-wallets/connect-blockchain/other/near.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ npm install --save @web3auth/modal near-api-js@4.0.4

After a user logs in, they receive a provider from the Embedded Wallets SDK. However, there is no native provider for Near, so we use the private key to make RPC calls directly.

To access the user's private key, the application can use `web3auth.connection?.ethereumProvider?.request({ method: 'private_key' })`. Since Near requires `ed25519`, use `getED25519Key()` (from the same package set) to convert the `secp256k1` key to an `ed25519` key.
To access the user's private key, the application can use `web3auth.connection?.ethereumProvider?.request({ method: 'private_key' })`. Since Near requires `ed25519`, use `getED25519Key()` (exported from `@web3auth/modal`) to convert the `secp256k1` key to an `ed25519` key.

```tsx
import { connect, KeyPair, keyStores, utils } from 'near-api-js'
Expand All @@ -87,7 +87,8 @@ const privateKey = await web3authProvider.request({ method: 'private_key' })
// Convert the secp256k1 key to ed25519 key
// When starting your application with "solana" namespace, you can skip the below two lines
// and pass the privateKey directly to buffer.
const privateKeyEd25519 = getED25519Key(privateKey).sk.toString('hex')
// getED25519Key returns `sk` as a Uint8Array
const privateKeyEd25519 = Buffer.from(getED25519Key(privateKey).sk).toString('hex')

// Convert the private key to Buffer
const privateKeyEd25519Buffer = Buffer.from(privateKeyEd25519, 'hex')
Expand Down
99 changes: 42 additions & 57 deletions embedded-wallets/connect-blockchain/other/xrpl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ description: 'Integrate Web3Auth with the XRPL Blockchain | Embedded Wallets'
import TabItem from '@theme/TabItem'
import Tabs from '@theme/Tabs'

The Embedded Wallets Web SDK uses `@web3auth/xrpl-provider` for XRPL JSON-RPC methods such as
`xrpl_getAccounts` and `xrpl_signTransaction`. After sign-in, read that provider from the auth
connector. Do not use `connection.ethereumProvider`, which is the EVM EIP-1193 provider for Wagmi and
`eth_*` methods.
The Embedded Wallets Web SDK includes an XRPL private key provider, `XrplPrivateKeyProvider`,
exported from the `@web3auth/modal/providers/xrpl-provider` subpath. It handles XRPL JSON-RPC
methods such as `xrpl_getAccounts` and `xrpl_signTransaction`. After sign-in, send these requests
through `connection.ethereumProvider`, which routes to the XRPL provider when you pass it as
`privateKeyProvider`.

## Installation

To interact with the XRPL blockchain, you can use the `@web3auth/xrpl-provider` package.

```bash npm2yarn
npm install --save @web3auth/xrpl-provider
npm install --save @web3auth/modal xrpl
```

### Getting the `chainConfig`
Expand All @@ -37,11 +36,11 @@ npm install --save @web3auth/xrpl-provider
value="mainnet"
>

- Chain Namespace: OTHER
- Chain Namespace: XRPL
- Chain ID: 0x1
- Public RPC URL: `https://ripple-node.tor.us` (Avoid using public rpcTarget in production, use
services like Infura)
- WebSocket URL: wss://s2.ripple.com
- WebSocket URL (`wsTarget`): wss://s2.ripple.com
- Ticker: XRP
- Ticker Name: XRPL
- Display Name: xrpl mainnet
Expand All @@ -53,11 +52,11 @@ npm install --save @web3auth/xrpl-provider
value="testnet"
>

- Chain Namespace: OTHER
- Chain ID: 0x2
- Chain Namespace: XRPL
- Chain ID: 0x6
- Public RPC URL: `https://testnet-ripple-node.tor.us` (Avoid using public rpcTarget in production,
use services like Infura)
- WebSocket URL: wss://s.altnet.rippletest.net
- WebSocket URL (`wsTarget`): wss://s.altnet.rippletest.net
- Ticker: XRP
- Ticker Name: XRPL
- Display Name: xrpl testnet
Expand All @@ -69,11 +68,11 @@ npm install --save @web3auth/xrpl-provider
value="devnet"
>

- Chain Namespace: OTHER
- Chain Namespace: XRPL
- Chain ID: 0x3
- Public RPC URL: `https://devnet-ripple-node.tor.us` (Avoid using public rpcTarget in production, use
services like Infura)
- WebSocket URL: wss://s.devnet.rippletest.net/
- WebSocket URL (`wsTarget`): wss://s.devnet.rippletest.net/
- Ticker: XRP
- Ticker Name: XRPL
- Display Name: xrpl devnet
Expand All @@ -84,70 +83,56 @@ npm install --save @web3auth/xrpl-provider

## Initializing provider

From v11 onward, enable XRPL on the [dashboard](/embedded-wallets/dashboard/chains-and-networks/).
You do not need to pass a `chains` array in code for standard XRPL networks.
XRPL requires an `XrplPrivateKeyProvider` passed as `privateKeyProvider` in
[`Web3AuthOptions`](/embedded-wallets/sdk/js/advanced/#web3authoptions). Without it, initialization
fails for XRPL chains. Pass the XRPL chain in `chains` and set it as `defaultChainId`. The chain
config must include `wsTarget`.

```tsx
import { Web3Auth, WALLET_CONNECTORS, WEB3AUTH_NETWORK } from '@web3auth/modal'
import { CHAIN_NAMESPACES, Web3Auth, WEB3AUTH_NETWORK } from '@web3auth/modal'
import type { IProvider } from '@web3auth/modal'

const web3AuthOptions: Web3AuthOptions = {
clientId,
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
import { XrplPrivateKeyProvider } from '@web3auth/modal/providers/xrpl-provider'

const chain = {
chainNamespace: CHAIN_NAMESPACES.XRPL,
chainId: '0x6',
rpcTarget: 'https://testnet-ripple-node.tor.us',
wsTarget: 'wss://s.altnet.rippletest.net',
ticker: 'XRP',
tickerName: 'XRPL',
displayName: 'xrpl testnet',
blockExplorerUrl: 'https://testnet.xrpl.org',
logo: '',
}

const web3auth = new Web3Auth(web3AuthOptions)

await web3auth.init()

await web3auth.connect()
// await web3auth.connectTo(WALLET_CONNECTORS.AUTH, { ... }); // For custom flow

// XRPL RPC, not connection.ethereumProvider (EVM only).
const provider: IProvider | null = web3auth.getConnector(WALLET_CONNECTORS.AUTH)?.provider ?? null
```

### Custom chain configuration in code

If you override RPC endpoints or chain IDs in code, pass an `XrplPrivateKeyProvider` as
`privateKeyProvider` (see [`Web3AuthOptions`](/embedded-wallets/sdk/js/advanced/#web3authoptions)):

```tsx
import { CHAIN_NAMESPACES } from '@web3auth/modal'
import { XrplPrivateKeyProvider } from '@web3auth/xrpl-provider'
import { Web3Auth, WALLET_CONNECTORS, WEB3AUTH_NETWORK } from '@web3auth/modal'

const privateKeyProvider = new XrplPrivateKeyProvider({
config: {
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.OTHER,
chainId: '0x2',
rpcTarget: 'https://testnet-ripple-node.tor.us',
displayName: 'xrpl testnet',
ticker: 'XRP',
tickerName: 'XRPL',
},
},
config: { chain, chains: [chain] },
})

const web3auth = new Web3Auth({
clientId,
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
privateKeyProvider,
chains: [chain],
defaultChainId: '0x6',
})

await web3auth.init()
await web3auth.connect()

const provider = web3auth.getConnector(WALLET_CONNECTORS.AUTH)?.provider ?? null
const provider: IProvider | null = web3auth.connection?.ethereumProvider ?? null
```

In React, pass the same options in `web3AuthOptions` of `Web3AuthContextConfig` and read the
provider from `useWeb3Auth().connection?.ethereumProvider`. See the
[XRPL example on GitHub](https://github.com/Web3Auth/web3auth-examples/tree/main/other/xrpl-example).

## Get account and Balance

```tsx
try {
// provider is from above
const accounts = await provider.request<string[]>({
const accounts = await provider.request<never, string[]>({
method: 'xrpl_getAccounts',
})

Expand Down Expand Up @@ -182,7 +167,7 @@ try {
import { Payment, xrpToDrops } from 'xrpl'

try {
const accounts = await provider.request<string[]>({
const accounts = await provider.request<never, string[]>({
method: 'xrpl_getAccounts',
})

Expand Down Expand Up @@ -214,7 +199,7 @@ try {
import { Payment, xrpToDrops } from 'xrpl'

try {
const accounts = await provider.request<string[]>({
const accounts = await provider.request<never, string[]>({
method: 'xrpl_getAccounts',
})

Expand Down Expand Up @@ -248,7 +233,7 @@ import { convertStringToHex } from 'xrpl'
try {
const msg = 'Hello world'
const hexMsg = convertStringToHex(msg)
const txSign = await provider.request<{ signature: string }>({
const txSign = await provider.request<{ message: string }, { signature: string }>({
method: 'xrpl_signMessage',
params: {
message: hexMsg,
Expand Down
8 changes: 4 additions & 4 deletions embedded-wallets/connect-blockchain/solana/javascript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ While using the Embedded Wallets Web SDK, read `connection.solanaWallet` from `w
<TabItem value="mainnet">

- Chain Namespace: SOLANA
- Chain ID: 0x1
- Chain ID: 0x65
- Public RPC URL: `https://api.mainnet-beta.solana.com` (avoid public RPC in production; prefer managed services)
- Display Name: Solana Mainnet
- Block Explorer Link: `https://explorer.solana.com`
Expand All @@ -37,10 +37,10 @@ While using the Embedded Wallets Web SDK, read `connection.solanaWallet` from `w
<TabItem value="testnet">

- Chain Namespace: SOLANA
- Chain ID: 0x2
- Chain ID: 0x66
- Public RPC URL: `https://api.testnet.solana.com` (avoid public RPC in production; prefer managed services)
- Display Name: Solana Testnet
- Block Explorer Link: `https://explorer.solana.com`
- Block Explorer Link: `https://explorer.solana.com?cluster=testnet`
- Ticker: SOL
- Ticker Name: Solana
- Logo: https://images.toruswallet.io/solana.svg
Expand All @@ -50,7 +50,7 @@ While using the Embedded Wallets Web SDK, read `connection.solanaWallet` from `w
<TabItem value="devnet">

- Chain Namespace: SOLANA
- Chain ID: 0x3
- Chain ID: 0x67
- Public RPC URL: `https://api.devnet.solana.com` (avoid public RPC in production; prefer managed services)
- Display Name: Solana Devnet
- Block Explorer Link: `https://explorer.solana.com?cluster=devnet`
Expand Down
8 changes: 4 additions & 4 deletions embedded-wallets/connect-blockchain/solana/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ While using the Embedded Wallets React SDK, you get access to native Solana hook
<TabItem value="mainnet">

- Chain Namespace: SOLANA
- Chain ID: 0x1
- Chain ID: 0x65
- Public RPC URL: `https://api.mainnet-beta.solana.com` (avoid public RPC in production; prefer managed services)
- Display Name: Solana Mainnet
- Block Explorer Link: `https://explorer.solana.com`
Expand All @@ -37,10 +37,10 @@ While using the Embedded Wallets React SDK, you get access to native Solana hook
<TabItem value="testnet">

- Chain Namespace: SOLANA
- Chain ID: 0x2
- Chain ID: 0x66
- Public RPC URL: `https://api.testnet.solana.com` (avoid public RPC in production; prefer managed services)
- Display Name: Solana Testnet
- Block Explorer Link: `https://explorer.solana.com`
- Block Explorer Link: `https://explorer.solana.com?cluster=testnet`
- Ticker: SOL
- Ticker Name: Solana
- Logo: https://images.toruswallet.io/solana.svg
Expand All @@ -50,7 +50,7 @@ While using the Embedded Wallets React SDK, you get access to native Solana hook
<TabItem value="devnet">

- Chain Namespace: SOLANA
- Chain ID: 0x3
- Chain ID: 0x67
- Public RPC URL: `https://api.devnet.solana.com` (avoid public RPC in production; prefer managed services)
- Display Name: Solana Devnet
- Block Explorer Link: `https://explorer.solana.com?cluster=devnet`
Expand Down
8 changes: 4 additions & 4 deletions embedded-wallets/connect-blockchain/solana/vue.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ While using the Embedded Wallets Vue SDK, you get access to native Solana compos
<TabItem value="mainnet">

- Chain Namespace: SOLANA
- Chain ID: 0x1
- Chain ID: 0x65
- Public RPC URL: `https://api.mainnet-beta.solana.com` (avoid public RPC in production; prefer managed services)
- Display Name: Solana Mainnet
- Block Explorer Link: `https://explorer.solana.com`
Expand All @@ -37,10 +37,10 @@ While using the Embedded Wallets Vue SDK, you get access to native Solana compos
<TabItem value="testnet">

- Chain Namespace: SOLANA
- Chain ID: 0x2
- Chain ID: 0x66
- Public RPC URL: `https://api.testnet.solana.com` (avoid public RPC in production; prefer managed services)
- Display Name: Solana Testnet
- Block Explorer Link: `https://explorer.solana.com`
- Block Explorer Link: `https://explorer.solana.com?cluster=testnet`
- Ticker: SOL
- Ticker Name: Solana
- Logo: https://images.toruswallet.io/solana.svg
Expand All @@ -50,7 +50,7 @@ While using the Embedded Wallets Vue SDK, you get access to native Solana compos
<TabItem value="devnet">

- Chain Namespace: SOLANA
- Chain ID: 0x3
- Chain ID: 0x67
- Public RPC URL: `https://api.devnet.solana.com` (avoid public RPC in production; prefer managed services)
- Display Name: Solana Devnet
- Block Explorer Link: `https://explorer.solana.com?cluster=devnet`
Expand Down
2 changes: 1 addition & 1 deletion embedded-wallets/dashboard/advanced/user-details.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function UserProfile() {

return (
<div>
<p>Primary login: {userInfo?.typeOfLogin}</p>
<p>Primary login: {userInfo?.authConnection}</p>
<ul>
{userInfo?.linkedAccounts?.map(account => (
<li key={account.id}>
Expand Down
10 changes: 7 additions & 3 deletions embedded-wallets/features/consent-screen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ The consent screen ships in **Web SDK v11** (`@web3auth/modal` for JavaScript, R

:::

Embedded Wallets displays a consent screen during social login so users understand what data is shared before they authenticate.
Embedded Wallets can display a consent screen after a user signs in so users accept your terms and privacy policy before the session becomes usable.
This helps your dapp meet transparency expectations under privacy frameworks such as GDPR and CCPA.

## What the consent screen shows

During social login, users see:
After sign-in, users see:

- Your application name and brand logo (if configured).
- Links to your terms of service and privacy policy.
- A clear prompt to accept before the OAuth flow continues.
- A clear prompt to accept before the SDK completes the connection.

The SDK only shows the consent screen when consent is enabled and both a terms of service link and a
privacy policy link are set (`uiConfig.consentRequired`, `uiConfig.tncLink`, and
`uiConfig.privacyPolicy`).

Configure terms and privacy links on the [Customization](/embedded-wallets/dashboard/customization/) page under **Custom terms and conditions / privacy policy**.

Expand Down
Loading
Loading