Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@mintbase-js/data
Advanced tools
[//]: # { "title": "@mintbase-js/data", "order": "2" }
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.
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
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.
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 }),
});
}
method name | params | description |
---|---|---|
ownedNftsByStore | ownerId: string,contractAddress: string, pagination: {limit: number, offset:number} | get all nfts from a single store |
ownedTokens | ownerId: string,{limit: number, offset:number} | get all tokens/nfts from a owner |
tokenById | tokenId: string, contractAddress: string | get token data by id of certain contract |
tokenListingCountsByMetaId | metadataId: string | get token listings from metadata id |
tokensByStatus | metadataId: string, ownedBy: string | get token by status on metadataId, and owner |
tokenOwner | tokenId: string, contractAddress: string | get token owner by token id and certain contract |
tokenProvenance | tokenId: string, contractAddress: string, pagination?: {limit: number, offset:number} | get token provenance by token id and certain contract |
tokenOwnersByMetadataId | metadataId: string, pagination?: {limit: number, offset:number} | get token owners by metadata id |
ownedStores | ownerId: string | get stores owned by owner id |
nearPrice | - | get near price in usd |
checkStoreName | name: string | check if store name already exists |
storeData | `contractAddress: string | string[]` |
storeNfts | `contractAddress: string | string[], showOnlyListed?: boolean, pagination?: {limit: number, offset:number}` |
metadataByMetadataId | metadataId: string | get metadata by metadataId |
tokenByAttributes | contractId: string, filters: AttributesFilters | get tokens of a certain contract and filters |
attributesByContract | contractId: string | get attributes of a certain contract |
attributeRarity | contractId: string, attributeType: string, attributeValue: string | get 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
Query wrappers for Mintbase JS SDK
The npm package @mintbase-js/data receives a total of 149 weekly downloads. As such, @mintbase-js/data popularity was classified as not popular.
We found that @mintbase-js/data demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.