Skip to content

modulenft/module-sdk

Repository files navigation

Module TypeScript SDK

The Module SDK is a TypeScript library that exposes powerful methods to quickly and easily get all your Web3 data. Powered by Modules APIs, Module SDK exposes methods for each and every endpoint that Module provides.

Quickly access information about NFT collections, token holders, collection statistics and much much more!

Information 📖
Some methods have names that differ from their api counterparts on the documentation as a result of consistency for the SDK.

Features ✨
Have a specific feature that you want added? Open a ticket in our discord and we can discuss building it for you!

Feedback/Issues 🤝
We welcome feedback and pull requests! Either open a ticket in our discord or open an issue on the repo and we can look into it!

Getting Started

yarn

yarn add module-sdk

npm

npm i module-sdk

After installing the SDK, import it using the following code

import { Module, ModuleConfig } from "module-sdk";

// Configuration object for the Module SDK. 
const config: ModuleConfig = {
  apiKey: "", // Module API Key. Not required, however rate limits will apply.
};

// Create a new instance of the SDK
const client = new Module(config);

SDK Usage

All methods are exposed through their own classes. There are four usable classes as shown below

import { Module } from "module-sdk";

const client = new Module();

client.eth; // Ethereum Methods

client.nft; // NFT Methods

client.central; // Central Methods

client.metadata; // Metadata Methods

All methods return promises that either resolve or reject depending on the server response. Handle errors accordingly.

try {
await client.eth.getTransaction({} as GetTransaction);
} catch(err) {
console.log(err);
}

Method Documentation

Refer below for information on each classes methods.

Examples

Getting azuki collection info

import { Module } from 'module-sdk';

const client = new Module({apiKey: ''});

const collectionInfo = await client.nft.getCollectionInfo({slug: 'azuki'});

Getting azuki contract abi

import { Module } from 'module-sdk';

const client = new Module({apiKey: ''});

const abi = await client.metadata.getContractABI({contractAddress: '0xed5af388653567af2f388e6224dc7c4b3241c544'});