npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

whales-otc-pre-market-aptos-sdk

v1.1.2

Published

TypeScript SDK for Whales OTC Pre-Market trading on Aptos blockchain

Readme

Whales OTC Pre-Market Aptos SDK

A TypeScript SDK for interacting with Whales OTC (Over-The-Counter) Pre-Market trading contracts on the Aptos blockchain.

Installation

npm install whales-otc-pre-market-aptos-sdk

Quick Start

import { OTCPreMarketAptos, Network } from "whales-otc-pre-market-aptos-sdk";

// Initialize the SDK
const sdk = new OTCPreMarketAptos({
  network: Network.TESTNET, // or Network.MAINNET
});

// Get configuration
const config = await sdk.getConfig();
console.log(config);

// Get an OTC offer
const offer = await sdk.getOtcOffer("0x...offer_address");
console.log(offer);

Features

  • OTC Trading: Create, fill, update, and cancel OTC offers
  • Batch Operations: Support for batch creation and cancellation of offers
  • Role Management: Admin functions for role-based access control
  • Event Crawling: Built-in event crawler for monitoring blockchain events
  • GraphQL Support: Optional GraphQL integration for enhanced data querying
  • Type Safety: Full TypeScript support with comprehensive type definitions

Configuration

Basic Configuration

import { OTCPreMarketAptos, Network } from "whales-otc-pre-market-aptos-sdk";

const sdk = new OTCPreMarketAptos({
  network: Network.MAINNET,
  // Additional Aptos configuration options...
});

With GraphQL Support

import { OTCPreMarketAptos, Network } from "whales-otc-pre-market-aptos-sdk";

const sdk = new OTCPreMarketAptos(
  {
    network: Network.MAINNET,
  },
  {
    endpoint: "https://your-graphql-endpoint.com/graphql",
    // Additional GraphQL configuration...
  }
);

Core Methods

Reading Data

// Get platform configuration
const config = await sdk.getConfig();

// Get OTC offer details
const offer = await sdk.getOtcOffer("0x...offer_address");

// Get user role
const role = await sdk.getRole("0x...user_address");

// Check if offer is expired
const isExpired = await sdk.isOfferExpired("0x...offer_address");

Creating Offers

// Create a single offer
const { rawTx, txData } = await sdk.buildCreateOffer("0x...user_address", {
  orderObj: "0x...order_address",
  isBuyer: true,
  exToken: "0x...token_address",
  value: 1000000, // Amount in token's smallest unit
  deadline: Date.now() + 86400000, // 24 hours from now
});

// Batch create multiple offers
const { rawTx: batchTx, txData: batchTxData } = await sdk.buildBatchCreateOffer(
  "0x...user_address",
  {
    orderObjs: ["0x...order1", "0x...order2"],
    isBuyers: [true, false],
    exTokens: ["0x...token1", "0x...token2"],
    values: [1000000, 2000000],
    deadlines: [deadline1, deadline2],
  }
);

Managing Offers

// Fill an offer
const { rawTx, txData } = await sdk.buildFillOffer(
  "0x...user_address",
  "0x...offer_address"
);

// Update an offer
const { rawTx, txData } = await sdk.buildUpdateOffer("0x...user_address", {
  offerObj: "0x...offer_address",
  newValue: 1500000,
  newDeadline: Date.now() + 172800000, // 48 hours from now
});

// Cancel an offer
const { rawTx, txData } = await sdk.buildCancelOffer(
  "0x...user_address",
  "0x...offer_address"
);

// Cancel expired offers (batch)
const { rawTx, txData } = await sdk.buildCancelExpiredOffers(
  "0x...user_address",
  ["0x...offer1", "0x...offer2"]
);

Administrative Functions

// Add role to user (requires admin privileges)
const { rawTx, txData } = await sdk.buildAddRole(
  "0x...admin_address",
  "0x...user_address",
  Role.OPERATOR
);

// Remove role from user
const { rawTx, txData } = await sdk.buildRemoveRole(
  "0x...admin_address",
  "0x...user_address"
);

// Update platform configuration
const { rawTx, txData } = await sdk.buildUpdateConfig("0x...owner_address", {
  feePercent: 100, // 1% (basis points)
  feeWallet: "0x...new_fee_wallet",
});

// Force cancel offers (operator function)
const { rawTx, txData } = await sdk.buildForceCancelOffers(
  "0x...operator_address",
  ["0x...offer1", "0x...offer2"]
);

Event Crawling

The SDK includes a built-in event crawler for monitoring blockchain events:

const lastTxVersion = 0;
const limit = 100;

// Access the event crawler
const events = await sdk.eventCrawler.getEventsV2(lastTxVersion, limit);

console.log(events);

Types and Enums

The SDK exports comprehensive TypeScript types:

import {
  ConfigData,
  OtcOfferData,
  Role,
  OTCPreMarketError,
  TokenStatus,
  OfferType,
} from "whales-otc-pre-market-aptos-sdk";

Network Support

The SDK supports both Aptos Mainnet and Testnet:

import { Network } from "@aptos-labs/ts-sdk";

// Testnet
const testnetSdk = new OTCPreMarketAptos({ network: Network.TESTNET });

// Mainnet
const mainnetSdk = new OTCPreMarketAptos({ network: Network.MAINNET });

Requirements

  • Node.js >= 22.0.0
  • TypeScript >= 5.8.3

License

MIT

Contributing

Please read our contributing guidelines before submitting pull requests.

Support

For support and questions, please open an issue on GitHub or contact the Whales team.