Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

100x-client

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

100x-client

A TypesScript SDK for the 100x exchange API.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-60%
Maintainers
1
Weekly downloads
 
Created
Source
100x Logo

100x TypeScript Client SDK Test & Release npm version

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.

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)
}

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 sever where you can get full support from the team.

License

MIT License © 2024-Present Tim Dunphy

Keywords

FAQs

Package last updated on 19 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc