# react-solana-nftmint

> UseEffect hook to mint NFT 1/1s

Latest version **2.0.15** (published 2023-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-solana-nftmint
pnpm add react-solana-nftmint
yarn add react-solana-nftmint
bun add react-solana-nftmint
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.15 |
| Published | 2023-07-27 |
| First published | 2023-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 34.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | svenanders |

## Links

- npm: https://www.npmjs.com/package/react-solana-nftmint
- Repository: https://github.com/CodeableSystems/react-solana-nftmint
- Homepage: https://github.com/CodeableSystems/react-solana-nftmint#readme
- Issues: https://github.com/CodeableSystems/react-solana-nftmint/issues
- npm.io page: https://npm.io/package/react-solana-nftmint

## Dependencies (2)

- [@solana/web3.js](https://npm.io/package/@solana/web3.js.md) ^1.73.2
- [@solana/spl-token](https://npm.io/package/@solana/spl-token.md) ^0.3.7

## Recent versions

- 2.0.15 (latest) — 2023-07-27
- 2.0.14 — 2023-07-27
- 2.0.13 — 2023-02-24
- 2.0.12 — 2023-02-24
- 2.0.11 — 2023-02-24
- 2.0.10 — 2023-02-24
- 2.0.9 — 2023-02-23
- 2.0.8 — 2023-02-22
- 2.0.6 — 2023-02-22
- 2.0.5 — 2023-02-22
- 2.0.4 — 2023-02-22
- 2.0.3 — 2023-02-22
- 2.0.2 — 2023-02-13
- 2.0.1 — 2023-02-13
- 2.0.0 — 2023-02-13
- … 11 more at https://npm.io/package/react-solana-nftmint/versions

## README

# React Solana NFT Mint  

Mint NFTs on Solana 
With this package, all you need to mint NFTs is to provide your JSON file as an URL to the mint function.

The props should be self-explanatory, but they are: 

* rpc: devnet/mainnet URL
* creators: array of pubkeys (total shares must sum up to 100)
* mintPrice: how much you take
* seller: pubkey that receives the SOL
* symbol: any symbol (keep it short)
* royalty: 500 equals 5% 

## Setup

### Installation

`yarn add react-solana-nftmint` or `npm i -S react-solana-nftmint`

### Usage

```tsx
import * as anchor from "@project-serum/anchor";
import { useAnchorWallet } from "@solana/wallet-adapter-react";
import { LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
import React, { useCallback } from "react";
import useMint, { MintProps } from "react-solana-nftmint";

export default function MyComponent() {
    const anchorWallet = useAnchorWallet()
    const props: MintProps = {
        rpc: "https://api.devnet.solana.com",
        title: "Sample NFT",
        creators: [
            {
                address: new PublicKey("6xnRdTedrerREnaveYndZPioRuK1JcQPfnyA5mQME6vT"),
                verified: false,
                share: 100 // sums must total 100 if you have more than one creator
            },
        ],
        mintPrice: new anchor.BN(0.05 * LAMPORTS_PER_SOL),
        symbol: "",
        seller: new PublicKey("6xnRdTedrerREnaveYndZPioRuK1JcQPfnyA5mQME6vT"),
        royalty: 500,
    }
    const { mintNft, ready, uploading, error, mintSuccess } = useMint(props, anchorWallet);

    const handleMint = useCallback(async () => {
        if (!anchorWallet) {
            return
        }
        let nftURL = "https://files.sdrive.app/15zg0r4.json";
        await mintNft(nftURL);
    }, [props, anchorWallet])

    return (
        <div>
            {error && <div>{error}</div>}
            {uploading && <div>NFT is cooking...</div>}
            {mintSuccess && <div>Minted!</div>}
            <button disabled={!ready} onClick={handleMint}>Mint {props.title}</button>
        </div>
    )
};
```

---
_Source: https://npm.io/package/react-solana-nftmint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
