From a1474a8f14bfc1f0e254688e8325784dc6829a11 Mon Sep 17 00:00:00 2001 From: Usman75 Date: Mon, 3 Oct 2022 22:12:59 +0500 Subject: [PATCH] feat/internal transfer exchange assets feature added --- src/fireblocks-sdk.ts | 2590 ++++++++++++++++++++++++----------------- src/types.ts | 919 ++++++++------- 2 files changed, 2022 insertions(+), 1487 deletions(-) diff --git a/src/fireblocks-sdk.ts b/src/fireblocks-sdk.ts index 58ac1c93..8e17cbc4 100644 --- a/src/fireblocks-sdk.ts +++ b/src/fireblocks-sdk.ts @@ -3,1050 +3,1564 @@ import { ApiTokenProvider } from "./api-token-provider"; import { IAuthProvider } from "./iauth-provider"; import queryString from "query-string"; import { - AllocateFundsRequest, - AssetResponse, - AssetTypeResponse, - CancelTransactionResponse, - ConvertExchangeAssetResponse, - CreateTransactionResponse, - CreateTransferTicketArgs, - CreateTransferTicketResponse, - DeallocateFundsRequest, - DepositAddressResponse, - EstimateFeeResponse, - EstimateTransactionFeeResponse, - ExchangeResponse, - ExecuteTermArgs, - ExternalWalletAsset, - FiatAccountResponse, - GasStationInfo, - GenerateAddressResponse, - InternalWalletAsset, - MaxSpendableAmountResponse, - NetworkConnectionResponse, - OffExchangeEntityResponse, - OperationSuccessResponse, - PagedVaultAccountsRequestFilters, - PagedVaultAccountsResponse, - PublicKeyInfoArgs, - PublicKeyInfoForVaultAccountArgs, - RequestOptions, - ResendWebhooksResponse, - TermResponse, - TransactionArguments, - TransactionFilter, - TransactionPageFilter, - TransactionPageResponse, - TransactionResponse, - TransferTicketResponse, - User, - ValidateAddressResponse, - VaultAccountResponse, - VaultAccountsFilter, - VaultAssetResponse, - VaultBalancesFilter, - WalletContainerResponse, - SetFeePayerConfiguration, - FeePayerConfiguration, + AllocateFundsRequest, + AssetResponse, + AssetTypeResponse, + CancelTransactionResponse, + ConvertExchangeAssetResponse, + CreateTransactionResponse, + CreateTransferTicketArgs, + CreateTransferTicketResponse, + DeallocateFundsRequest, + DepositAddressResponse, + EstimateFeeResponse, + EstimateTransactionFeeResponse, + ExchangeResponse, + ExecuteTermArgs, + ExternalWalletAsset, + FiatAccountResponse, + GasStationInfo, + GenerateAddressResponse, + InternalWalletAsset, + InternalTransferExchangeAssetResponse, + MaxSpendableAmountResponse, + NetworkConnectionResponse, + OffExchangeEntityResponse, + OperationSuccessResponse, + PagedVaultAccountsRequestFilters, + PagedVaultAccountsResponse, + PublicKeyInfoArgs, + PublicKeyInfoForVaultAccountArgs, + RequestOptions, + ResendWebhooksResponse, + TermResponse, + TradingAccountType, + TransactionArguments, + TransactionFilter, + TransactionPageFilter, + TransactionPageResponse, + TransactionResponse, + TransferTicketResponse, + User, + ValidateAddressResponse, + VaultAccountResponse, + VaultAccountsFilter, + VaultAssetResponse, + VaultBalancesFilter, + WalletContainerResponse, + SetFeePayerConfiguration, + FeePayerConfiguration, } from "./types"; export * from "./types"; export interface SDKOptions { - timeoutInMs: number; + timeoutInMs: number; } export class FireblocksSDK { - private authProvider: IAuthProvider; - private apiBaseUrl: string; - private apiClient: ApiClient; - - /** - * Creates a new Fireblocks API Client - * @param privateKey A string representation of your private key - * @param apiKey Your api key. This is a uuid you received from Fireblocks - * @param apiBaseUrl The fireblocks server URL. Leave empty to use the default server - * @param authProvider - * @param sdkOptions - */ - constructor(privateKey: string, apiKey: string, apiBaseUrl: string = "https://api.fireblocks.io", authProvider: IAuthProvider = undefined, sdkOptions?: SDKOptions) { - this.authProvider = authProvider ?? new ApiTokenProvider(privateKey, apiKey); - - if (apiBaseUrl) { - this.apiBaseUrl = apiBaseUrl; - } - - this.apiClient = new ApiClient(this.authProvider, this.apiBaseUrl, {timeoutInMs: sdkOptions?.timeoutInMs}); - } - - /** - * Gets all assets that are currently supported by Fireblocks - */ - public async getSupportedAssets(): Promise { - return await this.apiClient.issueGetRequest("/v1/supported_assets"); - } - - /** - * @deprecated this method is deprecated and will be removed in the future. Please use getVaultAccountsWithPageInfo instead. - * Gets all vault accounts for your tenant - */ - public async getVaultAccounts(filter?: VaultAccountsFilter): Promise { - const url = `/v1/vault/accounts?${queryString.stringify(filter)}`; - return await this.apiClient.issueGetRequest(url); - } - - /** - * Gets a list of vault accounts per page matching the given filter or path - * @param pagedVaultAccountsRequestFilters Filters for the first request - */ - public async getVaultAccountsWithPageInfo(pagedVaultAccountsRequestFilters: PagedVaultAccountsRequestFilters): Promise { - return await this.apiClient.issueGetRequest(`/v1/vault/accounts_paged?${queryString.stringify(pagedVaultAccountsRequestFilters)}`); - } - - /** - * @deprecated Replaced by getVaultAccountById. - * Gets a single vault account - * @param vaultAccountId The vault account ID - */ - public async getVaultAccount(vaultAccountId: string): Promise { - return await this.getVaultAccountById(vaultAccountId); - } - - /** - * Gets a single vault account - * @param vaultAccountId The vault account ID - */ - public async getVaultAccountById(vaultAccountId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/vault/accounts/${vaultAccountId}`); - } - - /** - * Gets a single vault account asset - * @param vaultAccountId The vault account ID - * @param assetId The ID of the asset to get - */ - public async getVaultAccountAsset(vaultAccountId: string, assetId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}`); - } - - /** - * Gets a single vault account asset balance after forcing refresh from the blockchain - * @param vaultAccountId The vault account ID - * @param assetId The ID of the asset to get - * @param requestOptions - */ - public async refreshVaultAssetBalance(vaultAccountId: string, assetId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/balance`, "{}", requestOptions); - } - - /** - * Gets deposit addresses for an asset in a vault account - * @param vaultAccountId The vault account ID - * @param assetId The ID of the asset for which to get the deposit address - */ - public async getDepositAddresses(vaultAccountId: string, assetId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses`); - } - - /** - * Gets utxo list for an asset in a vault account - * @param vaultAccountId The vault account ID - * @param assetId The ID of the asset for which to get the utxo list - */ - public async getUnspentInputs(vaultAccountId: string, assetId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/unspent_inputs`); - } - - /** - * Generates a new address for an asset in a vault account - * @param vaultAccountId The vault account ID - * @param assetId The ID of the asset for which to generate the deposit address - * @param description A description for the new address - * @param customerRefId A customer reference ID - * @param requestOptions - */ - public async generateNewAddress(vaultAccountId: string, assetId: string, description?: string, customerRefId?: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses`, { - description, - customerRefId - }, requestOptions); - } - - /** - * Sets the description of an existing address - * @param vaultAccountId The vault account ID - * @param assetId The ID of the asset - * @param address The address for which to set the description - * @param tag The XRP tag, or EOS memo, for which to set the description - * @param description The description to set - */ - public async setAddressDescription(vaultAccountId: string, assetId: string, address: string, tag?: string, description?: string): Promise { - let addressId = address; - if (tag && tag.length > 0) { - addressId = `${address}:${tag}`; - } - - return await this.apiClient.issuePutRequest( - `/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses/${addressId}`, - {description: description || ""}); - } - - /** - * Gets all network connections - */ - public async getNetworkConnections(): Promise { - return await this.apiClient.issueGetRequest("/v1/network_connections"); - } - - /** - * Gets a single network connection by id - */ - public async getNetworkConnectionById(connectionId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/network_connections/${connectionId}`); - } - - /** - * Gets all exchange accounts for your tenant - */ - public async getExchangeAccounts(): Promise { - return await this.apiClient.issueGetRequest("/v1/exchange_accounts"); - } - - /** - * @deprecated Replaced by getExchangeAccountById - * Gets a single exchange account by ID - * @param exchangeAccountId The exchange account ID - */ - public async getExchangeAccount(exchangeAccountId: string): Promise { - return await this.getExchangeAccount(exchangeAccountId); - } - - /** - * Gets a single exchange account by ID - * @param exchangeAccountId The exchange account ID - */ - public async getExchangeAccountById(exchangeAccountId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/exchange_accounts/${exchangeAccountId}`); - } - - /** - * Gets a single asset within an Exchange Account - * @param exchangeAccountId The exchange account ID - * @param assetId The ID of the asset - */ - public async getExchangeAsset(exchangeAccountId: string, assetId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/exchange_accounts/${exchangeAccountId}/${assetId}`); - } - - /** - * Convert an asset at an Exchange Account - * @param exchangeAccountId The exchange account ID - * @param srcAsset The source asset to convert from - * @param destAsset The destination asset to convert to - * @param amount The amount to convert - */ - public async convertExchangeAsset(exchangeAccountId: string, srcAsset: string, destAsset: string, amount: number, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/exchange_accounts/${exchangeAccountId}/convert`, { - srcAsset, destAsset, amount - }, requestOptions); - } - - /** - * Transfer from a main exchange account to a subaccount - * @param exchangeAccountId The exchange ID in Fireblocks - * @param subaccountId The ID of the subaccount in the exchange - * @param assetId The asset to transfer - * @param amount The amount to transfer - * @param requestOptions - */ - public async transferToSubaccount(exchangeAccountId: string, subaccountId: string, assetId: string, amount: number, requestOptions?: RequestOptions): Promise { - const body = { - subaccountId, - amount - }; - - return await this.apiClient.issuePostRequest(`/v1/exchange_accounts/${exchangeAccountId}/${assetId}/transfer_to_subaccount`, body, requestOptions); - } - - /** - * Transfer from a subaccount to a main exchange account - * @param exchangeAccountId The exchange ID in Fireblocks - * @param subaccountId The ID of the subaccount in the exchange - * @param assetId The asset to transfer - * @param amount The amount to transfer - * @param requestOptions - */ - public async transferFromSubaccount(exchangeAccountId: string, subaccountId: string, assetId: string, amount: number, requestOptions?: RequestOptions): Promise { - const body = { - subaccountId, - amount - }; - - return await this.apiClient.issuePostRequest(`/v1/exchange_accounts/${exchangeAccountId}/${assetId}/transfer_from_subaccount`, body, requestOptions); - } - - /** - * Gets all fiat accounts for your tenant - */ - public async getFiatAccounts(): Promise { - return await this.apiClient.issueGetRequest("/v1/fiat_accounts"); - } - - /** - * Gets a single fiat account by ID - * @param accountId The fiat account ID - */ - public async getFiatAccountById(accountId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/fiat_accounts/${accountId}`); - } - - /** - * Redeem from a fiat account to a linked DDA - * @param accountId The fiat account ID in Fireblocks - * @param amount The amount to transfer - * @param requestOptions - */ - public async redeemToLinkedDDA(accountId: string, amount: number, requestOptions?: RequestOptions): Promise { - const body = { - amount - }; - - return await this.apiClient.issuePostRequest(`/v1/fiat_accounts/${accountId}/redeem_to_linked_dda`, body, requestOptions); - } - - /** - * Deposit to a fiat account from a linked DDA - * @param accountId The fiat account ID in Fireblocks - * @param amount The amount to transfer - * @param requestOptions - */ - public async depositFromLinkedDDA(accountId: string, amount: number, requestOptions?: RequestOptions): Promise { - const body = { - amount - }; - - return await this.apiClient.issuePostRequest(`/v1/fiat_accounts/${accountId}/deposit_from_linked_dda`, body, requestOptions); - } - - /** - * Gets a list of transactions matching the given filter - * @param filter.before Only gets transactions created before a given timestamp (in milliseconds) - * @param filter.after Only gets transactions created after a given timestamp (in milliseconds) - * @param filter.status Only gets transactions with the spcified status - * @param filter.limit Limit the amount of returned results. If not specified, a limit of 200 results will be used - * @param filter.orderBy Determines the order of the results - */ - public async getTransactions(filter: TransactionFilter): Promise { - return await this.apiClient.issueGetRequest(`/v1/transactions?${queryString.stringify(filter)}`); - } - - /** - * Gets a list of transactions per page matching the given filter or path - * @param pageFilter Get transactions matching pageFilter params - * @param nextOrPreviousPath Get transactions from each of pageDetails paths - */ - public async getTransactionsWithPageInfo(pageFilter?: TransactionPageFilter, nextOrPreviousPath?: string): Promise { - if (pageFilter) { - return await this.apiClient.issueGetRequest(`/v1/transactions?${queryString.stringify(pageFilter)}`, true); - } else if (nextOrPreviousPath) { - const index = nextOrPreviousPath.indexOf("/v1/"); - const path = nextOrPreviousPath.substring(index, nextOrPreviousPath.length); - return await this.apiClient.issueGetRequest(path, true); - } - - return {transactions: [], pageDetails: { prevPage: "", nextPage: "" }}; - } - - /** - * Gets a transaction matching the external transaction id provided - * @param externalTxId - */ - public async getTransactionByExternalTxId(externalTxId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/transactions/external_tx_id/${externalTxId}`); - } - - /** - * Gets all internal wallets for your tenant - */ - public async getInternalWallets(): Promise[]> { - return await this.apiClient.issueGetRequest("/v1/internal_wallets"); - } - - /** - * Gets a single internal wallet - * @param walletId The internal wallet ID - */ - public async getInternalWallet(walletId: string): Promise> { - return await this.apiClient.issueGetRequest(`/v1/internal_wallets/${walletId}`); - } - - /** - * Gets a single internal wallet asset - * @param walletId The internal wallet ID - * @param assetId The asset ID - */ - public async getInternalWalletAsset(walletId: string, assetId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/internal_wallets/${walletId}/${assetId}`); - } - - /** - * Gets all external wallets for your tenant - */ - public async getExternalWallets(): Promise[]> { - return await this.apiClient.issueGetRequest("/v1/external_wallets"); - } - - /** - * Gets a single external wallet - * @param walletId The external wallet ID - */ - public async getExternalWallet(walletId: string): Promise> { - return await this.apiClient.issueGetRequest(`/v1/external_wallets/${walletId}`); - } - - /** - * Gets a single external wallet asset - * @param walletId The external wallet ID - * @param assetId The asset ID - */ - public async getExternalWalletAsset(walletId: string, assetId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/external_wallets/${walletId}/${assetId}`); - } - - /** - * Gets all contract wallets for your tenant - */ - public async getContractWallets(): Promise[]> { - return await this.apiClient.issueGetRequest("/v1/contracts"); - } - - /** - * Gets a single contract wallet - * @param walletId The contract wallet ID - */ - public async getContractWallet(walletId: string): Promise> { - return await this.apiClient.issueGetRequest(`/v1/contracts/${walletId}`); - } - - /** - * Gets a single contract wallet asset - * @param walletId The contract wallet ID - * @param assetId The asset ID - */ - public async getContractWalletAsset(walletId: string, assetId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/contracts/${walletId}/${assetId}`); - } - - /** - * Gets detailed information for a single transaction - * @param txId The transaction id to query - */ - public async getTransactionById(txId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/transactions/${txId}`); - } - - /** - * Cancels the selected transaction - * @param txId The transaction id to cancel - * @param requestOptions - */ - public async cancelTransactionById(txId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/transactions/${txId}/cancel`, {}, requestOptions); - } - - /** - * Creates a new vault account - * @param name A name for the new vault account - * @param hiddenOnUI If true, the created account and all related transactions will not be shown on Fireblocks console - * @param customerRefId A customer reference ID - * @param autoFuel - * @param requestOptions - * @param autoFuel - * @param requestOptions - */ - public async createVaultAccount(name: string, hiddenOnUI?: boolean, customerRefId?: string, autoFuel?: boolean, requestOptions?: RequestOptions): Promise { - const body = { - name, - customerRefId, - hiddenOnUI: hiddenOnUI || false, - autoFuel: autoFuel || false - }; - - return await this.apiClient.issuePostRequest("/v1/vault/accounts", body, requestOptions); - } - - /** - * Hides a vault account in Fireblocks console - * @param vaultAccountId The vault account ID - * @param requestOptions - */ - public async hideVaultAccount(vaultAccountId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/hide`, {}, requestOptions); - } - - /** - * Reveals a hidden vault account in Fireblocks console - * @param vaultAccountId The vault account ID - * @param requestOptions - */ - public async unhideVaultAccount(vaultAccountId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/unhide`, {}, requestOptions); - } - - /** - * Sets autoFuel to true/false for a vault account - * @param vaultAccountId The vault account ID - * @param autoFuel The new value for the autoFuel flag - * @param requestOptions - */ - public async setAutoFuel(vaultAccountId: string, autoFuel: boolean, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/set_auto_fuel`, {autoFuel}, requestOptions); - } - - /** - * Updates a vault account - * @param vaultAccountId - * @param name A new name for the vault account - */ - public async updateVaultAccount(vaultAccountId: string, name: string): Promise { - const body = { - name: name - }; - - return await this.apiClient.issuePutRequest(`/v1/vault/accounts/${vaultAccountId}`, body); - } - - /** - * Creates a new asset within an existing vault account - * @param vaultAccountId The vault account ID - * @param assetId The asset to add - * @param requestOptions - */ - public async createVaultAsset(vaultAccountId: string, assetId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}`, {}, requestOptions); - } - - /** - * Retry to create a vault asset for a vault asset that failed - * @param vaultAccountId The vault account ID - * @param assetId The asset to add - * @param requestOptions - */ - public async activateVaultAsset(vaultAccountId: string, assetId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/activate`, {} , requestOptions); - } - - /** - * Creates a new external wallet - * @param name A name for the new external wallet - * @param customerRefId A customer reference ID - * @param requestOptions - */ - public async createExternalWallet(name: string, customerRefId?: string, requestOptions?: RequestOptions): Promise> { - const body = { - name, - customerRefId - }; - - return await this.apiClient.issuePostRequest("/v1/external_wallets", body, requestOptions); - } - - /** - * Creates a new internal wallet - * @param name A name for the new internal wallet - * @param customerRefId A customer reference ID - * @param requestOptions - */ - public async createInternalWallet(name: string, customerRefId?: string, requestOptions?: RequestOptions): Promise> { - const body = { - name, - customerRefId - }; - - return await this.apiClient.issuePostRequest("/v1/internal_wallets", body, requestOptions); - } - - /** - * Creates a new contract wallet - * @param name A name for the new contract wallet - */ - public async createContractWallet(name: string, requestOptions?: RequestOptions): Promise> { - const body = { - name, - }; - - return await this.apiClient.issuePostRequest("/v1/contracts", body, requestOptions); - } - - /** - * Creates a new asset within an exiting external wallet - * @param walletId The wallet id - * @param assetId The asset to add - * @param address The wallet address - * @param tag (for ripple only) The ripple account tag - * @param requestOptions - */ - public async createExternalWalletAsset(walletId: string, assetId: string, address: string, tag?: string, requestOptions?: RequestOptions): Promise { - const path = `/v1/external_wallets/${walletId}/${assetId}`; - - const body = { - address: address, - tag: tag - }; - return await this.apiClient.issuePostRequest(path, body, requestOptions); - } - - /** - * Creates a new asset within an exiting internal wallet - * @param walletId The wallet id - * @param assetId The asset to add - * @param address The wallet address - * @param tag (for ripple only) The ripple account tag - * @param requestOptions - */ - public async createInternalWalletAsset(walletId: string, assetId: string, address: string, tag?: string, requestOptions?: RequestOptions): Promise { - const path = `/v1/internal_wallets/${walletId}/${assetId}`; - - const body = { - address: address, - tag: tag - }; - return await this.apiClient.issuePostRequest(path, body, requestOptions); - } - - /** - * Creates a new asset within an exiting contract wallet - * @param walletId The wallet id - * @param assetId The asset to add - * @param address The wallet address - * @param tag (for ripple only) The ripple account tag - */ - public async createContractWalletAsset(walletId: string, assetId: string, address: string, tag?: string, requestOptions?: RequestOptions): Promise { - const path = `/v1/contracts/${walletId}/${assetId}`; - - const body = { - address: address, - tag: tag - }; - return await this.apiClient.issuePostRequest(path, body, requestOptions); - } - - /** - * Creates a new transaction with the specified options - */ - public async createTransaction(transactionArguments: TransactionArguments, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest("/v1/transactions", transactionArguments, requestOptions); - } - - /** - * Estimates the fee for a transaction request - */ - public async estimateFeeForTransaction(transactionArguments: TransactionArguments, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest("/v1/transactions/estimate_fee", transactionArguments, requestOptions); - } - - /** - * Gets the estimated fees for an asset - */ - public async getFeeForAsset(asset: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/estimate_network_fee?assetId=${asset}`); - } - - /** - * Creates a new transfer ticket - */ - public async createTransferTicket(options: CreateTransferTicketArgs, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest("/v1/transfer_tickets", options, requestOptions); - } - - /** - * Gets all transfer tickets - */ - public async getTransferTickets(): Promise { - return await this.apiClient.issueGetRequest("/v1/transfer_tickets"); - } - - /** - * Get a transfer ticket by ticket ID - * @param ticketId - */ - public async getTransferTicketById(ticketId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/transfer_tickets/${ticketId}`); - } - - /** - * Get a term of transfer ticket - * @param ticketId - * @param termId - */ - public async getTransferTicketTerm(ticketId: string, termId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/transfer_tickets/${ticketId}/${termId}`); - } - - /** - * Cancel the transfer ticket - * @param ticketId - * @param requestOptions - */ - public async cancelTransferTicket(ticketId: string, requestOptions?: RequestOptions) { - return await this.apiClient.issuePostRequest(`/v1/transfer_tickets/${ticketId}/cancel`, {}, requestOptions); - } - - /** - * Executes a transaction for a single term of a transfer ticket - * @param ticketId - * @param termId - * @param options - * @param requestOptions - */ - public async executeTransferTicketTerm(ticketId: string, termId: string, options: ExecuteTermArgs, requestOptions?: RequestOptions) { - return await this.apiClient.issuePostRequest(`/v1/transfer_tickets/${ticketId}/${termId}/transfer`, - options, requestOptions); - } - - /** - * Deletes a single internal wallet - * @param walletId The internal wallet ID - */ - public async deleteInternalWallet(walletId: string): Promise { - return await this.apiClient.issueDeleteRequest(`/v1/internal_wallets/${walletId}`); - } - - /** - * Deletes a single internal wallet asset - * @param walletId The internal wallet ID - * @param assetId The asset ID - */ - public async deleteInternalWalletAsset(walletId: string, assetId: string): Promise { - return await this.apiClient.issueDeleteRequest(`/v1/internal_wallets/${walletId}/${assetId}`); - } - - /** - * Deletes a single external wallet - * @param walletId The external wallet ID - */ - public async deleteExternalWallet(walletId: string): Promise { - return await this.apiClient.issueDeleteRequest(`/v1/external_wallets/${walletId}`); - } - - /** - * Deletes a single external wallet asset - * @param walletId The external wallet ID - * @param assetId The asset ID - */ - public async deleteExternalWalletAsset(walletId: string, assetId: string): Promise { - return await this.apiClient.issueDeleteRequest(`/v1/external_wallets/${walletId}/${assetId}`); - } - - /** - * Deletes a single contract wallet - * @param walletId The contract wallet ID - */ - public async deleteContractWallet(walletId: string): Promise { - return await this.apiClient.issueDeleteRequest(`/v1/contracts/${walletId}`); - } - - /** - * Deletes a single contract wallet asset - * @param walletId The contract wallet ID - * @param assetId The asset ID - */ - public async deleteContractWalletAsset(walletId: string, assetId: string): Promise { - return await this.apiClient.issueDeleteRequest(`/v1/contracts/${walletId}/${assetId}`); - } - - /** - * Sets a customer reference ID - * @param vaultAccountId The vault account ID - * @param customerRefId The customer reference ID to set - * @param requestOptions - */ - public async setCustomerRefIdForVaultAccount(vaultAccountId: string, customerRefId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/set_customer_ref_id`, {customerRefId}, requestOptions); - } - - /** - * Sets a customer reference ID - * @param walletId The ID of the internal wallet - * @param customerRefId The customer reference ID to set - * @param requestOptions - */ - public async setCustomerRefIdForInternalWallet(walletId: string, customerRefId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/internal_wallets/${walletId}/set_customer_ref_id`, {customerRefId}, requestOptions); - } - - /** - * Sets a customer reference ID - * @param walletId The ID of the external wallet - * @param customerRefId The customer reference ID to set - * @param requestOptions - */ - public async setCustomerRefIdForExternalWallet(walletId: string, customerRefId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/external_wallets/${walletId}/set_customer_ref_id`, {customerRefId}, requestOptions); - } - - /** - * Sets a customer reference ID - * @param vaultAccountId The vault account ID - * @param assetId The ID of the asset - * @param address The address - * @param tag The XRP tag, or EOS memo - * @param customerRefId The customer reference ID to set - * @param requestOptions - */ - public async setCustomerRefIdForAddress(vaultAccountId: string, assetId: string, address: string, tag?: string, customerRefId?: string, requestOptions?: RequestOptions): Promise { - let addressId = address; - if (tag && tag.length > 0) { - addressId = `${address}:${tag}`; - } - - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses/${addressId}/set_customer_ref_id`, {customerRefId}, requestOptions); - } - - /** - * Set the required number of confirmations for transaction - * @param txId - * @param requiredConfirmationsNumber - * @param requestOptions - */ - public async setConfirmationThresholdForTxId(txId: string, requiredConfirmationsNumber: number, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/transactions/${txId}/set_confirmation_threshold`, {numOfConfirmations: requiredConfirmationsNumber}, requestOptions); - } - - /** - * Set the required number of confirmations for transactions by tx hash - * @param txHash - * @param requiredConfirmationsNumber - * @param requestOptions - */ - public async setConfirmationThresholdForTxHash(txHash: string, requiredConfirmationsNumber: number, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/txHash/${txHash}/set_confirmation_threshold`, {numOfConfirmations: requiredConfirmationsNumber}, requestOptions); - } - - /** - * Get the public key information - * @param args - */ - public async getPublicKeyInfo(args: PublicKeyInfoArgs) { - let url = `/v1/vault/public_key_info`; - if (args.algorithm) { - url += `?algorithm=${args.algorithm}`; - } - if (args.derivationPath) { - url += `&derivationPath=${args.derivationPath}`; - } - if (args.compressed) { - url += `&compressed=${args.compressed}`; - } - return await this.apiClient.issueGetRequest(url); - } - - /** - * allocate funds from you default balance to a private ledger - * @param vaultAccountId - * @param asset - * @param vaultAccountId - * @param asset - * @param args - * @param requestOptions - */ - public async allocateFundsToPrivateLedger(vaultAccountId: string, asset: string, args: AllocateFundsRequest, requestOptions?: RequestOptions) { - const url = `/v1/vault/accounts/${vaultAccountId}/${asset}/lock_allocation`; - return await this.apiClient.issuePostRequest(url, args, requestOptions); - } - - /** - * deallocate funds from a private ledger to your default balance - * @param vaultAccountId - * @param asset - * @param args - * @param requestOptions - */ - public async deallocateFundsFromPrivateLedger(vaultAccountId: string, asset: string, args: DeallocateFundsRequest, requestOptions?: RequestOptions) { - const url = `/v1/vault/accounts/${vaultAccountId}/${asset}/release_allocation`; - return await this.apiClient.issuePostRequest(url, args, requestOptions); - } - - /** - * Get the public key information for a vault account - * @param args - */ - public async getPublicKeyInfoForVaultAccount(args: PublicKeyInfoForVaultAccountArgs) { - let url = `/v1/vault/accounts/${args.vaultAccountId}/${args.assetId}/${args.change}/${args.addressIndex}/public_key_info`; - if (args.compressed) { - url += `?compressed=${args.compressed}`; - } - return await this.apiClient.issueGetRequest(url); - } - - /** - * Get configuration and status of the Gas Station account - */ - public async getGasStationInfo(assetId?: string): Promise { - let url = `/v1/gas_station`; - - if (assetId) { - url += `/${assetId}`; - } - - return await this.apiClient.issueGetRequest(url); - } - - /** - * Set configuration of the Gas Station account - */ - public async setGasStationConfiguration(gasThreshold: string, gasCap: string, maxGasPrice?: string, assetId?: string): Promise { - let url = `/v1/gas_station/configuration`; - - if (assetId) { - url += `/${assetId}`; - } - - const body = {gasThreshold, gasCap, maxGasPrice}; - - return await this.apiClient.issuePutRequest(url, body); - } - - /** - * Drop an ETH based transaction - */ - public async dropTransaction(txId: string, feeLevel?: string, requestedFee?: string, requestOptions?: RequestOptions) { - const url = `/v1/transactions/${txId}/drop`; - - const body = {feeLevel, requestedFee}; - - return await this.apiClient.issuePostRequest(url, body, requestOptions); - } - - /** - * Get max spendable amount per asset and vault - */ - public async getMaxSpendableAmount(vaultAccountId: string, assetId: string, manualSigning?: Boolean): Promise { - let url = `/v1/vault/accounts/${vaultAccountId}/${assetId}/max_spendable_amount`; - - if (manualSigning) { - url += `?manualSigning=${manualSigning}`; - } - - return await this.apiClient.issueGetRequest(url); - } - - /** - * Get all vault assets balance overview - */ - public async getVaultAssetsBalance(filter: VaultBalancesFilter): Promise { - const url = `/v1/vault/assets?${queryString.stringify(filter)}`; - - return await this.apiClient.issueGetRequest(url); - } - - /** - * Get vault balance overview per asset - */ - public async getVaultBalanceByAsset(assetId: string): Promise { - const url = `/v1/vault/assets/${assetId}`; - return await this.apiClient.issueGetRequest(url); - } - - /** - * Get address validation info - */ - public async validateAddress(assetId: string, address: string): Promise { - const url = `/v1/transactions/validate_address/${assetId}/${address}`; - return await this.apiClient.issueGetRequest(url); - } - - /** - * Unfreezes the selected transaction - * @param txId The transaction id to unfreeze - * @param requestOptions - */ - public async unfreezeTransactionById(txId: string, requestOptions?: RequestOptions): Promise { - return this.apiClient.issuePostRequest(`/v1/transactions/${txId}/unfreeze`, {}, requestOptions); - } - - /** - * Freezes the selected transaction - * @param txId The transaction id to freeze - * @param requestOptions - */ - public async freezeTransactionById(txId: string, requestOptions?: RequestOptions): Promise { - return this.apiClient.issuePostRequest(`/v1/transactions/${txId}/freeze`, {}, requestOptions); - } - - /** - * Resend failed webhooks - */ - public async resendWebhooks(requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest("/v1/webhooks/resend", {}, requestOptions); - } - - /** - * Resend transaction webhooks - * @param txId The transaction for which the message is sent - * @param resendCreated If true a webhook will be sent for the creation of the transaction - * @param resendStatusUpdated If true a webhook will be sent for the status of the transaction - * @param requestOptions - */ - public async resendTransactionWebhooksById(txId: string, resendCreated?: boolean, resendStatusUpdated?: boolean, requestOptions?: RequestOptions): Promise { - const body = { resendCreated, resendStatusUpdated }; - return await this.apiClient.issuePostRequest(`/v1/webhooks/resend/${txId}`, body, requestOptions); - } - - /** - * Gets all Users for your tenant - */ - public async getUsers(): Promise { - return await this.apiClient.issueGetRequest("/v1/users"); - } - - /** - * Get off exchange accounts - */ - public async getOffExchangeAccounts(): Promise { - return await this.apiClient.issueGetRequest(`/v1/off_exchange_accounts`); - } - - /** - * Get off exchange account by virtual account id - * @param id the ID of the off exchange - */ - public async getOffExchangeAccountById(id: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/off_exchange_accounts/${id}`); - } - - /** - * Settle off exchange account by virtual account id - * @param id the ID of the off exchange - * @param requestOptions - */ - public async settleOffExchangeAccountById(id: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/off_exchange_accounts/${id}/settle`, {}, requestOptions); - } - - /** - * Set Fee Payer configuration - * @param feePayerConfiguration - * @param baseAsset - * @param requestOptions - */ - public async setFeePayerConfiguration(baseAsset: string, feePayerConfiguration: SetFeePayerConfiguration, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/fee_payer/${baseAsset}`, feePayerConfiguration, requestOptions); - } - - /** - * Get Fee Payer Configuration - * @param baseAsset - */ - public async getFeePayerConfiguration(baseAsset: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/fee_payer/${baseAsset}`); - } - - /** - * Delete Fee Payer Configuration - * @param baseAsset - */ - public async removeFeePayerConfiguration(baseAsset: string): Promise { - return await this.apiClient.issueDeleteRequest(`/v1/fee_payer/${baseAsset}`); - } + private authProvider: IAuthProvider; + private apiBaseUrl: string; + private apiClient: ApiClient; + + /** + * Creates a new Fireblocks API Client + * @param privateKey A string representation of your private key + * @param apiKey Your api key. This is a uuid you received from Fireblocks + * @param apiBaseUrl The fireblocks server URL. Leave empty to use the default server + * @param authProvider + * @param sdkOptions + */ + constructor( + privateKey: string, + apiKey: string, + apiBaseUrl: string = "https://api.fireblocks.io", + authProvider: IAuthProvider = undefined, + sdkOptions?: SDKOptions + ) { + this.authProvider = + authProvider ?? new ApiTokenProvider(privateKey, apiKey); + + if (apiBaseUrl) { + this.apiBaseUrl = apiBaseUrl; + } + + this.apiClient = new ApiClient(this.authProvider, this.apiBaseUrl, { + timeoutInMs: sdkOptions?.timeoutInMs, + }); + } + + /** + * Gets all assets that are currently supported by Fireblocks + */ + public async getSupportedAssets(): Promise { + return await this.apiClient.issueGetRequest("/v1/supported_assets"); + } + + /** + * @deprecated this method is deprecated and will be removed in the future. Please use getVaultAccountsWithPageInfo instead. + * Gets all vault accounts for your tenant + */ + public async getVaultAccounts( + filter?: VaultAccountsFilter + ): Promise { + const url = `/v1/vault/accounts?${queryString.stringify(filter)}`; + return await this.apiClient.issueGetRequest(url); + } + + /** + * Gets a list of vault accounts per page matching the given filter or path + * @param pagedVaultAccountsRequestFilters Filters for the first request + */ + public async getVaultAccountsWithPageInfo( + pagedVaultAccountsRequestFilters: PagedVaultAccountsRequestFilters + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/vault/accounts_paged?${queryString.stringify( + pagedVaultAccountsRequestFilters + )}` + ); + } + + /** + * @deprecated Replaced by getVaultAccountById. + * Gets a single vault account + * @param vaultAccountId The vault account ID + */ + public async getVaultAccount( + vaultAccountId: string + ): Promise { + return await this.getVaultAccountById(vaultAccountId); + } + + /** + * Gets a single vault account + * @param vaultAccountId The vault account ID + */ + public async getVaultAccountById( + vaultAccountId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/vault/accounts/${vaultAccountId}` + ); + } + + /** + * Gets a single vault account asset + * @param vaultAccountId The vault account ID + * @param assetId The ID of the asset to get + */ + public async getVaultAccountAsset( + vaultAccountId: string, + assetId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/vault/accounts/${vaultAccountId}/${assetId}` + ); + } + + /** + * Gets a single vault account asset balance after forcing refresh from the blockchain + * @param vaultAccountId The vault account ID + * @param assetId The ID of the asset to get + * @param requestOptions + */ + public async refreshVaultAssetBalance( + vaultAccountId: string, + assetId: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/vault/accounts/${vaultAccountId}/${assetId}/balance`, + "{}", + requestOptions + ); + } + + /** + * Gets deposit addresses for an asset in a vault account + * @param vaultAccountId The vault account ID + * @param assetId The ID of the asset for which to get the deposit address + */ + public async getDepositAddresses( + vaultAccountId: string, + assetId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses` + ); + } + + /** + * Gets utxo list for an asset in a vault account + * @param vaultAccountId The vault account ID + * @param assetId The ID of the asset for which to get the utxo list + */ + public async getUnspentInputs( + vaultAccountId: string, + assetId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/vault/accounts/${vaultAccountId}/${assetId}/unspent_inputs` + ); + } + + /** + * Generates a new address for an asset in a vault account + * @param vaultAccountId The vault account ID + * @param assetId The ID of the asset for which to generate the deposit address + * @param description A description for the new address + * @param customerRefId A customer reference ID + * @param requestOptions + */ + public async generateNewAddress( + vaultAccountId: string, + assetId: string, + description?: string, + customerRefId?: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses`, + { + description, + customerRefId, + }, + requestOptions + ); + } + + /** + * Sets the description of an existing address + * @param vaultAccountId The vault account ID + * @param assetId The ID of the asset + * @param address The address for which to set the description + * @param tag The XRP tag, or EOS memo, for which to set the description + * @param description The description to set + */ + public async setAddressDescription( + vaultAccountId: string, + assetId: string, + address: string, + tag?: string, + description?: string + ): Promise { + let addressId = address; + if (tag && tag.length > 0) { + addressId = `${address}:${tag}`; + } + + return await this.apiClient.issuePutRequest( + `/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses/${addressId}`, + { description: description || "" } + ); + } + + /** + * Gets all network connections + */ + public async getNetworkConnections(): Promise { + return await this.apiClient.issueGetRequest("/v1/network_connections"); + } + + /** + * Gets a single network connection by id + */ + public async getNetworkConnectionById( + connectionId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/network_connections/${connectionId}` + ); + } + + /** + * Gets all exchange accounts for your tenant + */ + public async getExchangeAccounts(): Promise { + return await this.apiClient.issueGetRequest("/v1/exchange_accounts"); + } + + /** + * @deprecated Replaced by getExchangeAccountById + * Gets a single exchange account by ID + * @param exchangeAccountId The exchange account ID + */ + public async getExchangeAccount( + exchangeAccountId: string + ): Promise { + return await this.getExchangeAccount(exchangeAccountId); + } + + /** + * Gets a single exchange account by ID + * @param exchangeAccountId The exchange account ID + */ + public async getExchangeAccountById( + exchangeAccountId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/exchange_accounts/${exchangeAccountId}` + ); + } + + /** + * Gets a single asset within an Exchange Account + * @param exchangeAccountId The exchange account ID + * @param assetId The ID of the asset + */ + public async getExchangeAsset( + exchangeAccountId: string, + assetId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/exchange_accounts/${exchangeAccountId}/${assetId}` + ); + } + /** + * Internal transfer Exchange Asset + * @param exchangeAccountId The exchange account ID + * @param sourceType The source account type + * @param destType The destination account type + * @param asset The asset Id + * @param amount The amount to transfer + */ + public async internalTransferExchangeAsset( + exchangeAccountId: string, + sourceType: TradingAccountType, + destType: TradingAccountType, + asset: string, + amount: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/exchange_accounts/${exchangeAccountId}/internal_transfer`, + { + sourceType, + destType, + asset, + amount, + }, + requestOptions + ); + } + /** + * Convert an asset at an Exchange Account + * @param exchangeAccountId The exchange account ID + * @param srcAsset The source asset to convert from + * @param destAsset The destination asset to convert to + * @param amount The amount to convert + */ + public async convertExchangeAsset( + exchangeAccountId: string, + srcAsset: string, + destAsset: string, + amount: number, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/exchange_accounts/${exchangeAccountId}/convert`, + { + srcAsset, + destAsset, + amount, + }, + requestOptions + ); + } + + /** + * Transfer from a main exchange account to a subaccount + * @param exchangeAccountId The exchange ID in Fireblocks + * @param subaccountId The ID of the subaccount in the exchange + * @param assetId The asset to transfer + * @param amount The amount to transfer + * @param requestOptions + */ + public async transferToSubaccount( + exchangeAccountId: string, + subaccountId: string, + assetId: string, + amount: number, + requestOptions?: RequestOptions + ): Promise { + const body = { + subaccountId, + amount, + }; + + return await this.apiClient.issuePostRequest( + `/v1/exchange_accounts/${exchangeAccountId}/${assetId}/transfer_to_subaccount`, + body, + requestOptions + ); + } + + /** + * Transfer from a subaccount to a main exchange account + * @param exchangeAccountId The exchange ID in Fireblocks + * @param subaccountId The ID of the subaccount in the exchange + * @param assetId The asset to transfer + * @param amount The amount to transfer + * @param requestOptions + */ + public async transferFromSubaccount( + exchangeAccountId: string, + subaccountId: string, + assetId: string, + amount: number, + requestOptions?: RequestOptions + ): Promise { + const body = { + subaccountId, + amount, + }; + + return await this.apiClient.issuePostRequest( + `/v1/exchange_accounts/${exchangeAccountId}/${assetId}/transfer_from_subaccount`, + body, + requestOptions + ); + } + + /** + * Gets all fiat accounts for your tenant + */ + public async getFiatAccounts(): Promise { + return await this.apiClient.issueGetRequest("/v1/fiat_accounts"); + } + + /** + * Gets a single fiat account by ID + * @param accountId The fiat account ID + */ + public async getFiatAccountById( + accountId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/fiat_accounts/${accountId}` + ); + } + + /** + * Redeem from a fiat account to a linked DDA + * @param accountId The fiat account ID in Fireblocks + * @param amount The amount to transfer + * @param requestOptions + */ + public async redeemToLinkedDDA( + accountId: string, + amount: number, + requestOptions?: RequestOptions + ): Promise { + const body = { + amount, + }; + + return await this.apiClient.issuePostRequest( + `/v1/fiat_accounts/${accountId}/redeem_to_linked_dda`, + body, + requestOptions + ); + } + + /** + * Deposit to a fiat account from a linked DDA + * @param accountId The fiat account ID in Fireblocks + * @param amount The amount to transfer + * @param requestOptions + */ + public async depositFromLinkedDDA( + accountId: string, + amount: number, + requestOptions?: RequestOptions + ): Promise { + const body = { + amount, + }; + + return await this.apiClient.issuePostRequest( + `/v1/fiat_accounts/${accountId}/deposit_from_linked_dda`, + body, + requestOptions + ); + } + + /** + * Gets a list of transactions matching the given filter + * @param filter.before Only gets transactions created before a given timestamp (in milliseconds) + * @param filter.after Only gets transactions created after a given timestamp (in milliseconds) + * @param filter.status Only gets transactions with the spcified status + * @param filter.limit Limit the amount of returned results. If not specified, a limit of 200 results will be used + * @param filter.orderBy Determines the order of the results + */ + public async getTransactions( + filter: TransactionFilter + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/transactions?${queryString.stringify(filter)}` + ); + } + + /** + * Gets a list of transactions per page matching the given filter or path + * @param pageFilter Get transactions matching pageFilter params + * @param nextOrPreviousPath Get transactions from each of pageDetails paths + */ + public async getTransactionsWithPageInfo( + pageFilter?: TransactionPageFilter, + nextOrPreviousPath?: string + ): Promise { + if (pageFilter) { + return await this.apiClient.issueGetRequest( + `/v1/transactions?${queryString.stringify(pageFilter)}`, + true + ); + } else if (nextOrPreviousPath) { + const index = nextOrPreviousPath.indexOf("/v1/"); + const path = nextOrPreviousPath.substring( + index, + nextOrPreviousPath.length + ); + return await this.apiClient.issueGetRequest(path, true); + } + + return { transactions: [], pageDetails: { prevPage: "", nextPage: "" } }; + } + + /** + * Gets a transaction matching the external transaction id provided + * @param externalTxId + */ + public async getTransactionByExternalTxId( + externalTxId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/transactions/external_tx_id/${externalTxId}` + ); + } + + /** + * Gets all internal wallets for your tenant + */ + public async getInternalWallets(): Promise< + WalletContainerResponse[] + > { + return await this.apiClient.issueGetRequest("/v1/internal_wallets"); + } + + /** + * Gets a single internal wallet + * @param walletId The internal wallet ID + */ + public async getInternalWallet( + walletId: string + ): Promise> { + return await this.apiClient.issueGetRequest( + `/v1/internal_wallets/${walletId}` + ); + } + + /** + * Gets a single internal wallet asset + * @param walletId The internal wallet ID + * @param assetId The asset ID + */ + public async getInternalWalletAsset( + walletId: string, + assetId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/internal_wallets/${walletId}/${assetId}` + ); + } + + /** + * Gets all external wallets for your tenant + */ + public async getExternalWallets(): Promise< + WalletContainerResponse[] + > { + return await this.apiClient.issueGetRequest("/v1/external_wallets"); + } + + /** + * Gets a single external wallet + * @param walletId The external wallet ID + */ + public async getExternalWallet( + walletId: string + ): Promise> { + return await this.apiClient.issueGetRequest( + `/v1/external_wallets/${walletId}` + ); + } + + /** + * Gets a single external wallet asset + * @param walletId The external wallet ID + * @param assetId The asset ID + */ + public async getExternalWalletAsset( + walletId: string, + assetId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/external_wallets/${walletId}/${assetId}` + ); + } + + /** + * Gets all contract wallets for your tenant + */ + public async getContractWallets(): Promise< + WalletContainerResponse[] + > { + return await this.apiClient.issueGetRequest("/v1/contracts"); + } + + /** + * Gets a single contract wallet + * @param walletId The contract wallet ID + */ + public async getContractWallet( + walletId: string + ): Promise> { + return await this.apiClient.issueGetRequest(`/v1/contracts/${walletId}`); + } + + /** + * Gets a single contract wallet asset + * @param walletId The contract wallet ID + * @param assetId The asset ID + */ + public async getContractWalletAsset( + walletId: string, + assetId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/contracts/${walletId}/${assetId}` + ); + } + + /** + * Gets detailed information for a single transaction + * @param txId The transaction id to query + */ + public async getTransactionById(txId: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/transactions/${txId}`); + } + + /** + * Cancels the selected transaction + * @param txId The transaction id to cancel + * @param requestOptions + */ + public async cancelTransactionById( + txId: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/transactions/${txId}/cancel`, + {}, + requestOptions + ); + } + + /** + * Creates a new vault account + * @param name A name for the new vault account + * @param hiddenOnUI If true, the created account and all related transactions will not be shown on Fireblocks console + * @param customerRefId A customer reference ID + * @param autoFuel + * @param requestOptions + * @param autoFuel + * @param requestOptions + */ + public async createVaultAccount( + name: string, + hiddenOnUI?: boolean, + customerRefId?: string, + autoFuel?: boolean, + requestOptions?: RequestOptions + ): Promise { + const body = { + name, + customerRefId, + hiddenOnUI: hiddenOnUI || false, + autoFuel: autoFuel || false, + }; + + return await this.apiClient.issuePostRequest( + "/v1/vault/accounts", + body, + requestOptions + ); + } + + /** + * Hides a vault account in Fireblocks console + * @param vaultAccountId The vault account ID + * @param requestOptions + */ + public async hideVaultAccount( + vaultAccountId: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/vault/accounts/${vaultAccountId}/hide`, + {}, + requestOptions + ); + } + + /** + * Reveals a hidden vault account in Fireblocks console + * @param vaultAccountId The vault account ID + * @param requestOptions + */ + public async unhideVaultAccount( + vaultAccountId: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/vault/accounts/${vaultAccountId}/unhide`, + {}, + requestOptions + ); + } + + /** + * Sets autoFuel to true/false for a vault account + * @param vaultAccountId The vault account ID + * @param autoFuel The new value for the autoFuel flag + * @param requestOptions + */ + public async setAutoFuel( + vaultAccountId: string, + autoFuel: boolean, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/vault/accounts/${vaultAccountId}/set_auto_fuel`, + { autoFuel }, + requestOptions + ); + } + + /** + * Updates a vault account + * @param vaultAccountId + * @param name A new name for the vault account + */ + public async updateVaultAccount( + vaultAccountId: string, + name: string + ): Promise { + const body = { + name: name, + }; + + return await this.apiClient.issuePutRequest( + `/v1/vault/accounts/${vaultAccountId}`, + body + ); + } + + /** + * Creates a new asset within an existing vault account + * @param vaultAccountId The vault account ID + * @param assetId The asset to add + * @param requestOptions + */ + public async createVaultAsset( + vaultAccountId: string, + assetId: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/vault/accounts/${vaultAccountId}/${assetId}`, + {}, + requestOptions + ); + } + + /** + * Retry to create a vault asset for a vault asset that failed + * @param vaultAccountId The vault account ID + * @param assetId The asset to add + * @param requestOptions + */ + public async activateVaultAsset( + vaultAccountId: string, + assetId: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/vault/accounts/${vaultAccountId}/${assetId}/activate`, + {}, + requestOptions + ); + } + + /** + * Creates a new external wallet + * @param name A name for the new external wallet + * @param customerRefId A customer reference ID + * @param requestOptions + */ + public async createExternalWallet( + name: string, + customerRefId?: string, + requestOptions?: RequestOptions + ): Promise> { + const body = { + name, + customerRefId, + }; + + return await this.apiClient.issuePostRequest( + "/v1/external_wallets", + body, + requestOptions + ); + } + + /** + * Creates a new internal wallet + * @param name A name for the new internal wallet + * @param customerRefId A customer reference ID + * @param requestOptions + */ + public async createInternalWallet( + name: string, + customerRefId?: string, + requestOptions?: RequestOptions + ): Promise> { + const body = { + name, + customerRefId, + }; + + return await this.apiClient.issuePostRequest( + "/v1/internal_wallets", + body, + requestOptions + ); + } + + /** + * Creates a new contract wallet + * @param name A name for the new contract wallet + */ + public async createContractWallet( + name: string, + requestOptions?: RequestOptions + ): Promise> { + const body = { + name, + }; + + return await this.apiClient.issuePostRequest( + "/v1/contracts", + body, + requestOptions + ); + } + + /** + * Creates a new asset within an exiting external wallet + * @param walletId The wallet id + * @param assetId The asset to add + * @param address The wallet address + * @param tag (for ripple only) The ripple account tag + * @param requestOptions + */ + public async createExternalWalletAsset( + walletId: string, + assetId: string, + address: string, + tag?: string, + requestOptions?: RequestOptions + ): Promise { + const path = `/v1/external_wallets/${walletId}/${assetId}`; + + const body = { + address: address, + tag: tag, + }; + return await this.apiClient.issuePostRequest(path, body, requestOptions); + } + + /** + * Creates a new asset within an exiting internal wallet + * @param walletId The wallet id + * @param assetId The asset to add + * @param address The wallet address + * @param tag (for ripple only) The ripple account tag + * @param requestOptions + */ + public async createInternalWalletAsset( + walletId: string, + assetId: string, + address: string, + tag?: string, + requestOptions?: RequestOptions + ): Promise { + const path = `/v1/internal_wallets/${walletId}/${assetId}`; + + const body = { + address: address, + tag: tag, + }; + return await this.apiClient.issuePostRequest(path, body, requestOptions); + } + + /** + * Creates a new asset within an exiting contract wallet + * @param walletId The wallet id + * @param assetId The asset to add + * @param address The wallet address + * @param tag (for ripple only) The ripple account tag + */ + public async createContractWalletAsset( + walletId: string, + assetId: string, + address: string, + tag?: string, + requestOptions?: RequestOptions + ): Promise { + const path = `/v1/contracts/${walletId}/${assetId}`; + + const body = { + address: address, + tag: tag, + }; + return await this.apiClient.issuePostRequest(path, body, requestOptions); + } + + /** + * Creates a new transaction with the specified options + */ + public async createTransaction( + transactionArguments: TransactionArguments, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + "/v1/transactions", + transactionArguments, + requestOptions + ); + } + + /** + * Estimates the fee for a transaction request + */ + public async estimateFeeForTransaction( + transactionArguments: TransactionArguments, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + "/v1/transactions/estimate_fee", + transactionArguments, + requestOptions + ); + } + + /** + * Gets the estimated fees for an asset + */ + public async getFeeForAsset(asset: string): Promise { + return await this.apiClient.issueGetRequest( + `/v1/estimate_network_fee?assetId=${asset}` + ); + } + + /** + * Creates a new transfer ticket + */ + public async createTransferTicket( + options: CreateTransferTicketArgs, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + "/v1/transfer_tickets", + options, + requestOptions + ); + } + + /** + * Gets all transfer tickets + */ + public async getTransferTickets(): Promise { + return await this.apiClient.issueGetRequest("/v1/transfer_tickets"); + } + + /** + * Get a transfer ticket by ticket ID + * @param ticketId + */ + public async getTransferTicketById( + ticketId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/transfer_tickets/${ticketId}` + ); + } + + /** + * Get a term of transfer ticket + * @param ticketId + * @param termId + */ + public async getTransferTicketTerm( + ticketId: string, + termId: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/transfer_tickets/${ticketId}/${termId}` + ); + } + + /** + * Cancel the transfer ticket + * @param ticketId + * @param requestOptions + */ + public async cancelTransferTicket( + ticketId: string, + requestOptions?: RequestOptions + ) { + return await this.apiClient.issuePostRequest( + `/v1/transfer_tickets/${ticketId}/cancel`, + {}, + requestOptions + ); + } + + /** + * Executes a transaction for a single term of a transfer ticket + * @param ticketId + * @param termId + * @param options + * @param requestOptions + */ + public async executeTransferTicketTerm( + ticketId: string, + termId: string, + options: ExecuteTermArgs, + requestOptions?: RequestOptions + ) { + return await this.apiClient.issuePostRequest( + `/v1/transfer_tickets/${ticketId}/${termId}/transfer`, + options, + requestOptions + ); + } + + /** + * Deletes a single internal wallet + * @param walletId The internal wallet ID + */ + public async deleteInternalWallet( + walletId: string + ): Promise { + return await this.apiClient.issueDeleteRequest( + `/v1/internal_wallets/${walletId}` + ); + } + + /** + * Deletes a single internal wallet asset + * @param walletId The internal wallet ID + * @param assetId The asset ID + */ + public async deleteInternalWalletAsset( + walletId: string, + assetId: string + ): Promise { + return await this.apiClient.issueDeleteRequest( + `/v1/internal_wallets/${walletId}/${assetId}` + ); + } + + /** + * Deletes a single external wallet + * @param walletId The external wallet ID + */ + public async deleteExternalWallet( + walletId: string + ): Promise { + return await this.apiClient.issueDeleteRequest( + `/v1/external_wallets/${walletId}` + ); + } + + /** + * Deletes a single external wallet asset + * @param walletId The external wallet ID + * @param assetId The asset ID + */ + public async deleteExternalWalletAsset( + walletId: string, + assetId: string + ): Promise { + return await this.apiClient.issueDeleteRequest( + `/v1/external_wallets/${walletId}/${assetId}` + ); + } + + /** + * Deletes a single contract wallet + * @param walletId The contract wallet ID + */ + public async deleteContractWallet( + walletId: string + ): Promise { + return await this.apiClient.issueDeleteRequest(`/v1/contracts/${walletId}`); + } + + /** + * Deletes a single contract wallet asset + * @param walletId The contract wallet ID + * @param assetId The asset ID + */ + public async deleteContractWalletAsset( + walletId: string, + assetId: string + ): Promise { + return await this.apiClient.issueDeleteRequest( + `/v1/contracts/${walletId}/${assetId}` + ); + } + + /** + * Sets a customer reference ID + * @param vaultAccountId The vault account ID + * @param customerRefId The customer reference ID to set + * @param requestOptions + */ + public async setCustomerRefIdForVaultAccount( + vaultAccountId: string, + customerRefId: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/vault/accounts/${vaultAccountId}/set_customer_ref_id`, + { customerRefId }, + requestOptions + ); + } + + /** + * Sets a customer reference ID + * @param walletId The ID of the internal wallet + * @param customerRefId The customer reference ID to set + * @param requestOptions + */ + public async setCustomerRefIdForInternalWallet( + walletId: string, + customerRefId: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/internal_wallets/${walletId}/set_customer_ref_id`, + { customerRefId }, + requestOptions + ); + } + + /** + * Sets a customer reference ID + * @param walletId The ID of the external wallet + * @param customerRefId The customer reference ID to set + * @param requestOptions + */ + public async setCustomerRefIdForExternalWallet( + walletId: string, + customerRefId: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/external_wallets/${walletId}/set_customer_ref_id`, + { customerRefId }, + requestOptions + ); + } + + /** + * Sets a customer reference ID + * @param vaultAccountId The vault account ID + * @param assetId The ID of the asset + * @param address The address + * @param tag The XRP tag, or EOS memo + * @param customerRefId The customer reference ID to set + * @param requestOptions + */ + public async setCustomerRefIdForAddress( + vaultAccountId: string, + assetId: string, + address: string, + tag?: string, + customerRefId?: string, + requestOptions?: RequestOptions + ): Promise { + let addressId = address; + if (tag && tag.length > 0) { + addressId = `${address}:${tag}`; + } + + return await this.apiClient.issuePostRequest( + `/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses/${addressId}/set_customer_ref_id`, + { customerRefId }, + requestOptions + ); + } + + /** + * Set the required number of confirmations for transaction + * @param txId + * @param requiredConfirmationsNumber + * @param requestOptions + */ + public async setConfirmationThresholdForTxId( + txId: string, + requiredConfirmationsNumber: number, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/transactions/${txId}/set_confirmation_threshold`, + { numOfConfirmations: requiredConfirmationsNumber }, + requestOptions + ); + } + + /** + * Set the required number of confirmations for transactions by tx hash + * @param txHash + * @param requiredConfirmationsNumber + * @param requestOptions + */ + public async setConfirmationThresholdForTxHash( + txHash: string, + requiredConfirmationsNumber: number, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/txHash/${txHash}/set_confirmation_threshold`, + { numOfConfirmations: requiredConfirmationsNumber }, + requestOptions + ); + } + + /** + * Get the public key information + * @param args + */ + public async getPublicKeyInfo(args: PublicKeyInfoArgs) { + let url = `/v1/vault/public_key_info`; + if (args.algorithm) { + url += `?algorithm=${args.algorithm}`; + } + if (args.derivationPath) { + url += `&derivationPath=${args.derivationPath}`; + } + if (args.compressed) { + url += `&compressed=${args.compressed}`; + } + return await this.apiClient.issueGetRequest(url); + } + + /** + * allocate funds from you default balance to a private ledger + * @param vaultAccountId + * @param asset + * @param vaultAccountId + * @param asset + * @param args + * @param requestOptions + */ + public async allocateFundsToPrivateLedger( + vaultAccountId: string, + asset: string, + args: AllocateFundsRequest, + requestOptions?: RequestOptions + ) { + const url = `/v1/vault/accounts/${vaultAccountId}/${asset}/lock_allocation`; + return await this.apiClient.issuePostRequest(url, args, requestOptions); + } + + /** + * deallocate funds from a private ledger to your default balance + * @param vaultAccountId + * @param asset + * @param args + * @param requestOptions + */ + public async deallocateFundsFromPrivateLedger( + vaultAccountId: string, + asset: string, + args: DeallocateFundsRequest, + requestOptions?: RequestOptions + ) { + const url = `/v1/vault/accounts/${vaultAccountId}/${asset}/release_allocation`; + return await this.apiClient.issuePostRequest(url, args, requestOptions); + } + + /** + * Get the public key information for a vault account + * @param args + */ + public async getPublicKeyInfoForVaultAccount( + args: PublicKeyInfoForVaultAccountArgs + ) { + let url = `/v1/vault/accounts/${args.vaultAccountId}/${args.assetId}/${args.change}/${args.addressIndex}/public_key_info`; + if (args.compressed) { + url += `?compressed=${args.compressed}`; + } + return await this.apiClient.issueGetRequest(url); + } + + /** + * Get configuration and status of the Gas Station account + */ + public async getGasStationInfo(assetId?: string): Promise { + let url = `/v1/gas_station`; + + if (assetId) { + url += `/${assetId}`; + } + + return await this.apiClient.issueGetRequest(url); + } + + /** + * Set configuration of the Gas Station account + */ + public async setGasStationConfiguration( + gasThreshold: string, + gasCap: string, + maxGasPrice?: string, + assetId?: string + ): Promise { + let url = `/v1/gas_station/configuration`; + + if (assetId) { + url += `/${assetId}`; + } + + const body = { gasThreshold, gasCap, maxGasPrice }; + + return await this.apiClient.issuePutRequest(url, body); + } + + /** + * Drop an ETH based transaction + */ + public async dropTransaction( + txId: string, + feeLevel?: string, + requestedFee?: string, + requestOptions?: RequestOptions + ) { + const url = `/v1/transactions/${txId}/drop`; + + const body = { feeLevel, requestedFee }; + + return await this.apiClient.issuePostRequest(url, body, requestOptions); + } + + /** + * Get max spendable amount per asset and vault + */ + public async getMaxSpendableAmount( + vaultAccountId: string, + assetId: string, + manualSigning?: Boolean + ): Promise { + let url = `/v1/vault/accounts/${vaultAccountId}/${assetId}/max_spendable_amount`; + + if (manualSigning) { + url += `?manualSigning=${manualSigning}`; + } + + return await this.apiClient.issueGetRequest(url); + } + + /** + * Get all vault assets balance overview + */ + public async getVaultAssetsBalance( + filter: VaultBalancesFilter + ): Promise { + const url = `/v1/vault/assets?${queryString.stringify(filter)}`; + + return await this.apiClient.issueGetRequest(url); + } + + /** + * Get vault balance overview per asset + */ + public async getVaultBalanceByAsset(assetId: string): Promise { + const url = `/v1/vault/assets/${assetId}`; + return await this.apiClient.issueGetRequest(url); + } + + /** + * Get address validation info + */ + public async validateAddress( + assetId: string, + address: string + ): Promise { + const url = `/v1/transactions/validate_address/${assetId}/${address}`; + return await this.apiClient.issueGetRequest(url); + } + + /** + * Unfreezes the selected transaction + * @param txId The transaction id to unfreeze + * @param requestOptions + */ + public async unfreezeTransactionById( + txId: string, + requestOptions?: RequestOptions + ): Promise { + return this.apiClient.issuePostRequest( + `/v1/transactions/${txId}/unfreeze`, + {}, + requestOptions + ); + } + + /** + * Freezes the selected transaction + * @param txId The transaction id to freeze + * @param requestOptions + */ + public async freezeTransactionById( + txId: string, + requestOptions?: RequestOptions + ): Promise { + return this.apiClient.issuePostRequest( + `/v1/transactions/${txId}/freeze`, + {}, + requestOptions + ); + } + + /** + * Resend failed webhooks + */ + public async resendWebhooks( + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + "/v1/webhooks/resend", + {}, + requestOptions + ); + } + + /** + * Resend transaction webhooks + * @param txId The transaction for which the message is sent + * @param resendCreated If true a webhook will be sent for the creation of the transaction + * @param resendStatusUpdated If true a webhook will be sent for the status of the transaction + * @param requestOptions + */ + public async resendTransactionWebhooksById( + txId: string, + resendCreated?: boolean, + resendStatusUpdated?: boolean, + requestOptions?: RequestOptions + ): Promise { + const body = { resendCreated, resendStatusUpdated }; + return await this.apiClient.issuePostRequest( + `/v1/webhooks/resend/${txId}`, + body, + requestOptions + ); + } + + /** + * Gets all Users for your tenant + */ + public async getUsers(): Promise { + return await this.apiClient.issueGetRequest("/v1/users"); + } + + /** + * Get off exchange accounts + */ + public async getOffExchangeAccounts(): Promise { + return await this.apiClient.issueGetRequest(`/v1/off_exchange_accounts`); + } + + /** + * Get off exchange account by virtual account id + * @param id the ID of the off exchange + */ + public async getOffExchangeAccountById( + id: string + ): Promise { + return await this.apiClient.issueGetRequest( + `/v1/off_exchange_accounts/${id}` + ); + } + + /** + * Settle off exchange account by virtual account id + * @param id the ID of the off exchange + * @param requestOptions + */ + public async settleOffExchangeAccountById( + id: string, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/off_exchange_accounts/${id}/settle`, + {}, + requestOptions + ); + } + + /** + * Set Fee Payer configuration + * @param feePayerConfiguration + * @param baseAsset + * @param requestOptions + */ + public async setFeePayerConfiguration( + baseAsset: string, + feePayerConfiguration: SetFeePayerConfiguration, + requestOptions?: RequestOptions + ): Promise { + return await this.apiClient.issuePostRequest( + `/v1/fee_payer/${baseAsset}`, + feePayerConfiguration, + requestOptions + ); + } + + /** + * Get Fee Payer Configuration + * @param baseAsset + */ + public async getFeePayerConfiguration( + baseAsset: string + ): Promise { + return await this.apiClient.issueGetRequest(`/v1/fee_payer/${baseAsset}`); + } + + /** + * Delete Fee Payer Configuration + * @param baseAsset + */ + public async removeFeePayerConfiguration(baseAsset: string): Promise { + return await this.apiClient.issueDeleteRequest( + `/v1/fee_payer/${baseAsset}` + ); + } } diff --git a/src/types.ts b/src/types.ts index 87839611..843ca27c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,705 +1,726 @@ export interface VaultAccountResponse { - id: string; - name: string; - hiddenOnUI: boolean; - assets: AssetResponse[]; - customerRefId?: string; - autoFuel: boolean; + id: string; + name: string; + hiddenOnUI: boolean; + assets: AssetResponse[]; + customerRefId?: string; + autoFuel: boolean; } export enum VirtualAffiliation { - OFF_EXCHANGE = "OFF_EXCHANGE", - DEFAULT = "DEFAULT" + OFF_EXCHANGE = "OFF_EXCHANGE", + DEFAULT = "DEFAULT", } export interface BalanceRewardInfo { - pendingRewards: string; + pendingRewards: string; } export interface AssetResponse { - id: string; + id: string; + total: string; + /** + * @deprecated Replaced by "total" + */ + balance?: string; + lockedAmount?: string; + available: string; + pending: string; + selfStakedCPU?: string; + selfStakedNetwork?: string; + pendingRefundCPU?: string; + pendingRefundNetwork?: string; + totalStakedCPU?: string; + totalStakedNetwork?: string; + rewardInfo?: BalanceRewardInfo; + blockHeight?: string; + blockHash?: string; + allocatedBalances?: { + allocationId: string; + thirdPartyAccountId?: string; + affiliation?: VirtualAffiliation; + virtualType?: VirtualType; total: string; - /** - * @deprecated Replaced by "total" - */ - balance?: string; - lockedAmount?: string; available: string; - pending: string; - selfStakedCPU?: string; - selfStakedNetwork?: string; - pendingRefundCPU?: string; - pendingRefundNetwork?: string; - totalStakedCPU?: string; - totalStakedNetwork?: string; - rewardInfo?: BalanceRewardInfo; - blockHeight?: string; - blockHash?: string; - allocatedBalances?: { - allocationId: string; - thirdPartyAccountId?: string; - affiliation?: VirtualAffiliation; - virtualType?: VirtualType; - total: string; - available: string; - pending?: string; - frozen?: string; - locked?: string; - }[]; + pending?: string; + frozen?: string; + locked?: string; + }[]; } export interface UnfreezeTransactionResponse { - success: boolean; + success: boolean; } export interface VaultAssetResponse { - id: string; - address: string; - legacyAddress: string; - enterpriseAddress?: string; - tag: string; - eosAccountName: string; - status?: VaultAssetActivationStatus; - activationTxId?: string; + id: string; + address: string; + legacyAddress: string; + enterpriseAddress?: string; + tag: string; + eosAccountName: string; + status?: VaultAssetActivationStatus; + activationTxId?: string; } export enum VaultAssetActivationStatus { - PENDING_ACTIVATION = "PENDING_ACTIVATION", - ACTIVATION_FAILED = "ACTIVATION_FAILED", - READY = "READY" + PENDING_ACTIVATION = "PENDING_ACTIVATION", + ACTIVATION_FAILED = "ACTIVATION_FAILED", + READY = "READY", } export interface WalletContainerResponse { - id: string; - name: string; - assets: WalletAssetType[]; - customerRefId?: string; + id: string; + name: string; + assets: WalletAssetType[]; + customerRefId?: string; } export interface ExternalWalletAsset { - id: string; - status: string; - address: string; - tag: string; - activationTime?: string; + id: string; + status: string; + address: string; + tag: string; + activationTime?: string; } export interface InternalWalletAsset extends ExternalWalletAsset { - balance: string; + balance: string; } export interface CreateTransactionResponse { - id: string; - status: string; + id: string; + status: string; } export interface EstimateFeeResponse { - low: EstimatedFee; - medium: EstimatedFee; - high: EstimatedFee; + low: EstimatedFee; + medium: EstimatedFee; + high: EstimatedFee; } export interface EstimateTransactionFeeResponse { - low: EstimatedTransactionFee; - medium: EstimatedTransactionFee; - high: EstimatedTransactionFee; + low: EstimatedTransactionFee; + medium: EstimatedTransactionFee; + high: EstimatedTransactionFee; } export interface EstimatedFee { - networkFee?: string; - gasPrice?: string; - feePerByte?: string; - baseFee?: string; - priorityFee?: string; + networkFee?: string; + gasPrice?: string; + feePerByte?: string; + baseFee?: string; + priorityFee?: string; } export interface EstimatedTransactionFee { - networkFee?: string; - gasPrice?: string; - gasLimit?: string; - feePerByte?: string; - baseFee?: string; - priorityFee?: string; + networkFee?: string; + gasPrice?: string; + gasLimit?: string; + feePerByte?: string; + baseFee?: string; + priorityFee?: string; } export interface TransferPeerPath { - type?: PeerType; - id?: string; - virtualId?: string; - virtualType?: VirtualType; - address?: string; + type?: PeerType; + id?: string; + virtualId?: string; + virtualType?: VirtualType; + address?: string; } export interface DestinationTransferPeerPath { - type: PeerType; - id?: string; - virtualId?: string; - virtualType?: VirtualType; - oneTimeAddress?: IOneTimeAddress; + type: PeerType; + id?: string; + virtualId?: string; + virtualType?: VirtualType; + oneTimeAddress?: IOneTimeAddress; } export interface IOneTimeAddress { - address: string; - tag?: string; + address: string; + tag?: string; } export interface DepositAddressResponse { - assetId: string; - address: string; - tag?: string; - description?: string; - type: string; - customerRefId?: string; - addressFormat: string; - legacyAddress?: string; - enterpriseAddress?: string; + assetId: string; + address: string; + tag?: string; + description?: string; + type: string; + customerRefId?: string; + addressFormat: string; + legacyAddress?: string; + enterpriseAddress?: string; } export interface GenerateAddressResponse { - address: string; - tag?: string; - legacyAddress?: string; - enterpriseAddress?: string; + address: string; + tag?: string; + legacyAddress?: string; + enterpriseAddress?: string; } export enum SigningAlgorithm { - MPC_ECDSA_SECP256K1 = "MPC_ECDSA_SECP256K1", - MPC_ECDSA_SECP256R1 = "MPC_ECDSA_SECP256R1", - MPC_EDDSA_ED25519 = "MPC_EDDSA_ED25519" + MPC_ECDSA_SECP256K1 = "MPC_ECDSA_SECP256K1", + MPC_ECDSA_SECP256R1 = "MPC_ECDSA_SECP256R1", + MPC_EDDSA_ED25519 = "MPC_EDDSA_ED25519", } export interface RawMessageData { - messages: RawMessage[]; - algorithm?: SigningAlgorithm; + messages: RawMessage[]; + algorithm?: SigningAlgorithm; } export interface RawMessage { - content: string; - bip44addressIndex?: number; - bip44change?: number; - derivationPath?: number[]; + content: string; + bip44addressIndex?: number; + bip44change?: number; + derivationPath?: number[]; } export interface TransactionDestination { - amount: string | number; - destination: DestinationTransferPeerPath; + amount: string | number; + destination: DestinationTransferPeerPath; } export interface TransactionArgumentsFeePayerInfo { - feePayerAccountId: string; + feePayerAccountId: string; } export interface TransactionArguments { - assetId?: string; - source?: TransferPeerPath; - destination?: DestinationTransferPeerPath; - amount?: number | string; - operation?: TransactionOperation; - fee?: number | string; - feeLevel?: FeeLevel; - failOnLowFee?: boolean; - maxFee?: string; - priorityFee?: number | string; - gasPrice?: number | string; - gasLimit?: number | string; - note?: string; - cpuStaking?: number; - networkStaking?: number; - autoStaking?: boolean; - customerRefId?: string; - extraParameters?: object; - destinations?: TransactionDestination[]; - replaceTxByHash?: string; - externalTxId?: string; - treatAsGrossAmount?: boolean; - forceSweep?: boolean; - feePayerInfo?: TransactionArgumentsFeePayerInfo; + assetId?: string; + source?: TransferPeerPath; + destination?: DestinationTransferPeerPath; + amount?: number | string; + operation?: TransactionOperation; + fee?: number | string; + feeLevel?: FeeLevel; + failOnLowFee?: boolean; + maxFee?: string; + priorityFee?: number | string; + gasPrice?: number | string; + gasLimit?: number | string; + note?: string; + cpuStaking?: number; + networkStaking?: number; + autoStaking?: boolean; + customerRefId?: string; + extraParameters?: object; + destinations?: TransactionDestination[]; + replaceTxByHash?: string; + externalTxId?: string; + treatAsGrossAmount?: boolean; + forceSweep?: boolean; + feePayerInfo?: TransactionArgumentsFeePayerInfo; } export enum FeeLevel { - HIGH = "HIGH", - MEDIUM = "MEDIUM", - LOW = "LOW" + HIGH = "HIGH", + MEDIUM = "MEDIUM", + LOW = "LOW", } export interface ExchangeResponse { - id: string; - type: string; - name: string; - assets: AssetResponse[]; - isSubaccount: boolean; - status: string; + id: string; + type: string; + name: string; + assets: AssetResponse[]; + isSubaccount: boolean; + status: string; } export interface ConvertExchangeAssetResponse { - status: boolean; + status: boolean; +} + +export interface InternalTransferExchangeAssetResponse { + status: boolean; } export interface FiatAccountResponse { - id: string; - type: string; - name: string; - address?: string; - assets: AssetResponse[]; + id: string; + type: string; + name: string; + address?: string; + assets: AssetResponse[]; } export interface TransactionPageResponse { - transactions: TransactionResponse[]; - pageDetails: PageDetails; + transactions: TransactionResponse[]; + pageDetails: PageDetails; } export interface PageDetails { - prevPage: string; - nextPage: string; + prevPage: string; + nextPage: string; } export interface RewardInfo { - srcRewards?: string; - destRewards?: string; + srcRewards?: string; + destRewards?: string; } export interface FeePayerInfo { - feePayerAccountId?: string; + feePayerAccountId?: string; } export interface TransactionResponse { - id: string; - assetId: string; - source: TransferPeerPathResponse; - destination: TransferPeerPathResponse; - amount: number; - /** - * @deprecated Replaced by "networkFee" - */ - fee?: number; - networkFee: number; - amountUSD: number; - netAmount: number; - createdAt: number; - lastUpdated: number; - status: TransactionStatus; - txHash: string; - numOfConfirmations?: number; - subStatus?: string; - signedBy: string[]; - createdBy: string; - rejectedBy: string; - destinationAddress: string; - sourceAddress?: string; - destinationAddressDescription?: string; - destinationTag: string; - addressType: string; - note: string; - exchangeTxId: string; - requestedAmount: number; - serviceFee?: number; - feeCurrency: string; - amlScreeningResult?: AmlScreeningResult; - customerRefId?: string; - amountInfo?: AmountInfo; - feeInfo?: FeeInfo; - signedMessages?: SignedMessageResponse[]; - extraParameters?: any; - externalTxId?: string; - destinations?: TransactionResponseDestination[]; - blockInfo?: BlockInfo; - authorizationInfo?: AuthorizationInfo; - index?: number; - rewardInfo?: RewardInfo; - feePayerInfo?: FeePayerInfo; + id: string; + assetId: string; + source: TransferPeerPathResponse; + destination: TransferPeerPathResponse; + amount: number; + /** + * @deprecated Replaced by "networkFee" + */ + fee?: number; + networkFee: number; + amountUSD: number; + netAmount: number; + createdAt: number; + lastUpdated: number; + status: TransactionStatus; + txHash: string; + numOfConfirmations?: number; + subStatus?: string; + signedBy: string[]; + createdBy: string; + rejectedBy: string; + destinationAddress: string; + sourceAddress?: string; + destinationAddressDescription?: string; + destinationTag: string; + addressType: string; + note: string; + exchangeTxId: string; + requestedAmount: number; + serviceFee?: number; + feeCurrency: string; + amlScreeningResult?: AmlScreeningResult; + customerRefId?: string; + amountInfo?: AmountInfo; + feeInfo?: FeeInfo; + signedMessages?: SignedMessageResponse[]; + extraParameters?: any; + externalTxId?: string; + destinations?: TransactionResponseDestination[]; + blockInfo?: BlockInfo; + authorizationInfo?: AuthorizationInfo; + index?: number; + rewardInfo?: RewardInfo; + feePayerInfo?: FeePayerInfo; } export interface AmountInfo { - amount?: string; - requestedAmount?: string; - netAmount?: string; - amountUSD?: string; + amount?: string; + requestedAmount?: string; + netAmount?: string; + amountUSD?: string; } export interface FeeInfo { - networkFee?: string; - serviceFee?: string; - gasPrice?: string; + networkFee?: string; + serviceFee?: string; + gasPrice?: string; } export interface TransactionResponseDestination { - amount?: string; - amountUSD?: string; - amlScreeningResult?: AmlScreeningResult; - destination?: TransferPeerPathResponse; - authorizationInfo?: AuthorizationInfo; + amount?: string; + amountUSD?: string; + amlScreeningResult?: AmlScreeningResult; + destination?: TransferPeerPathResponse; + authorizationInfo?: AuthorizationInfo; } export interface AmlScreeningResult { - provider?: string; - payload: any; - screeningStatus: string; - bypassReason: string; - timestamp: number; + provider?: string; + payload: any; + screeningStatus: string; + bypassReason: string; + timestamp: number; } export interface TransferPeerPathResponse { - id: string; - type: PeerType; - name?: string; - subType?: string; - virtualType?: VirtualType; - virtualId?: string; + id: string; + type: PeerType; + name?: string; + subType?: string; + virtualType?: VirtualType; + virtualId?: string; } export interface AuthorizationInfo { - allowOperatorAsAuthorizer: boolean; - logic: "OR" | "AND"; - groups: { - users: UserGroup; - th: number - }[]; + allowOperatorAsAuthorizer: boolean; + logic: "OR" | "AND"; + groups: { + users: UserGroup; + th: number; + }[]; } export interface UserGroup { - [id: string]: string; + [id: string]: string; } export interface BlockInfo { - blockHeight?: string; - blockHash?: string; + blockHeight?: string; + blockHash?: string; } export interface SignedMessageResponse { - content: string; - algorithm: string; - derivationPath: string; - signature: { - fullSig: string; - r?: string; - s?: string; - v?: number; - }; - publicKey: string; + content: string; + algorithm: string; + derivationPath: string; + signature: { + fullSig: string; + r?: string; + s?: string; + v?: number; + }; + publicKey: string; } export interface CancelTransactionResponse { - success: boolean; + success: boolean; } export interface OperationSuccessResponse { - success: boolean; + success: boolean; } export interface NetworkConnectionResponse { - id: string; - status: string; - remoteNetworkId: NetworkId; - localNetworkId: NetworkId; - routingPolicy?: RoutingPolicy; + id: string; + status: string; + remoteNetworkId: NetworkId; + localNetworkId: NetworkId; + routingPolicy?: RoutingPolicy; } interface NetworkId { - id: string; - name: string; + id: string; + name: string; } export interface RoutingPolicy { - crypto?: RoutingDest; - sen?: RoutingDest; - signet?: RoutingDest; - sen_test?: RoutingDest; - signet_test?: RoutingDest; + crypto?: RoutingDest; + sen?: RoutingDest; + signet?: RoutingDest; + sen_test?: RoutingDest; + signet_test?: RoutingDest; } export interface RoutingDest { - scheme: Scheme; - dstType: NetworkDestType; - dstId: string; + scheme: Scheme; + dstType: NetworkDestType; + dstId: string; } export enum Scheme { - AUTO = "AUTO", - DEFAULT = "DEFAULT", - CUSTOM = "CUSTOM", + AUTO = "AUTO", + DEFAULT = "DEFAULT", + CUSTOM = "CUSTOM", } export enum NetworkDestType { - VAULT_ACCOUNT = "VAULT", - UNMANAGED_WALLET = "UNMANAGED", - EXCHANGE_ACCOUNT = "EXCHANGE", - FIAT_ACCOUNT = "FIAT_ACCOUNT", + VAULT_ACCOUNT = "VAULT", + UNMANAGED_WALLET = "UNMANAGED", + EXCHANGE_ACCOUNT = "EXCHANGE", + FIAT_ACCOUNT = "FIAT_ACCOUNT", } export interface TransactionFilter { - before?: number; - after?: number; - status?: TransactionStatus; - orderBy?: TransactionOrder; - limit?: number; - txHash?: string; - assets?: string; - sourceType?: PeerType; - destType?: PeerType; - sourceId?: string; - destId?: string; + before?: number; + after?: number; + status?: TransactionStatus; + orderBy?: TransactionOrder; + limit?: number; + txHash?: string; + assets?: string; + sourceType?: PeerType; + destType?: PeerType; + sourceId?: string; + destId?: string; } export interface TransactionPageFilter { - before?: number; - after?: number; - status?: TransactionStatus; - limit?: number; - txHash?: string; - assets?: string; - sourceType?: PeerType; - destType?: PeerType; - sourceId?: string; - destId?: string; + before?: number; + after?: number; + status?: TransactionStatus; + limit?: number; + txHash?: string; + assets?: string; + sourceType?: PeerType; + destType?: PeerType; + sourceId?: string; + destId?: string; } export enum TransactionOrder { - CREATED_AT = "createdAt", - LAST_UPDATED = "lastUpdated" + CREATED_AT = "createdAt", + LAST_UPDATED = "lastUpdated", +} + +export declare enum TradingAccountType { + COIN_FUTURES = "COIN_FUTURES", + COIN_MARGINED_SWAP = "COIN_MARGINED_SWAP", + EXCHANGE = "EXCHANGE", + FUNDING = "FUNDING", + FUNDUBLE = "FUNDUBLE", + FUTURES = "FUTURES", + FUTURES_CROSS = "FUTURES_CROSS", + MARGIN = "MARGIN", + MARGIN_CROSS = "MARGIN_CROSS", + OPTIONS = "OPTIONS", + SPOT = "SPOT", + USDT_MARGINED_SWAP_CROSS = "USDT_MARGINED_SWAP_CROSS", + USDT_FUTURES = "USDT_FUTURES", + UNIFIED = "UNIFIED", } export enum TransactionStatus { - SUBMITTED = "SUBMITTED", - QUEUED = "QUEUED", - PENDING_SIGNATURE = "PENDING_SIGNATURE", - PENDING_AUTHORIZATION = "PENDING_AUTHORIZATION", - PENDING_3RD_PARTY_MANUAL_APPROVAL = "PENDING_3RD_PARTY_MANUAL_APPROVAL", - PENDING_3RD_PARTY = "PENDING_3RD_PARTY", - /** - * @deprecated - */ - PENDING = "PENDING", - BROADCASTING = "BROADCASTING", - CONFIRMING = "CONFIRMING", - /** - * @deprecated Replaced by "COMPLETED" - */ - CONFIRMED = "CONFIRMED", - COMPLETED = "COMPLETED", - PENDING_AML_SCREENING = "PENDING_AML_SCREENING", - PARTIALLY_COMPLETED = "PARTIALLY_COMPLETED", - CANCELLING = "CANCELLING", - CANCELLED = "CANCELLED", - REJECTED = "REJECTED", - FAILED = "FAILED", - TIMEOUT = "TIMEOUT", - BLOCKED = "BLOCKED" + SUBMITTED = "SUBMITTED", + QUEUED = "QUEUED", + PENDING_SIGNATURE = "PENDING_SIGNATURE", + PENDING_AUTHORIZATION = "PENDING_AUTHORIZATION", + PENDING_3RD_PARTY_MANUAL_APPROVAL = "PENDING_3RD_PARTY_MANUAL_APPROVAL", + PENDING_3RD_PARTY = "PENDING_3RD_PARTY", + /** + * @deprecated + */ + PENDING = "PENDING", + BROADCASTING = "BROADCASTING", + CONFIRMING = "CONFIRMING", + /** + * @deprecated Replaced by "COMPLETED" + */ + CONFIRMED = "CONFIRMED", + COMPLETED = "COMPLETED", + PENDING_AML_SCREENING = "PENDING_AML_SCREENING", + PARTIALLY_COMPLETED = "PARTIALLY_COMPLETED", + CANCELLING = "CANCELLING", + CANCELLED = "CANCELLED", + REJECTED = "REJECTED", + FAILED = "FAILED", + TIMEOUT = "TIMEOUT", + BLOCKED = "BLOCKED", } export enum PeerType { - VAULT_ACCOUNT = "VAULT_ACCOUNT", - EXCHANGE_ACCOUNT = "EXCHANGE_ACCOUNT", - INTERNAL_WALLET = "INTERNAL_WALLET", - EXTERNAL_WALLET = "EXTERNAL_WALLET", - UNKNOWN = "UNKNOWN", - NETWORK_CONNECTION = "NETWORK_CONNECTION", - FIAT_ACCOUNT = "FIAT_ACCOUNT", - COMPOUND = "COMPOUND", - ONE_TIME_ADDRESS = "ONE_TIME_ADDRESS", - OEC_PARTNER = "OEC_PARTNER" + VAULT_ACCOUNT = "VAULT_ACCOUNT", + EXCHANGE_ACCOUNT = "EXCHANGE_ACCOUNT", + INTERNAL_WALLET = "INTERNAL_WALLET", + EXTERNAL_WALLET = "EXTERNAL_WALLET", + UNKNOWN = "UNKNOWN", + NETWORK_CONNECTION = "NETWORK_CONNECTION", + FIAT_ACCOUNT = "FIAT_ACCOUNT", + COMPOUND = "COMPOUND", + ONE_TIME_ADDRESS = "ONE_TIME_ADDRESS", + OEC_PARTNER = "OEC_PARTNER", } export enum VirtualType { - OFF_EXCHANGE = "OFF_EXCHANGE", - DEFAULT = "DEFAULT", - OEC_FEE_BANK = "OEC_FEE_BANK" + OFF_EXCHANGE = "OFF_EXCHANGE", + DEFAULT = "DEFAULT", + OEC_FEE_BANK = "OEC_FEE_BANK", } export enum TransactionOperation { - TRANSFER = "TRANSFER", - MINT = "MINT", - BURN = "BURN", - SUPPLY_TO_COMPOUND = "SUPPLY_TO_COMPOUND", - REDEEM_FROM_COMPOUND = "REDEEM_FROM_COMPOUND", - RAW = "RAW", - CONTRACT_CALL = "CONTRACT_CALL", - TYPED_MESSAGE = "TYPED_MESSAGE", + TRANSFER = "TRANSFER", + MINT = "MINT", + BURN = "BURN", + SUPPLY_TO_COMPOUND = "SUPPLY_TO_COMPOUND", + REDEEM_FROM_COMPOUND = "REDEEM_FROM_COMPOUND", + RAW = "RAW", + CONTRACT_CALL = "CONTRACT_CALL", + TYPED_MESSAGE = "TYPED_MESSAGE", } export interface AllocateFundsRequest { - allocationId: string; - amount: string; - treatAsGrossAmount?: boolean; + allocationId: string; + amount: string; + treatAsGrossAmount?: boolean; } export interface DeallocateFundsRequest { - allocationId: string; - amount: string; + allocationId: string; + amount: string; } export interface CreateTransferTicketArgs { - externalTicketId: string; - description?: string; - terms: { - networkConnectionId: string; - outgoing: boolean; - asset: string; - amount: string; - note: string; - }[]; + externalTicketId: string; + description?: string; + terms: { + networkConnectionId: string; + outgoing: boolean; + asset: string; + amount: string; + note: string; + }[]; } export enum TransferTicketStatus { - OPEN = "OPEN", - PARTIALLY_FULFILLED = "PARTIALLY_FULFILLED", - FULFILLED = "FULFILLED", - FAILED = "FAILED", - CANCELED = "CANCELED" + OPEN = "OPEN", + PARTIALLY_FULFILLED = "PARTIALLY_FULFILLED", + FULFILLED = "FULFILLED", + FAILED = "FAILED", + CANCELED = "CANCELED", } export enum TransferTicketTermStatus { - OPEN = "OPEN", - FULFILLED = "FULFILLED" + OPEN = "OPEN", + FULFILLED = "FULFILLED", } export interface TransferTicketResponse { - ticketId: string; - externalTicketId: string; - description: string; - status: TransferTicketStatus; - terms: TermResponse[]; + ticketId: string; + externalTicketId: string; + description: string; + status: TransferTicketStatus; + terms: TermResponse[]; } export interface TermResponse { - termId: string; - networkConnectionId: string; - outgoing: boolean; - asset: string; - amount: string; - txIds: string[]; - status: TransferTicketTermStatus; - note: string; + termId: string; + networkConnectionId: string; + outgoing: boolean; + asset: string; + amount: string; + txIds: string[]; + status: TransferTicketTermStatus; + note: string; } export interface ExecuteTermArgs { - source: { - type: string; - id: string; - }; - fee?: number; - gasPrice?: number; + source: { + type: string; + id: string; + }; + fee?: number; + gasPrice?: number; } export interface CreateTransferTicketResponse { - ticketId: string; + ticketId: string; } export interface PublicKeyInfoArgs { - algorithm?: string; - derivationPath?: string; - compressed?: boolean; + algorithm?: string; + derivationPath?: string; + compressed?: boolean; } export interface PublicKeyInfoForVaultAccountArgs { - assetId: string; - vaultAccountId: number; - change: number; - addressIndex: number; - compressed?: boolean; + assetId: string; + vaultAccountId: number; + change: number; + addressIndex: number; + compressed?: boolean; } export interface GasStationInfo { - balance: { [asset: string]: string }; - configuration: { - gasThreshold: string; - gasCap: string; - maxGasPrice: string; - }; + balance: { [asset: string]: string }; + configuration: { + gasThreshold: string; + gasCap: string; + maxGasPrice: string; + }; } export interface PublicKeyResonse { - status: number; - algorithm: string; - derivationPath: number[]; - publicKey: string; + status: number; + algorithm: string; + derivationPath: number[]; + publicKey: string; } export interface MaxSpendableAmountResponse { - maxSpendableAmount: string; + maxSpendableAmount: string; } export interface VaultAccountsFilter { - namePrefix?: string; - nameSuffix?: string; - minAmountThreshold?: number; - assetId?: string; + namePrefix?: string; + nameSuffix?: string; + minAmountThreshold?: number; + assetId?: string; } export interface PagedVaultAccountsRequestFilters { - namePrefix?: string; - nameSuffix?: string; - minAmountThreshold?: number; - assetId?: string; - orderBy?: "ASC" | "DESC"; - limit?: number; // for default and max limit values please see: https://docs.fireblocks.com/api/swagger-ui/#/ - before?: string; - after?: string; + namePrefix?: string; + nameSuffix?: string; + minAmountThreshold?: number; + assetId?: string; + orderBy?: "ASC" | "DESC"; + limit?: number; // for default and max limit values please see: https://docs.fireblocks.com/api/swagger-ui/#/ + before?: string; + after?: string; } export interface PagedVaultAccountsResponse { - accounts: VaultAccountResponse[]; - paging: { - before: string; - after: string; - }; - previousUrl: string; - nextUrl: string; + accounts: VaultAccountResponse[]; + paging: { + before: string; + after: string; + }; + previousUrl: string; + nextUrl: string; } export interface VaultBalancesFilter { - accountNamePrefix?: string; - accountNameSuffix?: string; + accountNamePrefix?: string; + accountNameSuffix?: string; } export interface RequestOptions { - idempotencyKey: string; + idempotencyKey: string; } export interface ValidateAddressResponse { - isValid: boolean; - isActive: boolean; - requiresTag: boolean; + isValid: boolean; + isActive: boolean; + requiresTag: boolean; } export interface AssetTypeResponse { - id: string; - name: string; - type: string; - contractAddress: string; - nativeAsset: string; - decimals?: number; + id: string; + name: string; + type: string; + contractAddress: string; + nativeAsset: string; + decimals?: number; } export interface User { - id: string; - firstName: string; - lastName: string; - email: string; - enabled: boolean; - role: string; + id: string; + firstName: string; + lastName: string; + email: string; + enabled: boolean; + role: string; } export interface ResendWebhooksResponse { - webhooksCount: number; + webhooksCount: number; } export interface OffExchangeEntityResponse { - id: string; - vaultAccountId: string; - thirdPartyAccountId: string; - balance?: { - [assetId: string]: { - total?: string; - locked?: string; - pending?: string; - frozen?: string; - }; + id: string; + vaultAccountId: string; + thirdPartyAccountId: string; + balance?: { + [assetId: string]: { + total?: string; + locked?: string; + pending?: string; + frozen?: string; }; + }; } export interface SetFeePayerConfiguration { - feePayerAccountId: string; + feePayerAccountId: string; } export interface FeePayerConfiguration { - feePayerAccountId: string; + feePayerAccountId: string; }