
Product
Introducing GitHub Actions Scanning Support
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
@solflare-wallet/nft-sdk
Advanced tools
NFT SDK used in Solflare wallet.
This SDK accepts a list of mints, triggers fetching NFT metadatas, all JSONs, Metaplex groups, and does "smart" grouping of everything else using few different rules.
Contents:
$ npm install @solflare-wallet/nft-sdk
import { SolflareNft } from '@solflare-wallet/nft-sdk';
const mints = [new PublicKey(mint1), new PublicKey(mint2)];
const solflare = new SolflareNft({ mints });
import { SolflareNft } from '@solflare-wallet/nft-sdk';
const solflare = new SolflareNft({
mints,
connection: web3connection // "https://api.mainnet-beta.solana.com" will be used if ommited
});
import { SolflareNft } from '@solflare-wallet/nft-sdk';
const solflare = new SolflareNft({ mints });
const response = await solflare.startFetching();
response = {
nfts: [
{
id: 'mint-address-string',
metadataAccount: MetadataAccount, // metaplex type
updateAuthority: PublicKey,
mint: PublicKey,
name: 'NFT name',
symbol: 'symbol',
uri: 'https://uri ...',
sellerFeeBasisPoints: 0,
creators: Creators[], // metaplex type
primarySaleHappened: true,
isMutable: true,
editionNonce: 253,
tokenStandard: TokenStandard | null, // metaplex type
collection: Collection | null, // metaplex type
uses: Uses | null, // metaplex type
metadata: JsonMetadata | null, // metaplex type, entire JSON object fetched from uri
group: 'unique-group-identifier-address-or-slug' | null
},
// ...
],
groups: [
{
id: 'unique-group-identifier-address-or-slug',
name: 'Group name',
image: 'uri of image used for group',
count: 3, // number of NFTs in this group
metaplex: true // true if grouped by verified Collection, otherwise false
},
// ...
]
}
import { SolflareNft, STATUS } from '@solflare-wallet/nft-sdk';
const solflare = new SolflareNft({ mints });
solflare.startFetching();
solflare.on('message', ({ status, payload }) => {
switch (status) {
case STATUS.GLOBAL_START:
console.log('Started fetching.');
break;
case STATUS.METADATA_FINISH:
console.log('Fetched all Metaplex metadata accounts');
console.log('payload', payload);
// payload = {
// nfts: [ { ...nftData } ],
// groups: []
// }
break;
case STATUS.JSON_FILE_SINGLE_FINISH:
console.log('Fetched single JSON file');
console.log('payload', payload);
// payload = {
// nft: { SINGLE NFT THAT GOT UPDATED }
// nfts: [...],
// groups: [...]
// }
break;
case STATUS.JSON_FILE_SINGLE_ERROR:
console.log('Failed to fetch JSON file');
console.log('payload', payload);
// payload = {
// nft: { SINGLE NFT THAT FAILED LOADING JSON }
// nfts: [...],
// groups: [...]
// }
break;
case STATUS.JSON_FILES_FINISH:
console.log('Everything finished loading');
console.log('payload', payload);
// payload = {
// nfts: [...],
// groups: [...]
// }
break;
case STATUS.GLOBAL_FINISH:
console.log('Finished fetching.');
break;
default:
break;
}
});
The SDK provides transaction builders for compressed NFT operations that return V0 transactions.
import { createTransferCompressedNftTransaction } from '@solflare-wallet/nft-sdk';
import { Connection, Keypair } from '@solana/web3.js';
const connection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');
const wallet = Keypair.generate(); // Your wallet keypair
const tx = await createTransferCompressedNftTransaction({
assetId: 'compressed-nft-asset-id',
walletPublicKey: wallet.publicKey,
destinationPublicKey: recipient.publicKey,
connection, // optional, defaults to mainnet
addressLookupTableAccounts // optional, for additional size optimization
});
// Sign and send (V0 transactions must be pre-signed)
tx.sign([wallet]);
const signature = await connection.sendTransaction(tx);
await connection.confirmTransaction(signature);
import { createBurnCompressedNftTransaction } from '@solflare-wallet/nft-sdk';
import { Connection, Keypair } from '@solana/web3.js';
const connection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');
const wallet = Keypair.generate(); // Your wallet keypair
const tx = await createBurnCompressedNftTransaction({
assetId: 'compressed-nft-asset-id',
walletPublicKey: wallet.publicKey,
connection, // optional
addressLookupTableAccounts // optional
});
// Sign and send
tx.sign([wallet]);
const signature = await connection.sendTransaction(tx);
await connection.confirmTransaction(signature);
Note: These functions return VersionedTransaction (V0 format) to support large Merkle tree proofs that exceed legacy transaction size limits. The transactions must be signed before sending, unlike legacy transactions where signers can be passed to sendTransaction().
FAQs
# @solflare-wallet/nft-sdk
The npm package @solflare-wallet/nft-sdk receives a total of 201 weekly downloads. As such, @solflare-wallet/nft-sdk popularity was classified as not popular.
We found that @solflare-wallet/nft-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.

Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.

Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.