0.2.15 • Published 3 months ago

@niftykit/diamond v0.2.15

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Diamond SDK

NiftyKit Diamond SDK Library.

Installation

Install via npm or yarn

# with npm
npm install @niftykit/diamond

# with yarn
yarn add @niftykit/diamond

Or use it via CDN

<script async src='https://unpkg.com/@niftykit/diamond/dist/umd/index.js'></script>

How to use

Drop Collection

// using ethers.js
import { ethers } from 'ethers';
import Diamond from '@niftykit/diamond';

const provider = new ethers.providers.Web3Provider(window.ethereum, 'any');
await provider.send('eth_requestAccounts', []);
const signer = provider.getSigner();

const diamond = await Diamond.create(signer, 'YOUR-SDK-KEY');

// minter
const recipient = await signer.getAddress();

// get current price
const price = await diamond.apps.drop.price();

// mint 1 NFT
const tx = await state.diamond.apps.drop.mintTo(recipient, 1, {
  value: price,
});

await tx.wait();

Edition Collection

// using ethers.js
import { ethers } from 'ethers';
import Diamond from '@niftykit/diamond';

const provider = new ethers.providers.Web3Provider(window.ethereum, 'any');
await provider.send('eth_requestAccounts', []);
const signer = provider.getSigner();

const diamond = await Diamond.create(signer, 'YOUR-SDK-KEY');

// edition id
const editionId = 0; // change this to your edition id

// get edition price
const price = await diamond.apps.edition.getEditionPrice(editionId);

// minter
const recipient = await signer.getAddress();

// check presale (if any)
const verify = await state.diamond.verifyForEdition(
  recipient,
  editionId
);

// mint 1 NFT
const tx = await diamond.apps.edition.mintEdition(
  recipient,
  editionId,
  1,
  verify?.proof ?? [],
  {
    value: price,
  }
);

await tx.wait();
0.2.15

3 months ago

0.2.9

5 months ago

0.2.8

6 months ago

0.2.3

7 months ago

0.2.2

7 months ago

0.2.1

1 year ago

0.2.0

1 year ago