UNPKG

hyperspace-sdk

Version:

An unofficial SDK for Hyperspace NFT Marketplace on Avalanche

45 lines (38 loc) 1.08 kB
import dotenv from "dotenv"; import { Hyperspace } from "./hyperspace"; import { ethers } from "ethers"; dotenv.config(); (async () => { const HYPERSPACE_API_KEY = process.env.HYPERSPACE_API_KEY; const RPC_HTTP_URL = process.env.RPC_HTTP_URL; const PRIVATE_KEY = process.env.PRIVATE_KEY; if (!HYPERSPACE_API_KEY) { throw new Error("Missing required 'HYPERSPACE_API_KEY'"); } else if (!RPC_HTTP_URL) { throw new Error("Missing required 'RPC_HTTP_URL'"); } else if (!PRIVATE_KEY) { throw new Error("Missing required 'PRIVATE_KEY'"); } const hyperspace = new Hyperspace( HYPERSPACE_API_KEY, RPC_HTTP_URL, PRIVATE_KEY ); const result = await hyperspace.getUserActivity( "0x8cDD7A500f21455361cf1c2e01C0525ce92481b2", ["TRANSACTION"] ); let counter = 0; while ( ( await hyperspace.getUserActivity( "0x8cDD7A500f21455361cf1c2e01C0525ce92481b2", ["TRANSACTION"] ) ).pagination_info.has_next_page ) { console.log("has next page"); console.log(counter); counter++; } })();