18min

Full Phantom

Introduction

Phantom is a crypto wallet that can be used to manage digital assets and access decentralized applications on the Solana blockchain.

At its core, Phantom works by creating and managing private keys on behalf of its users. These keys can then be used within Phantom to store funds and sign transactions.

To interact with web applications, the Phantom extension inject a Solana object into the javascript context of every site the user visits. A given web app may then interact with Phantom, and ask for the user's permission to perform transactions, through this injected object. Full Phantom plugin allows you to connect to Phantom Extension in order to send transactions, and sign a message. It also returns you the Public Key, and connection status.

How To Install

1. Install Phantom Extension

Official Phantom download page - https://phantom.app/download

2. Place the plugin element on the page

Document image

Plugin Element Properties

The plugin comes with one element - Phantom Provider

Phantom Provider elemen
Phantom Provider elemen

Elements Actions

Connect

This action establishes a connection with Phantom extension. This connection request will prompt the user for permission to share their public key, indicating that they are willing to interact further.



Document image

After a connection is established the plugin event "Connected" will be triggered.



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.

Document image



After disconnection both from the plugin or extension element event, "Disconnect" will be triggered.

Go to install page

Open a new tab with URL https://phantom.app/download

Sign and Send Transaction

Once a web application is connected to Phantom, it can prompt the user for permission to send transactions on their behalf.





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.





Document image

Fields

Title

Description

Type

Network URL

URL to the fullnode JSON RPC endpoint

Text

From Pubkey

An account that will transfer SOL

Text

To Pubkey

An account that will receive transferred SOL

Text

SOL

Amount of SOL to transfer

Number

Fee Payer

The transaction fee payer

Text

Sign message

When a web application is connected to Phantom, it can also request that the user signs a given message.



Document image

Fields

Title

Description

Type

Message

Message text to be signed by Phantom

Text

Clear

Remove all data from plugin states "Transaction Signature" and "Signed Message"

Element Events



Name



Description

Connect

this event is triggered when the plugin is connected to Phantom extension



Disconnect

this event is triggered when the plugin is disconnected from Phantom extension



Error

this event is triggered when an error has occurred



Transaction Successful

this event is triggered when a transaction is signed and sent successfully



Transaction Error

this event is triggered when an error has occurred in the transaction



Message is signed

this event is triggered when the message is signed successfully



Extension is not installed

this event is triggered when Phantom extension is not installed. The plugin checks for the presence of the extension the first time it appears on the page.



Exposed States

Title

Description

Type

Extension Installed

Indicates if Phantom extension is installed

Yes/No

Public Key

Return connected account public key

Text

Error Message

All error messages from the plugin element will be published in this state

Text

Is Connected

Indicates if the current page is connected to Phantom extension

Yes/No

Transaction Signature

Signed transaction signature

Text

Signed Message

Signed message content

Text



Changelogs

Added
Fixed

Demo to preview the plugin: