From f6cb44c47953ca113366437da7480218591dc000 Mon Sep 17 00:00:00 2001 From: Fuxing Loh <4266087+fuxingloh@users.noreply.github.com> Date: Thu, 12 Aug 2021 14:56:39 +0800 Subject: [PATCH] fix WhaleApiClient options to create a new options everytime (#339) --- packages/whale-api-client/src/whale.api.client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/whale-api-client/src/whale.api.client.ts b/packages/whale-api-client/src/whale.api.client.ts index eb76ec436..4534a0cf0 100644 --- a/packages/whale-api-client/src/whale.api.client.ts +++ b/packages/whale-api-client/src/whale.api.client.ts @@ -44,7 +44,7 @@ export interface WhaleApiClientOptions { /** * WhaleApiClient default options */ -export const DefaultOptions: WhaleApiClientOptions = { +const DEFAULT_OPTIONS: WhaleApiClientOptions = { url: 'https://ocean.defichain.com', timeout: 60000, version: version, @@ -78,7 +78,7 @@ export class WhaleApiClient { constructor ( protected readonly options: WhaleApiClientOptions ) { - this.options = Object.assign(DefaultOptions, options ?? {}) + this.options = { ...DEFAULT_OPTIONS, ...options } this.options.url = this.options.url.replace(/\/$/, '') }