Nice1 react tools =================
npm install @nice1/react-toolsNice1 react tools
=================
React helper tools for using both nice1 and anchor wallet in your applications.
Installation
------------
~~~bash
yarn add @nice1/react-tools
useAnchor you can easily login, logout, make blockchain calls and whatnot, with your anchor wallet:
Hi {session?.auth.actor} :)
You can whenever you want.
useAnchor, you can access and update nice1 info like your balance or profile information from our contracts:
Hi {session?.auth.actor} :)
Your balance is {balance} and your a.k.a. is {profile.alias}.
You also have defined a profile image as {profile.avatar}
You can whenever you want.
tsx
import { useNftAtomicAssets } from '@nice1/react-tools'
const MyComponent = () => {
const { nftsAA, updateNftsAA } = useNftAtomicAssets()
return (
<>
Your NFTs (AtomicAssets):
{nftsAA.map((nft) => (
-
Collection: {nft.collection_name}, Template: {nft.template_id}
))}
>
)
}
`
$3
This hook retrieves NFTs listed for sale in AtomicMarket.
`tsx
import { useNftAtomicMarket } from '@nice1/react-tools'
const MyComponent = () => {
const { nftsAM, updateNftsAM } = useNftAtomicMarket()
return (
<>
NFTs on AtomicMarket:
{nftsAM.map((sale) => (
-
Seller: {sale.seller}, Price: {sale.listing_price}
))}
>
)
}
`
$3
This hook retrieves and manages NFTs stored in SimpleAssets.
`tsx
import { useNftSimpleAssets } from '@nice1/react-tools'
const MyComponent = () => {
const { nftsSA, updateNfts } = useNftSimpleAssets()
return (
<>
Your NFTs (SimpleAssets):
{nftsSA.map((nft) => (
-
Owner: {nft.owner}, Category: {nft.category}
))}
>
)
}
`
$3
This hook retrieves NFTs listed for sale in SimpleMarket.
`tsx
import { useNftSimpleMarket } from '@nice1/react-tools'
const MyComponent = () => {
const { nftsSM, updateNfts } = useNftSimpleMarket()
return (
<>
NFTs on SimpleMarket:
{nftsSM.map((sale) => (
-
Seller: {sale.owner}, Price: {sale.price}
))}
>
)
}
``