fireblocks-sdk
Advanced tools
Comparing version 1.8.0 to 1.8.1
@@ -5,7 +5,7 @@ ### Changelog | ||
#### [v1.8.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v1.7.2...v1.8.0) | ||
#### [v1.8.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v1.7.2...v1.8.1) | ||
> 23 November 2021 | ||
- configuration [`b7cec03`](https://github.com/fireblocks/fireblocks-sdk-js/commit/b7cec03ed3c1e144a0063607f72c374eb7524a84) | ||
- add timeout mechanism [`#58`](https://github.com/fireblocks/fireblocks-sdk-js/pull/58) | ||
@@ -12,0 +12,0 @@ #### [v1.7.2](https://github.com/fireblocks/fireblocks-sdk-js/compare/v1.7.1...v1.7.2) |
@@ -6,4 +6,7 @@ import { IAuthProvider } from "./iauth-provider"; | ||
private apiBaseUrl; | ||
private options; | ||
private axiosInstance; | ||
constructor(authProvider: IAuthProvider, apiBaseUrl: string); | ||
constructor(authProvider: IAuthProvider, apiBaseUrl: string, options: { | ||
timeoutInMs?: number; | ||
}); | ||
issueGetRequest(path: string, pageMode?: boolean): Promise<any>; | ||
@@ -10,0 +13,0 @@ issuePostRequest(path: string, body: any, requestOptions?: RequestOptions): Promise<any>; |
@@ -18,5 +18,6 @@ "use strict"; | ||
class ApiClient { | ||
constructor(authProvider, apiBaseUrl) { | ||
constructor(authProvider, apiBaseUrl, options) { | ||
this.authProvider = authProvider; | ||
this.apiBaseUrl = apiBaseUrl; | ||
this.options = options; | ||
this.axiosInstance = axios_1.default.create({ | ||
@@ -33,3 +34,4 @@ baseURL: this.apiBaseUrl | ||
"Authorization": `Bearer ${token}` | ||
} | ||
}, | ||
timeout: this.options.timeoutInMs | ||
}); | ||
@@ -57,3 +59,4 @@ if (pageMode) { | ||
"Idempotency-Key": idempotencyKey | ||
} | ||
}, | ||
timeout: this.options.timeoutInMs | ||
})).data; | ||
@@ -69,3 +72,4 @@ }); | ||
"Authorization": `Bearer ${token}` | ||
} | ||
}, | ||
timeout: this.options.timeoutInMs | ||
})).data; | ||
@@ -81,3 +85,4 @@ }); | ||
"Authorization": `Bearer ${token}` | ||
} | ||
}, | ||
timeout: this.options.timeoutInMs | ||
})).data; | ||
@@ -84,0 +89,0 @@ }); |
import { IAuthProvider } from "./iauth-provider"; | ||
import { VaultAccountResponse, CreateTransactionResponse, TransactionArguments, AssetResponse, ExchangeResponse, TransactionResponse, TransactionFilter, CancelTransactionResponse, WalletContainerResponse, DepositAddressResponse, GenerateAddressResponse, OperationSuccessResponse, NetworkConnectionResponse, FiatAccountResponse, CreateTransferTicketArgs, TransferTicketResponse, TermResponse, ExecuteTermArgs, CreateTransferTicketResponse, EstimateTransactionFeeResponse, EstimateFeeResponse, PublicKeyInfoArgs, PublicKeyInfoForVaultAccountArgs, GasStationInfo, MaxSpendableAmountResponse, VaultAccountsFilter, VaultBalancesFilter, ValidateAddressResponse, CreateVaultAssetResponse, RequestOptions, AllocateFundsRequest, DeallocateFundsRequest, ResendWebhooksResponse, AssetTypeResponse, User, TransactionPageResponse, TransactionPageFilter, InternalWalletAsset, ExternalWalletAsset, OffExchangeEntityResponse } from "./types"; | ||
export * from "./types"; | ||
export interface SDKOptions { | ||
timeoutInMs: number; | ||
} | ||
export declare class FireblocksSDK { | ||
@@ -13,4 +16,6 @@ private authProvider; | ||
* @param apiBaseUrl The fireblocks server URL. Leave empty to use the default server | ||
* @param authProvider | ||
* @param sdkOptions | ||
*/ | ||
constructor(privateKey: string, apiKey: string, apiBaseUrl?: string, authProvider?: IAuthProvider); | ||
constructor(privateKey: string, apiKey: string, apiBaseUrl?: string, authProvider?: IAuthProvider, sdkOptions?: SDKOptions); | ||
/** | ||
@@ -17,0 +22,0 @@ * Gets all assets that are currently supported by Fireblocks |
@@ -36,4 +36,6 @@ "use strict"; | ||
* @param apiBaseUrl The fireblocks server URL. Leave empty to use the default server | ||
* @param authProvider | ||
* @param sdkOptions | ||
*/ | ||
constructor(privateKey, apiKey, apiBaseUrl = "https://api.fireblocks.io", authProvider = undefined) { | ||
constructor(privateKey, apiKey, apiBaseUrl = "https://api.fireblocks.io", authProvider = undefined, sdkOptions) { | ||
this.authProvider = authProvider !== null && authProvider !== void 0 ? authProvider : new api_token_provider_1.ApiTokenProvider(privateKey, apiKey); | ||
@@ -43,3 +45,3 @@ if (apiBaseUrl) { | ||
} | ||
this.apiClient = new api_client_1.ApiClient(this.authProvider, this.apiBaseUrl); | ||
this.apiClient = new api_client_1.ApiClient(this.authProvider, this.apiBaseUrl, { timeoutInMs: sdkOptions === null || sdkOptions === void 0 ? void 0 : sdkOptions.timeoutInMs }); | ||
} | ||
@@ -46,0 +48,0 @@ /** |
{ | ||
"name": "fireblocks-sdk", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"main": "dist/fireblocks-sdk.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/fireblocks-sdk.d.ts", |
@@ -32,1 +32,6 @@ # The Official Javascript & Typescript SDK for Fireblocks API | ||
You can also specify timeout for the http requests: | ||
``` | ||
import { FireblocksSDK } from "fireblocks-sdk"; | ||
const fireblocks = new FireblocksSDK(privateKey, apiKey. undefined, {timeoutInMs: 4000}); | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114798
2087
37