Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mintbase-js/data

Package Overview
Dependencies
Maintainers
0
Versions
1320
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mintbase-js/data

Query wrappers for Mintbase JS SDK

  • 0.6.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
117
decreased by-72.14%
Maintainers
0
Weekly downloads
 
Created
Source

[//]: # { "title": "@mintbase-js/data", "order": "2" }

@mintbase-js/data

Built-in methods to help fetch data from our indexer. These methods aim to make it as easy as possible to get blockchain data.

If the data you want to get is more specific also check out our GraphQL schema instead.

Source Configuration

You can set network and in some cases default contract configuration using the SDK's mbjs.config method. Read about config global variables on: Config SDK method

Usage Options

The default export methods return a wrapped result object with error and data properties. For example const { error, data } = myApiMethod() will provide any network errors inside of error in the event of failure, and the expected result in data on success.

If you prefer to catch errors, you can import the method from @mintbase-js/data/lib/unwrap instead. e.g. import { ownedTokens } from '@mintbase-js/data/lib/unwrap which will re-throw in the event of an error.

use our GraphQL Fetch Method

check our GraphQl Fetch Method

ex:


import { QUERIES, fetchGraphQl } from '@mintbase-js/data'
import { mbjs } from '@mintbase-js/sdk'

const myFetchMethod = ({showOnlyListed, pagination, network}) => {
    const { data, error } = await fetchGraphQl<MyResultType>({
      query: QUERIES.storeNftsQuery,
      variables: {
        condition: {
          nft_contract_id: { _in: mbjs.keys.contractAddress },
          ...(showOnlyListed && { price: { _is_null: false } }),
        },
        limit: pagination?.limit ?? 12,
        offset: pagination?.offset ?? 0,
      },
      ...(network && { network:network }),
    });
  }

Use our Queries on your own GraphQL Service Implementation

check our Queries here

API Methods

method nameparamsdescription
ownedNftsByStoreownerId: string,contractAddress: string, pagination: {limit: number, offset:number}get all nfts from a single store
ownedTokensownerId: string,{limit: number, offset:number}get all tokens/nfts from a owner
tokenByIdtokenId: string, contractAddress: stringget token data by id of certain contract
tokenListingCountsByMetaIdmetadataId: stringget token listings from metadata id
tokensByStatusmetadataId: string, ownedBy: stringget token by status on metadataId, and owner
tokenOwnertokenId: string, contractAddress: stringget token owner by token id and certain contract
tokenProvenancetokenId: string, contractAddress: string, pagination?: {limit: number, offset:number}get token provenance by token id and certain contract
tokenOwnersByMetadataIdmetadataId: string, pagination?: {limit: number, offset:number}get token owners by metadata id
ownedStoresownerId: stringget stores owned by owner id
nearPrice-get near price in usd
checkStoreNamename: stringcheck if store name already exists
storeData`contractAddress: stringstring[]`
storeNfts`contractAddress: stringstring[], showOnlyListed?: boolean, pagination?: {limit: number, offset:number}`
metadataByMetadataIdmetadataId: stringget metadata by metadataId
tokenByAttributescontractId: string, filters: AttributesFiltersget tokens of a certain contract and filters
attributesByContractcontractId: stringget attributes of a certain contract
attributeRaritycontractId: string, attributeType: string, attributeValue: stringget attribute rarity of a certain contract, attribute type and attribute value

While we will continue to provide public and our new mb_views schema objects, we will also begin to introduce helper methods here that can be used to query data without having to write any graphql.

For now, reference our existing graphql docs and be sure to check back here soon for updates concerning our data layer API.

FAQs

Package last updated on 19 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc