From 027d950f2a521e78da7d45c25ff968e51bb454ac Mon Sep 17 00:00:00 2001 From: amirlevy Date: Sun, 26 Dec 2021 10:25:31 +0200 Subject: [PATCH 1/3] COR-10778 add refresh balance to js sdk --- src/fireblocks-sdk.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/fireblocks-sdk.ts b/src/fireblocks-sdk.ts index fe26ba8d..4f7c4deb 100644 --- a/src/fireblocks-sdk.ts +++ b/src/fireblocks-sdk.ts @@ -115,6 +115,15 @@ export class FireblocksSDK { 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 + */ + public async getVaultAccountAssetWithRefreshBalance(vaultAccountId: string, assetId: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/balance`); + } + /** * Gets deposit addresses for an asset in a vault account * @param vaultAccountId The vault account ID From 3e31ee812d325f4f7cbda65ab892e0d68e12f76c Mon Sep 17 00:00:00 2001 From: amirlevy Date: Sun, 2 Jan 2022 18:05:03 +0200 Subject: [PATCH 2/3] COR-10778 change to POST --- src/fireblocks-sdk.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fireblocks-sdk.ts b/src/fireblocks-sdk.ts index 4f7c4deb..6a98c019 100644 --- a/src/fireblocks-sdk.ts +++ b/src/fireblocks-sdk.ts @@ -120,8 +120,8 @@ export class FireblocksSDK { * @param vaultAccountId The vault account ID * @param assetId The ID of the asset to get */ - public async getVaultAccountAssetWithRefreshBalance(vaultAccountId: string, assetId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/balance`); + public async refreshVaultAssetBalance(vaultAccountId: string, assetId: string): Promise { + return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/balance`, "{}"); } /** From a212e4cbb53ec77fcb7ee687f7323be0fe0352be Mon Sep 17 00:00:00 2001 From: amirlevy Date: Mon, 3 Jan 2022 17:33:12 +0200 Subject: [PATCH 3/3] COR-10778 add idempotency --- src/fireblocks-sdk.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fireblocks-sdk.ts b/src/fireblocks-sdk.ts index 6a98c019..2bb239c3 100644 --- a/src/fireblocks-sdk.ts +++ b/src/fireblocks-sdk.ts @@ -120,8 +120,8 @@ export class FireblocksSDK { * @param vaultAccountId The vault account ID * @param assetId The ID of the asset to get */ - public async refreshVaultAssetBalance(vaultAccountId: string, assetId: string): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/balance`, "{}"); + public async refreshVaultAssetBalance(vaultAccountId: string, assetId: string, requestOptions?: RequestOptions): Promise { + return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/balance`, "{}", requestOptions); } /**