Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-solana-nftmint

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-solana-nftmint

UseEffect hook to mint NFT 1/1s

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
increased by2600%
Maintainers
1
Weekly downloads
 
Created
Source

React useMint

Setup

Installation

yarn add react-use-mint

Usage

const MyComponent = () => {
  import { AnchorWallet, useAnchorWallet, useConnection } from "@solana/wallet-adapter-react"
  import * as anchor from "@project-serum/anchor"
  import { LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js"
  import useMint, { MintProps } from "../effects/useMint"

  const anchorWallet = useAnchorWallet()
  const {mintNft, ready, error} = useMint(mintProps, anchorWallet);

  const mintProps: MintProps = {
    loading: false,
    rpc: "https://api.devnet.solana.com",
    title: "My NFT",
    creeators: [
      {
        address: new PublicKey("6xnRdTedrerREnaveYndZPioRuK1JcQPfnyA5mQME6vT"),
        verified: false,
        share: 100 // sums must total 100 if you have more than one creator
      },
    ],
    mintPrice: new anchor.BN(0.25 * LAMPORTS_PER_SOL),
    symbol: "MY_SYMBOL",
    priceReceiver: new PublicKey("6xnRdTedrerREnaveYndZPioRuK1JcQPfnyA5mQME6vT"),
    royalty: 500, // 5%
  }

  const handleMint = useCallback(async () => {
    if (!anchorWallet) {
      return
    }
    let nftURL ="https://files.sdrive.app/1frzxgr.json";
    await mintNft(nftURL);
    setLoading(false)
  }, [nftData, anchorWallet])


return (
	<div>
	  <Button disabled={!ready || !!error} text={`Mint ${name}`} variant={VARIANT.SMALL} onClick={handleMint} />
</div>
)

};

FAQs

Package last updated on 12 Feb 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc