Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Atomex

Hierarchy

  • Atomex

Index

Constructors

  • new Atomex(network: "testnet" | "mainnet", baseUrl: string, authToken?: string): Atomex
  • Parameters

    • network: "testnet" | "mainnet"
    • baseUrl: string
    • Optional authToken: string

    Returns Atomex

Methods

  • addOrder(addOrderRequest: AddOrderRequest): Promise<number>
  • Create a new Order in Atomex

    Parameters

    • addOrderRequest: AddOrderRequest

      details of the order being placed

    Returns Promise<number>

    order id

  • addSwapRequisites(swapID: string, swapRequisites: AddSwapRequisites): Promise<boolean>
  • Add Requisites to a Swap in Atomex

    Parameters

    • swapID: string

      id of swap

    • swapRequisites: AddSwapRequisites

      swap requisites being updated

    Returns Promise<boolean>

    true/false depending on operation success

  • cancelOrder(orderID: string, symbol: string, side: Side): Promise<boolean>
  • Cancel an order request in Atomex

    Parameters

    • orderID: string

      id of order to cancel

    • symbol: string

      symbol used in the order. A list of all symbols can be found using getSymbols

    • side: Side

      side of the order Buy or Sell

    Returns Promise<boolean>

    true/false value depending on operation success

  • formatAmount(amount: string | number, currency: string): number
  • Formatting an amount based on currency

    Parameters

    • amount: string | number

      Amount received / sent

    • currency: string

      L1/L2 token symbol (uppercase)

    Returns number

  • getAuthToken(authRequest: AuthTokenRequest): Promise<AuthTokenResponse>
  • Get Atomex authorization token

    remarks

    the message details can be generated using getAuthMessage

    Parameters

    • authRequest: AuthTokenRequest

      details of the message, timeStamp and signed message with the algorithm used

    Returns Promise<AuthTokenResponse>

    atomex authorization token with expiration time

  • getCurrencyConfig(currency: string): CurrencyConfig
  • Get currency & network specific configuration

    Parameters

    • currency: string

      L1/L2 token symbol (uppercase)

    Returns CurrencyConfig

  • getMaxOrderSize(orderBook: OrderBook, side: Side): number
  • Get maximum available liquidity

    Parameters

    • orderBook: OrderBook

      order-book received from getOrderBook

    • side: Side

      order side Buy/Sell

    Returns number

  • getOrder(orderID: string): Promise<Order>
  • Query specific Order using Order ID

    Parameters

    • orderID: string

      order id to query

    Returns Promise<Order>

    details of requested order

  • getOrderBook(symbol: string): Promise<OrderBook>
  • Get the Order Book for a particular Symbol

    Parameters

    • symbol: string

      a symbol eg. ETH/BTC. A list of all symbols can be found using getSymbols

    Returns Promise<OrderBook>

    an order book containing all orders for the particular symbol

  • getOrderPreview(orderBook: OrderBook, side: Side, amount: number, direction: "Send" | "Receive"): OrderPreview
  • Returns an approximate preview of the requested amount and expected receive amount

    Parameters

    • orderBook: OrderBook

      order-book received from getOrderBook

    • side: Side

      side for the transaction Buy/Sell

    • amount: number

      amount received/sent

    • direction: "Send" | "Receive"

      direction for the order - Send/Receive

    Returns OrderPreview

  • getOrderSide(symbol: string, fromCurrency: string, toCurrency: string): Side
  • Get order side for a particular trading pair given the bridge direction

    Parameters

    • symbol: string

      Atomex trading pair {baseCurrency}/{quoteCurrency}

    • fromCurrency: string

      Currency to send

    • toCurrency: string

      Currency to receive

    Returns Side

  • getOrders(getOrdersRequest?: GetOrdersRequest): Promise<Order[]>
  • Query and filter all available orders in Atomex

    Parameters

    • Optional getOrdersRequest: GetOrdersRequest

      optional filters for querying all orders

    Returns Promise<Order[]>

    list of orders

  • getQuotes(symbolList?: string[]): Promise<BookQuote[]>
  • Get Top of Book Quotes for all or specific Symbols

    Parameters

    • Optional symbolList: string[]

      an array of Symbols eg. ETH/BTC , XTZ/ETH. A list of all symbols can be found using getSymbols

    Returns Promise<BookQuote[]>

    a list of Book Quotes

  • getSwap(swapID: string): Promise<Swap>
  • Query specific Swap using Swap ID

    Parameters

    • swapID: string

      Atomex internal swap id

    Returns Promise<Swap>

    details of swap requested

  • getSwaps(getSwapsRequest?: GetSwapsRequest): Promise<Swap[]>
  • Query and filter all available swaps in Atomex

    Parameters

    • Optional getSwapsRequest: GetSwapsRequest

      filters for querying all swaps

    Returns Promise<Swap[]>

    a list of swaps

  • getSymbols(): Promise<SymbolData[]>
  • Get list of all available symbols in Atomex

    Returns Promise<SymbolData[]>

    list of all the symbols and their minimum qty.

  • setAuthToken(authToken: string): void
  • Initialize Atomex authorization token

    remarks

    the token can be generated using getAuthToken

    Parameters

    • authToken: string

      Atomex authorization token with expiration time

    Returns void

  • splitSymbol(symbol: string): [string, string]
  • Split Atomex trading pair to base and quote currencies

    Parameters

    • symbol: string

      Atomex trading pair {baseCurrency}/{quoteCurrency}

    Returns [string, string]

  • create(network: "testnet" | "mainnet" | "localhost"): Atomex
  • Parameters

    • network: "testnet" | "mainnet" | "localhost"

    Returns Atomex

Generated using TypeDoc