Skip to content

Commit

Permalink
Merge pull request #18 from phantom/brian/docs
Browse files Browse the repository at this point in the history
Add readme
  • Loading branch information
bfriel authored Nov 19, 2024
2 parents 70cce5d + 7edee03 commit c277972
Showing 1 changed file with 102 additions and 1 deletion.
103 changes: 102 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,102 @@
# wallet-sdk
# Phantom Embedded Wallet SDK

Phantom Embedded enables you to seamlessly onboard users to your application, without requiring them to have previously installed a wallet. With Phantom Embedded, users can create a self custodial wallet with just their Google account and a 4-digit pin. Once created, this wallet will automatically sync with [Phantom](https://phantom.app)'s mobile and extension apps without the user needing to know their seed phrase or manage any private keys.

In addition to powering wallet creation, Phantom Embedded also comes with a built-in UI for users to view and manage their holdings. This UI serves as a trusted interface for users to sign messages and transactions on your app.

## Features

- Create self custodial wallets without leaving application
- Onboard via Sign in with Google and 4-digit pin (no seed phrases)
- Wallets automatically sync with Phantom's mobile and extension apps
- Sign transactions and message on Solana (more chains coming soon)
- View, send, and receive tokens on Solana, Ethereum, Bitcoin, Base, and Polygon
- Pricing: **FREE**

## Quickstart

1. Install the Phantom Embedded SDK

```bash
yarn | npm | pnpm add @phantom/wallet-sdk
```

2. Load the Phantom Embedded wallet in your web application

```jsx
import { createPhantom } from "@phantom/wallet-sdk"

const App = () => {
useEffect(() => {
createPhantom();
}, []);
...
}
```

3. [Integrate Phantom](https://docs.phantom.app/solana/integrating-phantom) as you would normally. Whenever a user interacts with Phantom (e.g. `window.phantom.connect()`), the Phantom Embedded wallet will automatically initialize if the user does not have Phantom already installed.

## Configuration

The following optional parameters can be passed as `createPhantom({options..})` to customize the Phantom Embedded wallet experience.

| Parameter | Type | Description |
| ----------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
| `hideLauncherBeforeOnboarded` | boolean | If `true`, the Phantom Embedded UI will be hidden until the user engages with Phantom. |
| `colorScheme` | string | The background color of the Phantom Embedded iframe. Can be `"light"`, `"dark"`, or `"normal"`. Defaults to `"normal"`. |
| `zIndex` | string | The z-index of the Phantom Embedded UI. Defaults to `"10_000"`. |
| `paddingBottom` | string | The number of pixels between the Phantom Embedded UI and the right edge of the web. Defaults to `"0"`. |
| `paddingRight` | string | The number of pixels between the Phantom Embedded UI and the bottom edge of the web. Defaults to `"0"`. |

## See It In Action

Try out Phantom Embedded via our demo app: https://sandbox.phantom.dev/sol-embedded-sandbox

> Note: Phantom Embedded will not initialize if it detects that the user already has the Phantom extension installed, or if the user is accessing the page from within the Phantom mobile app.
## Give Feedback

Phantom Embedded is in active development and will be prioritizing features requested by early adopters. If you are interested in working with us, please email us at `[email protected]` or message `@brianfriel` on Telegram.

## Frequently Asked Questions

<details>
<summary>How does the embedded wallet work with the Phantom extension?</summary>

If the Phantom extension is detected, we will not inject the embedded wallet. Phantom users can continue using their extension like normal.

</details>
<details>
<summary>What does `createPhantom()` do?</summary>

The Phantom embedded wallet lives inside an iframe. The `createPhantom` function loads and attaches the iframe to your website.

</details>
<details>
<summary>How do I interact with the embedded wallet?</summary>

Once `createPhantom` has been called, `window.phantom.solana` and a compliant wallet-standard provider will also be available in the global scope of your website. This means that most of your existing code for interacting with Solana wallets should work out of the box.

Once a user has onboarded to the embedded wallet, they should be able to click your “connect wallet” button, which gives your website access to their Solana address. After that, signing messages and transactions should just work as normal.

</details>
<details>
<summary>I can't see the embedded wallet on my website. What's wrong?</summary>

The most common cause is that you are using a browser with the Phantom extension installed. If the Phantom extension is detected, we will not inject the embedded wallet.

You can temporarily disable the Phantom extension by going to `chrome://extensions` and toggling Phantom off.

</details>
<details>
<summary>How much does this cost?</summary>

It's free!

</details>

## Disclaimers

We are providing early access to beta software for testing purposes only. Embedded wallet should be used in a non-production environment only. Phantom will not be liable for any losses or damages suffered by you or your end users if you push the early access version of embedded wallets to a production environment.

All suggestions, enhancement requests, recommendations or other feedback provided by you relating to the embedded wallet will be the sole and exclusive property of Phantom and by using the early access version of embedded wallets and providing feedback to Phantom you agree to assign any rights in that feedback to Phantom.

0 comments on commit c277972

Please sign in to comment.