From d11255578694264dc1ede0f24013e236c20ac4d2 Mon Sep 17 00:00:00 2001 From: vsiskin Date: Fri, 31 May 2024 17:30:34 +0200 Subject: [PATCH 1/2] add set asset price api --- src/fireblocks-sdk.ts | 11 +++++++++++ src/types.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/fireblocks-sdk.ts b/src/fireblocks-sdk.ts index d4cd0da2..70fd44ed 100644 --- a/src/fireblocks-sdk.ts +++ b/src/fireblocks-sdk.ts @@ -330,6 +330,17 @@ export class FireblocksSDK { public async getSupportedAssets(): Promise { return await this.apiClient.issueGetRequest("/v1/supported_assets"); } + + /** + * Sets asset price + * @param id The asset ID + * @param currency The currency (according to ISO 4217 currency codes) + * @param price The price in currency + */ + public async setAssetPrice(id: string, currency: number, price: string): Promise { + return await this.apiClient.issuePostRequest(`/v1/assets/prices/${id}`, {currency, price}); + } + /** * Gets a list of vault accounts per page matching the given filter or path * @param pagedVaultAccountsRequestFilters Filters for the first request diff --git a/src/types.ts b/src/types.ts index de4f92ee..c18902c9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1375,6 +1375,19 @@ export interface AssetTypeResponse { decimals?: number; } +export interface AssetPriceResponse { + legacyId: string; + lastUpdateAt: number; + currency: number; + price: string; + source: AssetPriceSource; +} + +enum AssetPriceSource { + PUBLIC = "PUBLIC", + PRIVATE = "PRIVATE" +} + export interface User { id: string; firstName: string; From 60f7be3cc1bd8ebef0f1d17de739550437b53d9a Mon Sep 17 00:00:00 2001 From: vsiskin Date: Mon, 3 Jun 2024 12:28:43 +0200 Subject: [PATCH 2/2] change param types for setAssetPrice endpoint --- src/fireblocks-sdk.ts | 4 ++-- src/types.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fireblocks-sdk.ts b/src/fireblocks-sdk.ts index 70fd44ed..85d5659a 100644 --- a/src/fireblocks-sdk.ts +++ b/src/fireblocks-sdk.ts @@ -139,7 +139,7 @@ import { ScreeningSupportedAssetResponse, ScreeningSupportedProviders, RegisterAssetResponse, - UnspentInputsResponse, + UnspentInputsResponse, AssetPriceResponse, } from "./types"; import { AxiosProxyConfig, AxiosResponse, InternalAxiosRequestConfig } from "axios"; import { PIIEncryption } from "./pii-client"; @@ -337,7 +337,7 @@ export class FireblocksSDK { * @param currency The currency (according to ISO 4217 currency codes) * @param price The price in currency */ - public async setAssetPrice(id: string, currency: number, price: string): Promise { + public async setAssetPrice(id: string, currency: string, price: number): Promise { return await this.apiClient.issuePostRequest(`/v1/assets/prices/${id}`, {currency, price}); } diff --git a/src/types.ts b/src/types.ts index c18902c9..c02d1b31 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1378,8 +1378,8 @@ export interface AssetTypeResponse { export interface AssetPriceResponse { legacyId: string; lastUpdateAt: number; - currency: number; - price: string; + currency: string; + price: number; source: AssetPriceSource; }