Skip to content

Latest commit

 

History

History
323 lines (208 loc) · 12.4 KB

OffExchangesApi.md

File metadata and controls

323 lines (208 loc) · 12.4 KB

OffExchangesApi

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

Method HTTP request Description
addOffExchange POST /off_exchange/add add collateral
getOffExchangeCollateralAccounts GET /off_exchange/collateral_accounts/{mainExchangeAccountId} Find a specific collateral exchange account
getOffExchangeSettlementTransactions GET /off_exchange/settlements/transactions get settlements transactions from exchange
removeOffExchange POST /off_exchange/remove remove collateral
settleOffExchangeTrades POST /off_exchange/settlements/trader create settlement for a trader

addOffExchange

CreateTransactionResponse addOffExchange()

add collateral, create deposit request

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, OffExchangesApiAddOffExchangeRequest, CreateTransactionResponse } 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: OffExchangesApiAddOffExchangeRequest = {
  // AddCollateralRequestBody (optional)
  addCollateralRequestBody: 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.offExchanges.addOffExchange(body).then((res: FireblocksResponse<CreateTransactionResponse>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
addCollateralRequestBody AddCollateralRequestBody
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

CreateTransactionResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 A transaction object -
0 Error Response * X-Request-ID -

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

getOffExchangeCollateralAccounts

ExchangeAccount getOffExchangeCollateralAccounts()

Returns a collateral account by mainExchangeAccountId.

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, OffExchangesApiGetOffExchangeCollateralAccountsRequest, 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: OffExchangesApiGetOffExchangeCollateralAccountsRequest = {
  // string | The id of the main exchange account for which the requested collateral account is associated with
  mainExchangeAccountId: mainExchangeAccountId_example,
};

fireblocks.offExchanges.getOffExchangeCollateralAccounts(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
mainExchangeAccountId [string] The id of the main exchange account for which the requested collateral account is associated with 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]

getOffExchangeSettlementTransactions

ExchangeSettlementTransactionsResponse getOffExchangeSettlementTransactions()

get settlements transactions from exchange

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, OffExchangesApiGetOffExchangeSettlementTransactionsRequest, ExchangeSettlementTransactionsResponse } 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: OffExchangesApiGetOffExchangeSettlementTransactionsRequest = {
  // string
  mainExchangeAccountId: mainExchangeAccountId_example,
};

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

Parameters

Name Type Description Notes
mainExchangeAccountId [string] defaults to undefined

Return type

ExchangeSettlementTransactionsResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 A settlement transactions -
0 Error Response * X-Request-ID -

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

removeOffExchange

CreateTransactionResponse removeOffExchange()

remove collateral, create withdraw request

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, OffExchangesApiRemoveOffExchangeRequest, CreateTransactionResponse } 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: OffExchangesApiRemoveOffExchangeRequest = {
  // RemoveCollateralRequestBody (optional)
  removeCollateralRequestBody: 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.offExchanges.removeOffExchange(body).then((res: FireblocksResponse<CreateTransactionResponse>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
removeCollateralRequestBody RemoveCollateralRequestBody
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

CreateTransactionResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 A transaction object -
0 Error Response * X-Request-ID -

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

settleOffExchangeTrades

SettlementResponse settleOffExchangeTrades()

create settlement for a trader

Example

import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, OffExchangesApiSettleOffExchangeTradesRequest, SettlementResponse } 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: OffExchangesApiSettleOffExchangeTradesRequest = {
  // SettlementRequestBody (optional)
  settlementRequestBody: 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.offExchanges.settleOffExchangeTrades(body).then((res: FireblocksResponse<SettlementResponse>) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));

Parameters

Name Type Description Notes
settlementRequestBody SettlementRequestBody
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

SettlementResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 A settlement object -
0 Error Response * X-Request-ID -

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