1.0.8 • Published 2 years ago

phantom-functions v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

phantom-functions

Installation

npm i phantom-functions

import { connectWallet, checkIfConnected, getProfileInfo, disconnect, discordAuth} from "phantom-functions";

connectWallet()

Created connection with Phantom wallet and returns public key which needs to be converted into string.

checkIfConnected()

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 page refresh. It returns public key.

getProfileInfo(rpcUrl, addressPublicKey)

Returns the account info to the Public Key provided. rpcUrl states that blockchain is either on testnet or mainnet

example: rpcUrl="https://api.devnet.solana.com" (testnet)

getAllAssets(rpcUrl, addressPublicKey)

Returns the account tokens assets of the Public Key provided. rpcUrl states that blockchain is either on testnet or mainnet

example: rpcUrl="https://api.devnet.solana.com" (testnet)

getSPLTokens(rpcUrl, addressPublicKey)

Returns the account SPL Tokens of the Public Key provided. rpcUrl states that blockchain is either on testnet or mainnet

example: rpcUrl="https://api.devnet.solana.com" (testnet)

burnSplToken(walletAddress, assetAddress)

Burn the assetAddress against the walletAddress if the asset exists in the wallet. For testing purpose you can create your own asset or burn any asset.

To change the amount you want to burn, alter the '10e8' (equal to 10 tokens) in the burnInstruction.

disconnect()

Disconnects the user from phantom wallet but if checkIfConnected() is being implemented, upon refresh it will connect again because we had given the right to the site.

downloadImage(fileUrl, filename)

Pass the fileRrl and filename and the function will download the file automaatically.

getNftTokenData(walletAddress)

Pass the walletAddress against which Metadata of the NFT's will be shown only if the address ia a valid Solana address.

discordAuth()

For discord auth, configuration needs to be done from the dicord developer portal. At the end of the configs, a random URL gets generated with a callback

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago