NFT Client

A Light Typescript Client Supporting NFT and Public ARK REST API

Prerequisites

Before we get started we need to make sure that all of the required dependencies are installed.

yarn

yarn add @protokol/client

Initialization

import { ProtokolConnection } from "@protokol/client";
const connection = new ProtokolConnection("https://api.protokol.com/api");

NFT Base Endpoints

Collections

List All Collections

const response = connection.NFTBaseApi("collections").all();
>>> Promise<ApiResponseWithPagination<CollectionsResource[]>>

Get Collection By Id

const response = connection.NFTBaseApi("collections").get("VALID_ID");
>>> Promise<ApiResponse<CollectionsResource>>

Get Schema By Id

const response = connection.NFTBaseApi("collections").getSchema("VALID_ID");
>>> Promise<ApiResponse<Schema>>

Get Collections Wallet

const response = connection.NFTBaseApi("collections").wallet("VALID_ID");
>>> Promise<ApiResponse<CollectionsWallet>>

Search Collections

const response = connection.NFTBaseApi("collections").searchByCollections({
jsonSchema: {
"VALID_JSON_OBJECT"
},
});
>>> Promise<ApiResponseWithPagination<CollectionsResource[]>>

Search Asset By Collection Id

const response = connection.NFTBaseApi("collections").assetByCollectionId("VALID_ID");
>>> Promise<ApiResponseWithPagination<CollectionsAsset[]>>

Assets

Return All Assets

const response = connection.NFTBaseApi("assets").all();
>>> Promise<ApiResponseWithPagination<AssetsResource[]>>

Return Asset By Id

const response = connection.NFTBaseApi("assets").get("VALID_ID");
>>> Promise<ApiResponse<AssetsResource>>

Return Assets Wallet

const response = connection.NFTBaseApi("assets").wallet("VALID_ID");
>>> Promise<ApiResponse<AssetsWallet>>

Search By Asset

const response = connection.NFTBaseApi("assets").searchByAsset({
"VALID_JSON_OBJECT"
});
>>> Promise<ApiResponseWithPagination<AssetsResource[]>>

Transfers

Return All Transfers

const response = connection.NFTBaseApi("transfers").all();
>>> Promise<ApiResponseWithPagination<TransfersResource[]>>

Return Transfer By Id

const response = connection.NFTBaseApi("transfers").get("VALID_ID");
>>> Promise<ApiResponse<TransfersResource>>

Burns

Return All Burns

const response = connection.NFTBaseApi("burns").all();
>>> Promise<ApiResponseWithPagination<BurnsResource[]>>

Return Burn By Id

const response = connection.NFTBaseApi("burns").get("VALID_ID");
>>> Promise<ApiResponse<BurnsResource>>

Configurations

Return Base Configurations

const response = connection.NFTBaseApi("configurations").index();
>>> Promise<ApiResponse<ConfigurationsResource>>

NFT Exchange Endpoints

Auctions

Return All Auctions

const response = connection.NFTExchangeApi("auctions").getAllAuctions();
>>> Promise<ApiResponseWithPagination<AuctionsResource[]>>

Return Auction By Id

const response = connection.NFTExchangeApi("auctions").getAuctionById("VALID_ID");
>>> Promise<ApiResponse<AuctionsResource>>

Return Auctions Wallet

const response = connection.NFTExchangeApi("auctions").getAuctionsWallets("VALID_ID");
>>> Promise<ApiResponse<AuctionsWallet>>

Search By Asset

const response = connection.NFTExchangeApi("auctions").searchByAsset({
nftIds: ["VALID_NFT_IDS"],
senderPublicKey: "VALID_SENDER_PUBLIC_KEY",
startAmount: "START_AMOUNT",
expiration: {
blockHeight: BLOCK_HEIGHT,
},
});
>>> Promise<ApiResponseWithPagination<AuctionsResource[]>>

Return All Canceled Auctions

const response = connection.NFTExchangeApi("auctions").getAllCanceledAuctions();
>>> Promise<ApiResponseWithPagination<AuctionCanceled[]>>

Return Canceled Auction By Id

const response = connection.NFTExchangeApi("auctions").getCanceledAuctionById("VALID_ID");
>>> Promise<ApiResponse<AuctionCanceled>>

Bids

Return All Bids

const response = connection.NFTExchangeApi("bids").getAllBids();
>>> Promise<ApiResponse<BidsResource>>

Return Bid By Id

const response = connection.NFTExchangeApi("bids").getBidById("VALID_ID");
>>> Promise<ApiResponse<BidsResource>>

Return Bids Wallet

const response = connection.NFTExchangeApi("bids").getBidsWallets("VALID_ID");
>>> Promise<ApiResponse<BidsWallet>>

Search Bid

const response = connection.NFTExchangeApi("bids").searchByBid({
auctionId: "VALID_AUCTION_ID",
senderPublicKey: "VALID_SENDER_PUBLIC_KEY",
bidAmount: "BID_AMOUNT",
});
>>> Promise<ApiResponse<BidCanceled>>

Return All Canceled Bids

const response = connection.NFTExchangeApi("bids").getCanceledBidById("VALID_ID");
>>> Promise<ApiResponse<BidCanceled>>

Trades

Return All Trades

const response = connection.NFTExchangeApi("trades").all();
>>> Promise<ApiResponse<TradesResource>>

Return Trade By Id

const response = connection.NFTExchangeApi("trades").get("VALID_ID");
>>> Promise<ApiResponse<TradeById>>

Search Trade

const response = connection.NFTExchangeApi("trades").search({
auctionId: "VALID_AUCTION_ID",
bidId: "VALID_BID_ID",
senderPublicKey: "VALID_SENDER_PUBLIC_KEY",
});
>>> Promise<ApiResponseWithPagination<TradesResource[]>>

Configurations

const response = connection.NFTExchangeApi("configurations").index();
>>> Promise<ApiResponse<ConfigurationsResource>>