From 2d3cd233431e12eb988806ead6d151f9fe59e856 Mon Sep 17 00:00:00 2001 From: OzBalasFB Date: Wed, 20 Nov 2024 17:08:21 +0200 Subject: [PATCH] added generated files and added timeout param to the jest run test command to bypass timeout failed tests --- v2/api-validator/package.json | 2 +- .../src/client/generated/ApiClient.ts | 3 + .../src/client/generated/index.ts | 31 + .../client/generated/models/ApiComponents.ts | 1 + .../generated/models/AssetCreditBalance.ts | 12 + .../src/client/generated/models/Balances.ts | 3 +- .../generated/models/CollateralAccount.ts | 15 + .../generated/models/CollateralAccountLink.ts | 15 + .../generated/models/CollateralAddress.ts | 15 + .../generated/models/CollateralAsset.ts | 10 + .../models/CollateralAssetAddress.ts | 10 + .../models/CollateralAssetMapping.ts | 12 + .../models/CollateralDepositAddresses.ts | 11 + .../models/CollateralDepositTransaction.ts | 22 + .../CollateralDepositTransactionStatus.ts | 16 + .../client/generated/models/CollateralId.ts | 9 + .../generated/models/CollateralIdPathParam.ts | 9 + .../generated/models/CollateralLinkStatus.ts | 18 + .../generated/models/CollateralSignerId.ts | 9 + .../models/CollateralTxIdPathParam.ts | 9 + .../models/CollateralWithdrawalTransaction.ts | 18 + .../CollateralWithdrawalTransactionRequest.ts | 17 + .../CollateralWithdrawalTransactionStatus.ts | 16 + .../client/generated/models/Environment.ts | 14 + .../models/FireblocksAssetIdPathParam.ts | 9 + .../models/SettlementDepositInstruction.ts | 17 + .../models/SettlementDepositTransaction.ts | 13 + .../models/SettlementInstructions.ts | 14 + .../generated/models/SettlementRequest.ts | 17 + .../generated/models/SettlementState.ts | 44 + .../models/SettlementTransactionStatus.ts | 26 + .../models/SettlementVersionPathParam.ts | 9 + .../models/SettlementWithdrawInstruction.ts | 18 + .../models/SettlementWithdrawTransaction.ts | 13 + .../models/X_FB_PLATFORM_SIGNATURE.ts | 9 + .../generated/services/CollateralService.ts | 1117 +++++++++++++++++ 36 files changed, 1601 insertions(+), 2 deletions(-) create mode 100644 v2/api-validator/src/client/generated/models/AssetCreditBalance.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralAccount.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralAccountLink.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralAddress.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralAsset.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralAssetAddress.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralAssetMapping.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralDepositAddresses.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralDepositTransaction.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralDepositTransactionStatus.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralId.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralIdPathParam.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralLinkStatus.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralSignerId.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralTxIdPathParam.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralWithdrawalTransaction.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralWithdrawalTransactionRequest.ts create mode 100644 v2/api-validator/src/client/generated/models/CollateralWithdrawalTransactionStatus.ts create mode 100644 v2/api-validator/src/client/generated/models/Environment.ts create mode 100644 v2/api-validator/src/client/generated/models/FireblocksAssetIdPathParam.ts create mode 100644 v2/api-validator/src/client/generated/models/SettlementDepositInstruction.ts create mode 100644 v2/api-validator/src/client/generated/models/SettlementDepositTransaction.ts create mode 100644 v2/api-validator/src/client/generated/models/SettlementInstructions.ts create mode 100644 v2/api-validator/src/client/generated/models/SettlementRequest.ts create mode 100644 v2/api-validator/src/client/generated/models/SettlementState.ts create mode 100644 v2/api-validator/src/client/generated/models/SettlementTransactionStatus.ts create mode 100644 v2/api-validator/src/client/generated/models/SettlementVersionPathParam.ts create mode 100644 v2/api-validator/src/client/generated/models/SettlementWithdrawInstruction.ts create mode 100644 v2/api-validator/src/client/generated/models/SettlementWithdrawTransaction.ts create mode 100644 v2/api-validator/src/client/generated/models/X_FB_PLATFORM_SIGNATURE.ts create mode 100644 v2/api-validator/src/client/generated/services/CollateralService.ts diff --git a/v2/api-validator/package.json b/v2/api-validator/package.json index 6ccad2e4..41d01597 100644 --- a/v2/api-validator/package.json +++ b/v2/api-validator/package.json @@ -17,7 +17,7 @@ "server": "NODE_ENV=development ts-node src/server/server.ts | pino-pretty; [ \"${PIPESTATUS[0]}\" -ne 0 ] && (echo \"\\nServer execution failed. There should be an error log above ^\"; exit 1)", "lint": "eslint src tests", "lint:fix": "eslint src tests --fix", - "test": "NODE_ENV=test jest --verbose --json --outputFile=test-results.json", + "test": "NODE_ENV=test jest --testTimeout=30000 --verbose --json --outputFile=test-results.json", "test:watch": "npm run test -- --watch", "test:sanity": "npm run test -- --config=jest.sanity.config.ts tests/sanity-tests", "test:sanity:watch": "npm run test:sanity -- --watch", diff --git a/v2/api-validator/src/client/generated/ApiClient.ts b/v2/api-validator/src/client/generated/ApiClient.ts index bb436a53..201d9c82 100644 --- a/v2/api-validator/src/client/generated/ApiClient.ts +++ b/v2/api-validator/src/client/generated/ApiClient.ts @@ -9,6 +9,7 @@ import { AxiosHttpRequest } from './core/AxiosHttpRequest'; import { AccountsService } from './services/AccountsService'; import { BalancesService } from './services/BalancesService'; import { CapabilitiesService } from './services/CapabilitiesService'; +import { CollateralService } from './services/CollateralService'; import { HistoricBalancesService } from './services/HistoricBalancesService'; import { LiquidityService } from './services/LiquidityService'; import { TradingService } from './services/TradingService'; @@ -25,6 +26,7 @@ export class ApiClient { public readonly accounts: AccountsService; public readonly balances: BalancesService; public readonly capabilities: CapabilitiesService; + public readonly collateral: CollateralService; public readonly historicBalances: HistoricBalancesService; public readonly liquidity: LiquidityService; public readonly trading: TradingService; @@ -52,6 +54,7 @@ export class ApiClient { this.accounts = new AccountsService(this.request); this.balances = new BalancesService(this.request); this.capabilities = new CapabilitiesService(this.request); + this.collateral = new CollateralService(this.request); this.historicBalances = new HistoricBalancesService(this.request); this.liquidity = new LiquidityService(this.request); this.trading = new TradingService(this.request); diff --git a/v2/api-validator/src/client/generated/index.ts b/v2/api-validator/src/client/generated/index.ts index 4cd85843..383c9a64 100644 --- a/v2/api-validator/src/client/generated/index.ts +++ b/v2/api-validator/src/client/generated/index.ts @@ -20,6 +20,7 @@ export { AccountStatus } from './models/AccountStatus'; export type { ApiComponents } from './models/ApiComponents'; export type { AssetBalance } from './models/AssetBalance'; export type { AssetCommonProperties } from './models/AssetCommonProperties'; +export type { AssetCreditBalance } from './models/AssetCreditBalance'; export type { AssetDefinition } from './models/AssetDefinition'; export type { AssetIdQueryParam } from './models/AssetIdQueryParam'; export type { AssetReference } from './models/AssetReference'; @@ -31,6 +32,23 @@ export type { BlockchainWithdrawal } from './models/BlockchainWithdrawal'; export type { BlockchainWithdrawalRequest } from './models/BlockchainWithdrawalRequest'; export { BucketAsset } from './models/BucketAsset'; export type { Capabilities } from './models/Capabilities'; +export type { CollateralAccount } from './models/CollateralAccount'; +export type { CollateralAccountLink } from './models/CollateralAccountLink'; +export type { CollateralAddress } from './models/CollateralAddress'; +export type { CollateralAsset } from './models/CollateralAsset'; +export type { CollateralAssetAddress } from './models/CollateralAssetAddress'; +export type { CollateralAssetMapping } from './models/CollateralAssetMapping'; +export type { CollateralDepositAddresses } from './models/CollateralDepositAddresses'; +export type { CollateralDepositTransaction } from './models/CollateralDepositTransaction'; +export { CollateralDepositTransactionStatus } from './models/CollateralDepositTransactionStatus'; +export type { CollateralId } from './models/CollateralId'; +export type { CollateralIdPathParam } from './models/CollateralIdPathParam'; +export { CollateralLinkStatus } from './models/CollateralLinkStatus'; +export type { CollateralSignerId } from './models/CollateralSignerId'; +export type { CollateralTxIdPathParam } from './models/CollateralTxIdPathParam'; +export type { CollateralWithdrawalTransaction } from './models/CollateralWithdrawalTransaction'; +export type { CollateralWithdrawalTransactionRequest } from './models/CollateralWithdrawalTransactionRequest'; +export { CollateralWithdrawalTransactionStatus } from './models/CollateralWithdrawalTransactionStatus'; export type { CryptocurrencyReference } from './models/CryptocurrencyReference'; export { CryptocurrencySymbol } from './models/CryptocurrencySymbol'; export type { CryptocurrencySymbolQueryParam } from './models/CryptocurrencySymbolQueryParam'; @@ -43,11 +61,13 @@ export type { DepositCapability } from './models/DepositCapability'; export type { DepositDestination } from './models/DepositDestination'; export { DepositStatus } from './models/DepositStatus'; export type { EntityIdPathParam } from './models/EntityIdPathParam'; +export { Environment } from './models/Environment'; export { Erc20Token } from './models/Erc20Token'; export type { FiatTransfer } from './models/FiatTransfer'; export type { FiatTransferDestination } from './models/FiatTransferDestination'; export type { FiatWithdrawal } from './models/FiatWithdrawal'; export type { FiatWithdrawalRequest } from './models/FiatWithdrawalRequest'; +export type { FireblocksAssetIdPathParam } from './models/FireblocksAssetIdPathParam'; export { GeneralError } from './models/GeneralError'; export type { Iban } from './models/Iban'; export type { IbanAddress } from './models/IbanAddress'; @@ -102,6 +122,15 @@ export type { QuoteCapability } from './models/QuoteCapability'; export type { QuoteRequest } from './models/QuoteRequest'; export { QuoteStatus } from './models/QuoteStatus'; export { RequestPart } from './models/RequestPart'; +export type { SettlementDepositInstruction } from './models/SettlementDepositInstruction'; +export type { SettlementDepositTransaction } from './models/SettlementDepositTransaction'; +export type { SettlementInstructions } from './models/SettlementInstructions'; +export type { SettlementRequest } from './models/SettlementRequest'; +export { SettlementState } from './models/SettlementState'; +export { SettlementTransactionStatus } from './models/SettlementTransactionStatus'; +export type { SettlementVersionPathParam } from './models/SettlementVersionPathParam'; +export type { SettlementWithdrawInstruction } from './models/SettlementWithdrawInstruction'; +export type { SettlementWithdrawTransaction } from './models/SettlementWithdrawTransaction'; export { StellarToken } from './models/StellarToken'; export type { SubAccountIdPathParam } from './models/SubAccountIdPathParam'; export type { SwiftAddress } from './models/SwiftAddress'; @@ -118,6 +147,7 @@ export type { WithdrawalCommonProperties } from './models/WithdrawalCommonProper export type { WithdrawalEvent } from './models/WithdrawalEvent'; export type { WithdrawalRequestCommonProperties } from './models/WithdrawalRequestCommonProperties'; export { WithdrawalStatus } from './models/WithdrawalStatus'; +export type { X_FB_PLATFORM_SIGNATURE } from './models/X_FB_PLATFORM_SIGNATURE'; export type { X_FBAPI_KEY } from './models/X_FBAPI_KEY'; export type { X_FBAPI_NONCE } from './models/X_FBAPI_NONCE'; export type { X_FBAPI_SIGNATURE } from './models/X_FBAPI_SIGNATURE'; @@ -126,6 +156,7 @@ export type { X_FBAPI_TIMESTAMP } from './models/X_FBAPI_TIMESTAMP'; export { AccountsService } from './services/AccountsService'; export { BalancesService } from './services/BalancesService'; export { CapabilitiesService } from './services/CapabilitiesService'; +export { CollateralService } from './services/CollateralService'; export { HistoricBalancesService } from './services/HistoricBalancesService'; export { LiquidityService } from './services/LiquidityService'; export { TradingService } from './services/TradingService'; diff --git a/v2/api-validator/src/client/generated/models/ApiComponents.ts b/v2/api-validator/src/client/generated/models/ApiComponents.ts index 15e9410c..de8b71ab 100644 --- a/v2/api-validator/src/client/generated/models/ApiComponents.ts +++ b/v2/api-validator/src/client/generated/models/ApiComponents.ts @@ -19,5 +19,6 @@ export type ApiComponents = { transfersInternal?: AccountsSet; trading?: AccountsSet; liquidity?: AccountsSet; + collateral?: AccountsSet; }; diff --git a/v2/api-validator/src/client/generated/models/AssetCreditBalance.ts b/v2/api-validator/src/client/generated/models/AssetCreditBalance.ts new file mode 100644 index 00000000..4821b57a --- /dev/null +++ b/v2/api-validator/src/client/generated/models/AssetCreditBalance.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AssetBalance } from './AssetBalance'; +import type { PositiveAmount } from './PositiveAmount'; + +export type AssetCreditBalance = (AssetBalance & { + creditAmount: PositiveAmount; +}); + diff --git a/v2/api-validator/src/client/generated/models/Balances.ts b/v2/api-validator/src/client/generated/models/Balances.ts index 41b46f14..779ee557 100644 --- a/v2/api-validator/src/client/generated/models/Balances.ts +++ b/v2/api-validator/src/client/generated/models/Balances.ts @@ -4,8 +4,9 @@ /* eslint-disable */ import type { AssetBalance } from './AssetBalance'; +import type { AssetCreditBalance } from './AssetCreditBalance'; /** * Maps balance assets to their balances. */ -export type Balances = Array; +export type Balances = Array<(AssetBalance | AssetCreditBalance)>; diff --git a/v2/api-validator/src/client/generated/models/CollateralAccount.ts b/v2/api-validator/src/client/generated/models/CollateralAccount.ts new file mode 100644 index 00000000..0515e4a8 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralAccount.ts @@ -0,0 +1,15 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CollateralId } from './CollateralId'; +import type { CollateralSignerId } from './CollateralSignerId'; +import type { Environment } from './Environment'; + +export type CollateralAccount = { + collateralId: CollateralId; + collateralSigners: Array; + env: Environment; +}; + diff --git a/v2/api-validator/src/client/generated/models/CollateralAccountLink.ts b/v2/api-validator/src/client/generated/models/CollateralAccountLink.ts new file mode 100644 index 00000000..62b0f240 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralAccountLink.ts @@ -0,0 +1,15 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CollateralAccount } from './CollateralAccount'; +import type { CollateralAsset } from './CollateralAsset'; +import type { CollateralLinkStatus } from './CollateralLinkStatus'; + +export type CollateralAccountLink = (CollateralAccount & { + status: CollateralLinkStatus; + eligibleCollateralAssets: Array; + rejectionReason?: string; +}); + diff --git a/v2/api-validator/src/client/generated/models/CollateralAddress.ts b/v2/api-validator/src/client/generated/models/CollateralAddress.ts new file mode 100644 index 00000000..ffb3149e --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralAddress.ts @@ -0,0 +1,15 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { PublicBlockchainAddress } from './PublicBlockchainAddress'; + +export type CollateralAddress = { + address: PublicBlockchainAddress; + /** + * An account ID used when recovering the assets of an off-exchange client + */ + recoveryAccountId: string; +}; + diff --git a/v2/api-validator/src/client/generated/models/CollateralAsset.ts b/v2/api-validator/src/client/generated/models/CollateralAsset.ts new file mode 100644 index 00000000..dce28e2f --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralAsset.ts @@ -0,0 +1,10 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { NativeCryptocurrency } from './NativeCryptocurrency'; +import type { OtherAssetReference } from './OtherAssetReference'; + +export type CollateralAsset = (NativeCryptocurrency | OtherAssetReference); + diff --git a/v2/api-validator/src/client/generated/models/CollateralAssetAddress.ts b/v2/api-validator/src/client/generated/models/CollateralAssetAddress.ts new file mode 100644 index 00000000..faa897da --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralAssetAddress.ts @@ -0,0 +1,10 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CollateralAddress } from './CollateralAddress'; +import type { CollateralAssetMapping } from './CollateralAssetMapping'; + +export type CollateralAssetAddress = (CollateralAddress & CollateralAssetMapping); + diff --git a/v2/api-validator/src/client/generated/models/CollateralAssetMapping.ts b/v2/api-validator/src/client/generated/models/CollateralAssetMapping.ts new file mode 100644 index 00000000..cbacfe32 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralAssetMapping.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CollateralAsset } from './CollateralAsset'; + +export type CollateralAssetMapping = { + asset: CollateralAsset; + fireblocksAssetId: string; +}; + diff --git a/v2/api-validator/src/client/generated/models/CollateralDepositAddresses.ts b/v2/api-validator/src/client/generated/models/CollateralDepositAddresses.ts new file mode 100644 index 00000000..3769ec9a --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralDepositAddresses.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CollateralAssetAddress } from './CollateralAssetAddress'; + +export type CollateralDepositAddresses = { + addresses: Array; +}; + diff --git a/v2/api-validator/src/client/generated/models/CollateralDepositTransaction.ts b/v2/api-validator/src/client/generated/models/CollateralDepositTransaction.ts new file mode 100644 index 00000000..4359a4f2 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralDepositTransaction.ts @@ -0,0 +1,22 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CollateralDepositTransactionStatus } from './CollateralDepositTransactionStatus'; +import type { PositiveAmount } from './PositiveAmount'; + +export type CollateralDepositTransaction = { + /** + * A unique identifier of the transaction to track. This field will contain information to help the provider poll the status of the transaction from Fireblocks. + * + */ + collateralTxId: string; + /** + * ID of the Fireblocks asset + */ + fireblocksAssetId: string; + amount?: PositiveAmount; + status?: CollateralDepositTransactionStatus; +}; + diff --git a/v2/api-validator/src/client/generated/models/CollateralDepositTransactionStatus.ts b/v2/api-validator/src/client/generated/models/CollateralDepositTransactionStatus.ts new file mode 100644 index 00000000..0054b44a --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralDepositTransactionStatus.ts @@ -0,0 +1,16 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * - **Pending** - The transaction is pending and has not been credited to the provider's account yet + * - **Credited** - The transaction has been completed successfully and the account has been credited + * - **Rejected** - The transaction has been rejected and the account has not been credited + * + */ +export enum CollateralDepositTransactionStatus { + PENDING = 'Pending', + CREDITED = 'Credited', + REJECTED = 'Rejected', +} diff --git a/v2/api-validator/src/client/generated/models/CollateralId.ts b/v2/api-validator/src/client/generated/models/CollateralId.ts new file mode 100644 index 00000000..7e4660c8 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralId.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Unique string representing the collateral account Id (..) + */ +export type CollateralId = string; diff --git a/v2/api-validator/src/client/generated/models/CollateralIdPathParam.ts b/v2/api-validator/src/client/generated/models/CollateralIdPathParam.ts new file mode 100644 index 00000000..3bd2aea7 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralIdPathParam.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * ID of a collateral account + */ +export type CollateralIdPathParam = string; diff --git a/v2/api-validator/src/client/generated/models/CollateralLinkStatus.ts b/v2/api-validator/src/client/generated/models/CollateralLinkStatus.ts new file mode 100644 index 00000000..8a2ba7a2 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralLinkStatus.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * - **Eligible** - The provider account is eligible for linking to a collateral account + * - **Linked** - The provider account is linked to a collateral account + * - **Disabled** - The link is disabled at the moment, but can be re-enabled + * - **Failed** - The link creation failed + * + */ +export enum CollateralLinkStatus { + ELIGIBLE = 'Eligible', + LINKED = 'Linked', + DISABLED = 'Disabled', + FAILED = 'Failed', +} diff --git a/v2/api-validator/src/client/generated/models/CollateralSignerId.ts b/v2/api-validator/src/client/generated/models/CollateralSignerId.ts new file mode 100644 index 00000000..4bc23c02 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralSignerId.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Unique Id of the collateral signer + */ +export type CollateralSignerId = string; diff --git a/v2/api-validator/src/client/generated/models/CollateralTxIdPathParam.ts b/v2/api-validator/src/client/generated/models/CollateralTxIdPathParam.ts new file mode 100644 index 00000000..c79c570a --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralTxIdPathParam.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * A Fireblocks' ID of a collateral transaction + */ +export type CollateralTxIdPathParam = string; diff --git a/v2/api-validator/src/client/generated/models/CollateralWithdrawalTransaction.ts b/v2/api-validator/src/client/generated/models/CollateralWithdrawalTransaction.ts new file mode 100644 index 00000000..51de58e5 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralWithdrawalTransaction.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CollateralWithdrawalTransactionStatus } from './CollateralWithdrawalTransactionStatus'; + +export type CollateralWithdrawalTransaction = { + /** + * A unique identifier of the transaction to track. This field will contain information to help Fireblocks poll the status of the transaction from the provider. + * + */ + collateralTxId: string; + status: CollateralWithdrawalTransactionStatus; + withdrawalTxBlockchainId?: string; + rejectionReason?: string | null; +}; + diff --git a/v2/api-validator/src/client/generated/models/CollateralWithdrawalTransactionRequest.ts b/v2/api-validator/src/client/generated/models/CollateralWithdrawalTransactionRequest.ts new file mode 100644 index 00000000..0ae7fe9c --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralWithdrawalTransactionRequest.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { PositiveAmount } from './PositiveAmount'; +import type { PublicBlockchainAddress } from './PublicBlockchainAddress'; + +export type CollateralWithdrawalTransactionRequest = { + /** + * ID of the Fireblocks asset + */ + fireblocksAssetId: string; + amount: PositiveAmount; + destinationAddress: PublicBlockchainAddress; +}; + diff --git a/v2/api-validator/src/client/generated/models/CollateralWithdrawalTransactionStatus.ts b/v2/api-validator/src/client/generated/models/CollateralWithdrawalTransactionStatus.ts new file mode 100644 index 00000000..98963936 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/CollateralWithdrawalTransactionStatus.ts @@ -0,0 +1,16 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * - **Pending** - The withdrawal transaction is pending the provider's approval + * - **Approved** - The withdrawal transaction has been approved and it is in progress + * - **Rejected** - The withdrawal transaction has been rejected + * + */ +export enum CollateralWithdrawalTransactionStatus { + PENDING = 'Pending', + APPROVED = 'Approved', + REJECTED = 'Rejected', +} diff --git a/v2/api-validator/src/client/generated/models/Environment.ts b/v2/api-validator/src/client/generated/models/Environment.ts new file mode 100644 index 00000000..ba01006f --- /dev/null +++ b/v2/api-validator/src/client/generated/models/Environment.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Environment field describes which environment is being run at the moment + * + */ +export enum Environment { + PROD = 'prod', + SANDBOX = 'sandbox', + STAGE = 'stage', +} diff --git a/v2/api-validator/src/client/generated/models/FireblocksAssetIdPathParam.ts b/v2/api-validator/src/client/generated/models/FireblocksAssetIdPathParam.ts new file mode 100644 index 00000000..7f400860 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/FireblocksAssetIdPathParam.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * ID of a Fireblocks asset. + */ +export type FireblocksAssetIdPathParam = string; diff --git a/v2/api-validator/src/client/generated/models/SettlementDepositInstruction.ts b/v2/api-validator/src/client/generated/models/SettlementDepositInstruction.ts new file mode 100644 index 00000000..a0d929ec --- /dev/null +++ b/v2/api-validator/src/client/generated/models/SettlementDepositInstruction.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { PositiveAmount } from './PositiveAmount'; +import type { PublicBlockchainAddress } from './PublicBlockchainAddress'; + +export type SettlementDepositInstruction = { + /** + * ID of the Fireblocks asset + */ + fireblocksAssetId: string; + amount: PositiveAmount; + destinationAddress: PublicBlockchainAddress; +}; + diff --git a/v2/api-validator/src/client/generated/models/SettlementDepositTransaction.ts b/v2/api-validator/src/client/generated/models/SettlementDepositTransaction.ts new file mode 100644 index 00000000..a27079c0 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/SettlementDepositTransaction.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { SettlementDepositInstruction } from './SettlementDepositInstruction'; +import type { SettlementTransactionStatus } from './SettlementTransactionStatus'; + +export type SettlementDepositTransaction = (SettlementDepositInstruction & { + status: SettlementTransactionStatus; + rejectionReason?: string | null; +}); + diff --git a/v2/api-validator/src/client/generated/models/SettlementInstructions.ts b/v2/api-validator/src/client/generated/models/SettlementInstructions.ts new file mode 100644 index 00000000..c810a715 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/SettlementInstructions.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { SettlementDepositInstruction } from './SettlementDepositInstruction'; +import type { SettlementWithdrawInstruction } from './SettlementWithdrawInstruction'; + +export type SettlementInstructions = { + settlementVersion?: string; + withdrawInstructions: Array; + depositInstructions: Array; +}; + diff --git a/v2/api-validator/src/client/generated/models/SettlementRequest.ts b/v2/api-validator/src/client/generated/models/SettlementRequest.ts new file mode 100644 index 00000000..5e627297 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/SettlementRequest.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Settlement to be created + */ +export type SettlementRequest = { + settlementId: string; + /** + * A unique identifier of the settlement state version. This field is optional and can be used to indicate the version of the settlement state the client is referring to. + * + */ + settlementVersion?: string; +}; + diff --git a/v2/api-validator/src/client/generated/models/SettlementState.ts b/v2/api-validator/src/client/generated/models/SettlementState.ts new file mode 100644 index 00000000..e014e8a4 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/SettlementState.ts @@ -0,0 +1,44 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { SettlementDepositTransaction } from './SettlementDepositTransaction'; +import type { SettlementWithdrawTransaction } from './SettlementWithdrawTransaction'; + +export type SettlementState = { + settlementVersion?: string; + withdrawTransactions?: Array; + depositTransactions?: Array; + /** + * - **Invalid** - The settlement state is invalid and cannot be processed, usually due to balance changes + * - **Pending** - The settlement is pending and has not started yet + * - **InProgress** - The settlement is in progress + * - **Completed** - The settlement has been completed successfully + * - **Failed** - The settlement has failed + * + */ + status?: SettlementState.status; +}; + +export namespace SettlementState { + + /** + * - **Invalid** - The settlement state is invalid and cannot be processed, usually due to balance changes + * - **Pending** - The settlement is pending and has not started yet + * - **InProgress** - The settlement is in progress + * - **Completed** - The settlement has been completed successfully + * - **Failed** - The settlement has failed + * + */ + export enum status { + INVALID = 'Invalid', + PENDING = 'Pending', + IN_PROGRESS = 'InProgress', + COMPLETED = 'Completed', + FAILED = 'Failed', + } + + +} + diff --git a/v2/api-validator/src/client/generated/models/SettlementTransactionStatus.ts b/v2/api-validator/src/client/generated/models/SettlementTransactionStatus.ts new file mode 100644 index 00000000..679a8e1e --- /dev/null +++ b/v2/api-validator/src/client/generated/models/SettlementTransactionStatus.ts @@ -0,0 +1,26 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * - **NOT_FOUND** - The transaction was not found + * - **PROCESSING** - The transaction is being processed + * - **CANCELLED** - The transaction was cancelled + * - **FAILED** - The transaction failed + * - **PENDING_MANUAL_APPROVAL** - The transaction is pending manual approval + * - **PENDING_SERVICE_MANUAL_APPROVAL** - The transaction is pending service manual approval + * - **REJECTED** - The transaction was rejected + * - **COMPLETED** - The transaction was completed + * + */ +export enum SettlementTransactionStatus { + NOT_FOUND = 'NOT_FOUND', + PROCESSING = 'PROCESSING', + CANCELLED = 'CANCELLED', + FAILED = 'FAILED', + PENDING_MANUAL_APPROVAL = 'PENDING_MANUAL_APPROVAL', + PENDING_SERVICE_MANUAL_APPROVAL = 'PENDING_SERVICE_MANUAL_APPROVAL', + REJECTED = 'REJECTED', + COMPLETED = 'COMPLETED', +} diff --git a/v2/api-validator/src/client/generated/models/SettlementVersionPathParam.ts b/v2/api-validator/src/client/generated/models/SettlementVersionPathParam.ts new file mode 100644 index 00000000..f82b85ff --- /dev/null +++ b/v2/api-validator/src/client/generated/models/SettlementVersionPathParam.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * A provider version ID of a settlement state + */ +export type SettlementVersionPathParam = string; diff --git a/v2/api-validator/src/client/generated/models/SettlementWithdrawInstruction.ts b/v2/api-validator/src/client/generated/models/SettlementWithdrawInstruction.ts new file mode 100644 index 00000000..b81f0306 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/SettlementWithdrawInstruction.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { PositiveAmount } from './PositiveAmount'; +import type { PublicBlockchainAddress } from './PublicBlockchainAddress'; + +export type SettlementWithdrawInstruction = { + /** + * ID of the Fireblocks asset + */ + fireblocksAssetId: string; + amount: PositiveAmount; + fee?: PositiveAmount; + sourceAddress: PublicBlockchainAddress; +}; + diff --git a/v2/api-validator/src/client/generated/models/SettlementWithdrawTransaction.ts b/v2/api-validator/src/client/generated/models/SettlementWithdrawTransaction.ts new file mode 100644 index 00000000..439c4564 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/SettlementWithdrawTransaction.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { SettlementTransactionStatus } from './SettlementTransactionStatus'; +import type { SettlementWithdrawInstruction } from './SettlementWithdrawInstruction'; + +export type SettlementWithdrawTransaction = (SettlementWithdrawInstruction & { + status: SettlementTransactionStatus; + rejectionReason?: string | null; +}); + diff --git a/v2/api-validator/src/client/generated/models/X_FB_PLATFORM_SIGNATURE.ts b/v2/api-validator/src/client/generated/models/X_FB_PLATFORM_SIGNATURE.ts new file mode 100644 index 00000000..db6fe520 --- /dev/null +++ b/v2/api-validator/src/client/generated/models/X_FB_PLATFORM_SIGNATURE.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Authentication signature of Fireblocks as the originator of the request + */ +export type X_FB_PLATFORM_SIGNATURE = string; diff --git a/v2/api-validator/src/client/generated/services/CollateralService.ts b/v2/api-validator/src/client/generated/services/CollateralService.ts new file mode 100644 index 00000000..26e0c284 --- /dev/null +++ b/v2/api-validator/src/client/generated/services/CollateralService.ts @@ -0,0 +1,1117 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CollateralAccount } from '../models/CollateralAccount'; +import type { CollateralAccountLink } from '../models/CollateralAccountLink'; +import type { CollateralAddress } from '../models/CollateralAddress'; +import type { CollateralDepositAddresses } from '../models/CollateralDepositAddresses'; +import type { CollateralDepositTransaction } from '../models/CollateralDepositTransaction'; +import type { CollateralWithdrawalTransaction } from '../models/CollateralWithdrawalTransaction'; +import type { CollateralWithdrawalTransactionRequest } from '../models/CollateralWithdrawalTransactionRequest'; +import type { SettlementInstructions } from '../models/SettlementInstructions'; +import type { SettlementRequest } from '../models/SettlementRequest'; +import type { SettlementState } from '../models/SettlementState'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; + +export class CollateralService { + + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * Initiate collateral account link + * Creates a new link between a collateral account and a provider account. + * + * @returns CollateralAccountLink Link created successfully + * @throws ApiError + */ + public createCollateralAccountLink({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + requestBody, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * Collateral account link details + */ + requestBody: CollateralAccount, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/accounts/{accountId}/collateral/link', + path: { + 'accountId': accountId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + + /** + * Get list of collateral account links + * @returns any List of collateral account links + * @throws ApiError + */ + public getCollateralAccountLinks({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + limit = 10, + startingAfter, + endingBefore, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * Maximum number of returned items. + */ + limit?: number, + /** + * Object ID. Instructs to return the items immediately following this object and not including it. Cannot be used together with `endingBefore`. + */ + startingAfter?: string, + /** + * Object ID. Instructs to return the items immediately preceding this object and not including it. Cannot be used together with `startingAfter`. + */ + endingBefore?: string, + }): CancelablePromise<{ + collateralLinks: Array; + }> { + return this.httpRequest.request({ + method: 'GET', + url: '/accounts/{accountId}/collateral/link', + path: { + 'accountId': accountId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + query: { + 'limit': limit, + 'startingAfter': startingAfter, + 'endingBefore': endingBefore, + }, + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + + /** + * Get list of collateral account deposit addresses + * @returns CollateralDepositAddresses List of collateral deposit addresses + * @throws ApiError + */ + public getCollateralDepositAddresses({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + limit = 10, + startingAfter, + endingBefore, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * Maximum number of returned items. + */ + limit?: number, + /** + * Object ID. Instructs to return the items immediately following this object and not including it. Cannot be used together with `endingBefore`. + */ + startingAfter?: string, + /** + * Object ID. Instructs to return the items immediately preceding this object and not including it. Cannot be used together with `startingAfter`. + */ + endingBefore?: string, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/accounts/{accountId}/collateral/{collateralId}/addresses', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + query: { + 'limit': limit, + 'startingAfter': startingAfter, + 'endingBefore': endingBefore, + }, + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + + /** + * Create/register a collateral deposit address for a specific asset + * Notifies the provider to have a new collateral deposit address for a specific asset. The provider is expected to listen to this address and credit the account accordingly, or sending the funds to this address if a withdrawal is requested. + * + * @returns CollateralDepositAddresses Successful Operation + * @throws ApiError + */ + public createCollateralDepositAddressForAsset({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + fireblocksAssetId, + requestBody, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * ID of a Fireblocks asset. + */ + fireblocksAssetId: string, + /** + * Collateral deposit address details + */ + requestBody: CollateralAddress, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/accounts/{accountId}/collateral/{collateralId}/addresses/{fireblocksAssetId}', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + 'fireblocksAssetId': fireblocksAssetId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Return Bad Request.`, + 401: `Unauthorized. Either API details are missing or invalid`, + 403: `Forbidden- You do not have access to the requested resource.`, + 415: `Unsupported media type. You need to use application/json.`, + 500: `Exchange internal error.`, + }, + }); + } + + /** + * Get list of collateral account deposit addresses for a specific asset + * @returns any List of collateral deposit addresses + * @throws ApiError + */ + public getCollateralDepositAddressesForAsset({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + fireblocksAssetId, + limit = 10, + startingAfter, + endingBefore, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * ID of a Fireblocks asset. + */ + fireblocksAssetId: string, + /** + * Maximum number of returned items. + */ + limit?: number, + /** + * Object ID. Instructs to return the items immediately following this object and not including it. Cannot be used together with `endingBefore`. + */ + startingAfter?: string, + /** + * Object ID. Instructs to return the items immediately preceding this object and not including it. Cannot be used together with `startingAfter`. + */ + endingBefore?: string, + }): CancelablePromise<{ + addresses?: Array; + }> { + return this.httpRequest.request({ + method: 'GET', + url: '/accounts/{accountId}/collateral/{collateralId}/addresses/{fireblocksAssetId}', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + 'fireblocksAssetId': fireblocksAssetId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + query: { + 'limit': limit, + 'startingAfter': startingAfter, + 'endingBefore': endingBefore, + }, + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + + /** + * Register a collateral deposit transaction + * Notifies the provider to have start listening to a new collateral deposit transaction. The provider is expected to listen to this address and credit the account accordingly + * + * @returns CollateralDepositTransaction Successful Operation + * @throws ApiError + */ + public registerCollateralDepositTransaction({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + requestBody, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * Collateral deposit transaction details + */ + requestBody: CollateralDepositTransaction, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/accounts/{accountId}/collateral/{collateralId}/deposits', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Return Bad Request.`, + 401: `Unauthorized. Either API details are missing or invalid`, + 403: `Forbidden- You do not have access to the requested resource.`, + 415: `Unsupported media type. You need to use application/json.`, + 500: `Exchange internal error.`, + }, + }); + } + + /** + * Get list of collateral account deposit transactions sorted by creation time + * @returns any List of collateral deposit transactions + * @throws ApiError + */ + public getCollateralDepositTransactions({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + limit = 10, + startingAfter, + endingBefore, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * Maximum number of returned items. + */ + limit?: number, + /** + * Object ID. Instructs to return the items immediately following this object and not including it. Cannot be used together with `endingBefore`. + */ + startingAfter?: string, + /** + * Object ID. Instructs to return the items immediately preceding this object and not including it. Cannot be used together with `startingAfter`. + */ + endingBefore?: string, + }): CancelablePromise<{ + transactions?: Array; + }> { + return this.httpRequest.request({ + method: 'GET', + url: '/accounts/{accountId}/collateral/{collateralId}/deposits', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + query: { + 'limit': limit, + 'startingAfter': startingAfter, + 'endingBefore': endingBefore, + }, + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + + /** + * Get a collateral account deposit transaction details + * @returns CollateralDepositTransaction A collateral deposit transaction details + * @throws ApiError + */ + public getCollateralDepositTransactionDetails({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + collateralTxId, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * A Fireblocks' ID of a collateral transaction + */ + collateralTxId: string, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/accounts/{accountId}/collateral/{collateralId}/deposits/{collateralTxId}', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + 'collateralTxId': collateralTxId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + + /** + * Initiate a withdrawal from a collateral account + * Initiates a withdrawal request from the customers collateral account. The withdrawal must be confirmed by the provider before it can be signed by the customer. Once the provider approve the withdrawal, it can be reduced from the customers available balance in the provider main account based on the withdrawal amount. + * + * @returns CollateralWithdrawalTransaction Successful Operation + * @throws ApiError + */ + public initiateCollateralWithdrawalTransaction({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + requestBody, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * Collateral withdrawal transaction details + */ + requestBody: CollateralWithdrawalTransactionRequest, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/accounts/{accountId}/collateral/{collateralId}/withdrawals', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Return Bad Request.`, + 401: `Unauthorized. Either API details are missing or invalid`, + 403: `Forbidden- You do not have access to the requested resource.`, + 415: `Unsupported media type. You need to use application/json.`, + 500: `Exchange internal error.`, + }, + }); + } + + /** + * Get list of collateral withdrawal transactions sorted by creation time + * @returns any List of collateral withdrawal transactions + * @throws ApiError + */ + public getCollateralWithdrawalTransactions({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + limit = 10, + startingAfter, + endingBefore, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * Maximum number of returned items. + */ + limit?: number, + /** + * Object ID. Instructs to return the items immediately following this object and not including it. Cannot be used together with `endingBefore`. + */ + startingAfter?: string, + /** + * Object ID. Instructs to return the items immediately preceding this object and not including it. Cannot be used together with `startingAfter`. + */ + endingBefore?: string, + }): CancelablePromise<{ + transactions?: Array; + }> { + return this.httpRequest.request({ + method: 'GET', + url: '/accounts/{accountId}/collateral/{collateralId}/withdrawals', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + query: { + 'limit': limit, + 'startingAfter': startingAfter, + 'endingBefore': endingBefore, + }, + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + + /** + * Get a collateral withdrawal transaction details + * @returns CollateralWithdrawalTransaction A collateral withdrawal transaction details + * @throws ApiError + */ + public getCollateralWithdrawalTransactionDetails({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + collateralTxId, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * A Fireblocks' ID of a collateral transaction + */ + collateralTxId: string, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/accounts/{accountId}/collateral/{collateralId}/withdrawals/{collateralTxId}', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + 'collateralTxId': collateralTxId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + + /** + * Initiate a settlement request from the provider + * Request a settlement from the provider. + * @returns SettlementInstructions Settlement instructions + * @throws ApiError + */ + public initiateSettlement({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + requestBody, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * Collateral withdrawal transaction details + */ + requestBody: SettlementRequest, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/accounts/{accountId}/collateral/{collateralId}/settlement', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Return Bad Request.`, + 401: `Unauthorized. Either API details are missing or invalid`, + 403: `Forbidden- You do not have access to the requested resource.`, + 415: `Unsupported media type. You need to use application/json.`, + 500: `Exchange internal error.`, + }, + }); + } + + /** + * Get current Instructions for settlement + * Gets a list of required transactions to finalize the settlement + * + * @returns SettlementInstructions Settlement instructions + * @throws ApiError + */ + public getCurrentSettlementInstructions({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/accounts/{accountId}/collateral/{collateralId}/settlement', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + + /** + * Get a settlement details + * @returns SettlementState A specific settlement details + * @throws ApiError + */ + public getSettlementDetails({ + xFbPlatformSignature, + xFbapiKey, + xFbapiNonce, + xFbapiSignature, + xFbapiTimestamp, + accountId, + collateralId, + settlementVersion, + }: { + /** + * Authentication signature of Fireblocks as the originator of the request + */ + xFbPlatformSignature: string, + /** + * API authentication key. + */ + xFbapiKey: string, + /** + * Unique identifier of the request. + */ + xFbapiNonce: string, + /** + * Request signature using the chosen cryptographic algorithm. The signature is to be calculated on concatenation of the following request fields in the specified order: + * - `X-FBAPI-TIMESTAMP` - `X-FBAPI-NONCE` - HTTP request method in upper case - Endpoint path, including the query parameters - Request body + */ + xFbapiSignature: string, + /** + * Request timestamp in milliseconds since Unix epoch. + */ + xFbapiTimestamp: number, + /** + * Sub-account identifier. + */ + accountId: string, + /** + * ID of a collateral account + */ + collateralId: string, + /** + * A provider version ID of a settlement state + */ + settlementVersion: string, + }): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/accounts/{accountId}/collateral/{collateralId}/settlements/{settlementVersion}', + path: { + 'accountId': accountId, + 'collateralId': collateralId, + 'settlementVersion': settlementVersion, + }, + headers: { + 'X-FB-PLATFORM-SIGNATURE': xFbPlatformSignature, + 'X-FBAPI-KEY': xFbapiKey, + 'X-FBAPI-NONCE': xFbapiNonce, + 'X-FBAPI-SIGNATURE': xFbapiSignature, + 'X-FBAPI-TIMESTAMP': xFbapiTimestamp, + }, + errors: { + 400: `Request could not be processed due to a client error.`, + 401: `Request is unauthorized`, + }, + }); + } + +}