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

Overview

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

Name Type Default Description
contract string The contract hex-address.
tokenId string The token ID within the contract.
id number Internal ID - can be used for caching purposes.
include object Object used to choose what other data you want to include in the response.
include.owner object If the owner object is empty, only the owner's address will be included.
include.owner.profile bool false If true, the profile information will be included, if available.
include.owner.reverseProfile bool false If 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

Name Type Default Description
filter object Object used to return a response based on the filtering option(s)
filter.contractAddress string Filter tokens that satisfy the given contract address.
limit number 10 Maximum number of tokens to return.
include object Object used to choose what other data you want to include in the response.
include.owner object If the owner object is empty, only the owner's address will be included.
include.owner.profile bool false If true, the profile information will be included, if available.
include.owner.reverseProfile bool false If true, the reverse resolution of the ENS (ENS docs) profile information will be included, if available.
cursor string Cursor 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

Name Type Default Description
name string hex-address or ENS address
include object Object used to choose what other data you want to include in the response.
include.profile bool false If true, the profile information will be included, if available.
include.reverseProfile bool false If true, the reverse resolution of the ENS (ENS docs) profile information will be included, if available.
include.tokens object If 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.limit number 10 Maximum number of tokens to return.
include.tokens.filterSuspectedScams bool false Experimental - 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

Name Type Default Description
contract string The contract hex-address.
tokenId string The token ID within the contract.
id number Internal 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

Name Type Default Description
filter object Object used to return a response based on the filtering option(s).
filter.contractAddress string Filter tokens that satisfy the given contract address.
limit number 10 Maximum number of token transfers to return.
include object Object used to choose what other data you want to include in the response.
include.erc721Metadata bool false If true, it will include ERC721, like tokenId, attributes, contractAddress, etc.
include.from object If the from object is empty, only the from's address will be included.
include.from.profile bool false If true, the profile information will be included, if available.
include.from.reverseProfile bool false If true, the reverse resolution of the ENS (ENS docs) profile information will be included, if available.
include.from.tokens object If 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.limit number 10 Maximum number of tokens to return.
include.from.tokens.filterSuspectedScams bool false Experimental - If true, it will remove the results that are suspected to be scams.
include.to object If the to object is empty, only the to's address will be included.
include.to.profile bool false If true, the profile information will be included, if available.
include.to.reverseProfile bool false If true, the reverse resolution of the ENS (ENS docs) profile information will be included, if available.
include.to.tokens object If 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.limit number 10 Maximum number of tokens to return.
include.to.tokens.filterSuspectedScams bool false Experimental - If true, it will remove the results that are suspected to be scams.
You might also like...

Blog-webapp - A simple webapp prototype that serves tech news, blogs, and anything else a developer might want to learn or get help with

Blog-webapp - A simple webapp prototype that serves tech news, blogs, and anything else a developer might want to learn or get help with

Blog Web app A simple webapp prototype that serves tech news, blogs, and anythin

Nov 3, 2022

Chrome Extension that enables you to read 30% more efficiently and easily!

Chrome Extension that enables you to read 30% more efficiently and easily!

Bionic Reading Extension that enables you to read 30% more efficiently and easily! About The Project All credits for this method go to https://bionic-

Jan 1, 2023

A quotaless, partially limitless, and fast Node.js Multiplayer Piano server implementation that efficiently makes use of the protocol and uWebSockets.js

speedymppserver A quotaless, partially limitless, and fast Node.js Multiplayer Piano server implementation that efficiently makes use of the protocol

Oct 14, 2022

Offer a translation system to your users! a plugin capable of translating your website, simply and efficiently!

Offer a translation system to your users! a plugin capable of translating your website, simply and efficiently!

TranslateForMe Offer a translation system to your users, a plugin capable of translating your website, simply and efficiently! View Demo · Report Bug

Jan 12, 2022

Open-source CD platform that helps developers to deliver applications efficiently by simplifying software releases and operations in any environment.

Open-source CD platform that helps developers to deliver applications efficiently by simplifying software releases and operations in any environment.

dyrector.io - The open source internal delivery platform Overview dyrector.io is an open-source internal delivery platform that helps developers to de

Jan 3, 2023

A simple, no-hassle library for efficiently querying Your Enrollment Services.

@vanderbilt/yes-api A simple, no-hassle library for efficiently querying Your Enrollment Services. Created by Dylan Hanson (jovialis) NOTE: THIS MODUL

Jan 25, 2022

Web application that manages your sales team efficiently.

Sales Incentive Management System Overview • Entities • APIs • Demo • Application Properties • Development • Build Overview Problem Statement Creating

Nov 28, 2022

This SDK helps developers get started with the on-chain tools provided by Metaplex.

This SDK helps developers get started with the on-chain tools provided by Metaplex.

Metaplex JavaScript SDK ⛔️ DO NOT USE IN PRODUCTION, THIS SDK IS IN VERY EARLY ALPHA STAGES! This SDK helps developers get started with the on-chain t

Dec 27, 2022
Comments
  • Refactor shape when including options

    Refactor shape when including options

    Previously, when including options in the response, the API looked like this:

    const { token } = await sdk.token({
      contract: string,
      tokenId: string,
      includeOwnerProfile: boolean,
      includeOwnerReverseProfile: boolean
    })
    

    Now, it's refactored to have the following shape:

    const { token } = await sdk.token({
      contract: string,
      tokenId: string,
      include: {
          owner: {
          profile: boolean,
          reverseProfile: boolean
        }
      }
    })
    

    JSDoc has also been added to each property as opposed to the function, which provides a better developer experience

    opened by anasyusef 1
Owner
Basement for Developers
Basement is the easiest way to build on web3.
Basement for Developers
This package includes the sensible ESLint configuration used by our team

TypeScript + Prettier ESLint configuration for CasterlyApp team (and others)

Casterly 2 Jan 26, 2022
Veselin Petranchev 2 Oct 11, 2022
Grayce Muthui 8 Jun 16, 2022
A little CLI for making TypeScript packages, cleanly and effortlessly.

TSEX A little CLI for making TypeScript packages, cleanly and effortlessly. Install npm install -g tsex Usage Usage: tsex [options] [command] A littl

Fabio Spampinato 6 Nov 15, 2022
Create your own wrappings with optional key bindings for selected text, a set of useful defaults is also provided.

Create your own wrappings with optional key bindings for selected text, a set of useful defaults is also provided.

Seth Yuan 66 Jan 1, 2023
Debug your Jest tests. Effortlessly.🛠🖼

Jest Preview Debug your Jest tests. Effortlessly. ?? ?? Try Jest Preview Online. No downloads needed! Why jest-preview When writing tests using Jest,

Hung Viet Nguyen 2.1k Jan 4, 2023
Cupcakes SDK to allow developers access to Authentication & Smart Contract Wallets

Introduction Cupcakes allow DAPPs developers access to Smart Contract Wallets. These wallets can be DAPPs specific or User specific. You must read abo

null 7 Nov 26, 2022
Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's `move-ts`.

Movehat Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's move-ts. Movehat aspires to b

Pentagon 10 Sep 30, 2022
The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling rapid development of iofod extensions through the SDK.

iofod-sdk English | 简体中文 The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling

iofod, Inc. 47 Oct 17, 2022
This tool allows you to draw up plans for facilities from Foxhole's new Inferno update. It takes power and resource needs into account to help you efficiently design your facilities.

Foxhole Facility Planner This tool allows you to draw up plans for facilities from Foxhole's new Inferno update. It takes power and resource needs int

Brandon Ray 23 Dec 23, 2022