Phantom Developer Docs
HomeDeveloper Forums
  • 👻Introduction
    • Introduction
  • 🟩Solana
    • Getting Started With Solana
    • Detecting the Provider
    • Establishing a Connection
    • Sending a Legacy Transaction
    • Sending a Versioned Transaction
    • Signing a Message
    • Error Messages and Codes
  • 🔷Ethereum, Monad Testnet, Base, & Polygon
    • Getting Started with EVM networks
    • Detecting the Provider
    • Establishing a Connection
    • Sending a Transaction
    • Signing a Message
    • Provider API Reference
      • Properties
        • isPhantom
        • chainId
        • networkVersion
        • selectedAddress
        • _events
        • _eventsCount
      • Events
        • Connect
        • Accounts Changed
        • Disconnect
        • Chain Changed
      • Methods
        • isConnected
        • request
      • Error Messages & Codes
  • 🌊Sui
    • Getting Started with Sui
    • Detecting the Provider
    • Establishing a Connection
    • Sending a Transaction
    • Signing a Message
  • 🟠Bitcoin
    • Getting Started With Bitcoin
    • Detecting the Provider
    • Establishing a Connection
    • Sending a Transaction
    • Signing a Message
    • Provider API Reference
  • ⛓️Phantom Deeplinks
    • Phantom Deeplinks
    • Provider Methods
      • Connect
      • Disconnect
      • SignAndSendTransaction
      • SignAllTransactions
      • SignTransaction
      • SignMessage
    • Other Methods
      • Browse
      • Fungible
      • Swap
    • Handling Sessions
    • Specifying Redirects
    • Encryption
    • Limitations
  • 🛠️Developer Powertools
    • Auto-Confirm
    • Domain and Transaction Warnings
    • Mobile Web Debugging
    • Phantom Blocklist
    • Shortcuts
    • Sign-In-With (SIW) Standards
    • Solana Actions & Blinks
    • Solana Priority Fees
    • Solana Token Extensions (Token22)
    • Solana Versioned Transactions
    • Testnet Mode
    • Token Pages
    • Wallet Standard
  • ✅Best Practices
    • Launching a Dapp
    • Displaying Apps within the Activity Tab
    • Displaying Apps within Dialogs
    • Displaying Tokens on Solana
      • Fungibles
      • NFTs & Semi-Fungibles
      • Supported Media Types
  • 🙋Resources
    • FAQ
    • Demo Applications
    • Community Guides & SDKs
    • Logos & Assets
Powered by GitBook
On this page
  • Base URL
  • Query String Parameters
  • Returns
  • Example

Was this helpful?

  1. Phantom Deeplinks
  2. Provider Methods

Connect

PreviousProvider MethodsNextDisconnect

Last updated 2 years ago

Was this helpful?

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, please review .

Base URL

https://phantom.app/ul/v1/connect

Query String Parameters

  • app_url (required): A url used to fetch app metadata (i.e. title, icon) using the same properties found in . 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, please review .

  • redirect_link (required): The URI where Phantom should redirect the user upon connection. Please review for more details. 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.

Returns

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 to learn how apps can decrypt data using a shared secret. Encrypted bytes are encoded in base58.

    // 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 information on sessions, please review .

{
  "errorCode": "...",
  "errorMessage": "..."
}

Example

Reject

An errorCode and errorMessage as query parameters. Please refer to for a full list of possible error codes.

Please refer to the .

⛓️
❌
✅
Handling Sessions
Displaying Your App
Encryption
Specifying Redirects
Encryption
Handling Sessions
Errors
connect method implemented in our React Native demo application