0.0.8 • Published 3 years ago
@nirvanalabs/chain-query-sdk v0.0.8
Getting started
npm i @nirvanalabs/chain-query-sdkHow to use the react hooks after installing the package
import { useContractMetadata } from "@nirvanalabs/chain-query-sdk";
function App() {
const address = "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d";
const apiKey = 'your-api-key-here'; // This API key is optional
const request = {
address: address,
apiKey: apiKey
}
const { data , error, loading } = useContractMetadata(request);
if (loading) return(<div>Loading</div>);
if (error) return(<div>Error occured ${error.message}</div>);
return (
<div className="App">
{
data.map((d, index) => {
return(<h1 key={index}>{d.address}</h1>)
})
}
</div>
);
}
export default App;Full list of supported React hooks
Please refer https://docs.nirvanalabs.io/docs-chain-query for more REST APIs.
useContractMetadata(): Retrieve the contract level metadata for a given addressuseContractTxns(): Get all transfers of NFTs for a given contract addressuseContractOwners(): Retrieves all owners within a given contract addressuseContractStatistics(): Retrieve stats about an NFT collection such as sales floor price, volume, token supply etc.useContractSearch(): Retrieves all owners within a given contract address Search by contract name, address & symboluseAllNftContracts(): Retrieves all tokens in a contract & metadatauseLatestTransactions(): Gets the transfer of the tokens matching the given addressuseLatestTransferTransactionByAddress(): Get all transfers of NFTs for a given contract addressuseTransferGetFromtoBlock(): Gets transfers of the tokens from_block -> to_block OR from_date -> to_dateuseTransactionByHash(): Gets Latest NFT Txns BY HASHuseTokenNews(): Retrieves all news related to a key word for Tokens or NFTs.