> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rhinestone.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Ecosystem

> Use embedded and external wallets through EIP-1193, viem, or wagmi.

The embedded wallet SDK exposes an EIP-1193 provider and a wagmi connector. Both reuse the shared [client initialization](/wallets/embedded-wallets/accounts#initialize-the-client) and route requests to the selected account: your application's embedded wallet or a connected external wallet.

## EIP-1193 provider

```ts theme={null}
import { createOneAuthProvider } from "@rhinestone/1auth"
import { oneAuth } from "./oneauth"

export const provider = createOneAuthProvider({
  client: oneAuth,
  chainId: 8453,
})
```

Calling `eth_requestAccounts` authenticates the user and returns the account address:

```ts theme={null}
const accounts = await provider.request({
  method: "eth_requestAccounts",
})

if (!Array.isArray(accounts) || typeof accounts[0] !== "string") {
  throw new Error("The provider did not return an account")
}

const [accountAddress] = accounts
```

To offer embedded and external wallets, call `wallet_connect` instead. See [Connect external wallets](/wallets/embedded-wallets/external-wallets/connect-external-wallets) for the connection flow.

The provider supports these common methods:

| Method                   | Purpose                                                         |
| ------------------------ | --------------------------------------------------------------- |
| `wallet_connect`         | Open the embedded-or-external wallet chooser.                   |
| `eth_requestAccounts`    | Request an account without opening the external-wallet chooser. |
| `eth_accounts`           | Return the connected account address.                           |
| `personal_sign`          | Sign an EIP-191 message.                                        |
| `eth_signTypedData_v4`   | Sign EIP-712 typed data.                                        |
| `eth_sendTransaction`    | Submit one transaction.                                         |
| `wallet_sendCalls`       | Submit a batch of calls.                                        |
| `wallet_getCallsStatus`  | Read batch status.                                              |
| `wallet_getCapabilities` | Read wallet capabilities.                                       |

Listen for standard provider events:

```ts theme={null}
provider.on("accountsChanged", (accounts) => {
  if (Array.isArray(accounts)) console.log(accounts[0])
})

provider.on("chainChanged", (chainId) => {
  console.log(chainId)
})
```

## viem

Wrap the same provider with a viem wallet client:

```ts theme={null}
import { createWalletClient, custom } from "viem"
import { base } from "viem/chains"
import { provider } from "./provider"

export const walletClient = createWalletClient({
  chain: base,
  transport: custom(provider),
})

const [accountAddress] = await walletClient.requestAddresses()
```

Use viem's standard wallet actions after connection. For an external wallet, connect through `wallet_connect` first and wrap the same provider. Embedded-wallet transactions require the sponsorship callbacks configured on the shared client; follow [Sponsorship setup](/transactions/sponsorship/set-up).

## wagmi

Create a connector around the same client:

```ts config.ts theme={null}
import { createConfig, http } from "wagmi"
import { base } from "wagmi/chains"
import { oneAuth as oneAuthConnector } from "@rhinestone/1auth/wagmi"
import { oneAuth } from "./oneauth"

export const config = createConfig({
  chains: [base],
  connectors: [oneAuthConnector({ client: oneAuth, chainId: base.id })],
  transports: {
    [base.id]: http(),
  },
})
```

Connect and read the account with standard wagmi hooks. The connector opens the embedded-or-external wallet chooser:

```tsx theme={null}
import { useAccount, useConnect } from "wagmi"

export function ConnectWalletButton() {
  const { address, isConnected } = useAccount()
  const { connect, connectors } = useConnect()
  const connector = connectors.find(({ id }) => id === "1auth")

  if (isConnected) return <span>{address}</span>
  if (!connector) return null

  return (
    <button onClick={() => connect({ connector })}>
      Connect wallet
    </button>
  )
}
```

## Availability

These examples use the public `@rhinestone/1auth` `0.10.2` release. The integrations expose the supported provider methods, not every method a browser extension wallet may implement. See [Use and manage connected wallets](/wallets/embedded-wallets/external-wallets/use-and-manage-connected-wallets) for external-wallet transaction and connection behavior.
