Skip to content

Latest commit

 

History

History
454 lines (296 loc) · 18.3 KB

File metadata and controls

454 lines (296 loc) · 18.3 KB

ExchangeAccountsApi

All URIs are relative to https://developers.fireblocks.com/reference/

Method HTTP request Description
addExchangeAccount POST /exchange_accounts Add an exchange account
convertAssets POST /exchange_accounts/{exchangeAccountId}/convert Convert exchange account funds
getExchangeAccount GET /exchange_accounts/{exchangeAccountId} Get a specific exchange account
getExchangeAccountAsset GET /exchange_accounts/{exchangeAccountId}/{assetId} Get an asset for an exchange account
getExchangeAccountsCredentialsPublicKey GET /exchange_accounts/credentials_public_key Get public key to encrypt exchange credentials
getPagedExchangeAccounts GET /exchange_accounts/paged List connected exchange accounts
internalTransfer POST /exchange_accounts/{exchangeAccountId}/internal_transfer Internal transfer for exchange accounts

addExchangeAccount

AddExchangeAccountResponse addExchangeAccount(addExchangeAccountRequest)

Add an exchange account to exchanges. Note: This endpoint currently only supports the following exchanges INDEPENDENT_RESERVE,BIT, BITHUMB, BITSO, CRYPTOCOM, BYBIT_V2, WHITEBIT, HITBTC, GEMINI, HUOBI, GATEIO, COINHAKO, BULLISH, BITGET, and LUNO To add an exchange account, please use the following guide.

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ExchangeAccountsApiAddExchangeAccountRequest, AddExchangeAccountResponse } from '@fireblocks/ts-sdk';

// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");

const fireblocks = new Fireblocks();

let body: ExchangeAccountsApiAddExchangeAccountRequest = {
  // AddExchangeAccountRequest
  addExchangeAccountRequest: param_value,
  // string | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)
  idempotencyKey: idempotencyKey_example,
};

fireblocks.exchangeAccounts.addExchangeAccount(body).then((res: FireblocksResponse<AddExchangeAccountResponse>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
addExchangeAccountRequest AddExchangeAccountRequest
idempotencyKey [string] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional) defaults to undefined

Return type

AddExchangeAccountResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 An Exchange Account identifier object * X-Request-ID -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

convertAssets

ConvertAssetsResponse convertAssets()

Convert exchange account funds from the source asset to the destination asset. Coinbase (USD to USDC, USDC to USD) and Bitso (MXN to USD) are supported conversions. Learn more about Fireblocks Exchange Connectivity in the following guide. Endpoint Permission: Admin, Non-Signing Admin.

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ExchangeAccountsApiConvertAssetsRequest, ConvertAssetsResponse } from '@fireblocks/ts-sdk';

// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");

const fireblocks = new Fireblocks();

let body: ExchangeAccountsApiConvertAssetsRequest = {
  // string | The ID of the exchange account. Please make sure the exchange supports conversions. To find the ID of your exchange account, use GET/exchange_accounts.
  exchangeAccountId: exchangeAccountId_example,
  // ConvertAssetsRequest (optional)
  convertAssetsRequest: param_value,
  // string | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)
  idempotencyKey: idempotencyKey_example,
};

fireblocks.exchangeAccounts.convertAssets(body).then((res: FireblocksResponse<ConvertAssetsResponse>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
convertAssetsRequest ConvertAssetsRequest
exchangeAccountId [string] The ID of the exchange account. Please make sure the exchange supports conversions. To find the ID of your exchange account, use GET/exchange_accounts. defaults to undefined
idempotencyKey [string] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional) defaults to undefined

Return type

ConvertAssetsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Conversion successful * X-Request-ID -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getExchangeAccount

ExchangeAccount getExchangeAccount()

Returns an exchange account by ID. Endpoint Permission: Admin, Non-Signing Admin.

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ExchangeAccountsApiGetExchangeAccountRequest, ExchangeAccount } from '@fireblocks/ts-sdk';

// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");

const fireblocks = new Fireblocks();

let body: ExchangeAccountsApiGetExchangeAccountRequest = {
  // string | The ID of the exchange account to return
  exchangeAccountId: exchangeAccountId_example,
};

