Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

@basementdev/sdk

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@basementdev/sdk

Basement SDK

Source
npmnpm
Version
0.1.2
Version published
Maintainers
2
Created
Source

Basement SDK

The Basement SDK has sensible defaults and flexibility to allow you to get the data you want efficiently and effortlessly.

Installation

Basement SDK is available as an npm package

npm:

npm install @basementdev/sdk

yarn:

yarn add @basementdev/sdk

Getting Started

Here's an example of a basic query using the SDK:

import { BasementSDK } from "@basementdev/sdk";

const sdk = new BasementSDK();

const { address } = await sdk.address({
  name: "vitalik.eth",
  include: { tokens: { limit: 5 }, profile: true },
});

Methods

token

Queries information about a specific token

Example usage

const { token } = await sdk.token({
  contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
  tokenId: "660",
  include: {
    owner: {
      profile: true,
      reverseProfile: true,
    },
  },
});

Parameters

NameTypeDefaultDescription
contractstringThe contract hex-address.
tokenIdstringThe token ID within the contract.
idnumberInternal ID - can be used for caching purposes.
includeobjectObject used to choose what other data you want to include in the response.
include.ownerobjectIf the owner object is empty, only the owner's address will be included.
include.owner.profileboolfalseIf true, the profile information will be included, if available.
include.owner.reverseProfileboolfalseIf true, the reverse resolution of the ENS (ENS docs) profile information will be included, if available.

tokens

Query tokens that satisfy the given filter(s)

Example usage

const { tokens } = await sdk.tokens({
  filter: { contractAddress: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" },
  limit: 5,
  include: {
    owner: {
      profile: true,
      reverseProfile: true,
    },
  },
});

Parameters

NameTypeDefaultDescription
filterobjectObject used to return a response based on the filtering option(s)
filter.contractAddressstringFilter tokens that satisfy the given contract address.
limitnumber10Maximum number of tokens to return.
includeobjectObject used to choose what other data you want to include in the response.
include.ownerobjectIf the owner object is empty, only the owner's address will be included.
include.owner.profileboolfalseIf true, the profile information will be included, if available.
include.owner.reverseProfileboolfalseIf true, the reverse resolution of the ENS (ENS docs) profile information will be included, if available.
cursorstringCursor used for pagination. To go the next page, provide the given cursor from the response.

address

Queries information about an address

Example usage

const { address } = await sdk.address({
  name: "vitalik.eth",
  include: { profile: true, tokens: { limit: 5 } },
});

Parameters

NameTypeDefaultDescription
namestringhex-address or ENS address
includeobjectObject used to choose what other data you want to include in the response.
include.profileboolfalseIf true, the profile information will be included, if available.
include.reverseProfileboolfalseIf true, the reverse resolution of the ENS (ENS docs) profile information will be included, if available.
include.tokensobjectIf the tokens object is empty, it will include the tokens that the address holds with the default values for the parameters inside the tokens object.
include.tokens.limitnumber10Maximum number of tokens to return.
include.tokens.filterSuspectedScamsboolfalseExperimental - If true, it will remove the results that are suspected to be scams.

tokenMetadataRefresh

Refreshes metadata of a specific token

Example usage

const { tokenMetadataRefresh } = await sdk.tokenMetadataRefresh({
  contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
  tokenId: "660",
});

Parameters

NameTypeDefaultDescription
contractstringThe contract hex-address.
tokenIdstringThe token ID within the contract.
idnumberInternal ID - can be used for caching purposes.

tokenTransfers

Query token transfers that satisfy the given filter(s)

Example usage

const { tokenTransfers } = await sdk.tokenTransfers({
  filter: { contractAddress: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" },
  limit: 5,
  include: {
    erc721Metadata: true,
    from: {
      profile: true,
      reverseProfile: true,
      tokens: {},
    },
    to: {
      profile: true,
      reverseProfile: true,
      tokens: {},
    },
  },
});

Parameters

NameTypeDefaultDescription
filterobjectObject used to return a response based on the filtering option(s).
filter.contractAddressstringFilter tokens that satisfy the given contract address.
limitnumber10Maximum number of token transfers to return.
includeobjectObject used to choose what other data you want to include in the response.
include.erc721MetadataboolfalseIf true, it will include ERC721, like tokenId, attributes, contractAddress, etc.
include.fromobjectIf the from object is empty, only the from's address will be included.
include.from.profileboolfalseIf true, the profile information will be included, if available.
include.from.reverseProfileboolfalseIf true, the reverse resolution of the ENS (ENS docs) profile information will be included, if available.
include.from.tokensobjectIf the tokens object is empty, it will include the tokens that the address holds with the default values for the parameters inside the tokens object.
include.from.tokens.limitnumber10Maximum number of tokens to return.
include.from.tokens.filterSuspectedScamsboolfalseExperimental - If true, it will remove the results that are suspected to be scams.
include.toobjectIf the to object is empty, only the to's address will be included.
include.to.profileboolfalseIf true, the profile information will be included, if available.
include.to.reverseProfileboolfalseIf true, the reverse resolution of the ENS (ENS docs) profile information will be included, if available.
include.to.tokensobjectIf the tokens object is empty, it will include the tokens that the address holds with the default values for the parameters inside the tokens object.
include.to.tokens.limitnumber10Maximum number of tokens to return.
include.to.tokens.filterSuspectedScamsboolfalseExperimental - If true, it will remove the results that are suspected to be scams.

Keywords

nft

FAQs

Package last updated on 20 Jul 2022

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