# Table of Contents - [Build with Phantom - Phantom developer documentation](#build-with-phantom-phantom-developer-documentation) - [Display apps in the Recent Activity tab - Phantom developer documentation](#display-apps-in-the-recent-activity-tab-phantom-developer-documentation) - [Go-live checklist - Phantom developer documentation](#go-live-checklist-phantom-developer-documentation) - [Detect the provider - Phantom developer documentation](#detect-the-provider-phantom-developer-documentation) - [Get started with Bitcoin - Phantom developer documentation](#get-started-with-bitcoin-phantom-developer-documentation) - [Establish a connection - Phantom developer documentation](#establish-a-connection-phantom-developer-documentation) - [Display apps within dialogs - Phantom developer documentation](#display-apps-within-dialogs-phantom-developer-documentation) - [Sign a message - Phantom developer documentation](#sign-a-message-phantom-developer-documentation) - [Provider API reference - Phantom developer documentation](#provider-api-reference-phantom-developer-documentation) - [Send a transaction - Phantom developer documentation](#send-a-transaction-phantom-developer-documentation) - [Display tokens on Solana - Phantom developer documentation](#display-tokens-on-solana-phantom-developer-documentation) - [NFTs and semi-fungibles - Phantom developer documentation](#nfts-and-semi-fungibles-phantom-developer-documentation) - [Get started with EVM networks - Phantom developer documentation](#get-started-with-evm-networks-phantom-developer-documentation) - [Detect the provider - Phantom developer documentation](#detect-the-provider-phantom-developer-documentation) - [Wallet Standard - Phantom developer documentation](#wallet-standard-phantom-developer-documentation) - [Make your token appear as verified - Phantom developer documentation](#make-your-token-appear-as-verified-phantom-developer-documentation) - [Limitations - Phantom developer documentation](#limitations-phantom-developer-documentation) - [Supported media types - Phantom developer documentation](#supported-media-types-phantom-developer-documentation) - [Fungibles - Phantom developer documentation](#fungibles-phantom-developer-documentation) - [Provider API reference - Phantom developer documentation](#provider-api-reference-phantom-developer-documentation) - [Establish a connection - Phantom developer documentation](#establish-a-connection-phantom-developer-documentation) - [Error messages and codes - Phantom developer documentation](#error-messages-and-codes-phantom-developer-documentation) - [Transaction Validation - Phantom developer documentation](#transaction-validation-phantom-developer-documentation) - [Phantom deep links - Phantom developer documentation](#phantom-deep-links-phantom-developer-documentation) - [Encryption - Phantom developer documentation](#encryption-phantom-developer-documentation) - [Specifying redirects - Phantom developer documentation](#specifying-redirects-phantom-developer-documentation) - [Domain and transaction warnings - Phantom developer documentation](#domain-and-transaction-warnings-phantom-developer-documentation) - [Create an app - Phantom developer documentation](#create-an-app-phantom-developer-documentation) - [Configure allowed origins and redirect URLs - Phantom developer documentation](#configure-allowed-origins-and-redirect-urls-phantom-developer-documentation) - [AI-assisted development - Phantom developer documentation](#ai-assisted-development-phantom-developer-documentation) - [Send a transaction - Phantom developer documentation](#send-a-transaction-phantom-developer-documentation) - [Shortcuts - Phantom developer documentation](#shortcuts-phantom-developer-documentation) - [Mobile web debugging - Phantom developer documentation](#mobile-web-debugging-phantom-developer-documentation) - [Create an account - Phantom developer documentation](#create-an-account-phantom-developer-documentation) - [Add your app information - Phantom developer documentation](#add-your-app-information-phantom-developer-documentation) - [Solana Actions and Blinks - Phantom developer documentation](#solana-actions-and-blinks-phantom-developer-documentation) - [Other methods - Phantom developer documentation](#other-methods-phantom-developer-documentation) - [Browse - Phantom developer documentation](#browse-phantom-developer-documentation) - [Sign a message - Phantom developer documentation](#sign-a-message-phantom-developer-documentation) - [Swap - Phantom developer documentation](#swap-phantom-developer-documentation) - [Events - Phantom developer documentation](#events-phantom-developer-documentation) - [isConnected - Phantom developer documentation](#isconnected-phantom-developer-documentation) - [Fungible - Phantom developer documentation](#fungible-phantom-developer-documentation) - [Accounts changed - Phantom developer documentation](#accounts-changed-phantom-developer-documentation) - [Testnet mode - Phantom developer documentation](#testnet-mode-phantom-developer-documentation) - [Token pages - Phantom developer documentation](#token-pages-phantom-developer-documentation) - [request - Phantom developer documentation](#request-phantom-developer-documentation) - [Get started - Phantom developer documentation](#get-started-phantom-developer-documentation) - [Developer tools and resources - Phantom developer documentation](#developer-tools-and-resources-phantom-developer-documentation) - [Disconnect - Phantom developer documentation](#disconnect-phantom-developer-documentation) - [Connect - Phantom developer documentation](#connect-phantom-developer-documentation) - [Provider methods - Phantom developer documentation](#provider-methods-phantom-developer-documentation) - [Verify your domain - Phantom developer documentation](#verify-your-domain-phantom-developer-documentation) - [Phantom Connect - Phantom developer documentation](#phantom-connect-phantom-developer-documentation) - [Chain changed - Phantom developer documentation](#chain-changed-phantom-developer-documentation) - [SignAndSendTransaction (deprecated) - Phantom developer documentation](#signandsendtransaction-deprecated-phantom-developer-documentation) - [Solana priority fees - Phantom developer documentation](#solana-priority-fees-phantom-developer-documentation) - [Methods - Phantom developer documentation](#methods-phantom-developer-documentation) - [Phantom Portal overview - Phantom developer documentation](#phantom-portal-overview-phantom-developer-documentation) - [Solana Token Extensions (Token22) - Phantom developer documentation](#solana-token-extensions-token22-phantom-developer-documentation) - [Contracts and Auto-Confirm - Phantom developer documentation](#contracts-and-auto-confirm-phantom-developer-documentation) - [Disconnect - Phantom developer documentation](#disconnect-phantom-developer-documentation) - [Solana Versioned Transactions - Phantom developer documentation](#solana-versioned-transactions-phantom-developer-documentation) - [SignTransaction - Phantom developer documentation](#signtransaction-phantom-developer-documentation) - [Establish a connection - Phantom developer documentation](#establish-a-connection-phantom-developer-documentation) - [Connect - Phantom developer documentation](#connect-phantom-developer-documentation) - [SignAllTransactions - Phantom developer documentation](#signalltransactions-phantom-developer-documentation) - [Get started with Sui - Phantom developer documentation](#get-started-with-sui-phantom-developer-documentation) - [Get your App ID and integrate - Phantom developer documentation](#get-your-app-id-and-integrate-phantom-developer-documentation) - [Send a transaction - Phantom developer documentation](#send-a-transaction-phantom-developer-documentation) - [Updates - Phantom developer documentation](#updates-phantom-developer-documentation) - [Properties - Phantom developer documentation](#properties-phantom-developer-documentation) - [Get started with Solana - Phantom developer documentation](#get-started-with-solana-phantom-developer-documentation) - [Detect the provider - Phantom developer documentation](#detect-the-provider-phantom-developer-documentation) - [Detect the provider - Phantom developer documentation](#detect-the-provider-phantom-developer-documentation) - [isPhantom - Phantom developer documentation](#isphantom-phantom-developer-documentation) - [chainId - Phantom developer documentation](#chainid-phantom-developer-documentation) - [Sign-In-With (SIW) standards - Phantom developer documentation](#sign-in-with-siw-standards-phantom-developer-documentation) - [Sign a message - Phantom developer documentation](#sign-a-message-phantom-developer-documentation) - [ events - Phantom developer documentation](#-events-phantom-developer-documentation) - [ eventsCount - Phantom developer documentation](#-eventscount-phantom-developer-documentation) - [Error messages and codes - Phantom developer documentation](#error-messages-and-codes-phantom-developer-documentation) - [networkVersion - Phantom developer documentation](#networkversion-phantom-developer-documentation) - [SignMessage - Phantom developer documentation](#signmessage-phantom-developer-documentation) - [Sign a message - Phantom developer documentation](#sign-a-message-phantom-developer-documentation) - [selectedAddress - Phantom developer documentation](#selectedaddress-phantom-developer-documentation) - [Sign messages - Phantom developer documentation](#sign-messages-phantom-developer-documentation) - [Handle sessions - Phantom developer documentation](#handle-sessions-phantom-developer-documentation) - [Establish a connection - Phantom developer documentation](#establish-a-connection-phantom-developer-documentation) - [Send a legacy transaction - Phantom developer documentation](#send-a-legacy-transaction-phantom-developer-documentation) - [Logos and assets - Phantom developer documentation](#logos-and-assets-phantom-developer-documentation) - [Send a versioned transaction - Phantom developer documentation](#send-a-versioned-transaction-phantom-developer-documentation) - [Demo apps - Phantom developer documentation](#demo-apps-phantom-developer-documentation) - [Sign and send transactions - Phantom developer documentation](#sign-and-send-transactions-phantom-developer-documentation) - [Sign messages - Phantom developer documentation](#sign-messages-phantom-developer-documentation) - [Sign and send transactions - Phantom developer documentation](#sign-and-send-transactions-phantom-developer-documentation) - [MCP server - Phantom developer documentation](#mcp-server-phantom-developer-documentation) - [Connect - Phantom developer documentation](#connect-phantom-developer-documentation) - [Phantom Connect SDK overview - Phantom developer documentation](#phantom-connect-sdk-overview-phantom-developer-documentation) - [Sign messages - Phantom developer documentation](#sign-messages-phantom-developer-documentation) - [Connect - Phantom developer documentation](#connect-phantom-developer-documentation) - [Sign and send transactions - Phantom developer documentation](#sign-and-send-transactions-phantom-developer-documentation) - [Connect - Phantom developer documentation](#connect-phantom-developer-documentation) - [Recipes and starter kits - Phantom developer documentation](#recipes-and-starter-kits-phantom-developer-documentation) - [Cursor AI prompts - Phantom developer documentation](#cursor-ai-prompts-phantom-developer-documentation) - [FAQ - Phantom developer documentation](#faq-phantom-developer-documentation) - [Browser SDK - Phantom developer documentation](#browser-sdk-phantom-developer-documentation) - [Phantom React SDK - Phantom developer documentation](#phantom-react-sdk-phantom-developer-documentation) - [Phantom React Native SDK - Phantom developer documentation](#phantom-react-native-sdk-phantom-developer-documentation) - [Wallet authentication with JWTs - Phantom developer documentation](#wallet-authentication-with-jwts-phantom-developer-documentation) - [Phantom React SDK - Phantom developer documentation](#phantom-react-sdk-phantom-developer-documentation) - [Phantom React Native SDK - Phantom developer documentation](#phantom-react-native-sdk-phantom-developer-documentation) - [Browser SDK - Phantom developer documentation](#browser-sdk-phantom-developer-documentation) - [Spending limits - Phantom developer documentation](#spending-limits-phantom-developer-documentation) --- # Build with Phantom - Phantom developer documentation [Skip to main content](https://docs.phantom.com/introduction#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Overview Build with Phantom [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Key features](https://docs.phantom.com/introduction#key-features) * [Phantom Connect](https://docs.phantom.com/introduction#phantom-connect) * [Phantom Connect SDKs](https://docs.phantom.com/introduction#phantom-connect-sdks) * [Phantom Portal](https://docs.phantom.com/introduction#phantom-portal) * [Quick start guides](https://docs.phantom.com/introduction#quick-start-guides) * [Phantom Connect SDKs](https://docs.phantom.com/introduction#phantom-connect-sdks-2) * [Extension and mobile deep links](https://docs.phantom.com/introduction#extension-and-mobile-deep-links) * [Developer resources](https://docs.phantom.com/introduction#developer-resources) **Phantom** is a leading crypto wallet enabling users to manage digital assets and access decentralized applications across [Solana](https://solana.com/) , [Ethereum](https://ethereum.org/en/) , [Bitcoin](https://bitcoin.org/) , [Base](https://www.base.org/) , [Polygon](https://polygon.technology/) , [Sui](https://sui.io/) , and [Monad](https://www.monad.xyz/) . Available as a [browser extension](https://phantom.app/download) , [iOS app](https://apps.apple.com/us/app/phantom-solana-wallet/id1598432977) , and [Android app](https://play.google.com/store/apps/details?id=app.phantom) , Phantom provides developers with enterprise-grade wallet infrastructure through our comprehensive SDK suite. This documentation is for developers building with Phantom. For integration support, submit a request using this [form](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) . For general support, visit our [Help Center](https://help.phantom.app/) . [​](https://docs.phantom.com/introduction#key-features) Key features ----------------------------------------------------------------------- ### [​](https://docs.phantom.com/introduction#phantom-connect) Phantom Connect Enable smooth and fast authentication with [Phantom Connect](https://docs.phantom.com/phantom-connect) , offering users the choice between social login providers (Google, Apple) or their existing Phantom browser extension. ### [​](https://docs.phantom.com/introduction#phantom-connect-sdks) Phantom Connect SDKs Build with our comprehensive [SDK suite](https://docs.phantom.com/wallet-sdks-overview) for web and mobile platforms. Choose from React, React Native, or Browser SDKs to integrate wallet functionality into your app with native multi-chain support. ### [​](https://docs.phantom.com/introduction#phantom-portal) Phantom Portal Publish and maintain your app with [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) , a self-service dashboard for managing branding, supported networks, and contract verification. [​](https://docs.phantom.com/introduction#quick-start-guides) Quick start guides ----------------------------------------------------------------------------------- Get up and running quickly with these guides: [Connect a wallet\ ----------------\ \ Use the React SDK to authenticate users and enable wallet connection](https://docs.phantom.com/sdks/react-sdk/index) [Build a mobile app\ ------------------\ \ Use The Phantom Connect React Native SDK to build a mobile wallet app](https://docs.phantom.com/sdks/react-native-sdk/index) [Integrate Phantom Connect\ -------------------------\ \ Enable users to connect using social login or browser extension](https://docs.phantom.com/phantom-connect) [Build with vanilla JS\ ---------------------\ \ Use The Phantom Connect Browser SDK for framework-agnostic web integration](https://docs.phantom.com/sdks/browser-sdk/index) [​](https://docs.phantom.com/introduction#phantom-connect-sdks-2) Phantom Connect SDKs ----------------------------------------------------------------------------------------- Choose the SDK that fits your app: [React SDK\ ---------\ \ React hooks for wallet integration in your apps with native transaction support](https://docs.phantom.com/sdks/react-sdk/index) [React Native SDK\ ----------------\ \ Build mobile wallet experiences for iOS and Android with React Native](https://docs.phantom.com/sdks/react-native-sdk/index) [Browser SDK\ -----------\ \ Framework-agnostic JavaScript SDK for wallet integration in web apps](https://docs.phantom.com/sdks/browser-sdk/index) Not sure which SDK to use? Check out our [SDK comparison guide](https://docs.phantom.com/wallet-sdks-overview) to find the perfect fit for your use case. [​](https://docs.phantom.com/introduction#extension-and-mobile-deep-links) Extension and mobile deep links ------------------------------------------------------------------------------------------------------------- Connect to users’ existing Phantom wallets via our Provider API and mobile deep links: [Solana\ ------\ \ Build on Solana with fast transactions and low fees](https://docs.phantom.com/solana/integrating-phantom) [Ethereum, Base, Polygon, and Monad\ ----------------------------------\ \ Connect to EVM-compatible chains including Ethereum, Base, Polygon, and Monad](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/getting-started) [Bitcoin\ -------\ \ Integrate with the Bitcoin network](https://docs.phantom.com/bitcoin/integrating-phantom) [Sui\ ---\ \ Build on the Sui blockchain](https://docs.phantom.com/sui/getting-started-with-sui) [​](https://docs.phantom.com/introduction#developer-resources) Developer resources ------------------------------------------------------------------------------------- [AI-assisted development\ -----------------------\ \ Build faster with AI tools that have access to Phantom docs](https://docs.phantom.com/developer-powertools/ai-tools) [MCP server\ ----------\ \ Give your AI coding assistant access to Phantom docs](https://docs.phantom.com/resources/mcp-server) [Cursor AI prompts\ -----------------\ \ One-shot prompts to implement any SDK with Cursor AI](https://docs.phantom.com/resources/cursor-prompts) [Recipes and starter kits\ ------------------------\ \ Explore starter templates and example implementations](https://docs.phantom.com/resources/recipes) [Sandbox\ -------\ \ Test your integration in our interactive sandbox](https://docs.phantom.com/resources/sandbox) [FAQ\ ---\ \ Find answers to common questions](https://docs.phantom.com/resources/faq) [Support\ -------\ \ Get help from our developer support team](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) Was this page helpful? YesNo [Phantom Connect](https://docs.phantom.com/phantom-connect) ⌘I --- # Display apps in the Recent Activity tab - Phantom developer documentation [Skip to main content](https://docs.phantom.com/best-practices/displaying-apps-within-the-activity-tab#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Best practices Display apps in the Recent Activity tab [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) When a user views their historical activity, Phantom will parse their dapp interactions and enrich them with known metadata. The following are two examples of how Phantom displays historical transactions on [Magic Eden](https://magiceden.io/) and [Jupiter](https://jup.ag/) , respectively: ![An example activity row for Magic Eden](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/best-practices/images/me-activity.png?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=75097742adfe6d33035b09bab751b480) ![An example activity row for Jupiter](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/best-practices/images/jupiter-activity.png?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=eb2681d82db1cf8c42974805f7a3f61d) To display your app within the Activity tab, fill out this [form](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) with the following information: * URL of the website * Display name of the dapp * Program/Contract IDs * Interaction names (corresponding to program IDs) Was this page helpful? YesNo [Go-live checklist](https://docs.phantom.com/best-practices/launching-a-dapp) [Display apps within dialogs](https://docs.phantom.com/best-practices/displaying-your-app) ⌘I --- # Go-live checklist - Phantom developer documentation [Skip to main content](https://docs.phantom.com/best-practices/launching-a-dapp#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Best practices Go-live checklist [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Phantom Portal setup](https://docs.phantom.com/best-practices/launching-a-dapp#phantom-portal-setup) * [Account created in Phantom Portal](https://docs.phantom.com/best-practices/launching-a-dapp#account-created-in-phantom-portal) * [App created and configured in Phantom Portal](https://docs.phantom.com/best-practices/launching-a-dapp#app-created-and-configured-in-phantom-portal) * [Integration testing](https://docs.phantom.com/best-practices/launching-a-dapp#integration-testing) * [Security](https://docs.phantom.com/best-practices/launching-a-dapp#security) * [Common issues](https://docs.phantom.com/best-practices/launching-a-dapp#common-issues) * [Transactions fail](https://docs.phantom.com/best-practices/launching-a-dapp#transactions-fail) * [App doesn’t show in the Explore tab](https://docs.phantom.com/best-practices/launching-a-dapp#app-doesn%E2%80%99t-show-in-the-explore-tab) * [Need help?](https://docs.phantom.com/best-practices/launching-a-dapp#need-help) [​](https://docs.phantom.com/best-practices/launching-a-dapp#phantom-portal-setup) Phantom Portal setup ---------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/best-practices/launching-a-dapp#account-created-in-phantom-portal) Account created in Phantom Portal Go to [phantom.com/portal](https://phantom.com/portal) and sign up with Google or Apple. [Phantom Portal overview →](https://docs.phantom.com/phantom-portal/portal) ### [​](https://docs.phantom.com/best-practices/launching-a-dapp#app-created-and-configured-in-phantom-portal) App created and configured in Phantom Portal Confirm that your app is fully set up in Phantom Portal: * The app has been created in Phantom Portal. * Branding and app details have been added. * The domain has been verified. * Allowed origin URLs have been configured. * An App ID has been generated. * The app access mode is set to `PUBLIC`. [Get started →](https://docs.phantom.com/phantom-portal/getting-started) [​](https://docs.phantom.com/best-practices/launching-a-dapp#integration-testing) Integration testing -------------------------------------------------------------------------------------------------------- Validate that your integration works correctly across common user flows: * Wallet connection and authentication work through Phantom Connect. * Transaction signing works on all supported networks. * Spending limit behavior is correct, if you’re using embedded wallets. * Error handling works as expected for rejected transactions or insufficient funds. * The app behaves correctly across browsers and devices. [​](https://docs.phantom.com/best-practices/launching-a-dapp#security) Security ---------------------------------------------------------------------------------- Verify that basic security requirements are met: * HTTPS is enforced across all production URLs. * No private keys or sensitive data are logged. * All transactions clearly display the correct amounts and intent to users. [Mobile web debugging →](https://docs.phantom.com/developer-powertools/mobile-web-debugging) [​](https://docs.phantom.com/best-practices/launching-a-dapp#common-issues) Common issues -------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/best-practices/launching-a-dapp#transactions-fail) Transactions fail If transactions fail during testing or after launch, common causes include the following: * Insufficient funds to cover gas or rent. * Contract errors or RPC-related failures. ### [​](https://docs.phantom.com/best-practices/launching-a-dapp#app-doesn%E2%80%99t-show-in-the-explore-tab) App doesn’t show in the Explore tab If your app isn’t visible in the **Explore** tab, it’s usually because of the following reason: * Cause: Your app profile changes are still under review. * Solution: Wait for Phantom to approve the updates. Once approved, changes appear immediately. [​](https://docs.phantom.com/best-practices/launching-a-dapp#need-help) Need help? ------------------------------------------------------------------------------------- [Support\ -------\ \ Get help from our developer support team](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) [FAQ\ ---\ \ Find answers to common questions](https://docs.phantom.com/resources/faq) Was this page helpful? YesNo [Mobile web debugging](https://docs.phantom.com/developer-powertools/mobile-web-debugging) [Display apps in the Recent Activity tab](https://docs.phantom.com/best-practices/displaying-apps-within-the-activity-tab) ⌘I --- # Detect the provider - Phantom developer documentation [Skip to main content](https://docs.phantom.com/bitcoin/detecting-the-provider#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Bitcoin Detect the provider [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Phantom’s browser extension and mobile in-app browser will both inject a `phantom` object into the [window](https://developer.mozilla.org/en-US/docs/Web/API/Window) of any web application the user visits, provided that site is using `https://`, on `localhost`, or is `127.0.0.1.` Phantom will not inject the provider into [iframes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) or sites using `http://`. If a `phantom` object exists, Bitcoin and Ordinals dapps can interact with Phantom via the API found at `window.phantom.bitcoin`. To detect if Phantom is installed, an application should check for an additional `isPhantom` flag like so: Report incorrect code Copy Ask AI const isPhantomInstalled = window?.phantom?.bitcoin?.isPhantom If Phantom is not installed, we recommend you redirect your users to our website `https://phantom.com/`. Altogether, this may look like the following: Report incorrect code Copy Ask AI const getProvider = () => { if ('phantom' in window) { const anyWindow: any = window; const provider = anyWindow.phantom?.bitcoin; if (provider && provider.isPhantom) { return provider; } } window.open('https://phantom.com/', '_blank'); }; When adding a Phantom button to your dapp’s wallet modal, we recommend using the name “Phantom” with an SVG/PNG icon, which you can find in [Logos and assets](https://docs.phantom.com/resources/assets) . ![An example Phantom button in a wallet modal](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/phantom-modal-button.png?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=0e580d6d1ce5ebed8d7a1e771099bff9) Was this page helpful? YesNo [Get started with Bitcoin](https://docs.phantom.com/bitcoin/integrating-phantom) [Establish a connection](https://docs.phantom.com/bitcoin/establishing-a-connection) ⌘I --- # Get started with Bitcoin - Phantom developer documentation [Skip to main content](https://docs.phantom.com/bitcoin/integrating-phantom#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Bitcoin Get started with Bitcoin [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Direct integration](https://docs.phantom.com/bitcoin/integrating-phantom#direct-integration) * [Wallet Standard](https://docs.phantom.com/bitcoin/integrating-phantom#wallet-standard) The Phantom browser extension and mobile in-app browser both support interacting with Bitcoin and Ordinals dapps. There are two main ways to integrate Phantom into your web application: [​](https://docs.phantom.com/bitcoin/integrating-phantom#direct-integration) Direct integration -------------------------------------------------------------------------------------------------- The most direct way to interact with Phantom is via the provider that Phantom injects into your web application. This provider is globally available at `window.phantom` and its methods will always include Phantom’s most up-to-date functionality. This documentation is dedicated to covering all aspects of the provider. When adding a Phantom button to your dapp’s wallet modal, we recommend using the name “Phantom” with an SVG/PNG icon, which you can find in [Logos and assets](https://docs.phantom.com/resources/assets) . ![An example Phantom button in a wallet modal](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/phantom-modal-button.png?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=0e580d6d1ce5ebed8d7a1e771099bff9) [​](https://docs.phantom.com/bitcoin/integrating-phantom#wallet-standard) Wallet Standard -------------------------------------------------------------------------------------------- Applications can also integrate Phantom by adding support for [Wallet Standard](https://github.com/wallet-standard/wallet-standard) . You can find the Bitcoin-specific extensions for Wallet Standard on [GitHub](https://github.com/ExodusMovement/bitcoin-wallet-standard?tab=readme-ov-file) . Was this page helpful? YesNo [Error messages and codes](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/errors) [Detect the provider](https://docs.phantom.com/bitcoin/detecting-the-provider) ⌘I --- # Establish a connection - Phantom developer documentation [Skip to main content](https://docs.phantom.com/bitcoin/establishing-a-connection#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Bitcoin Establish a connection [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Connect](https://docs.phantom.com/bitcoin/establishing-a-connection#connect) * [Disconnect](https://docs.phantom.com/bitcoin/establishing-a-connection#disconnect) * [Change accounts](https://docs.phantom.com/bitcoin/establishing-a-connection#change-accounts) [​](https://docs.phantom.com/bitcoin/establishing-a-connection#connect) Connect ---------------------------------------------------------------------------------- Once an application has [detected the provider](https://docs.phantom.com/bitcoin/detecting-the-provider) , it can then request to connect to Phantom by invoking the `requestAccounts` method. This connection request will prompt the user for permission to share their Bitcoin addresses, indicating that they are willing to interact further. Users must approve a connection request before the app can make additional requests such as [signing a message](https://docs.phantom.com/bitcoin/signing-a-message) or [sending a transaction](https://docs.phantom.com/bitcoin/sending-a-transaction) . ![Phantom popup triggered when user connects to an app for the first time](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/establishing-a-connection.webp?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=a9ec7d8cd43f13d734203634013adf17) The `requestAccounts` method returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves if the user approves the connection request. Once resolved, it contains an array of the user’s `BtcAccount` objects. If the user declines the request or closes the pop-up, it will reject (throw when awaited). The array of `BtcAccount` objects represent the possible addresses that can be used when a user connects with Phantom. This is defined as: Report incorrect code Copy Ask AI type BtcAccount = { address: string; addressType: "p2tr" | "p2wpkh" | "p2sh" | "p2pkh"; publicKey: string; purpose: "payment" | "ordinals"; }; Where: * `address`: The Bitcoin address owned by the user. * `addressType`: The address’s format. For details, see [Bitcoin Design Glossary](https://bitcoin.design/guide/glossary/address/) . * `publicKey`: A hex string representing the bytes of the public key of the account. * `purpose`: The general purpose of the address. If `ordinals`, the user prefers to store Ordinals on this address. If `payment`, the user prefers to store bitcoin on this address. The purpose fields represent user preferences and do not represent a guarantee that there will only be Bitcoin on `payment` addresses or only Ordinals on `ordinals` addresses. When submitting a transaction, make sure to carefully select UTXOs such that you do not cause the user to accidentally spend a rare or inscribed satoshi. The following is an example of how to connect to Phantom: Report incorrect code Copy Ask AI const phantomProvider = getProvider(); // see "Detecting the Provider" const accounts = await phantomProvider.requestAccounts(); console.log(accounts); /** [\ {\ "address": "bc1phajtersv55fwud5xr0t70p5234swy396a6avqhuny0qf83zssvrsm7tl4q",\ "publicKey": "02435c68c1f20522946e46bcc39f8a19088095939db840e874e1ad2c18f0f2361c"\ "addressType": "p2tr"\ "purpose": "ordinals"\ },\ {\ "address": "bc1qqy4emmf7q623vlf2z4j3pvgfyjkaffx2u3fkpk",\ "publicKey": "0279f5b4123030accae6c4ca9a17263753a21df2142bbf0ced940d28ca613e87f9"\ "addressType": "p2wpkh"\ "purpose": "payment"\ }\ ] **/ [​](https://docs.phantom.com/bitcoin/establishing-a-connection#disconnect) Disconnect ---------------------------------------------------------------------------------------- There is no way for dapps to programmatically disconnect a user. Once a user has established a connection, Phantom will add the website they opened a connection with to a list of **Connected Apps**. When a user returns to one of these whitelisted sites, Phantom will attempt to reconnect the application automatically. At any time, the user can revoke access to the dapp through their UI by navigating to **Settings** > **Connected Apps**. If a user disconnects from a dapp, they will need to reconnect on the subsequent visit before signing a message or sending a transaction. ![Disconnecting a dApp in Connected Apps settings in Phantom extension](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/disconnect.png?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=806a2ab1137c59180e48e8518d3838b5) [​](https://docs.phantom.com/bitcoin/establishing-a-connection#change-accounts) Change accounts -------------------------------------------------------------------------------------------------- Phantom allows users to manage multiple accounts from within a single extension or mobile app. Whenever a user switches accounts, Phantom will emit an `accountsChanged` event. Report incorrect code Copy Ask AI phantomProvider.on('accountsChanged', (accounts: BtcAccount[]) => { console.log('Accounts changed:', accounts); }); If Phantom passes an empty array on `accountsChanged`, it implies that the user has switched to an account that has not connected to the dapp before (that is, not already in **Connected Apps**) or does not support Bitcoin (for example, a Solana private key account). In this case, the application can either do nothing or attempt to reconnect: Report incorrect code Copy Ask AI phantomProvider.on('accountsChanged', (accounts: BtcAccount[]) => { if (accounts.length > 0) { // Set new address and continue as usual } else { // Attempt to reconnect to Phantom phantomProvider.requestAccounts().catch((error) => { // handle connection failure }); } }); Was this page helpful? YesNo [Detect the provider](https://docs.phantom.com/bitcoin/detecting-the-provider) [Send a transaction](https://docs.phantom.com/bitcoin/sending-a-transaction) ⌘I --- # Display apps within dialogs - Phantom developer documentation [Skip to main content](https://docs.phantom.com/best-practices/displaying-your-app#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Best practices Display apps within dialogs [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) ![An example app displayed within a dialog](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/best-practices/images/displayingappswithindialogs.jpeg?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=1e46953709fb6c186982c7561c42d679) When an app is [establishing a connection](https://docs.phantom.com/solana/establishing-a-connection) or [sending a transaction](https://docs.phantom.com/solana/sending-a-transaction) , Phantom will present the user with the above dialogs. In order to display the title and icon for these dialogs, Phantom will inspect the application’s HTML for the following items: | Value | Primary lookup | Secondary lookup | Fallback | | --- | --- | --- | --- | | Title | [Open Graph title](https://ogp.me/) | [Document Title Element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title) | None | | Icon | [Apple touch icon](https://www.computerhope.com/jargon/a/appletou.htm) | [Favicon](https://developer.mozilla.org/en-US/docs/Glossary/Favicon) | A default icon | Was this page helpful? YesNo [Display apps in the Recent Activity tab](https://docs.phantom.com/best-practices/displaying-apps-within-the-activity-tab) [Display tokens on Solana](https://docs.phantom.com/best-practices/tokens/README) ⌘I --- # Sign a message - Phantom developer documentation [Skip to main content](https://docs.phantom.com/bitcoin/signing-a-message#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Bitcoin Sign a message [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) When a dapp is connected to Phantom, it can also request that the user signs a given message. Applications are free to write their own messages which will be displayed to users from within Phantom’s signature prompt. Message signatures do not involve network fees and are a convenient way for apps to verify ownership of an address. ![Signing a message in the Phantom browser extension](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/signing-a-message.webp?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=b71cb184c17fda5e92fd7fa5ec981e07) Phantom’s `signMessage` function accepts two parameters: an encoded `message` and an `address` that should be used to sign the message. It returns a Promise that resolves if the user approves the signature request. Once resolved, it contains the resulting `signature`. Report incorrect code Copy Ask AI // function signature function signMessage( address: string, message: Uint8Array, ): Promise<{ signature: Uint8Array; }>; The following is an example of how to construct and sign a message with Phantom: Report incorrect code Copy Ask AI const message = new TextEncoder().encode('hello world'); const address = "bc1phajtersv55fwud5xr0t70p5234swy396a6avqhuny0qf83zssvrsm7tl4q"; // see "Establishing a Connection" const { signature } = await phantomProvider.signMessage(address, message); To verify that a message was signed by a given address, we recommend using the [bip322-js](https://github.com/ACken2/bip322-js) library like so: Report incorrect code Copy Ask AI import { Verifier } from "bip322-js"; // helper method function bytesToBase64(bytes) { const binString = String.fromCodePoint(...bytes); return btoa(binString); } const isValidSignature = Verifier.verifySignature( address, new TextDecoder().decode(message), bytesToBase64(signature), ); console.log(isValidSignature); // true Was this page helpful? YesNo [Send a transaction](https://docs.phantom.com/bitcoin/sending-a-transaction) [Provider API reference](https://docs.phantom.com/bitcoin/provider-api-reference) ⌘I --- # Provider API reference - Phantom developer documentation [Skip to main content](https://docs.phantom.com/bitcoin/provider-api-reference#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Bitcoin Provider API reference [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Methods](https://docs.phantom.com/bitcoin/provider-api-reference#methods) * [requestAccounts](https://docs.phantom.com/bitcoin/provider-api-reference#requestaccounts) * [Description](https://docs.phantom.com/bitcoin/provider-api-reference#description) * [Parameters](https://docs.phantom.com/bitcoin/provider-api-reference#parameters) * [Response](https://docs.phantom.com/bitcoin/provider-api-reference#response) * [BtcAccount response object properties](https://docs.phantom.com/bitcoin/provider-api-reference#btcaccount-response-object-properties) * [signMessage](https://docs.phantom.com/bitcoin/provider-api-reference#signmessage) * [Description](https://docs.phantom.com/bitcoin/provider-api-reference#description-2) * [Parameters](https://docs.phantom.com/bitcoin/provider-api-reference#parameters-2) * [Response](https://docs.phantom.com/bitcoin/provider-api-reference#response-2) * [signPSBT](https://docs.phantom.com/bitcoin/provider-api-reference#signpsbt) * [Description](https://docs.phantom.com/bitcoin/provider-api-reference#description-3) * [Parameters](https://docs.phantom.com/bitcoin/provider-api-reference#parameters-3) * [options parameters](https://docs.phantom.com/bitcoin/provider-api-reference#options-parameters) * [Response](https://docs.phantom.com/bitcoin/provider-api-reference#response-3) * [Events](https://docs.phantom.com/bitcoin/provider-api-reference#events) * [accountsChanged](https://docs.phantom.com/bitcoin/provider-api-reference#accountschanged) * [Description](https://docs.phantom.com/bitcoin/provider-api-reference#description-4) * [Properties](https://docs.phantom.com/bitcoin/provider-api-reference#properties) * [BtcAccount response object properties](https://docs.phantom.com/bitcoin/provider-api-reference#btcaccount-response-object-properties-2) [​](https://docs.phantom.com/bitcoin/provider-api-reference#methods) Methods ------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/bitcoin/provider-api-reference#requestaccounts) requestAccounts #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#description) Description Connects to the user’s Phantom account. #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#parameters) Parameters None #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#response) Response [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-promise-btc-account) Promise array Array of the connected user’s `BtcAccount` objects. #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#btcaccount-response-object-properties) BtcAccount response object properties [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-address) address string The Bitcoin address owned by the user. [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-address-type) addressType p2tr, p2wpkh, p2sh, p2pkh The address’s format. For details, see [Bitcoin Design Glossary](https://bitcoin.design/guide/glossary/address/) . [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-public-key) publicKey string A hex string representing the bytes of the public key of the account. [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-purpose) purpose payment, ordinals The general purpose of the address. If `ordinals`, the user prefers to store Ordinals on this address. If `payment`, the user prefers to store Bitcoin on this address. ### [​](https://docs.phantom.com/bitcoin/provider-api-reference#signmessage) signMessage #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#description-2) Description Signs a message with the user’s Phantom account. #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#parameters-2) Parameters [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-message) message Uint8array The message to be signed. [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-address-1) address string One of the user’s addresses that should be used to sign the message. #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#response-2) Response [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-promise-signature-uint8-array) Promise<{ signature: Uint8Array; }> object Object containing the signature. ### [​](https://docs.phantom.com/bitcoin/provider-api-reference#signpsbt) signPSBT #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#description-3) Description Signs a Partially-Signed Bitcoin Transaction (PSBT). #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#parameters-3) Parameters [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-psbt-hex) psbtHex Uint8Array A serialized PSBT. [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-options) options object Configuration options for signing the PSBT. #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#options-parameters) options parameters An array containing the indexes of which transaction inputs to sign, and how to sign them. #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#response-3) Response [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-promise-string) Promise string A serialized PSBT where the inputs belonging to the user’s account have been signed. [​](https://docs.phantom.com/bitcoin/provider-api-reference#events) Events ----------------------------------------------------------------------------- ### [​](https://docs.phantom.com/bitcoin/provider-api-reference#accountschanged) accountsChanged #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#description-4) Description The event that is emitted when a user changes their connected Phantom account. Report incorrect code Copy Ask AI type AccountsChangedEvent = (accounts: BtcAccount[]) => void; #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#properties) Properties [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-accounts) accounts BtcAccount\[\] The array of `BtcAccount` objects of the newly connect Phantom account. #### [​](https://docs.phantom.com/bitcoin/provider-api-reference#btcaccount-response-object-properties-2) BtcAccount response object properties [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-address-2) address string The Bitcoin address owned by the user. [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-address-type-1) addressType p2tr, p2wpkh, p2sh, p2pkh The address’s format. For details, see [Bitcoin Design Glossary](https://bitcoin.design/guide/glossary/address/) . [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-public-key-1) publicKey string A hex string representing the bytes of the public key of the account. [​](https://docs.phantom.com/bitcoin/provider-api-reference#param-purpose-1) purpose payment, ordinals The general purpose of the address. If `ordinals`, the user prefers to store Ordinals on this address. If `payment`, the user prefers to store Bitcoin on this address. Was this page helpful? YesNo [Sign a message](https://docs.phantom.com/bitcoin/signing-a-message) [Get started with Sui](https://docs.phantom.com/sui/getting-started-with-sui) ⌘I --- # Send a transaction - Phantom developer documentation [Skip to main content](https://docs.phantom.com/bitcoin/sending-a-transaction#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Bitcoin Send a transaction [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Phantom supports signing transactions using the [Partially Signed Bitcoin Transaction (PSBT)](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki) format. The `signPSBT` method takes in a serialized PSBT, and returns a serialized PSBT where the user’s inputs have been signed. Report incorrect code Copy Ask AI // function signature signPSBT( psbt: Uint8Array, options: {inputsToSign: {sigHash?: number | undefined, address: string, signingIndexes: number[]}[]} ): Promise; We recommend using [bitcoinjs-lib](https://github.com/bitcoinjs/bitcoinjs-lib) for constructing and serializing PSBTs. Report incorrect code Copy Ask AI const fromHexString = (hexString) => Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); const signedPSBTBytes = await phantomProvider.signPSBT( fromHexString("70736274ff0100fd940102000000048a841e4104389e3b5b04c1522ed7bfc0e64c3760cb801a2ee2406d1c2373d81d0300000000ffffffff8a841e4104389e3b5b04c1522ed7bfc0e64c3760cb801a2ee2406d1c2373d81d0400000000ffffffffaf3341cffbd7ce8b4a51dec0f358a21809fad67be1a11bf70b86e83ec4567ace0100000000ffffffff8eceb072b7c47ebd9c1aa2e17c2541145835c70a8667eb21fa2ff3cac503170e0600000000ffffffff07b004000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed04a01000000000000225120b1a548f1672b6bc666e23943b0b138a4216e2ce5f9bc687469e0f52a917bbf274b0100000000000017a91433ab469b293fa7700f0954c96ec630895892f189874402000000000000160014c015c65276d5f38d599d445c4cb03aa7aa0dc3655802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed072fe050000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed000000000000100fdf50102000000000101a1f8bb2bde4e13b2f397a82a8a101b378e90af13354710b93742be79b773e3840000000000ffffffff0b5802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed00d4c070000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed00247304402204d2e9da8a14537a1c37b59e6a7eb828816249747dbec041315ade14a181c826a022044dcc381227cef6ab18431e692dccc7c27e2a10fed4d3131e0523094819d1dda0121028b8437ac47a4434d4b86d19ab7eeb255887f75cfa43ca135168bfc8281ae8bb90000000001011f5802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed0000100fdf50102000000000101a1f8bb2bde4e13b2f397a82a8a101b378e90af13354710b93742be79b773e3840000000000ffffffff0b5802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed00d4c070000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed00247304402204d2e9da8a14537a1c37b59e6a7eb828816249747dbec041315ade14a181c826a022044dcc381227cef6ab18431e692dccc7c27e2a10fed4d3131e0523094819d1dda0121028b8437ac47a4434d4b86d19ab7eeb255887f75cfa43ca135168bfc8281ae8bb90000000001011f5802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed0000100fd6f0302000000000104a81c37519eca22bd78a4705230dcc471fb59f285bb2f22165c803de5bbe10b4c08000000171600147e3a872889766d0e3aebacf19f7936fd659b2605ffffffffa81c37519eca22bd78a4705230dcc471fb59f285bb2f22165c803de5bbe10b4c03000000171600147e3a872889766d0e3aebacf19f7936fd659b2605ffffffff33ec9dbdfa3ecb3654683b54855eac430d41b9b87b028f8cc84c6766bf7cc3870100000000ffffffff14e64f84c47029f5b8687519707c6e18080f675f37323746c695a681b0fdfece06000000171600147e3a872889766d0e3aebacf19f7936fd659b2605ffffffff07b00400000000000017a91433ab469b293fa7700f0954c96ec630895892f189874a01000000000000225120a9af1fae42dbe9b0604e0ed64ae6e26d56d1c9bbcc4e1e66326914bdb5149606591a000000000000225120cfb72754409e197bce4ea0670bd4f977104bcc86f7ea65d8981609dc66e984454402000000000000160014c015c65276d5f38d599d445c4cb03aa7aa0dc365580200000000000017a91433ab469b293fa7700f0954c96ec630895892f18987580200000000000017a91433ab469b293fa7700f0954c96ec630895892f18987d8c300000000000017a91433ab469b293fa7700f0954c96ec630895892f189870247304402204c291efdec8e7442aef45ad4751938ae21b847bedde8ce8c9eb208f7a29537880220247a6767215d12c0c5ebc751b6386c50c3a9d5ba0792e0396e2ae420b736a5ab0121032765788cbacba654f3cdf679026db3cdb5a5d0310f870f4da223926a2813259902483045022100bceed8f98e1fbed310cfc01e2bdd3dcbd146064c6fc9d423e787367602d8df7c02204e300e2c9e6c4be50f2c9db54c2f6aeb5eae1897db38bf6406f16ee2e3de4f5e0121032765788cbacba654f3cdf679026db3cdb5a5d0310f870f4da223926a2813259901414045d5e077660865bde16a0af320b426f636b49ea7674f1cc1a9d7c86643638cdbb21c9a281c79aeaa118d833840eca4ec0b3cc6a807f1900bb7395ab4eb72ff830247304402204fdc2e31b88b42081c42dc6c249297aeffe1147071fa6994f95ded6257d93d9602205bf9c30fc7cf0d2b78a1e0027e1cc4eae6e45aef7281017fac932058ee1674d70121032765788cbacba654f3cdf679026db3cdb5a5d0310f870f4da223926a281325990000000001012b4a01000000000000225120a9af1fae42dbe9b0604e0ed64ae6e26d56d1c9bbcc4e1e66326914bdb51496060117207f003df863d4c17579f7b22f7498e39525b81c947aef234859b0466d3dd8dfb3000100fd2603020000000001048a841e4104389e3b5b04c1522ed7bfc0e64c3760cb801a2ee2406d1c2373d81d0800000000ffffffff8a841e4104389e3b5b04c1522ed7bfc0e64c3760cb801a2ee2406d1c2373d81d0500000000ffffffff9584f0b205109f6790fbf08f782166892f22facb8e2598b705cd9136b25aabc30000000000ffffffff4f4b0bbc053b9e3cb6261cb83c063481eba8a8a32a448c63f1c1218d6fe330380600000000ffffffff07b004000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed02202000000000000225120b1a548f1672b6bc666e23943b0b138a4216e2ce5f9bc687469e0f52a917bbf2775120000000000002251208ef171ead3a8f91d9dca9ae4b645537aafada16559f9f714cbe524ef672ab4144402000000000000160014c015c65276d5f38d599d445c4cb03aa7aa0dc3655802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed05802000000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed04057060000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed002483045022100a5cf71b0115db7980055fa9158c24fca9e3cc09cca0d1a0c54f17e8fa92d3e2402201b7dce27ff09e06c40a87b54aa2db693f49291e2f1a32f055155a3750607d01e0121028b8437ac47a4434d4b86d19ab7eeb255887f75cfa43ca135168bfc8281ae8bb902473044022049edbc2650ed737bad10d567c072da54c6b592fcfe2240fabcd49d8aa176422102206c8101ba6f8d6a155ed916ca7b25bf69395d76c020cb6ed9cf8293d65870346e0121028b8437ac47a4434d4b86d19ab7eeb255887f75cfa43ca135168bfc8281ae8bb901410a4a56764a5f9ed3fee4a869f6edee7b9b72f87bdba96d08310191a6df94bcf56f32152e63a836844cea71611886e3f96f74a2cc06d88ddf508184857f5fb4138302473044022075b779781668f4a487c2308aca9217125b897d089f617d831122612db02a672402200ef61ec6ddb6cac999e528e9e4fe27acb0a1cba4f8b33204b180ee458a8d82790121028b8437ac47a4434d4b86d19ab7eeb255887f75cfa43ca135168bfc8281ae8bb90000000001011f4057060000000000160014b2c9b35e4b02e8b16236ae5c0540cf2d56605ed00000000000000000"), { inputsToSign: [\ {\ address: "bc1qktymxhjtqt5tzc3k4ewq2sx094txqhksgy8hsw",\ signingIndexes: [0, 1, 3],\ sigHash: 0,\ },\ ], }, ); Was this page helpful? YesNo [Establish a connection](https://docs.phantom.com/bitcoin/establishing-a-connection) [Sign a message](https://docs.phantom.com/bitcoin/signing-a-message) ⌘I --- # Display tokens on Solana - Phantom developer documentation [Skip to main content](https://docs.phantom.com/best-practices/tokens/README#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Token display and verification Display tokens on Solana [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Search for metadata](https://docs.phantom.com/best-practices/tokens/README#search-for-metadata) * [Categorize tokens](https://docs.phantom.com/best-practices/tokens/README#categorize-tokens) * [Display tokens](https://docs.phantom.com/best-practices/tokens/README#display-tokens) If you’ve created a token on Solana using the [SPL Token Program](https://spl.solana.com/token) or [Token-2022 Program (“Token Extensions”)](https://spl.solana.com/token-2022) , then your token is compatible with Phantom. If Phantom users own a certain balance of a token made with these programs, that balance will always appear in their wallet. However, if Phantom cannot find more metadata about that token, it will display the token as “Unknown.” [​](https://docs.phantom.com/best-practices/tokens/README#search-for-metadata) Search for metadata ----------------------------------------------------------------------------------------------------- When searching for metadata, Phantom will first look to the [Token Metadata Program](https://developers.metaplex.com/token-metadata) established by [Metaplex](https://www.metaplex.com/) . This program enhances ordinary SPL token [mints](https://docs.solana.com/integrations/exchange#token-mints) with a Metadata Account that describes additional fields such as the token’s `symbol`, `image`, and `description`. Some of these fields exist on-chain in the Metadata Account itself, while others exist off-chain in a JSON file that follows a [standard format](https://developers.metaplex.com/token-metadata/token-standard) . The link to this off-chain JSON file is found at the Metadata Account’s `uri` field. If a Metadata Account is found, Phantom will prioritize on-chain fields (such as `name`, `symbol`) before off-chain fields described in the `uri` JSON file. [​](https://docs.phantom.com/best-practices/tokens/README#categorize-tokens) Categorize tokens ------------------------------------------------------------------------------------------------- Phantom will categorize and display tokens based on their [Token Standard](https://developers.metaplex.com/token-metadata/token-standard) . The `tokenStandard` field can be found in the token’s on-chain Metadata Account and is used to describe a token’s fungibility. The `tokenStandard` field has four options: * `Fungible`: A token with simple metadata that can be freely mixed with others of the same mint. Common examples include [USDC](https://www.circle.com/en/usdc) and [SRM](https://www.projectserum.com/) . * `FungibleAsset`: A token with metadata that can also have NFT-like attributes. Commonly referred to as Semi-Fungible, these tokens are often used in gaming contexts to support stackable items like a piece of wood. * `NonFungible`: A non-fungible token with a [Master Edition](https://docs.metaplex.com/programs/token-metadata/accounts#master-edition) account. This is the most popular type of NFT, encompassing well known collections like [Solana Monkey Business](https://solanamonkey.business/) and [DeGods](https://www.degods.com/) . * `NonFungibleEdition`: A non-fungible token with an [Edition](https://developers.metaplex.com/token-metadata/token-standard#the-token-standard-field) account (printed from a Master Edition). This is a helpful feature for creators who want to offer multiple copies of their 1/1 NFTs. * `ProgrammableNonFungible`: A new non-fungible asset class that allows for flexible configuration of various lifecycle rules triggered by specific actions. For more information about Programmable NFTs or pNFTs, visit [Programmable NFTs](https://developers.metaplex.com/token-metadata/pnfts) . If no `tokenStandard` is set, Phantom will fallback to categorizing tokens based on the following logic: 1. If the total mint supply is 1, Phantom will consider the token to be `NonFungible`. 2. If the total mint supply is greater than 1 and the mint has 0 decimals, Phantom will consider the token to be a `FungibleAsset`. 3. Phantom will consider all other tokens to be `Fungible`. [​](https://docs.phantom.com/best-practices/tokens/README#display-tokens) Display tokens ------------------------------------------------------------------------------------------- Phantom will display all `Fungible` tokens in the **Home** tab. For more details on `Fungible` token best practices, refer to our [Fungibles](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles) documentation. All other token standards (`FungibleAsset`, `NonFungible`, and `NonFungibleEdition`) will be displayed in the **Collectibles** tab. For more information on collectible best practices, see [Collectibles](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles) . Was this page helpful? YesNo [Display apps within dialogs](https://docs.phantom.com/best-practices/displaying-your-app) [Fungibles](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles) ⌘I --- # NFTs and semi-fungibles - Phantom developer documentation [Skip to main content](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Token display and verification NFTs and semi-fungibles [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Group collectibles](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#group-collectibles) * [Name grouped collectibles](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#name-grouped-collectibles) * [Display an individual collectible](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#display-an-individual-collectible) * [Render collectible media](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#render-collectible-media) * [Supported media types](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#supported-media-types) * [Select media](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#select-media) * [Determine media type](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#determine-media-type) * [Resize images](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#resize-images) On Solana, NFTs are often thought of as [SPL Tokens](https://spl.solana.com/token#example-create-a-non-fungible-token) with 0 decimals and a supply of 1. According to the [Token Metadata Standard](https://developers.metaplex.com/token-metadata/token-standard) , however, it is possible for a range of different tokens to have NFT-like characteristics. Phantom refers to all NFT-like tokens as **collectibles** and will display them separately from `Fungible` tokens that appear on the **Home** tab. Specifically, Phantom will display all `FungibleAsset`, `NonFungible`, `NonFungibleEdition` and `ProgrammableNonFungible` tokens on their own **Collectibles** tab. [​](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#group-collectibles) Group collectibles --------------------------------------------------------------------------------------------------------------------------------- Phantom groups collectibles by their [Certified Collections](https://developers.metaplex.com/token-metadata/collections) introduced in [v1.1.0 of the Token Metadata Standard](https://developers.metaplex.com/token-metadata/token-standard) . In order to be grouped together, individual NFTs should all reference the same verified collection mint address. This mint address is itself home to an NFT with metadata that describes the collection as in the [example](https://solscan.io/token/SMBH3wF6baUj6JWtzYvqcKuj2XCKWDqQxzspY12xPND#metadata) . Creators must ensure that this collection is [verified on-chain](https://developers.metaplex.com/token-metadata/collections) (that is, that `verified` is set to `true`). If no verified collection is found, Phantom will fallback to grouping NFTs by the first verified creator’s address in the on-chain `creators` field. If two unverified items share the same creator address at the 0 index of their `creators` array, they will be grouped into the same collection. [​](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#name-grouped-collectibles) Name grouped collectibles ----------------------------------------------------------------------------------------------------------------------------------------------- When a group is created, a best-effort process is used to determine that group’s name. Phantom will look to these fields in the following order of preference: 1. `name` of the verified on-chain collection NFT 2. `collection.name` 3. `collection.family` 4. `external_url` (parsed to remove url parts) 5. `name` (of a single collectible) 6. `symbol` 7. address of the first verified creator in the `creators` array (also used to group the collection) [​](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#display-an-individual-collectible) Display an individual collectible --------------------------------------------------------------------------------------------------------------------------------------------------------------- When displaying the detail view of an individual collectible, Phantom will prioritize on-chain data in the Metadata Account over off-chain JSON linked via the `uri` field. This impacts both the `name` and `symbol` field which appears in both locations. [​](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#render-collectible-media) Render collectible media --------------------------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#supported-media-types) **Supported media types** Phantom supports a wide-range of media types. For a full list, refer to [Supported media types](https://docs.phantom.com/best-practices/tokens/supported-media-types) . ### [​](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#select-media) **Select media** When determining what media to display for a given collectible, Phantom will search the off-chain JSON for data in the following order: 1. `animation_url`: Phantom will select the media source at the collectible’s `animation_url` field. 2. `properties.files`: If no `animation_url` is found, Phantom will choose the first file where the `cdn` property is set to `true`. Otherwise, a file will be chosen based on the media type in the following order of preference: 1. `image` 2. `audio` 3. `video` 4. `vr` or `model` 3. `image`: Finally, if Phantom still cannot find media to display, it will fallback to the media source at the collectible’s `image` field. ### [​](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#determine-media-type) **Determine media type** If a media source is found in `properties.files`, and that source is defined as an object, Phantom will determine the media type based on that file’s `type` property. Under the Token Metadata Standard, file objects are defined with the following structure: | Field | Type | Description | | --- | --- | --- | | type | string | The media type of the file. If selected, Phantom will use this to determine the media type. For example, “image/png.” | | uri | string | The URI source of the file. For example, [https://asfh3uxyeoyvtkfqc7jagy3mhtsszhyubnc3wfss5ismdgtw.arweave.net/BIp90vgjs\_VmosBfSA2NsPOUsnxQLRbsWUuo-kwZp2o?ext=png](https://asfh3uxyeoyvtkfqc7jagy3mhtsszhyubnc3wfss5ismdgtw.arweave.net/BIp90vgjs_VmosBfSA2NsPOUsnxQLRbsWUuo-kwZp2o?ext=png) | | cdn | boolean (optional) | An optional flag that dictates if the file is hosted on a cdn. If `true`, Phantom will select this file as the primary source file. | In cases where Phantom cannot find a source from `properties.files`, it may fallback to a media source that is defined as a `string` (such as `animation_url` or `image`). In these cases, Phantom will look for data in the following order of preference: 1. The media source URI’s `?ext=` query string parameter (`https://example.com/foo?ext=png`). 2. The media source URI’s pathname extension (`https://example.com/foo.png`). 3. If the media source URI comes from the `animation_url`, Phantom will infer the media type based on the collectible’s `properties.category` field. 4. If the media source URI comes from the `image` field, Phantom will default to assume it is a PNG. If no supported media type can be determined, no media will be selected, and users may see a placeholder image instead. ### [​](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles#resize-images) **Resize images** Phantom will resize all collectible images to 256x256 pixels. For best results, we recommend images with a square aspect ratio and a power-of-2 dimension (for example, 256x256, 512x512, or 1024x1024). Was this page helpful? YesNo [Fungibles](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles) [Supported media types](https://docs.phantom.com/best-practices/tokens/supported-media-types) ⌘I --- # Get started with EVM networks - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/getting-started#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Ethereum, Monad, Base, and Polygon Get started with EVM networks [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) The Phantom browser extension and mobile in-app browser are both designed to interact with web applications. EVM web apps can interact with Phantom via the provider that is injected at `window.phantom.ethereum`. This provider conforms to the [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) standard and is also injected at `window.ethereum` to support legacy integrations. Phantom also supports [EIP-6963](https://eip6963.org/) for ease of integration. Additionally, Phantom has enabled support for the Monad Testnet, allowing developers and users to interact with the Monad network before its mainnet launch. Developers can integrate Monad Testnet support using Phantom’s existing EVM provider by adding the relevant [network parameters](https://docs.monad.xyz/getting-started/network-information) and referring to the Monad documentation for any [special considerations](https://docs.monad.xyz/getting-started/differences) . Users must enable the Monad Testnet in Phantom’s settings before interacting with it. Once Monad mainnet support is enabled by default, this step will no longer be necessary. This documentation is dedicated to covering all aspects of the provider. Was this page helpful? YesNo [Error messages and codes](https://docs.phantom.com/solana/errors) [Detect the provider](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/detecting-the-provider) ⌘I --- # Detect the provider - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/detecting-the-provider#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Ethereum, Monad, Base, and Polygon Detect the provider [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [window.phantom](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/detecting-the-provider#window-phantom) * [window.ethereum](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/detecting-the-provider#window-ethereum) To detect if a user has already installed Phantom, a web application should check for the existence of a `phantom` object. Phantom’s browser extension and mobile in-app browser will both inject a `phantom` object into the [window](https://developer.mozilla.org/en-US/docs/Web/API/Window) of any web application the user visits, provided that site is using `https://`, on `localhost`, or is `127.0.0.1.` Phantom will not inject the provider into [iframes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) or sites using `http://`. If a `phantom` object exists, EVM dApps can interact with Phantom via the API found at `window.phantom.ethereum`. This `ethereum` provider is also made available at `window.ethereum` but is prone to namespace collisions from other injected wallets. To detect if Phantom is installed, an application should check for an additional `isPhantom` flag. Report incorrect code Copy Ask AI const isPhantomInstalled = window?.phantom?.ethereum?.isPhantom If Phantom is not installed, we recommend you redirect your users to our website `https://phantom.com/`. Altogether, this may look like the following: [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/detecting-the-provider#window-phantom) window.phantom ----------------------------------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI const getProvider = () => { if ('phantom' in window) { const anyWindow: any = window; const provider = anyWindow.phantom?.ethereum; if (provider) { return provider; } } window.open('https://phantom.com/', '_blank'); }; [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/detecting-the-provider#window-ethereum) window.ethereum ------------------------------------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI const getProvider = () => { if ('ethereum' in window) { const anyWindow: any = window; const provider = anyWindow.ethereum; if (provider?.isPhantom) { return provider; } } window.open('https://phantom.com/', '_blank'); }; For an example of how a React application can detect Phantom, refer to [getProvider](https://github.com/phantom-labs/eth_sandbox/blob/main/src/utils/getProvider.ts) in our sandbox. Was this page helpful? YesNo [Get started with EVM networks](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/getting-started) [Establish a connection](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection) ⌘I --- # Wallet Standard - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/wallet-standard#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Integration patterns Wallet Standard [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [For app developers](https://docs.phantom.com/developer-powertools/wallet-standard#for-app-developers) * [Further reading](https://docs.phantom.com/developer-powertools/wallet-standard#further-reading) [Wallet Standard](https://github.com/wallet-standard/wallet-standard) is a chain-agnostic set of interfaces and conventions that aim to improve how applications interact with injected wallets such as Phantom. The standard was pioneered on Solana and is used as the foundation for the [Solana Wallet Adapter](https://github.com/solana-labs/wallet-adapter) . Phantom supports the Wallet Standard and is open to working with others to bring this innovation to other ecosystems. Wallet Standard introduces an event-based model that: 1. Standardizes the way wallets attach themselves to the window. 2. Defines a set of standard APIs that dapps can rely upon. At a high-level, Wallet Standard defines the following [Window interface](https://github.com/wallet-standard/wallet-standard/blob/ce280f05f6eb16d0e77939827e0b7fa294460e1f/packages/core/base/src/window.ts#L16-L25) for events: Report incorrect code Copy Ask AI export interface WalletEventsWindow extends Omit { /** Add a listener for {@link WindowAppReadyEvent}. */ addEventListener(type: WindowAppReadyEventType, listener: (event: WindowAppReadyEvent) => void): void; /** Add a listener for {@link WindowRegisterWalletEvent}. */ addEventListener(type: WindowRegisterWalletEventType, listener: (event: WindowRegisterWalletEvent) => void): void; /** Dispatch a {@link WindowAppReadyEvent}. */ dispatchEvent(event: WindowAppReadyEvent): void; /** Dispatch a {@link WindowRegisterWalletEvent}. */ dispatchEvent(event: WindowRegisterWalletEvent): void; } When a wallet is ready to inject into a website, it will [dispatch](https://github.com/wallet-standard/wallet-standard/blob/ce280f05f6eb16d0e77939827e0b7fa294460e1f/packages/core/wallet/src/register.ts#L27-L38) a `register-wallet` event and listen for an `app-ready` event. Conversely, an app will [dispatch](https://github.com/wallet-standard/wallet-standard/blob/master/packages/core/app/src/wallets.ts#L39-L50) an `app-ready` event and listen for `register-wallet` events. [​](https://docs.phantom.com/developer-powertools/wallet-standard#for-app-developers) For app developers ----------------------------------------------------------------------------------------------------------- Phantom comes with built-in support for Wallet Standard on **Solana**. To get started, simply update the [Solana Wallet Adapter](https://github.com/solana-labs/wallet-adapter) to the latest release. For a demo, check out the [Wallet Adapter](https://anza-xyz.github.io/wallet-adapter/example/) example. If you are migrating an existing Solana dapp to use Wallet Standard, please ensure that you are not mutating transactions in place. Failure to do will result in a breaking change. [​](https://docs.phantom.com/developer-powertools/wallet-standard#further-reading) Further reading ----------------------------------------------------------------------------------------------------- [Wallet Standard design document](https://github.com/wallet-standard/wallet-standard/blob/master/DESIGN.md) Was this page helpful? YesNo [Swap](https://docs.phantom.com/phantom-deeplinks/other-methods/swap) ⌘I --- # Make your token appear as verified - Phantom developer documentation [Skip to main content](https://docs.phantom.com/best-practices/tokens/token-verification#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Token display and verification Make your token appear as verified [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Phantom doesn’t manage token verification directly and doesn’t have an email address or form to assist with verification. Instead, Phantom displays token information using data from trusted third-party sources (for example, [CoinGecko](https://support.coingecko.com/hc/en-us/articles/23725417857817-Verification-Guide-for-Listing-Update-Requests-on-CoinGecko) and [Jupiter](https://verified.jup.ag/tokens) ). We’re unable to provide specific details about how token verification status is determined in Phantom. If you’re trying to have a token appear as verified, a good first step is to make sure the token is recognized by major token data sources (for example, by being listed or verified there). Was this page helpful? YesNo [Supported media types](https://docs.phantom.com/best-practices/tokens/supported-media-types) [FAQ](https://docs.phantom.com/resources/faq) ⌘I --- # Limitations - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/limitations#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Mobile deep links Limitations [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Android](https://docs.phantom.com/phantom-deeplinks/limitations#android) * [iOS](https://docs.phantom.com/phantom-deeplinks/limitations#ios) [​](https://docs.phantom.com/phantom-deeplinks/limitations#android) Android ------------------------------------------------------------------------------ Android has a 500kb transaction limit when passing data between services and apps. The requesting app may crash with a `TransactionTooLarge` exception when requesting a string over 500kb (over 31k characters). This tends to happen with significantly large intents. [​](https://docs.phantom.com/phantom-deeplinks/limitations#ios) iOS ---------------------------------------------------------------------- iOS is not known to have a 500kb transaction and allows [transmissions up to 1 MB](https://github.com/zoul/ios-url-scheme-length-limit/blob/master/Transmitter/ViewController.swift) . Was this page helpful? YesNo [Encryption](https://docs.phantom.com/phantom-deeplinks/encryption) [Provider methods](https://docs.phantom.com/phantom-deeplinks/provider-methods/README) ⌘I --- # Supported media types - Phantom developer documentation [Skip to main content](https://docs.phantom.com/best-practices/tokens/supported-media-types#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Token display and verification Supported media types [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Phantom supports a range of token media types, including images, audio files, video files, and 3D models. At this time, Phantom doesn’t support HTML files. The following list includes all file types supported by Phantom: | Media | Format | | --- | --- | | Images | JPEG, JPG, PNG, GIF, SVG, WEBP | | Video | MP4, MOV, WEBM, M4V, OGV, OGG | | Audio | MP3, WAV, OGA, FLAC | | 3D models | GLB, GLTF, GLTF-BINARY | Was this page helpful? YesNo [NFTs and semi-fungibles](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles) [Make your token appear as verified](https://docs.phantom.com/best-practices/tokens/token-verification) ⌘I --- # Fungibles - Phantom developer documentation [Skip to main content](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Token display and verification Fungibles [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Display fungible tokens](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles#display-fungible-tokens) * [Display prices](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles#display-prices) [​](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles#display-fungible-tokens) Display fungible tokens ------------------------------------------------------------------------------------------------------------------------- Phantom prioritizes on-chain metadata that follows the [Token Metadata Standard](https://developers.metaplex.com/token-metadata/token-standard) . For [fungible tokens](https://developers.metaplex.com/token-metadata/token-standard#the-fungible-standard) specifically, Phantom will show the following fields: | Field | Description | | --- | --- | | name | The name of the token, such as “USD Coin.” | | symbol | The symbol of the token, such as ”USDC.” | | image | A URI pointing to the token’s logo. | If a `Fungible` token has `name` and `symbol` fields present on both its on-chain Metadata Account and off-chain JSON file (linked via the on-chain `uri` field), Phantom will prioritize the on-chain fields. If a `Fungible` token does not have an on-chain Metadata Account, Phantom will fallback to displaying data from the [Solana Labs Token List](https://github.com/solana-labs/token-list) . This list is considered deprecated and should not be used to host new tokens. When reading from the token list, Phantom will display the following fields: | Field | Description | | --- | --- | | name | The name of the token, such as “USD Coin.” | | symbol | The symbol of the token, such as ”USDC.” | | logoURI | A URI pointing to the token’s logo. | | extensions.coingeckoID | The token ID as defined by the Coingecko API. Phantom uses this to fetch the price of the token. | [​](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles#display-prices) Display prices ------------------------------------------------------------------------------------------------------- Phantom will display prices for any token that is verified on [Coingecko](https://www.coingecko.com/) . When verifying with Coingecko, be sure to include the token’s `contract`. For Solana tokens, this should be the mint address. For example, [Bonk](https://www.coingecko.com/en/coins/bonk) is verified with the contract [DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263](https://solscan.io/token/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263) . Once a token has verified its `contract` address with Coingecko, Phantom will automatically begin displaying its price. If Coingecko is unable to return a price for a given token, Phantom will fallback to using [Birdeye](https://birdeye.so/) for token prices. Was this page helpful? YesNo [Display tokens on Solana](https://docs.phantom.com/best-practices/tokens/README) [NFTs and semi-fungibles](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles) ⌘I --- # Provider API reference - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/README#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Provider API reference Provider API reference [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Phantom’s provider API is exposed to the user through the `window.ethereum` object that is injected into the browser. This same provider is made available at `window.phantom.ethereum` to prevent namespace collisions. This API is how a dapp will make requests to the user; reading account data, connecting to the website, signing messages, and sending transactions will all be done through this provider object. This provider API is specified in greater detail in [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) . This area of the documentation will contain information about the API’s properties, events, and methods. Was this page helpful? YesNo [Sign a message](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/signing-a-message) [Properties](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/README) ⌘I --- # Establish a connection - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Ethereum, Monad, Base, and Polygon Establish a connection [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Connect](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection#connect) * [Disconnect](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection#disconnect) * [Change accounts](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection#change-accounts) Once an application has [detected the provider](https://docs.phantom.com/solana/detecting-the-provider) , it can then request to connect to Phantom. This connection request will prompt the user for permission to share their public key, indicating that they are willing to interact further. Users must approve a connection request before the app can make additional requests such as [signing a message](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/signing-a-message) or [sending a transaction](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/sending-a-transaction) . Once permission is established for the first time, the web application’s domain will be whitelisted for future connection requests. After a connection is established, it is possible to terminate the connection from both the application and the user side. [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection#connect) Connect ------------------------------------------------------------------------------------------------------------------ The default way to connect to Phantom is by calling `window.ethereum.request()` function. Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" try { const accounts = await provider.request({ method: "eth_requestAccounts" }); console.log(accounts[0]); // 0x534583cd8cE0ac1af4Ce01Ae4f294d52b4Cd305F } catch (err) { // { code: 4001, message: 'User rejected the request.' } } The `eth_requestAccounts` method will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) . If it resolves, it is an array where the connected address is in the 0th index, and rejects (throw when awaited) when the user declines the request or closes the pop-up. See [Errors](https://docs.phantom.com/solana/errors) for a breakdown of error messages Phantom may emit. When the user accepts the request to connect, the provider will also emit a `connect` event that contains the `chainId` of the network the user is connected to. Report incorrect code Copy Ask AI provider.on("connect", (connectionInfo: { chainId: string }) => console.log(`Connected to chain: ${connectionInfo.chainId}`)); Once the web application is connected to Phantom, it will be able to read the connected account’s address and prompt the user for additional transactions. It also exposes a convenience `isConnected` boolean. Report incorrect code Copy Ask AI console.log(provider.selectedAddress); // 0x534583cd8cE0ac1af4Ce01Ae4f294d52b4Cd305F console.log(provider.isConnected()); // true [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection#disconnect) Disconnect ------------------------------------------------------------------------------------------------------------------------ There is no way to programmatically disconnect a user from their connection once they have established one. Once a user has established a connection, Phantom will add the website they opened a connection with to a list of “trusted apps.” The user can then revoke access through the UI at any time, and will then need to reconnect. Phantom will attempt to reconnect to any application that is added to the users’ “trusted apps” automatically. [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection#change-accounts) Change accounts ---------------------------------------------------------------------------------------------------------------------------------- Phantom allows users to seamlessly manage multiple accounts (addresses) from within a single extension or mobile app. Whenever a user switches accounts, Phantom will emit an `accountsChanged` event. If a user changes accounts while already connected to an application, and the new account had already whitelisted that application, then the user will stay connected and Phantom will pass the public key of the new account: Report incorrect code Copy Ask AI provider.on('accountsChanged', (publicKeys: String[]) => { if (publicKeys) { // Set new public key and continue as usual console.log(`Switched to account ${publicKeys[0]}`); } }); If Phantom does not pass the public key of the new account, an application can either do nothing or attempt to reconnect: Report incorrect code Copy Ask AI provider.on('accountsChanged', (publicKeys: String[]) => { if (publicKeys) { // Set new public key and continue as usual console.log(`Switched to account ${publicKeys[0].toBase58()}`); } else { // Attempt to reconnect to Phantom provider.request({ method: "eth_requestAccounts" }).catch((error) => { // handle connection failure }); } }); Was this page helpful? YesNo [Detect the provider](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/detecting-the-provider) [Send a transaction](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/sending-a-transaction) ⌘I --- # Error messages and codes - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/errors#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Provider API reference Error messages and codes [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) When making requests to Phantom in [establishing a connection](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection) , [sending a transaction](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/sending-a-transaction) , or [signing a message](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/signing-a-message) , Phantom may respond with an error. The following is a list of all possible error codes and their meanings. These error messages follow [EIP-1474](https://eips.ethereum.org/EIPS/eip-1474#error-codes) and [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193#provider-errors) . | Code | Title | Description | | --- | --- | --- | | 4900 | Disconnected | Phantom could not connect to the network. | | 4100 | Unauthorized | The requested method and/or account has not been authorized by the user. | | 4001 | User Rejected Request | The user rejected the request through Phantom. | | \-32000 | Invalid Input | Missing or invalid parameters. | | \-32002 | Requested resource not available | This error occurs when a dapp attempts to submit a new transaction while Phantom’s approval dialog is already open for a previous transaction. Only one approve window can be open at a time. Users should approve or reject their transaction before initiating a new transaction. | | \-32003 | Transaction Rejected | Phantom does not recognize a valid transaction. | | \-32601 | Method Not Found | Phantom does not recognize the method. | | \-32603 | Internal Error | Something went wrong within Phantom. | Was this page helpful? YesNo [request](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request) [Get started with Bitcoin](https://docs.phantom.com/bitcoin/integrating-phantom) ⌘I --- # Transaction Validation - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/lighthouse#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Security and validation Transaction Validation [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [What this means for your transactions](https://docs.phantom.com/developer-powertools/lighthouse#what-this-means-for-your-transactions) * [Additional information](https://docs.phantom.com/developer-powertools/lighthouse#additional-information) When building with Phantom, you may see transactions that include Lighthouse assertion instructions. Lighthouse is a Solana program that adds runtime checks to transactions. These checks validate onchain state and will cause the transaction to fail if conditions aren’t met. These assertions are included to ensure user safety by protecting against unexpected outcomes like simulation spoofing or malicious transaction manipulation. [​](https://docs.phantom.com/developer-powertools/lighthouse#what-this-means-for-your-transactions) What this means for your transactions -------------------------------------------------------------------------------------------------------------------------------------------- When you submit a transaction to Phantom, it may be augmented with Lighthouse assertion instructions before being submitted to the network. This means that if you’re checking transactions onchain as part of your confirmation flow, you should be aware that the transaction onchain will be different from what you originally submitted. Additionally, these assertions can cause a transaction to fail even when it would otherwise execute successfully. For example, if a swap transaction includes an assertion checking for a specific token balance and the actual balance differs, the entire transaction will fail. You don’t need to do anything special to handle these assertions. They’re included in the transaction by Phantom and are processed automatically onchain. [​](https://docs.phantom.com/developer-powertools/lighthouse#additional-information) Additional information -------------------------------------------------------------------------------------------------------------- For guidance on handling transaction warnings and best practices, see [Domain and transaction warnings](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings) . Was this page helpful? YesNo [Domain and transaction warnings](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings) [Token pages](https://docs.phantom.com/developer-powertools/token-pages) ⌘I --- # Phantom deep links - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/deeplinks-ios-and-android#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Mobile deep links Phantom deep links [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) As of Phantom `v22.04.11`, iOS and Android apps can now natively interact with Phantom through either [universal links](https://developer.apple.com/ios/universal-links/) (recommended) or [deeplinks](https://en.wikipedia.org/wiki/Mobile_deep_linking) . We refer to both of these workflows collectively as “deeplinks”. Currently only Solana is supported for deeplinks. All [provider methods](https://docs.phantom.com/phantom-deeplinks/provider-methods/README) follow a protocol format of: Report incorrect code Copy Ask AI https://phantom.app/ul// It is also possible (but not recommended) to call these methods using Phantom’s custom protocol handler: Report incorrect code Copy Ask AI phantom:/// In addition to these provider methods, Phantom also supports [other methods](https://docs.phantom.com/phantom-deeplinks/other-methods/README) that are accessible via deeplinks. Specifically, users can open web apps within Phantom’s in-app browser via the [Browse](https://docs.phantom.com/phantom-deeplinks/other-methods/browse) deeplink. Was this page helpful? YesNo [Sign a message](https://docs.phantom.com/sui/signing-a-message) [Handle sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions) ⌘I --- # Encryption - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/encryption#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Mobile deep links Encryption [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Encryption and decryption workflow](https://docs.phantom.com/phantom-deeplinks/encryption#encryption-and-decryption-workflow) * [Connect](https://docs.phantom.com/phantom-deeplinks/encryption#connect) * [Subsequent deeplinks](https://docs.phantom.com/phantom-deeplinks/encryption#subsequent-deeplinks) * [Encryption resources](https://docs.phantom.com/phantom-deeplinks/encryption#encryption-resources) * [JavaScript](https://docs.phantom.com/phantom-deeplinks/encryption#javascript) * [iOS](https://docs.phantom.com/phantom-deeplinks/encryption#ios) * [Android](https://docs.phantom.com/phantom-deeplinks/encryption#android) Deeplinks are encrypted using symmetric key encryption generated from a [Diffie-Hellman key exchange](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) . While deeplink sessions will be created in plaintext, an encrypted channel will be created to prevent session tokens from getting hijacked. [​](https://docs.phantom.com/phantom-deeplinks/encryption#encryption-and-decryption-workflow) Encryption and decryption workflow ----------------------------------------------------------------------------------------------------------------------------------- Phantom deeplinks are encrypted with the following workflows: ### [​](https://docs.phantom.com/phantom-deeplinks/encryption#connect) Connect 1. **\[dapp\]:** On the initial [connect deeplink](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) , dapps should include a `dapp_encryption_public_key` query parameter. It’s recommended to create a new x25519 keypair for every session started with `connect`. In all methods, the public key for this keypair is referred to as `dapp_encryption_public_key`. 2. **\[phantom\]:** Upon handling a `connect` deeplink, Phantom will also generate a new x25519 keypair. * Phantom will return this public key as `phantom_encryption_public_key` in the `connect` response. * Phantom will create a secret key using Diffie-Hellman with `dapp_encryption_public_key` and the _**private key**_ associated with `phantom_encryption_public_key`. * Phantom will locally store a mapping of `dapp_encryption_public_key` to shared secrets for use with decryption in subsequent deeplinks. 3. **\[dapp\]:** Upon receiving the `connect` response, the dapp should create a shared secret by using Diffie-Hellman with `phantom_encryption_public_key` and the _**private key**_ associated with `dapp_encryption_public_key`. This shared secret should then be used to decrypt the `data` field in the response. If done correctly, the user’s public key will be available to share with the dapp inside the `data` JSON object. ### [​](https://docs.phantom.com/phantom-deeplinks/encryption#subsequent-deeplinks) Subsequent deeplinks 1. **\[dapp\]:** For any subsequent methods (such as [SignTransaction](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction) and [SignMessage](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage) ), dapps should send a `dapp_encryption_public_key` (the public key side of the shared secret) used with Phantom along with an encrypted `payload` object. 2. **\[phantom\]:** Upon approval, Phantom will encrypt the signed response as a JSON object with the encryption sent as a `data=` query param. 3. **\[dapp\]:** Upon receiving the deeplink response, dapps should decrypt the object in the `data=` query param to view the signature. [​](https://docs.phantom.com/phantom-deeplinks/encryption#encryption-resources) Encryption resources ------------------------------------------------------------------------------------------------------- To learn more about encryption and decryption, please refer to the following libraries: ### [​](https://docs.phantom.com/phantom-deeplinks/encryption#javascript) JavaScript [TweetNaCl.js](https://github.com/dchest/tweetnacl-js) ### [​](https://docs.phantom.com/phantom-deeplinks/encryption#ios) iOS [TweetNaCl SwiftWrap](https://github.com/bitmark-inc/tweetnacl-swiftwrap) ### [​](https://docs.phantom.com/phantom-deeplinks/encryption#android) Android * [Tink](https://github.com/google/tink) * [TweetNaCl Java](https://github.com/InstantWebP2P/tweetnacl-java) Was this page helpful? YesNo [Specifying redirects](https://docs.phantom.com/phantom-deeplinks/specifying-redirects) [Limitations](https://docs.phantom.com/phantom-deeplinks/limitations) ⌘I --- # Specifying redirects - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/specifying-redirects#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Mobile deep links Specifying redirects [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Redirect link types](https://docs.phantom.com/phantom-deeplinks/specifying-redirects#redirect-link-types) * [HTTPS URLs](https://docs.phantom.com/phantom-deeplinks/specifying-redirects#https-urls) * [Custom scheme URIs](https://docs.phantom.com/phantom-deeplinks/specifying-redirects#custom-scheme-uris) All [methods](https://docs.phantom.com/phantom-deeplinks/provider-methods/README) support a `redirect_link=` param that lets Phantom know how to get back to the original app. The URI specified by this param should be URL encoded. If the deeplink request to Phantom comes with a response, Phantom will append the results as query parameters in the `redirect_link=` upon redirecting. [​](https://docs.phantom.com/phantom-deeplinks/specifying-redirects#redirect-link-types) Redirect link types --------------------------------------------------------------------------------------------------------------- You can use either HTTPS URLs or custom scheme URIs for `redirect_link`, but each has different behavior: ### [​](https://docs.phantom.com/phantom-deeplinks/specifying-redirects#https-urls) HTTPS URLs When using an HTTPS URL (e.g., `https://yourapp.com/callback`): * **App metadata displays correctly**: Logo, title, and favicon are fetched and shown in the connection approval dialog * **Opens in browser**: The redirect opens in the mobile browser instead of redirecting back to your app Example: Report incorrect code Copy Ask AI redirect_link=https%3A%2F%2Fyourapp.com%2Fcallback ### [​](https://docs.phantom.com/phantom-deeplinks/specifying-redirects#custom-scheme-uris) Custom scheme URIs When using a custom scheme URI (e.g., `mydapp://onPhantomConnected`): * **Redirects back to app**: Properly redirects back to your mobile app * **No app metadata**: Logo, title, and favicon are not displayed in the connection approval dialog Example: Report incorrect code Copy Ask AI redirect_link%3Dmydapp%3A%2F%2FonPhantomConnected After redirect with response data: Report incorrect code Copy Ask AI redirect_link=mydapp://onPhantomConnected?data=... **Choosing a redirect link type**: * Use **HTTPS URLs** if displaying your app’s branding in the connection dialog is important, but be aware that users will be redirected to the browser instead of your app. * Use **custom scheme URIs** if seamless app redirection is critical, but note that your app’s branding will not appear in the connection dialog. Was this page helpful? YesNo [Handle sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions) [Encryption](https://docs.phantom.com/phantom-deeplinks/encryption) ⌘I --- # Domain and transaction warnings - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Security and validation Domain and transaction warnings [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [New domain warning](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings#new-domain-warning) * [Transaction simulation warning](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings#transaction-simulation-warning) * [Prediction market token burn warning](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings#prediction-market-token-burn-warning) Phantom may display different warnings when users connect to your app or sign transactions. These warnings are designed to help protect users from unexpected or unsafe activity. [​](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings#new-domain-warning) New domain warning --------------------------------------------------------------------------------------------------------------------------- If your app or website has been newly launched, Phantom may show users the following message: > _“This domain is new or has not been reviewed yet. Proceed with caution.”_ ![Warning message shown when connecting to a new or unverified domain](https://mintcdn.com/phantom-e50e2e68/-BstuKpEdI9oFGb0/images/warning-new-domain-dev-docs.png?w=2500&fit=max&auto=format&n=-BstuKpEdI9oFGb0&q=85&s=10f0312745d24d90e7eac0e8484083b5 "Warning message shown when connecting to a new or unverified domain") This warning appears automatically for newly detected domains and typically disappears after a few days once the domain has been reviewed. There’s usually **no action required** on your part. If the warning remains visible for more than a week, contact our domain review team using this [form](https://docs.google.com/forms/d/1JgIxdmolgh_80xMfQKBKx9-QPC7LRdN6LHpFFW8BlKM/viewform) . [​](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings#transaction-simulation-warning) Transaction simulation warning --------------------------------------------------------------------------------------------------------------------------------------------------- If Phantom can’t accurately simulate a transaction before it’s sent, users may see the following message: > _“This dApp could be malicious. Do not proceed unless you are certain it is safe.”_ ![Warning displayed when Phantom can’t confirm the safety of a transaction](https://mintcdn.com/phantom-e50e2e68/-BstuKpEdI9oFGb0/images/warning-malicious-dapp-devdocs.png?w=2500&fit=max&auto=format&n=-BstuKpEdI9oFGb0&q=85&s=a09ae7944dbcc318f8823125e08a15cf "Warning displayed when Phantom can’t confirm the safety of a transaction") This message appears when Phantom is unable to safely predict a transaction’s outcome before execution. If Phantom displays this warning when you sign a transaction on your domain, follow these steps: * Limit the transaction to **one** signer. * If the transaction requires multiple signers, sign it with Phantom first using [signTransaction](https://docs.phantom.com/solana/sending-a-transaction#sign-a-transaction-without-sending) instead of signAndSendTransaction, then collect signatures from the other signers. * If your transaction approaches Solana’s size limit, split it into multiple signing requests or use [Address Lookup Tables](https://docs.phantom.com/solana/sending-a-transaction-1#build-an-address-lut) . * Before submitting the transaction for signing, simulate the transaction with `sigVerify: false` using your RPC node to ensure they will not fail onchain. Failed transactions could trigger simulation warnings. If you’ve made these changes and the warning persists, or if you can’t apply these changes, contact our domain review team using this [form](https://docs.google.com/forms/d/1JgIxdmolgh_80xMfQKBKx9-QPC7LRdN6LHpFFW8BlKM/viewform) . [​](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings#prediction-market-token-burn-warning) Prediction market token burn warning --------------------------------------------------------------------------------------------------------------------------------------------------------------- If a transaction attempts to burn a prediction market token, Phantom may show users the following message: > _“This transaction will burn a valuable prediction market token. Please use the Phantom app to close the position first.”_ This warning appears when Phantom detects a transaction that would permanently burn a prediction market token. To resolve this warning, contact our Trust and Safety team using this [form](https://docs.google.com/forms/d/1JgIxdmolgh_80xMfQKBKx9-QPC7LRdN6LHpFFW8BlKM/viewform) . Was this page helpful? YesNo [MCP server](https://docs.phantom.com/resources/mcp-server) [Transaction Validation](https://docs.phantom.com/developer-powertools/lighthouse) ⌘I --- # Create an app - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-portal/create-app#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Account setup Create an app [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Create an app](https://docs.phantom.com/phantom-portal/create-app#create-an-app) * [Next steps](https://docs.phantom.com/phantom-portal/create-app#next-steps) After creating your Phantom Portal account, the next step is to create an app. This establishes your app’s presence in the portal and allows you to configure settings, verify your domain, and integrate with Phantom. [​](https://docs.phantom.com/phantom-portal/create-app#create-an-app) Create an app -------------------------------------------------------------------------------------- When you first sign in to Phantom Portal, you’ll see an option to create a new app. 1. Click **Create New App** or **Add App** on your dashboard. 2. Fill in the required fields: * **Upload Avatar**: Upload your app icon (PNG or JPG, max 1MB, 250×250px minimum) * **App Name**: Enter your app’s official name * **Website**: Enter your app’s public URL (must use HTTPS, e.g., `https://yourapp.com`) 3. Click **Continue**. ![Create New App modal showing app creation form](https://mintcdn.com/phantom-e50e2e68/oGAeqebvkE4mhDv1/phantom-portal/images/create-app.png?w=2500&fit=max&auto=format&n=oGAeqebvkE4mhDv1&q=85&s=d010fd338928ad9fab884cf044efa6ab) Your app is now created and you can proceed with the setup process. You’ll be taken to your app’s dashboard where you can: * Verify your domain (required for SDK usage and app display) * Configure allowed origins for your app * Add additional app information and branding * Get your App ID for SDK integration [​](https://docs.phantom.com/phantom-portal/create-app#next-steps) Next steps -------------------------------------------------------------------------------- [Create an account\ -----------------\ \ Previous: Sign up for a Phantom Portal account to manage your app](https://docs.phantom.com/phantom-portal/create-account) [Verify your domain\ ------------------\ \ Next: Verify your domain for SDK usage and app display](https://docs.phantom.com/phantom-portal/verify-domain) Was this page helpful? YesNo [Create an account](https://docs.phantom.com/phantom-portal/create-account) [Verify your domain](https://docs.phantom.com/phantom-portal/verify-domain) ⌘I --- # Configure allowed origins and redirect URLs - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-portal/configure-urls#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Account setup Configure allowed origins and redirect URLs [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Allowed origins](https://docs.phantom.com/phantom-portal/configure-urls#allowed-origins) * [Add allowed origins](https://docs.phantom.com/phantom-portal/configure-urls#add-allowed-origins) * [Allowed origin requirements](https://docs.phantom.com/phantom-portal/configure-urls#allowed-origin-requirements) * [Examples](https://docs.phantom.com/phantom-portal/configure-urls#examples) * [Redirect URLs](https://docs.phantom.com/phantom-portal/configure-urls#redirect-urls) * [Add redirect URLs](https://docs.phantom.com/phantom-portal/configure-urls#add-redirect-urls) * [Redirect URL requirements](https://docs.phantom.com/phantom-portal/configure-urls#redirect-url-requirements) * [Examples](https://docs.phantom.com/phantom-portal/configure-urls#examples-2) * [Common setup mistakes](https://docs.phantom.com/phantom-portal/configure-urls#common-setup-mistakes) * [Need help?](https://docs.phantom.com/phantom-portal/configure-urls#need-help) * [Next steps](https://docs.phantom.com/phantom-portal/configure-urls#next-steps) To use Phantom Connect in development and production, you must configure _allowed origins_ and _redirect URLs_ in Phantom Portal. These settings tell Phantom where your app is allowed to run and where users can be redirected after authentication. Both are required to connect users. [​](https://docs.phantom.com/phantom-portal/configure-urls#allowed-origins) Allowed origins ---------------------------------------------------------------------------------------------- Allowed origins define _where your app is allowed to initiate a connection_ from. Phantom will only connect if the request comes from one of these domains. This prevents other websites from impersonating your app. ### [​](https://docs.phantom.com/phantom-portal/configure-urls#add-allowed-origins) Add allowed origins 1. In Phantom Portal, expand your app in the left navigation and select **Set Up**. 2. Scroll to **Allowed Origins**. 3. Enter a domain where your app runs. 4. Select **Add**. ### [​](https://docs.phantom.com/phantom-portal/configure-urls#allowed-origin-requirements) Allowed origin requirements * Include the protocol (`https://` for production). * Use exact domains only. * Do not include paths, query strings, or wildcards. ### [​](https://docs.phantom.com/phantom-portal/configure-urls#examples) Examples | Environment | Example | | --- | --- | | Production | `https://yourapp.com` | | Staging | `https://staging.yourapp.com` | | Local development | `http://localhost:3000` | If your app runs in multiple environments, add _each origin_ separately. [​](https://docs.phantom.com/phantom-portal/configure-urls#redirect-urls) Redirect URLs ------------------------------------------------------------------------------------------ Redirect URLs define _where users are sent after authentication_. These are required for social login flows (Google, Apple) and for completing the Phantom Connect handshake. Redirect URLs can be web URLs or mobile app URIs. ### [​](https://docs.phantom.com/phantom-portal/configure-urls#add-redirect-urls) Add redirect URLs 1. In Phantom Portal, expand your app in the left navigation and select **Set Up**. 2. Scroll to **Redirect URLs**. 3. Enter a valid redirect URL. 4. Select **Add**. ### [​](https://docs.phantom.com/phantom-portal/configure-urls#redirect-url-requirements) Redirect URL requirements * Must exactly match the URL used in your app. * Must be added and allowlisted in Phantom Portal before you can use it in production. * Multiple redirect URLs are allowed. ### [​](https://docs.phantom.com/phantom-portal/configure-urls#examples-2) Examples | Use case | Example | | --- | --- | | Web app | `https://yourapp.com/auth/callback` | | Local development | `http://localhost:3000/auth/callback` | | Mobile app | `myapp://phantom-auth-callback` | When using Google or Apple login, users are redirected to one of these URLs after authentication. If the redirect URL is missing or mismatched, login will fail. [​](https://docs.phantom.com/phantom-portal/configure-urls#common-setup-mistakes) Common setup mistakes ---------------------------------------------------------------------------------------------------------- * Adding a redirect URL but forgetting to add the corresponding allowed origin. * Including paths or wildcards in allowed origins. * Using a redirect URL in code that hasn’t been added to Phantom Portal. * Using `http://` for production domains. [​](https://docs.phantom.com/phantom-portal/configure-urls#need-help) Need help? ----------------------------------------------------------------------------------- Contact [Phantom developer support](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) . [​](https://docs.phantom.com/phantom-portal/configure-urls#next-steps) Next steps ------------------------------------------------------------------------------------ [Verify your domain\ ------------------\ \ Previous: Verify your domain](https://docs.phantom.com/phantom-portal/verify-domain) [Edit app info\ -------------\ \ Next: Add your app information](https://docs.phantom.com/phantom-portal/edit-app-info) Was this page helpful? YesNo [Verify your domain](https://docs.phantom.com/phantom-portal/verify-domain) [Add your app information](https://docs.phantom.com/phantom-portal/edit-app-info) ⌘I --- # AI-assisted development - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/ai-tools#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Developer tools AI-assisted development [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [AI tools](https://docs.phantom.com/developer-powertools/ai-tools#ai-tools) * [MCP server](https://docs.phantom.com/developer-powertools/ai-tools#mcp-server) * [Setup](https://docs.phantom.com/developer-powertools/ai-tools#setup) * [Configuration](https://docs.phantom.com/developer-powertools/ai-tools#configuration) * [Example prompts](https://docs.phantom.com/developer-powertools/ai-tools#example-prompts) * [Cursor AI prompts](https://docs.phantom.com/developer-powertools/ai-tools#cursor-ai-prompts) * [Available prompts](https://docs.phantom.com/developer-powertools/ai-tools#available-prompts) * [How to use](https://docs.phantom.com/developer-powertools/ai-tools#how-to-use) * [Best practices](https://docs.phantom.com/developer-powertools/ai-tools#best-practices) * [Provide context](https://docs.phantom.com/developer-powertools/ai-tools#provide-context) * [Combine tools](https://docs.phantom.com/developer-powertools/ai-tools#combine-tools) * [Verify generated code](https://docs.phantom.com/developer-powertools/ai-tools#verify-generated-code) * [Resources](https://docs.phantom.com/developer-powertools/ai-tools#resources) Your AI coding assistant can search Phantom documentation directly, giving you accurate, up-to-date guidance while you build. [​](https://docs.phantom.com/developer-powertools/ai-tools#ai-tools) AI tools -------------------------------------------------------------------------------- [MCP server\ ----------\ \ Connect Cursor, VS Code, Claude, or Claude Code to search our docs in real-time](https://docs.phantom.com/resources/mcp-server) [Cursor AI prompts\ -----------------\ \ One-shot prompts that generate complete, production-ready SDK implementations](https://docs.phantom.com/resources/cursor-prompts) **ChatGPT integration**: Every documentation page includes an “Open in ChatGPT” button in the contextual menu for quick implementation help. [​](https://docs.phantom.com/developer-powertools/ai-tools#mcp-server) MCP server ------------------------------------------------------------------------------------ The Phantom MCP (Model Context Protocol) server enables AI coding assistants to search and retrieve information from the Phantom developer documentation. This allows your AI assistant to provide accurate, up-to-date guidance when building Phantom integrations. ### [​](https://docs.phantom.com/developer-powertools/ai-tools#setup) Setup | Tool | One-click | Manual | | --- | --- | --- | | Cursor | Click “Connect to Cursor” on any docs page | Add to `~/.cursor/mcp.json` | | VS Code | Click “Connect to VS Code” | Add to `.vscode/mcp.json` | | Claude.ai | — | Add connector in Settings | | Claude Code | — | `claude mcp add --transport http phantom-docs https://docs.phantom.com/mcp` | ### [​](https://docs.phantom.com/developer-powertools/ai-tools#configuration) Configuration Add this configuration to your MCP settings: mcp.json Report incorrect code Copy Ask AI { "mcpServers": { "phantom-docs": { "type": "sse", "url": "https://docs.phantom.com/mcp" } } } ### [​](https://docs.phantom.com/developer-powertools/ai-tools#example-prompts) Example prompts Once configured, try asking your AI assistant: * “How do I set up Phantom Connect in a React app?” * “Show me how to sign a message with the Browser SDK.” * “What’s the process for verifying a domain in Phantom Portal?” * “How do I handle transaction errors in React Native?” [Full MCP server documentation\ -----------------------------\ \ Complete setup guides for all supported tools](https://docs.phantom.com/resources/mcp-server) [​](https://docs.phantom.com/developer-powertools/ai-tools#cursor-ai-prompts) Cursor AI prompts -------------------------------------------------------------------------------------------------- Use one-shot prompts with Cursor AI to generate complete, production-ready Phantom SDK implementations. These prompts create full applications with wallet connection, message signing, and transaction handling. ### [​](https://docs.phantom.com/developer-powertools/ai-tools#available-prompts) Available prompts | SDK | What it generates | | --- | --- | | React SDK | Complete app with wallet connection, message signing, SOL transfers | | React Native SDK | Mobile app with Expo, OAuth flow, native wallet functionality | | Browser SDK | Vanilla JS implementation for any web framework | ### [​](https://docs.phantom.com/developer-powertools/ai-tools#how-to-use) How to use 1 [](https://docs.phantom.com/developer-powertools/ai-tools#) Get App ID from Phantom Portal Visit [Phantom Portal](https://docs.phantom.com/phantom-portal/get-app-id) to get your App ID before using any prompt. 2 [](https://docs.phantom.com/developer-powertools/ai-tools#) Copy prompt for your SDK Open the [Cursor AI prompts page](https://docs.phantom.com/resources/cursor-prompts) and copy the prompt for your preferred SDK (React, React Native, or Browser). 3 [](https://docs.phantom.com/developer-powertools/ai-tools#) Replace placeholders Replace `[YOUR_APP_ID]` and `[YOUR_REDIRECT_URL]` (or `[YOUR_SCHEME]` for React Native) with your actual values. 4 [](https://docs.phantom.com/developer-powertools/ai-tools#) Paste into Cursor Open Cursor AI, press `Cmd+K` (or `Ctrl+K` on Windows), and paste the complete prompt. 5 [](https://docs.phantom.com/developer-powertools/ai-tools#) Review and run Cursor will generate a full implementation. Review the code, then run and test your integration. [View all Cursor prompts\ -----------------------\ \ Get prompts for React, React Native, and Browser SDKs](https://docs.phantom.com/resources/cursor-prompts) [​](https://docs.phantom.com/developer-powertools/ai-tools#best-practices) Best practices -------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/developer-powertools/ai-tools#provide-context) Provide context Give your AI assistant enough context to generate accurate code. Include: * Your target framework (React, React Native, or vanilla JS). * Specific features you need (wallet connection, transactions, message signing). * General app structure and requirements. **Security best practice**: Avoid sharing sensitive information like App IDs, redirect URLs, or API keys with AI assistants. Use placeholders like `[YOUR_APP_ID]` in prompts, then replace them with actual values in your code after generation. **Example of a good prompt:** Report incorrect code Copy Ask AI I'm building a React app with Phantom Connect. I need to: 1. Connect a wallet using social login 2. Sign messages for authentication 3. Send SOL transactions I'll replace [YOUR_APP_ID] and [YOUR_REDIRECT_URL] placeholders with my actual values after the code is generated. ### [​](https://docs.phantom.com/developer-powertools/ai-tools#combine-tools) Combine tools Use MCP server for questions and documentation lookups, then use Cursor prompts for scaffolding complete implementations: 1. **Ask questions first**: Use MCP server to understand concepts (“How does Phantom Connect authentication work?”). 2. **Generate code**: Use Cursor prompts to scaffold your implementation. 3. **Refine with MCP**: Ask follow-up questions to customize the generated code. ### [​](https://docs.phantom.com/developer-powertools/ai-tools#verify-generated-code) Verify generated code Always review AI-generated code before deploying: * Check App ID matches your Phantom Portal app. * Verify redirect URLs are allowlisted in Phantom Portal. * Ensure error handling is present for all async operations. * Confirm lamports are calculated correctly (1 SOL = 1,000,000,000 lamports). * Test wallet connection flow end-to-end. * Validate transaction amounts and recipient addresses. [​](https://docs.phantom.com/developer-powertools/ai-tools#resources) Resources ---------------------------------------------------------------------------------- [MCP server setup\ ----------------\ \ Complete setup guides for Cursor, VS Code, Claude, and Claude Code](https://docs.phantom.com/resources/mcp-server) [Cursor prompts\ --------------\ \ One-shot prompts for all Phantom SDKs](https://docs.phantom.com/resources/cursor-prompts) [Recipes and starter kits\ ------------------------\ \ Example implementations and starter templates](https://docs.phantom.com/resources/recipes) [SDK comparison guide\ --------------------\ \ Choose the right SDK for your application](https://docs.phantom.com/wallet-sdks-overview) Was this page helpful? YesNo [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) [Recipes and starter kits](https://docs.phantom.com/resources/recipes) ⌘I --- # Send a transaction - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/sending-a-transaction#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Ethereum, Monad, Base, and Polygon Send a transaction [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Once a web application is connected to Phantom, it can prompt the user for permission to send transactions on their behalf. To send a transaction, you will need to have a valid transaction object. It should look a little like this: Report incorrect code Copy Ask AI { from: "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8", to: "0xac03bb73b6a9e108530aff4df5077c2b3d481e5a", gasLimit: "21000", maxFeePerGas: "300", maxPriorityFeePerGas: "10", nonce: "0", value: "10000000000" } However, this transaction object needs to be signed using the sender’s private key. This ensures that only the person that holds the private key can send transactions from the public address. To prompt Phantom to send a transaction to the network, refer to the following code snippet: Report incorrect code Copy Ask AI const result = await provider.request({ method: 'eth_sendTransaction', params: [ \ {\ from: accounts[0],\ to: '0x0c54FcCd2e384b4BB6f2E405Bf5Cbc15a017AaFb',\ value: '0x0',\ gasLimit: '0x5028',\ gasPrice: '0x2540be400',\ type: '0x0',\ },\ ], }); This is the building blocks of what you will need to send a transaction. However, if you were to copy/paste this, it would likely fail. There are several pieces of a transaction that are best provided in a dynamic manner. For details, refer to the [sendTransaction](https://github.com/phantom-labs/eth_sandbox/blob/main/src/utils/sendTransaction.ts) function in our sandbox. Was this page helpful? YesNo [Establish a connection](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/establishing-a-connection) [Sign a message](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/signing-a-message) ⌘I --- # Shortcuts - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/shortcuts#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Security and validation Shortcuts [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) [Shortcuts](https://phantom.app/learn/blog/shortcuts) is a feature that enables NFT collections to surface a curated list of links to their holders. Shortcuts are currently in beta. If you want to enable this in your project within Phantom, let us know by submitting this [form](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) . For details, see our [implementation guide](https://github.com/phantom/shortcuts) on GitHub. Was this page helpful? YesNo [Sign-In-With (SIW) standards](https://docs.phantom.com/developer-powertools/signing-a-message) [Solana priority fees](https://docs.phantom.com/developer-powertools/solana-priority-fees) ⌘I --- # Mobile web debugging - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/mobile-web-debugging#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Testing and debugging Mobile web debugging [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [iOS](https://docs.phantom.com/developer-powertools/mobile-web-debugging#ios) * [Android](https://docs.phantom.com/developer-powertools/mobile-web-debugging#android) Watch [How to debug your dapp on iPhone using Phantom](https://www.loom.com/share/1b1817d84af649c9a38e5dbd8ed25ca9?t=1) on loom. Developers can debug their mobile web dapps using PC browsers. To enable this in Phantom mobile, go to **Settings** > **Developer Settings**, and toggle **Web View Debugging** on. Then follow the steps for your platform. [​](https://docs.phantom.com/developer-powertools/mobile-web-debugging#ios) iOS ---------------------------------------------------------------------------------- 1. Tether your iPhone to your computer via USB. 2. On your iPhone go to **Settings** > **Safari** > **Advanced** and turn on **Web Inspector**. 3. On your computer open Safari. Then from the menu bar **Safari** > Settings -> Advanced tab -> turn on **Show features for web developers**. 4. Open your web dapp in Phantom on your tethered device. 5. Back on your computer from the Safari menu bar, go to **Develop** > \[Your device\] > \[Your dapp\]. [​](https://docs.phantom.com/developer-powertools/mobile-web-debugging#android) Android ------------------------------------------------------------------------------------------ 1. Tether your Android phone to your computer via USB. 2. Open your web dapp in Phantom on your tethered device. 3. On your computer open `chrome://inspect/#devices` on Chrome. 4. Select your device on the left and select **Inspect** on the Phantom dapp contents you’d like to inspect. ![Developer Settings menu in the Phantom browser extension](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/developer-powertools/images/developer-settings-web.avif?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=57759c4e5f823d59bd38729395ecd62e) For more information, see [React Native WebView debugging guide](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Debugging.md#debugging-webview-contents) . Was this page helpful? YesNo [Testnet mode](https://docs.phantom.com/developer-powertools/testnet-mode) [Go-live checklist](https://docs.phantom.com/best-practices/launching-a-dapp) ⌘I --- # Create an account - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-portal/create-account#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Account setup Create an account [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Sign up to create your account](https://docs.phantom.com/phantom-portal/create-account#sign-up-to-create-your-account) * [Phantom Portal dashboard](https://docs.phantom.com/phantom-portal/create-account#phantom-portal-dashboard) * [Next steps](https://docs.phantom.com/phantom-portal/create-account#next-steps) You need a Phantom Portal account to register your app, configure settings, and manage its presence in Phantom. This page explains how to sign up and access the dashboard. [​](https://docs.phantom.com/phantom-portal/create-account#sign-up-to-create-your-account) Sign up to create your account ---------------------------------------------------------------------------------------------------------------------------- Phantom Portal uses social login for secure, password-free access. 1. Go to [phantom.app/portal](https://phantom.app/portal) . 2. Click **Sign Up**. 3. Sign in with your Google account or Apple ID. Your Phantom Portal account is created automatically. [​](https://docs.phantom.com/phantom-portal/create-account#phantom-portal-dashboard) Phantom Portal dashboard ---------------------------------------------------------------------------------------------------------------- When you sign in, you’ll see the main dashboard, which includes: * **Set Up**: App ID, SDK installation, allowed origins, and redirect URLs * **Edit App Info**: App details and branding * **Contracts**: Auto-Confirm contract submissions ![Main Phantom Portal dashboard view](https://mintcdn.com/phantom-e50e2e68/oGAeqebvkE4mhDv1/phantom-portal/images/portal-dashboard.png?w=2500&fit=max&auto=format&n=oGAeqebvkE4mhDv1&q=85&s=f12e33ee584ec9b1f69c4af6a248e116) [​](https://docs.phantom.com/phantom-portal/create-account#next-steps) Next steps ------------------------------------------------------------------------------------ [Phantom Portal overview\ -----------------------\ \ Previous: Phantom Portal overview](https://docs.phantom.com/phantom-portal/portal) [Create your app\ ---------------\ \ Next: Create your app](https://docs.phantom.com/phantom-portal/create-app) Was this page helpful? YesNo [Get started](https://docs.phantom.com/phantom-portal/getting-started) [Create an app](https://docs.phantom.com/phantom-portal/create-app) ⌘I --- # Add your app information - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-portal/edit-app-info#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Account setup Add your app information [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Add your app information](https://docs.phantom.com/phantom-portal/edit-app-info#add-your-app-information) * [App access control](https://docs.phantom.com/phantom-portal/edit-app-info#app-access-control) * [Domain verification](https://docs.phantom.com/phantom-portal/edit-app-info#domain-verification) * [Submit for review](https://docs.phantom.com/phantom-portal/edit-app-info#submit-for-review) * [Next steps](https://docs.phantom.com/phantom-portal/edit-app-info#next-steps) Fill out more information about your app and add graphics to customize how the app appears to users in Phantom. Any changes you make on the **Edit App Info** page will go through a review process. Once approved by Phantom, they will be published across all platforms. ![Edit app info page showing all fields](https://mintcdn.com/phantom-e50e2e68/oGAeqebvkE4mhDv1/phantom-portal/images/app-info-form.png?w=2500&fit=max&auto=format&n=oGAeqebvkE4mhDv1&q=85&s=05f3944a58da1a1a3cfe86aceab7e131) [​](https://docs.phantom.com/phantom-portal/edit-app-info#add-your-app-information) Add your app information --------------------------------------------------------------------------------------------------------------- 1. In Phantom Portal, expand your app in the main nagivation, then click **Edit App Info**. 2. App Details: * App icon: Upload an icon as a PNG or JPG image, up to 250×250px and 1MB. * Name: Enter your app’s official name (up to 50 characters). * Description: Provide a brief tagline describing what your app does (up to 100 characters). The description field can accommodate longer text, but descriptions over 100 characters may not display well in the app. * Public URL: Your app’s public URL within Phantom, must use HTTPS. You will need to verify your domain to use Phantom Connect SDK and for your app to be visible in Phantom’s **Explore** tab. * Cover image: A PNG or JPG image, recommended 1500×500px, up to 2MB. 3. Categories: * Category: Select the category that best represents your app (AI, DeFi, NFT, gaming, and others). * Networks: Select all blockchain networks your app supports. 4. Social Links: Add links to your website, Discord, Telegram, GitHub, X (Twitter), and YouTube. [​](https://docs.phantom.com/phantom-portal/edit-app-info#app-access-control) App access control --------------------------------------------------------------------------------------------------- Your app’s access mode controls who can connect: * **DISABLED**: App is banned, no users can connect * **PRIVATE**: Invited team members only (max 20) — this is the default mode * **PUBLIC**: All users can connect — available after Phantom approval In PRIVATE mode, you must invite team members through Phantom Portal. If someone who isn’t invited tries to connect, the connection is rejected. ### [​](https://docs.phantom.com/phantom-portal/edit-app-info#domain-verification) Domain verification Domain verification is required to use Phantom Connect SDK and for your app to appear in Phantom’s **Explore** tab and search results: 1. In Phantom Portal, click **Verify now**. 2. Add a DNS TXT record to your domain with the details on the screen. 3. Copy the verification code from Phantom Portal. 4. Select **Verify Domain** in Phantom Portal. DNS configuration: | Field | Value | | --- | --- | | **Type** | TXT | | **Host** | `@` | | **Value** | Verification code from Phantom Portal | | **TTL** | 3600 | [View the detailed verification guide →](https://docs.phantom.com/phantom-portal/verify-domain) [​](https://docs.phantom.com/phantom-portal/edit-app-info#submit-for-review) Submit for review ------------------------------------------------------------------------------------------------- After making any changes to your app information, a **Submit changes for review** button will appear above the cover image section. Click this button to submit your updates for review by the Phantom team. [​](https://docs.phantom.com/phantom-portal/edit-app-info#next-steps) Next steps ----------------------------------------------------------------------------------- [Configure allowed origins\ -------------------------\ \ Previous: Configure allowed origins](https://docs.phantom.com/phantom-portal/configure-urls) [Get App ID and integrate\ ------------------------\ \ Next: Get your App ID and start building](https://docs.phantom.com/phantom-portal/get-app-id) Was this page helpful? YesNo [Configure allowed origins and redirect URLs](https://docs.phantom.com/phantom-portal/configure-urls) [Get your App ID and integrate](https://docs.phantom.com/phantom-portal/get-app-id) ⌘I --- # Solana Actions and Blinks - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/solana-actions-and-blinks#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana features Solana Actions and Blinks [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Watch [Solana Actions and Blinks](https://youtu.be/TU87JjHxQQo) demo on YouTube. [Solana Actions](https://solana.com/docs/advanced/actions) are APIs to deliver signable transactions from a variety of web contexts. Blockchain links, or [Blinks](https://solana.com/docs/advanced/actions#blinks) , are client applications that introspect Action APIs and construct user interfaces to interact with Actions. The Phantom Extension supports rendering Blinks on Twitter/X.com. If an Action URL is posted to Twitter/X.com, the Phantom extension is can construct a UI to interact with the transaction from directly within the user’s timeline. This feature is disabled by default. Users can opt-in to enabling this feature via by goint to **Settings** > **Experimental Features** and turning on **Blinks**. Phantom will only render Actions that are registered under the Dialect-maintained [Actions Registry](https://solana.com/docs/advanced/actions#dialect's-actions-registry) . Was this page helpful? YesNo [Solana Token Extensions (Token22)](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22) [Testnet mode](https://docs.phantom.com/developer-powertools/testnet-mode) ⌘I --- # Other methods - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/other-methods/README#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Other methods Other methods [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) In addition to its [provider methods](https://docs.phantom.com/phantom-deeplinks/provider-methods/README) , Phantom also supports other methods that are accessible via deeplinks. Specifically, users can open web apps within Phantom’s in-app browser via the [Browse](https://docs.phantom.com/phantom-deeplinks/other-methods/browse) deeplink. Was this page helpful? YesNo [SignMessage](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage) [Browse](https://docs.phantom.com/phantom-deeplinks/other-methods/browse) ⌘I --- # Browse - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/other-methods/browse#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Other methods Browse [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [URL structure](https://docs.phantom.com/phantom-deeplinks/other-methods/browse#url-structure) * [Parameters](https://docs.phantom.com/phantom-deeplinks/other-methods/browse#parameters) * [Example](https://docs.phantom.com/phantom-deeplinks/other-methods/browse#example) Deeplinks provide a convenient way for users to open web apps within Phantom. Using their phone’s camera, users can scan a QR code to open a page directly within Phantom’s in-app browser. If a web app detects that a user is on mobile, it can also prompt the user to open a specific page within Phantom’s in-app browser. The `browse` deeplink can be used before a [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) event takes places, as it does not require a `session` param. The `browse` deeplinks are not intended to be pasted into mobile web browsers. These deeplinks must either be handled by an app or clicked on by an end user. [​](https://docs.phantom.com/phantom-deeplinks/other-methods/browse#url-structure) URL structure --------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI https://phantom.app/ul/browse/?ref= [​](https://docs.phantom.com/phantom-deeplinks/other-methods/browse#parameters) Parameters --------------------------------------------------------------------------------------------- * `url` (required): The URL that should open within Phantom’s in-app browser, URL-encoded. * `ref` (required): The URL of the requesting app, URL-encoded. [​](https://docs.phantom.com/phantom-deeplinks/other-methods/browse#example) Example --------------------------------------------------------------------------------------- The following is an example request to open an [NFT listed on Magic Eden](https://magiceden.io/item-details/8yjN8iRuoiYiKW487cnW9vn6mLBR5E8aCNKsBRmTP9vN) : Report incorrect code Copy Ask AI https://phantom.app/ul/browse/https%3A%2F%2Fmagiceden.io%2Fitem-details%2F8yjN8iRuoiYiKW487cnW9vn6mLBR5E8aCNKsBRmTP9vN?ref=https%3A%2F%2Fmagiceden.io Was this page helpful? YesNo [Other methods](https://docs.phantom.com/phantom-deeplinks/other-methods/README) [Fungible](https://docs.phantom.com/phantom-deeplinks/other-methods/fungible) ⌘I --- # Sign a message - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/signing-a-message#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Ethereum, Monad, Base, and Polygon Sign a message [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Support for “Sign-In with” standards](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/signing-a-message#support-for-%E2%80%9Csign-in-with%E2%80%9D-standards) When a web application is connected to Phantom, it can also request that the user signs a given message. Applications are free to write their own messages which will be displayed to users from within Phantom’s signature prompt. Message signatures do not involve network fees and are a convenient way for apps to verify ownership of an address. To learn how you can use libraries such as [ethers.js](https://docs.ethers.org/v5/) to abstract away some of these intricacies, see [handleSignMessage](https://github.com/phantom-labs/eth_sandbox/blob/main/src/App.tsx#L193-L211) in our sandbox. Report incorrect code Copy Ask AI const message = 'To avoid digital dognappers, sign below to authenticate with CryptoCorgis.'; const from = accounts[0]; const msg = `0x${Buffer.from(message, 'utf8').toString('hex')}`; const sign = await provider.request({ method: 'personal_sign', params: [msg, from, 'Example password'], }); [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/signing-a-message#support-for-%E2%80%9Csign-in-with%E2%80%9D-standards) Support for “Sign-In with” standards ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Applications that rely on signing messages to authenticate users can choose to opt-in to one of the various “Sign-In with” (SIW) standards. For more details, see [Sign-In with (SIW) standards](https://docs.phantom.com/developer-powertools/signing-a-message) . Was this page helpful? YesNo [Send a transaction](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/sending-a-transaction) [Provider API reference](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/README) ⌘I --- # Swap - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Other methods Swap [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [URL structure](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#url-structure) * [Parameters](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#parameters) * [Examples](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#examples) * [Swap SOL to WIF](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#swap-sol-to-wif) * [Bridge USDC on Solana to USDT on Ethereum](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#bridge-usdc-on-solana-to-usdt-on-ethereum) Watch [Swap demo](https://youtu.be/qJNv7lpYmtw) on YouTube. Phantom supports deeplinking directly to the in-app swapper. Developers can specify which tokens should be prefilled in the `buy` and `sell` fields. In addition to swapping tokens on a single chain, the swapper can also be used to bridge stablecoins across chains, such as USDT on Ethereum to USDC on Solana. The `swap` deeplink can be used at anytime. It does not need to be proceeded by a [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) event, as it does not require a `session` param. The `swap` deeplinks are not intended to be pasted into mobile web browsers. These deeplinks must either be handled by an app or tapped on by an end user. [​](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#url-structure) URL structure ------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI https://phantom.app/ul/v1/swap?buy=&sell= [​](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#parameters) Parameters ------------------------------------------------------------------------------------------- * `buy`: The [CAIP-19](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-19.md) address of the token that should be bought, URL-encoded. Defaults to SOL if omitted. * `sell`: The [CAIP-19](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-19.md) address of the token that should be sold, URL-encoded. Defaults to SOL if omitted. [​](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#examples) Examples --------------------------------------------------------------------------------------- Using a mobile device, tap the following links to try out the `swap` deeplink: ### [​](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#swap-sol-to-wif) Swap SOL to WIF Report incorrect code Copy Ask AI https://phantom.app/ul/v1/swap/?buy=solana%3A101%2Faddress%3AEKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm&sell= ### [​](https://docs.phantom.com/phantom-deeplinks/other-methods/swap#bridge-usdc-on-solana-to-usdt-on-ethereum) Bridge USDC on Solana to USDT on Ethereum Report incorrect code Copy Ask AI https://phantom.app/ul/v1/swap/?buy=eip155%3A1%2Faddress%3A0xdAC17F958D2ee523a2206206994597C13D831ec7&sell=solana%3A101%2Faddress%3AEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v Was this page helpful? YesNo [Fungible](https://docs.phantom.com/phantom-deeplinks/other-methods/fungible) [Wallet Standard](https://docs.phantom.com/developer-powertools/wallet-standard) ⌘I --- # Events - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/README#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Events Events [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Phantom’s provider API available at `window.ethereum` implements a Node.js style [EventEmitter](https://nodejs.org/api/events.html) API, that allows you to hook into different events that are emitted upon certain actions that take place in either the dapp, or the wallet. Each page in this section will be an isolated piece of information that informs you of all the technical details you need to know about each event Phantom supports. Was this page helpful? YesNo  [eventsCount](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_eventscount) [Connect](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/connect) ⌘I --- # isConnected - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/isconnected#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Methods isConnected [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Parameters](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/isconnected#parameters) * [Response](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/isconnected#response) Checks if the wallet is connected to the dapp. [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/isconnected#parameters) Parameters ----------------------------------------------------------------------------------------------------------------------------------------- None [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/isconnected#response) Response ------------------------------------------------------------------------------------------------------------------------------------- Boolean Report incorrect code Copy Ask AI window.phantom.ethereum.isConnected() // true if connected // false if not Was this page helpful? YesNo [Methods](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/README) [request](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request) ⌘I --- # Fungible - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/other-methods/fungible#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Other methods Fungible [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [URL structure](https://docs.phantom.com/phantom-deeplinks/other-methods/fungible#url-structure) * [Parameters](https://docs.phantom.com/phantom-deeplinks/other-methods/fungible#parameters) * [Example](https://docs.phantom.com/phantom-deeplinks/other-methods/fungible#example) Phantom supports deeplinking directly to a fungible token detail page. Developers can specify which chain and token detail page to navigate to. The `fungible` deeplink can be used at anytime. It does not need to be proceeded by a [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) event, as it does not require a `session` param. [​](https://docs.phantom.com/phantom-deeplinks/other-methods/fungible#url-structure) URL structure ----------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI https://phantom.app/ul/v1/fungible?token= [​](https://docs.phantom.com/phantom-deeplinks/other-methods/fungible#parameters) Parameters ----------------------------------------------------------------------------------------------- `fungible` (required): The [CAIP-19](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-19) address of the token page to be viewed, URL-encoded. Defaults to `SOL` if omitted. [​](https://docs.phantom.com/phantom-deeplinks/other-methods/fungible#example) Example ----------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI https://phantom.app/ul/v1/fungible?token=solana%3A101%2Faddress%3AFoXyMu5xwXre7zEoSvzViRk3nGawHUp9kUh97y2NDhcq ![Fungible Example Gi](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/phantom-deeplinks/images/fungible-example.gif?s=57e4648e5847bbfbcde35961880d6bf9) Was this page helpful? YesNo [Browse](https://docs.phantom.com/phantom-deeplinks/other-methods/browse) [Swap](https://docs.phantom.com/phantom-deeplinks/other-methods/swap) ⌘I --- # Accounts changed - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/accounts-changed#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Events Accounts changed [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Event emitted upon changing accounts within your Phantom wallet. Report incorrect code Copy Ask AI window.ethereum.on('accountsChanged', (newAccounts: String[]) => { // "newAccounts" will always be an array, but it can be empty. if (newAccounts) { console.log(`switched to new account: ${newAccounts}`); accounts = newAccounts; } else { /** * In this case dApps could... * * 1. Not do anything * 2. Only re-connect to the new account if it is trusted * * ``` * provider.send('eth_requestAccounts', []).catch((err) => { * // fail silently * }); * ``` * * 3. Always attempt to reconnect */ } }) You can see an example of [hooking into this event](https://github.com/phantom-labs/eth_sandbox/blob/main/src/App.tsx#L114-L152) in our sandbox. Was this page helpful? YesNo [Connect](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/connect) [Disconnect](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/disconnect) ⌘I --- # Testnet mode - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/testnet-mode#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Testing and debugging Testnet mode [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Enable testnet mode](https://docs.phantom.com/developer-powertools/testnet-mode#enable-testnet-mode) * [Supported test networks](https://docs.phantom.com/developer-powertools/testnet-mode#supported-test-networks) * [Get test tokens](https://docs.phantom.com/developer-powertools/testnet-mode#get-test-tokens) * [Testing with Phantom Connect](https://docs.phantom.com/developer-powertools/testnet-mode#testing-with-phantom-connect) Testnet mode allows you to connect to blockchain test networks for development and testing purposes. When enabled, Phantom will display testnet balances and allow transactions on supported test networks. [​](https://docs.phantom.com/developer-powertools/testnet-mode#enable-testnet-mode) Enable testnet mode ---------------------------------------------------------------------------------------------------------- To access test networks in Phantom, go to **Settings** → **Developer Settings** → **Testnet Mode**. ![Testnet mode toggle in Developer Settings](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/developer-powertools/images/developer-settings-testnet.png?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=70c51a60d51d08ba78d01d65a577ea58) [​](https://docs.phantom.com/developer-powertools/testnet-mode#supported-test-networks) Supported test networks ------------------------------------------------------------------------------------------------------------------ When testnet mode is enabled, you can connect to the following networks: | Blockchain | Test networks | | --- | --- | | Solana | Devnet, Testnet | | Ethereum | Sepolia, Goerli | | Base | Base Sepolia | | Polygon | Polygon Amoy | [​](https://docs.phantom.com/developer-powertools/testnet-mode#get-test-tokens) Get test tokens -------------------------------------------------------------------------------------------------- To test transactions, you’ll need testnet tokens: * **Solana Devnet SOL**: Use the [Solana Faucet](https://faucet.solana.com/) * **Sepolia ETH**: Use the [Sepolia Faucet](https://sepoliafaucet.com/) * **Base Sepolia ETH**: Use the [Base Faucet](https://www.coinbase.com/faucets/base-ethereum-goerli-faucet) [​](https://docs.phantom.com/developer-powertools/testnet-mode#testing-with-phantom-connect) Testing with Phantom Connect ---------------------------------------------------------------------------------------------------------------------------- When using Phantom Connect SDKs, testnet mode works automatically. Users with testnet mode enabled in their Phantom wallet will see testnet balances and can sign testnet transactions. For local development, you can also use `localhost` or `127.0.0.1` to test your integration before deploying to a production URL. Was this page helpful? YesNo [Solana Actions and Blinks](https://docs.phantom.com/developer-powertools/solana-actions-and-blinks) [Mobile web debugging](https://docs.phantom.com/developer-powertools/mobile-web-debugging) ⌘I --- # Token pages - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/token-pages#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Security and validation Token pages [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Generate a token page URL](https://docs.phantom.com/developer-powertools/token-pages#generate-a-token-page-url) * [Key features](https://docs.phantom.com/developer-powertools/token-pages#key-features) * [Universal and deep linking](https://docs.phantom.com/developer-powertools/token-pages#universal-and-deep-linking) * [Quick access to swapper](https://docs.phantom.com/developer-powertools/token-pages#quick-access-to-swapper) * [Enhanced social sharing](https://docs.phantom.com/developer-powertools/token-pages#enhanced-social-sharing) Phantom provides shareable, web-accessible **token pages** that display detailed token information. These pages provide a seamless experience whether accessed through the Phantom wallet app or via web browsers. [​](https://docs.phantom.com/developer-powertools/token-pages#generate-a-token-page-url) Generate a token page URL --------------------------------------------------------------------------------------------------------------------- To create a shareable token page URL: 1. Open the desired token page in Phantom. 2. Tap the share button. 3. Copy or share the generated URL. The URL follows this format: Report incorrect code Copy Ask AI https://phantom.com/tokens// For example, the WIF token on Solana can be accessed at: Report incorrect code Copy Ask AI https://phantom.com/tokens/solana/EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm [​](https://docs.phantom.com/developer-powertools/token-pages#key-features) Key features ------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/developer-powertools/token-pages#universal-and-deep-linking) Universal and deep linking When accessed on mobile devices with Phantom installed, token page URLs automatically open the corresponding details page within the Phantom app. For users without Phantom installed, the links gracefully fallback to the web view. ### [​](https://docs.phantom.com/developer-powertools/token-pages#quick-access-to-swapper) Quick access to swapper The web view includes a QR code that, when scanned, deep links directly to the token’s swap screen within the Phantom app. This enables quick and convenient token swaps for mobile users. ![An example token page on the web](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/developer-powertools/images/token-page-web.png?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=bc795f024d00b38ecdc0a9253c7b6214) ![An example token page in the Phantom mobile app](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/developer-powertools/images/token-page-mobile.png?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=9b169703ba45a4b2120d488399fe5196) ### [​](https://docs.phantom.com/developer-powertools/token-pages#enhanced-social-sharing) Enhanced social sharing Each token page generates dynamic OpenGraph images that display essential token information and price charts. When shared on social media platforms, these rich previews provide immediate context about the token’s performance and status. ![An example token page from X.com](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/developer-powertools/images/token-twitter.png?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=fc0f425f25b60911a07dafbf5ae364b5) Was this page helpful? YesNo [Transaction Validation](https://docs.phantom.com/developer-powertools/lighthouse) [Sign-In-With (SIW) standards](https://docs.phantom.com/developer-powertools/signing-a-message) ⌘I --- # request - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Methods request [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Params](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request#params) * [Returns](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request#returns) * [Example](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request#example) Sends a JSON RPC request to the wallet. [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request#params) Params ----------------------------------------------------------------------------------------------------------------------------- `method: string;` `params?: unknown[] | object;` [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request#returns) Returns ------------------------------------------------------------------------------------------------------------------------------- `Promise` [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request#example) Example ------------------------------------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI const accounts = await window.phantom.ethereum.request({ method: "eth_requestAccounts", params: [] }) console.log(accounts) // ["0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5"] The code above demonstrates how you can use the `request` method to ask the user to connect to your dapp. The `request` method is the go to way for you to interface with the wallet in your dapp. It accepts most [JSON RPC requests](https://ethereum.org/en/developers/docs/apis/json-rpc/#json-rpc-methods) that would need to interact with the wallet. However it **will not** work for methods that don’t make sense for a wallet. For example, you can’t use the provider object Phantom injects to call something like `eth_getTransactionByHash`. If you send a method that the provider object does not support, it will throw an error. For a full list of errors, see [Error messages and codes](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/errors) . Was this page helpful? YesNo [isConnected](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/isconnected) [Error messages and codes](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/errors) ⌘I --- # Get started - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-portal/getting-started#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Overview Get started [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Signup to live](https://docs.phantom.com/phantom-portal/getting-started#signup-to-live) * [Before you begin](https://docs.phantom.com/phantom-portal/getting-started#before-you-begin) * [Quick start](https://docs.phantom.com/phantom-portal/getting-started#quick-start) * [Account setup](https://docs.phantom.com/phantom-portal/getting-started#account-setup) * [After setup](https://docs.phantom.com/phantom-portal/getting-started#after-setup) * [Resources](https://docs.phantom.com/phantom-portal/getting-started#resources) * [Need help?](https://docs.phantom.com/phantom-portal/getting-started#need-help) Follow this step-by-step guide to set up your app in Phantom Portal and prepare it for discovery within Phantom. [​](https://docs.phantom.com/phantom-portal/getting-started#signup-to-live) Signup to live --------------------------------------------------------------------------------------------- [​](https://docs.phantom.com/phantom-portal/getting-started#before-you-begin) Before you begin ------------------------------------------------------------------------------------------------- Before starting, make sure you have the following: * A deployed web app with a public domain * HTTPS enabled with a valid SSL certificate * Domain access to add DNS records * Branding assets (logo and optional cover image) * A clear description of what your app does [​](https://docs.phantom.com/phantom-portal/getting-started#quick-start) Quick start --------------------------------------------------------------------------------------- Create your Phantom Portal account to begin the setup process:[Create your account\ -------------------\ \ Start your Phantom Portal setup by creating an account](https://docs.phantom.com/phantom-portal/create-account) [​](https://docs.phantom.com/phantom-portal/getting-started#account-setup) Account setup ------------------------------------------------------------------------------------------- Setting up your app in Phantom Portal involves six main steps: [1\. Create an account\ ---------------------\ \ Sign up with Google or Apple to access Phantom Portal](https://docs.phantom.com/phantom-portal/create-account) [2\. Create your app\ -------------------\ \ Set up your app with a name, icon, and website URL](https://docs.phantom.com/phantom-portal/create-app) [3\. Verify your domain\ ----------------------\ \ Required to use Phantom Connect SDK and for app display](https://docs.phantom.com/phantom-portal/verify-domain) [4\. Configure URLs\ ------------------\ \ Add allowed origins and redirect URLs for your app](https://docs.phantom.com/phantom-portal/configure-urls) [5\. Add your app information (optional)\ ---------------------------------------\ \ Add branding and details for the app to appear in Phantom’s Explore tab](https://docs.phantom.com/phantom-portal/edit-app-info) [6\. Get your App ID and integrate\ ---------------------------------\ \ Get your App ID and begin integrating your SDK of choice](https://docs.phantom.com/phantom-portal/get-app-id) [​](https://docs.phantom.com/phantom-portal/getting-started#after-setup) After setup --------------------------------------------------------------------------------------- After your app is published, keep maintaining it: * Monitor performance in the Phantom Portal dashboard * Update information when releasing new features * Review community feedback to improve your app * Maintain domain verification by keeping DNS records in place [​](https://docs.phantom.com/phantom-portal/getting-started#resources) Resources ----------------------------------------------------------------------------------- [Phantom Portal overview\ -----------------------\ \ Understand what Phantom Portal is](https://docs.phantom.com/phantom-portal/portal) [SDK overview\ ------------\ \ Compare Phantom Connnect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Phantom Connect\ ---------------\ \ Understand user authentication flows](https://docs.phantom.com/phantom-connect) [Launch checklist\ ----------------\ \ Step-by-step launch guide](https://docs.phantom.com/best-practices/launching-a-dapp) [​](https://docs.phantom.com/phantom-portal/getting-started#need-help) Need help? ------------------------------------------------------------------------------------ Contact [Phantom developer support](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) . Was this page helpful? YesNo [Phantom Portal overview](https://docs.phantom.com/phantom-portal/portal) [Create an account](https://docs.phantom.com/phantom-portal/create-account) ⌘I --- # Developer tools and resources - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/overview#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Overview Developer tools and resources [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Developer tools](https://docs.phantom.com/developer-powertools/overview#developer-tools) * [Security and validation](https://docs.phantom.com/developer-powertools/overview#security-and-validation) * [Solana features](https://docs.phantom.com/developer-powertools/overview#solana-features) * [Testing and debugging](https://docs.phantom.com/developer-powertools/overview#testing-and-debugging) * [Best practices](https://docs.phantom.com/developer-powertools/overview#best-practices) * [Resources](https://docs.phantom.com/developer-powertools/overview#resources) * [Need help?](https://docs.phantom.com/developer-powertools/overview#need-help) Build better apps with Phantom using our developer tools, integration guides, and best practices. This section covers everything from AI-assisted development to transaction handling and token display. [​](https://docs.phantom.com/developer-powertools/overview#developer-tools) Developer tools ---------------------------------------------------------------------------------------------- Accelerate your Phantom integration with AI-powered tools and starter templates. [Recipes and starter kits\ ------------------------\ \ Example implementations and starter templates](https://docs.phantom.com/resources/recipes) [Cursor AI prompts\ -----------------\ \ One-shot prompts for implementing Phantom SDKs](https://docs.phantom.com/resources/cursor-prompts) [MCP server\ ----------\ \ Give your AI assistant access to Phantom docs](https://docs.phantom.com/resources/mcp-server) [​](https://docs.phantom.com/developer-powertools/overview#security-and-validation) Security and validation -------------------------------------------------------------------------------------------------------------- Learn how Phantom handles security, transactions, and authentication. [Domain and transaction warnings\ -------------------------------\ \ Understand and resolve Phantom security warnings](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings) [Transaction validation\ ----------------------\ \ How Phantom validates transactions with Lighthouse](https://docs.phantom.com/developer-powertools/lighthouse) [Token pages\ -----------\ \ Shareable web-accessible token detail pages](https://docs.phantom.com/developer-powertools/token-pages) [Sign-In-With standards\ ----------------------\ \ Implement SIWS, SIWE, and CAIP-122 authentication](https://docs.phantom.com/developer-powertools/signing-a-message) [Shortcuts\ ---------\ \ Surface curated links to NFT collection holders](https://docs.phantom.com/developer-powertools/shortcuts) [​](https://docs.phantom.com/developer-powertools/overview#solana-features) Solana features ---------------------------------------------------------------------------------------------- Guides for Solana-specific capabilities in Phantom. [Priority fees\ -------------\ \ How Phantom calculates and applies priority fees](https://docs.phantom.com/developer-powertools/solana-priority-fees) [Versioned Transactions\ ----------------------\ \ Use Address Lookup Tables and versioned transactions](https://docs.phantom.com/developer-powertools/solana-versioned-transactions) [Token Extensions (Token22)\ --------------------------\ \ Supported Token-2022 extensions in Phantom](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22) [Actions and Blinks\ ------------------\ \ Enable interactive transactions on Twitter/X](https://docs.phantom.com/developer-powertools/solana-actions-and-blinks) [​](https://docs.phantom.com/developer-powertools/overview#testing-and-debugging) Testing and debugging ---------------------------------------------------------------------------------------------------------- Tools for developing and testing your integration. [Testnet mode\ ------------\ \ Access test networks in Phantom for development](https://docs.phantom.com/developer-powertools/testnet-mode) [Mobile web debugging\ --------------------\ \ Debug your mobile web app using browser dev tools](https://docs.phantom.com/developer-powertools/mobile-web-debugging) [​](https://docs.phantom.com/developer-powertools/overview#best-practices) Best practices -------------------------------------------------------------------------------------------- Guidance for optimizing your app’s integration with Phantom. [Go-live checklist\ -----------------\ \ Pre-launch checklist for Phantom integrations](https://docs.phantom.com/best-practices/launching-a-dapp) [Display apps in dialogs\ -----------------------\ \ Configure your app title and icon in Phantom dialogs](https://docs.phantom.com/best-practices/displaying-your-app) [Display in Recent Activity\ --------------------------\ \ Show your app in the user’s transaction history](https://docs.phantom.com/best-practices/displaying-apps-within-the-activity-tab) [Token display guidelines\ ------------------------\ \ Ensure your tokens display correctly in Phantom](https://docs.phantom.com/best-practices/tokens/README) [​](https://docs.phantom.com/developer-powertools/overview#resources) Resources ---------------------------------------------------------------------------------- Additional resources and support. [FAQ\ ---\ \ Common questions and answers](https://docs.phantom.com/resources/faq) [Demo apps\ ---------\ \ Live examples and sandbox environments](https://docs.phantom.com/resources/sandbox) [Brand assets\ ------------\ \ Official Phantom logos and guidelines](https://docs.phantom.com/resources/assets) [​](https://docs.phantom.com/developer-powertools/overview#need-help) Need help? ----------------------------------------------------------------------------------- [Developer support\ -----------------\ \ Contact Phantom developer support](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) [Developer announcements\ -----------------------\ \ Join our Telegram for updates](https://t.me/+R0vUw_QWSO9lNjlh) Was this page helpful? YesNo [AI-assisted development](https://docs.phantom.com/developer-powertools/ai-tools) ⌘I --- # Disconnect - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/disconnect#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Events Disconnect [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Event emitted upon the wallet losing connection to the RPC provider. This is **not** a user “disconnecting” from a dapp, or otherwise revoking access between the dapp and the wallet. Report incorrect code Copy Ask AI window.ethereum.on('disconnect', () => { console.log('lost connection to the rpc) }); You can see an example of [hooking into this event](https://github.com/phantom-labs/eth_sandbox/blob/main/src/App.tsx#L106-L112) in our sandbox. Was this page helpful? YesNo [Accounts changed](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/accounts-changed) [Chain changed](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/chain-changed) ⌘I --- # Connect - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/connect#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Events Connect [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Event emitted upon connecting to a dapp. Report incorrect code Copy Ask AI interface connectionInfo { chainId: string; } window.ethereum.on('connect', (connectionInfo: connectionInfo) => { console.log(connectionInfo.chainId); // "0x1" On Ethereum }); You can see an example of [hooking into this event](https://github.com/phantom-labs/eth_sandbox/blob/main/src/App.tsx#L98-L104) in our sandbox. Was this page helpful? YesNo [Events](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/README) [Accounts changed](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/accounts-changed) ⌘I --- # Provider methods - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/provider-methods/README#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Provider methods Provider methods [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) All provider methods follow a protocol format of: Report incorrect code Copy Ask AI https://phantom.app/ul// The following provider methods are accessible via deeplinks: * [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) * [Disconnect](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect) * [SignAndSendTransaction](https://docs.phantom.com/phantom-deeplinks/provider-methods/signandsendtransaction) * [SignAllTransactions](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions) * [SignTransaction](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction) * [SignMessage](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage) Was this page helpful? YesNo [Limitations](https://docs.phantom.com/phantom-deeplinks/limitations) [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) ⌘I --- # Verify your domain - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-portal/verify-domain#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Account setup Verify your domain [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Add your domain in Phantom Portal](https://docs.phantom.com/phantom-portal/verify-domain#add-your-domain-in-phantom-portal) * [Get your verification code](https://docs.phantom.com/phantom-portal/verify-domain#get-your-verification-code) * [Add the DNS TXT record](https://docs.phantom.com/phantom-portal/verify-domain#add-the-dns-txt-record) * [Common DNS providers](https://docs.phantom.com/phantom-portal/verify-domain#common-dns-providers) * [Complete verification](https://docs.phantom.com/phantom-portal/verify-domain#complete-verification) * [Multiple TXT records](https://docs.phantom.com/phantom-portal/verify-domain#multiple-txt-records) * [Subdomain or root domain](https://docs.phantom.com/phantom-portal/verify-domain#subdomain-or-root-domain) * [DNS changes not saving](https://docs.phantom.com/phantom-portal/verify-domain#dns-changes-not-saving) * [FAQ](https://docs.phantom.com/phantom-portal/verify-domain#faq) * [Next steps](https://docs.phantom.com/phantom-portal/verify-domain#next-steps) To use Phantom Connect in production and to have your app appear in Phantom’s public surfaces, you must verify the domain where your app runs. Domain verification confirms ownership of the domain and helps protect users from phishing and impersonation. Verification is required in several situations. In particular, you must verify your domain before the following actions are allowed: * Using Phantom Connect SDKs in production * Allowing users outside your team to connect * Appearing in Phantom’s Explore tab, search results, or recommended apps [​](https://docs.phantom.com/phantom-portal/verify-domain#add-your-domain-in-phantom-portal) Add your domain in Phantom Portal --------------------------------------------------------------------------------------------------------------------------------- 1. In Phantom Portal, go to **Edit App Info**. 2. Find the **Public URL** field. 3. Enter your app’s primary domain, for example `https://yourapp.com`. 4. Select **Save**. Enter only your root domain or primary subdomain. Do not include paths such as `/app`, `/login`, or `/dashboard`. [​](https://docs.phantom.com/phantom-portal/verify-domain#get-your-verification-code) Get your verification code ------------------------------------------------------------------------------------------------------------------- After saving your domain, Phantom Portal generates a verification code for you. 1. Locate the **Domain Verification** section. 2. Copy the verification code shown. It will look like `phantom-verification-XXXXX`. ![Phantom Portal showing the verification code](https://mintcdn.com/phantom-e50e2e68/oGAeqebvkE4mhDv1/phantom-portal/images/domain-verification-code.png?w=2500&fit=max&auto=format&n=oGAeqebvkE4mhDv1&q=85&s=358bf7b140f32557c04c00d32e178a58) [​](https://docs.phantom.com/phantom-portal/verify-domain#add-the-dns-txt-record) Add the DNS TXT record ----------------------------------------------------------------------------------------------------------- Add a TXT record to your domain’s DNS settings using the verification code. | Field | Value | | --- | --- | | Type | TXT | | Host / Name | `@` (or leave blank, depending on provider) | | Value | The verification code from Phantom Portal | | TTL | 3600 or your provider’s default | ### [​](https://docs.phantom.com/phantom-portal/verify-domain#common-dns-providers) Common DNS providers Cloudflare 1. Open the Cloudflare dashboard. 2. Select your domain. 3. Go to DNS → Records. 4. Add a TXT record with name `@` and the verification code as the value. 5. Save your changes. GoDaddy 1. Open GoDaddy and go to DNS settings for your domain. 2. Add a new TXT record. 3. Use `@` as the host and paste the verification code as the value. 4. Save your changes. Namecheap 1. Go to Domain List → Manage → Advanced DNS. 2. Add a TXT record. 3. Use `@` as the host and paste the verification code as the value. 4. Save your changes. AWS Route 53 1. Open the Route 53 console. 2. Select your hosted zone. 3. Create a TXT record at the root. 4. Paste the verification code as the value and save. Vercel 1. Open your project settings. 2. Go to Domains and select your domain. 3. Add a TXT record using the verification code. 4. Save your changes. If you’re not sure where your DNS is managed, check your domain registrar or hosting provider. [​](https://docs.phantom.com/phantom-portal/verify-domain#complete-verification) Complete verification --------------------------------------------------------------------------------------------------------- DNS changes usually propagate within 15 to 60 minutes, but may take up to 48 hours. You can check propagation using the following command: Report incorrect code Copy Ask AI nslookup -type=TXT yourapp.com ## Troubleshooting ### Verification fails If selecting **Verify Domain** returns an error, try the following steps: - Wait for DNS propagation to complete, which can take up to 48 hours - Confirm that the TXT record value matches the verification code exactly. - Remove any quotation marks added automatically by your DNS provider. - Ensure the TXT record is added at the root domain (@), not to a subdomain unless required. - Check the record using a different DNS lookup tool. - Clear your local DNS cache using the following commands: ```bash # macOS sudo dscacheutil -flushcache # Windows ipconfig /flushdns ### [​](https://docs.phantom.com/phantom-portal/verify-domain#multiple-txt-records) Multiple TXT records If your domain already has TXT records, you can safely add another one for Phantom verification. DNS supports multiple TXT records on the same domain, so don’t remove or overwrite existing records. ### [​](https://docs.phantom.com/phantom-portal/verify-domain#subdomain-or-root-domain) Subdomain or root domain If you’re unsure which domain to verify, use the domain where users actually access your app: * Verify app.example.com if your app runs on that subdomain. * Verify example.com if your app runs on the root domain. ### [​](https://docs.phantom.com/phantom-portal/verify-domain#dns-changes-not-saving) DNS changes not saving If your DNS provider doesn’t save the record, the issue is often related to formatting or permissions. Try the following: * Remove quotation marks from the TXT value. * Check for trailing periods or extra whitespace. * Confirm that you have permission to edit DNS records for the domain. * Contact your DNS provider’s support team if the issue persists. [​](https://docs.phantom.com/phantom-portal/verify-domain#faq) FAQ --------------------------------------------------------------------- Can I verify multiple domains? Yes. If your app is accessed from multiple domains, verify each one separately. Do I need to verify staging domains? No. Staging domains do not need verification unless you want them to appear in public listings. How long does verification last? Verification remains valid as long as the TXT record stays in place. Can I change my domain after verification? Yes. Verify the new domain by completing the same process. [​](https://docs.phantom.com/phantom-portal/verify-domain#next-steps) Next steps ----------------------------------------------------------------------------------- [Create your app\ ---------------\ \ Previous: Create your app to get started with integration](https://docs.phantom.com/phantom-portal/create-app) [Configure allowed origins\ -------------------------\ \ Next: Configure allowed origins](https://docs.phantom.com/phantom-portal/configure-urls) Was this page helpful? YesNo [Create an app](https://docs.phantom.com/phantom-portal/create-app) [Configure allowed origins and redirect URLs](https://docs.phantom.com/phantom-portal/configure-urls) ⌘I --- # Phantom Connect - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-connect#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Overview Phantom Connect [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Overview](https://docs.phantom.com/phantom-connect#overview) * [Connect modal](https://docs.phantom.com/phantom-connect#connect-modal) * [Embedded wallets](https://docs.phantom.com/phantom-connect#embedded-wallets) * [Spending limits](https://docs.phantom.com/phantom-connect#spending-limits) * [Authentication methods](https://docs.phantom.com/phantom-connect#authentication-methods) * [Social login](https://docs.phantom.com/phantom-connect#social-login) * [Extension and injected wallets](https://docs.phantom.com/phantom-connect#extension-and-injected-wallets) * [Account selection behavior](https://docs.phantom.com/phantom-connect#account-selection-behavior) * [Social login](https://docs.phantom.com/phantom-connect#social-login-2) * [Extension and injected wallets](https://docs.phantom.com/phantom-connect#extension-and-injected-wallets-2) * [Disconnecting an app](https://docs.phantom.com/phantom-connect#disconnecting-an-app) * [Session duration](https://docs.phantom.com/phantom-connect#session-duration) * [FAQ](https://docs.phantom.com/phantom-connect#faq) * [Resources](https://docs.phantom.com/phantom-connect#resources) [​](https://docs.phantom.com/phantom-connect#overview) Overview ------------------------------------------------------------------ Phantom Connect is a suite of tools that lets developers onboard users instantly with embedded wallets powered by Phantom. Users sign in with Google or Apple (with more identity providers coming in the future), and your app receives a secure, ready-to-use wallet without requiring extensions, mobile apps, or private-key management. When users authenticate with social login, Phantom creates an embedded wallet inside a secure environment on the user’s device. This wallet is authorized to transact with your app and is protected by spending-limit controls, domain binding, and real-time risk evaluation. Your app never handles private keys and never becomes a custodian. [​](https://docs.phantom.com/phantom-connect#connect-modal) Connect modal ---------------------------------------------------------------------------- Phantom Connect includes a built-in Connect modal that handles sign-in and wallet connection for you. It’s the recommended way to onboard users because it works across supported sign-in methods and returns a connected wallet session your app can use immediately. ![Connect modal showing login options with Google, Apple, and Other Wallets](https://mintcdn.com/phantom-e50e2e68/KN3-1wDAs9l09m_L/images/connect-modal.png?w=2500&fit=max&auto=format&n=KN3-1wDAs9l09m_L&q=85&s=88e64608bc820756d97accc6524892ed) Connect modal features: * Multiple sign-in options, including Google and Apple * Built-in error handling and loading states * Works across devices and environments * Handles the full connection flow and returns a ready-to-use wallet session For implementation, see the Connect guide for your SDK: [React](https://docs.phantom.com/sdks/react-sdk/connect) , [React Native](https://docs.phantom.com/sdks/react-native-sdk/connect) . [​](https://docs.phantom.com/phantom-connect#embedded-wallets) Embedded wallets ---------------------------------------------------------------------------------- Embedded wallets are wallets built directly into your application. No browser extensions, mobile apps, or external wallet software required. Users authenticate with familiar methods like Google or Apple, and your app instantly has access to a fully functional wallet. Embedded wallets remove the friction of traditional wallet onboarding while maintaining the security and self-custody guarantees users expect. [​](https://docs.phantom.com/phantom-connect#spending-limits) Spending limits -------------------------------------------------------------------------------- Embedded wallets have a default spending limit of **$1,000 USD per app per day**. This limit applies to the total value of transactions a user can sign through your app within a 24-hour period. The limit resets daily and helps protect users from unauthorized or excessive spending. [​](https://docs.phantom.com/phantom-connect#authentication-methods) Authentication methods ---------------------------------------------------------------------------------------------- Phantom Connect currently supports one direct authentication method: social login. Users authenticate with Google or Apple, and Phantom Connect creates or retrieves an embedded wallet for your app. Extension and injected wallets are also supported. These connections use the user’s existing self-custodial wallet and its own signing system. ### [​](https://docs.phantom.com/phantom-connect#social-login) Social login When a user selects **Sign in with Google** or **Sign in with Apple**, Phantom Connect creates or retrieves an embedded wallet tied to that identity. Flow summary: 1. Users authenticate with Google or Apple. 2. Users enter their 4-digit PIN. 3. Users approve any required permissions or spending limits. 4. Your app receives the connected embedded wallet. How embedded wallets work for different user types: * **New social-login users:** Phantom creates a brand-new embedded wallet. * **Existing social-login (seedless) users:** Phantom securely converts the existing seedless wallet into an embedded wallet. After that, the same wallet is usable in both Phantom and your app. ### [​](https://docs.phantom.com/phantom-connect#extension-and-injected-wallets) Extension and injected wallets When users connect with the Phantom extension or any other injected wallet: * Phantom Connect doesn’t create an embedded wallet. * Users transact and approve actions directly inside their extension. * The extension signs using whatever key-management system that wallet uses. * Your app receives the connected account through the same Phantom Connect SDK interface. This gives your app a unified integration path while preserving the user’s wallet choice. [​](https://docs.phantom.com/phantom-connect#account-selection-behavior) Account selection behavior ------------------------------------------------------------------------------------------------------ ### [​](https://docs.phantom.com/phantom-connect#social-login-2) Social login Users can choose from any Phantom accounts tied to their Google or Apple identity, from the account picker. ### [​](https://docs.phantom.com/phantom-connect#extension-and-injected-wallets-2) Extension and injected wallets Users can choose from any Phantom account tied to their recovery phrase. [​](https://docs.phantom.com/phantom-connect#disconnecting-an-app) Disconnecting an app ------------------------------------------------------------------------------------------ Users can disconnect your app at any time from Phantom: 1. Open Phantom (extension or mobile app). 2. Go to **Settings → Connected Apps**. 3. Select your app. 4. Choose **Revoke permissions** or **Disconnect**. After disconnecting, your app can no longer access the wallet. [​](https://docs.phantom.com/phantom-connect#session-duration) Session duration ---------------------------------------------------------------------------------- A Phantom Connect session remains active for seven days from the last login. After it expires, users must sign in again with Google or Apple. [​](https://docs.phantom.com/phantom-connect#faq) FAQ -------------------------------------------------------- What is Phantom Connect? Phantom Connect lets your users sign in with Google, Apple, or the Phantom extension and instantly receive a secure embedded wallet your app can use for signing. No wallet installation required. If users already use the Phantom extension, they can connect with that too. How much does Phantom Connect cost? There’s no cost to use Phantom Connect. Phantom provides authentication, embedded wallets, and signing infrastructure at no charge to developers. How does Phantom Connect keep wallets secure? Phantom Connect creates a wallet that only the user can authorize. Private keys never pass through your app or backend and never appear in plaintext. Every action is authenticated by the user and evaluated against built-in protections like spending limits and app-level permissions. Your integration stays fully non-custodial. Which authentication methods does Phantom Connect support? Phantom Connect supports two ways for users to sign in: * Social login: Users sign in with Google or Apple. Your app receives a secure embedded wallet that’s ready to use immediately. * Extension and injected wallets: Users connect with the Phantom extension or any other injected wallet. All approvals happen in the existing wallet, and no embedded wallet is created. Your app can support one or both methods depending on your needs. Do I need to handle private keys myself? No. Private keys are never exposed to your app, your backend, or your infrastructure. Phantom Connect handles secure signing behind the scenes, and your app simply requests signatures through the SDK. What does integration look like for my app? Integration is lightweight: 1. [Create an account in Phantom Portal](https://docs.phantom.com/phantom-portal/create-account) . 2. [Create an app](https://docs.phantom.com/phantom-portal/create-app) . 3. [Verify your domain](https://docs.phantom.com/phantom-portal/verify-domain) . 4. [Configure allowed origins and redirect URLs](https://docs.phantom.com/phantom-portal/configure-urls) . 5. [Add your app information](https://docs.phantom.com/phantom-portal/edit-app-info) . 6. [Get your App ID and integrate](https://docs.phantom.com/phantom-portal/get-app-id) . 7. Trigger the connect flow and start using the wallet returned by the [SDK](https://docs.phantom.com/wallet-sdks-overview) . [​](https://docs.phantom.com/phantom-connect#resources) Resources -------------------------------------------------------------------- For implementation details and platform-specific examples, see the Phantom Connect SDKs: * [React SDK](https://docs.phantom.com/sdks/react-sdk) * [Browser SDK](https://docs.phantom.com/sdks/browser-sdk) * [React Native SDK](https://docs.phantom.com/sdks/react-native-sdk) Was this page helpful? YesNo [Build with Phantom](https://docs.phantom.com/introduction) [Updates](https://docs.phantom.com/updates) ⌘I --- # Chain changed - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/chain-changed#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Events Chain changed [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Event emitted upon the dapp or wallet changing the network/chain you are connected to. Phantom abstracts the concept of networks, and network switching. So there is no action required on your end as a dapp developer. Report incorrect code Copy Ask AI ethereum.on('chainChanged', (chainId: string) => { console.log(chainId); // "0x1" on Ethereum /* Phantom will handle all of the internal changes needed to handle the new chain. * As the dapp developer, * you just need to make sure all of your transaction requests * populate the correct chainId */ }); Was this page helpful? YesNo [Disconnect](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/disconnect) [Methods](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/README) ⌘I --- # SignAndSendTransaction (deprecated) - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/provider-methods/signandsendtransaction#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Provider methods SignAndSendTransaction (deprecated) [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) The `signAndSendTransaction` deeplink has been deprecated. Use the [signAllTransactions](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions) or [signTransaction](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction) deeplink instead. Was this page helpful? YesNo [Disconnect](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect) [SignAllTransactions](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions) ⌘I --- # Solana priority fees - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/solana-priority-fees#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana features Solana priority fees [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [How transaction fees work on Solana](https://docs.phantom.com/developer-powertools/solana-priority-fees#how-transaction-fees-work-on-solana) * [Priority fee calculation](https://docs.phantom.com/developer-powertools/solana-priority-fees#priority-fee-calculation) * [How Phantom applies priority fees to app transactions](https://docs.phantom.com/developer-powertools/solana-priority-fees#how-phantom-applies-priority-fees-to-app-transactions) * [Further reading](https://docs.phantom.com/developer-powertools/solana-priority-fees#further-reading) Phantom automatically calculates and applies [Priority fees](https://docs.solana.com/proposals/fee_transaction_priority) to all Phantom-generated transactions and dapp-generated transactions that meet [our requirements](https://docs.phantom.com/developer-powertools/solana-priority-fees#how-phantom-applies-priority-fees-to-dapp-transactions) . [​](https://docs.phantom.com/developer-powertools/solana-priority-fees#how-transaction-fees-work-on-solana) How transaction fees work on Solana -------------------------------------------------------------------------------------------------------------------------------------------------- Solana transactions fees are calculated based on two main parts: * A statically set base fee per signature, and * The computational resources used during the transaction, measured in **Compute Units** **(CU)** Since each transaction requires different computational resources, they are allotted a maximum number of compute units, known as the Compute Budget. After the Compute Budget is exhausted, the runtime halts the transaction and returns an error, resulting in a failed transaction. The maximum budget for a transaction is 1.4 million CU, while the total blockspace limit is 48 million CU. Only a few computationally heavy TXs, like a mint or a swap, could fill the entire block, halting other TXs—hence the need for **Priority Fees**. The fee priority of a transaction `T` can be defined as `F(T)`, where `F(T)` is the _“fee-per compute-unit”_, calculated by: (additional\_fee+base\_fee) / requested\_compute\_units(additional\\\_fee + base\\\_fee)\\ /\\ requested\\\_compute\\\_units(additional\_fee+base\_fee) / requested\_compute\_units This means that the more compute units a transaction requests, the more additional fee it will have to pay to maintain the priority in the transaction queue. This prevents computationally heavy transactions from being easily spammed or from filling blocks. [​](https://docs.phantom.com/developer-powertools/solana-priority-fees#priority-fee-calculation) Priority fee calculation ---------------------------------------------------------------------------------------------------------------------------- Priority fees are calculated as, priority\_fees \= compute\_budget ∗ compute\_unit\_pricepriority\\\_fees\\ =\\ compute\\\_budget\\ \*\\ compute\\\_unit\\\_pricepriority\_fees \= compute\_budget ∗ compute\_unit\_price where, compute\_budget \= # of instructions ∗ compute\_unit\_limitcompute\\\_budget\\ =\\ \\#\\ of\\ instructions\\ \*\\ compute\\\_unit\\\_limitcompute\_budget \= # of instructions ∗ compute\_unit\_limit [​](https://docs.phantom.com/developer-powertools/solana-priority-fees#how-phantom-applies-priority-fees-to-app-transactions) How Phantom applies priority fees to app transactions -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Although dapps can set their own [priority fees on transactions](https://solanacookbook.com/references/basic-transactions.html#how-to-change-compute-budget-fee-priority-for-a-transaction) they generate, we highly discourage doing so as it often surfaces unnecessary complexity to end-users. Instead, we recommend that dapp developers let Phantom apply priority fees on the user’s behalf. Phantom will calculate and apply Priority Fees to all dapp-generated transactions, provided: * The transaction(s) do not already have signature(s) present. * The transaction(s) do not have existing priority fee instructions (`computeUnitBudget` or `computeUnitLimit`). * After enhancing transaction(s) with Priority Fees, the size of each transaction will still be less than the byte size limit (1232 bytes). If all of the above conditions are met, Phantom will automatically calculate and apply priority fees at the time of signing. This pattern applies to all Phantom provider methods (`signAndSendTransaction`, `signTransaction` , `signAllTransactions`) across all environments (extension, mobile in-app browser, deeplinks, mobile wallet adapter). [​](https://docs.phantom.com/developer-powertools/solana-priority-fees#further-reading) Further reading ---------------------------------------------------------------------------------------------------------- * [Fee Transaction Priority - Solana Proposals](https://docs.solana.com/proposals/fee_transaction_priority) * [How to change compute budget fee priority for a transaction - Solana Cookbook](https://solanacookbook.com/references/basic-transactions.html#how-to-change-compute-budget-fee-priority-for-a-transaction) * [Prioritization Fees - Solana Programming Model](https://docs.solana.com/developing/programming-model/runtime#prioritization-fees) * [Transaction Fees - Prioritization Fee](https://docs.solana.com/transaction_fees#prioritization-fee) Was this page helpful? YesNo [Shortcuts](https://docs.phantom.com/developer-powertools/shortcuts) [Solana Versioned Transactions](https://docs.phantom.com/developer-powertools/solana-versioned-transactions) ⌘I --- # Methods - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/README#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Methods Methods [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) In the following pages you will find information about the individual methods that are available to you through Phantom’s `window.phantom.ethereum` object. As a dapp developer, you will use these methods to programmatically interact with the wallet. From sending requests to/from the blockchain, to connecting to your website—these methods will help you interact with your users. Was this page helpful? YesNo [Chain changed](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/chain-changed) [isConnected](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/isconnected) ⌘I --- # Phantom Portal overview - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-portal/portal#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Overview Phantom Portal overview [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Key features](https://docs.phantom.com/phantom-portal/portal#key-features) * [Apps that need Phantom Portal access](https://docs.phantom.com/phantom-portal/portal#apps-that-need-phantom-portal-access) * [Domain verification](https://docs.phantom.com/phantom-portal/portal#domain-verification) * [Resources](https://docs.phantom.com/phantom-portal/portal#resources) * [Need help?](https://docs.phantom.com/phantom-portal/portal#need-help) Phantom Portal is a self-service dashboard where developers manage their app’s configuration, branding, and presence within Phantom. To sign up, go to [phantom.app/portal](https://phantom.app/portal) and sign up with a Google account or Apple ID. [​](https://docs.phantom.com/phantom-portal/portal#key-features) Key features -------------------------------------------------------------------------------- Phantom Portal is the central hub for managing your app’s integration with Phantom. The portal lets you do the following: * Configure your app: Set up allowed URLs, network support, and authentication settings. * Manage branding: Upload your app icon, cover image, and description. * View access mode: See your app’s current access mode `DISABLED`, `PRIVATE`, or `PUBLIC`). * Verify your domain: Confirm that you own the domain in order to have your app displayed in Phantom. [​](https://docs.phantom.com/phantom-portal/portal#apps-that-need-phantom-portal-access) Apps that need Phantom Portal access -------------------------------------------------------------------------------------------------------------------------------- You need to use Phantom Portal if you’re building one of the following: * Apps with embedded wallet: Using [React SDK](https://docs.phantom.com/sdks/react-sdk) , [Browser SDK](https://docs.phantom.com/sdks/browser-sdk) , or [React Native SDK](https://docs.phantom.com/sdks/react-native-sdk) * Apps with Phantom Connect: Implementing [social login or extension-based authentication](https://docs.phantom.com/phantom-connect) . [Learn about Phantom Connect](https://docs.phantom.com/phantom-connect) . * Apps that need public listing: Appearing in Phantom’s **Explore** tab, search results, or recommended apps. [​](https://docs.phantom.com/phantom-portal/portal#domain-verification) Domain verification ---------------------------------------------------------------------------------------------- Domain verification confirms that you control the domain where your app runs. While domain verification is not required to use Phantom Connect, it is required for your app to appear in Phantom’s public discovery surfaces, including the following: * The **Explore** tab: A curated discovery surface that helps users find your app. * Search results: Your app appears when users search within Phantom. * Recommended apps: Featured placements that increase visibility. [​](https://docs.phantom.com/phantom-portal/portal#resources) Resources -------------------------------------------------------------------------- [View Phantom Portal terms\ -------------------------\ \ Phantom Developer Portal Terms of Service](https://phantom.com/developer-portal-terms) [​](https://docs.phantom.com/phantom-portal/portal#need-help) Need help? --------------------------------------------------------------------------- Contact [Phantom developer support](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) . [Get started\ -----------\ \ Next: Step-by-step guide for setting up your app in Phantom Portal](https://docs.phantom.com/phantom-portal/getting-started) Was this page helpful? YesNo [Get started](https://docs.phantom.com/phantom-portal/getting-started) ⌘I --- # Solana Token Extensions (Token22) - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana features Solana Token Extensions (Token22) [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Group and Group Pointer](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#group-and-group-pointer) * [Interest-Bearing Tokens](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#interest-bearing-tokens) * [Memo on Transfer](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#memo-on-transfer) * [Metadata](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#metadata) * [Metadata Pointer](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#metadata-pointer) * [Permanent Delegate](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#permanent-delegate) * [Transfer Fees](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#transfer-fees) * [Transfer Hooks](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#transfer-hooks) Phantom supports [fungible](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles) and [non-fungible](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles) tokens created with the [Token-2022 Program](https://spl.solana.com/token-2022) . At the time of this writing, Phantom supports the following Token Extensions: [​](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#group-and-group-pointer) Group and Group Pointer ------------------------------------------------------------------------------------------------------------------------------------- The [Group](https://spl.solana.com/token-2022/extensions#group) and [Group Pointer](https://spl.solana.com/token-2022/extensions#group-pointer) extensions allow token creators to create configurations for grouping tokens together. Phantom currently supports both extensions for non-fungible tokens in the **Collectibles** tab. If a particular mint has a `memberAddress` listed under a `groupMemberPointer`, Phantom will look for the `mint` and `group` fields stored at this `memberAddress`. If the mint address matches the `mint` value, Phantom will use the `group` as the new group identifier. Example (mainnet): [8eDYWjDKmCR5B3UJm95gaG8zCdT5anWakTZG1PyWpBm9](https://solana.fm/address/8eDYWjDKmCR5B3UJm95gaG8zCdT5anWakTZG1PyWpBm9/extensions) [​](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#interest-bearing-tokens) Interest-Bearing Tokens ------------------------------------------------------------------------------------------------------------------------------------- The [Interest-Bearing Tokens](https://spl.solana.com/token-2022/extensions#interest-bearing-tokens) extension allows creators to set an interest rate on their tokens. This interest rate is for cosmetic purposes only, no new tokens are created as a result of the interest. If this extension is enabled, Phantom will display the current interest rate on the token’s detail screen. Example (mainnet): [aNMXxywEHAH3VfWnaVwedLJWPT9NsxagsGTEQqS5WKK](https://solana.fm/address/aNMXxywEHAH3VfWnaVwedLJWPT9NsxagsGTEQqS5WKK?cluster=mainnet-alpha) [​](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#memo-on-transfer) Memo on Transfer ----------------------------------------------------------------------------------------------------------------------- The [Memo on Transfer](https://spl.solana.com/token-2022/extensions#required-memo-on-transfer) extension enforces that all incoming transfers must have an accompanying memo instruction right before the transfer instruction. If this extension is enabled, an account owner may choose to flip the required memo on or off. Phantom will allow a user to input a memo on transfers, even if it is optional. Example on mainnet: BonkEarn [CKfatsPMUf8SkiURsDXs7eK6GWb4Jsd6UDbs7twMCWxo](https://solana.fm/address/CKfatsPMUf8SkiURsDXs7eK6GWb4Jsd6UDbs7twMCWxo?cluster=mainnet-alpha) [​](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#metadata) Metadata ------------------------------------------------------------------------------------------------------- The [Metadata](https://spl.solana.com/token-2022/extensions#metadata) extension allows a token creator to include their metadata directly in the token’s mint account. Phantom will display the `name` and `symbol` that is stored in the mint account, and look to the `uri` field for additional information such as the token’s `image`. Example on devnet: [EGKdqrXxFeTpRTskrH81xmefuTAU9MJGCDLoNss28a2](https://solana.fm/address/EGKdqrXxFeTpRTskrH81xmefuTAU9MJGCDLoNss28a2?cluster=devnet-solana) [​](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#metadata-pointer) Metadata Pointer ----------------------------------------------------------------------------------------------------------------------- The [Metadata Pointer](https://spl.solana.com/token-2022/extensions#metadata-pointer) extension allows a token creator to designate an address that describes the canonical metadata. Phantom supports the Metadata Pointer Extension. At the time of this writing, Phantom will assume all metadata schemas follow the [Metaplex Standard](https://developers.metaplex.com/token-metadata/token-standard) . [​](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#permanent-delegate) Permanent Delegate --------------------------------------------------------------------------------------------------------------------------- The [Permanent Delegate](https://spl.solana.com/token-2022/extensions#permanent-delegate) extension allows token creators to grant unlimited delegation privileges over any account for that mint. If enabled, a delegate can can burn or transfer any amount of tokens. Phantom will display a warning for any token that has this extension enabled. Example on mainnet: [aNMXxywEHAH3VfWnaVwedLJWPT9NsxagsGTEQqS5WKK](https://solana.fm/address/aNMXxywEHAH3VfWnaVwedLJWPT9NsxagsGTEQqS5WKK?cluster=mainnet-alpha) [​](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#transfer-fees) Transfer Fees ----------------------------------------------------------------------------------------------------------------- The [Transfer Fees](https://spl.solana.com/token-2022/extensions#transfer-fees) extension allows a token creator to assess fees on every token transfer. If this extension is enabled, Phantom will display the fee on the confirmation screen of every send. Example on mainnet: BonkEarn [CKfatsPMUf8SkiURsDXs7eK6GWb4Jsd6UDbs7twMCWxo](https://solana.fm/address/CKfatsPMUf8SkiURsDXs7eK6GWb4Jsd6UDbs7twMCWxo?cluster=mainnet-alpha) [​](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22#transfer-hooks) Transfer Hooks ------------------------------------------------------------------------------------------------------------------- The [Transfer Hooks](https://spl.solana.com/token-2022/extensions#transfer-hook) extension allows a token to invoke a custom program at the time of transfer. This program can be used to add custom logic on transfers, such as assessing royalties or determining if the transfer is allowed based on a range of on-chain data sources. Was this page helpful? YesNo [Solana Versioned Transactions](https://docs.phantom.com/developer-powertools/solana-versioned-transactions) [Solana Actions and Blinks](https://docs.phantom.com/developer-powertools/solana-actions-and-blinks) ⌘I --- # Contracts and Auto-Confirm - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-portal/contracts#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Reference Contracts and Auto-Confirm [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [About Auto-Confirm](https://docs.phantom.com/phantom-portal/contracts#about-auto-confirm) * [How Auto-Confirm works](https://docs.phantom.com/phantom-portal/contracts#how-auto-confirm-works) * [When Auto-Confirm activates](https://docs.phantom.com/phantom-portal/contracts#when-auto-confirm-activates) * [Why developers use Auto-Confirm](https://docs.phantom.com/phantom-portal/contracts#why-developers-use-auto-confirm) * [Enable Auto-Confirm for your app](https://docs.phantom.com/phantom-portal/contracts#enable-auto-confirm-for-your-app) * [Step 1: Verify your domain](https://docs.phantom.com/phantom-portal/contracts#step-1-verify-your-domain) * [Step 2: Complete your app profile](https://docs.phantom.com/phantom-portal/contracts#step-2-complete-your-app-profile) * [Step 3: Use production-ready contracts](https://docs.phantom.com/phantom-portal/contracts#step-3-use-production-ready-contracts) * [Submit your contracts](https://docs.phantom.com/phantom-portal/contracts#submit-your-contracts) * [Step 1: Go to the Contracts section](https://docs.phantom.com/phantom-portal/contracts#step-1-go-to-the-contracts-section) * [Step 2: Provide contract details](https://docs.phantom.com/phantom-portal/contracts#step-2-provide-contract-details) * [Step 3: Submit for review](https://docs.phantom.com/phantom-portal/contracts#step-3-submit-for-review) * [Review criteria](https://docs.phantom.com/phantom-portal/contracts#review-criteria) * [Possible outcomes](https://docs.phantom.com/phantom-portal/contracts#possible-outcomes) * [Manage approved contracts](https://docs.phantom.com/phantom-portal/contracts#manage-approved-contracts) * [View contract status](https://docs.phantom.com/phantom-portal/contracts#view-contract-status) * [Add more contracts](https://docs.phantom.com/phantom-portal/contracts#add-more-contracts) * [Update contract information](https://docs.phantom.com/phantom-portal/contracts#update-contract-information) * [Remove a contract](https://docs.phantom.com/phantom-portal/contracts#remove-a-contract) * [FAQ](https://docs.phantom.com/phantom-portal/contracts#faq) * [Support](https://docs.phantom.com/phantom-portal/contracts#support) * [Next steps](https://docs.phantom.com/phantom-portal/contracts#next-steps) The **Contracts** section of Phantom Portal is where you enable Auto-Confirm for your app. This page walks you through the requirements, the submission process, and how to manage approved contracts. Before you begin, make sure your domain is verified, because it’s required for all Auto-Confirm submissions. Auto-Confirm is granted selectively after a security review. [​](https://docs.phantom.com/phantom-portal/contracts#about-auto-confirm) About Auto-Confirm ----------------------------------------------------------------------------------------------- [Auto-Confirm](https://phantom.app/learn/blog/auto-confirm) reduces approval dialogs for trusted, high-frequency interactions. When users turn it on and your contracts are approved, Phantom signs transactions automatically as long as the request comes from your verified domain. Watch the [Auto-Confirm demo](https://youtu.be/WAfv06CPiRo) on YouTube to see it in action. ### [​](https://docs.phantom.com/phantom-portal/contracts#how-auto-confirm-works) How Auto-Confirm works 1. User turns on Auto-Confirm for your app. 2. Your app submits a transaction to an approved contract. 3. Phantom validates\*\* the transaction and domain. 4. Transaction is signed automatically without a dialog. 5. Transaction is broadcast to the blockchain. Users turn Auto-Confirm directly in Phantom after they connect to your app. They can review approved contracts before enabling and disable Auto-Confirm anytime from **Settings → Connected Apps**. Phantom continues to analyze every transaction, verifies that the request originates from your verified domain, and limits Auto-Confirm to approved contracts. Users keep full control and can turn it off at any time. Phantom shows transaction details in the activity feed even when Auto-Confirm is turned on, giving users visibility into all activity. Some users prefer manual approval for every transaction. Respect these preferences and encourage safe behavior. ### [​](https://docs.phantom.com/phantom-portal/contracts#when-auto-confirm-activates) When Auto-Confirm activates Auto-Confirm activates only when the user has enabled it, the request originates from your verified domain, and the transaction targets one of your approved contracts. If any of these conditions are missing, Phantom shows a standard approval dialog. This includes first-time connections, transactions to unapproved contracts, or requests that fail security checks or appear unusual based on user settings. ### [​](https://docs.phantom.com/phantom-portal/contracts#why-developers-use-auto-confirm) Why developers use Auto-Confirm Auto-Confirm makes interactions feel faster and more fluid, reduces friction during repeated actions, and enables smoother transaction flows without compromising safety. It adds polish to your application and improves conversion rates while benefiting from Phantom’s ongoing monitoring. [​](https://docs.phantom.com/phantom-portal/contracts#enable-auto-confirm-for-your-app) Enable Auto-Confirm for your app --------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/phantom-portal/contracts#step-1-verify-your-domain) Step 1: Verify your domain Domain verification is required before you can submit contracts. Complete DNS verification in **Edit App Info → Domain verification**. Requests from unverified domains are rejected automatically. ### [​](https://docs.phantom.com/phantom-portal/contracts#step-2-complete-your-app-profile) Step 2: Complete your app profile A complete app profile helps reviewers understand your project and evaluate legitimacy. Make sure you add: * App icon: 250×250px recommended (PNG or JPG, max 1MB) * Cover image: 1500×500px recommended (PNG or JPG, max 2MB) * Description: Clear overview of what your app does * Category: Select the most accurate category * Social links: Website, Twitter, GitHub, or community links ### [​](https://docs.phantom.com/phantom-portal/contracts#step-3-use-production-ready-contracts) Step 3: Use production-ready contracts Your contracts should be deployed on mainnet, stable, tested, clearly documented, and ideally audited. Phantom evaluates both contract behavior and associated risk. [​](https://docs.phantom.com/phantom-portal/contracts#submit-your-contracts) Submit your contracts ----------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/phantom-portal/contracts#step-1-go-to-the-contracts-section) Step 1: Go to the Contracts section 1. Log in to [Phantom Portal](https://phantom.app/portal) . 2. Open **Contracts** in the navigation. 3. Select **Submit contract** or **Add new contract**. ### [​](https://docs.phantom.com/phantom-portal/contracts#step-2-provide-contract-details) Step 2: Provide contract details For each contract, include: * Contract address: The live deployed address. EVM addresses begin with `0x`; Solana uses base58. * Network: Select the blockchain where the contract is deployed. * Contract name: Use a clear name such as “Swap router” or “Marketplace actions.” * Description: Describe what the contract does, typical user actions, and why Auto-Confirm is meaningful for it. * Additional context (recommended): Links to source code, audits, architecture notes, or documentation help reviewers understand the contract more quickly. The more context you provide, the faster the review usually moves. ### [​](https://docs.phantom.com/phantom-portal/contracts#step-3-submit-for-review) Step 3: Submit for review Once submitted, Phantom’s security team reviews the contract. You may receive follow-up questions if clarification is needed. #### [​](https://docs.phantom.com/phantom-portal/contracts#review-criteria) Review criteria Phantom evaluates each contract individually. The review considers: **Security and architecture** Code quality, audits, known risks, upgrade patterns, and how the contract behaves. **App legitimacy** Domain verification, clear descriptions, and completeness of your app profile. **User experience value** Expected interaction frequency and whether Auto-Confirm meaningfully improves the flow. **Risk considerations** Potential for fund loss, contract complexity, admin-key exposure, oracle dependencies, and overall trustworthiness. #### [​](https://docs.phantom.com/phantom-portal/contracts#possible-outcomes) Possible outcomes | Outcome | Description | | --- | --- | | **Approved** | Your contract is added to your approved list. Users can enable Auto-Confirm for interactions involving it. | | **More information needed** | Phantom requests additional documentation or clarification. | | **Rejected** | The contract doesn’t meet Auto-Confirm requirements. You can revise and resubmit. | [​](https://docs.phantom.com/phantom-portal/contracts#manage-approved-contracts) Manage approved contracts ------------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/phantom-portal/contracts#view-contract-status) View contract status In the Contracts section, you can view submitted contracts, their status, approval dates, and any review notes. ### [​](https://docs.phantom.com/phantom-portal/contracts#add-more-contracts) Add more contracts You can submit additional contracts at any time. ### [​](https://docs.phantom.com/phantom-portal/contracts#update-contract-information) Update contract information Select a contract, update the fields, and resubmit if needed. If you deploy a new version of your contract, submit the new address for review. Auto-Confirm does not carry over automatically. ### [​](https://docs.phantom.com/phantom-portal/contracts#remove-a-contract) Remove a contract Removing a contract disables Auto-Confirm for that contract. Users will see approval dialogs again for interactions involving that address. Other approved contracts remain unaffected. [​](https://docs.phantom.com/phantom-portal/contracts#faq) FAQ ----------------------------------------------------------------- Why was my contract rejected? Common reasons include unaudited contracts, incomplete documentation, unverified domains, unclear upgrade paths, risky admin keys, or proxy patterns that need stronger safeguards. Can I appeal a rejection? Yes. Review the feedback, address the issues, and resubmit. If you need clarification, contact [Phantom developer support](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) . How many contracts can I submit? There’s no limit. Focus on the contracts that benefit most from Auto-Confirm. Each contract is reviewed individually. Do I need separate submissions for each network? Yes. Submit each network deployment separately. You can reuse the same description. What happens if I upgrade my contract? Auto-Confirm does not apply to new deployments automatically. Submit the new address for review and include any migration information. Can I test Auto-Confirm before launch? Auto-Confirm is available only for production mainnet contracts. Test your contracts thoroughly before submitting. [​](https://docs.phantom.com/phantom-portal/contracts#support) Support ------------------------------------------------------------------------- Need help with your Auto-Confirm submission? Contact [Phantom developer support](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) . [​](https://docs.phantom.com/phantom-portal/contracts#next-steps) Next steps ------------------------------------------------------------------------------- [Verify your domain\ ------------------\ \ Complete domain verification to use Auto-Confirm](https://docs.phantom.com/phantom-portal/edit-app-info#domain-verification) [Phantom Portal overview\ -----------------------\ \ Learn more about Phantom Portal features](https://docs.phantom.com/phantom-portal/portal) [Domain security\ ---------------\ \ Understand domain and transaction warnings](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings) [Launch checklist\ ----------------\ \ Prepare for app launch](https://docs.phantom.com/best-practices/launching-a-dapp) Was this page helpful? YesNo [Get your App ID and integrate](https://docs.phantom.com/phantom-portal/get-app-id) ⌘I --- # Disconnect - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Provider methods Disconnect [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Base URL](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#base-url) * [Query string parameters](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#query-string-parameters) * [Returns](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#returns) * [Approve](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#approve) * [Reject](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#reject) * [Example](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#example) After an initial [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) event has taken place, an app may disconnect from Phantom at anytime. Once disconnected, Phantom will reject all signature requests until another connection is established. [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#base-url) Base URL ------------------------------------------------------------------------------------------------ Report incorrect code Copy Ask AI https://phantom.app/ul/v1/disconnect [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#query-string-parameters) Query string parameters ------------------------------------------------------------------------------------------------------------------------------ * `dapp_encryption_public_key` (required): The original encryption public key used from the app side for an existing [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) session. * `nonce` (required): A nonce used for encrypting the request, encoded in base58. * `redirect_link` (required): The URI where Phantom should redirect the user upon completion. For more details, see [Specify redirects](https://docs.phantom.com/phantom-deeplinks/specifying-redirects) . URL-encoded. * `payload` (required): An encrypted JSON string with the following fields: Report incorrect code Copy Ask AI { "session": "...", // token received from the connect method } * `session` (required): The session token received from the [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) method. For more details, see [Handle sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions) . [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#returns) Returns ---------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#approve) Approve No query params returned. ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#reject) Reject An `errorCode` and `errorMessage` as query parameters. For a full list of possible error codes, see [Errors](https://docs.phantom.com/solana/errors) . Report incorrect code Copy Ask AI { "errorCode": "...", "errorMessage": "..." } [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect#example) Example ---------------------------------------------------------------------------------------------- Refer to the [disconnect](https://github.com/phantom-labs/deep-link-demo-app/blob/20f19f2154e98699f0d5a6b28bc4bb3d5acbcefd/App.tsx#L187) method implemented in our React Native demo application. Was this page helpful? YesNo [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) [SignAndSendTransaction (deprecated)](https://docs.phantom.com/phantom-deeplinks/provider-methods/signandsendtransaction) ⌘I --- # Solana Versioned Transactions - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/solana-versioned-transactions#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana features Solana Versioned Transactions [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Address LUTs](https://docs.phantom.com/developer-powertools/solana-versioned-transactions#address-luts) * [RPC changes](https://docs.phantom.com/developer-powertools/solana-versioned-transactions#rpc-changes) * [Further reading](https://docs.phantom.com/developer-powertools/solana-versioned-transactions#further-reading) Phantom supports [Versioned Transactions](https://docs.solana.com/developing/versioned-transactions) and [Legacy Transactions](https://docs.phantom.com/solana/sending-a-transaction) . Versioned Transactions and Address Lookup Tables (LUTs) were introduced by Solana in an effort to improve the developer and end-user experience. The proposed changes are as follows: * Introduce a program which manages on-chain address lookup tables * Add a new transaction format which can make use of the above on-chain address lookup tables Why do we need the above? Legacy transactions have a major issue: Maximum allowed size of 1232 bytes, and hence the number of accounts that can fit in an atomic transaction: 35 addresses. ![Legacy Transaction Avi](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/developer-powertools/images/legacy-transaction.avif?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=79d49a6e4eb65b67148d8ff8b174de0d) This is problematic as developers are limited with this threshold and are unable to include >35 signature-free account / program addresses in a single transaction. This is where Address LUTs come into the picture. [​](https://docs.phantom.com/developer-powertools/solana-versioned-transactions#address-luts) Address LUTs ------------------------------------------------------------------------------------------------------------- The idea behind Address LUTs is to store account addresses in array-like data structures on-chain. Once accounts are stored in this table, the address of the table can be referenced in a transaction message using 1-byte u8 indices. ![Address Lookup Tables Avi](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/developer-powertools/images/address-lookup-tables.avif?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=420ee1a4b38d02cf25ce6bea20a814f1) This opens up space as addresses need not be stored inside transaction messages, but only be referenced. This allows 2^8=256 accounts to be included in 1 tx, as accounts are referenced using u8 indices. [​](https://docs.phantom.com/developer-powertools/solana-versioned-transactions#rpc-changes) RPC changes ----------------------------------------------------------------------------------------------------------- Transaction responses will require a new version field: `maxSupportedTransactionVersion` to indicate to clients which transaction structure needs to be followed for deserialisation. The following methods need to be updated to avoid errors: * `getTransaction` * `getBlock` The following parameter needs to be added to the requests: `maxSupportedTransactionVersion: 0` If `maxSupportedTransactionVersion` is not explicitly added to the request, the transaction version will fallback to `legacy`. Any block that contains a versioned transaction will return with an error by the client in the case of a legacy transaction. You can set this via JSON formatted requests to the RPC endpoint like below: Report incorrect code Copy Ask AI curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d \ '{"jsonrpc": "2.0", "id":1, "method": "getBlock", "params": [430, {\ "encoding":"json",\ "maxSupportedTransactionVersion":0,\ "transactionDetails":"full",\ "rewards":false\ }]}' You can also do the same using the [@solana/web3.js](https://github.com/solana-foundation/solana-web3.js) library. Report incorrect code Copy Ask AI // connect to the `devnet` cluster and get the current `slot` const connection = new web3.Connection(web3.clusterApiUrl("devnet")); const slot = await connection.getSlot(); // get the latest block (allowing for v0 transactions) const block = await connection.getBlock(slot, { maxSupportedTransactionVersion: 0, }); // get a specific transaction (allowing for v0 transactions) const getTx = await connection.getTransaction( "3jpoANiFeVGisWRY5UP648xRXs3iQasCHABPWRWnoEjeA93nc79WrnGgpgazjq4K9m8g2NJoyKoWBV1Kx5VmtwHQ", { maxSupportedTransactionVersion: 0, }, ); For details on how to build and send Versioned Transactions and LUTs, see [Send a versioned transaction](https://docs.phantom.com/solana/sending-a-transaction-1) . [​](https://docs.phantom.com/developer-powertools/solana-versioned-transactions#further-reading) Further reading ------------------------------------------------------------------------------------------------------------------- * [How to create a versioned transaction - Solana Docs](https://beta.docs.solana.com/developing/versioned-transactions#how-create-a-versioned-transaction) * [How to create an address lookup table - Solana Docs](https://beta.docs.solana.com/developing/lookup-tables#how-to-create-an-address-lookup-table) * [Versioned Transactions - Anvit Hashnode](https://anvit.hashnode.dev/versioned-transactions) Was this page helpful? YesNo [Solana priority fees](https://docs.phantom.com/developer-powertools/solana-priority-fees) [Solana Token Extensions (Token22)](https://docs.phantom.com/developer-powertools/solana-token-extensions-token22) ⌘I --- # SignTransaction - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Provider methods SignTransaction [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Base URL](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#base-url) * [Query string parameters](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#query-string-parameters) * [Returns](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#returns) * [Approve](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#approve) * [Reject](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#reject) * [Example](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#example) Request Phantom to sign the prepared transaction and return the signature. After receiving the signature, your app can broadcast the transaction itself with [sendRawTransaction](https://solana-foundation.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction) in web3.js, giving you full control over timing, batching, or custom error handling. [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#base-url) Base URL ----------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI https://phantom.app/ul/v1/signTransaction [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#query-string-parameters) Query string parameters ----------------------------------------------------------------------------------------------------------------------------------- * `dapp_encryption_public_key` (required): The original encryption public key used from the app side for an existing [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) session. * `nonce` (required): A nonce used for encrypting the request, encoded in base58. * `redirect_link` (required): The URI where Phantom should redirect the user upon completion. For more details, see [Specify redirects](https://docs.phantom.com/phantom-deeplinks/specifying-redirects) . URL-encoded. * `payload` (required): An encrypted JSON string with the following fields: Report incorrect code Copy Ask AI { "transaction": "...", // serialized transaction, base58 encoded "session": "...", // token received from connect-method } * `transaction` (required): The [transaction](https://solana-foundation.github.io/solana-web3.js/classes/Transaction.html) that Phantom will sign, serialized and encoded in base58. * `session` (required): The session token received from the [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) method. For more details, see [Handle sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions) . [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#returns) Returns --------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#approve) Approve * `nonce`: A nonce used for encrypting the response, encoded in base58. * `data`: An encrypted JSON string. Refer to [Encryption](https://docs.phantom.com/phantom-deeplinks/encryption) to learn how apps can decrypt `data` using a shared secret. Encrypted bytes are encoded in base58. Report incorrect code Copy Ask AI // content of decrypted `data`-parameter { transaction: "...", // signed serialized transaction, base58 encoded } * `transaction`: The signed, serialized transaction that is base58 encoded. Phantom will not submit this transactions. An application can submit this transactions itself using `sendRawTransaction` in [web3.js](https://solana-foundation.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction) . ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#reject) Reject An `errorCode` and `errorMessage` as query parameters. For a full list of possible error codes, see [Errors](https://docs.phantom.com/solana/errors) . Report incorrect code Copy Ask AI { "errorCode": "...", "errorMessage": "..." } [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction#example) Example --------------------------------------------------------------------------------------------------- Refer to the [signTransaction](https://github.com/phantom-labs/deep-link-demo-app/blob/20f19f2154e98699f0d5a6b28bc4bb3d5acbcefd/App.tsx#L262) method implemented in our React Native demo application. Was this page helpful? YesNo [SignAllTransactions](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions) [SignMessage](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage) ⌘I --- # Establish a connection - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sui/establishing-a-connection#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Sui Establish a connection [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Connect](https://docs.phantom.com/sui/establishing-a-connection#connect) Once an application has detected the provider, it can then request to connect to Phantom. This connection request will prompt the user for permission to share their public key, indicating that they are willing to interact further. Users must approve a connection request before the app can make additional requests such as [signing a message](https://docs.phantom.com/sui/signing-a-message) or [sending a transaction](https://docs.phantom.com/sui/sending-a-transaction) . Once permission is established for the first time, the web application’s domain will be whitelisted for future connection requests. After a connection is established, it is possible for the user to terminate the connection from the Phantom settings UI. [​](https://docs.phantom.com/sui/establishing-a-connection#connect) Connect ------------------------------------------------------------------------------ The recommended and easiest way to connect to Phantom is by calling `window.phantom.sui.requestAccount()`. Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" try { const resp = await provider.requestAccount(); console.log(resp.publicKey.toString()); } catch (err) { // { code: 4001, message: 'User rejected the request.' } } Was this page helpful? YesNo [Detect the provider](https://docs.phantom.com/sui/detecting-the-provider) [Send a transaction](https://docs.phantom.com/sui/sending-a-transaction) ⌘I --- # Connect - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Provider methods Connect [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Base URL](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#base-url) * [Query string parameters](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#query-string-parameters) * [Returns](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#returns) * [Approve](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#approve) * [Reject](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#reject) * [Example](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#example) In order to start interacting with Phantom, an app must first establish a connection. This connection request will prompt the user for permission to share their public key, indicating that they are willing to interact further. Once a user connects to Phantom, Phantom will return a `session` param that should be used on all subsequent methods. For more information on sessions, see [Handle sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions) . [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#base-url) Base URL --------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI https://phantom.app/ul/v1/connect [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#query-string-parameters) Query string parameters --------------------------------------------------------------------------------------------------------------------------- * `app_url` (required): A URL that is stored in the session token for validation purposes. This URL is used during session validation and can be checked against the blocklist. URL-encoded. * `dapp_encryption_public_key` (required): A public key used for end-to-end encryption. This will be used to generate a shared secret. For more information on how Phantom handles shared secrets, see [Encryption](https://docs.phantom.com/phantom-deeplinks/encryption) . * `redirect_link` (required): The URI where Phantom should redirect the user upon connection. This URL is also used to fetch app metadata (such as title, icon, and favicon) for display in the connection approval dialog, using the same properties found in [Display your app](https://docs.phantom.com/best-practices/displaying-your-app) . The origin from this URL is also used for trusted app management. For more details, see [Specify redirects](https://docs.phantom.com/phantom-deeplinks/specifying-redirects) . URL-encoded. * `cluster` (optional): The network that should be used for subsequent interactions. Can be either: `mainnet-beta`, `testnet`, or `devnet`. Defaults to `mainnet-beta`. **Important distinction between `redirect_link` and `app_url`**: * `redirect_link` is used to fetch app metadata (title, icon, favicon) for display in the connection approval dialog and for trusted app management. This is what users see when approving the connection. * `app_url` is stored in the session token for validation purposes and is not used for fetching metadata or display purposes. **Redirect link behavior**: * **HTTPS URLs**: App metadata (logo, title, favicon) displays correctly in the connection dialog, but the redirect opens in the mobile browser instead of redirecting back to your app. * **Custom scheme URIs**: Properly redirects back to your mobile app, but app metadata is not displayed in the connection dialog. For more details on choosing a redirect link type, see [Specify redirects](https://docs.phantom.com/phantom-deeplinks/specifying-redirects) . [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#returns) Returns ------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#approve) Approve * `phantom_encryption_public_key`: An encryption public key used by Phantom for the construction of a shared secret between the connecting app and Phantom, encoded in base58. * `nonce`: A nonce used for encrypting the response, encoded in base58. * `data`: An encrypted JSON string. Refer to [Encryption](https://docs.phantom.com/phantom-deeplinks/encryption) to learn how apps can decrypt `data` using a shared secret. Encrypted bytes are encoded in base58. Report incorrect code Copy Ask AI // content of decrypted `data`-parameter { // base58 encoding of user public key "public_key": "BSFtCudCd4pR4LSFqWPjbtXPKSNVbGkc35gRNdnqjMCU", // session token for subsequent signatures and messages // dapps should send this with any other deeplinks after connect "session": "..." } * `public_key`: The public key of the user, represented as a base58-encoded string. * `session`: A string encoded in base58. This should be treated as opaque by the connecting app, as it only needs to be passed alongside other parameters. Sessions do not expire. For more details, see [Handle sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions) . ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#reject) Reject An `errorCode` and `errorMessage` as query parameters. For a full list of possible error codes, see [Errors](https://docs.phantom.com/solana/errors) . Report incorrect code Copy Ask AI { "errorCode": "...", "errorMessage": "..." } [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect#example) Example ------------------------------------------------------------------------------------------- Refer to the [connect](https://github.com/phantom-labs/deep-link-demo-app/blob/20f19f2154e98699f0d5a6b28bc4bb3d5acbcefd/App.tsx#L175) method implemented in our React Native demo application. Was this page helpful? YesNo [Provider methods](https://docs.phantom.com/phantom-deeplinks/provider-methods/README) [Disconnect](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect) ⌘I --- # SignAllTransactions - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Provider methods SignAllTransactions [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Base URL](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#base-url) * [Query string parameters](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#query-string-parameters) * [Returns](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#returns) * [Approve](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#approve) * [Reject](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#reject) * [Example](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#example) Once an app is connected, it is also possible to sign multiple transactions at once. Phantom will not submit these transactions to the network. Applications can submit signed transactions using [sendRawTransaction](https://solana-foundation.github.io/solana-web3.js/classes/Connection.html#sendrawtransaction) in web3.js. [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#base-url) Base URL --------------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI https://phantom.app/ul/v1/signAllTransactions [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#query-string-parameters) Query string parameters --------------------------------------------------------------------------------------------------------------------------------------- * `dapp_encryption_public_key` (required): The original encryption public key used from the app side for an existing [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) session. * `nonce` (required): A nonce used for encrypting the request, encoded in base58. * `redirect_link` (required): The URI where Phantom should redirect the user upon completion. For more details, see [Specify redirects](https://docs.phantom.com/phantom-deeplinks/specifying-redirects) . URL-encoded. * `payload` (required): An encrypted JSON string with the following fields: Report incorrect code Copy Ask AI { "transactions": [\ "...", // serialized transaction, bs58-encoded\ "...", // serialized transaction, bs58-encoded\ ], "session": "...", // token received from connect-method } * `transactions` (required): An array of [transactions](https://solana-foundation.github.io/solana-web3.js/classes/Transaction.html) that Phantom will sign, serialized and encoded in base58. * `session` (required): The session token received from the [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) method. For more details, see [Handle sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions) . [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#returns) Returns ------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#approve) Approve * `nonce`: A nonce used for encrypting the response, encoded in base58. * `data`: An encrypted JSON string. Refer to [Encryption](https://docs.phantom.com/phantom-deeplinks/encryption) to learn how apps can decrypt `data` using a shared secret. Encrypted bytes are encoded in base58. Report incorrect code Copy Ask AI // content of decrypted `data`-parameter { transactions: [\ "...", // signed serialized transaction, bs58-encoded\ "...", // signed serialized transaction, bs58-encoded\ ] } * `transactions`: An array of signed, serialized transactions that are base58 encoded. Phantom will not submit these transactions. Applications can submit these transactions themselves using [sendRawTransaction](https://solana-foundation.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction) in web3.js. ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#reject) Reject An `errorCode` and `errorMessage` as query parameters. For a full list of possible error codes, see [Errors](https://docs.phantom.com/solana/errors) . Report incorrect code Copy Ask AI { "errorCode": "...", "errorMessage": "..." } [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signalltransactions#example) Example ------------------------------------------------------------------------------------------------------- Refer to the [signAllTransactions](https://github.com/phantom-labs/deep-link-demo-app/blob/20f19f2154e98699f0d5a6b28bc4bb3d5acbcefd/App.tsx#L229) method implemented in our React Native demo application. Was this page helpful? YesNo [SignAndSendTransaction (deprecated)](https://docs.phantom.com/phantom-deeplinks/provider-methods/signandsendtransaction) [SignTransaction](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction) ⌘I --- # Get started with Sui - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sui/getting-started-with-sui#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Sui Get started with Sui [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) The Phantom browser extension and mobile in-app browser now have full support for Sui dapps. Was this page helpful? YesNo [Provider API reference](https://docs.phantom.com/bitcoin/provider-api-reference) [Detect the provider](https://docs.phantom.com/sui/detecting-the-provider) ⌘I --- # Get your App ID and integrate - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-portal/get-app-id#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Account setup Get your App ID and integrate [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Find your App ID](https://docs.phantom.com/phantom-portal/get-app-id#find-your-app-id) * [Choose your SDK](https://docs.phantom.com/phantom-portal/get-app-id#choose-your-sdk) * [Install the SDK](https://docs.phantom.com/phantom-portal/get-app-id#install-the-sdk) * [Start building with Phantom](https://docs.phantom.com/phantom-portal/get-app-id#start-building-with-phantom) * [Example usage](https://docs.phantom.com/phantom-portal/get-app-id#example-usage) * [Other examples](https://docs.phantom.com/phantom-portal/get-app-id#other-examples) * [Resources](https://docs.phantom.com/phantom-portal/get-app-id#resources) * [Need help?](https://docs.phantom.com/phantom-portal/get-app-id#need-help) Your app is now published in Phantom. Get your App ID and begin integrating with your preferred SDK. Your App ID is a unique identifier that’s automatically generated for your app. The App ID is used when integrating with Phantom’s client-side SDKs. It’s safe to include in client-side code. [​](https://docs.phantom.com/phantom-portal/get-app-id#find-your-app-id) Find your App ID -------------------------------------------------------------------------------------------- In Phantom Portal, expand your app in the left navigation, then select **Set Up**. Your App ID appears at the top of the **Set Up** page. Select the copy button to add it to your clipboard. [​](https://docs.phantom.com/phantom-portal/get-app-id#choose-your-sdk) Choose your SDK ------------------------------------------------------------------------------------------ The **Set Up** page provides tailored installation instructions and code examples for each SDK. Select the tab that matches your application platform: * **React**: For React web applications * **React Native**: For iOS and Android mobile apps * **Browser**: For vanilla JavaScript browser applications [​](https://docs.phantom.com/phantom-portal/get-app-id#install-the-sdk) Install the SDK ------------------------------------------------------------------------------------------ Copy the installation command for your preferred package manager: Report incorrect code Copy Ask AI # Using npm npm install @phantom/react-sdk # Using yarn yarn add @phantom/react-sdk # Using pnpm pnpm add @phantom/react-sdk [​](https://docs.phantom.com/phantom-portal/get-app-id#start-building-with-phantom) Start building with Phantom ------------------------------------------------------------------------------------------------------------------ After completing Phantom Portal setup, select the Phantom Connect SDK that fits your app environment. [React SDK\ ---------\ \ React apps with user authentication](https://docs.phantom.com/sdks/react-sdk) [Browser SDK\ -----------\ \ JavaScript browser apps](https://docs.phantom.com/sdks/browser-sdk) [React Native SDK\ ----------------\ \ iOS and Android apps](https://docs.phantom.com/sdks/react-native-sdk) ### [​](https://docs.phantom.com/phantom-portal/get-app-id#example-usage) Example usage Use your App ID when initializing the SDK: Report incorrect code Copy Ask AI import { PhantomProvider } from '@phantom/sdk'; const phantom = new PhantomProvider({ appId: 'your-app-id-here', // Paste your App ID // ... other configuration }); ### [​](https://docs.phantom.com/phantom-portal/get-app-id#other-examples) Other examples Explore our official example apps to kickstart your integration. [React SDK demo\ --------------\ \ Full-featured React example](https://github.com/phantom/wallet-sdk/tree/main/examples/react-sdk-demo-app) [Browser SDK demo\ ----------------\ \ JavaScript browser example](https://github.com/phantom/wallet-sdk/tree/main/examples/browser-sdk-demo-app) [React Native demo\ -----------------\ \ Mobile example with Expo](https://github.com/phantom/wallet-sdk/tree/main/examples/react-native-sdk-demo-app) [Next.js example\ ---------------\ \ Next.js integration](https://github.com/phantom/wallet-sdk/tree/main/examples/with-nextjs) [Wagmi example\ -------------\ \ Wagmi integration](https://github.com/phantom/wallet-sdk/tree/main/examples/with-wagmi) [All examples\ ------------\ \ View all on GitHub](https://github.com/phantom/wallet-sdk/tree/main/examples) [​](https://docs.phantom.com/phantom-portal/get-app-id#resources) Resources ------------------------------------------------------------------------------ [SDK overview\ ------------\ \ Compare Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Phantom Connect\ ---------------\ \ Learn how users authenticate](https://docs.phantom.com/phantom-connect) [​](https://docs.phantom.com/phantom-portal/get-app-id#need-help) Need help? ------------------------------------------------------------------------------- Contact [Phantom developer support](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) . Was this page helpful? YesNo [Add your app information](https://docs.phantom.com/phantom-portal/edit-app-info) [Contracts and Auto-Confirm](https://docs.phantom.com/phantom-portal/contracts) ⌘I --- # Send a transaction - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sui/sending-a-transaction#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Sui Send a transaction [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Once a dapp is connected to Phantom, it can request user permission to send transactions on their behalf. To initiate a transaction, ensure you have the necessary parameters. For details on constructing transactions, refer to [Sui developer documentation](https://sdk.mystenlabs.com/typescript/transaction-building/basics) . Report incorrect code Copy Ask AI const transactionParams = { transaction: await tx.toJSON(), // Replace with actual transaction address: address.toString(), // Sender address networkID: SupportedSuiChainIds.SuiMainnet, // or your network ID }; To prompt Phantom to send a transaction to the network, refer to the following code snippet: Report incorrect code Copy Ask AI try { const signature = await provider.signTransaction(params); return signature; } catch (error) { throw new Error(error instanceof Error ? error.message : 'Failed to sign transaction'); } Was this page helpful? YesNo [Establish a connection](https://docs.phantom.com/sui/establishing-a-connection) [Sign a message](https://docs.phantom.com/sui/signing-a-message) ⌘I --- # Updates - Phantom developer documentation [Skip to main content](https://docs.phantom.com/updates#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Overview Updates [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Changelog](https://docs.phantom.com/updates#changelog) * [Phantom Connect v1.0.2 - January 15, 2026](https://docs.phantom.com/updates#phantom-connect-v1-0-2-january-15-2026) * [Bug Fixes](https://docs.phantom.com/updates#bug-fixes) * [December 2025](https://docs.phantom.com/updates#december-2025) * [MCP server](https://docs.phantom.com/updates#mcp-server) * [Spending limits](https://docs.phantom.com/updates#spending-limits) * [Phantom Connect SDKs](https://docs.phantom.com/updates#phantom-connect-sdks) Stay up to date with the latest SDK releases, new features, and important announcements for Phantom developers. [​](https://docs.phantom.com/updates#changelog) Changelog ------------------------------------------------------------ [​](https://docs.phantom.com/updates#phantom-connect-v1-0-2-january-15-2026) Phantom Connect v1.0.2 - January 15, 2026 ------------------------------------------------------------------------------------------------------------------------- **Affected SDKs:** React SDK, Browser SDK, React Native SDK #### [​](https://docs.phantom.com/updates#bug-fixes) Bug Fixes **Detect account changes when using injected provider** Fixed an issue where the SDK wouldn’t detect when users switch accounts in their injected wallet provider (for example, Phantom extension). The SDK now automatically detects account changes and updates the connection state accordingly. **Improved wallet detection for mobile wallets** Fixed an issue where mobile wallets weren’t properly detected and displayed in the wallet discovery list. The SDK now correctly detects and displays all available mobile wallets. **Prevent connection to unsupported networks** Fixed an issue where the SDK would attempt to connect to networks that aren’t supported by certain wallet providers, which could cause connection errors. The SDK now correctly validates network support before attempting connections. [​](https://docs.phantom.com/updates#december-2025) December 2025 -------------------------------------------------------------------- ### [​](https://docs.phantom.com/updates#mcp-server) MCP server Your AI coding assistant can now search Phantom documentation directly. The MCP server gives Cursor, VS Code, Claude, and Claude Code real-time access to our docs for accurate answers while you code. Use the contextual menu on any docs page to auto-install, or check out the [MCP server setup guide](https://docs.phantom.com/resources/mcp-server) . ### [​](https://docs.phantom.com/updates#spending-limits) Spending limits Users can now set spending limits when connecting to apps via Phantom Connect. This security feature allows users to control how much an app can spend on their behalf, with on-chain enforcement. Learn more in the [spending limits documentation](https://docs.phantom.com/spending-limits) . ### [​](https://docs.phantom.com/updates#phantom-connect-sdks) Phantom Connect SDKs The Phantom Connect SDKs provide a streamlined way to integrate Phantom wallet functionality into your applications. Check out the SDK documentation: * [React SDK](https://docs.phantom.com/sdks/react-sdk/index) - For React web applications * [React Native SDK](https://docs.phantom.com/sdks/react-native-sdk/index) - For mobile applications * [Browser SDK](https://docs.phantom.com/sdks/browser-sdk/index) - For vanilla JavaScript applications Was this page helpful? YesNo [Phantom Connect](https://docs.phantom.com/phantom-connect) ⌘I --- # Properties - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/README#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Properties Properties [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) Here you will find a list of all of the properties available to you once the `window.phantom.ethereum` object has been injected. These are all exactly the same as the `window.ethereum` object. However, we recommend using the `window.phantom.ethereum` object to prevent namespace collisions. Report incorrect code Copy Ask AI { chainId: HexString networkVersion: String selectedAddress: HexString _events: Object _eventsCount: Number } Was this page helpful? YesNo [Provider API reference](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/README) [isPhantom](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/isphantom) ⌘I --- # Get started with Solana - Phantom developer documentation [Skip to main content](https://docs.phantom.com/solana/integrating-phantom#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana Get started with Solana [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Direct integration](https://docs.phantom.com/solana/integrating-phantom#direct-integration) * [Solana Wallet Adapter](https://docs.phantom.com/solana/integrating-phantom#solana-wallet-adapter) The Phantom browser extension and mobile in-app browser are both designed to interact with web applications. For mobile apps, we recommend integrating via [universal links or deeplinks](https://docs.phantom.com/phantom-deeplinks/deeplinks-ios-and-android) . There are two main ways to integrate Phantom into your web application: [​](https://docs.phantom.com/solana/integrating-phantom#direct-integration) Direct integration ------------------------------------------------------------------------------------------------- The most direct way to interact with Phantom is via the provider that Phantom injects into your web application. This provider is globally available at `window.phantom` and its methods will always include Phantom’s most up-to-date functionality. This documentation is dedicated to covering all aspects of the provider. [​](https://docs.phantom.com/solana/integrating-phantom#solana-wallet-adapter) Solana Wallet Adapter ------------------------------------------------------------------------------------------------------- Another quick and easy way to get up and running with Phantom is via the [Solana Wallet Adapter](https://github.com/anza-xyz/wallet-adapter) package. The wallet adapter is a set of modular TypeScript components that allow developers to easily integrate multiple Solana wallets into their applications. This package includes starter files, setup and usage instructions, and a live demo showcasing multiple UI frameworks. Was this page helpful? YesNo [Detect the provider](https://docs.phantom.com/solana/detecting-the-provider) ⌘I --- # Detect the provider - Phantom developer documentation [Skip to main content](https://docs.phantom.com/solana/detecting-the-provider#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana Detect the provider [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) To detect if a user has already installed Phantom, a web application should check for the existence of a `phantom` object. Phantom’s browser extension and mobile in-app browser will both inject a `phantom` object into the [window](https://developer.mozilla.org/en-US/docs/Web/API/Window) of any web application the user visits, provided that site is using `https://`, on `localhost`, or is `127.0.0.1.` Phantom will not inject the provider into [iframes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) or sites that use `http://`. If a `phantom` object exists, Solana apps can interact with Phantom via the API found at `window.phantom.solana`. This `solana` object is also available at `window.solana` to support legacy integrations. To detect if Phantom is installed, an application should check for an additional `isPhantom` flag. Report incorrect code Copy Ask AI const isPhantomInstalled = window.phantom?.solana?.isPhantom If Phantom is not installed, we recommend you redirect your users to `https://phantom.com/`. Altogether, this may look like the following: Report incorrect code Copy Ask AI const getProvider = () => { if ('phantom' in window) { const provider = window.phantom?.solana; if (provider?.isPhantom) { return provider; } } window.open('https://phantom.app/', '_blank'); }; For an example of how a React application can detect Phantom, refer to [getProvider](https://github.com/phantom-labs/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L43) in our sandbox. Was this page helpful? YesNo [Get started with Solana](https://docs.phantom.com/solana/integrating-phantom) [Establish a connection](https://docs.phantom.com/solana/establishing-a-connection) ⌘I --- # Detect the provider - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sui/detecting-the-provider#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Sui Detect the provider [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) To detect if a user has already installed Phantom, a web application should check for the existence of a `phantom` object. Phantom’s browser extension and mobile in-app browser will both inject a `phantom` object into the [window](https://developer.mozilla.org/en-US/docs/Web/API/Window) of any web application the user visits, provided that site is using `https://`, on `localhost`, or is `127.0.0.1`. Phantom will not inject the provider into sites using http://. If a `phantom` object exists, Sui apps can interact with Phantom via the API found at `window.phantom.sui`. To detect if Phantom is installed, an application should check for an additional `isPhantom` flag. Report incorrect code Copy Ask AI const isPhantomInstalled = window.phantom?.sui?.isPhantom If Phantom is not installed, we recommend you redirect your users to our website `https://www.phantom.com/`. Altogether this may look like the following: Report incorrect code Copy Ask AI const getProvider = () => { if ('phantom' in window) { const provider = window.phantom?.sui; if (provider?.isPhantom) { return provider; } } window.open('https://phantom.com/', '_blank'); }; Was this page helpful? YesNo [Get started with Sui](https://docs.phantom.com/sui/getting-started-with-sui) [Establish a connection](https://docs.phantom.com/sui/establishing-a-connection) ⌘I --- # isPhantom - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/isphantom#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Properties isPhantom [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [window.phantom.ethereum.isPhantom](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/isphantom#window-phantom-ethereum-isphantom) [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/isphantom#window-phantom-ethereum-isphantom) window.phantom.ethereum.isPhantom ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- A boolean that identifies if Phantom is installed. Report incorrect code Copy Ask AI const isPhantomInstalled = window.phantom?.ethereum?.isPhantom; console.log(isPhantomInstalled); // true Was this page helpful? YesNo [Properties](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/README) [chainId](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/chainid) ⌘I --- # chainId - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/chainid#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Properties chainId [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [window.phantom.ethereum.chainId](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/chainid#window-phantom-ethereum-chainid) [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/chainid#window-phantom-ethereum-chainid) window.phantom.ethereum.chainId ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The `chainId` of the network you are currently connected to, returned as a hexadecimal string. Report incorrect code Copy Ask AI const chainId = window.phantom.ethereum.chainId; console.log(chainId); // "0x1" // hexidecimal representation of Ethereum Mainnet Was this page helpful? YesNo [isPhantom](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/isphantom) [networkVersion](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/networkversion) ⌘I --- # Sign-In-With (SIW) standards - Phantom developer documentation [Skip to main content](https://docs.phantom.com/developer-powertools/signing-a-message#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Security and validation Sign-In-With (SIW) standards [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Sign-In with Solana](https://docs.phantom.com/developer-powertools/signing-a-message#sign-in-with-solana) * [Sign-In with Ethereum](https://docs.phantom.com/developer-powertools/signing-a-message#sign-in-with-ethereum) * [Examples](https://docs.phantom.com/developer-powertools/signing-a-message#examples) * [Sign-In with X](https://docs.phantom.com/developer-powertools/signing-a-message#sign-in-with-x) * [Ethereum example](https://docs.phantom.com/developer-powertools/signing-a-message#ethereum-example) * [Solana example](https://docs.phantom.com/developer-powertools/signing-a-message#solana-example) Applications that rely on `signMessage` for authenticating users can choose to opt-in to one of the various Sign-In with (SIW) standards. If a message follows one of the supported standards, Phantom will verify required fields at the time of signing. At the time of this writing, Phantom supports: * **Sign-In with Solana** ([specification](https://github.com/phantom/sign-in-with-solana) ) * **Sign-In with Ethereum** ([EIP-4361](https://eips.ethereum.org/EIPS/eip-4361) ) * **Sign-In with X** ([CAIP-122](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-122.md) ) The serialized format of SIW messages is as follows: Report incorrect code Copy Ask AI ${domain} wants you to sign in with your ${blockchain} account: ${address} ${statement} URI: ${uri} Version: ${version} Chain ID: ${chain-id} Nonce: ${nonce} Issued At: ${issued-at} Expiration Time: ${expiration-time} Not Before: ${not-before} Request ID: ${request-id} Resources: - ${resources[0]} - ${resources[1]} ... - ${resources[n]} | Name | Type | Required? | Description | | --- | --- | --- | --- | | `domain` | `string` | true | The authority that is requesting the signing. | | `address` | `string` | true | The blockchain address that is performing the signing. | | `statement` | `string` | false | A human-readable ASCII assertion that the user will sign. It MUST NOT contain `\\n`. | | `uri` | `string` | true | A URI referring to the resource that is the subject of the signing—that is, the subject of the claim. | | `version` | `string` | true | The current version of the message. | | `chain-id` | `string` | true | The Chain ID to which the session is bound, and the network where Contract Accounts MUST be resolved. | | `nonce` | `string` | true | A randomized token to prevent signature replay attacks. | | `issued-at` | `string` | true | The issuance time. | | `expiration-time` | `string` | false | The time at which the signed authentication message is no longer valid. | | `not-before` | `string` | false | The time at which the signed authentication message starts being valid. | | `request-id` | `string` | false | A system-specific identifier used to uniquely refer to the authentication request. | | `resources` | `string[]` | false | A list of URIs the user wishes to have resolved as part of the authentication by the relying party. | ### [​](https://docs.phantom.com/developer-powertools/signing-a-message#sign-in-with-solana) Sign-In with Solana See our [specification and integration guide](https://github.com/phantom/sign-in-with-solana) on GitHub. ### [​](https://docs.phantom.com/developer-powertools/signing-a-message#sign-in-with-ethereum) Sign-In with Ethereum The Sign-In with Ethereum standard is defined by [EIP-4361](https://eips.ethereum.org/EIPS/eip-4361) . #### [​](https://docs.phantom.com/developer-powertools/signing-a-message#examples) Examples signMessage() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const message = `magiceden.io wants you to sign in with your Ethereum account: 0xb9c5714089478a327f09197987f16f9e5d936e8a Click Sign or Approve only means you have proved this wallet is owned by you. URI: https://magiceden.io Version: 1 Chain ID: 1 Nonce: bZQJ0SL6gJ Issued At: 2022-10-25T16:52:02.748Z Resources: - https://foo.com - https://bar.com`; const encodedMessage = new TextEncoder().encode(message); const signedMessage = await provider.signMessage(encodedMessage, "utf8"); request() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const message = `magiceden.io wants you to sign in with your Ethereum account: 0xb9c5714089478a327f09197987f16f9e5d936e8a Click Sign or Approve only means you have proved this wallet is owned by you. URI: https://magiceden.io Version: 1 Chain ID: 1 Nonce: bZQJ0SL6gJ Issued At: 2022-10-25T16:52:02.748Z Resources: - https://foo.com - https://bar.com`; const encodedMessage = new TextEncoder().encode(message); const signedMessage = await provider.request({ method: "signMessage", params: { message: encodedMessage, display: "utf8", } }); ### [​](https://docs.phantom.com/developer-powertools/signing-a-message#sign-in-with-x) Sign-In with X The Sign-In with X standard is defined by [CAIP-122](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-122.md) . It uses [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10) identifiers for the `address` field and [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2) for `chain-id`. While CAIP-122 is technically chain-agnostic, only Ethereum and Solana parsing are supported at this time. #### [​](https://docs.phantom.com/developer-powertools/signing-a-message#ethereum-example) Ethereum example signMessage() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const message = `magiceden.io wants you to sign in with your Ethereum account: eip155:1:0xb9c5714089478a327f09197987f16f9e5d936e8a Click Sign or Approve only means you have proved this wallet is owned by you. URI: https://magiceden.io Version: 1 Chain ID: eip155:1 Nonce: bZQJ0SL6gJ Issued At: 2022-10-25T16:52:02.748Z Resources: - https://foo.com - https://bar.com`; const encodedMessage = new TextEncoder().encode(message); const signedMessage = await provider.signMessage(encodedMessage, "utf8"); request() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const message = `magiceden.io wants you to sign in with your Ethereum account: eip155:1:0xb9c5714089478a327f09197987f16f9e5d936e8a Click Sign or Approve only means you have proved this wallet is owned by you. URI: https://magiceden.io Version: 1 Chain ID: eip155:1 Nonce: bZQJ0SL6gJ Issued At: 2022-10-25T16:52:02.748Z Resources: - https://foo.com - https://bar.com`; const encodedMessage = new TextEncoder().encode(message); const signedMessage = await provider.request({ method: "signMessage", params: { message: encodedMessage, display: "utf8", } }); #### [​](https://docs.phantom.com/developer-powertools/signing-a-message#solana-example) Solana example signMessage() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const message = `magiceden.io wants you to sign in with your Solana account: solana:mainnet:FYpB58cLw5cwiN763ayB2sFT8HLF2MRUBbbyRgHYiRpK Click Sign or Approve only means you have proved this wallet is owned by you. URI: https://magiceden.io Version: 1 Chain ID: solana:mainnet Nonce: bZQJ0SL6gJ Issued At: 2022-10-25T16:52:02.748Z Resources: - https://foo.com - https://bar.com`; const encodedMessage = new TextEncoder().encode(message); const signedMessage = await provider.signMessage(encodedMessage, "utf8"); request() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const message = `magiceden.io wants you to sign in with your Solana account: solana:mainnet:FYpB58cLw5cwiN763ayB2sFT8HLF2MRUBbbyRgHYiRpK Click Sign or Approve only means you have proved this wallet is owned by you. URI: https://magiceden.io Version: 1 Chain ID: solana:mainnet Nonce: bZQJ0SL6gJ Issued At: 2022-10-25T16:52:02.748Z Resources: - https://foo.com - https://bar.com`; const encodedMessage = new TextEncoder().encode(message); const signedMessage = await provider.request({ method: "signMessage", params: { message: encodedMessage, display: "utf8", } }); Phantom uses Ed25519 signatures for Solana message signatures. To verify a message signature, you can use the [tweetnacl](https://www.npmjs.com/package/tweetnacl) npm package. Was this page helpful? YesNo [Token pages](https://docs.phantom.com/developer-powertools/token-pages) [Shortcuts](https://docs.phantom.com/developer-powertools/shortcuts) ⌘I --- # Sign a message - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sui/signing-a-message#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Sui Sign a message [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) When a web application is [connected](https://docs.phantom.com/sui/establishing-a-connection) to Phantom, it can also request that the user signs a given message. Applications are free to write their own messages which will be displayed to users from within Phantom’s signature prompt. Message signatures do not involve network fees and are a convenient way for apps to verify ownership of an address. Report incorrect code Copy Ask AI try { const encodedMessage = new TextEncoder().encode(message); const signature = await provider.signMessage(encodedMessage, address); return signature; } catch (error) { throw new Error(error instanceof Error ? error.message : 'Failed to sign message'); } Was this page helpful? YesNo [Send a transaction](https://docs.phantom.com/sui/sending-a-transaction) [Phantom deep links](https://docs.phantom.com/phantom-deeplinks/deeplinks-ios-and-android) ⌘I --- #  events - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_events#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Properties  events [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [window.phantom.ethereum.\_events](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_events#window-phantom-ethereum-events) [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_events#window-phantom-ethereum-events) window.phantom.ethereum.\_events ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- An object containing all of the events that the provider has emitted or logged. Report incorrect code Copy Ask AI const events = window.phantom.ethereum._events; console.log(events); // Events {chainChanged: Array(2), accountsChanged: EE} This is **not** a recommended way to keep track of different events. The provider implements a Node.js `EventEmitter` API to emit different events happening within the wallet and/or dapp. For more details, see [Events](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/README) . Was this page helpful? YesNo [selectedAddress](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/selectedaddress)  [eventsCount](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_eventscount) ⌘I --- #  eventsCount - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_eventscount#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Properties  eventsCount [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [window.phantom.ethereum.\_eventsCount](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_eventscount#window-phantom-ethereum-eventscount) [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_eventscount#window-phantom-ethereum-eventscount) window.phantom.ethereum.\_eventsCount ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- An object containing the number of events that have happened Report incorrect code Copy Ask AI const eventsCount = window.phantom.ethereum._eventsCount; console.log(eventsCount); // 2 This is **not** a recommended way to keep track of different events. The provider implements a Node.js `EventEmitter` API to emit different events happening within the wallet and/or dapp. Was this page helpful? YesNo  [events](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_events) [Events](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/README) ⌘I --- # Error messages and codes - Phantom developer documentation [Skip to main content](https://docs.phantom.com/solana/errors#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana Error messages and codes [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) When making requests to Phantom in [establishing a connection](https://docs.phantom.com/solana/establishing-a-connection) , [sending a transaction](https://docs.phantom.com/solana/sending-a-transaction) , or [signing a message](https://docs.phantom.com/solana/signing-a-message) , Phantom may respond with an error. The following is a list of all possible error codes and their meanings. These error messages are inspired by Ethereum’s [EIP-1474](https://eips.ethereum.org/EIPS/eip-1474#error-codes) and [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193#provider-errors) . | Code | Title | Description | | --- | --- | --- | | 4900 | Disconnected | Phantom could not connect to the network. | | 4100 | Unauthorized | The requested method and/or account has not been authorized by the user. | | 4001 | User Rejected Request | The user rejected the request through Phantom. | | \-32000 | Invalid Input | Missing or invalid parameters. | | \-32002 | Requested resource not available | This error occurs when a dapp attempts to submit a new transaction while Phantom’s approval dialog is already open for a previous transaction. Only one approve window can be open at a time. Users should approve or reject their transaction before initiating a new transaction. | | \-32003 | Transaction Rejected | Phantom does not recognize a valid transaction. | | \-32601 | Method Not Found | Phantom does not recognize the method. | | \-32603 | Internal Error | Something went wrong within Phantom. | Typically, these errors will be easily parseable and have both a code and an explanation. For example: Report incorrect code Copy Ask AI try { await window.solana.signMessage(); } catch (err) { // {code: 4100, message: 'The requested method and/or account has not been authorized by the user.'} } Was this page helpful? YesNo [Sign a message](https://docs.phantom.com/solana/signing-a-message) [Get started with EVM networks](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/getting-started) ⌘I --- # networkVersion - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/networkversion#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Properties networkVersion [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [window.ethereum.networkVersion](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/networkversion#window-ethereum-networkversion) [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/networkversion#window-ethereum-networkversion) window.ethereum.networkVersion --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The network number of the blockchain that you are connected to. This property is available for legacy purposes. It is recommended that modern dapps refer to the `chainId` property to determine what chain a user is connected to currently. Report incorrect code Copy Ask AI const networkVersion = window.phantom.ethereum.networkVersion; console.log(networkVersion); // "1" // Ethereum Mainnet's Network Version Was this page helpful? YesNo [chainId](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/chainid) [selectedAddress](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/selectedaddress) ⌘I --- # SignMessage - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Provider methods SignMessage [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Base URL](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#base-url) * [Query string parameters](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#query-string-parameters) * [Returns](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#returns) * [Approve](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#approve) * [Reject](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#reject) * [Example](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#example) Once it’s connected to Phantom, an app can request that the user signs a given message. Applications are free to write their own messages which will be displayed to users from within Phantom’s signature prompt. Message signatures do not involve network fees and are a convenient way for apps to verify ownership of an address. In order to send a message for the user to sign, an application must: 1. Provide a **hex** or **UTF-8** encoded string as a Uint8Array and then **base58-encoded it**. 2. Request that the encoded message is signed via the user’s Phantom wallet. The [deeplinking demo app](https://docs.phantom.com/resources/sandbox) provides an example of signing a message. The message to be signed must be passed as a base58-encoded string. For more information on how to verify the signature of a message, please refer to [Encryption resources](https://docs.phantom.com/phantom-deeplinks/encryption) . [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#base-url) Base URL ------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI https://phantom.app/ul/v1/signMessage [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#query-string-parameters) Query string parameters ------------------------------------------------------------------------------------------------------------------------------- * `dapp_encryption_public_key` (required): The original encryption public key used from the app side for an existing [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) session. * `nonce` (required): A nonce used for encrypting the request, encoded in base58. * `redirect_link` (required): The URI where Phantom should redirect the user upon completion. For more details, see [Specify redirects](https://docs.phantom.com/phantom-deeplinks/specifying-redirects) . URL-encoded. * `payload` (required): An encrypted JSON string with the following fields: Report incorrect code Copy Ask AI { "message": "...", // the message, base58 encoded "session": "...", // token received from connect-method "display": "utf8" | "hex", // the encoding to use when displaying the message } * `message` (required): The message that should be signed by the user, encoded in base58. Phantom will display this message to the user when they are prompted to sign. * `session` (required): The session token received from the [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) method. For more details, see [Handle sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions) . * `display` (optional): How you want us to display the string to the user. Defaults to `utf8`. [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#returns) Returns ----------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#approve) Approve * `nonce`: A nonce used for encrypting the response, encoded in base58. * `data`: An encrypted JSON string. Refer to [Encryption](https://docs.phantom.com/phantom-deeplinks/encryption) to learn how apps can decrypt `data` using a shared secret. Encrypted bytes are encoded in base58. Report incorrect code Copy Ask AI // content of decrypted `data`-parameter { signature: "...", // message-signature } * `signature`: The message signature, encoded in base58. For more information on how to verify the signature of a message, see [Encryption resources](https://docs.phantom.com/phantom-deeplinks/encryption) . ### [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#reject) Reject An `errorCode` and `errorMessage` as query parameters. For a full list of possible error codes, see [Errors](https://docs.phantom.com/solana/errors) . Report incorrect code Copy Ask AI { "errorCode": "...", "errorMessage": "..." } [​](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage#example) Example ----------------------------------------------------------------------------------------------- Refer to the [signMessage](https://github.com/phantom-labs/deep-link-demo-app/blob/20f19f2154e98699f0d5a6b28bc4bb3d5acbcefd/App.tsx#L290) method implemented in our React Native demo application. Was this page helpful? YesNo [SignTransaction](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction) [Other methods](https://docs.phantom.com/phantom-deeplinks/other-methods/README) ⌘I --- # Sign a message - Phantom developer documentation [Skip to main content](https://docs.phantom.com/solana/signing-a-message#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana Sign a message [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [signMessage()](https://docs.phantom.com/solana/signing-a-message#signmessage) * [request()](https://docs.phantom.com/solana/signing-a-message#request) * [Sign-In with Solana (SIWS)](https://docs.phantom.com/solana/signing-a-message#sign-in-with-solana-siws) * [Support for other “Sign-In with” Standards](https://docs.phantom.com/solana/signing-a-message#support-for-other-%E2%80%9Csign-in-with%E2%80%9D-standards) When a web application is connected to Phantom, it can also request that the user signs a given message. Applications are free to write their own messages which will be displayed to users from within Phantom’s signature prompt. Message signatures do not involve network fees and are a convenient way for apps to verify ownership of an address. In order to send a message for the user to sign, a web application must: 1. Provide a **hex** or **UTF-8** encoded string as a Uint8Array. 2. Request that the encoded message is signed via the user’s Phantom wallet. For an example of signing a message, refer to [handleSignMessage](https://github.com/phantom-labs/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L242) in our sandbox. Phantom uses Ed25519 signatures for Solana message signatures. To verify a message signature, you can use the [tweetnacl](https://www.npmjs.com/package/tweetnacl) npm package. [​](https://docs.phantom.com/solana/signing-a-message#signmessage) signMessage() ----------------------------------------------------------------------------------- Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const message = `To avoid digital dognappers, sign below to authenticate with CryptoCorgis`; const encodedMessage = new TextEncoder().encode(message); const signedMessage = await provider.signMessage(encodedMessage, "utf8"); [​](https://docs.phantom.com/solana/signing-a-message#request) request() --------------------------------------------------------------------------- Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const message = `To avoid digital dognappers, sign below to authenticate with CryptoCorgis`; const encodedMessage = new TextEncoder().encode(message); const signedMessage = await provider.request({ method: "signMessage", params: { message: encodedMessage, display: "hex", }, }); [​](https://docs.phantom.com/solana/signing-a-message#sign-in-with-solana-siws) Sign-In with Solana (SIWS) ------------------------------------------------------------------------------------------------------------- Developers who use `signMessage` to authenticate users can now take advantage of Phantom’s new [Sign-In with Solana](https://github.com/phantom/sign-in-with-solana) feature. For more information, refer to our [specification](https://github.com/phantom/sign-in-with-solana) on GitHub. [​](https://docs.phantom.com/solana/signing-a-message#support-for-other-%E2%80%9Csign-in-with%E2%80%9D-standards) Support for other “Sign-In with” Standards --------------------------------------------------------------------------------------------------------------------------------------------------------------- Phantom supports a range of “Sign-In with” (SIW) message standards. You can read more about them in [Sign a message](https://docs.phantom.com/developer-powertools/signing-a-message) . Was this page helpful? YesNo [Send a versioned transaction](https://docs.phantom.com/solana/sending-a-transaction-1) [Error messages and codes](https://docs.phantom.com/solana/errors) ⌘I --- # selectedAddress - Phantom developer documentation [Skip to main content](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/selectedaddress#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Properties selectedAddress [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [window.phantom.ethereum.selectedAddress](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/selectedaddress#window-phantom-ethereum-selectedaddress) [​](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/selectedaddress#window-phantom-ethereum-selectedaddress) window.phantom.ethereum.selectedAddress ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The address of the wallet that is currently connected to the dapp. This value will update upon [accountsChanged](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/accounts-changed) and [connect](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/connect) events. Returns a hexadecimal string. Report incorrect code Copy Ask AI const address = window.phantom.ethereum.selectedAddress; console.log(address); // "0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5" Was this page helpful? YesNo [networkVersion](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/networkversion)  [events](https://docs.phantom.com/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/_events) ⌘I --- # Sign messages - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sdks/browser-sdk/sign-messages#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Browser SDK Sign messages [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Chain-specific message signing](https://docs.phantom.com/sdks/browser-sdk/sign-messages#chain-specific-message-signing) * [Solana message signing](https://docs.phantom.com/sdks/browser-sdk/sign-messages#solana-message-signing) * [Ethereum message signing](https://docs.phantom.com/sdks/browser-sdk/sign-messages#ethereum-message-signing) * [Complete examples](https://docs.phantom.com/sdks/browser-sdk/sign-messages#complete-examples) * [Solana message signing](https://docs.phantom.com/sdks/browser-sdk/sign-messages#solana-message-signing-2) * [Ethereum message signing](https://docs.phantom.com/sdks/browser-sdk/sign-messages#ethereum-message-signing-2) * [EIP-712 typed data signing](https://docs.phantom.com/sdks/browser-sdk/sign-messages#eip-712-typed-data-signing) The Phantom Connect Browser SDK provides chain-specific message signing methods through dedicated interfaces (`sdk.solana` and `sdk.ethereum`). [​](https://docs.phantom.com/sdks/browser-sdk/sign-messages#chain-specific-message-signing) Chain-specific message signing ----------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/browser-sdk/sign-messages#solana-message-signing) Solana message signing Report incorrect code Copy Ask AI // Sign a message with Solana wallet const signature = await sdk.solana.signMessage("Hello Solana!"); // Returns: { signature: string, rawSignature: string } ### [​](https://docs.phantom.com/sdks/browser-sdk/sign-messages#ethereum-message-signing) Ethereum message signing Report incorrect code Copy Ask AI // Sign personal message const signature = await sdk.ethereum.signPersonalMessage("Hello Ethereum!", address); // Sign EIP-712 typed data const typedDataSignature = await sdk.ethereum.signTypedData(typedData, address); [​](https://docs.phantom.com/sdks/browser-sdk/sign-messages#complete-examples) Complete examples --------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/browser-sdk/sign-messages#solana-message-signing-2) Solana message signing Report incorrect code Copy Ask AI import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; const sdk = new BrowserSDK({ providers: ["injected"], addressTypes: [AddressType.solana], }); await sdk.connect({ provider: "injected" }); // Sign a message const signature = await sdk.solana.signMessage("Hello Solana!"); console.log("Signature:", signature.signature); console.log("Raw signature:", signature.rawSignature); ### [​](https://docs.phantom.com/sdks/browser-sdk/sign-messages#ethereum-message-signing-2) Ethereum message signing Report incorrect code Copy Ask AI import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; const sdk = new BrowserSDK({ providers: ["injected"], addressTypes: [AddressType.ethereum], }); await sdk.connect({ provider: "injected" }); const accounts = await sdk.ethereum.getAccounts(); // Sign personal message const message = "Hello Ethereum!"; const signature = await sdk.ethereum.signPersonalMessage(message, accounts[0]); console.log("Signature:", signature.signature); ### [​](https://docs.phantom.com/sdks/browser-sdk/sign-messages#eip-712-typed-data-signing) EIP-712 typed data signing Report incorrect code Copy Ask AI const typedData = { types: { EIP712Domain: [\ { name: "name", type: "string" },\ { name: "version", type: "string" },\ { name: "chainId", type: "uint256" },\ { name: "verifyingContract", type: "address" }\ ], Mail: [\ { name: "from", type: "string" },\ { name: "to", type: "string" },\ { name: "contents", type: "string" }\ ] }, primaryType: "Mail", domain: { name: "Ether Mail", version: "1", chainId: 1, verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" }, message: { from: "Alice", to: "Bob", contents: "Hello!" } }; const accounts = await sdk.ethereum.getAccounts(); const signature = await sdk.ethereum.signTypedData(typedData, accounts[0]); console.log("Typed data signature:", signature.signature); Was this page helpful? YesNo [Connect](https://docs.phantom.com/sdks/browser-sdk/connect) [Sign and send transactions](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction) ⌘I --- # Handle sessions - Phantom developer documentation [Skip to main content](https://docs.phantom.com/phantom-deeplinks/handling-sessions#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Mobile deep links Handle sessions [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Session structure](https://docs.phantom.com/phantom-deeplinks/handling-sessions#session-structure) * [Decode sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions#decode-sessions) * [Invalid sessions](https://docs.phantom.com/phantom-deeplinks/handling-sessions#invalid-sessions) When a user [connects to Phantom](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) for the first time, Phantom will return a `session` param that represents the user’s connection. The app should pass this `session` param back to Phantom on all subsequent [provider methods](https://docs.phantom.com/phantom-deeplinks/provider-methods/) . It is the app’s responsibility to store this `session`. Sessions do not expire. Once a user has connected with Phantom, the corresponding app can indefinitely make requests such as [SignTransaction](https://docs.phantom.com/phantom-deeplinks/provider-methods/signtransaction) and [SignMessage](https://docs.phantom.com/phantom-deeplinks/provider-methods/signmessage) without prompting the user to re-connect with Phantom. Apps will still need to re-connect to Phantom after a [disconnect](https://docs.phantom.com/phantom-deeplinks/provider-methods/disconnect) event or an [invalid session](https://docs.phantom.com/phantom-deeplinks/handling-sessions) . [​](https://docs.phantom.com/phantom-deeplinks/handling-sessions#session-structure) Session structure -------------------------------------------------------------------------------------------------------- The entire `session` param is encoded in base58. A `session` should contain the following data: * **JSON Data Signature**: A base58 signature of the JSON data that is 64 bytes. Phantom will check the signature against the actual message that was signed. * **JSON Data**: A JSON object with the following fields: * `app_url` (string): A URL that was provided during the initial connection request. This URL is stored in the session for validation purposes and can be checked against the blocklist. * `timestamp` (number): The timestamp at which the user approved the connection. At the time of this writing, sessions do not expire. * `chain` (string): The chain that the user connected to at the start of the session. Sessions can’t be used across two different chains with the same keypair (for example, the user can’t connect to Solana and then sign on Ethereum). At the time of this writing, Phantom only supports `solana`. * `cluster` (string) (optional): The approved cluster that the app and user initially connected to. Solana-only. Can be either: `mainnet-beta`, `testnet`, or `devnet`. Defaults to `mainnet-beta`. **About `app_url` in sessions**: The `app_url` stored in the session token is used for validation purposes only. App metadata (such as title, icon, and favicon) is fetched from the `redirect_link` parameter during the initial connection request, not from the `app_url` stored in the session. For more information, see the [Connect](https://docs.phantom.com/phantom-deeplinks/provider-methods/connect) method documentation. [​](https://docs.phantom.com/phantom-deeplinks/handling-sessions#decode-sessions) Decode sessions ---------------------------------------------------------------------------------------------------- Phantom will decode and validate the `session` param on every request. To decode the session, we decode it with `bs58`, slice off the first 64 bytes of the signature, and the treat the rest as JSON data. We then sign the JSON data again with the same keypair and compare that signature against the signature in the session. If the signatures are the same, the session is valid. Otherwise, we conclude that the session has been faked, as the signature does not belong to the keypair it claims it does. Calling `nacl.sign.open` conveniently verifies and returns the original object. For more information, please review [Encryption resources](https://docs.phantom.com/phantom-deeplinks/encryption) . After we determine that the session is valid, we still need to ensure that the JSON fields line up with what we expect. An app could give a session for `pubkey A` when the user is currently using `pubkey B` in Phantom. In such a scenario, that session should not allow an app to request signatures. Instead, the app must issue a new connect request or use the correct session. Report incorrect code Copy Ask AI // Encoding a session const privateKey = ...; const sessionData = JSON.stringify({ "app_id": "APP_ID", "chain": "CHAIN", "cluster": "CLUSTER", "timestamp": 1644954984, }); const bytes = Buffer.from(sessionData, "utf-8"); // tweetnacl-js formats signature in format const signature = bs58.encode(nacl.sign(bytes, privateKey)); // Decoding ja session const publicKey = ...; const verifiedSessionData = nacl.sign.open(bs58.decode(signature), publicKey.toBytes()); if (!verifiedSessionData) throw new Error(`This session was not signed by ${publicKey}`); [​](https://docs.phantom.com/phantom-deeplinks/handling-sessions#invalid-sessions) Invalid sessions ------------------------------------------------------------------------------------------------------ While sessions do not expire, there are a number of reasons why a sessions could still be deemed invalid: 1. It was not signed by the current wallet keypair. This could mean that the session is entirely fake, or that it was signed by another keypair in the user’s wallet. 2. It was signed by the current wallet keypair, but the session’s JSON `data` does not pass muster. There are a few reasons why this might occur: 1. The user switched chains (or possibly networks). 2. The `app_url` could be blocked if malicious. For more information, see [Blocklist](https://docs.phantom.com/developer-powertools/blocklist) . You must pass the session token for all requests or Phantom will redirect the user back to your app and a new session will be created. Was this page helpful? YesNo [Phantom deep links](https://docs.phantom.com/phantom-deeplinks/deeplinks-ios-and-android) [Specifying redirects](https://docs.phantom.com/phantom-deeplinks/specifying-redirects) ⌘I --- # Establish a connection - Phantom developer documentation [Skip to main content](https://docs.phantom.com/solana/establishing-a-connection#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana Establish a connection [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Connect](https://docs.phantom.com/solana/establishing-a-connection#connect) * [connect()](https://docs.phantom.com/solana/establishing-a-connection#connect-2) * [request()](https://docs.phantom.com/solana/establishing-a-connection#request) * [Eagerly connecting](https://docs.phantom.com/solana/establishing-a-connection#eagerly-connecting) * [connect()](https://docs.phantom.com/solana/establishing-a-connection#connect-3) * [request()](https://docs.phantom.com/solana/establishing-a-connection#request-2) * [Disconnect](https://docs.phantom.com/solana/establishing-a-connection#disconnect) * [disconnect()](https://docs.phantom.com/solana/establishing-a-connection#disconnect-2) * [request()](https://docs.phantom.com/solana/establishing-a-connection#request-3) * [Change accounts](https://docs.phantom.com/solana/establishing-a-connection#change-accounts) Once an application has [detected the provider](https://docs.phantom.com/solana/detecting-the-provider) , it can then request to connect to Phantom. This connection request will prompt the user for permission to share their public key, indicating that they are willing to interact further. Users must approve a connection request before the app can make additional requests such as [signing a message](https://docs.phantom.com/solana/signing-a-message) or [sending a transaction](https://docs.phantom.com/solana/sending-a-transaction) . Once permission is established for the first time, the web application’s domain will be whitelisted for future connection requests. After a connection is established, it is possible to terminate the connection from both the application and the user side. [​](https://docs.phantom.com/solana/establishing-a-connection#connect) Connect --------------------------------------------------------------------------------- The **recommended** and **easiest** way to connect to Phantom is by calling `window.phantom.solana.connect()`. However, the provider also exposes a `request` JSON RPC interface. ### [​](https://docs.phantom.com/solana/establishing-a-connection#connect-2) connect() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" try { const resp = await provider.connect(); console.log(resp.publicKey.toString()); // 26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo } catch (err) { // { code: 4001, message: 'User rejected the request.' } } ### [​](https://docs.phantom.com/solana/establishing-a-connection#request) request() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" try { const resp = await provider.request({ method: "connect" }); console.log(resp.publicKey.toString()); // 26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo } catch (err) { // { code: 4001, message: 'User rejected the request.' } } The `connect()` call will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves when the user accepts the connection request, and reject (throw when awaited) when the user declines the request or closes the pop-up. See [Errors](https://docs.phantom.com/solana/errors) for a breakdown of error messages Phantom may emit. When the user accepts the request to connect, the provider will also emit a `connect` event. Report incorrect code Copy Ask AI provider.on("connect", () => console.log("connected!")); Once the web application is connected to Phantom, it will be able to read the connected account’s public key and prompt the user for additional transactions. It also exposes a convenience `isConnected` boolean. Report incorrect code Copy Ask AI console.log(provider.publicKey.toString()); // 26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo console.log(provider.isConnected); // true [​](https://docs.phantom.com/solana/establishing-a-connection#eagerly-connecting) Eagerly connecting ------------------------------------------------------------------------------------------------------- After a web application connects to Phantom for the first time, it becomes trusted. Once trusted, it’s possible for the application to automatically connect to Phantom on subsequent visits or page refreshes, without prompting the user for permission. This is referred to as “eagerly connecting”. To implement this, applications should pass an `onlyIfTrusted` option into the `connect()` call. ### [​](https://docs.phantom.com/solana/establishing-a-connection#connect-3) connect() Report incorrect code Copy Ask AI provider.connect({ onlyIfTrusted: true }); ### [​](https://docs.phantom.com/solana/establishing-a-connection#request-2) request() Report incorrect code Copy Ask AI window.solana.request({ method: "connect", params: { onlyIfTrusted: true }}); If this flag is present, Phantom will only eagerly connect and emit a `connect` event if the application is trusted. If the application is not trusted, Phantom will throw a [4001 error](https://docs.phantom.com/solana/errors) and remain disconnected until the user is prompted to connect without an `onlyIfTrusted` flag. In either case, Phantom will not open a pop-up window, making this convenient to use on all page loads. The following is an example of how a React application can eagerly connect to Phantom. Report incorrect code Copy Ask AI import { useEffect } from "react"; useEffect(() => { // Will either automatically connect to Phantom, or do nothing. provider.connect({ onlyIfTrusted: true }) .then(({ publicKey }) => { // Handle successful eager connection }) .catch(() => { // Handle connection failure as usual }) }, []); For a live demo, refer to the [handleConnect](https://github.com/phantom/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L263) function in our sandbox. If a wallet disconnects from a trusted app and then attempts to reconnect at a later time, Phantom will still eagerly connect. Once an app is trusted, Phantom will only require the user to approve a connection request if the user revokes the app from within their **Trusted Apps** settings. [​](https://docs.phantom.com/solana/establishing-a-connection#disconnect) Disconnect --------------------------------------------------------------------------------------- Disconnecting mirrors the same process as connecting. However, it is also possible for the wallet to initiate the disconnection, rather than the application itself. ### [​](https://docs.phantom.com/solana/establishing-a-connection#disconnect-2) disconnect() Report incorrect code Copy Ask AI provider.disconnect(); ### [​](https://docs.phantom.com/solana/establishing-a-connection#request-3) request() Report incorrect code Copy Ask AI provider.request({ method: "disconnect" }); The following is an example of how a React application can [gracefully handle](https://github.com/phantom-labs/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L107) a `disconnect` event. Report incorrect code Copy Ask AI import { useState, useEffect } from "react"; const [pubKey, setPubKey] = useState(null); useEffect(() => { // Store user's public key once they connect provider.on("connect", (publicKey) => { setPubKey(publicKey); }); // Forget user's public key once they disconnect provider.on("disconnect", () => { setPubKey(null); }); }, [provider]); [​](https://docs.phantom.com/solana/establishing-a-connection#change-accounts) Change accounts ------------------------------------------------------------------------------------------------- Phantom allows users to seamlessly manage multiple accounts (such as [keypairs](https://solana-foundation.github.io/solana-web3.js/classes/Keypair.html) ) from within a single extension or mobile app. Whenever a user switches accounts, Phantom will emit an `accountChanged` event. If a user changes accounts while already connected to an application, and the new account had already whitelisted that application, then the user will stay connected and Phantom will pass the [PublicKey](https://solana-foundation.github.io/solana-web3.js/classes/PublicKey.html) of the new account: Report incorrect code Copy Ask AI provider.on('accountChanged', (publicKey) => { if (publicKey) { // Set new public key and continue as usual console.log(`Switched to account ${publicKey.toBase58()}`); } }); If Phantom does not pass the public key of the new account, an application can either do nothing or attempt to reconnect: Report incorrect code Copy Ask AI provider.on('accountChanged', (publicKey) => { if (publicKey) { // Set new public key and continue as usual console.log(`Switched to account ${publicKey.toBase58()}`); } else { // Attempt to reconnect to Phantom provider.connect().catch((error) => { // Handle connection failure }); } }); Was this page helpful? YesNo [Detect the provider](https://docs.phantom.com/solana/detecting-the-provider) [Send a legacy transaction](https://docs.phantom.com/solana/sending-a-transaction) ⌘I --- # Send a legacy transaction - Phantom developer documentation [Skip to main content](https://docs.phantom.com/solana/sending-a-transaction#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana Send a legacy transaction [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Sign and send a transaction](https://docs.phantom.com/solana/sending-a-transaction#sign-and-send-a-transaction) * [signAndSendTransaction()](https://docs.phantom.com/solana/sending-a-transaction#signandsendtransaction) * [request()](https://docs.phantom.com/solana/sending-a-transaction#request) * [Sign and send multiple transactions](https://docs.phantom.com/solana/sending-a-transaction#sign-and-send-multiple-transactions) * [signAndSendAllTransactions()](https://docs.phantom.com/solana/sending-a-transaction#signandsendalltransactions) * [Other signing methods](https://docs.phantom.com/solana/sending-a-transaction#other-signing-methods) * [Sign a transaction (without sending)](https://docs.phantom.com/solana/sending-a-transaction#sign-a-transaction-without-sending) * [signTransaction()](https://docs.phantom.com/solana/sending-a-transaction#signtransaction) * [request()](https://docs.phantom.com/solana/sending-a-transaction#request-2) * [Sign multiple transactions](https://docs.phantom.com/solana/sending-a-transaction#sign-multiple-transactions) * [signAllTransactions()](https://docs.phantom.com/solana/sending-a-transaction#signalltransactions) * [request()](https://docs.phantom.com/solana/sending-a-transaction#request-3) Once a web application is connected to Phantom, it can prompt the user for permission to send transactions on their behalf. In order to send a transaction, a web application must: 1. Create an unsigned transaction. 2. Have the transaction be signed and submitted to the network by the user’s Phantom wallet. 3. Optionally await network confirmation using a Solana JSON RPC connection. For more information about the nature of Solana transactions, refer to the [solana-web3.js](https://solana-foundation.github.io/solana-web3.js/) documentation and the [Solana Cookbook](https://solanacookbook.com/core-concepts/transactions.html#transactions) . For a sample Phantom transaction, check out our [sandbox](https://github.com/phantom-labs/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L160) . [​](https://docs.phantom.com/solana/sending-a-transaction#sign-and-send-a-transaction) Sign and send a transaction --------------------------------------------------------------------------------------------------------------------- Once a transaction is created, the web application may ask the user’s Phantom wallet to sign and send the transaction. If accepted, Phantom will sign the transaction with the user’s private key and submit it via a Solana JSON RPC connection. By far the **easiest** and most **recommended** way of doing this is by using the `signAndSendTransaction` method on the provider, but it is also possible to do with `request`. In both cases, the call will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for an object containing the `signature`. ### [​](https://docs.phantom.com/solana/sending-a-transaction#signandsendtransaction) signAndSendTransaction() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const network = ""; const connection = new Connection(network); const transaction = new Transaction(); const { signature } = await provider.signAndSendTransaction(transaction); await connection.getSignatureStatus(signature); ### [​](https://docs.phantom.com/solana/sending-a-transaction#request) request() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const network = ""; const connection = new Connection(network); const transaction = new Transaction(); const { signature } = await provider.request({ method: "signAndSendTransaction", params: { message: bs58.encode(transaction.serializeMessage()), }, }); await connection.getSignatureStatus(signature); You can also specify a `SendOptions` [object](https://solana-foundation.github.io/solana-web3.js/modules.html#SendOptions) as a second argument into `signAndSendTransaction` or as an `options` parameter when using `request`. For a live demo of `signAndSendTransaction`, refer to [handleSignAndSendTransaction](https://github.com/phantom-labs/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L160) in our sandbox. [​](https://docs.phantom.com/solana/sending-a-transaction#sign-and-send-multiple-transactions) Sign and send multiple transactions ------------------------------------------------------------------------------------------------------------------------------------- It is also possible to sign and send multiple transactions at once. This is exposed through the `signAndSendAllTransactions` method on the provider. This method accepts an array of Solana transactions, and will optionally accept a [SendOptions](https://solana-foundation.github.io/solana-web3.js/types/SendOptions.html) object as a second parameter. If successful, it will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for an object containing the array of string `signatures` and the `publicKey` of the signer. ### [​](https://docs.phantom.com/solana/sending-a-transaction#signandsendalltransactions) signAndSendAllTransactions() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const network = ""; const connection = new Connection(network); const transactions = [new Transaction(), new Transaction()]; const { signatures, publicKey } = await provider.signAndSendAllTransactions(transactions); await connection.getSignatureStatuses(signatures); [​](https://docs.phantom.com/solana/sending-a-transaction#other-signing-methods) Other signing methods --------------------------------------------------------------------------------------------------------- The following methods are also supported, but are not recommended over `signAndSendTransaction`. It is safer for users, and a simpler API for developers, for Phantom to submit the transaction immediately after signing it instead of relying on the application to do so. The following methods are not supported in the [wallet standard](https://docs.phantom.com/solana/sending-a-transaction#) implementation and may be removed in a future release. These methods are only available via the [window.solana object](https://docs.phantom.com/solana/detecting-the-provider) . [​](https://docs.phantom.com/solana/sending-a-transaction#sign-a-transaction-without-sending) Sign a transaction (without sending) ------------------------------------------------------------------------------------------------------------------------------------- Once a transaction is created, a web application may ask the user’s Phantom wallet to sign the transaction _without_ also submitting it to the network. The easiest and most recommended way of doing this is via the `signTransaction` method on the provider, but it is also possible to do via `request`. In both cases, the call will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for the signed transaction. After the transaction has been signed, an application may submit the transaction itself using [sendRawTransaction](https://solana-foundation.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction) in web3.js. ### [​](https://docs.phantom.com/solana/sending-a-transaction#signtransaction) signTransaction() Report incorrect code Copy Ask AI const provider = getProvider(); const network = ""; const connection = new Connection(network); const transaction = new Transaction(); const signedTransaction = await provider.signTransaction(transaction); const signature = await connection.sendRawTransaction(signedTransaction.serialize()); ### [​](https://docs.phantom.com/solana/sending-a-transaction#request-2) request() Report incorrect code Copy Ask AI const provider = getProvider(); const network = ""; const connection = new Connection(network); const transaction = new Transaction(); const signedTransaction = await provider.request({ method: "signTransaction", params: { message: bs58.encode(transaction.serializeMessage()), }, }); const signature = await connection.sendRawTransaction(signedTransaction.serialize()); For an example of `signTransaction`, refer to [handleSignTransaction](https://github.com/phantom-labs/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L187) in our sandbox. [​](https://docs.phantom.com/solana/sending-a-transaction#sign-multiple-transactions) Sign multiple transactions ------------------------------------------------------------------------------------------------------------------- For legacy integrations, Phantom supports signing multiple transactions at once without sending them. This is exposed through the `signAllTransactions` method on the provider. This method is **not recommended** for new integrations. Instead, developers should make use of `signAndSendAllTransactions`. ### [​](https://docs.phantom.com/solana/sending-a-transaction#signalltransactions) signAllTransactions() Report incorrect code Copy Ask AI const signedTransactions = await provider.signAllTransactions(transactions); ### [​](https://docs.phantom.com/solana/sending-a-transaction#request-3) request() Report incorrect code Copy Ask AI const message = transactions.map(transaction => { return bs58.encode(transaction.serializeMessage()); }); const signedTransactions = await provider.request({ method: "signAllTransactions", params: { message }, }); For an example of `signAllTransactions`, refer to [handleSignAllTransactions](https://github.com/phantom-labs/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L213) in our sandbox. Was this page helpful? YesNo [Establish a connection](https://docs.phantom.com/solana/establishing-a-connection) [Send a versioned transaction](https://docs.phantom.com/solana/sending-a-transaction-1) ⌘I --- # Logos and assets - Phantom developer documentation [Skip to main content](https://docs.phantom.com/resources/assets#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Resources Logos and assets [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) A variety of Phantom logos and assets for your integration can be found here: [Phantom integration assets](https://187760183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MVOiF6Zqit57q_hxJYp%2Fuploads%2F76nE5VTUa3iCCzwlkEbC%2FPhantom-Integration-Assets.zip?alt=media&token=b91a3de7-3f28-4b78-a17c-5d36f4f6ee01) . When integrating Phantom, refer to our attached style guide. For most dapp integrations, we recommend using the following icon in SVG or PNG format: ![Phantom SVG Icon Sv](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/resources/images/Phantom_SVG_Icon.svg?w=2500&fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=cc3a9da12473cb37d4a33d4266750d93) Was this page helpful? YesNo [Demo apps](https://docs.phantom.com/resources/sandbox) ⌘I --- # Send a versioned transaction - Phantom developer documentation [Skip to main content](https://docs.phantom.com/solana/sending-a-transaction-1#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Solana Send a versioned transaction [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Build a versioned transaction](https://docs.phantom.com/solana/sending-a-transaction-1#build-a-versioned-transaction) * [createTransactionV0()](https://docs.phantom.com/solana/sending-a-transaction-1#createtransactionv0) * [Sign and send a versioned transaction](https://docs.phantom.com/solana/sending-a-transaction-1#sign-and-send-a-versioned-transaction) * [signAndSendTransaction()](https://docs.phantom.com/solana/sending-a-transaction-1#signandsendtransaction) * [Build an Address LUT](https://docs.phantom.com/solana/sending-a-transaction-1#build-an-address-lut) * [createAddressLookupTable()](https://docs.phantom.com/solana/sending-a-transaction-1#createaddresslookuptable) * [Extend an Address LUT](https://docs.phantom.com/solana/sending-a-transaction-1#extend-an-address-lut) * [extendAddressLookupTable()](https://docs.phantom.com/solana/sending-a-transaction-1#extendaddresslookuptable) * [Sign and send a versioned transaction using a LUT](https://docs.phantom.com/solana/sending-a-transaction-1#sign-and-send-a-versioned-transaction-using-a-lut) * [getAddressLookupTable()](https://docs.phantom.com/solana/sending-a-transaction-1#getaddresslookuptable) * [Parse and read addresses](https://docs.phantom.com/solana/sending-a-transaction-1#parse-and-read-addresses) The Solana runtime supports two types of transactions: `legacy` (see [Send a legacy transaction](https://docs.phantom.com/solana/sending-a-transaction) ) and `v0` (transactions that can include Address Lookup Tables or LUTs). The goal of `v0` is to increase the maximum size of a transaction, and hence the number of accounts that can fit in a single atomic transaction. With LUTs, developers can now build transactions with a maximum of 256 accounts, as compared to the limit of 35 accounts in legacy transactions that do not utilize LUTs. For a dive deep on versioned transactions, LUTs, and how the above changes affect the anatomy of a transaction, see [Versioned Transactions - Anvit Mangal’s Blog](https://anvit.hashnode.dev/versioned-transactions) . On this page, we’ll go over the following: 1. Building a versioned tansaction. 2. Signing and sending a versioned transaction. 3. Building an Address LUT. 4. Extending an Address LUT. 5. Signing and sending a versioned transaction using a LUT. [​](https://docs.phantom.com/solana/sending-a-transaction-1#build-a-versioned-transaction) Build a versioned transaction --------------------------------------------------------------------------------------------------------------------------- Versioned transactions are built in a very similar fashion to [legacy transactions](https://docs.phantom.com/solana/sending-a-transaction) . The only difference is that developers should use the `VersionedTransaction` class rather than the `Transaction` class. The following example shows how to build a simple transfer instruction. Once the transfer instruction is made, a `MessageV0` formatted transaction message is constructed with the transfer instruction. Finally, a new `VersionedTransaction` is created, parsing in the `v0` compatible message. ### [​](https://docs.phantom.com/solana/sending-a-transaction-1#createtransactionv0) createTransactionV0() Report incorrect code Copy Ask AI // create array of instructions const instructions = [\ SystemProgram.transfer({\ fromPubkey: publicKey,\ toPubkey: publicKey,\ lamports: 10,\ }),\ ]; // create v0 compatible message const messageV0 = new TransactionMessage({ payerKey: publicKey, recentBlockhash: blockhash, instructions, }).compileToV0Message(); // make a versioned transaction const transactionV0 = new VersionedTransaction(messageV0); For a live example of creating a versioned transaction, refer to [createTransferTransactionV0](https://github.com/phantom-labs/sandbox/blob/main/src/utils/createTransferTransactionV0.ts) in our sandbox. [​](https://docs.phantom.com/solana/sending-a-transaction-1#sign-and-send-a-versioned-transaction) Sign and send a versioned transaction ------------------------------------------------------------------------------------------------------------------------------------------- Once a Versioned transaction is created, it can be signed and sent via Phantom using the `signAndSendTransaction` method on the provider. The call will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for an object containing the `signature`. This is the same way a legacy transaction is sent via the Phantom provider. ### [​](https://docs.phantom.com/solana/sending-a-transaction-1#signandsendtransaction) signAndSendTransaction() Report incorrect code Copy Ask AI const provider = getProvider(); // see "Detecting the Provider" const network = ""; const connection = new Connection(network); const versionedTransaction = new VersionedTransaction(); const { signature } = await provider.signAndSendTransaction(versionedTransaction); await connection.getSignatureStatus(signature); You can also specify a `SendOptions` [object](https://solana-foundation.github.io/solana-web3.js/modules.html#SendOptions) as a second argument into `signAndSendTransaction()` or as an `options` parameter when using `request`. For a live demo of signing and sending a versioned transaction, refer to [handleSignAndSendTransactionV0](https://github.com/phantom-labs/sandbox/blob/78dc35fe140140a961345a6af30a058e1e19a7aa/src/App.tsx#L191) in our sandbox. [​](https://docs.phantom.com/solana/sending-a-transaction-1#build-an-address-lut) Build an Address LUT --------------------------------------------------------------------------------------------------------- Address LUTs can be used to load accounts into table-like data structures. These structures can then be referenced to significantly increase the number of accounts that can be loaded in a single transaction. This lookup method effectively “_compresses_” a 32-byte address into a 1-byte index value. This “_compression_” enables storing up to 256 address in a single LUT for use inside any given transaction. With the `@solana/web3.js` [createLookupTable](https://solana-foundation.github.io/solana-web3.js/classes/AddressLookupTableProgram.html#createLookupTable) method, developers can construct the instruction needed to create a new LUT, as well as determine its address. Once we have the LUT instruction, we can construct a transaction, sign it, and send it to create a LUT on-chain. Address LUTs can be created with either a `v0` transaction or a `legacy` transaction. However, the Solana runtime can only retrieve and handle the additional addresses within a LUT while using `v0` transactions. The following is a code snippet that creates a LUT. ### [​](https://docs.phantom.com/solana/sending-a-transaction-1#createaddresslookuptable) createAddressLookupTable() Report incorrect code Copy Ask AI // create an Address Lookup Table const [lookupTableInst, lookupTableAddress] = AddressLookupTableProgram.createLookupTable({ authority: publicKey, payer: publicKey, recentSlot: slot, }); // To create the Address Lookup Table on chain: // send the `lookupTableInst` instruction in a transaction const lookupMessage = new TransactionMessage({ payerKey: publicKey, recentBlockhash: blockhash, instructions: [lookupTableInst], }).compileToV0Message(); const lookupTransaction = new VersionedTransaction(lookupMessage); const lookupSignature = await signAndSendTransaction(provider, lookupTransaction); For a live demo of creating a LUT, refer to [handleSignAndSendTransactionV0WithLookupTable](https://github.com/phantom-labs/sandbox/blob/78dc35fe140140a961345a6af30a058e1e19a7aa/src/App.tsx#L218) in our sandbox. [​](https://docs.phantom.com/solana/sending-a-transaction-1#extend-an-address-lut) Extend an Address LUT ----------------------------------------------------------------------------------------------------------- Once an Address LUT is created, it can then be extended, which means that accounts can be appended to the table. Using the `@solana/web3.js` library, you can create a new `extend` instruction using the [extendLookupTable](https://solana-labs.github.io/solana-web3.js/classes/AddressLookupTableProgram.html#extendLookupTable) method. Once the extend instruction is created, it can be sent in a transaction. ### [​](https://docs.phantom.com/solana/sending-a-transaction-1#extendaddresslookuptable) extendAddressLookupTable() Report incorrect code Copy Ask AI // add addresses to the `lookupTableAddress` table via an `extend` instruction const extendInstruction = AddressLookupTableProgram.extendLookupTable({ payer: publicKey, authority: publicKey, lookupTable: lookupTableAddress, addresses: [\ publicKey,\ SystemProgram.programId,\ // more `publicKey` addresses can be listed here\ ], }); // Send this `extendInstruction` in a transaction to the cluster // to insert the listing of `addresses` into your lookup table with address `lookupTableAddress` const extensionMessageV0 = new TransactionMessage({ payerKey: publicKey, recentBlockhash: blockhash, instructions: [extendInstruction], }).compileToV0Message(); const extensionTransactionV0 = new VersionedTransaction(extensionMessageV0); const extensionSignature = await signAndSendTransaction(provider, extensionTransactionV0); For a live demo of extending a LUT, refer to the [handleSignAndSendTransactionV0WithLookupTable](https://github.com/phantom-labs/sandbox/blob/78dc35fe140140a961345a6af30a058e1e19a7aa/src/App.tsx#L218) function in our sandbox. [​](https://docs.phantom.com/solana/sending-a-transaction-1#sign-and-send-a-versioned-transaction-using-a-lut) Sign and send a versioned transaction using a LUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------- Up until now, we have: 1. Learned how to create a `VersionedTransaction`. 2. Created an Address LUT. 3. Extended the Address LUT. At this point, we are now ready to sign and send a `VersionedTransaction` using an Address LUT. First, we need to fetch the account of the created Address LUT. ### [​](https://docs.phantom.com/solana/sending-a-transaction-1#getaddresslookuptable) getAddressLookupTable() Report incorrect code Copy Ask AI // get the table from the cluster const lookupTableAccount = await connection.getAddressLookupTable(lookupTableAddress).then((res) => res.value); // `lookupTableAccount` will now be a `AddressLookupTableAccount` object console.log('Table address from cluster:', lookupTableAccount.key.toBase58()); We can also parse and read all the addresses currently stores in the fetched Address LUT. [​](https://docs.phantom.com/solana/sending-a-transaction-1#parse-and-read-addresses) Parse and read addresses ----------------------------------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI // Loop through and parse all the address stored in the table for (let i = 0; i < lookupTableAccount.state.addresses.length; i++) { const address = lookupTableAccount.state.addresses[i]; console.log(i, address.toBase58()); } We can now create the instructions array with an arbitrary transfer instruction, just the way we did while creating the `VersionedTransaction` earlier. This `VersionedTransaction` can then be sent using the `signAndSendTransaction()` provider function. Report incorrect code Copy Ask AI // create an array with your desired `instructions` // in this case, just a transfer instruction const instructions = [\ SystemProgram.transfer({\ fromPubkey: publicKey,\ toPubkey: publicKey,\ lamports: minRent,\ }),\ ]; // create v0 compatible message const messageV0 = new TransactionMessage({ payerKey: publicKey, recentBlockhash: blockhash, instructions, }).compileToV0Message([lookupTableAccount]); // make a versioned transaction const transactionV0 = new VersionedTransaction(messageV0); const signature = await signAndSendTransaction(provider, transactionV0); For a live demo of of signing and sending a versioned transaction using an Address LUT, refer to the [handleSignAndSendTransactionV0WithLookupTable](https://github.com/phantom-labs/sandbox/blob/78dc35fe140140a961345a6af30a058e1e19a7aa/src/App.tsx#L218) in our sandbox. Was this page helpful? YesNo [Send a legacy transaction](https://docs.phantom.com/solana/sending-a-transaction) [Sign a message](https://docs.phantom.com/solana/signing-a-message) ⌘I --- # Demo apps - Phantom developer documentation [Skip to main content](https://docs.phantom.com/resources/sandbox#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Resources Demo apps [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Multi-chain sandbox](https://docs.phantom.com/resources/sandbox#multi-chain-sandbox) * [Solana-only sandbox](https://docs.phantom.com/resources/sandbox#solana-only-sandbox) * [Deeplinking demo app](https://docs.phantom.com/resources/sandbox#deeplinking-demo-app) [​](https://docs.phantom.com/resources/sandbox#multi-chain-sandbox) Multi-chain sandbox ------------------------------------------------------------------------------------------ For a live example of how a multichain dApp can integrate with Phantom, check out our Multichain Sandbox on [CodeSandbox](https://472igc.csb.app/) and [GitHub](https://github.com/phantom-labs/multi-chain-sandbox) . [​](https://docs.phantom.com/resources/sandbox#solana-only-sandbox) Solana-only sandbox ------------------------------------------------------------------------------------------ For a live example of a Solana-only integration, check out our [Solana Sandbox](https://github.com/phantom-labs/sandbox) on GitHub. [​](https://docs.phantom.com/resources/sandbox#deeplinking-demo-app) Deeplinking demo app -------------------------------------------------------------------------------------------- For a live demonstration of Phantom’s deeplinking API, see our [React Native demo application](https://github.com/phantom-labs/deep-link-demo-app) . This application can be run locally and interacted with on iOS and Android devices via [Expo CLI](https://docs.expo.dev/workflow/expo-cli/) . Was this page helpful? YesNo [FAQ](https://docs.phantom.com/resources/faq) [Logos and assets](https://docs.phantom.com/resources/assets) ⌘I --- # Sign and send transactions - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Browser SDK Sign and send transactions [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Chain-specific transaction methods](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#chain-specific-transaction-methods) * [Solana transactions (sdk.solana)](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#solana-transactions-sdk-solana) * [Ethereum transactions (sdk.ethereum)](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#ethereum-transactions-sdk-ethereum) * [Transaction examples](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#transaction-examples) * [Solana transaction examples](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#solana-transaction-examples) * [Solana with @solana/web3.js](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#solana-with-%40solana%2Fweb3-js) * [Solana with @solana/kit](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#solana-with-%40solana%2Fkit) * [Ethereum transaction examples](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#ethereum-transaction-examples) * [Ethereum with viem](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#ethereum-with-viem) The Phantom Connect Browser SDK provides chain-specific transaction methods through dedicated interfaces (`sdk.solana` and `sdk.ethereum`) for optimal transaction handling. **Embedded wallet limitations**: The `signTransaction` and `signAllTransactions` methods **aren’t supported** for embedded wallets. For embedded wallets, use only `signAndSendTransaction` that signs and broadcasts the transaction in a single step. **Transaction security for embedded wallets**: All transactions signed for embedded wallets pass through Phantom’s advanced simulation system before execution. This security layer automatically blocks malicious transactions and transactions from origins that have been reported as malicious, providing an additional layer of protection for your users’ assets. [​](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#chain-specific-transaction-methods) Chain-specific transaction methods ------------------------------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#solana-transactions-sdk-solana) Solana transactions (sdk.solana) Report incorrect code Copy Ask AI // Sign and send transaction const result = await sdk.solana.signAndSendTransaction(transaction); // Just sign (without sending) - Note: Not supported for embedded wallets const signedTx = await sdk.solana.signTransaction(transaction); ### [​](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#ethereum-transactions-sdk-ethereum) Ethereum transactions (sdk.ethereum) Report incorrect code Copy Ask AI // Send transaction const result = await sdk.ethereum.sendTransaction({ to: "0x...", value: "1000000000000000000", gas: "21000", }); [​](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#transaction-examples) Transaction examples --------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#solana-transaction-examples) Solana transaction examples The SDK supports multiple Solana transaction libraries. Here are examples using both `@solana/web3.js` and `@solana/kit`: #### [​](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#solana-with-@solana/web3-js) Solana with @solana/web3.js Report incorrect code Copy Ask AI import { VersionedTransaction, TransactionMessage, SystemProgram, PublicKey, LAMPORTS_PER_SOL, Connection, } from "@solana/web3.js"; import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; const sdk = new BrowserSDK({ providers: ["injected"], addressTypes: [AddressType.solana], }); await sdk.connect({ provider: "injected" }); // Get recent blockhash const connection = new Connection("https://api.mainnet-beta.solana.com"); const { blockhash } = await connection.getLatestBlockhash(); // Create transfer instruction const fromAddress = await sdk.solana.getPublicKey(); const transferInstruction = SystemProgram.transfer({ fromPubkey: new PublicKey(fromAddress), toPubkey: new PublicKey(toAddress), lamports: 0.001 * LAMPORTS_PER_SOL, }); // Create VersionedTransaction const messageV0 = new TransactionMessage({ payerKey: new PublicKey(fromAddress), recentBlockhash: blockhash, instructions: [transferInstruction], }).compileToV0Message(); const transaction = new VersionedTransaction(messageV0); // Send transaction using chain-specific API const result = await sdk.solana.signAndSendTransaction(transaction); console.log("Transaction signature:", result.hash); #### [​](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#solana-with-@solana/kit) Solana with @solana/kit Report incorrect code Copy Ask AI import { createSolanaRpc, pipe, createTransactionMessage, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, address, compileTransaction, } from "@solana/kit"; import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; const sdk = new BrowserSDK({ providers: ["injected"], addressTypes: [AddressType.solana], }); await sdk.connect({ provider: "injected" }); // Create transaction with @solana/kit const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com"); const { value: latestBlockhash } = await rpc.getLatestBlockhash().send(); const userPublicKey = await sdk.solana.getPublicKey(); const transactionMessage = pipe( createTransactionMessage({ version: 0 }), tx => setTransactionMessageFeePayer(address(userPublicKey), tx), tx => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx), ); const transaction = compileTransaction(transactionMessage); // Send using chain-specific API const result = await sdk.solana.signAndSendTransaction(transaction); console.log("Transaction signature:", result.hash); ### [​](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#ethereum-transaction-examples) Ethereum transaction examples Report incorrect code Copy Ask AI import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; const sdk = new BrowserSDK({ providers: ["injected"], addressTypes: [AddressType.ethereum], }); await sdk.connect({ provider: "injected" }); // Simple ETH transfer const result = await sdk.ethereum.sendTransaction({ to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E", value: "1000000000000000000", // 1 ETH in wei gas: "21000", gasPrice: "20000000000", // 20 gwei }); // EIP-1559 transaction with maxFeePerGas const result2 = await sdk.ethereum.sendTransaction({ to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E", value: "1000000000000000000", // 1 ETH in wei data: "0x...", // contract call data gas: "50000", maxFeePerGas: "30000000000", // 30 gwei maxPriorityFeePerGas: "2000000000", // 2 gwei }); console.log("Transaction hash:", result.hash); #### [​](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction#ethereum-with-viem) Ethereum with viem Report incorrect code Copy Ask AI import { parseEther, parseGwei, encodeFunctionData } from "viem"; import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; const sdk = new BrowserSDK({ providers: ["injected"], addressTypes: [AddressType.ethereum], }); // Simple transfer with viem utilities const result = await sdk.ethereum.sendTransaction({ to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E", value: parseEther("1").toString(), // 1 ETH gas: "21000", gasPrice: parseGwei("20").toString(), // 20 gwei }); // Contract interaction const result2 = await sdk.ethereum.sendTransaction({ to: tokenContractAddress, data: encodeFunctionData({ abi: tokenAbi, functionName: "transfer", args: [recipientAddress, parseEther("100")], }), gas: "50000", maxFeePerGas: parseGwei("30").toString(), maxPriorityFeePerGas: parseGwei("2").toString(), }); Was this page helpful? YesNo [Sign messages](https://docs.phantom.com/sdks/browser-sdk/sign-messages) [Wallet authentication with JWTs](https://docs.phantom.com/sdks/guides/wallet-authentication-with-jwts) ⌘I --- # Sign messages - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sdks/react-sdk/sign-messages#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation React SDK Sign messages [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Chain-specific message signing hooks](https://docs.phantom.com/sdks/react-sdk/sign-messages#chain-specific-message-signing-hooks) * [Solana message signing (useSolana)](https://docs.phantom.com/sdks/react-sdk/sign-messages#solana-message-signing-usesolana) * [Ethereum message signing (useEthereum)](https://docs.phantom.com/sdks/react-sdk/sign-messages#ethereum-message-signing-useethereum) * [Complete examples](https://docs.phantom.com/sdks/react-sdk/sign-messages#complete-examples) * [Solana message signing](https://docs.phantom.com/sdks/react-sdk/sign-messages#solana-message-signing) * [Ethereum message signing](https://docs.phantom.com/sdks/react-sdk/sign-messages#ethereum-message-signing) The React SDK provides chain-specific hooks (`useSolana` and `useEthereum`) for signing messages with blockchain-specific handling. [​](https://docs.phantom.com/sdks/react-sdk/sign-messages#chain-specific-message-signing-hooks) Chain-specific message signing hooks --------------------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/react-sdk/sign-messages#solana-message-signing-usesolana) Solana message signing (useSolana) Report incorrect code Copy Ask AI import { useSolana } from "@phantom/react-sdk"; function SolanaMessageSigning() { const { solana } = useSolana(); const handleSign = async () => { const signature = await solana.signMessage("Hello Solana!"); console.log("Signature:", signature.signature); console.log("Raw signature:", signature.rawSignature); }; return ( ); } ### [​](https://docs.phantom.com/sdks/react-sdk/sign-messages#ethereum-message-signing-useethereum) Ethereum message signing (useEthereum) Report incorrect code Copy Ask AI import { useEthereum } from "@phantom/react-sdk"; function EthereumMessageSigning() { const { ethereum } = useEthereum(); const handleSignPersonal = async () => { const accounts = await ethereum.getAccounts(); const signature = await ethereum.signPersonalMessage("Hello Ethereum!", accounts[0]); console.log("Signature:", signature.signature); }; const handleSignTypedData = async () => { const accounts = await ethereum.getAccounts(); const signature = await ethereum.signTypedData(typedData, accounts[0]); console.log("Typed data signature:", signature.signature); }; return (
); } [​](https://docs.phantom.com/sdks/react-sdk/sign-messages#complete-examples) Complete examples ------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/react-sdk/sign-messages#solana-message-signing) Solana message signing Report incorrect code Copy Ask AI import { useSolana } from "@phantom/react-sdk"; import { VersionedTransaction, TransactionMessage, SystemProgram, PublicKey, Connection } from "@solana/web3.js"; function SolanaOperations() { const { solana } = useSolana(); const signMessage = async () => { const signature = await solana.signMessage("Hello Solana!"); console.log("Signature:", signature); }; return (

Connected: {solana.isConnected ? 'Yes' : 'No'}

); } ### [​](https://docs.phantom.com/sdks/react-sdk/sign-messages#ethereum-message-signing) Ethereum message signing Report incorrect code Copy Ask AI import { useEthereum } from "@phantom/react-sdk"; function EthereumOperations() { const { ethereum } = useEthereum(); const signPersonalMessage = async () => { const accounts = await ethereum.getAccounts(); const signature = await ethereum.signPersonalMessage("Hello Ethereum!", accounts[0]); console.log("Signature:", signature); }; const signTypedData = async () => { const accounts = await ethereum.getAccounts(); const typedData = { types: { EIP712Domain: [\ { name: "name", type: "string" },\ { name: "version", type: "string" },\ { name: "chainId", type: "uint256" },\ { name: "verifyingContract", type: "address" }\ ], Mail: [\ { name: "from", type: "string" },\ { name: "to", type: "string" },\ { name: "contents", type: "string" }\ ] }, primaryType: "Mail", domain: { name: "Ether Mail", version: "1", chainId: 1, verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" }, message: { from: "Alice", to: "Bob", contents: "Hello!" } }; const signature = await ethereum.signTypedData(typedData); console.log("Typed data signature:", signature); }; return (

Connected: {ethereum.isConnected ? 'Yes' : 'No'}

); } Was this page helpful? YesNo [Connect](https://docs.phantom.com/sdks/react-sdk/connect) [Sign and send transactions](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction) ⌘I --- # Sign and send transactions - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation React SDK Sign and send transactions [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Chain-specific transaction hooks](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#chain-specific-transaction-hooks) * [Solana transactions (useSolana)](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#solana-transactions-usesolana) * [Ethereum transactions (useEthereum)](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#ethereum-transactions-useethereum) * [Transaction examples](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#transaction-examples) * [Solana with @solana/web3.js](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#solana-with-%40solana%2Fweb3-js) * [Solana with @solana/kit](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#solana-with-%40solana%2Fkit) * [Ethereum with viem](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#ethereum-with-viem) The React SDK provides chain-specific hooks (`useSolana` and `useEthereum`) for signing and sending transactions with optimal blockchain-specific handling. **Embedded wallet limitations**: The `signTransaction` and `signAllTransactions` methods **aren’t supported** for embedded wallets. For embedded wallets, use only `signAndSendTransaction` that signs and broadcasts the transaction in a single step. **Transaction security for embedded wallets**: All transactions signed for embedded wallets pass through Phantom’s advanced simulation system before execution. This security layer automatically blocks malicious transactions and transactions from origins that have been reported as malicious, providing an additional layer of protection for your users’ assets. [​](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#chain-specific-transaction-hooks) Chain-specific transaction hooks ------------------------------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#solana-transactions-usesolana) Solana transactions (useSolana) Report incorrect code Copy Ask AI import { useSolana } from "@phantom/react-sdk"; function SolanaTransactions() { const { solana } = useSolana(); const sendTransaction = async () => { // Sign and send transaction const result = await solana.signAndSendTransaction(transaction); console.log("Transaction sent:", result.hash); }; const signOnly = async () => { // Just sign (without sending) - Note: Not supported for embedded wallets const signedTx = await solana.signTransaction(transaction); console.log("Signed transaction:", signedTx); }; return (
); } ### [​](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#ethereum-transactions-useethereum) Ethereum transactions (useEthereum) Report incorrect code Copy Ask AI import { useEthereum } from "@phantom/react-sdk"; function EthereumTransactions() { const { ethereum } = useEthereum(); const sendTransaction = async () => { const result = await ethereum.sendTransaction({ to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E", value: "1000000000000000000", // 1 ETH in wei gas: "21000", }); console.log("Transaction sent:", result.hash); }; return ( ); } [​](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#transaction-examples) Transaction examples ------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#solana-with-@solana/web3-js) Solana with @solana/web3.js Report incorrect code Copy Ask AI import { VersionedTransaction, TransactionMessage, SystemProgram, PublicKey, Connection } from "@solana/web3.js"; import { useSolana } from "@phantom/react-sdk"; function SolanaExample() { const { solana } = useSolana(); const sendTransaction = async () => { // Get recent blockhash const connection = new Connection("https://api.mainnet-beta.solana.com"); const { blockhash } = await connection.getLatestBlockhash(); // Create transfer instruction const fromAddress = await solana.getPublicKey(); const transferInstruction = SystemProgram.transfer({ fromPubkey: new PublicKey(fromAddress), toPubkey: new PublicKey(toAddress), lamports: 1000000, // 0.001 SOL }); // Create VersionedTransaction const messageV0 = new TransactionMessage({ payerKey: new PublicKey(fromAddress), recentBlockhash: blockhash, instructions: [transferInstruction], }).compileToV0Message(); const transaction = new VersionedTransaction(messageV0); // Sign and send using chain-specific hook const result = await solana.signAndSendTransaction(transaction); console.log("Transaction sent:", result.hash); }; return ; } ### [​](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#solana-with-@solana/kit) Solana with @solana/kit Report incorrect code Copy Ask AI import { createSolanaRpc, pipe, createTransactionMessage, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, address, compileTransaction, } from "@solana/kit"; import { useSolana } from "@phantom/react-sdk"; function SolanaKitExample() { const { solana } = useSolana(); const sendTransaction = async () => { const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com"); const { value: latestBlockhash } = await rpc.getLatestBlockhash().send(); const userPublicKey = await solana.getPublicKey(); const transactionMessage = pipe( createTransactionMessage({ version: 0 }), tx => setTransactionMessageFeePayer(address(userPublicKey), tx), tx => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx), ); const transaction = compileTransaction(transactionMessage); // Sign and send using chain-specific hook const result = await solana.signAndSendTransaction(transaction); console.log("Transaction sent:", result.hash); }; return ; } ### [​](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction#ethereum-with-viem) Ethereum with viem Report incorrect code Copy Ask AI import { parseEther, parseGwei, encodeFunctionData } from "viem"; import { useEthereum } from "@phantom/react-sdk"; function EthereumExample() { const { ethereum } = useEthereum(); const sendEth = async () => { const result = await ethereum.sendTransaction({ to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E", value: parseEther("1").toString(), // 1 ETH gas: "21000", gasPrice: parseGwei("20").toString(), // 20 gwei }); console.log("ETH sent:", result.hash); }; const sendToken = async () => { const result = await ethereum.sendTransaction({ to: tokenContractAddress, data: encodeFunctionData({ abi: erc20Abi, functionName: "transfer", args: [recipientAddress, parseEther("100")], }), gas: "50000", maxFeePerGas: parseGwei("30").toString(), maxPriorityFeePerGas: parseGwei("2").toString(), }); console.log("Token sent:", result.hash); }; return (
); } Was this page helpful? YesNo [Sign messages](https://docs.phantom.com/sdks/react-sdk/sign-messages) [Phantom React Native SDK](https://docs.phantom.com/sdks/react-native-sdk) ⌘I --- # MCP server - Phantom developer documentation [Skip to main content](https://docs.phantom.com/resources/mcp-server#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Developer tools MCP server [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Overview](https://docs.phantom.com/resources/mcp-server#overview) * [Quick install](https://docs.phantom.com/resources/mcp-server#quick-install) * [Features](https://docs.phantom.com/resources/mcp-server#features) * [Setup guides](https://docs.phantom.com/resources/mcp-server#setup-guides) * [Usage](https://docs.phantom.com/resources/mcp-server#usage) * [Example prompts](https://docs.phantom.com/resources/mcp-server#example-prompts) * [Server details](https://docs.phantom.com/resources/mcp-server#server-details) * [Available tools](https://docs.phantom.com/resources/mcp-server#available-tools) * [Troubleshooting](https://docs.phantom.com/resources/mcp-server#troubleshooting) * [Related resources](https://docs.phantom.com/resources/mcp-server#related-resources) [​](https://docs.phantom.com/resources/mcp-server#overview) Overview ----------------------------------------------------------------------- The Phantom MCP (Model Context Protocol) server enables AI coding assistants like [Cursor](https://cursor.com/) , [Claude](https://claude.ai/) , and [VS Code](https://code.visualstudio.com/) to search and retrieve information from the Phantom developer documentation. This allows your AI assistant to provide accurate, up-to-date guidance when building Phantom integrations. MCP is an open protocol that allows AI applications to securely connect to external data sources and tools. Learn more about MCP at [modelcontextprotocol.io](https://modelcontextprotocol.io/) . [​](https://docs.phantom.com/resources/mcp-server#quick-install) Quick install --------------------------------------------------------------------------------- Use the contextual menu at the top of any documentation page to quickly connect to your preferred tool: * **Copy MCP server URL** - Copy the URL to your clipboard * **Connect to Cursor** - Automatically install in Cursor * **Connect to VS Code** - Automatically install in VS Code [​](https://docs.phantom.com/resources/mcp-server#features) Features ----------------------------------------------------------------------- The Phantom MCP server provides: * **SearchPhantomDeveloper**: Search across the entire Phantom developer documentation knowledge base to find relevant information, code examples, API references, and guides [​](https://docs.phantom.com/resources/mcp-server#setup-guides) Setup guides ------------------------------------------------------------------------------- * Cursor * VS Code * Claude * Claude Code ### [​](https://docs.phantom.com/resources/mcp-server#option-1-quick-install) Option 1: Quick install Use the contextual menu at the top of this page and select **Connect to Cursor** to automatically install the MCP server. ### [​](https://docs.phantom.com/resources/mcp-server#option-2-manual-setup) Option 2: Manual setup 1 [](https://docs.phantom.com/resources/mcp-server#) Open MCP settings Use `Cmd + Shift + P` (Mac) or `Ctrl + Shift + P` (Windows/Linux) to open the command palette, then search for **“Open MCP settings”**. 2 [](https://docs.phantom.com/resources/mcp-server#) Configure the Phantom MCP server Add the following to your `mcp.json` file: Report incorrect code Copy Ask AI { "mcpServers": { "phantom-docs": { "type": "sse", "url": "https://docs.phantom.com/mcp" } } } If you already have other MCP servers configured, add `phantom-docs` to your existing `mcpServers` object. 3 [](https://docs.phantom.com/resources/mcp-server#) Verify the connection In Cursor’s chat, ask **“What tools do you have available?”** - Cursor should show the Phantom MCP server as an available tool. See the [Cursor MCP documentation](https://docs.cursor.com/context/model-context-protocol) for more details. ### [​](https://docs.phantom.com/resources/mcp-server#option-1-quick-install-2) Option 1: Quick install Use the contextual menu at the top of this page and select **Connect to VS Code** to automatically install the MCP server. ### [​](https://docs.phantom.com/resources/mcp-server#option-2-manual-setup-2) Option 2: Manual setup 1 [](https://docs.phantom.com/resources/mcp-server#) Create the MCP configuration file Create a `.vscode/mcp.json` file in your project directory. 2 [](https://docs.phantom.com/resources/mcp-server#) Configure the Phantom MCP server Add the following configuration: Report incorrect code Copy Ask AI { "servers": { "phantom-docs": { "type": "http", "url": "https://docs.phantom.com/mcp" } } } 3 [](https://docs.phantom.com/resources/mcp-server#) Verify the connection The MCP server should now be available in VS Code’s AI features. See the [VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more details. 1 [](https://docs.phantom.com/resources/mcp-server#) Open Claude settings Navigate to the **Connectors** page in your [Claude settings](https://claude.ai/settings/connectors) . 2 [](https://docs.phantom.com/resources/mcp-server#) Add the Phantom MCP server 1. Select **Add custom connector** 2. Enter the following details: * **Name**: `Phantom Docs` * **URL**: `https://docs.phantom.com/mcp` 3. Select **Add** 3 [](https://docs.phantom.com/resources/mcp-server#) Use the MCP server When using Claude: 1. Select the attachments button (the plus icon) 2. Select the **Phantom Docs** connector 3. Ask Claude questions about Phantom integration See the [Claude MCP documentation](https://modelcontextprotocol.io/quickstart/user) for more details. ### [​](https://docs.phantom.com/resources/mcp-server#install-via-command-line) Install via command line Run the following command to add the Phantom MCP server to Claude Code: Report incorrect code Copy Ask AI claude mcp add --transport http phantom-docs https://docs.phantom.com/mcp ### [​](https://docs.phantom.com/resources/mcp-server#verify-the-installation) Verify the installation Check that the server was added successfully: Report incorrect code Copy Ask AI claude mcp list See the [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code/mcp) for more details. [​](https://docs.phantom.com/resources/mcp-server#usage) Usage ----------------------------------------------------------------- Once configured, your AI assistant can automatically search Phantom documentation when you ask questions about: * Phantom SDK integration (React, React Native, Browser) * Wallet connection and authentication flows * Transaction signing and sending * Message signing for authentication * Multi-chain support (Solana, Ethereum, Bitcoin, Sui, and more) * Phantom Portal setup and configuration * Best practices and troubleshooting ### [​](https://docs.phantom.com/resources/mcp-server#example-prompts) Example prompts Try asking your AI assistant: * “How do I set up Phantom Connect in a React app?” * “Show me how to sign a message with the Phantom Browser SDK” * “What’s the process for verifying a domain in Phantom Portal?” * “How do I send a Solana transaction using Phantom?” The AI will search the Phantom documentation and provide accurate, contextual responses with code examples. [​](https://docs.phantom.com/resources/mcp-server#server-details) Server details ----------------------------------------------------------------------------------- | Property | Value | | --- | --- | | Server name | Phantom developer documentation | | Version | 1.0.0 | | Transport | SSE (Server-Sent Events) | | Endpoint | `https://docs.phantom.com/mcp` | ### [​](https://docs.phantom.com/resources/mcp-server#available-tools) Available tools | Tool | Description | | --- | --- | | `SearchPhantomDeveloper` | Search across the Phantom developer documentation knowledge base to find relevant information, code examples, API references, and guides | [​](https://docs.phantom.com/resources/mcp-server#troubleshooting) Troubleshooting ------------------------------------------------------------------------------------- Server shows as disconnected in Cursor * Make sure you include `"type": "sse"` in your Cursor configuration * Verify you have an active internet connection * Check that the URL is exactly `https://docs.phantom.com/mcp` * Try removing and re-adding the server * Restart Cursor completely AI doesn't use the documentation * Make sure the MCP server shows a green status indicator * Try explicitly asking about Phantom (e.g., “Using Phantom docs, how do I…”) * Verify the server is enabled in your settings * In Cursor, ask “What tools do you have available?” to verify the connection Configuration file not found * **Cursor**: The `mcp.json` file is located at `~/.cursor/mcp.json` (Mac/Linux) or `%APPDATA%\Cursor\mcp.json` (Windows) * **VS Code**: Create `.vscode/mcp.json` in your project directory * If the file doesn’t exist, create it with the configuration shown above Claude connector not working * Make sure you’re using the correct URL: `https://docs.phantom.com/mcp` * Try removing and re-adding the connector * Check the [Claude Connectors page](https://claude.ai/settings/connectors) to verify the connector is added [​](https://docs.phantom.com/resources/mcp-server#related-resources) Related resources ----------------------------------------------------------------------------------------- [Cursor AI prompts\ -----------------\ \ One-shot prompts for implementing Phantom SDKs](https://docs.phantom.com/resources/cursor-prompts) [SDK overview\ ------------\ \ Choose the right SDK for your application](https://docs.phantom.com/wallet-sdks-overview) [Phantom Portal\ --------------\ \ Set up your app in the Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Developer support\ -----------------\ \ Contact the Phantom developer support team](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) Was this page helpful? YesNo [Cursor AI prompts](https://docs.phantom.com/resources/cursor-prompts) [Domain and transaction warnings](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings) ⌘I --- # Connect - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sdks/react-native-sdk/connect#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation React Native SDK Connect [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Using the Connect modal (recommended)](https://docs.phantom.com/sdks/react-native-sdk/connect#using-the-connect-modal-recommended) * [useConnect hook (manual connection)](https://docs.phantom.com/sdks/react-native-sdk/connect#useconnect-hook-manual-connection) * [Authentication providers](https://docs.phantom.com/sdks/react-native-sdk/connect#authentication-providers) * [Checking connection status](https://docs.phantom.com/sdks/react-native-sdk/connect#checking-connection-status) * [Handling connection errors](https://docs.phantom.com/sdks/react-native-sdk/connect#handling-connection-errors) The Phantom Connect React Native SDK provides hooks for connecting users with OAuth authentication and secure key handling. **Learn about Phantom Connect**: For details about authentication flows, login, account selection, and session management, see the [Phantom Connect](https://docs.phantom.com/phantom-connect) guide. [​](https://docs.phantom.com/sdks/react-native-sdk/connect#using-the-connect-modal-recommended) Using the Connect modal (recommended) ---------------------------------------------------------------------------------------------------------------------------------------- The SDK includes a built-in bottom sheet Connect modal that handles sign-in and wallet connection. Use the `useModal()` hook to open it: Report incorrect code Copy Ask AI import React from "react"; import { View, Button, Text } from "react-native"; import { useModal, useAccounts } from "@phantom/react-native-sdk"; function WalletScreen() { const modal = useModal(); const { isConnected, addresses } = useAccounts(); if (!isConnected) { return ( ); } [​](https://docs.phantom.com/sdks/react-sdk/connect#authentication-providers) Authentication providers --------------------------------------------------------------------------------------------------------- The `connect()` method accepts a `provider` parameter to specify how users should authenticate: Report incorrect code Copy Ask AI // Connect with Google OAuth await connect({ provider: "google" }); // Connect with Apple OAuth await connect({ provider: "apple" }); // Connect directly to the injected Phantom extension await connect({ provider: "injected" }); The `"deeplink"` provider opens the Phantom mobile app on mobile devices. It only appears in the Connect modal when the Phantom extension is not installed. Include it in your `providers` array for mobile support. ### [​](https://docs.phantom.com/sdks/react-sdk/connect#useisextensioninstalled-hook) useIsExtensionInstalled hook The `"injected"` provider directly connects to the user’s Phantom browser extension (not an embedded wallet). Use the `useIsExtensionInstalled` hook to check if the extension is installed: Report incorrect code Copy Ask AI import { useConnect, useIsExtensionInstalled } from "@phantom/react-sdk"; function InjectedConnectButton() { const { connect, isConnecting } = useConnect(); const { isInstalled, isLoading } = useIsExtensionInstalled(); const handleInjectedConnect = async () => { if (isInstalled) { await connect({ provider: "injected" }); } }; if (isLoading) { return
Checking for Phantom extension...
; } if (!isInstalled) { return (

Phantom extension not found.

Install Phantom
); } return ( ); } When to use injected provider: * User wants to use their existing extension wallet directly. * No embedded wallet creation needed. * Direct access to extension accounts and balances. **Account change detection**: When using the `injected` provider, the SDK automatically detects when users switch accounts in their wallet extension and updates the connection state accordingly. Your app will receive updated account information through the `useAccounts()` and `usePhantom()` hooks when account changes occur. [​](https://docs.phantom.com/sdks/react-sdk/connect#core-account-hooks) Core account hooks --------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/react-sdk/connect#useaccounts-hook) useAccounts hook Get connected wallet addresses: Report incorrect code Copy Ask AI import { useAccounts } from "@phantom/react-sdk"; function WalletAddresses() { const addresses = useAccounts(); if (!addresses) { return
Not connected
; } return (
{addresses.map((addr, index) => (
{addr.addressType}: {addr.address}
))}
); } ### [​](https://docs.phantom.com/sdks/react-sdk/connect#usedisconnect-hook) useDisconnect hook Disconnect from a wallet: Report incorrect code Copy Ask AI import { useDisconnect } from "@phantom/react-sdk"; function DisconnectButton() { const { disconnect, isDisconnecting } = useDisconnect(); return ( ); } [​](https://docs.phantom.com/sdks/react-sdk/connect#using-the-connect-modal-recommended) Using the Connect modal (recommended) --------------------------------------------------------------------------------------------------------------------------------- The SDK includes a built-in connection modal that provides a user-friendly interface for connecting to Phantom. Use the `useModal()` hook to control it: Report incorrect code Copy Ask AI import { PhantomProvider, useModal, darkTheme, usePhantom, AddressType } from "@phantom/react-sdk"; function App() { return ( ); } function ConnectButton() { const { open } = useModal(); const { isConnected } = usePhantom(); if (isConnected) { return
Connected!
; } return ; } Modal features: * Multiple sign-in options: Google, Apple, browser extension * Built-in error handling and loading states * Works across devices and environments * Handles the full connection flow and returns a ready-to-use wallet session * Presented as a bottom sheet optimized for mobile interaction [​](https://docs.phantom.com/sdks/react-sdk/connect#using-connectbox-for-auth-callbacks) Using ConnectBox for auth callbacks ------------------------------------------------------------------------------------------------------------------------------- The `ConnectBox` component provides an inline, embedded connection experience that’s perfect for auth callback pages. Unlike the modal, it renders directly in your page flow and automatically handles all OAuth callback states. ![ConnectBox component showing login options](https://mintcdn.com/phantom-e50e2e68/6Jx1knw-O3z4Ex2i/resources/images/phantom-connect/connect-box-component.png?w=2500&fit=max&auto=format&n=6Jx1knw-O3z4Ex2i&q=85&s=01db56344fd01ad8e7d01c00296fd251) ### [​](https://docs.phantom.com/sdks/react-sdk/connect#setting-up-an-auth-callback-page) Setting up an auth callback page When using OAuth providers (Google, Apple), users are redirected to your callback URL after authentication. Use `ConnectBox` on this page to handle the callback flow: Report incorrect code Copy Ask AI // pages/auth/callback.tsx or app/auth/callback/page.tsx import { PhantomProvider, ConnectBox, darkTheme } from "@phantom/react-sdk"; import { AddressType } from "@phantom/browser-sdk"; function AuthCallbackPage() { return (
); } ### [​](https://docs.phantom.com/sdks/react-sdk/connect#connectbox-props) ConnectBox props | Property | Type | Default | Description | | --- | --- | --- | --- | | `maxWidth` | `string \| number` | `"350px"` | Maximum width of the box | | `transparent` | `boolean` | `false` | Removes background, border, and shadow | | `appIcon` | `string` | — | URL to your app icon | | `appName` | `string` | — | Your app name | ### [​](https://docs.phantom.com/sdks/react-sdk/connect#usage-examples) Usage examples Report incorrect code Copy Ask AI import { ConnectBox } from "@phantom/react-sdk"; // Default embedded box // Custom width // Transparent (blends with your page background) // Override app icon and name for this instance ### [​](https://docs.phantom.com/sdks/react-sdk/connect#connectbox-vs-modal) ConnectBox vs modal | Feature | ConnectBox | Modal | | --- | --- | --- | | Rendering | Inline in page flow | Floating overlay | | Close button | No | Yes | | Auth callback handling | Automatic | Manual | | Use case | Auth callback pages, embedded auth | On-demand connection | | Background | Customizable/transparent | Overlay backdrop | **Best practice**: Use `ConnectBox` on your OAuth callback page (`/auth/callback`) to automatically handle the authentication completion flow. The component shows loading states during token exchange and displays any errors clearly. [​](https://docs.phantom.com/sdks/react-sdk/connect#configuration-options) Configuration options --------------------------------------------------------------------------------------------------- Important notes about `redirectUrl`: * Must be an existing page/route in your application. * Must be whitelisted in your Phantom Portal app configuration. * This is where users will be redirected after completing OAuth authentication. * Required for the `google` and `apple` providers. * Not required for the `injected` provider. [​](https://docs.phantom.com/sdks/react-sdk/connect#handling-connection-errors) Handling connection errors ------------------------------------------------------------------------------------------------------------- When a connection fails, the `connect()` promise rejects with an error. Report incorrect code Copy Ask AI import { useConnect } from "@phantom/react-sdk"; function ConnectButton() { const { connect, isConnecting, error } = useConnect(); const handleConnect = async () => { try { const { walletId, addresses } = await connect({ provider: "google" }); // Connection successful console.log("Connected addresses:", addresses); } catch (err) { // Connection failed (user cancelled, network error, etc) console.error("Failed to connect:", err); } }; return ( ); } Was this page helpful? YesNo [Phantom React SDK](https://docs.phantom.com/sdks/react-sdk) [Sign messages](https://docs.phantom.com/sdks/react-sdk/sign-messages) ⌘I --- # Recipes and starter kits - Phantom developer documentation [Skip to main content](https://docs.phantom.com/resources/recipes#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Developer tools Recipes and starter kits [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Overview](https://docs.phantom.com/resources/recipes#overview) * [Official example apps](https://docs.phantom.com/resources/recipes#official-example-apps) * [Community starter kits](https://docs.phantom.com/resources/recipes#community-starter-kits) * [Quick recipes](https://docs.phantom.com/resources/recipes#quick-recipes) * [Connect to Phantom](https://docs.phantom.com/resources/recipes#connect-to-phantom) * [Use the connection modal](https://docs.phantom.com/resources/recipes#use-the-connection-modal) * [Sign a message](https://docs.phantom.com/resources/recipes#sign-a-message) * [Send a transaction](https://docs.phantom.com/resources/recipes#send-a-transaction) * [Multi-chain support](https://docs.phantom.com/resources/recipes#multi-chain-support) * [Need help?](https://docs.phantom.com/resources/recipes#need-help) [​](https://docs.phantom.com/resources/recipes#overview) Overview -------------------------------------------------------------------- Get started quickly with curated starter kits, templates, and example implementations. These resources include production-ready code to help you integrate Phantom wallet functionality into your app. [​](https://docs.phantom.com/resources/recipes#official-example-apps) Official example apps ---------------------------------------------------------------------------------------------- These examples are built and maintained by Phantom. [React SDK demo\ --------------\ \ Full-featured React app demonstrating all SDK capabilities](https://github.com/phantom/wallet-sdk/tree/main/examples/react-sdk-demo-app) [Browser SDK demo\ ----------------\ \ Vanilla JavaScript implementation with complete examples](https://github.com/phantom/wallet-sdk/tree/main/examples/browser-sdk-demo-app) [React Native SDK demo\ ---------------------\ \ Mobile app example with Expo and React Native](https://github.com/phantom/wallet-sdk/tree/main/examples/react-native-sdk-demo-app) [Next.js integration\ -------------------\ \ Complete Next.js app with Phantom SDK integration](https://github.com/phantom/wallet-sdk/tree/main/examples/with-nextjs) [Wagmi integration\ -----------------\ \ Use Phantom alongside Wagmi for enhanced Ethereum support](https://github.com/phantom/wallet-sdk/tree/main/examples/with-wagmi) [View all examples\ -----------------\ \ Browse the complete examples directory on GitHub](https://github.com/phantom/wallet-sdk/tree/main/examples) [​](https://docs.phantom.com/resources/recipes#community-starter-kits) Community starter kits ------------------------------------------------------------------------------------------------ Templates and boilerplates from the Phantom ecosystem. [Browser SDK template\ --------------------\ \ Vite + vanilla JavaScript template for integrating Phantom’s embedded user wallets](https://solana.com/developers/templates/phantom-embedded-js) [React SDK template\ ------------------\ \ Next.js template with Phantom Embedded Wallet SDK for seamless Web3 authentication](https://solana.com/developers/templates/phantom-embedded-react) [React Native SDK template\ -------------------------\ \ Expo starter template for integrating Phantom’s embedded user wallets on mobile](https://solana.com/developers/templates/phantom-embedded-react-native-starter) [​](https://docs.phantom.com/resources/recipes#quick-recipes) Quick recipes ------------------------------------------------------------------------------ Common patterns and code snippets for frequent use cases. ### [​](https://docs.phantom.com/resources/recipes#connect-to-phantom) Connect to Phantom Connect to Phantom wallets using the React SDK: Report incorrect code Copy Ask AI import { PhantomProvider, useConnect } from "@phantom/react-sdk"; import { AddressType } from "@phantom/browser-sdk"; function App() { return ( ); } function ConnectButton() { const { connect, isConnecting } = useConnect(); return ( ); } ### [​](https://docs.phantom.com/resources/recipes#use-the-connection-modal) Use the connection modal Use the built-in connection modal for a user-friendly interface with multiple authentication providers: Report incorrect code Copy Ask AI import { PhantomProvider, useModal, darkTheme, usePhantom } from "@phantom/react-sdk"; import { AddressType } from "@phantom/browser-sdk"; function App() { return ( ); } function WalletComponent() { const { open, close, isOpened } = useModal(); const { isConnected } = usePhantom(); if (isConnected) { return (

Connected

); } return ; } ### [​](https://docs.phantom.com/resources/recipes#sign-a-message) Sign a message Authenticate users by signing a message: Report incorrect code Copy Ask AI import { useSolana } from "@phantom/react-sdk"; function SignMessage() { const { solana } = useSolana(); const handleSign = async () => { const message = "Sign this message to authenticate"; const signature = await solana.signMessage(message); console.log("Signature:", signature); }; return ; } ### [​](https://docs.phantom.com/resources/recipes#send-a-transaction) Send a transaction Sign and send a transaction on Solana: Report incorrect code Copy Ask AI import { useSolana } from "@phantom/react-sdk"; import { Transaction, SystemProgram, PublicKey } from "@solana/web3.js"; function SendTransaction() { const { solana } = useSolana(); const handleSend = async () => { const transaction = new Transaction().add( SystemProgram.transfer({ fromPubkey: new PublicKey("your-address"), toPubkey: new PublicKey("recipient-address"), lamports: 1000000, // 0.001 SOL }) ); const result = await solana.signAndSendTransaction(transaction); console.log("Transaction:", result.hash); }; return ; } ### [​](https://docs.phantom.com/resources/recipes#multi-chain-support) Multi-chain support Connect to multiple chains simultaneously: Report incorrect code Copy Ask AI import { PhantomProvider, useSolana, useEthereum } from "@phantom/react-sdk"; import { AddressType } from "@phantom/browser-sdk"; function MultiChainApp() { return ( ); } function MultiChainOperations() { const { solana } = useSolana(); const { ethereum } = useEthereum(); const signOnSolana = async () => { const sig = await solana.signMessage("Hello Solana!"); console.log("Solana signature:", sig); }; const signOnEthereum = async () => { const accounts = await ethereum.getAccounts(); const sig = await ethereum.signPersonalMessage("Hello Ethereum!", accounts[0]); console.log("Ethereum signature:", sig); }; return (
); } [​](https://docs.phantom.com/resources/recipes#need-help) Need help? ----------------------------------------------------------------------- Can’t find what you’re looking for? Check out these resources: [Documentation\ -------------\ \ Browse the full documentation](https://docs.phantom.com/introduction) [Support\ -------\ \ Contact Phantom developer support](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) [FAQ\ ---\ \ Find answers to common questions](https://docs.phantom.com/resources/faq) Was this page helpful? YesNo [AI-assisted development](https://docs.phantom.com/developer-powertools/ai-tools) [Cursor AI prompts](https://docs.phantom.com/resources/cursor-prompts) ⌘I --- # Cursor AI prompts - Phantom developer documentation [Skip to main content](https://docs.phantom.com/resources/cursor-prompts#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Developer tools Cursor AI prompts [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Overview](https://docs.phantom.com/resources/cursor-prompts#overview) * [React SDK prompt](https://docs.phantom.com/resources/cursor-prompts#react-sdk-prompt) * [React Native SDK prompt](https://docs.phantom.com/resources/cursor-prompts#react-native-sdk-prompt) * [Browser SDK prompt](https://docs.phantom.com/resources/cursor-prompts#browser-sdk-prompt) * [Step-by-step guide for using the prompts](https://docs.phantom.com/resources/cursor-prompts#step-by-step-guide-for-using-the-prompts) * [Need more customization?](https://docs.phantom.com/resources/cursor-prompts#need-more-customization) [​](https://docs.phantom.com/resources/cursor-prompts#overview) Overview --------------------------------------------------------------------------- Use these prompts with [Cursor AI](https://cursor.com/) to quickly implement Phantom wallet integration. Copy the prompt for your preferred SDK and paste it into Cursor to generate a complete, production-ready implementation. For even better results, add the [Phantom MCP server](https://docs.phantom.com/resources/mcp-server) to Cursor. This gives your AI assistant direct access to our documentation for more accurate and contextual help. [​](https://docs.phantom.com/resources/cursor-prompts#react-sdk-prompt) React SDK prompt ------------------------------------------------------------------------------------------- View React SDK prompt Report incorrect code Copy Ask AI Implement Phantom React SDK integration for Solana with the following requirements: INSTALLATION: 1. Install the SDK: npm install @phantom/react-sdk 2. Install Solana dependencies: npm install @solana/web3.js SETUP: 1. Create App.tsx that wraps your application with PhantomProvider: - Import: PhantomProvider, useConnect, useSolana, useAccounts, useDisconnect from "@phantom/react-sdk" - Import: AddressType from "@phantom/browser-sdk" - Configure PhantomProvider with: * providerType: "embedded" * addressTypes: [AddressType.solana] * appId: "[YOUR_APP_ID]" * authOptions: { authUrl: "https://connect.phantom.app/login", redirectUrl: "[YOUR_REDIRECT_URL]" } WALLET CONNECTION COMPONENT: 1. Create a component that uses useConnect() and useAccounts() hooks 2. useConnect() returns: { connect, isConnecting } 3. Call connect() to initiate connection, returns: { addresses } 4. useAccounts() returns the connected Solana addresses array 5. Display "Connect Wallet" button when not connected 6. Display connected Solana address when connected 7. Add a disconnect button using useDisconnect() hook MESSAGE SIGNING COMPONENT: 1. Create component that uses useSolana() hook 2. Get Solana interface: const { solana } = useSolana() 3. Sign message: await solana.signMessage("Your message here") 4. Returns signature object with the signed message 5. Display signature to user in a readable format 6. Add copy-to-clipboard functionality for signature TRANSACTION COMPONENT: 1. Import required Solana libraries: - Import Transaction, SystemProgram, PublicKey from @solana/web3.js 2. Create transfer transaction: - Use SystemProgram.transfer() to create a SOL transfer - Set fromPubkey, toPubkey, and lamports (1 SOL = 1,000,000,000 lamports) 3. Sign and send transaction: - await solana.signAndSendTransaction(transaction) - Returns { hash } with transaction signature 4. Display transaction hash with link to Solana explorer 5. Add input fields for recipient address and amount in SOL 6. Validate inputs before sending REQUIREMENTS: - Use TypeScript with proper types - Add try-catch error handling for all async operations - Show loading states during connection and transactions - Display error messages to users with helpful context - Add null checks before accessing addresses - Style with Tailwind CSS for modern UI - Add helpful comments explaining Solana-specific concepts - Format addresses with truncation (show first 4 and last 4 characters) - Convert lamports to SOL for user display (divide by 1,000,000,000) The SDK automatically handles wallet connection UI, authentication flow, and transaction confirmation. What to replace in the prompt * **\[YOUR\_APP\_ID\]**: Replace with your App ID from [Phantom Portal](https://docs.phantom.com/phantom-portal/get-app-id) * **\[YOUR\_REDIRECT\_URL\]**: Replace with your authentication callback URL (must be allowlisted in Phantom Portal) [​](https://docs.phantom.com/resources/cursor-prompts#react-native-sdk-prompt) React Native SDK prompt --------------------------------------------------------------------------------------------------------- View React Native SDK prompt Report incorrect code Copy Ask AI Implement Phantom React Native SDK integration for Solana mobile apps with the following requirements: INSTALLATION: 1. Install SDK: npm install @phantom/react-native-sdk 2. Install Solana dependency: npm install @solana/web3.js 3. Install peer dependencies: - For Expo: npx expo install expo-secure-store expo-web-browser expo-auth-session expo-router - Required polyfill: npm install react-native-get-random-values POLYFILL SETUP (CRITICAL): Add this import at the VERY TOP of your app entry point (index.js, App.tsx, or _layout.tsx): // MUST be the first import - before any other imports import "react-native-get-random-values"; import { PhantomProvider } from "@phantom/react-native-sdk"; // ... other imports APP CONFIGURATION: Configure app.json with your custom URL scheme: { "expo": { "name": "My Solana Wallet App", "slug": "my-solana-wallet-app", "scheme": "[YOUR_SCHEME]", "plugins": ["expo-router", "expo-secure-store", "expo-web-browser", "expo-auth-session"] } } PROVIDER SETUP: Wrap your app with PhantomProvider in App.tsx or _layout.tsx: import { PhantomProvider, AddressType } from "@phantom/react-native-sdk"; export default function App() { return ( ); } WALLET SCREEN COMPONENT: Create a component using hooks from "@phantom/react-native-sdk": 1. Import: useConnect, useAccounts, useSolana, useDisconnect 2. Use React Native components: View, Button, Text, Alert, StyleSheet from "react-native" 3. Connect flow: - const { connect, isConnecting, error } = useConnect() - await connect({ provider: "google" }) // or "apple" - const { addresses, isConnected } = useAccounts() 4. Display Solana address when connected (truncate for mobile: show first 4 and last 4 chars) 5. Add disconnect button using useDisconnect() 6. Show wallet balance if needed MESSAGE SIGNING: Implement message signing for authentication: - const { solana } = useSolana() - const signature = await solana.signMessage("Sign in to MyApp") - signature.signature contains the signature string - Show success Alert with truncated signature - Use for login or authentication flows TRANSACTION SCREEN: Build a transfer screen with @solana/web3.js: 1. Import Transaction, SystemProgram, PublicKey from @solana/web3.js 2. Create TextInput fields for: - Recipient address (validate it's a valid Solana address) - Amount in SOL (convert to lamports: amount * 1,000,000,000) 3. Build transaction: - Create transfer with SystemProgram.transfer() - Set fromPubkey, toPubkey, lamports 4. Send transaction: - await solana.signAndSendTransaction(transaction) - Returns { hash } with transaction signature 5. Show success Alert with link to Solana Explorer 6. Handle errors with user-friendly messages REQUIREMENTS: - Use TypeScript with proper types - Handle all errors with try-catch and Alert.alert - Show loading states during connection and transactions - Use StyleSheet for component styling - Add pull-to-refresh for balance updates - Format SOL amounts properly (show 2-4 decimal places) - Truncate addresses for mobile display - Add haptic feedback for actions - Test thoroughly on both iOS and Android - Implement proper null checks for addresses - Add helpful comments explaining Solana concepts The SDK handles OAuth flow automatically with system browser and deep link redirect back to your app. What to replace in the prompt * **\[YOUR\_APP\_ID\]**: Replace with your App ID from [Phantom Portal](https://docs.phantom.com/phantom-portal/get-app-id) * **\[YOUR\_SCHEME\]**: Replace with your custom URL scheme (for example, `myapp`) [​](https://docs.phantom.com/resources/cursor-prompts#browser-sdk-prompt) Browser SDK prompt ----------------------------------------------------------------------------------------------- View Browser SDK prompt Report incorrect code Copy Ask AI Implement Phantom Browser SDK integration for Solana with the following requirements: INSTALLATION: 1. Install SDK: npm install @phantom/browser-sdk 2. Install Solana dependency: npm install @solana/web3.js BUILD SETUP: - Use Vite as build tool: npm create vite@latest my-solana-app -- --template vanilla-ts - Configure proper TypeScript settings SDK INITIALIZATION (phantom.ts): Create a module that initializes and exports the SDK: import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; export const sdk = new BrowserSDK({ providerType: "embedded", addressTypes: [AddressType.solana], appId: "[YOUR_APP_ID]", authOptions: { authUrl: "https://connect.phantom.app/login", redirectUrl: "[YOUR_REDIRECT_URL]", }, }); MAIN APPLICATION (main.ts): 1. Import the SDK instance 2. Set up DOM elements and event listeners 3. Implement wallet connection: - Call sdk.connect() which returns { addresses } - Display connected Solana address in UI - Store address in state variable 4. Implement disconnect: - Call sdk.disconnect() - Clear address from state - Update UI to show disconnected state MESSAGE SIGNING: Implement message signing for authentication: const message = "Sign in to MyApp"; const signature = await sdk.solana.signMessage(message); console.log("Signature:", signature); // Display signature in UI // Can be used for server-side verification TRANSACTIONS: Build SOL transfer functionality: import { Transaction, SystemProgram, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js"; // Get amount in SOL from user input const solAmount = parseFloat(amountInput.value); const lamports = solAmount * LAMPORTS_PER_SOL; // Create transaction const transaction = new Transaction().add( SystemProgram.transfer({ fromPubkey: new PublicKey(connectedAddress), toPubkey: new PublicKey(recipientAddress), lamports: lamports, }) ); // Sign and send const result = await sdk.solana.signAndSendTransaction(transaction); console.log("Transaction signature:", result.hash); // Show success with link to Solana Explorer const explorerUrl = `https://explorer.solana.com/tx/${result.hash}`; WALLET BALANCE: Display user's SOL balance: // Fetch balance using Solana web3.js Connection // Format as SOL (divide lamports by LAMPORTS_PER_SOL) // Update on connection and after transactions HTML STRUCTURE: Create index.html with clean sections: - Header with app title and network selector - Connect/Disconnect button (style differently based on state) - Connected address display (truncated with copy button) - Wallet balance display in SOL - Message signing section: * Text input for message * Sign button * Signature display area - Transaction section: * Input for recipient address (validate format) * Input for amount in SOL * Send button * Transaction status display - Use Tailwind CSS for modern, responsive styling REQUIREMENTS: - Use TypeScript with strict mode enabled - Add try-catch error handling for all SDK calls - Display user-friendly error messages in UI - Show loading spinners during async operations - Add null checks before accessing addresses - Update UI reactively based on connection state - Format addresses (show first 4 and last 4 characters) - Format SOL amounts with proper decimals - Add copy-to-clipboard functionality for addresses and signatures - Include helpful comments explaining Solana concepts - Validate user inputs before transactions - Use modern JavaScript (async/await, optional chaining, nullish coalescing) The SDK automatically handles authentication UI, wallet selection, and transaction confirmation. What to replace in the prompt * **\[YOUR\_APP\_ID\]**: Replace with your App ID from [Phantom Portal](https://docs.phantom.com/phantom-portal/get-app-id) * **\[YOUR\_REDIRECT\_URL\]**: Replace with your authentication callback URL (must be allowlisted in Phantom Portal) [​](https://docs.phantom.com/resources/cursor-prompts#step-by-step-guide-for-using-the-prompts) Step-by-step guide for using the prompts ------------------------------------------------------------------------------------------------------------------------------------------- 1 [](https://docs.phantom.com/resources/cursor-prompts#) Get your App ID Make sure you have your App ID from [Phantom Portal](https://docs.phantom.com/phantom-portal/get-app-id) before using any prompt. 2 [](https://docs.phantom.com/resources/cursor-prompts#) Customize the prompt Replace placeholder values such as `[YOUR_APP_ID]`, `[YOUR_REDIRECT_URL]`, and `[YOUR_SCHEME]` with your actual values. 3 [](https://docs.phantom.com/resources/cursor-prompts#) Paste into Cursor Open Cursor AI, press `Cmd+K` (or `Ctrl+K` on Windows), and paste the complete prompt. 4 [](https://docs.phantom.com/resources/cursor-prompts#) Review the generated code Cursor will generate a full implementation. Review the code to ensure it meets your requirements. 5 [](https://docs.phantom.com/resources/cursor-prompts#) Test the integration Run your application and test wallet connection, message signing, and transaction flows. Phantom Connect manages authentication using social login through Google or Apple. [​](https://docs.phantom.com/resources/cursor-prompts#need-more-customization) Need more customization? ---------------------------------------------------------------------------------------------------------- These prompts generate a complete, ready-to-use integration. For deeper feature support, refer to the SDK documentation. [React SDK docs\ --------------\ \ Explore React SDK features and hooks](https://docs.phantom.com/sdks/react-sdk/index) [React Native SDK docs\ ---------------------\ \ Review React Native SDK capabilities](https://docs.phantom.com/sdks/react-native-sdk/index) [Browser SDK docs\ ----------------\ \ Learn about Browser SDK features](https://docs.phantom.com/sdks/browser-sdk/index) [Developer support\ -----------------\ \ Contact the Phantom developer support team](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) Was this page helpful? YesNo [Recipes and starter kits](https://docs.phantom.com/resources/recipes) [MCP server](https://docs.phantom.com/resources/mcp-server) ⌘I --- # FAQ - Phantom developer documentation [Skip to main content](https://docs.phantom.com/resources/faq#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Resources FAQ [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Phantom Connect and SDKs](https://docs.phantom.com/resources/faq#phantom-connect-and-sdks) * [What is Phantom Connect?](https://docs.phantom.com/resources/faq#what-is-phantom-connect) * [What’s the difference between embedded and extension wallets?](https://docs.phantom.com/resources/faq#what%E2%80%99s-the-difference-between-embedded-and-extension-wallets) * [Which SDK should I use?](https://docs.phantom.com/resources/faq#which-sdk-should-i-use) * [Do I need to set up Phantom Portal?](https://docs.phantom.com/resources/faq#do-i-need-to-set-up-phantom-portal) * [Which blockchains does Phantom Connect support?](https://docs.phantom.com/resources/faq#which-blockchains-does-phantom-connect-support) * [Can users connect with both social login and extension?](https://docs.phantom.com/resources/faq#can-users-connect-with-both-social-login-and-extension) * [Browser extension integration](https://docs.phantom.com/resources/faq#browser-extension-integration) * [Why can’t I access Phantom on my website?](https://docs.phantom.com/resources/faq#why-can%E2%80%99t-i-access-phantom-on-my-website) * [Are hardware wallets supported?](https://docs.phantom.com/resources/faq#are-hardware-wallets-supported) * [Tokens and NFTs](https://docs.phantom.com/resources/faq#tokens-and-nfts) * [Why isn’t my token displaying properly?](https://docs.phantom.com/resources/faq#why-isn%E2%80%99t-my-token-displaying-properly) * [What types of NFTs are supported?](https://docs.phantom.com/resources/faq#what-types-of-nfts-are-supported) * [Wallet behavior](https://docs.phantom.com/resources/faq#wallet-behavior) * [How does Phantom import wallet addresses?](https://docs.phantom.com/resources/faq#how-does-phantom-import-wallet-addresses) * [Why does Phantom prepend an additional instruction on standard SPL token transfers?](https://docs.phantom.com/resources/faq#why-does-phantom-prepend-an-additional-instruction-on-standard-spl-token-transfers) * [Troubleshooting](https://docs.phantom.com/resources/faq#troubleshooting) * [Why am I seeing a “new domain” warning?](https://docs.phantom.com/resources/faq#why-am-i-seeing-a-%E2%80%9Cnew-domain%E2%80%9D-warning) * [Why is my transaction showing a security warning?](https://docs.phantom.com/resources/faq#why-is-my-transaction-showing-a-security-warning) * [How do I debug my app in Phantom’s mobile browser?](https://docs.phantom.com/resources/faq#how-do-i-debug-my-app-in-phantom%E2%80%99s-mobile-browser) * [Need more help?](https://docs.phantom.com/resources/faq#need-more-help) [​](https://docs.phantom.com/resources/faq#phantom-connect-and-sdks) Phantom Connect and SDKs ------------------------------------------------------------------------------------------------ ### [​](https://docs.phantom.com/resources/faq#what-is-phantom-connect) What is Phantom Connect? Phantom Connect is the recommended way to integrate Phantom into your app. It provides a unified authentication experience using social login (Google or Apple) or browser extension connection. Phantom Connect is available through our SDKs: * [React SDK](https://docs.phantom.com/sdks/react-sdk/index) for React web apps * [React Native SDK](https://docs.phantom.com/sdks/react-native-sdk/index) for mobile apps * [Browser SDK](https://docs.phantom.com/sdks/browser-sdk/index) for vanilla JavaScript ### [​](https://docs.phantom.com/resources/faq#what%E2%80%99s-the-difference-between-embedded-and-extension-wallets) What’s the difference between embedded and extension wallets? **Embedded wallets** are created through Phantom Connect using social login (Google or Apple). Users don’t need to install any browser extension—the wallet is managed by Phantom and accessible across devices. **Extension wallets** are traditional self-custody wallets where users install the Phantom browser extension or mobile app and manage their own recovery phrase. Phantom Connect supports both. Set `providerType: "embedded"` for embedded wallets or `providerType: "extension"` to connect to installed Phantom wallets. ### [​](https://docs.phantom.com/resources/faq#which-sdk-should-i-use) Which SDK should I use? | Your app type | Recommended SDK | | --- | --- | | React web app | [React SDK](https://docs.phantom.com/sdks/react-sdk/index) | | Next.js app | [React SDK](https://docs.phantom.com/sdks/react-sdk/index) | | React Native / Expo mobile app | [React Native SDK](https://docs.phantom.com/sdks/react-native-sdk/index) | | Vanilla JavaScript / other frameworks | [Browser SDK](https://docs.phantom.com/sdks/browser-sdk/index) | ### [​](https://docs.phantom.com/resources/faq#do-i-need-to-set-up-phantom-portal) Do I need to set up Phantom Portal? Yes. Before using any Phantom Connect SDK, you need to: 1. [Create an account](https://docs.phantom.com/phantom-portal/create-account) in Phantom Portal 2. [Create an app](https://docs.phantom.com/phantom-portal/create-app) and configure your branding 3. [Verify your domain](https://docs.phantom.com/phantom-portal/verify-domain) 4. [Get your App ID](https://docs.phantom.com/phantom-portal/get-app-id) ### [​](https://docs.phantom.com/resources/faq#which-blockchains-does-phantom-connect-support) Which blockchains does Phantom Connect support? Phantom Connect supports **Solana**, **Ethereum**, **Base**, **Polygon**, **Bitcoin**, and **Sui**. You can enable multiple chains simultaneously by configuring `addressTypes` in your SDK setup. ### [​](https://docs.phantom.com/resources/faq#can-users-connect-with-both-social-login-and-extension) Can users connect with both social login and extension? Yes. Phantom Connect handles both authentication methods. When a user connects, they can choose to sign in with Google/Apple (embedded wallet) or connect their existing Phantom extension wallet. [​](https://docs.phantom.com/resources/faq#browser-extension-integration) Browser extension integration ---------------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/resources/faq#why-can%E2%80%99t-i-access-phantom-on-my-website) Why can’t I access Phantom on my website? Phantom will only [inject its provider](https://docs.phantom.com/solana/detecting-the-provider) into websites that begin with `https://`, or if the host is `localhost` or `127.0.0.1`. If your website only uses `http://`, Phantom will not inject its provider and you will not be able to access the methods found at `window.phantom`. Encrypting your web traffic and upgrading to `https://` will restore functionality. Phantom will also not inject its provider into any [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) . For new integrations, we recommend using [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) instead of directly accessing the browser extension provider. The SDKs handle provider detection, connection state, and authentication automatically. ### [​](https://docs.phantom.com/resources/faq#are-hardware-wallets-supported) Are hardware wallets supported? Yes, Phantom currently supports [Ledger](https://www.ledger.com/) hardware wallets and requires no special treatment on the application side. [​](https://docs.phantom.com/resources/faq#tokens-and-nfts) Tokens and NFTs ------------------------------------------------------------------------------ ### [​](https://docs.phantom.com/resources/faq#why-isn%E2%80%99t-my-token-displaying-properly) Why isn’t my token displaying properly? Phantom supports the [Token Metadata Standard](https://developers.metaplex.com/token-metadata/token-standard) established by [Metaplex](https://www.metaplex.com/) . When displaying tokens, Phantom will first [categorize](https://docs.phantom.com/best-practices/tokens/README) them according to their [TokenStandard](https://developers.metaplex.com/token-metadata/token-standard) . If a token is considered `Fungible`, Phantom will display it on the [Home tab](https://docs.phantom.com/best-practices/tokens/home-tab-fungibles) . Otherwise, Phantom will display it as a [Collectible](https://docs.phantom.com/best-practices/tokens/collectibles-nfts-and-semi-fungibles) . For more details, see [Token Display documentation](https://docs.phantom.com/best-practices/tokens/README) . ### [​](https://docs.phantom.com/resources/faq#what-types-of-nfts-are-supported) What types of NFTs are supported? Phantom supports a range of NFT media types including images, audio files, video files, and 3D models. At this time, Phantom does not support HTML files. For a full list of the types of NFTs that Phantom can display, see [Supported media types](https://docs.phantom.com/best-practices/tokens/supported-media-types) . [​](https://docs.phantom.com/resources/faq#wallet-behavior) Wallet behavior ------------------------------------------------------------------------------ ### [​](https://docs.phantom.com/resources/faq#how-does-phantom-import-wallet-addresses) How does Phantom import wallet addresses? When importing addresses from an existing recovery phrase (also known as a seed phrase), Phantom will scan for 20 addresses in each of our three supported derivation paths (`bip44change`, `bip44`, and a deprecated path), for a total of 60 addresses. For the convenience of the user, Phantom will filter this list of addresses down to wallets that have ever had signatures (have ever been used). Phantom will then sort this filtered list based on how many signatures each wallet has had plus the amount of [lamports](https://docs.solana.com/terminology#lamport) it currently owns. ### [​](https://docs.phantom.com/resources/faq#why-does-phantom-prepend-an-additional-instruction-on-standard-spl-token-transfers) Why does Phantom prepend an additional instruction on standard SPL token transfers? When transferring SPL tokens, Phantom will first double check if a token account exists for the recipient you are sending to. If one does not exist, Phantom will help you create an Associated Token Account on the recipient’s behalf. To do this check, Phantom calls a deployment of the [Serum Assert Owner](https://github.com/project-serum/serum-dex/tree/6138ca98280f6433deecde560f3d23cc4a749bae/assert-owner) program. The program address of this deployment is `DeJBGdMFa1uynnnKiwrVioatTuHmNLpyFKnmB5kaFdzQ` and is available on Solana’s Devnet, Testnet, and Mainnet. This program has been in use since 2021. It was deployed by the Phantom team to keep this program address consistent across networks. [​](https://docs.phantom.com/resources/faq#troubleshooting) Troubleshooting ------------------------------------------------------------------------------ ### [​](https://docs.phantom.com/resources/faq#why-am-i-seeing-a-%E2%80%9Cnew-domain%E2%80%9D-warning) Why am I seeing a “new domain” warning? When your app or website is newly launched, Phantom may show users a warning that the domain is new or has not been reviewed. This warning typically disappears automatically after a few days. If the warning persists for more than a week, see [Domain and transaction warnings](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings) for next steps. ### [​](https://docs.phantom.com/resources/faq#why-is-my-transaction-showing-a-security-warning) Why is my transaction showing a security warning? If Phantom can’t accurately simulate a transaction, users may see a warning message. This can happen when: * The transaction has multiple signers * The transaction approaches Solana’s size limit * The transaction would fail during simulation See [Domain and transaction warnings](https://docs.phantom.com/developer-powertools/domain-and-transaction-warnings) for detailed guidance on resolving these warnings. ### [​](https://docs.phantom.com/resources/faq#how-do-i-debug-my-app-in-phantom%E2%80%99s-mobile-browser) How do I debug my app in Phantom’s mobile browser? You can debug mobile web apps using your desktop browser’s developer tools. See [Mobile web debugging](https://docs.phantom.com/developer-powertools/mobile-web-debugging) for step-by-step instructions for iOS and Android. [​](https://docs.phantom.com/resources/faq#need-more-help) Need more help? ----------------------------------------------------------------------------- [Developer support\ -----------------\ \ Contact Phantom developer support](https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform) [Developer announcements\ -----------------------\ \ Join our Telegram for updates](https://t.me/+R0vUw_QWSO9lNjlh) Was this page helpful? YesNo [Make your token appear as verified](https://docs.phantom.com/best-practices/tokens/token-verification) [Demo apps](https://docs.phantom.com/resources/sandbox) ⌘I --- # Browser SDK - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sdks/browser-sdk#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation Browser SDK Browser SDK [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Quick start](https://docs.phantom.com/sdks/browser-sdk#quick-start) * [Features](https://docs.phantom.com/sdks/browser-sdk#features) * [Security](https://docs.phantom.com/sdks/browser-sdk#security) * [Prerequisites](https://docs.phantom.com/sdks/browser-sdk#prerequisites) * [Authentication providers](https://docs.phantom.com/sdks/browser-sdk#authentication-providers) * [Available providers](https://docs.phantom.com/sdks/browser-sdk#available-providers) * [Configuration examples](https://docs.phantom.com/sdks/browser-sdk#configuration-examples) * [Installation](https://docs.phantom.com/sdks/browser-sdk#installation) * [Quick start](https://docs.phantom.com/sdks/browser-sdk#quick-start-2) * [Injected provider (browser extension)](https://docs.phantom.com/sdks/browser-sdk#injected-provider-browser-extension) * [Embedded provider (multiple auth methods)](https://docs.phantom.com/sdks/browser-sdk#embedded-provider-multiple-auth-methods) * [Chain-specific APIs](https://docs.phantom.com/sdks/browser-sdk#chain-specific-apis) * [Solana chain (sdk.solana)](https://docs.phantom.com/sdks/browser-sdk#solana-chain-sdk-solana) * [Ethereum chain (sdk.ethereum)](https://docs.phantom.com/sdks/browser-sdk#ethereum-chain-sdk-ethereum) * [Auto-Confirm (injected provider only)](https://docs.phantom.com/sdks/browser-sdk#auto-confirm-injected-provider-only) * [Extension detection](https://docs.phantom.com/sdks/browser-sdk#extension-detection) * [Wallet discovery](https://docs.phantom.com/sdks/browser-sdk#wallet-discovery) * [Discover wallets](https://docs.phantom.com/sdks/browser-sdk#discover-wallets) * [Get discovered wallets](https://docs.phantom.com/sdks/browser-sdk#get-discovered-wallets) * [Event handlers](https://docs.phantom.com/sdks/browser-sdk#event-handlers) * [Available events](https://docs.phantom.com/sdks/browser-sdk#available-events) * [Using events with autoConnect](https://docs.phantom.com/sdks/browser-sdk#using-events-with-autoconnect) * [Debug configuration](https://docs.phantom.com/sdks/browser-sdk#debug-configuration) * [Debug levels](https://docs.phantom.com/sdks/browser-sdk#debug-levels) * [Available AddressType values](https://docs.phantom.com/sdks/browser-sdk#available-addresstype-values) * [What you can do](https://docs.phantom.com/sdks/browser-sdk#what-you-can-do) * [Starter kits and examples](https://docs.phantom.com/sdks/browser-sdk#starter-kits-and-examples) * [Additional resources](https://docs.phantom.com/sdks/browser-sdk#additional-resources) The Phantom Connect Browser SDK provides a framework-agnostic JavaScript/TypeScript interface for connecting to existing Phantom user wallets in web apps. ### [​](https://docs.phantom.com/sdks/browser-sdk#quick-start) Quick start Generate a new Solana project using the **Phantom Embedded JS Starter** template. * npm * pnpm * yarn * bun Report incorrect code Copy Ask AI npx -y create-solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-js Report incorrect code Copy Ask AI pnpm create solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-js Report incorrect code Copy Ask AI yarn create solana-dapp -t solana-foundation/templates/community/phantom-embedded-js Report incorrect code Copy Ask AI bun create solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-js Run the command above in your terminal to get started. [View template on Solana Templates →](https://solana.com/developers/templates/phantom-embedded-js) * * * [​](https://docs.phantom.com/sdks/browser-sdk#features) Features ------------------------------------------------------------------- * **Non-custodial**: Full user control of private keys for both injected and embedded wallets. * **Dual provider support**: Works with Phantom browser extension or creates embedded wallets. * **Chain-specific APIs**: Dedicated interfaces for Solana and Ethereum operations. * **Native transactions**: Work with blockchain-native objects, not base64url strings. * **Multi-chain**: Solana and Ethereum support with dedicated methods. * **TypeScript**: Full type safety for all transaction formats. * **Unified API**: Same interface for both injected and embedded providers. * **Multiple auth methods**: Google, Apple, and browser extension. [​](https://docs.phantom.com/sdks/browser-sdk#security) Security ------------------------------------------------------------------- The Phantom Connect Browser SDK connects to existing Phantom user wallets, ensuring: * Users control their own wallets and private keys. * Users maintain full control of their assets. * Integration with Phantom’s secure wallet infrastructure. * No private key handling in your app. [​](https://docs.phantom.com/sdks/browser-sdk#prerequisites) Prerequisites ----------------------------------------------------------------------------- * Register your app: Sign up or log in to the [Phantom Portal](https://phantom.com/portal/) and register your app. * Obtain your App ID: * In Phantom Portal, expand your app in the left navigation, then select **Set Up**. * Your App ID appears at the top of the page. * Allowlist your domains and redirect URLs: Add your app’s domains and redirect URLs in the Phantom Portal to enable wallet connections. [​](https://docs.phantom.com/sdks/browser-sdk#authentication-providers) Authentication providers --------------------------------------------------------------------------------------------------- The SDK supports multiple authentication providers that you configure via the `providers` array: ### [​](https://docs.phantom.com/sdks/browser-sdk#available-providers) Available providers | Provider | Description | Requires appId | | --- | --- | --- | | `"injected"` | Phantom browser extension | No | | `"google"` | Google OAuth | Yes | | `"apple"` | Apple ID | Yes | | `"deeplink"` | Deeplink to Phantom mobile app (mobile devices only) | Yes | ### [​](https://docs.phantom.com/sdks/browser-sdk#configuration-examples) Configuration examples **Injected provider only (browser extension)** Report incorrect code Copy Ask AI const sdk = new BrowserSDK({ providers: ["injected"], // Only allow browser extension addressTypes: [AddressType.solana, AddressType.ethereum], }); **Multiple authentication methods** Report incorrect code Copy Ask AI const sdk = new BrowserSDK({ providers: ["google", "apple", "injected", "deeplink"], // Allow all methods addressTypes: [AddressType.solana, AddressType.ethereum], appId: "your-app-id", // Required for embedded providers authOptions: { authUrl: "https://connect.phantom.app/login", // optional redirectUrl: "https://yourapp.com/callback", // optional, defaults to current page }, autoConnect: true, // optional, auto-connect to existing session }); **Mobile deeplink support** The `"deeplink"` provider enables a button that opens the Phantom mobile app on mobile devices. This option only appears when the Phantom browser extension is not installed. When clicked, it redirects users to the Phantom mobile app to complete authentication. Report incorrect code Copy Ask AI const sdk = new BrowserSDK({ providers: ["google", "apple", "deeplink"], // Include deeplink for mobile support addressTypes: [AddressType.solana, AddressType.ethereum], appId: "your-app-id", }); Notes about `redirectUrl`: * Must be an existing page/route in your app. * Must be allowlisted in your Phantom Portal app configuration. * This is where users will be redirected after completing OAuth authentication. [​](https://docs.phantom.com/sdks/browser-sdk#installation) Installation --------------------------------------------------------------------------- Report incorrect code Copy Ask AI npm install @phantom/browser-sdk [​](https://docs.phantom.com/sdks/browser-sdk#quick-start-2) Quick start --------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/browser-sdk#injected-provider-browser-extension) Injected provider (browser extension) Report incorrect code Copy Ask AI import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; // Connect to Phantom browser extension const sdk = new BrowserSDK({ providers: ["injected"], // Only allow browser extension addressTypes: [AddressType.solana, AddressType.ethereum], }); const { addresses } = await sdk.connect({ provider: "injected" }); console.log("Connected addresses:", addresses); // Chain-specific operations const message = "Hello from Phantom!"; const solanaSignature = await sdk.solana.signMessage(message); // Encode the message as hex for EVM const encoded = "0x" + Buffer.from(message, "utf8").toString("hex"); const ethSignature = await sdk.ethereum.signPersonalMessage(encoded, addresses[1].address); ### [​](https://docs.phantom.com/sdks/browser-sdk#embedded-provider-multiple-auth-methods) Embedded provider (multiple auth methods) Report incorrect code Copy Ask AI import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; // Create embedded non-custodial wallet with multiple auth providers const sdk = new BrowserSDK({ providers: ["google", "apple"], // Allow Google and Apple OAuth addressTypes: [AddressType.solana, AddressType.ethereum], appId: "your-app-id", // Get your app ID from phantom.com/portal }); const { addresses } = await sdk.connect({ provider: "google" }); console.log("Addresses:", addresses); // Use chain-specific APIs const solanaResult = await sdk.solana.signAndSendTransaction(mySolanaTransaction); const ethResult = await sdk.ethereum.sendTransaction(myEthTransaction); [​](https://docs.phantom.com/sdks/browser-sdk#chain-specific-apis) Chain-specific APIs ----------------------------------------------------------------------------------------- The SDK provides separate interfaces for each blockchain with optimized methods: ### [​](https://docs.phantom.com/sdks/browser-sdk#solana-chain-sdk-solana) Solana chain (sdk.solana) Report incorrect code Copy Ask AI // Message signing const signature = await sdk.solana.signMessage("Hello Solana!"); // Transaction signing (without sending) const signedTx = await sdk.solana.signTransaction(transaction); // Sign and send transaction const result = await sdk.solana.signAndSendTransaction(transaction); // Network switching await sdk.solana.switchNetwork('devnet'); // Utilities const publicKey = await sdk.solana.getPublicKey(); const isConnected = sdk.solana.isConnected(); ### [​](https://docs.phantom.com/sdks/browser-sdk#ethereum-chain-sdk-ethereum) Ethereum chain (sdk.ethereum) EVM support for Phantom Connect embedded wallets will go live later in 2026. Report incorrect code Copy Ask AI // EIP-1193 requests const accounts = await sdk.ethereum.request({ method: 'eth_accounts' }); const chainId = await sdk.ethereum.request({ method: 'eth_chainId' }); // Message signing const signature = await sdk.ethereum.signPersonalMessage(message, address); // EIP-712 typed data signing const typedDataSignature = await sdk.ethereum.signTypedData(typedData, address); // Transaction sending const result = await sdk.ethereum.sendTransaction({ to: "0x...", value: "1000000000000000000", // 1 ETH in wei gas: "21000", }); // Network switching await sdk.ethereum.switchChain(1); // Ethereum mainnet await sdk.ethereum.switchChain(137); // Polygon // Utilities const chainId = await sdk.ethereum.getChainId(); const accounts = await sdk.ethereum.getAccounts(); const isConnected = sdk.ethereum.isConnected(); **Supported EVM Networks:** | Network | Chain ID | Usage | | --- | --- | --- | | Ethereum Mainnet | `1` | `ethereum.switchChain(1)` | | Ethereum Sepolia | `11155111` | `ethereum.switchChain(11155111)` | | Polygon Mainnet | `137` | `ethereum.switchChain(137)` | | Polygon Amoy | `80002` | `ethereum.switchChain(80002)` | | Base Mainnet | `8453` | `ethereum.switchChain(8453)` | | Base Sepolia | `84532` | `ethereum.switchChain(84532)` | | Arbitrum One | `42161` | `ethereum.switchChain(42161)` | | Arbitrum Sepolia | `421614` | `ethereum.switchChain(421614)` | | Monad Mainnet | `143` | `ethereum.switchChain(143)` | | Monad Testnet | `10143` | `ethereum.switchChain(10143)` | [​](https://docs.phantom.com/sdks/browser-sdk#auto-confirm-injected-provider-only) Auto-Confirm (injected provider only) --------------------------------------------------------------------------------------------------------------------------- The SDK provides Auto-Confirm functionality that allows automatic transaction confirmation for specified chains. This feature is only available when using the injected provider (Phantom browser extension). Report incorrect code Copy Ask AI import { NetworkId } from "@phantom/browser-sdk"; // Enable auto-confirm for specific chains const result = await sdk.enableAutoConfirm({ chains: [NetworkId.SOLANA_MAINNET, NetworkId.ETHEREUM_MAINNET] }); // Enable auto-confirm for all supported chains const result = await sdk.enableAutoConfirm(); // Disable auto-confirm await sdk.disableAutoConfirm(); // Get current status const status = await sdk.getAutoConfirmStatus(); // Get supported chains for auto-confirm const supportedChains = await sdk.getSupportedAutoConfirmChains(); Auto-confirm methods are only available for injected providers (Phantom browser extension). Calling these methods on embedded providers will throw an error. [​](https://docs.phantom.com/sdks/browser-sdk#extension-detection) Extension detection ----------------------------------------------------------------------------------------- The SDK provides functions to check if the Phantom extension is installed: Report incorrect code Copy Ask AI import { waitForPhantomExtension } from "@phantom/browser-sdk"; // Check if Phantom extension is available (with optional timeout in ms) const isAvailable = await waitForPhantomExtension(5000); if (isAvailable) { console.log("Phantom extension is available!"); } else { console.log("Phantom extension not found"); } [​](https://docs.phantom.com/sdks/browser-sdk#wallet-discovery) Wallet discovery ----------------------------------------------------------------------------------- The SDK can discover multiple injected wallets using Wallet Standard for Solana and EIP-6963 for Ethereum. This allows users to choose from any installed wallet that supports the configured address types. ### [​](https://docs.phantom.com/sdks/browser-sdk#discover-wallets) Discover wallets Asynchronously discover all available injected wallets: Report incorrect code Copy Ask AI // Discover wallets asynchronously const wallets = await sdk.discoverWallets(); console.log("Discovered wallets:", wallets); // Example output: // [\ // {\ // id: "backpack",\ // name: "Backpack",\ // icon: "https://backpack.app/icon.png",\ // addressTypes: [AddressType.solana],\ // chains: ["solana:mainnet", "solana:devnet"]\ // },\ // {\ // id: "metamask-io",\ // name: "MetaMask",\ // icon: "https://metamask.io/icon.png",\ // addressTypes: [AddressType.ethereum],\ // chains: ["eip155:1", "eip155:5", "eip155:11155111"]\ // }\ // ] ### [​](https://docs.phantom.com/sdks/browser-sdk#get-discovered-wallets) Get discovered wallets Get wallets from the internal registry (synchronous): Report incorrect code Copy Ask AI // Get already discovered wallets const wallets = sdk.getDiscoveredWallets(); [​](https://docs.phantom.com/sdks/browser-sdk#event-handlers) Event handlers ------------------------------------------------------------------------------- Report incorrect code Copy Ask AI import { BrowserSDK, AddressType } from "@phantom/browser-sdk"; const sdk = new BrowserSDK({ providers: ["google", "apple"], appId: "your-app-id", addressTypes: [AddressType.solana], }); // Fired when connection starts sdk.on("connect_start", (data) => { console.log("Connection starting:", data.source); // "auto-connect" | "manual-connect" }); // Fired when connection succeeds sdk.on("connect", (data) => { console.log("Connected successfully!"); console.log("Provider type:", data.provider); console.log("Addresses:", data.addresses); console.log("Status:", data.status); }); // Fired when connection fails sdk.on("connect_error", (data) => { console.error("Connection failed:", data.error); console.log("Source:", data.source); }); // Fired when disconnected sdk.on("disconnect", (data) => { console.log("Disconnected from wallet"); }); // Remove listeners when done sdk.off("connect", handleConnect); ### [​](https://docs.phantom.com/sdks/browser-sdk#available-events) Available events | Event | When fired | Key data | | --- | --- | --- | | `connect_start` | Connection initiated | `source`, `authOptions` | | `connect` | Connection successful | `provider`, `addresses`, `status`, `source` | | `connect_error` | Connection failed | `error`, `source` | | `disconnect` | Disconnected | `source` | | `error` | General SDK errors | Error details | ### [​](https://docs.phantom.com/sdks/browser-sdk#using-events-with-autoconnect) Using events with autoConnect Report incorrect code Copy Ask AI const sdk = new BrowserSDK({ providers: ["google", "apple"], appId: "your-app-id", addressTypes: [AddressType.solana], autoConnect: true, }); // Set up event listeners BEFORE autoConnect sdk.on("connect", (data) => { console.log("Auto-connected successfully!"); updateUIWithAddresses(data.addresses); }); sdk.on("connect_error", (data) => { console.log("Auto-connect failed:", data.error); showConnectButton(); }); // Auto-connect will trigger events await sdk.autoConnect(); [​](https://docs.phantom.com/sdks/browser-sdk#debug-configuration) Debug configuration ----------------------------------------------------------------------------------------- The SDK provides dynamic debug configuration that can be changed at runtime: Report incorrect code Copy Ask AI import { DebugLevel } from "@phantom/browser-sdk"; // Enable debug logging sdk.enableDebug(); // Disable debug logging sdk.disableDebug(); // Set debug level sdk.setDebugLevel(DebugLevel.INFO); // Set debug callback function sdk.setDebugCallback((message) => { console.log(`[${message.category}] ${message.message}`, message.data); }); // Configure all debug settings at once sdk.configureDebug({ enabled: true, level: DebugLevel.DEBUG, callback: (message) => { console.log(`[${message.level}] ${message.category}: ${message.message}`); }, }); ### [​](https://docs.phantom.com/sdks/browser-sdk#debug-levels) Debug levels | Level | Value | Description | | --- | --- | --- | | `DebugLevel.ERROR` | 0 | Only error messages | | `DebugLevel.WARN` | 1 | Warning and error messages | | `DebugLevel.INFO` | 2 | Info, warning, and error messages | | `DebugLevel.DEBUG` | 3 | All debug messages (most verbose) | [​](https://docs.phantom.com/sdks/browser-sdk#available-addresstype-values) Available AddressType values ----------------------------------------------------------------------------------------------------------- | AddressType | Supported chains | | --- | --- | | `AddressType.solana` | Solana Mainnet, Devnet, Testnet | | `AddressType.ethereum` | Ethereum, Polygon, Arbitrum, and more | [​](https://docs.phantom.com/sdks/browser-sdk#what-you-can-do) What you can do --------------------------------------------------------------------------------- [Connect to wallets\ ------------------\ \ Learn how to connect to Phantom embeded wallet with vanilla JavaScript](https://docs.phantom.com/sdks/browser-sdk/connect) [Sign messages\ -------------\ \ Implement message signing for authentication and verification](https://docs.phantom.com/sdks/browser-sdk/sign-messages) [Sign and send transactions\ --------------------------\ \ Handle transaction signing and broadcasting across blockchains](https://docs.phantom.com/sdks/browser-sdk/sign-and-send-transaction) [​](https://docs.phantom.com/sdks/browser-sdk#starter-kits-and-examples) Starter kits and examples ----------------------------------------------------------------------------------------------------- Framework-agnostic JavaScript examples and templates: [Browser SDK demo app\ --------------------\ \ Full-featured vanilla JavaScript example with all SDK features](https://github.com/phantom/wallet-sdk/tree/main/examples/browser-sdk-demo-app) [All examples\ ------------\ \ Browse all example apps on GitHub](https://github.com/phantom/wallet-sdk/tree/main/examples) [Code recipes\ ------------\ \ Code snippets and implementation patterns](https://docs.phantom.com/resources/recipes) [Interactive sandbox\ -------------------\ \ Test The Phantom Connect Browser SDK in our interactive sandbox](https://docs.phantom.com/resources/sandbox) [​](https://docs.phantom.com/sdks/browser-sdk#additional-resources) Additional resources ------------------------------------------------------------------------------------------- [SDK overview\ ------------\ \ Compare all Phantom SDKs and choose the right one](https://docs.phantom.com/wallet-sdks-overview) [Phantom Connect\ ---------------\ \ Learn about authentication flows and user experience](https://docs.phantom.com/phantom-connect) [JWT authentication\ ------------------\ \ Implement custom JWT-based authentication](https://docs.phantom.com/sdks/guides/wallet-authentication-with-jwts) Was this page helpful? YesNo [Sign and send transactions](https://docs.phantom.com/sdks/react-native-sdk/sign-and-send-transaction) [Connect](https://docs.phantom.com/sdks/browser-sdk/connect) ⌘I --- # Phantom React SDK - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sdks/react-sdk#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation React SDK Phantom React SDK [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Quick start](https://docs.phantom.com/sdks/react-sdk#quick-start) * [Features](https://docs.phantom.com/sdks/react-sdk#features) * [Security](https://docs.phantom.com/sdks/react-sdk#security) * [Prerequisites](https://docs.phantom.com/sdks/react-sdk#prerequisites) * [Authentication configuration](https://docs.phantom.com/sdks/react-sdk#authentication-configuration) * [Installation](https://docs.phantom.com/sdks/react-sdk#installation) * [Dependencies](https://docs.phantom.com/sdks/react-sdk#dependencies) * [Quick start](https://docs.phantom.com/sdks/react-sdk#quick-start-2) * [Connection Modal](https://docs.phantom.com/sdks/react-sdk#connection-modal) * [Using the Modal with useModal Hook](https://docs.phantom.com/sdks/react-sdk#using-the-modal-with-usemodal-hook) * [ConnectButton Component](https://docs.phantom.com/sdks/react-sdk#connectbutton-component) * [ConnectBox component](https://docs.phantom.com/sdks/react-sdk#connectbox-component) * [Theming](https://docs.phantom.com/sdks/react-sdk#theming) * [Pre-built themes](https://docs.phantom.com/sdks/react-sdk#pre-built-themes) * [Custom themes](https://docs.phantom.com/sdks/react-sdk#custom-themes) * [Chain-Specific Hooks](https://docs.phantom.com/sdks/react-sdk#chain-specific-hooks) * [useSolana hook](https://docs.phantom.com/sdks/react-sdk#usesolana-hook) * [useEthereum hook](https://docs.phantom.com/sdks/react-sdk#useethereum-hook) * [Auto-Confirm Hook (Injected Provider Only)](https://docs.phantom.com/sdks/react-sdk#auto-confirm-hook-injected-provider-only) * [useAutoConfirm hook](https://docs.phantom.com/sdks/react-sdk#useautoconfirm-hook) * [Wallet Discovery Hook](https://docs.phantom.com/sdks/react-sdk#wallet-discovery-hook) * [useDiscoveredWallets](https://docs.phantom.com/sdks/react-sdk#usediscoveredwallets) * [SDK Initialization](https://docs.phantom.com/sdks/react-sdk#sdk-initialization) * [Debug Configuration](https://docs.phantom.com/sdks/react-sdk#debug-configuration) * [Available hooks](https://docs.phantom.com/sdks/react-sdk#available-hooks) * [What you can do](https://docs.phantom.com/sdks/react-sdk#what-you-can-do) * [Starter kits and examples](https://docs.phantom.com/sdks/react-sdk#starter-kits-and-examples) * [Additional resources](https://docs.phantom.com/sdks/react-sdk#additional-resources) The Phantom Connect React SDK provides React hooks for connecting to existing Phantom user wallets in your React apps with native transaction support across multiple blockchains. ### [​](https://docs.phantom.com/sdks/react-sdk#quick-start) Quick start Generate a new Solana project using the **Phantom Embedded React Starter** template. * npm * pnpm * yarn * bun Report incorrect code Copy Ask AI npx -y create-solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-react Report incorrect code Copy Ask AI pnpm create solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-react Report incorrect code Copy Ask AI yarn create solana-dapp -t solana-foundation/templates/community/phantom-embedded-react Report incorrect code Copy Ask AI bun create solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-react Run the command above in your terminal to get started. [View template on Solana Templates →](https://solana.com/developers/templates/phantom-embedded-react) * * * [​](https://docs.phantom.com/sdks/react-sdk#features) Features ----------------------------------------------------------------- * Built for React: Provides React hooks (`usePhantom`, `useModal`) and a provider component for app-level configuration. * Multi-chain support: Solana (available now), other chains coming soon. * Connection modal: Built-in, customizable modal for connecting users to Phantom. * Flexible authentication providers: OAuth (Google, Apple), browser extension, and injected providers. * User wallet integration: Connects to existing Phantom user wallets using Phantom Connect. * TypeScript support: Fully typed API surface. [​](https://docs.phantom.com/sdks/react-sdk#security) Security ----------------------------------------------------------------- The Phantom Connect React SDK connects to existing Phantom user wallets, ensuring: * Users control their own wallets and private keys. * Integration with Phantom’s secure wallet infrastructure. * No private key handling in your application. * User maintains full control of their assets. [​](https://docs.phantom.com/sdks/react-sdk#prerequisites) Prerequisites --------------------------------------------------------------------------- * Register your app: Sign up or log in to the [Phantom Portal](https://phantom.com/portal/) and register your app. * Obtain your App ID: * In Phantom Portal, expand your app in the left navigation, then select **Set Up**. * Your App ID appears at the top of the page. * Allowlist your domains and redirect URLs: Add your app’s domains and redirect URLs in the Phantom Portal to enable wallet connections. [​](https://docs.phantom.com/sdks/react-sdk#authentication-configuration) Authentication configuration --------------------------------------------------------------------------------------------------------- When using OAuth providers (google, apple), you’ll need to configure authentication options: Report incorrect code Copy Ask AI authOptions: { redirectUrl: "https://yourapp.com/auth/callback", // Your callback page } **Important notes about `redirectUrl`:** * Must be an existing page/route in your application * Must be whitelisted in your Phantom Portal app configuration * This is where users will be redirected after completing OAuth authentication * Required for google and apple providers * Not required for injected provider [​](https://docs.phantom.com/sdks/react-sdk#installation) Installation ------------------------------------------------------------------------- Report incorrect code Copy Ask AI npm install @phantom/react-sdk [​](https://docs.phantom.com/sdks/react-sdk#dependencies) Dependencies ------------------------------------------------------------------------- Install additional dependencies based on the networks you want to support: | Network support | Required dependencies | | --- | --- | | Solana | `@solana/web3.js` OR `@solana/kit` | | Ethereum/EVM | `viem` | Example for Solana and Ethereum support: Report incorrect code Copy Ask AI npm install @phantom/react-sdk @solana/web3.js viem [​](https://docs.phantom.com/sdks/react-sdk#quick-start-2) Quick start ------------------------------------------------------------------------- Report incorrect code Copy Ask AI import { PhantomProvider, useModal, darkTheme, usePhantom } from "@phantom/react-sdk"; import { AddressType } from "@phantom/browser-sdk"; function App() { return ( ); } function WalletComponent() { const { open, close, isOpened } = useModal(); const { isConnected, user } = usePhantom(); if (isConnected) { return (

Connected

); } return ; } [​](https://docs.phantom.com/sdks/react-sdk#connection-modal) Connection Modal --------------------------------------------------------------------------------- The SDK includes a built-in connection modal UI that provides a user-friendly interface for connecting to Phantom. The modal supports multiple connection methods (Google, Apple, browser extension) and handles all connection logic automatically. ### [​](https://docs.phantom.com/sdks/react-sdk#using-the-modal-with-usemodal-hook) Using the Modal with useModal Hook To use the modal, pass a `theme` prop to `PhantomProvider` and use the `useModal()` hook to control visibility: Report incorrect code Copy Ask AI import { PhantomProvider, useModal, darkTheme, usePhantom } from "@phantom/react-sdk"; import { AddressType } from "@phantom/browser-sdk"; function App() { return ( ); } function WalletComponent() { const { open, close, isOpened } = useModal(); const { isConnected } = usePhantom(); if (isConnected) { return (

Connected

); } return ; } **Modal Features:** * **Multiple Auth Providers**: Google, Apple, browser extension * **Automatic Provider Detection**: Shows browser extension option when Phantom is installed * **Mobile Support**: Displays deeplink option for Phantom mobile app on mobile devices * **Error Handling**: Clear error messages displayed in the modal * **Loading States**: Visual feedback during connection attempts * **Responsive Design**: Optimized for both mobile and desktop ### [​](https://docs.phantom.com/sdks/react-sdk#connectbutton-component) ConnectButton Component A ready-to-use button component that handles the complete connection flow: Report incorrect code Copy Ask AI import { ConnectButton, AddressType } from "@phantom/react-sdk"; function Header() { return (
{/* Default: Shows first available address */} {/* Show specific address type */} {/* Full width button */}
); } ConnectButton features: * When disconnected: Opens connection modal with auth provider options * When connected: Displays truncated address and opens wallet management modal * Uses theme styling for consistent appearance ### [​](https://docs.phantom.com/sdks/react-sdk#connectbox-component) ConnectBox component An inline embedded component that displays the connection UI directly in your page layout (without a modal backdrop). Perfect for auth callback pages or when you want a more integrated connection experience. The component automatically handles all connection states including loading, error, and success during the auth callback flow. ![ConnectBox component showing login options](https://mintcdn.com/phantom-e50e2e68/6Jx1knw-O3z4Ex2i/resources/images/phantom-connect/connect-box-component.png?w=2500&fit=max&auto=format&n=6Jx1knw-O3z4Ex2i&q=85&s=01db56344fd01ad8e7d01c00296fd251) Report incorrect code Copy Ask AI import { ConnectBox } from "@phantom/react-sdk"; function AuthCallbackPage() { return (

Connecting to Phantom...

); } Props: | Property | Type | Default | Description | | --- | --- | --- | --- | | `maxWidth` | `string \| number` | `"350px"` | Maximum width of the box | | `transparent` | `boolean` | `false` | Removes background, border, and shadow for a transparent appearance | | `appIcon` | `string` | — | URL to your app icon (optional, can also be set via `PhantomProvider`) | | `appName` | `string` | — | Your app name (optional, can also be set via `PhantomProvider`) | **Usage Examples:** Report incorrect code Copy Ask AI import { ConnectBox } from "@phantom/react-sdk"; // Default usage // Custom width // Transparent (no background/border) // Custom width with transparent **ConnectBox Features:** * **Inline embedded**: Renders directly in page flow (not as a floating modal) * **Auto state management**: Automatically shows connection/login UI when disconnected, wallet info when connected * **Auth callback support**: Handles loading and error states during OAuth callback flows * **No close button**: Designed for embedded use cases where users shouldn’t dismiss the UI * **Theme-aware**: Uses your configured theme for consistent styling **Use ConnectBox for auth callback pages**: When using OAuth providers (Google, Apple), users are redirected to your callback URL after authentication. Place `ConnectBox` on this page to automatically handle the auth flow completion with proper loading and error states. [​](https://docs.phantom.com/sdks/react-sdk#theming) Theming --------------------------------------------------------------- The SDK includes pre-built themes and supports full customization to match your app’s design. ### [​](https://docs.phantom.com/sdks/react-sdk#pre-built-themes) Pre-built themes Use the included `darkTheme` or `lightTheme`: Report incorrect code Copy Ask AI import { PhantomProvider, darkTheme, lightTheme } from "@phantom/react-sdk"; // Dark theme // Light theme ### [​](https://docs.phantom.com/sdks/react-sdk#custom-themes) Custom themes Create a custom theme object to fully control the modal’s appearance: Report incorrect code Copy Ask AI const customTheme = { background: "#1a1a1a", // Background color for modal text: "#ffffff", // Primary text color secondary: "#98979C", // Secondary color for text, borders, dividers brand: "#ab9ff2", // Brand/primary action color error: "#ff4444", // Error state color success: "#00ff00", // Success state color borderRadius: "16px", // Border radius for buttons and modal overlay: "rgba(0, 0, 0, 0.8)", // Overlay background color (with opacity) }; | Property | Description | Example | | --- | --- | --- | | `background` | Modal background color | `"#1a1a1a"` | | `text` | Primary text color | `"#ffffff"` | | `secondary` | Secondary text, borders, and dividers | `"#98979C"` | | `brand` | Brand/primary action color | `"#ab9ff2"` | | `error` | Error state color | `"#ff4444"` | | `success` | Success state color | `"#00ff00"` | | `borderRadius` | Border radius for buttons and modal | `"16px"` | | `overlay` | Modal overlay background (supports opacity) | `"rgba(0, 0, 0, 0.8)"` | The `secondary` color must be a hex color value (for example, `#98979C`) as it’s used to derive auxiliary colors with opacity. [​](https://docs.phantom.com/sdks/react-sdk#chain-specific-hooks) Chain-Specific Hooks ----------------------------------------------------------------------------------------- The React SDK provides dedicated hooks for each blockchain: ### [​](https://docs.phantom.com/sdks/react-sdk#usesolana-hook) useSolana hook Report incorrect code Copy Ask AI import { useSolana } from "@phantom/react-sdk"; function SolanaOperations() { const { solana, isAvailable } = useSolana(); // Check if Solana is available before using it if (!isAvailable) { return
Solana is not available for the current wallet
; } const signMessage = async () => { const signature = await solana.signMessage("Hello Solana!"); console.log("Signature:", signature); }; const signAndSendTransaction = async () => { const result = await solana.signAndSendTransaction(transaction); console.log("Transaction sent:", result.hash); }; const switchNetwork = async () => { await solana.switchNetwork('devnet'); }; return (

Connected: {solana.isConnected ? 'Yes' : 'No'}

); } ### [​](https://docs.phantom.com/sdks/react-sdk#useethereum-hook) useEthereum hook EVM support for Phantom Connect embedded wallets will go live later in 2026. Report incorrect code Copy Ask AI import { useEthereum } from "@phantom/react-sdk"; function EthereumOperations() { const { ethereum, isAvailable } = useEthereum(); // Check if Ethereum is available before using it if (!isAvailable) { return
Ethereum is not available for the current wallet
; } const signPersonalMessage = async () => { const accounts = await ethereum.getAccounts(); const signature = await ethereum.signPersonalMessage("Hello Ethereum!", accounts[0]); console.log("Signature:", signature); }; const sendTransaction = async () => { const result = await ethereum.sendTransaction({ to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E", value: "1000000000000000000", // 1 ETH in wei gas: "21000", }); console.log("Transaction sent:", result.hash); }; const switchChain = async () => { await ethereum.switchChain(137); // Switch to Polygon }; return (

Connected: {ethereum.isConnected ? 'Yes' : 'No'}

); } **Supported EVM Networks:** | Network | Chain ID | Usage | | --- | --- | --- | | Ethereum Mainnet | `1` | `ethereum.switchChain(1)` | | Ethereum Sepolia | `11155111` | `ethereum.switchChain(11155111)` | | Polygon Mainnet | `137` | `ethereum.switchChain(137)` | | Polygon Amoy | `80002` | `ethereum.switchChain(80002)` | | Base Mainnet | `8453` | `ethereum.switchChain(8453)` | | Base Sepolia | `84532` | `ethereum.switchChain(84532)` | | Arbitrum One | `42161` | `ethereum.switchChain(42161)` | | Arbitrum Sepolia | `421614` | `ethereum.switchChain(421614)` | | Monad Mainnet | `143` | `ethereum.switchChain(143)` | | Monad Testnet | `10143` | `ethereum.switchChain(10143)` | [​](https://docs.phantom.com/sdks/react-sdk#auto-confirm-hook-injected-provider-only) Auto-Confirm Hook (Injected Provider Only) ----------------------------------------------------------------------------------------------------------------------------------- The SDK provides auto-confirm functionality that allows automatic transaction confirmation for specified chains. ### [​](https://docs.phantom.com/sdks/react-sdk#useautoconfirm-hook) useAutoConfirm hook Report incorrect code Copy Ask AI import { useAutoConfirm, NetworkId } from "@phantom/react-sdk"; function AutoConfirmControls() { const { enable, disable, status, supportedChains, isLoading, error, } = useAutoConfirm(); const handleEnable = async () => { // Enable auto-confirm for specific chains const result = await enable({ chains: [NetworkId.SOLANA_DEVNET, NetworkId.ETHEREUM_MAINNET] }); console.log("Auto-confirm enabled:", result); }; const handleDisable = async () => { await disable(); console.log("Auto-confirm disabled"); }; return (

Status: {status?.enabled ? "Enabled" : "Disabled"}

); } [​](https://docs.phantom.com/sdks/react-sdk#wallet-discovery-hook) Wallet Discovery Hook ------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/react-sdk#usediscoveredwallets) useDiscoveredWallets Get discovered injected wallets with automatic loading and error states. Discovers wallets using Wallet Standard (Solana) and EIP-6963 (Ethereum) standards. Report incorrect code Copy Ask AI import { useDiscoveredWallets } from "@phantom/react-sdk"; function WalletSelector() { const { wallets, isLoading, error, refetch } = useDiscoveredWallets(); if (isLoading) { return
Discovering wallets...
; } if (error) { return
Error discovering wallets: {error.message}
; } return (

Available Wallets

{wallets.map((wallet) => (
{wallet.name} {wallet.name}
))}
); } Returns: | Property | Type | Description | | --- | --- | --- | | `wallets` | `InjectedWalletInfo[]` | Array of discovered wallet information | | `isLoading` | `boolean` | `true` while discovery is in progress | | `error` | `Error \| null` | Error object if discovery fails | | `refetch` | `() => Promise` | Function to manually refresh the wallet list | [​](https://docs.phantom.com/sdks/react-sdk#sdk-initialization) SDK Initialization ------------------------------------------------------------------------------------- The SDK provides an `isLoading` state to track when initialization and autoconnect are in progress: Report incorrect code Copy Ask AI import { useConnect, usePhantom } from "@phantom/react-sdk"; function App() { const { isLoading } = usePhantom(); const { connect } = useConnect(); // Show loading state while SDK initializes if (isLoading) { return (

Initializing Phantom SDK...

Please wait...

); } // SDK is ready return (

Welcome!

); } [​](https://docs.phantom.com/sdks/react-sdk#debug-configuration) Debug Configuration --------------------------------------------------------------------------------------- Configure debug logging by passing a `debugConfig` prop to `PhantomProvider`: Report incorrect code Copy Ask AI import { PhantomProvider, DebugLevel } from "@phantom/react-sdk"; function App() { const [debugMessages, setDebugMessages] = useState([]); const debugConfig = { enabled: true, level: DebugLevel.INFO, callback: (message) => { setDebugMessages((prev) => [...prev, message]); }, }; return ( ); } Debug configuration properties: | Property | Type | Description | | --- | --- | --- | | `enabled` | `boolean` | Enable debug logging | | `level` | `DebugLevel` | Debug level (ERROR, WARN, INFO, DEBUG) | | `callback` | `(message: DebugMessage) => void` | Custom debug message handler | [​](https://docs.phantom.com/sdks/react-sdk#available-hooks) Available hooks ------------------------------------------------------------------------------- | Hook | Purpose | Returns | | --- | --- | --- | | `useModal` | Control the connection modal | `{ open, close, isOpened }` | | `usePhantom` | Access wallet/user state | `{ isConnected, isLoading, user, wallet }` | | `useConnect` | Connect to wallet | `{ connect, isConnecting, isLoading, error }` | | `useAccounts` | Get wallet addresses | `WalletAddress[]` or `null` | | `useIsExtensionInstalled` | Check extension status | `{ isLoading, isInstalled }` | | `useDisconnect` | Disconnect from wallet | `{ disconnect, isDisconnecting }` | | `useAutoConfirm` | Auto-confirm management (injected only) | `{ enable, disable, status, supportedChains, ... }` | | `useDiscoveredWallets` | Get discovered injected wallets | `{ wallets, isLoading, error, refetch }` | | `useSolana` | Solana chain operations | `{ solana, isAvailable }` | | `useEthereum` | Ethereum chain operations | `{ ethereum, isAvailable }` | | `useTheme` | Access current theme | `PhantomTheme` | [​](https://docs.phantom.com/sdks/react-sdk#what-you-can-do) What you can do ------------------------------------------------------------------------------- [Connect to wallets\ ------------------\ \ Learn how to connect to Phantom user wallets with React hooks](https://docs.phantom.com/sdks/react-sdk/connect) [Sign messages\ -------------\ \ Implement message signing for authentication and verification](https://docs.phantom.com/sdks/react-sdk/sign-messages) [Sign and send transactions\ --------------------------\ \ Handle transaction signing and broadcasting across blockchains](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction) [​](https://docs.phantom.com/sdks/react-sdk#starter-kits-and-examples) Starter kits and examples --------------------------------------------------------------------------------------------------- Get started quickly with production-ready React templates: [React SDK demo app\ ------------------\ \ Full-featured React example with wallet connection, signing, and transactions](https://github.com/phantom/wallet-sdk/tree/main/examples/react-sdk-demo-app) [Next.js example\ ---------------\ \ Complete Next.js integration with Phantom React SDK](https://github.com/phantom/wallet-sdk/tree/main/examples/with-nextjs) [Wagmi Integration\ -----------------\ \ Use Phantom SDK alongside Wagmi for enhanced Ethereum support](https://github.com/phantom/wallet-sdk/tree/main/examples/with-wagmi) [All examples\ ------------\ \ Browse all example applications on GitHub](https://github.com/phantom/wallet-sdk/tree/main/examples) [​](https://docs.phantom.com/sdks/react-sdk#additional-resources) Additional resources ----------------------------------------------------------------------------------------- [SDK overview\ ------------\ \ Compare all Phantom SDKs and choose the right one](https://docs.phantom.com/wallet-sdks-overview) [Phantom Connect\ ---------------\ \ Learn about authentication flows and user experience](https://docs.phantom.com/phantom-connect) [JWT authentication\ ------------------\ \ Implement custom JWT-based authentication](https://docs.phantom.com/sdks/guides/wallet-authentication-with-jwts) Was this page helpful? YesNo [Phantom Connect SDK overview](https://docs.phantom.com/wallet-sdks-overview) [Connect](https://docs.phantom.com/sdks/react-sdk/connect) ⌘I --- # Phantom React Native SDK - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sdks/react-native-sdk#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation React Native SDK Phantom React Native SDK [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Quick start](https://docs.phantom.com/sdks/react-native-sdk#quick-start) * [Features](https://docs.phantom.com/sdks/react-native-sdk#features) * [Security](https://docs.phantom.com/sdks/react-native-sdk#security) * [Prerequisites](https://docs.phantom.com/sdks/react-native-sdk#prerequisites) * [Installation](https://docs.phantom.com/sdks/react-native-sdk#installation) * [Install peer dependencies](https://docs.phantom.com/sdks/react-native-sdk#install-peer-dependencies) * [Required polyfill](https://docs.phantom.com/sdks/react-native-sdk#required-polyfill) * [Configure your app scheme](https://docs.phantom.com/sdks/react-native-sdk#configure-your-app-scheme) * [Expo projects](https://docs.phantom.com/sdks/react-native-sdk#expo-projects) * [Quick start](https://docs.phantom.com/sdks/react-native-sdk#quick-start-2) * [Use the connection modal (Recommended)](https://docs.phantom.com/sdks/react-native-sdk#use-the-connection-modal-recommended) * [Or use hooks directly](https://docs.phantom.com/sdks/react-native-sdk#or-use-hooks-directly) * [Chain-specific operations](https://docs.phantom.com/sdks/react-native-sdk#chain-specific-operations) * [Solana operations](https://docs.phantom.com/sdks/react-native-sdk#solana-operations) * [Ethereum operations](https://docs.phantom.com/sdks/react-native-sdk#ethereum-operations) * [Hooks](https://docs.phantom.com/sdks/react-native-sdk#hooks) * [useModal](https://docs.phantom.com/sdks/react-native-sdk#usemodal) * [useConnect](https://docs.phantom.com/sdks/react-native-sdk#useconnect) * [useAccounts](https://docs.phantom.com/sdks/react-native-sdk#useaccounts) * [useSolana](https://docs.phantom.com/sdks/react-native-sdk#usesolana) * [useEthereum](https://docs.phantom.com/sdks/react-native-sdk#useethereum) * [useDisconnect](https://docs.phantom.com/sdks/react-native-sdk#usedisconnect) * [Authentication flows](https://docs.phantom.com/sdks/react-native-sdk#authentication-flows) * [Available providers](https://docs.phantom.com/sdks/react-native-sdk#available-providers) * [Authentication process](https://docs.phantom.com/sdks/react-native-sdk#authentication-process) * [Deep-link handling](https://docs.phantom.com/sdks/react-native-sdk#deep-link-handling) * [Security considerations](https://docs.phantom.com/sdks/react-native-sdk#security-considerations) * [Secure storage](https://docs.phantom.com/sdks/react-native-sdk#secure-storage) * [Secure authentication](https://docs.phantom.com/sdks/react-native-sdk#secure-authentication) * [Configuration examples](https://docs.phantom.com/sdks/react-native-sdk#configuration-examples) * [Basic configuration](https://docs.phantom.com/sdks/react-native-sdk#basic-configuration) * [Multi-chain configuration](https://docs.phantom.com/sdks/react-native-sdk#multi-chain-configuration) * [Debug configuration](https://docs.phantom.com/sdks/react-native-sdk#debug-configuration) * [What you can do](https://docs.phantom.com/sdks/react-native-sdk#what-you-can-do) * [Starter kits and examples](https://docs.phantom.com/sdks/react-native-sdk#starter-kits-and-examples) * [Additional resources](https://docs.phantom.com/sdks/react-native-sdk#additional-resources) The Phantom Connect React Native SDK provides React hooks for connecting to existing Phantom user wallets in your mobile React Native apps with native transaction support across multiple blockchains. ### [​](https://docs.phantom.com/sdks/react-native-sdk#quick-start) Quick start Generate a new Solana project using the **Phantom Embedded React Native Starter** template. * npm * pnpm * yarn * bun Report incorrect code Copy Ask AI npx -y create-solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-react-native Report incorrect code Copy Ask AI pnpm create solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-react-native Report incorrect code Copy Ask AI yarn create solana-dapp -t solana-foundation/templates/community/phantom-embedded-react-native Report incorrect code Copy Ask AI bun create solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-react-native Run the command above in your terminal to get started. [View template on Solana Templates →](https://solana.com/developers/templates/phantom-embedded-react-native) * * * [​](https://docs.phantom.com/sdks/react-native-sdk#features) Features ------------------------------------------------------------------------ * Built for React Native: Works in Expo environments with native modules for authentication * Connection modal: Built-in modal for initiating wallet connections in mobile apps * System browser authentication: Uses Safari (iOS) and Chrome Custom Tab (Android) for login and redirect handling * Multi-chain support: Solana (available now), other chains coming soon. * User wallet integration: Connects to existing Phantom mobile wallets through browser-based OAuth flows. [​](https://docs.phantom.com/sdks/react-native-sdk#security) Security ------------------------------------------------------------------------ The Phantom Connect React Native SDK connects to existing Phantom user wallets: * OAuth authentication with Google, Apple, or custom JWT providers * PKCE support for secure OAuth flows * Users maintain full control of their existing wallets * Integration with Phantom’s secure wallet infrastructure [​](https://docs.phantom.com/sdks/react-native-sdk#prerequisites) Prerequisites ---------------------------------------------------------------------------------- * Register your app: Sign up or log in to the [Phantom Portal](https://phantom.com/portal/) and register your app. * Obtain your App ID: * In Phantom Portal, expand your app in the left navigation, then select **Set Up**. * Your App ID appears at the top of the page. * Allowlist your domains and redirect URLs: Add your app’s domains and redirect URLs in the Phantom Portal to enable wallet connections. [​](https://docs.phantom.com/sdks/react-native-sdk#installation) Installation -------------------------------------------------------------------------------- Report incorrect code Copy Ask AI npm install @phantom/react-native-sdk ### [​](https://docs.phantom.com/sdks/react-native-sdk#install-peer-dependencies) Install peer dependencies Report incorrect code Copy Ask AI # For Expo projects npx expo install expo-secure-store expo-web-browser expo-auth-session expo-router react-native-svg # For bare React Native projects (additional setup required) npm install expo-secure-store expo-web-browser expo-auth-session react-native-svg # Required polyfill for cryptographic operations npm install react-native-get-random-values ### [​](https://docs.phantom.com/sdks/react-native-sdk#required-polyfill) Required polyfill You must polyfill random byte generation to ensure cryptographic operations work properly. Add this import _at the very top_ of your app’s entry point (before any other imports): Report incorrect code Copy Ask AI // index.js, App.tsx, or _layout.tsx - MUST be the first import import "react-native-get-random-values"; import { PhantomProvider } from "@phantom/react-native-sdk"; // ... other imports The polyfill import must be the first import in your app’s entry point. ### [​](https://docs.phantom.com/sdks/react-native-sdk#configure-your-app-scheme) Configure your app scheme #### [​](https://docs.phantom.com/sdks/react-native-sdk#expo-projects) Expo projects Add your custom scheme to `app.json`: Report incorrect code Copy Ask AI { "expo": { "name": "My Wallet App", "slug": "my-wallet-app", "scheme": "mywalletapp", "plugins": ["expo-router", "expo-secure-store", "expo-web-browser", "expo-auth-session"] } } [​](https://docs.phantom.com/sdks/react-native-sdk#quick-start-2) Quick start -------------------------------------------------------------------------------- Report incorrect code Copy Ask AI // App.tsx or _layout.tsx (for Expo Router) import { PhantomProvider, AddressType, darkTheme } from "@phantom/react-native-sdk"; export default function App() { return ( ); } // WalletScreen.tsx import { View, Button, Text } from "react-native"; import { useModal, usePhantom } from "@phantom/react-native-sdk"; export function WalletScreen() { const { open, close, isOpened } = useModal(); const { isConnected } = usePhantom(); if (isConnected) { return ( Connected ); } return ( ; } [​](https://docs.phantom.com/sdks/react-sdk/index#connection-modal) Connection Modal --------------------------------------------------------------------------------------- The SDK includes a built-in connection modal UI that provides a user-friendly interface for connecting to Phantom. The modal supports multiple connection methods (Google, Apple, browser extension) and handles all connection logic automatically. ### [​](https://docs.phantom.com/sdks/react-sdk/index#using-the-modal-with-usemodal-hook) Using the Modal with useModal Hook To use the modal, pass a `theme` prop to `PhantomProvider` and use the `useModal()` hook to control visibility: Report incorrect code Copy Ask AI import { PhantomProvider, useModal, darkTheme, usePhantom } from "@phantom/react-sdk"; import { AddressType } from "@phantom/browser-sdk"; function App() { return ( ); } function WalletComponent() { const { open, close, isOpened } = useModal(); const { isConnected } = usePhantom(); if (isConnected) { return (

Connected

); } return ; } **Modal Features:** * **Multiple Auth Providers**: Google, Apple, browser extension * **Automatic Provider Detection**: Shows browser extension option when Phantom is installed * **Mobile Support**: Displays deeplink option for Phantom mobile app on mobile devices * **Error Handling**: Clear error messages displayed in the modal * **Loading States**: Visual feedback during connection attempts * **Responsive Design**: Optimized for both mobile and desktop ### [​](https://docs.phantom.com/sdks/react-sdk/index#connectbutton-component) ConnectButton Component A ready-to-use button component that handles the complete connection flow: Report incorrect code Copy Ask AI import { ConnectButton, AddressType } from "@phantom/react-sdk"; function Header() { return (
{/* Default: Shows first available address */} {/* Show specific address type */} {/* Full width button */}
); } ConnectButton features: * When disconnected: Opens connection modal with auth provider options * When connected: Displays truncated address and opens wallet management modal * Uses theme styling for consistent appearance ### [​](https://docs.phantom.com/sdks/react-sdk/index#connectbox-component) ConnectBox component An inline embedded component that displays the connection UI directly in your page layout (without a modal backdrop). Perfect for auth callback pages or when you want a more integrated connection experience. The component automatically handles all connection states including loading, error, and success during the auth callback flow. ![ConnectBox component showing login options](https://mintcdn.com/phantom-e50e2e68/6Jx1knw-O3z4Ex2i/resources/images/phantom-connect/connect-box-component.png?w=2500&fit=max&auto=format&n=6Jx1knw-O3z4Ex2i&q=85&s=01db56344fd01ad8e7d01c00296fd251) Report incorrect code Copy Ask AI import { ConnectBox } from "@phantom/react-sdk"; function AuthCallbackPage() { return (

Connecting to Phantom...

); } Props: | Property | Type | Default | Description | | --- | --- | --- | --- | | `maxWidth` | `string \| number` | `"350px"` | Maximum width of the box | | `transparent` | `boolean` | `false` | Removes background, border, and shadow for a transparent appearance | | `appIcon` | `string` | — | URL to your app icon (optional, can also be set via `PhantomProvider`) | | `appName` | `string` | — | Your app name (optional, can also be set via `PhantomProvider`) | **Usage Examples:** Report incorrect code Copy Ask AI import { ConnectBox } from "@phantom/react-sdk"; // Default usage // Custom width // Transparent (no background/border) // Custom width with transparent **ConnectBox Features:** * **Inline embedded**: Renders directly in page flow (not as a floating modal) * **Auto state management**: Automatically shows connection/login UI when disconnected, wallet info when connected * **Auth callback support**: Handles loading and error states during OAuth callback flows * **No close button**: Designed for embedded use cases where users shouldn’t dismiss the UI * **Theme-aware**: Uses your configured theme for consistent styling **Use ConnectBox for auth callback pages**: When using OAuth providers (Google, Apple), users are redirected to your callback URL after authentication. Place `ConnectBox` on this page to automatically handle the auth flow completion with proper loading and error states. [​](https://docs.phantom.com/sdks/react-sdk/index#theming) Theming --------------------------------------------------------------------- The SDK includes pre-built themes and supports full customization to match your app’s design. ### [​](https://docs.phantom.com/sdks/react-sdk/index#pre-built-themes) Pre-built themes Use the included `darkTheme` or `lightTheme`: Report incorrect code Copy Ask AI import { PhantomProvider, darkTheme, lightTheme } from "@phantom/react-sdk"; // Dark theme // Light theme ### [​](https://docs.phantom.com/sdks/react-sdk/index#custom-themes) Custom themes Create a custom theme object to fully control the modal’s appearance: Report incorrect code Copy Ask AI const customTheme = { background: "#1a1a1a", // Background color for modal text: "#ffffff", // Primary text color secondary: "#98979C", // Secondary color for text, borders, dividers brand: "#ab9ff2", // Brand/primary action color error: "#ff4444", // Error state color success: "#00ff00", // Success state color borderRadius: "16px", // Border radius for buttons and modal overlay: "rgba(0, 0, 0, 0.8)", // Overlay background color (with opacity) }; | Property | Description | Example | | --- | --- | --- | | `background` | Modal background color | `"#1a1a1a"` | | `text` | Primary text color | `"#ffffff"` | | `secondary` | Secondary text, borders, and dividers | `"#98979C"` | | `brand` | Brand/primary action color | `"#ab9ff2"` | | `error` | Error state color | `"#ff4444"` | | `success` | Success state color | `"#00ff00"` | | `borderRadius` | Border radius for buttons and modal | `"16px"` | | `overlay` | Modal overlay background (supports opacity) | `"rgba(0, 0, 0, 0.8)"` | The `secondary` color must be a hex color value (for example, `#98979C`) as it’s used to derive auxiliary colors with opacity. [​](https://docs.phantom.com/sdks/react-sdk/index#chain-specific-hooks) Chain-Specific Hooks ----------------------------------------------------------------------------------------------- The React SDK provides dedicated hooks for each blockchain: ### [​](https://docs.phantom.com/sdks/react-sdk/index#usesolana-hook) useSolana hook Report incorrect code Copy Ask AI import { useSolana } from "@phantom/react-sdk"; function SolanaOperations() { const { solana, isAvailable } = useSolana(); // Check if Solana is available before using it if (!isAvailable) { return
Solana is not available for the current wallet
; } const signMessage = async () => { const signature = await solana.signMessage("Hello Solana!"); console.log("Signature:", signature); }; const signAndSendTransaction = async () => { const result = await solana.signAndSendTransaction(transaction); console.log("Transaction sent:", result.hash); }; const switchNetwork = async () => { await solana.switchNetwork('devnet'); }; return (

Connected: {solana.isConnected ? 'Yes' : 'No'}

); } ### [​](https://docs.phantom.com/sdks/react-sdk/index#useethereum-hook) useEthereum hook EVM support for Phantom Connect embedded wallets will go live later in 2026. Report incorrect code Copy Ask AI import { useEthereum } from "@phantom/react-sdk"; function EthereumOperations() { const { ethereum, isAvailable } = useEthereum(); // Check if Ethereum is available before using it if (!isAvailable) { return
Ethereum is not available for the current wallet
; } const signPersonalMessage = async () => { const accounts = await ethereum.getAccounts(); const signature = await ethereum.signPersonalMessage("Hello Ethereum!", accounts[0]); console.log("Signature:", signature); }; const sendTransaction = async () => { const result = await ethereum.sendTransaction({ to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E", value: "1000000000000000000", // 1 ETH in wei gas: "21000", }); console.log("Transaction sent:", result.hash); }; const switchChain = async () => { await ethereum.switchChain(137); // Switch to Polygon }; return (

Connected: {ethereum.isConnected ? 'Yes' : 'No'}

); } **Supported EVM Networks:** | Network | Chain ID | Usage | | --- | --- | --- | | Ethereum Mainnet | `1` | `ethereum.switchChain(1)` | | Ethereum Sepolia | `11155111` | `ethereum.switchChain(11155111)` | | Polygon Mainnet | `137` | `ethereum.switchChain(137)` | | Polygon Amoy | `80002` | `ethereum.switchChain(80002)` | | Base Mainnet | `8453` | `ethereum.switchChain(8453)` | | Base Sepolia | `84532` | `ethereum.switchChain(84532)` | | Arbitrum One | `42161` | `ethereum.switchChain(42161)` | | Arbitrum Sepolia | `421614` | `ethereum.switchChain(421614)` | | Monad Mainnet | `143` | `ethereum.switchChain(143)` | | Monad Testnet | `10143` | `ethereum.switchChain(10143)` | [​](https://docs.phantom.com/sdks/react-sdk/index#auto-confirm-hook-injected-provider-only) Auto-Confirm Hook (Injected Provider Only) ----------------------------------------------------------------------------------------------------------------------------------------- The SDK provides auto-confirm functionality that allows automatic transaction confirmation for specified chains. ### [​](https://docs.phantom.com/sdks/react-sdk/index#useautoconfirm-hook) useAutoConfirm hook Report incorrect code Copy Ask AI import { useAutoConfirm, NetworkId } from "@phantom/react-sdk"; function AutoConfirmControls() { const { enable, disable, status, supportedChains, isLoading, error, } = useAutoConfirm(); const handleEnable = async () => { // Enable auto-confirm for specific chains const result = await enable({ chains: [NetworkId.SOLANA_DEVNET, NetworkId.ETHEREUM_MAINNET] }); console.log("Auto-confirm enabled:", result); }; const handleDisable = async () => { await disable(); console.log("Auto-confirm disabled"); }; return (

Status: {status?.enabled ? "Enabled" : "Disabled"}

); } [​](https://docs.phantom.com/sdks/react-sdk/index#wallet-discovery-hook) Wallet Discovery Hook ------------------------------------------------------------------------------------------------- ### [​](https://docs.phantom.com/sdks/react-sdk/index#usediscoveredwallets) useDiscoveredWallets Get discovered injected wallets with automatic loading and error states. Discovers wallets using Wallet Standard (Solana) and EIP-6963 (Ethereum) standards. Report incorrect code Copy Ask AI import { useDiscoveredWallets } from "@phantom/react-sdk"; function WalletSelector() { const { wallets, isLoading, error, refetch } = useDiscoveredWallets(); if (isLoading) { return
Discovering wallets...
; } if (error) { return
Error discovering wallets: {error.message}
; } return (

Available Wallets

{wallets.map((wallet) => (
{wallet.name} {wallet.name}
))}
); } Returns: | Property | Type | Description | | --- | --- | --- | | `wallets` | `InjectedWalletInfo[]` | Array of discovered wallet information | | `isLoading` | `boolean` | `true` while discovery is in progress | | `error` | `Error \| null` | Error object if discovery fails | | `refetch` | `() => Promise` | Function to manually refresh the wallet list | [​](https://docs.phantom.com/sdks/react-sdk/index#sdk-initialization) SDK Initialization ------------------------------------------------------------------------------------------- The SDK provides an `isLoading` state to track when initialization and autoconnect are in progress: Report incorrect code Copy Ask AI import { useConnect, usePhantom } from "@phantom/react-sdk"; function App() { const { isLoading } = usePhantom(); const { connect } = useConnect(); // Show loading state while SDK initializes if (isLoading) { return (

Initializing Phantom SDK...

Please wait...

); } // SDK is ready return (

Welcome!

); } [​](https://docs.phantom.com/sdks/react-sdk/index#debug-configuration) Debug Configuration --------------------------------------------------------------------------------------------- Configure debug logging by passing a `debugConfig` prop to `PhantomProvider`: Report incorrect code Copy Ask AI import { PhantomProvider, DebugLevel } from "@phantom/react-sdk"; function App() { const [debugMessages, setDebugMessages] = useState([]); const debugConfig = { enabled: true, level: DebugLevel.INFO, callback: (message) => { setDebugMessages((prev) => [...prev, message]); }, }; return ( ); } Debug configuration properties: | Property | Type | Description | | --- | --- | --- | | `enabled` | `boolean` | Enable debug logging | | `level` | `DebugLevel` | Debug level (ERROR, WARN, INFO, DEBUG) | | `callback` | `(message: DebugMessage) => void` | Custom debug message handler | [​](https://docs.phantom.com/sdks/react-sdk/index#available-hooks) Available hooks ------------------------------------------------------------------------------------- | Hook | Purpose | Returns | | --- | --- | --- | | `useModal` | Control the connection modal | `{ open, close, isOpened }` | | `usePhantom` | Access wallet/user state | `{ isConnected, isLoading, user, wallet }` | | `useConnect` | Connect to wallet | `{ connect, isConnecting, isLoading, error }` | | `useAccounts` | Get wallet addresses | `WalletAddress[]` or `null` | | `useIsExtensionInstalled` | Check extension status | `{ isLoading, isInstalled }` | | `useDisconnect` | Disconnect from wallet | `{ disconnect, isDisconnecting }` | | `useAutoConfirm` | Auto-confirm management (injected only) | `{ enable, disable, status, supportedChains, ... }` | | `useDiscoveredWallets` | Get discovered injected wallets | `{ wallets, isLoading, error, refetch }` | | `useSolana` | Solana chain operations | `{ solana, isAvailable }` | | `useEthereum` | Ethereum chain operations | `{ ethereum, isAvailable }` | | `useTheme` | Access current theme | `PhantomTheme` | [​](https://docs.phantom.com/sdks/react-sdk/index#what-you-can-do) What you can do ------------------------------------------------------------------------------------- [Connect to wallets\ ------------------\ \ Learn how to connect to Phantom user wallets with React hooks](https://docs.phantom.com/sdks/react-sdk/connect) [Sign messages\ -------------\ \ Implement message signing for authentication and verification](https://docs.phantom.com/sdks/react-sdk/sign-messages) [Sign and send transactions\ --------------------------\ \ Handle transaction signing and broadcasting across blockchains](https://docs.phantom.com/sdks/react-sdk/sign-and-send-transaction) [​](https://docs.phantom.com/sdks/react-sdk/index#starter-kits-and-examples) Starter kits and examples --------------------------------------------------------------------------------------------------------- Get started quickly with production-ready React templates: [React SDK demo app\ ------------------\ \ Full-featured React example with wallet connection, signing, and transactions](https://github.com/phantom/wallet-sdk/tree/main/examples/react-sdk-demo-app) [Next.js example\ ---------------\ \ Complete Next.js integration with Phantom React SDK](https://github.com/phantom/wallet-sdk/tree/main/examples/with-nextjs) [Wagmi Integration\ -----------------\ \ Use Phantom SDK alongside Wagmi for enhanced Ethereum support](https://github.com/phantom/wallet-sdk/tree/main/examples/with-wagmi) [All examples\ ------------\ \ Browse all example applications on GitHub](https://github.com/phantom/wallet-sdk/tree/main/examples) [​](https://docs.phantom.com/sdks/react-sdk/index#additional-resources) Additional resources ----------------------------------------------------------------------------------------------- [SDK overview\ ------------\ \ Compare all Phantom SDKs and choose the right one](https://docs.phantom.com/wallet-sdks-overview) [Phantom Connect\ ---------------\ \ Learn about authentication flows and user experience](https://docs.phantom.com/phantom-connect) [JWT authentication\ ------------------\ \ Implement custom JWT-based authentication](https://docs.phantom.com/sdks/guides/wallet-authentication-with-jwts) Was this page helpful? YesNo [Phantom Connect SDK overview](https://docs.phantom.com/wallet-sdks-overview) [Connect](https://docs.phantom.com/sdks/react-sdk/connect) ⌘I --- # Phantom React Native SDK - Phantom developer documentation [Skip to main content](https://docs.phantom.com/sdks/react-native-sdk/index#content-area) [Phantom developer documentation home page![light logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-light.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=c21a66db70347ca7a31053b98a0b5b0a)![dark logo](https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/logo/phantom-dark.svg?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=af17fb78921412073a894ea97523898c)](https://docs.phantom.com/) Search... ⌘KAsk AI Search... Navigation React Native SDK Phantom React Native SDK [Get started](https://docs.phantom.com/introduction) [Phantom Portal](https://docs.phantom.com/phantom-portal/portal) [Phantom Connect SDKs](https://docs.phantom.com/wallet-sdks-overview) [Extension and mobile app](https://docs.phantom.com/solana/integrating-phantom) [Developer tools and resources](https://docs.phantom.com/developer-powertools/overview) On this page * [Quick start](https://docs.phantom.com/sdks/react-native-sdk/index#quick-start) * [Features](https://docs.phantom.com/sdks/react-native-sdk/index#features) * [Security](https://docs.phantom.com/sdks/react-native-sdk/index#security) * [Prerequisites](https://docs.phantom.com/sdks/react-native-sdk/index#prerequisites) * [Installation](https://docs.phantom.com/sdks/react-native-sdk/index#installation) * [Install peer dependencies](https://docs.phantom.com/sdks/react-native-sdk/index#install-peer-dependencies) * [Required polyfill](https://docs.phantom.com/sdks/react-native-sdk/index#required-polyfill) * [Configure your app scheme](https://docs.phantom.com/sdks/react-native-sdk/index#configure-your-app-scheme) * [Expo projects](https://docs.phantom.com/sdks/react-native-sdk/index#expo-projects) * [Quick start](https://docs.phantom.com/sdks/react-native-sdk/index#quick-start-2) * [Use the connection modal (Recommended)](https://docs.phantom.com/sdks/react-native-sdk/index#use-the-connection-modal-recommended) * [Or use hooks directly](https://docs.phantom.com/sdks/react-native-sdk/index#or-use-hooks-directly) * [Chain-specific operations](https://docs.phantom.com/sdks/react-native-sdk/index#chain-specific-operations) * [Solana operations](https://docs.phantom.com/sdks/react-native-sdk/index#solana-operations) * [Ethereum operations](https://docs.phantom.com/sdks/react-native-sdk/index#ethereum-operations) * [Hooks](https://docs.phantom.com/sdks/react-native-sdk/index#hooks) * [useModal](https://docs.phantom.com/sdks/react-native-sdk/index#usemodal) * [useConnect](https://docs.phantom.com/sdks/react-native-sdk/index#useconnect) * [useAccounts](https://docs.phantom.com/sdks/react-native-sdk/index#useaccounts) * [useSolana](https://docs.phantom.com/sdks/react-native-sdk/index#usesolana) * [useEthereum](https://docs.phantom.com/sdks/react-native-sdk/index#useethereum) * [useDisconnect](https://docs.phantom.com/sdks/react-native-sdk/index#usedisconnect) * [Authentication flows](https://docs.phantom.com/sdks/react-native-sdk/index#authentication-flows) * [Available providers](https://docs.phantom.com/sdks/react-native-sdk/index#available-providers) * [Authentication process](https://docs.phantom.com/sdks/react-native-sdk/index#authentication-process) * [Deep-link handling](https://docs.phantom.com/sdks/react-native-sdk/index#deep-link-handling) * [Security considerations](https://docs.phantom.com/sdks/react-native-sdk/index#security-considerations) * [Secure storage](https://docs.phantom.com/sdks/react-native-sdk/index#secure-storage) * [Secure authentication](https://docs.phantom.com/sdks/react-native-sdk/index#secure-authentication) * [Configuration examples](https://docs.phantom.com/sdks/react-native-sdk/index#configuration-examples) * [Basic configuration](https://docs.phantom.com/sdks/react-native-sdk/index#basic-configuration) * [Multi-chain configuration](https://docs.phantom.com/sdks/react-native-sdk/index#multi-chain-configuration) * [Debug configuration](https://docs.phantom.com/sdks/react-native-sdk/index#debug-configuration) * [What you can do](https://docs.phantom.com/sdks/react-native-sdk/index#what-you-can-do) * [Starter kits and examples](https://docs.phantom.com/sdks/react-native-sdk/index#starter-kits-and-examples) * [Additional resources](https://docs.phantom.com/sdks/react-native-sdk/index#additional-resources) The Phantom Connect React Native SDK provides React hooks for connecting to existing Phantom user wallets in your mobile React Native apps with native transaction support across multiple blockchains. ### [​](https://docs.phantom.com/sdks/react-native-sdk/index#quick-start) Quick start Generate a new Solana project using the **Phantom Embedded React Native Starter** template. * npm * pnpm * yarn * bun Report incorrect code Copy Ask AI npx -y create-solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-react-native Report incorrect code Copy Ask AI pnpm create solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-react-native Report incorrect code Copy Ask AI yarn create solana-dapp -t solana-foundation/templates/community/phantom-embedded-react-native Report incorrect code Copy Ask AI bun create solana-dapp@latest -t solana-foundation/templates/community/phantom-embedded-react-native Run the command above in your terminal to get started. [View template on Solana Templates →](https://solana.com/developers/templates/phantom-embedded-react-native) * * * [​](https://docs.phantom.com/sdks/react-native-sdk/index#features) Features ------------------------------------------------------------------------------ * Built for React Native: Works in Expo environments with native modules for authentication * Connection modal: Built-in modal for initiating wallet connections in mobile apps * System browser authentication: Uses Safari (iOS) and Chrome Custom Tab (Android) for login and redirect handling * Multi-chain support: Solana (available now), other chains coming soon. * User wallet integration: Connects to existing Phantom mobile wallets through browser-based OAuth flows. [​](https://docs.phantom.com/sdks/react-native-sdk/index#security) Security ------------------------------------------------------------------------------ The Phantom Connect React Native SDK connects to existing Phantom user wallets: * OAuth authentication with Google, Apple, or custom JWT providers * PKCE support for secure OAuth flows * Users maintain full control of their existing wallets * Integration with Phantom’s secure wallet infrastructure [​](https://docs.phantom.com/sdks/react-native-sdk/index#prerequisites) Prerequisites ---------------------------------------------------------------------------------------- * Register your app: Sign up or log in to the [Phantom Portal](https://phantom.com/portal/) and register your app. * Obtain your App ID: * In Phantom Portal, expand your app in the left navigation, then select **Set Up**. * Your App ID appears at the top of the page. * Allowlist your domains and redirect URLs: Add your app’s domains and redirect URLs in the Phantom Portal to enable wallet connections. [​](https://docs.phantom.com/sdks/react-native-sdk/index#installation) Installation -------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI npm install @phantom/react-native-sdk ### [​](https://docs.phantom.com/sdks/react-native-sdk/index#install-peer-dependencies) Install peer dependencies Report incorrect code Copy Ask AI # For Expo projects npx expo install expo-secure-store expo-web-browser expo-auth-session expo-router react-native-svg # For bare React Native projects (additional setup required) npm install expo-secure-store expo-web-browser expo-auth-session react-native-svg # Required polyfill for cryptographic operations npm install react-native-get-random-values ### [​](https://docs.phantom.com/sdks/react-native-sdk/index#required-polyfill) Required polyfill You must polyfill random byte generation to ensure cryptographic operations work properly. Add this import _at the very top_ of your app’s entry point (before any other imports): Report incorrect code Copy Ask AI // index.js, App.tsx, or _layout.tsx - MUST be the first import import "react-native-get-random-values"; import { PhantomProvider } from "@phantom/react-native-sdk"; // ... other imports The polyfill import must be the first import in your app’s entry point. ### [​](https://docs.phantom.com/sdks/react-native-sdk/index#configure-your-app-scheme) Configure your app scheme #### [​](https://docs.phantom.com/sdks/react-native-sdk/index#expo-projects) Expo projects Add your custom scheme to `app.json`: Report incorrect code Copy Ask AI { "expo": { "name": "My Wallet App", "slug": "my-wallet-app", "scheme": "mywalletapp", "plugins": ["expo-router", "expo-secure-store", "expo-web-browser", "expo-auth-session"] } } [​](https://docs.phantom.com/sdks/react-native-sdk/index#quick-start-2) Quick start -------------------------------------------------------------------------------------- Report incorrect code Copy Ask AI // App.tsx or _layout.tsx (for Expo Router) import { PhantomProvider, AddressType, darkTheme } from "@phantom/react-native-sdk"; export default function App() { return ( ); } // WalletScreen.tsx import { View, Button, Text } from "react-native"; import { useModal, usePhantom } from "@phantom/react-native-sdk"; export function WalletScreen() { const { open, close, isOpened } = useModal(); const { isConnected } = usePhantom(); if (isConnected) { return ( Connected ); } return (