PhantomConnect class
Phantom Connect is a package that allows users to connect to Phantom Wallet from Mobile apps.
- This package need deeplinking to work, so you need to add your own deeplink to your app.
- You can find more information about deeplinking from here
Constructors
- PhantomConnect.new({required String appUrl, required String deepLink})
-
We need to provide
appUrl
anddeepLink
as parameters to create new PhantomConnect object.
Properties
- appUrl ↔ String
-
appUrl is used to fetch app metadata (i.e. title, icon) using the
same properties found in Displaying Your App.
getter/setter pair
- dAppPublicKey ↔ PublicKey
-
getter/setter pair
- deepLink ↔ String
-
deepLink uri is used to open the app from Phantom Wallet i.e our app's deeplink.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- host → String
-
The scheme of the app that will be opened i.e Phantom.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scheme → String
-
The scheme of the app that will be opened i.e Phantom.
final
- userPublicKey ↔ String
-
userPublicKey once session is established with Phantom Wallet (i.e. user has approved the connection) we get user's Publickey.
getter/setter pair
Methods
-
createSession(
Map< String, String> params) → bool -
Creates
_sharedSecret
using_dAppSecretKey
andphantom_encryption_public_key
. -
Created a shared secret between Phantom Wallet and our DApp using our
_dAppSecretKey
andphantom_encryption_public_key
. -
decryptPayload(
{required String data, required String nonce}) → Map -
Decrypts the
data
payload returned by Phantom Wallet -
encryptPayload(
Map< String, dynamic> data) → Map<String, dynamic> - Encrypts the data payload to be sent to Phantom Wallet.
-
generateConnectUri(
{required String cluster, required String redirect}) → Uri -
Generate an URL to connect to Solana
cluster
with Phantom Wallet. -
generateDisconnectUri(
{required String redirect}) → Uri - Generate an URL to disconnect from Phantom Wallet and destroy the session.
-
generateSignAndSendTransactionUri(
{required String transaction, required String redirect}) → Uri -
Generate an URL with given
transaction
to signAndSend transaction with Phantom Wallet. -
generateSignMessageUri(
{required Uint8List nonce, required String redirect}) → Uri -
Generates an URL with given
nonce
to be signed by Phantom Wallet to verify the ownership of the wallet. -
generateSignTransactionUri(
{required String transaction, required String redirect}) → Uri -
Generate an URL with given
transaction
to sign transaction with Phantom Wallet. -
generateUriSignAllTransactions(
{required List< String> transactions, required String redirect}) → Uri -
Generate an URL with given
transactions
to sign all transaction with Phantom Wallet. -
isValidSignature(
String signature, Uint8List nonce) → Future< bool> -
Verifies the
signature
returned by Phantom Wallet. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited