0.8.7 • Published 1 year ago

@inkerlabs/react-sdk v0.8.7

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Installation

npm install --save @inkerlabs/react-sdk

Getting Started

To inject the SDK into your react app, wrap your App component with the Provider.

All of the following examples are assuming you built your project with the Simultaneous Reveal use case. If this is not the case, update the imports accordingly.

import { Provider } from '@inkerlabs/react-sdk/'
import { UseCase } from '@inkerlabs/sdk'

// Assuming your use case is Simultaneous Reveal
const useCase = UseCase.SR

// These informations are available in your dashboard
const config = {
  contractAddress: CONTRACT_ADDRESS,
  version: VERSION,
  chain: CHAIN,
}

ReactDOM.render(
  <React.StrictMode>
    <Provider useCase={useCase} config={config}>
      <App />
    </Provider>
  </React.StrictMode>,
  document.getElementById('root'),
)

Get User NFTs

You can use the useNFTs hook to retrieve the NFTs that the user holds. The user will be prompted to log in with MetaMask if not already.

import { useNFTs } from '@inkerlabs/react-sdk/build/simultaneousReveal'

function YourComponent() {
  const [nfts, nftsError] = useNFTs()
}

Buy NFTs

You can use the useBuyPublic and useBuyPrivate hooks to buy NFTs. Buy public will only work if the public sales are open. Buy private will only work if the private sales are open and the user holds at least one allow list entry.

import {
  useBuyPublic,
  useBuyPrivate,
} from '@inkerlabs/react-sdk/build/simultaneousReveal'

function YourComponent() {
  const buyPublic = useBuyPublic()
  const buyPrivate = useBuyPrivate()
}

Smart Contract Metadata

You can fetch the contract metadata with the useContractMetadata hook. The contract metadata includes the name, description and image identifying the smart contract.

import {
  useContractMetadata,
} from '@inkerlabs/react-sdk/build/simultaneousReveal'

function YourComponent() {
  const [contractMetadata, metadataError] = useContractMetadata()
}

Smart Contract Data

You can fetch the contract data with the useContractData hook. The contract data includes the states of the sales, the pricing and more.

import {
  useContractData,
} from '@inkerlabs/react-sdk/build/simultaneousReveal'

function YourComponent() {
  const [data, dataError] = useContractData()
}

Allow List Tickets

If you want to display how many allow list tickets the user possesses you can use the useWhiteListTickets hook. Note that the SDK handles the tickets automatically for private sales buying.

import {
  useWhiteListTickets,
} from '@inkerlabs/react-sdk/build/simultaneousReveal'

function YourComponent() {
  const [tickets, ticketsError] = useWhiteListTickets()
}
0.8.7

1 year ago

0.8.5

1 year ago

0.8.4

1 year ago

0.8.6

1 year ago

0.7.9

2 years ago

0.7.8

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.8.3

2 years ago

0.8.2

2 years ago

0.6.7

2 years ago

0.6.6

2 years ago

0.6.9

2 years ago

0.6.8

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.4

2 years ago

0.5.6

2 years ago

0.7.3

2 years ago

0.7.0

2 years ago

0.7.6

2 years ago

0.5.8

2 years ago

0.7.5

2 years ago

0.5.7

2 years ago

0.7.7

2 years ago

0.5.9

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.4.9

2 years ago

0.4.8

2 years ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.5

2 years ago

0.5.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.4.5

2 years ago

0.4.4

2 years ago

0.4.7

2 years ago

0.4.6

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.9

2 years ago

0.3.0

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.4.1

2 years ago

0.3.2

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.1.0

2 years ago

0.2.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.2.3

2 years ago

0.1.4

2 years ago

0.2.2

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.1

2 years ago