Socket
Book a DemoInstallSign in
Socket

@tian000/react-native-wallet-sdk

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@tian000/react-native-wallet-sdk

Phantom wallet embedded wallet SDK

0.0.28
unpublished
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

Phantom React Native SDK

Phantom React Native SDK allows you to seamlessly onboard users to your application, without requiring them to have previously installed a wallet. With Phantom React Native SDK, 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's mobile and extension apps without the user needing to know their seed phrase or manage any private keys.

Features

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

Quickstart

  • Install the Phantom React Native SDK
yarn | npm | pnpm add @phantom/react-native-wallet-sdk
  • Load the Phantom Embedded wallet in your mobile application and start signing transactions and messages
import { createPhantom, PhantomConfig } from "@phantom/react-native-wallet-sdk";
import { VersionedTransaction } from "@solana/web3.js";
import React, { useState } from "react";
import { Alert, Button, View } from "react-native";

const opts: PhantomConfig = {
  redirectURI: "my-app://",
  sdkKey: "my-sdk-key",
};

const phantom = createPhantom(opts);

const App = () => {
  const [solanaAddress, setSolanaAddress] = useState<string | null>(null);

  const handleLogin = async () => {
    const { solana: solanaAddress } = await phantom.loginWithGoogle();
    setSolanaAddress(solanaAddress);
    // Persist the user's Solana address to storage
    // The account will stay logged in until the user logs out
  };

  if (!solanaAddress) {
    return (
      <View>
        <Button title="Login with Phantom" onPress={handleLogin} />
      </View>
    );
  }

  // Sign a message or transaction with the Phantom Embedded wallet
  const handleSignMessage = async () => {
    const { signature } = await phantom.providers.solana.signMessage(new TextEncoder().encode("Hello, world!"));
    Alert.alert("Signature", JSON.stringify(signature));
  };

  const handleSignTransaction = async () => {
    const transaction = new VersionedTransaction(/* Create your transaction here. */);
    const signedTransaction = await phantom.providers.solana.signTransaction(transaction);
    Alert.alert("Signature", JSON.stringify(signedTransaction.serialize()));
  };

  return (
    <View>
      <Button title="Sign Message" onPress={handleSignMessage} />
      <Button title="Sign Transaction" onPress={handleSignTransaction} />
    </View>
  );
};

Configuration

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

ParameterTypeDescription
sdkKeystringContact Phantom for your SDK key
redirectURIstringA base URI that will redirect to your app. Can be a custom scheme (e.g. my-app://) or a universal link (e.g. https://my-app.com).

See It In Action

Try out Phantom Embedded via our demo app:

Give Feedback

Phantom React Native SDK 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 developers@phantom.app or message @brianfriel on Telegram.

Frequently Asked Questions

How does the embedded wallet work with the Phantom extension?
If the user has a social account linked to their Phantom extension - the same Phantom account will be used in the Phantom React Native SDK.
What does `createPhantom()` do? To ensure that there is a robust security sandbox, the Phantom embedded wallet lives inside an browser view. The `createPhantom` function will return an object that allows you to interact the embedded wallet after initialization.
How do I interact with the embedded wallet?
Once `createPhantom` has been called, it will return an object that contains the provider methods for interacting with the Phantom wallet.
How much does this cost?
It's free!

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.

FAQs

Package last updated on 04 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.