fireblocks.exchangeAccounts.getExchangeAccount(body).then((res: FireblocksResponse<ExchangeAccount>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
exchangeAccountId [string] The ID of the exchange account to return defaults to undefined

Return type

ExchangeAccount

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 An ExchangeAccount object * X-Request-ID -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getExchangeAccountAsset

ExchangeAsset getExchangeAccountAsset()

Returns an asset for an exchange account. Endpoint Permission: Admin, Non-Signing Admin.

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ExchangeAccountsApiGetExchangeAccountAssetRequest, ExchangeAsset } from '@fireblocks/ts-sdk';

// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");

const fireblocks = new Fireblocks();

let body: ExchangeAccountsApiGetExchangeAccountAssetRequest = {
  // string | The ID of the exchange account to return
  exchangeAccountId: exchangeAccountId_example,
  // string | The ID of the asset to return
  assetId: assetId_example,
};

fireblocks.exchangeAccounts.getExchangeAccountAsset(body).then((res: FireblocksResponse<ExchangeAsset>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
exchangeAccountId [string] The ID of the exchange account to return defaults to undefined
assetId [string] The ID of the asset to return defaults to undefined

Return type

ExchangeAsset

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 An ExchangeAccountAsset object * X-Request-ID -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getExchangeAccountsCredentialsPublicKey

GetExchangeAccountsCredentialsPublicKeyResponse getExchangeAccountsCredentialsPublicKey()

Return public key

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, GetExchangeAccountsCredentialsPublicKeyResponse } from '@fireblocks/ts-sdk';

// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");

const fireblocks = new Fireblocks();

let body:any = {};

fireblocks.exchangeAccounts.getExchangeAccountsCredentialsPublicKey(body).then((res: FireblocksResponse<GetExchangeAccountsCredentialsPublicKeyResponse>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

This endpoint does not need any parameter.

Return type

GetExchangeAccountsCredentialsPublicKeyResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 public key as string * X-Request-ID -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getPagedExchangeAccounts

GetPagedExchangeAccountsResponse getPagedExchangeAccounts()

Returns a list of the connected exchange accounts in your workspace. Endpoint Permission: Admin, Non-Signing Admin.

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ExchangeAccountsApiGetPagedExchangeAccountsRequest, GetPagedExchangeAccountsResponse } from '@fireblocks/ts-sdk';

// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");

const fireblocks = new Fireblocks();

let body: ExchangeAccountsApiGetPagedExchangeAccountsRequest = {
  // number | number of exchanges per page
  limit: 8.14,
  // string (optional)
  before: before_example,
  // string (optional)
  after: after_example,
};

fireblocks.exchangeAccounts.getPagedExchangeAccounts(body).then((res: FireblocksResponse<GetPagedExchangeAccountsResponse>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
limit [number] number of exchanges per page defaults to 3
before [string] (optional) defaults to undefined
after [string] (optional) defaults to undefined

Return type

GetPagedExchangeAccountsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 An ExchangeAccount object * X-Request-ID -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

internalTransfer

InternalTransferResponse internalTransfer()

Transfers funds between trading accounts under the same exchange account. Learn more about Fireblocks Exchange Connectivity in the following guide. Endpoint Permission: Admin, Non-Signing Admin.

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ExchangeAccountsApiInternalTransferRequest, InternalTransferResponse } from '@fireblocks/ts-sdk';

// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");

const fireblocks = new Fireblocks();

let body: ExchangeAccountsApiInternalTransferRequest = {
  // string | The ID of the exchange account to return
  exchangeAccountId: exchangeAccountId_example,
  // CreateInternalTransferRequest (optional)
  createInternalTransferRequest: param_value,
  // string | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)
  idempotencyKey: idempotencyKey_example,
};

fireblocks.exchangeAccounts.internalTransfer(body).then((res: FireblocksResponse<InternalTransferResponse>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
createInternalTransferRequest CreateInternalTransferRequest
exchangeAccountId [string] The ID of the exchange account to return defaults to undefined
idempotencyKey [string] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional) defaults to undefined

Return type

InternalTransferResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Transfer succeeded * X-Request-ID -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]