Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface BityApiClientInterface

The Bity API client interface that abstracts all Bity services.

Hierarchy

  • BityApiClientInterface

Index

Properties

createOrder

createOrder: (order: PreparedOrder) => Promise<URL>

Type declaration

fetchAuthorizationCode

fetchAuthorizationCode: () => void

To begin the OAuth2 process. Will direct the user to the authorization server, as specified in the [oauthConfig].

Type declaration

    • (): void
    • Returns void

fetchCurrencies

fetchCurrencies: (specificCurrency?: CurrencyCode, options?: KeyValues) => Promise<Currency[]>

Get information on currencies.

param

Get information on a specific currency.

param

See https://doc.bity.com/exchange/v2.html#bity-exchange-api-currencies for options.

Type declaration

fetchEstimateForOrder

fetchEstimateForOrder: (order: PreparedOrder) => Promise<Order>

Get an estimate for an order. Takes a prepared order object created with generateObjectForOrderCreation.

returns

An Order object with the estimated values.

Type declaration

fetchExchangeRates

fetchExchangeRates: () => Promise<PairRate[]>

Legacy functions - use at your own risk.

Type declaration

fetchExchangeRatesHistory

fetchExchangeRatesHistory: () => Promise<ExchangeRateHistory[]>

Type declaration

fetchOrderWithId

fetchOrderWithId: (orderRef: OrderReference) => Promise<OrderPaymentDetailsAll>

Type declaration

fetchOrderWithUrl

fetchOrderWithUrl: (orderUrl: URL) => Promise<OrderPaymentDetailsAll>

Type declaration

fetchOrders

fetchOrders: () => Promise<OrderPaymentDetailsAll[]>

Type declaration

fetchPairs

fetchPairs: (options?: KeyValues) => Promise<Pair[]>

Get information on pairs.

param

See https://doc.bity.com/exchange/v2.html#list-currency-pairs for options.

Type declaration

fromOrderIdToUrl

fromOrderIdToUrl: (orderRef: OrderReference) => URL | undefined

Get the proper order URL from an order Id.

Type declaration

getAccessToken

getAccessToken: () => Promise<AccessContext>

Gets the access token from the auth server. It abstracts away the exchange of an authorization code for an access token, or refreshing an access token with a refresh token.

Type declaration

isAccessTokenExpired

isAccessTokenExpired: () => boolean

Determines if the current access token is expired. Will return false if the access token hasn't been fetched yet.

Type declaration

    • (): boolean
    • Returns boolean

isAuthorized

isAuthorized: () => boolean

Determines if there is any access token fetched. Does not mean it is valid, so you must still check the expiry.

Type declaration

    • (): boolean
    • Returns boolean

isReturningFromAuthServer

isReturningFromAuthServer: () => Promise<boolean>

Determines if the user is returning from the auth server. Returns a promise since something could possibly go wrong, and inside the callback indicates if they actually have.

Type declaration

    • (): Promise<boolean>
    • Returns Promise<boolean>

resetOAuth

resetOAuth: () => void

Resets the current OAuth state, effectively "logging out" the user.

Type declaration

    • (): void
    • Returns void

setOAuthActive

setOAuthActive: (isActive: boolean) => void

Stops or starts decorating fetch with OAuth headers.

Type declaration

    • (isActive: boolean): void
    • Parameters

      • isActive: boolean

      Returns void

verifySignature

verifySignature: (relativeUrlReturnedByOrderPaymentDetails: URL, signature: string) => Promise<void>
param

This is the URL to submit the signature to. It's unique, so that's why a new one is given for each order.

param

A signature formatted according to the cryptocurrency being used in the trade. For example, Ethereum signature are string-hex-encoded, starting with a '0x' followed by all the hex characters. Bitcoin is base58 encoded. Other currencies will have their own encoding schemes.

returns

A resolved or rejected promise, which corresponds to a successful or failed verification.

Type declaration

    • (relativeUrlReturnedByOrderPaymentDetails: URL, signature: string): Promise<void>
    • Parameters

      • relativeUrlReturnedByOrderPaymentDetails: URL
      • signature: string

      Returns Promise<void>

Methods

createBookmark

fetchBookmark

  • Fetch a particular bookmark.

    Parameters

    • bookmarkUrl: URL

      A URL which references a bookmark to fetch.

    Returns Promise<BookmarkResponse>

fetchBookmarks

  • Fetches many bookmarks and can filter them based options passed.

    Parameters

    • Optional options: KeyValues

      A dictionary of options.

      The current options accepted are: { currency: string }.

    Returns Promise<BookmarkResponse>

removeBookmark

  • removeBookmark(bookmarkUrl: URL): Promise<any>
  • Remove a particular bookmark.

    Parameters

    • bookmarkUrl: URL

      A URL which references a bookmark to fetch. Check the status code for success (200) or not found (404).

    Returns Promise<any>

Generated using TypeDoc