Catalog npm
Back to packageRELEASE DETAILS

1.2.0

npm

100x-client

A TypesScript SDK for the 100x exchange API.

100xapicryptocryptocurrencydexevmexchangeorderbookperpsresttrading
Published26 Jun 2024
Direct dependencies3
Transitive dependenciesNot calculated

README

Current package documentation

100x Logo

Build NPM Version Discord

Interact with the 100x decentralized exchange and trade pre-launch tokens, BTC, ETH, SOL, BLUR and other cryptocurrency perp futures with leverage. Live on Blast.

npm install 100x-client
# or
yarn add 100x-client
# or
pnpm add 100x-client
# or
bun install 100x-client

Usage

Getting started is a simple case of importing the Client and instantiating an instance.

import HundredXClient from '100x-client'

const MY_PRIVATE_KEY = '0x...'

const Client = new HundredXClient(MY_PRIVATE_KEY)

The client can also accept a configuration object as the second parameter.

KeyTypeDefaultDescription
debugbooleanfalseUsed to enable debug mode when running the client for additional logging.
environment'testnet' | 'mainnet''testnet'Specify the environment you wish to trade in.
rpcstringBlast RPC based on environmentSpecify a custom RPC url to used.
subAccountIdnumber1Specify a sub-account ID to use. This can be from 1-255.
import HundredXClient from '100x-client'

const CONFIG = {
  debug: false,
  environment: 'testnet',
  rpc: 'https://sepolia.blast.io',
  subAccountId: 1,
}
const MY_PRIVATE_KEY = '0x...'

const Client = new HundredXClient(MY_PRIVATE_KEY)

Getting started

To get started, you will need to deposit funds and make a trade. Let's look at how we can do that now. If you're in need of testnet funds, please head over to the 100x Discord server where we will be happy to help.

import HundredXClient from '100x-client'
import { OrderType, TimeInForce } from '100x-client/enums'

const MY_PRIVATE_KEY = '0x...'

const Client = new HundredXClient(MY_PRIVATE_KEY)

// Let's deposit 1000 USDB to get started. By default deposits are in USDB.
const { error, success, transactionHash } = await Client.deposit(1000)

// Now we can make an order. Let's go long on some ETH!
if (success) {
  const { error, order } = await Client.placeOrder({
    isBuy: true,
    orderType: OrderType.LIMIT,
    price: 2990,
    productId: 1002,
    quantity: 1,
    timeInForce: TimeInForce.GTC,
  })

  // Finally let's log out our order to check the details.
  console.log(order)
}

Handy enums

A series of useful enums can be imported from 100x-client/enums and used to help match against responses or compose payloads.

NameValuesDescription
EnvironmentMAINNET | TESTNETThe environment to use when initialising the client.
Interval'1M' | '5M' | '15M' | '30M' | '1H' | '2H' | '4H' | '8H' | '1D' | '3D' | '1W'The interval to use when fetching K-line data.
MarginAssetsUSDBSymbol values of supported margin assets.
OrderStatusCANCELLED | EXPIRED | FILLED | OPEN | PENDING | REJECTEDDefines the possible states an order can be in.
OrderTypeLIMIT | LIMIT_MAKER | MARKETOrder types for building order payloads.
TimeInForceGTC | FOK | IOCTime in force values for building order payloads.

Further support

For more detailed information on specific endpoints, please refer to the official 100x API docs. Each function in this client contains detailed JSDocs on arguments and return types to aid the developer experience as well as links to their respective endpoints within the official docs.

Contributing

Want to contribute? Check out that contributing guide to get started.

Support

Having troubles getting started? Feel free to join us the official 100x Discord server where you can get full support from the team.

License

MIT License © 2024-Present Tim Dunphy

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 3

Native requirements
3 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
pino
Environment
{
  "local_name": "pino",
  "alias": false,
  "peer_metadata": null
}
^8.19.0runtime
viem
Environment
{
  "local_name": "viem",
  "alias": false,
  "peer_metadata": null
}
^2.9.9runtime
pino-pretty
Environment
{
  "local_name": "pino-pretty",
  "alias": false,
  "peer_metadata": null
}
^11.0.0runtime

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "56bac4ea4734f8a13f80184278b1be48b6f66533",
  "tarball": "https://registry.npmjs.org/100x-client/-/100x-client-1.2.0.tgz",
  "fileCount": 10,
  "integrity": "sha512-+cWSx7okSMoSJXRPMuw4qJnuXDymtjhQjiVjJITz4u4Geq2sPXUmjn/DJgmiYm8alUmeJSpGhUvZAIHsWEq1Sg==",
  "signatures": [
    {
      "sig": "MEUCIBA4gs5mSLZry4DFbeDdlm7771Snk6MfqbhVNj9A6Vu+AiEA3l0xcLjr39w1oGqCOL4TtdRkyGFfMD+j1fhq2BzWmjU=",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 77804
}

Repository

PENDING
meanboycousin/100xclient

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:59 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:a2e54629fb95c550bc707f50fc43ecdba1e952f0c85e7ebca5a6bde235985c12

Other collected versions

1.1.111 Jun1.1.028 May1.0.324 Apr1.0.222 Apr1.0.119 Apr1.0.019 AprView all collected versions →